diff mbox series

scsi: iscsi: Switch to using the new API kobj_to_dev()

Message ID 1614678044-5635-1-git-send-email-jiapeng.chong@linux.alibaba.com (mailing list archive)
State Superseded
Headers show
Series scsi: iscsi: Switch to using the new API kobj_to_dev() | expand

Commit Message

Jiapeng Chong March 2, 2021, 9:40 a.m. UTC
Fix the following coccicheck warnings:

./drivers/scsi/scsi_transport_iscsi.c:4453:61-62: WARNING opportunity
for kobj_to_dev().

./drivers/scsi/scsi_transport_iscsi.c:4309:61-62: WARNING opportunity
for kobj_to_dev().

./drivers/scsi/scsi_transport_iscsi.c:4040:61-62: WARNING opportunity
for kobj_to_dev().

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 drivers/scsi/scsi_transport_iscsi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 969d24d..debedcd 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -4037,7 +4037,7 @@  static ISCSI_CLASS_ATTR(conn, field, S_IRUGO,				\
 static umode_t iscsi_conn_attr_is_visible(struct kobject *kobj,
 					 struct attribute *attr, int i)
 {
-	struct device *cdev = container_of(kobj, struct device, kobj);
+	struct device *cdev = kobj_to_dev(kobj);
 	struct iscsi_cls_conn *conn = transport_class_to_conn(cdev);
 	struct iscsi_transport *t = conn->transport;
 	int param;
@@ -4306,7 +4306,7 @@  static ISCSI_CLASS_ATTR(priv_sess, field, S_IRUGO | S_IWUSR,		\
 static umode_t iscsi_session_attr_is_visible(struct kobject *kobj,
 					    struct attribute *attr, int i)
 {
-	struct device *cdev = container_of(kobj, struct device, kobj);
+	struct device *cdev = kobj_to_dev(kobj);
 	struct iscsi_cls_session *session = transport_class_to_session(cdev);
 	struct iscsi_transport *t = session->transport;
 	int param;
@@ -4450,7 +4450,7 @@  static ISCSI_CLASS_ATTR(host, field, S_IRUGO, show_host_param_##param,	\
 static umode_t iscsi_host_attr_is_visible(struct kobject *kobj,
 					 struct attribute *attr, int i)
 {
-	struct device *cdev = container_of(kobj, struct device, kobj);
+	struct device *cdev = kobj_to_dev(kobj);
 	struct Scsi_Host *shost = transport_class_to_shost(cdev);
 	struct iscsi_internal *priv = to_iscsi_internal(shost->transportt);
 	int param;