[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220510105145.1352030-1-chi.minghao@zte.com.cn>
Date: Tue, 10 May 2022 10:51:45 +0000
From: cgel.zte@...il.com
To: james.smart@...adcom.com
Cc: dick.kennedy@...adcom.com, jejb@...ux.ibm.com,
martin.petersen@...cle.com, linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org, Minghao Chi <chi.minghao@....com.cn>,
Zeal Robot <zealci@....com.cn>
Subject: [PATCH] lpfc: use kobj_to_dev()
From: Minghao Chi <chi.minghao@....com.cn>
Use kobj_to_dev() instead of open-coding it.
Reported-by: Zeal Robot <zealci@....com.cn>
Signed-off-by: Minghao Chi <chi.minghao@....com.cn>
---
drivers/scsi/lpfc/lpfc_attr.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 3caaa7c4af48..97f87155c1bd 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -4376,8 +4376,7 @@ sysfs_drvr_stat_data_read(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_Host *shost = class_to_shost(dev);
struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
struct lpfc_hba *phba = vport->phba;
@@ -6396,7 +6395,7 @@ sysfs_ctlreg_write(struct file *filp, struct kobject *kobj,
char *buf, loff_t off, size_t count)
{
size_t buf_off;
- struct device *dev = container_of(kobj, struct device, kobj);
+ struct device *dev = kobj_to_dev(kobj);
struct Scsi_Host *shost = class_to_shost(dev);
struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
struct lpfc_hba *phba = vport->phba;
@@ -6456,7 +6455,7 @@ sysfs_ctlreg_read(struct file *filp, struct kobject *kobj,
{
size_t buf_off;
uint32_t * tmp_ptr;
- struct device *dev = container_of(kobj, struct device, kobj);
+ struct device *dev = kobj_to_dev(kobj);
struct Scsi_Host *shost = class_to_shost(dev);
struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
struct lpfc_hba *phba = vport->phba;
--
2.25.1
Powered by blists - more mailing lists