Commit a66099a3 authored by Tony Lindgren's avatar Tony Lindgren

DSP: Clean up memory allocation return values

Clean up memory allocation return values
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 23ed8b5c
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <linux/err.h> #include <linux/err.h>
#include "mmu.h" #include "mmu.h"
#include <asm/tlbflush.h> #include <asm/tlbflush.h>
#include <asm/arch/dsp.h>
#include <asm/arch/dsp_common.h> #include <asm/arch/dsp_common.h>
static void *dspvect_page; static void *dspvect_page;
......
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
#include <asm/arch/dma.h> #include <asm/arch/dma.h>
#include <asm/arch/mux.h> #include <asm/arch/mux.h>
#include <asm/arch/irqs.h> #include <asm/arch/irqs.h>
#include <asm/arch/mcbsp.h>
#include <asm/arch/dsp_common.h> #include <asm/arch/dsp_common.h>
#include <asm/arch/mcbsp.h>
#ifdef CONFIG_MCBSP_DEBUG #ifdef CONFIG_MCBSP_DEBUG
#define DBG(x...) printk(x) #define DBG(x...) printk(x)
...@@ -197,7 +197,14 @@ static int omap_mcbsp_check(unsigned int id) ...@@ -197,7 +197,14 @@ static int omap_mcbsp_check(unsigned int id)
static void omap_mcbsp_dsp_request(void) static void omap_mcbsp_dsp_request(void)
{ {
if (cpu_is_omap15xx() || cpu_is_omap16xx()) { if (cpu_is_omap15xx() || cpu_is_omap16xx()) {
omap_dsp_request_mem(); int ret;
ret = omap_dsp_request_mem();
if (ret < 0) {
printk(KERN_ERR "Could not get dsp memory: %i\n", ret);
return;
}
clk_enable(mcbsp_dsp_ck); clk_enable(mcbsp_dsp_ck);
clk_enable(mcbsp_api_ck); clk_enable(mcbsp_api_ck);
......
...@@ -588,9 +588,12 @@ int omap_mmu_load_tlb_entry(struct omap_mmu *mmu, ...@@ -588,9 +588,12 @@ int omap_mmu_load_tlb_entry(struct omap_mmu *mmu,
{ {
struct omap_mmu_tlb_lock lock; struct omap_mmu_tlb_lock lock;
struct cam_ram_regset *cr; struct cam_ram_regset *cr;
int ret;
clk_enable(mmu->clk); clk_enable(mmu->clk);
omap_dsp_request_mem(); ret = omap_dsp_request_mem();
if (ret < 0)
goto out;
omap_mmu_get_tlb_lock(mmu, &lock); omap_mmu_get_tlb_lock(mmu, &lock);
for (lock.victim = 0; lock.victim < lock.base; lock.victim++) { for (lock.victim = 0; lock.victim < lock.base; lock.victim++) {
...@@ -624,6 +627,7 @@ found_victim: ...@@ -624,6 +627,7 @@ found_victim:
omap_mmu_set_tlb_lock(mmu, &lock); omap_mmu_set_tlb_lock(mmu, &lock);
omap_dsp_release_mem(); omap_dsp_release_mem();
out:
clk_disable(mmu->clk); clk_disable(mmu->clk);
return 0; return 0;
} }
...@@ -638,11 +642,13 @@ omap_mmu_cam_va(struct omap_mmu *mmu, struct cam_ram_regset *cr) ...@@ -638,11 +642,13 @@ omap_mmu_cam_va(struct omap_mmu *mmu, struct cam_ram_regset *cr)
int omap_mmu_clear_tlb_entry(struct omap_mmu *mmu, unsigned long vadr) int omap_mmu_clear_tlb_entry(struct omap_mmu *mmu, unsigned long vadr)
{ {
struct omap_mmu_tlb_lock lock; struct omap_mmu_tlb_lock lock;
int i; int i, ret = 0;
int max_valid = 0; int max_valid = 0;
clk_enable(mmu->clk); clk_enable(mmu->clk);
omap_dsp_request_mem(); ret = omap_dsp_request_mem();
if (ret < 0)
goto out;
omap_mmu_get_tlb_lock(mmu, &lock); omap_mmu_get_tlb_lock(mmu, &lock);
for (i = 0; i < lock.base; i++) { for (i = 0; i < lock.base; i++) {
...@@ -666,23 +672,28 @@ int omap_mmu_clear_tlb_entry(struct omap_mmu *mmu, unsigned long vadr) ...@@ -666,23 +672,28 @@ int omap_mmu_clear_tlb_entry(struct omap_mmu *mmu, unsigned long vadr)
omap_mmu_set_tlb_lock(mmu, &lock); omap_mmu_set_tlb_lock(mmu, &lock);
omap_dsp_release_mem(); omap_dsp_release_mem();
out:
clk_disable(mmu->clk); clk_disable(mmu->clk);
return 0; return ret;
} }
EXPORT_SYMBOL_GPL(omap_mmu_clear_tlb_entry); EXPORT_SYMBOL_GPL(omap_mmu_clear_tlb_entry);
static void omap_mmu_gflush(struct omap_mmu *mmu) static void omap_mmu_gflush(struct omap_mmu *mmu)
{ {
struct omap_mmu_tlb_lock lock; struct omap_mmu_tlb_lock lock;
int ret;
clk_enable(mmu->clk); clk_enable(mmu->clk);
omap_dsp_request_mem(); ret = omap_dsp_request_mem();
if (ret < 0)
goto out;
omap_mmu_write_reg(mmu, 0x1, OMAP_MMU_GFLUSH); omap_mmu_write_reg(mmu, 0x1, OMAP_MMU_GFLUSH);
lock.base = lock.victim = mmu->nr_exmap_preserved; lock.base = lock.victim = mmu->nr_exmap_preserved;
omap_mmu_set_tlb_lock(mmu, &lock); omap_mmu_set_tlb_lock(mmu, &lock);
omap_dsp_release_mem(); omap_dsp_release_mem();
out:
clk_disable(mmu->clk); clk_disable(mmu->clk);
} }
...@@ -1073,7 +1084,10 @@ static int omap_mmu_init(struct omap_mmu *mmu) ...@@ -1073,7 +1084,10 @@ static int omap_mmu_init(struct omap_mmu *mmu)
int ret = 0; int ret = 0;
clk_enable(mmu->clk); clk_enable(mmu->clk);
omap_dsp_request_mem(); ret = omap_dsp_request_mem();
if (ret < 0)
goto out;
down_write(&mmu->exmap_sem); down_write(&mmu->exmap_sem);
ret = request_irq(mmu->irq, omap_mmu_interrupt, IRQF_DISABLED, ret = request_irq(mmu->irq, omap_mmu_interrupt, IRQF_DISABLED,
...@@ -1093,9 +1107,10 @@ static int omap_mmu_init(struct omap_mmu *mmu) ...@@ -1093,9 +1107,10 @@ static int omap_mmu_init(struct omap_mmu *mmu)
if (unlikely(mmu->ops->startup)) if (unlikely(mmu->ops->startup))
ret = mmu->ops->startup(mmu); ret = mmu->ops->startup(mmu);
fail: fail:
up_write(&mmu->exmap_sem); up_write(&mmu->exmap_sem);
omap_dsp_release_mem(); omap_dsp_release_mem();
out:
clk_disable(mmu->clk); clk_disable(mmu->clk);
return ret; return ret;
...@@ -1309,15 +1324,18 @@ static ssize_t omap_mmu_show(struct device *dev, struct device_attribute *attr, ...@@ -1309,15 +1324,18 @@ static ssize_t omap_mmu_show(struct device *dev, struct device_attribute *attr,
{ {
struct omap_mmu *mmu = dev_get_drvdata(dev); struct omap_mmu *mmu = dev_get_drvdata(dev);
struct omap_mmu_tlb_lock tlb_lock; struct omap_mmu_tlb_lock tlb_lock;
int ret = -EIO; int ret;
clk_enable(mmu->clk); clk_enable(mmu->clk);
omap_dsp_request_mem(); ret = omap_dsp_request_mem();
if (ret < 0)
goto out;
down_read(&mmu->exmap_sem); down_read(&mmu->exmap_sem);
omap_mmu_get_tlb_lock(mmu, &tlb_lock); omap_mmu_get_tlb_lock(mmu, &tlb_lock);
ret = -EIO;
if (likely(mmu->ops->show)) if (likely(mmu->ops->show))
ret = mmu->ops->show(mmu, buf, &tlb_lock); ret = mmu->ops->show(mmu, buf, &tlb_lock);
...@@ -1326,6 +1344,7 @@ static ssize_t omap_mmu_show(struct device *dev, struct device_attribute *attr, ...@@ -1326,6 +1344,7 @@ static ssize_t omap_mmu_show(struct device *dev, struct device_attribute *attr,
up_read(&mmu->exmap_sem); up_read(&mmu->exmap_sem);
omap_dsp_release_mem(); omap_dsp_release_mem();
out:
clk_disable(mmu->clk); clk_disable(mmu->clk);
return ret; return ret;
......
...@@ -66,8 +66,11 @@ extern void omap_dsp_release_mpui(void); ...@@ -66,8 +66,11 @@ extern void omap_dsp_release_mpui(void);
extern int omap_dsp_request_mem(void); extern int omap_dsp_request_mem(void);
extern int omap_dsp_release_mem(void); extern int omap_dsp_release_mem(void);
#elif defined(CONFIG_ARCH_OMAP2) #elif defined(CONFIG_ARCH_OMAP2)
#define omap_dsp_request_mem() do { } while (0) static inline int omap_dsp_request_mem(void)
#define omap_dsp_release_mem() do { } while (0) {
return 0;
}
#define omap_dsp_release_mem() do {} while (0)
#endif #endif
#endif /* ASM_ARCH_DSP_COMMON_H */ #endif /* ASM_ARCH_DSP_COMMON_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment