Re: [PATCH 20/22] watchdog: jz4740_wdt: Use 'dev' instead of dereferencing it repeatedly

Joe Perches
2019-04-10T16:52:15Z

On Wed, 2019-04-10 at 09:28 -0700, Guenter Roeck wrote:
> Introduce local variable 'struct device *dev' and use it instead of
> dereferencing it repeatedly. Also, there is no call to dev_get_drvdata()
> or platform_get_drvdata() in the driver, so drop the unnecessary
> call to platform_set_drvdata().

Dropping platform_set_drvdata seems to me like it should
be a separate patch.

And are you sure no other function uses a get_drvdata call?
Maybe something in watchdog_dev.c? Possibly:

#ifdef CONFIG_WATCHDOG_SYSFS
static ssize_t nowayout_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct watchdog_device *wdd = dev_get_drvdata(dev);

return sprintf(buf, "%d\n", !!test_bit(WDOG_NO_WAY_OUT, &wdd->status));
}
static DEVICE_ATTR_RO(nowayout);

> diff --git a/drivers/watchdog/jz4740_wdt.c b/drivers/watchdog/jz4740_wdt.c
[]
> @@ -189,18 +190,16 @@ static int jz4740_wdt_probe(struct platform_device *pdev)
[]
> - platform_set_drvdata(pdev, drvdata);
> -
> return 0;
> }
>