Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1377876pxb; Sun, 21 Feb 2021 23:28:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJxS7OQcldnMFSI3wDsUz2JczmawE/9896JeSaiPrS3lsG7CDnzTQn4a8uFAu0YTvlg9+Neo X-Received: by 2002:a17:906:2c51:: with SMTP id f17mr6630081ejh.49.1613978917457; Sun, 21 Feb 2021 23:28:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613978917; cv=none; d=google.com; s=arc-20160816; b=k80AeJMB8G70ca0KZxdvjBOd6EIeqHnUxXvkpvoUr8N2oNCFYLIuWCvBBMk/HV+b91 ZxTDwYb5/ziamSumxmDN8rrRyup1fCQf/TYOw0ALJ8uvOk26YvsiJmPtJRVhBM619rmO ILMYibVBU8AGEgLTDdJtwrmLWiLJfhioBLLM2kieDXoPxKSmLOeqGTJBoLXYKpkFNU3w VMr02kxHEihJRPwNO39sadprKLVksBzsD/H5j4U1MdP8lhAEVdyorzQFYtxbj6/0U2yf /Qd6p0Cbda/K5kpE33yO6E8IifzVd9M+SiWX+7BFcSE7mHlPZtEnJF770VUIRUo73g3B fWRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=Ys3z8wf7VRisyQHlSDz5OD3+kDyDv5UEv321ay3N46Q=; b=SxFsz/OwNzpoU7V59DS0RBx3W6zagNGr19IZV5CWjOBsrsXMnifpTwWw3K4BVFY8gw 5bc1sna2qUjSeRpw+GuU/Qp4e9hUJKMjrubyHL2H4XhffI9pQCtUeL4H9hz53pEPZqRp l9B4hnyzxQM4a39n5693kMLVnPPJXMRayvoFfHyFKeFAEjVYx7ETjYRGZjNxZA9N4dNn f88KWLVhzq1o3c3XRv5kScjO2+GytpxnZq3j+T3JbcRtkuMh8O7D6jf60fTox3jbQSpX vuRrr7PlXW1kCI//vHc34EWV+yId7c6Vie7vOoB7i1qBnyj0nXc0aZ06+28JkyTYG0Zh 7HPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bu13si10957221ejb.588.2021.02.21.23.28.14; Sun, 21 Feb 2021 23:28:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229863AbhBVH1f (ORCPT + 99 others); Mon, 22 Feb 2021 02:27:35 -0500 Received: from out30-45.freemail.mail.aliyun.com ([115.124.30.45]:33831 "EHLO out30-45.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229886AbhBVH1d (ORCPT ); Mon, 22 Feb 2021 02:27:33 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R301e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=yang.lee@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0UPCfPyz_1613978806; Received: from j63c13417.sqa.eu95.tbsite.net(mailfrom:yang.lee@linux.alibaba.com fp:SMTPD_---0UPCfPyz_1613978806) by smtp.aliyun-inc.com(127.0.0.1); Mon, 22 Feb 2021 15:26:46 +0800 From: Yang Li To: martin.petersen@oracle.com Cc: jejb@linux.ibm.com, lduncan@suse.com, cleech@redhat.com, open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Yang Li Subject: [PATCH] scsi: iscsi: Switch to using the new API kobj_to_dev() Date: Mon, 22 Feb 2021 15:26:44 +0800 Message-Id: <1613978804-4846-1-git-send-email-yang.lee@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org fixed the following coccicheck: ./drivers/scsi/scsi_transport_iscsi.c:436:60-61: WARNING opportunity for kobj_to_dev() ./drivers/scsi/scsi_transport_iscsi.c:1128:60-61: WARNING opportunity for kobj_to_dev() ./drivers/scsi/scsi_transport_iscsi.c:4043:61-62: WARNING opportunity for kobj_to_dev() ./drivers/scsi/scsi_transport_iscsi.c:4312:61-62: WARNING opportunity for kobj_to_dev() ./drivers/scsi/scsi_transport_iscsi.c:4456:61-62: WARNING opportunity for kobj_to_dev() Reported-by: Abaci Robot Signed-off-by: Yang Li --- drivers/scsi/scsi_transport_iscsi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 2e68c0a..467ed95 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -433,7 +433,7 @@ struct device_attribute dev_attr_##_prefix##_##_name = \ static umode_t iscsi_iface_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 iscsi_iface *iface = iscsi_dev_to_iface(dev); struct iscsi_transport *t = iface->transport; int param; @@ -1125,7 +1125,7 @@ static umode_t iscsi_flashnode_conn_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 iscsi_bus_flash_conn *fnode_conn = iscsi_dev_to_flash_conn(dev); struct iscsi_transport *t = fnode_conn->transport; int param; @@ -4040,7 +4040,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; @@ -4309,7 +4309,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; @@ -4453,7 +4453,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; -- 1.8.3.1