]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
habanalabs: Switch to using the new API kobj_to_dev()
authorYang Li <yang.lee@linux.alibaba.com>
Tue, 23 Feb 2021 09:12:24 +0000 (17:12 +0800)
committerOded Gabbay <ogabbay@kernel.org>
Fri, 9 Apr 2021 11:09:23 +0000 (14:09 +0300)
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>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/sysfs.c

index 9bd13bdc1ba950be73bc42410733b3cffeab206a..f37634cf8b6501e3fd3b216b93104d80c6b02a95 100644 (file)
@@ -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;