From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============7212306222250920592==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: api: fix kobj_to_dev.cocci warnings Date: Thu, 03 Dec 2020 09:10:06 +0800 Message-ID: <20201203011006.GA51045@436ff7e215fd> In-Reply-To: <202012030947.BZ5mH3GP-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============7212306222250920592== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org CC: linux-kernel(a)vger.kernel.org TO: Denis Efremov CC: Julia Lawall CC: Adam Radford CC: "James E.J. Bottomley" CC: "Martin K. Petersen" CC: linux-scsi(a)vger.kernel.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/scsi/3w-sas.c:102:60-61: WARNING opportunity for kobj_to_dev() drivers/scsi/3w-sas.c:133:60-61: WARNING opportunity for kobj_to_dev() Use kobj_to_dev() instead of container_of() Generated by: scripts/coccinelle/api/kobj_to_dev.cocci Fixes: a2fc3718bc22 ("coccinelle: api: add kobj_to_dev.cocci script") CC: Denis Efremov Reported-by: kernel test robot Signed-off-by: kernel test robot --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git = master head: 3bb61aa61828499a7d0f5e560051625fd02ae7e4 commit: a2fc3718bc22e85378085568ecc5765fb28cabce coccinelle: api: add kobj_= to_dev.cocci script :::::: branch date: 5 hours ago :::::: commit date: 3 months ago Please take the patch only if it's a positive warning. Thanks! 3w-sas.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/scsi/3w-sas.c +++ b/drivers/scsi/3w-sas.c @@ -99,7 +99,7 @@ static ssize_t twl_sysfs_aen_read(struct struct bin_attribute *bin_attr, char *outbuf, loff_t offset, size_t count) { - struct device *dev =3D container_of(kobj, struct device, kobj); + struct device *dev =3D kobj_to_dev(kobj); struct Scsi_Host *shost =3D class_to_shost(dev); TW_Device_Extension *tw_dev =3D (TW_Device_Extension *)shost->hostdata; unsigned long flags =3D 0; @@ -130,7 +130,7 @@ static ssize_t twl_sysfs_compat_info(str struct bin_attribute *bin_attr, char *outbuf, loff_t offset, size_t count) { - struct device *dev =3D container_of(kobj, struct device, kobj); + struct device *dev =3D kobj_to_dev(kobj); struct Scsi_Host *shost =3D class_to_shost(dev); TW_Device_Extension *tw_dev =3D (TW_Device_Extension *)shost->hostdata; unsigned long flags =3D 0; --===============7212306222250920592==--