Re: [PATCH] drivers\watchdog: Use kobj_to_dev() API

From: Guenter Roeck
Date: Fri Jun 12 2020 - 09:17:27 EST


On 6/12/20 12:03 AM, Wang Qing wrote:
> Use kobj_to_dev() API instead of container_of().
>
> Signed-off-by: Wang Qing <wangqing@xxxxxxxx>

Reviewed-by: Guenter Roeck <linux@xxxxxxxxxxxx>

> ---
> drivers/watchdog/watchdog_dev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> mode change 100644 => 100755 drivers/watchdog/watchdog_dev.c
>
> diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
> index 7e4cd34..9da2360
> --- a/drivers/watchdog/watchdog_dev.c
> +++ b/drivers/watchdog/watchdog_dev.c
> @@ -587,7 +587,7 @@ static DEVICE_ATTR_RW(pretimeout_governor);
> static umode_t wdt_is_visible(struct kobject *kobj, struct attribute *attr,
> int n)
> {
> - struct device *dev = container_of(kobj, struct device, kobj);
> + struct device *dev = kobj_to_dev(kobj);
> struct watchdog_device *wdd = dev_get_drvdata(dev);
> umode_t mode = attr->mode;
>
>