From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============2537556050530931226==" 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:19 +0800 Message-ID: <20210310003119.GA185632@da48b91e3745> In-Reply-To: <202103100840.NM8LWxi2-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============2537556050530931226== 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: Jean Delvare CC: Guenter Roeck CC: linux-hwmon(a)vger.kernel.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/hwmon/ltc2990.c:156: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: 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! ltc2990.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/hwmon/ltc2990.c +++ b/drivers/hwmon/ltc2990.c @@ -153,7 +153,7 @@ static ssize_t ltc2990_value_show(struct static umode_t ltc2990_attrs_visible(struct kobject *kobj, struct attribute *a, int n) { - struct device *dev =3D container_of(kobj, struct device, kobj); + struct device *dev =3D kobj_to_dev(kobj); struct ltc2990_data *data =3D dev_get_drvdata(dev); struct device_attribute *da =3D container_of(a, struct device_attribute, attr); --===============2537556050530931226==--