[PATCH v3 5/5] staging: vme_user: Use dev_err() in vme_check_window()
From: Soumya Negi
Date: Thu Oct 19 2023 - 21:55:54 EST
vme_check_window() uses printk() for logging error message. This
leads to the following checkpatch warning:
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then
dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
Use dev_err() instead. Pass VME bridge device to vme_check_window() so
that the error message can be logged with the bridge device context.
Signed-off-by: Soumya Negi <soumya.negi97@xxxxxxxxx>
Suggested-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
drivers/staging/vme_user/vme.c | 10 +++++-----
drivers/staging/vme_user/vme.h | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/vme_user/vme.c b/drivers/staging/vme_user/vme.c
index 661d1edfa26a..5c416c31ec57 100644
--- a/drivers/staging/vme_user/vme.c
+++ b/drivers/staging/vme_user/vme.c
@@ -160,8 +160,8 @@ size_t vme_get_size(struct vme_resource *resource)
}
EXPORT_SYMBOL(vme_get_size);
-int vme_check_window(u32 aspace, unsigned long long vme_base,
- unsigned long long size)
+int vme_check_window(struct vme_bridge *bridge, u32 aspace,
+ unsigned long long vme_base, unsigned long long size)
{
int retval = 0;
@@ -195,7 +195,7 @@ int vme_check_window(u32 aspace, unsigned long long vme_base,
/* User Defined */
break;
default:
- printk(KERN_ERR "Invalid address space\n");
+ dev_err(bridge->parent, "Invalid address space\n");
retval = -EINVAL;
break;
}
@@ -350,7 +350,7 @@ int vme_slave_set(struct vme_resource *resource, int enabled,
return -EINVAL;
}
- retval = vme_check_window(aspace, vme_base, size);
+ retval = vme_check_window(bridge, aspace, vme_base, size);
if (retval)
return retval;
@@ -552,7 +552,7 @@ int vme_master_set(struct vme_resource *resource, int enabled,
return -EINVAL;
}
- retval = vme_check_window(aspace, vme_base, size);
+ retval = vme_check_window(bridge, aspace, vme_base, size);
if (retval)
return retval;
diff --git a/drivers/staging/vme_user/vme.h b/drivers/staging/vme_user/vme.h
index fbcbd0204453..06504dccd5ff 100644
--- a/drivers/staging/vme_user/vme.h
+++ b/drivers/staging/vme_user/vme.h
@@ -133,8 +133,8 @@ void vme_free_consistent(struct vme_resource *, size_t, void *,
dma_addr_t);
size_t vme_get_size(struct vme_resource *);
-int vme_check_window(u32 aspace, unsigned long long vme_base,
- unsigned long long size);
+int vme_check_window(struct vme_bridge *bridge, u32 aspace,
+ unsigned long long vme_base, unsigned long long size);
struct vme_resource *vme_slave_request(struct vme_dev *, u32, u32);
int vme_slave_set(struct vme_resource *, int, unsigned long long,
--
2.42.0