diff mbox series

SCSI: use kobj_to_dev

Message ID 20200225100411.10250-1-guosongsu@gmail.com (mailing list archive)
State Mainlined
Commit 9e7bd945b9a95267872099c03a00e134951062c0
Headers show
Series SCSI: use kobj_to_dev | expand

Commit Message

guosongsu@gmail.com Feb. 25, 2020, 10:04 a.m. UTC
From: Guosong Su <suguosong@xiaomi.com>

Use kobj_to_dev to instead of open-coding it.

Signed-off-by: Guosong Su <suguosong@xiaomi.com>
---
 drivers/scsi/scsi_sysfs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Bart Van Assche Feb. 26, 2020, 5:31 a.m. UTC | #1
On 2020-02-25 02:04, guosongsu@gmail.com wrote:
> From: Guosong Su <suguosong@xiaomi.com>
> 
> Use kobj_to_dev to instead of open-coding it.

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Martin K. Petersen Feb. 29, 2020, 1:44 a.m. UTC | #2
Guosong,

> Use kobj_to_dev to instead of open-coding it.

Applied to 5.7/scsi-queue, thanks!
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 677b5c5403d2..c3a30ba4ae08 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -856,7 +856,7 @@  show_vpd_##_page(struct file *filp, struct kobject *kobj,	\
 		 struct bin_attribute *bin_attr,			\
 		 char *buf, loff_t off, size_t count)			\
 {									\
-	struct device *dev = container_of(kobj, struct device, kobj);	\
+	struct device *dev = kobj_to_dev(kobj);				\
 	struct scsi_device *sdev = to_scsi_device(dev);			\
 	struct scsi_vpd *vpd_page;					\
 	int ret = -EINVAL;						\
@@ -884,7 +884,7 @@  static ssize_t show_inquiry(struct file *filep, struct kobject *kobj,
 			    struct bin_attribute *bin_attr,
 			    char *buf, loff_t off, size_t count)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	struct scsi_device *sdev = to_scsi_device(dev);
 
 	if (!sdev->inquiry)
@@ -1181,7 +1181,7 @@  static DEVICE_ATTR(queue_ramp_up_period, S_IRUGO | S_IWUSR,
 static umode_t scsi_sdev_attr_is_visible(struct kobject *kobj,
 					 struct attribute *attr, int i)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	struct scsi_device *sdev = to_scsi_device(dev);
 
 
@@ -1207,7 +1207,7 @@  static umode_t scsi_sdev_attr_is_visible(struct kobject *kobj,
 static umode_t scsi_sdev_bin_attr_is_visible(struct kobject *kobj,
 					     struct bin_attribute *attr, int i)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	struct scsi_device *sdev = to_scsi_device(dev);