From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============2269260853779416276==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: api: fix kobj_to_dev.cocci warnings Date: Tue, 01 Sep 2020 17:46:04 +0800 Message-ID: <20200901094604.GA29069@e18970f1e570> In-Reply-To: <202009011711.D4mNHDQW%lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============2269260853779416276== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org TO: Denis Efremov CC: Julia Lawall CC: Dmitry Torokhov CC: Alexandru Ardelean CC: linux-input(a)vger.kernel.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/input/touchscreen/ads7846.c:484: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 Signed-off-by: kernel test robot --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux.git f= or-5.10 head: ea3047aac79bc12dfda32fd676d6d1b2a6e5475d commit: a2fc3718bc22e85378085568ecc5765fb28cabce [3/4] coccinelle: api: add= kobj_to_dev.cocci script :::::: branch date: 3 days ago :::::: commit date: 11 days ago Please take the patch only if it's a positive warning. Thanks! ads7846.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -481,7 +481,7 @@ SHOW(in1_input, vbatt, vbatt_adjust) static umode_t ads7846_is_visible(struct kobject *kobj, struct attribute *= attr, int index) { - struct device *dev =3D container_of(kobj, struct device, kobj); + struct device *dev =3D kobj_to_dev(kobj); struct ads7846 *ts =3D dev_get_drvdata(dev); = if (ts->model =3D=3D 7843 && index < 2) /* in0, in1 */ --===============2269260853779416276==--