linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] banalabs: Switch to using the new API kobj_to_dev()
@ 2021-02-23  9:12 Yang Li
  2021-02-28 20:13 ` Oded Gabbay
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Li @ 2021-02-23  9:12 UTC (permalink / raw)
  To: ogabbay; +Cc: arnd, gregkh, linux-kernel, Yang Li

fixed the following coccicheck:
./drivers/misc/habanalabs/common/sysfs.c:347:60-61: WARNING opportunity
for kobj_to_dev()

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 drivers/misc/habanalabs/common/sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/habanalabs/common/sysfs.c b/drivers/misc/habanalabs/common/sysfs.c
index 4366d8f..79c1ddf 100644
--- a/drivers/misc/habanalabs/common/sysfs.c
+++ b/drivers/misc/habanalabs/common/sysfs.c
@@ -344,7 +344,7 @@ static ssize_t eeprom_read_handler(struct file *filp, struct kobject *kobj,
 			struct bin_attribute *attr, char *buf, loff_t offset,
 			size_t max_size)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	struct hl_device *hdev = dev_get_drvdata(dev);
 	char *data;
 	int rc;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] banalabs: Switch to using the new API kobj_to_dev()
  2021-02-23  9:12 [PATCH] banalabs: Switch to using the new API kobj_to_dev() Yang Li
@ 2021-02-28 20:13 ` Oded Gabbay
  0 siblings, 0 replies; 2+ messages in thread
From: Oded Gabbay @ 2021-02-28 20:13 UTC (permalink / raw)
  To: Yang Li
  Cc: Oded Gabbay, Arnd Bergmann, Greg Kroah-Hartman,
	Linux-Kernel@Vger. Kernel. Org

On Tue, Feb 23, 2021 at 11:12 AM Yang Li <yang.lee@linux.alibaba.com> wrote:
>
> fixed the following coccicheck:
> ./drivers/misc/habanalabs/common/sysfs.c:347:60-61: WARNING opportunity
> for kobj_to_dev()
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> ---
>  drivers/misc/habanalabs/common/sysfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/habanalabs/common/sysfs.c b/drivers/misc/habanalabs/common/sysfs.c
> index 4366d8f..79c1ddf 100644
> --- a/drivers/misc/habanalabs/common/sysfs.c
> +++ b/drivers/misc/habanalabs/common/sysfs.c
> @@ -344,7 +344,7 @@ static ssize_t eeprom_read_handler(struct file *filp, struct kobject *kobj,
>                         struct bin_attribute *attr, char *buf, loff_t offset,
>                         size_t max_size)
>  {
> -       struct device *dev = container_of(kobj, struct device, kobj);
> +       struct device *dev = kobj_to_dev(kobj);
>         struct hl_device *hdev = dev_get_drvdata(dev);
>         char *data;
>         int rc;
> --
> 1.8.3.1
>

Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Applied to -next.

Thanks,
Oded

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-28 20:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-23  9:12 [PATCH] banalabs: Switch to using the new API kobj_to_dev() Yang Li
2021-02-28 20:13 ` Oded Gabbay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).