Skip to content

Commit 250977d

Browse files
andy-shevmchehab
authored andcommitted
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 <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 71aecd5 commit 250977d

File tree

4 files changed

+15
-18
lines changed

4 files changed

+15
-18
lines changed

drivers/staging/media/atomisp/pci/atomisp_acc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,11 @@ int atomisp_acc_map(struct atomisp_sub_device *asd, struct atomisp_acc_map *map)
355355

356356
pgnr = DIV_ROUND_UP(map->length, PAGE_SIZE);
357357
if (pgnr < ((PAGE_ALIGN(map->length)) >> PAGE_SHIFT)) {
358-
dev_err(atomisp_dev,
358+
dev_err(asd->isp->dev,
359359
"user space memory size is less than the expected size..\n");
360360
return -ENOMEM;
361361
} else if (pgnr > ((PAGE_ALIGN(map->length)) >> PAGE_SHIFT)) {
362-
dev_err(atomisp_dev,
362+
dev_err(asd->isp->dev,
363363
"user space memory size is large than the expected size..\n");
364364
return -ENOMEM;
365365
}

drivers/staging/media/atomisp/pci/atomisp_compat_css20.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,10 @@ void atomisp_load_uint32(hrt_address addr, uint32_t *data)
182182
*data = atomisp_css2_hw_load_32(addr);
183183
}
184184

185-
static int hmm_get_mmu_base_addr(unsigned int *mmu_base_addr)
185+
static int hmm_get_mmu_base_addr(struct device *dev, unsigned int *mmu_base_addr)
186186
{
187187
if (!sh_mmu_mrfld.get_pd_base) {
188-
dev_err(atomisp_dev, "get mmu base address failed.\n");
188+
dev_err(dev, "get mmu base address failed.\n");
189189
return -EINVAL;
190190
}
191191

@@ -840,7 +840,7 @@ int atomisp_css_init(struct atomisp_device *isp)
840840
int ret;
841841
int err;
842842

843-
ret = hmm_get_mmu_base_addr(&mmu_base_addr);
843+
ret = hmm_get_mmu_base_addr(isp->dev, &mmu_base_addr);
844844
if (ret)
845845
return ret;
846846

@@ -942,7 +942,7 @@ int atomisp_css_resume(struct atomisp_device *isp)
942942
unsigned int mmu_base_addr;
943943
int ret;
944944

945-
ret = hmm_get_mmu_base_addr(&mmu_base_addr);
945+
ret = hmm_get_mmu_base_addr(isp->dev, &mmu_base_addr);
946946
if (ret) {
947947
dev_err(isp->dev, "get base address error.\n");
948948
return -EINVAL;
@@ -4337,7 +4337,7 @@ static const char * const fw_acc_type_name[] = {
43374337
[IA_CSS_ACC_STANDALONE] = "Stand-alone acceleration",
43384338
};
43394339

4340-
int atomisp_css_dump_blob_infor(void)
4340+
int atomisp_css_dump_blob_infor(struct atomisp_device *isp)
43414341
{
43424342
struct ia_css_blob_descr *bd = sh_css_blob_info;
43434343
unsigned int i, nm = sh_css_num_binaries;
@@ -4354,17 +4354,15 @@ int atomisp_css_dump_blob_infor(void)
43544354
for (i = 0; i < sh_css_num_binaries - NUM_OF_SPS; i++) {
43554355
switch (bd[i].header.type) {
43564356
case ia_css_isp_firmware:
4357-
dev_dbg(atomisp_dev,
4358-
"Num%2d type %s (%s), binary id is %2d, name is %s\n",
4357+
dev_dbg(isp->dev, "Num%2d type %s (%s), binary id is %2d, name is %s\n",
43594358
i + NUM_OF_SPS,
43604359
fw_type_name[bd[i].header.type],
43614360
fw_acc_type_name[bd[i].header.info.isp.type],
43624361
bd[i].header.info.isp.sp.id,
43634362
bd[i].name);
43644363
break;
43654364
default:
4366-
dev_dbg(atomisp_dev,
4367-
"Num%2d type %s, name is %s\n",
4365+
dev_dbg(isp->dev, "Num%2d type %s, name is %s\n",
43684366
i + NUM_OF_SPS, fw_type_name[bd[i].header.type],
43694367
bd[i].name);
43704368
}

drivers/staging/media/atomisp/pci/atomisp_compat_css20.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ int atomisp_css_debug_dump_isp_binary(void);
153153

154154
int atomisp_css_dump_sp_raw_copy_linecount(bool reduced);
155155

156-
int atomisp_css_dump_blob_infor(void);
156+
int atomisp_css_dump_blob_infor(struct atomisp_device *isp);
157157

158158
void atomisp_css_set_isp_config_id(struct atomisp_sub_device *asd,
159159
uint32_t isp_config_id);

drivers/staging/media/atomisp/pci/atomisp_drvfs.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ static inline int iunit_dump_dbgopt(struct atomisp_device *isp,
6262

6363
if (opt & OPTION_VALID) {
6464
if (opt & OPTION_BIN_LIST) {
65-
ret = atomisp_css_dump_blob_infor();
65+
ret = atomisp_css_dump_blob_infor(isp);
6666
if (ret) {
67-
dev_err(atomisp_dev, "%s dump blob infor err[ret:%d]\n",
67+
dev_err(isp->dev, "%s dump blob infor err[ret:%d]\n",
6868
__func__, ret);
6969
goto opt_err;
7070
}
@@ -76,7 +76,7 @@ static inline int iunit_dump_dbgopt(struct atomisp_device *isp,
7676
atomisp_css_debug_dump_isp_binary();
7777
} else {
7878
ret = -EPERM;
79-
dev_err(atomisp_dev, "%s dump running bin err[ret:%d]\n",
79+
dev_err(isp->dev, "%s dump running bin err[ret:%d]\n",
8080
__func__, ret);
8181
goto opt_err;
8282
}
@@ -86,8 +86,7 @@ static inline int iunit_dump_dbgopt(struct atomisp_device *isp,
8686
hmm_show_mem_stat(__func__, __LINE__);
8787
} else {
8888
ret = -EINVAL;
89-
dev_err(atomisp_dev, "%s dump nothing[ret=%d]\n", __func__,
90-
ret);
89+
dev_err(isp->dev, "%s dump nothing[ret=%d]\n", __func__, ret);
9190
}
9291

9392
opt_err:
@@ -195,7 +194,7 @@ int atomisp_drvfs_init(struct atomisp_device *isp)
195194

196195
ret = iunit_drvfs_create_files(iunit_debug.drv);
197196
if (ret) {
198-
dev_err(atomisp_dev, "drvfs_create_files error: %d\n", ret);
197+
dev_err(isp->dev, "drvfs_create_files error: %d\n", ret);
199198
iunit_drvfs_remove_files(iunit_debug.drv);
200199
}
201200

0 commit comments

Comments
 (0)