From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============5948594435919590386==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: api: fix kobj_to_dev.cocci warnings Date: Fri, 02 Oct 2020 23:06:17 +0800 Message-ID: <20201002150617.GA25487@8cbb73b479b5> In-Reply-To: <202010022336.F4IlTzZV-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============5948594435919590386== 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: Guenter Roeck CC: Jean Delvare CC: linux-hwmon(a)vger.kernel.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/hwmon/max6697.c:463: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: 44d8870f21529cfa8f50b503b5d949c6d46e6fc1 commit: a2fc3718bc22e85378085568ecc5765fb28cabce [3/10] coccinelle: api: ad= d kobj_to_dev.cocci script :::::: branch date: 19 hours ago :::::: commit date: 6 weeks ago Please take the patch only if it's a positive warning. Thanks! max6697.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/hwmon/max6697.c +++ b/drivers/hwmon/max6697.c @@ -460,7 +460,7 @@ static DEVICE_ATTR(dummy, 0, NULL, NULL) static umode_t max6697_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 max6697_data *data =3D dev_get_drvdata(dev); const struct max6697_chip_data *chip =3D data->chip; int channel =3D index / 7; /* channel number */ --===============5948594435919590386==--