mirror of https://gitee.com/openkylin/linux.git
media: atomisp: Drop global atomisp_dev variable (easy cases)
Refactor code to avoid use of atomisp_dev global variable where it's easy to achieve. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
71aecd5d63
commit
250977de59
|
@ -355,11 +355,11 @@ int atomisp_acc_map(struct atomisp_sub_device *asd, struct atomisp_acc_map *map)
|
||||||
|
|
||||||
pgnr = DIV_ROUND_UP(map->length, PAGE_SIZE);
|
pgnr = DIV_ROUND_UP(map->length, PAGE_SIZE);
|
||||||
if (pgnr < ((PAGE_ALIGN(map->length)) >> PAGE_SHIFT)) {
|
if (pgnr < ((PAGE_ALIGN(map->length)) >> PAGE_SHIFT)) {
|
||||||
dev_err(atomisp_dev,
|
dev_err(asd->isp->dev,
|
||||||
"user space memory size is less than the expected size..\n");
|
"user space memory size is less than the expected size..\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
} else if (pgnr > ((PAGE_ALIGN(map->length)) >> PAGE_SHIFT)) {
|
} else if (pgnr > ((PAGE_ALIGN(map->length)) >> PAGE_SHIFT)) {
|
||||||
dev_err(atomisp_dev,
|
dev_err(asd->isp->dev,
|
||||||
"user space memory size is large than the expected size..\n");
|
"user space memory size is large than the expected size..\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,10 +182,10 @@ void atomisp_load_uint32(hrt_address addr, uint32_t *data)
|
||||||
*data = atomisp_css2_hw_load_32(addr);
|
*data = atomisp_css2_hw_load_32(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hmm_get_mmu_base_addr(unsigned int *mmu_base_addr)
|
static int hmm_get_mmu_base_addr(struct device *dev, unsigned int *mmu_base_addr)
|
||||||
{
|
{
|
||||||
if (!sh_mmu_mrfld.get_pd_base) {
|
if (!sh_mmu_mrfld.get_pd_base) {
|
||||||
dev_err(atomisp_dev, "get mmu base address failed.\n");
|
dev_err(dev, "get mmu base address failed.\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -840,7 +840,7 @@ int atomisp_css_init(struct atomisp_device *isp)
|
||||||
int ret;
|
int ret;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
ret = hmm_get_mmu_base_addr(&mmu_base_addr);
|
ret = hmm_get_mmu_base_addr(isp->dev, &mmu_base_addr);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -942,7 +942,7 @@ int atomisp_css_resume(struct atomisp_device *isp)
|
||||||
unsigned int mmu_base_addr;
|
unsigned int mmu_base_addr;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = hmm_get_mmu_base_addr(&mmu_base_addr);
|
ret = hmm_get_mmu_base_addr(isp->dev, &mmu_base_addr);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(isp->dev, "get base address error.\n");
|
dev_err(isp->dev, "get base address error.\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -4337,7 +4337,7 @@ static const char * const fw_acc_type_name[] = {
|
||||||
[IA_CSS_ACC_STANDALONE] = "Stand-alone acceleration",
|
[IA_CSS_ACC_STANDALONE] = "Stand-alone acceleration",
|
||||||
};
|
};
|
||||||
|
|
||||||
int atomisp_css_dump_blob_infor(void)
|
int atomisp_css_dump_blob_infor(struct atomisp_device *isp)
|
||||||
{
|
{
|
||||||
struct ia_css_blob_descr *bd = sh_css_blob_info;
|
struct ia_css_blob_descr *bd = sh_css_blob_info;
|
||||||
unsigned int i, nm = sh_css_num_binaries;
|
unsigned int i, nm = sh_css_num_binaries;
|
||||||
|
@ -4354,8 +4354,7 @@ int atomisp_css_dump_blob_infor(void)
|
||||||
for (i = 0; i < sh_css_num_binaries - NUM_OF_SPS; i++) {
|
for (i = 0; i < sh_css_num_binaries - NUM_OF_SPS; i++) {
|
||||||
switch (bd[i].header.type) {
|
switch (bd[i].header.type) {
|
||||||
case ia_css_isp_firmware:
|
case ia_css_isp_firmware:
|
||||||
dev_dbg(atomisp_dev,
|
dev_dbg(isp->dev, "Num%2d type %s (%s), binary id is %2d, name is %s\n",
|
||||||
"Num%2d type %s (%s), binary id is %2d, name is %s\n",
|
|
||||||
i + NUM_OF_SPS,
|
i + NUM_OF_SPS,
|
||||||
fw_type_name[bd[i].header.type],
|
fw_type_name[bd[i].header.type],
|
||||||
fw_acc_type_name[bd[i].header.info.isp.type],
|
fw_acc_type_name[bd[i].header.info.isp.type],
|
||||||
|
@ -4363,8 +4362,7 @@ int atomisp_css_dump_blob_infor(void)
|
||||||
bd[i].name);
|
bd[i].name);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dev_dbg(atomisp_dev,
|
dev_dbg(isp->dev, "Num%2d type %s, name is %s\n",
|
||||||
"Num%2d type %s, name is %s\n",
|
|
||||||
i + NUM_OF_SPS, fw_type_name[bd[i].header.type],
|
i + NUM_OF_SPS, fw_type_name[bd[i].header.type],
|
||||||
bd[i].name);
|
bd[i].name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ int atomisp_css_debug_dump_isp_binary(void);
|
||||||
|
|
||||||
int atomisp_css_dump_sp_raw_copy_linecount(bool reduced);
|
int atomisp_css_dump_sp_raw_copy_linecount(bool reduced);
|
||||||
|
|
||||||
int atomisp_css_dump_blob_infor(void);
|
int atomisp_css_dump_blob_infor(struct atomisp_device *isp);
|
||||||
|
|
||||||
void atomisp_css_set_isp_config_id(struct atomisp_sub_device *asd,
|
void atomisp_css_set_isp_config_id(struct atomisp_sub_device *asd,
|
||||||
uint32_t isp_config_id);
|
uint32_t isp_config_id);
|
||||||
|
|
|
@ -62,9 +62,9 @@ static inline int iunit_dump_dbgopt(struct atomisp_device *isp,
|
||||||
|
|
||||||
if (opt & OPTION_VALID) {
|
if (opt & OPTION_VALID) {
|
||||||
if (opt & OPTION_BIN_LIST) {
|
if (opt & OPTION_BIN_LIST) {
|
||||||
ret = atomisp_css_dump_blob_infor();
|
ret = atomisp_css_dump_blob_infor(isp);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(atomisp_dev, "%s dump blob infor err[ret:%d]\n",
|
dev_err(isp->dev, "%s dump blob infor err[ret:%d]\n",
|
||||||
__func__, ret);
|
__func__, ret);
|
||||||
goto opt_err;
|
goto opt_err;
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ static inline int iunit_dump_dbgopt(struct atomisp_device *isp,
|
||||||
atomisp_css_debug_dump_isp_binary();
|
atomisp_css_debug_dump_isp_binary();
|
||||||
} else {
|
} else {
|
||||||
ret = -EPERM;
|
ret = -EPERM;
|
||||||
dev_err(atomisp_dev, "%s dump running bin err[ret:%d]\n",
|
dev_err(isp->dev, "%s dump running bin err[ret:%d]\n",
|
||||||
__func__, ret);
|
__func__, ret);
|
||||||
goto opt_err;
|
goto opt_err;
|
||||||
}
|
}
|
||||||
|
@ -86,8 +86,7 @@ static inline int iunit_dump_dbgopt(struct atomisp_device *isp,
|
||||||
hmm_show_mem_stat(__func__, __LINE__);
|
hmm_show_mem_stat(__func__, __LINE__);
|
||||||
} else {
|
} else {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
dev_err(atomisp_dev, "%s dump nothing[ret=%d]\n", __func__,
|
dev_err(isp->dev, "%s dump nothing[ret=%d]\n", __func__, ret);
|
||||||
ret);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
opt_err:
|
opt_err:
|
||||||
|
@ -195,7 +194,7 @@ int atomisp_drvfs_init(struct atomisp_device *isp)
|
||||||
|
|
||||||
ret = iunit_drvfs_create_files(iunit_debug.drv);
|
ret = iunit_drvfs_create_files(iunit_debug.drv);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(atomisp_dev, "drvfs_create_files error: %d\n", ret);
|
dev_err(isp->dev, "drvfs_create_files error: %d\n", ret);
|
||||||
iunit_drvfs_remove_files(iunit_debug.drv);
|
iunit_drvfs_remove_files(iunit_debug.drv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue