linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] SCSI: use kobj_to_dev
@ 2020-02-25 10:04 guosongsu
  2020-02-26  5:31 ` Bart Van Assche
  2020-02-29  1:44 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: guosongsu @ 2020-02-25 10:04 UTC (permalink / raw)
  To: James E . J . Bottomley, Martin K . Petersen
  Cc: linux-scsi, linux-kernel, Guosong Su

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(-)

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);
 
 
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] SCSI: use kobj_to_dev
  2020-02-25 10:04 [PATCH] SCSI: use kobj_to_dev guosongsu
@ 2020-02-26  5:31 ` Bart Van Assche
  2020-02-29  1:44 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Bart Van Assche @ 2020-02-26  5:31 UTC (permalink / raw)
  To: guosongsu, James E . J . Bottomley, Martin K . Petersen
  Cc: linux-scsi, linux-kernel, Guosong Su

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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] SCSI: use kobj_to_dev
  2020-02-25 10:04 [PATCH] SCSI: use kobj_to_dev guosongsu
  2020-02-26  5:31 ` Bart Van Assche
@ 2020-02-29  1:44 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2020-02-29  1:44 UTC (permalink / raw)
  To: guosongsu
  Cc: James E . J . Bottomley, Martin K . Petersen, linux-scsi,
	linux-kernel, Guosong Su


Guosong,

> Use kobj_to_dev to instead of open-coding it.

Applied to 5.7/scsi-queue, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-02-29  1:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-25 10:04 [PATCH] SCSI: use kobj_to_dev guosongsu
2020-02-26  5:31 ` Bart Van Assche
2020-02-29  1:44 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).