From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============3239620401559929773==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: api: fix kobj_to_dev.cocci warnings Date: Wed, 10 Mar 2021 08:31:18 +0800 Message-ID: <20210310003118.GA185141@da48b91e3745> In-Reply-To: <202103100840.NM8LWxi2-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============3239620401559929773== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)01.org CC: linux-kernel(a)vger.kernel.org TO: Denis Efremov CC: Julia Lawall CC: Dmitry Torokhov CC: Colin Ian King CC: Dan Carpenter CC: linux-input(a)vger.kernel.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/input/misc/ims-pcu.c:1231:60-61: WARNING opportunity for kobj_to_de= v() 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: 4b3d9f9cf108ebf2c48fbbbf30a8d1346d9cc7d6 commit: a2fc3718bc22e85378085568ecc5765fb28cabce coccinelle: api: add kobj_= to_dev.cocci script :::::: branch date: 4 hours ago :::::: commit date: 7 months ago Please take the patch only if it's a positive warning. Thanks! ims-pcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/input/misc/ims-pcu.c +++ b/drivers/input/misc/ims-pcu.c @@ -1228,7 +1228,7 @@ static struct attribute *ims_pcu_attrs[] static umode_t ims_pcu_is_attr_visible(struct kobject *kobj, struct attribute *attr, int n) { - struct device *dev =3D container_of(kobj, struct device, kobj); + struct device *dev =3D kobj_to_dev(kobj); struct usb_interface *intf =3D to_usb_interface(dev); struct ims_pcu *pcu =3D usb_get_intfdata(intf); umode_t mode =3D attr->mode; --===============3239620401559929773==--