Skip to content

Commit

Permalink
Watchdog: Fix parent of watchdog_devices
Browse files Browse the repository at this point in the history
/sys/class/watchdog/watchdogn/device/modalias can help to identify the
driver/module for a given watchdog node. However, many wdt devices do not
set their parent and so, we do not see an entry for device in sysfs for
such devices.

This patch fixes parent of watchdog_device so that
/sys/class/watchdog/watchdogn/device is populated.

Exceptions: booke, diag288, octeon, softdog and w83627hf -- They do not
have any parent. Not sure, how we can identify driver for these devices.

Signed-off-by: Pratyush Anand <panand@redhat.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Lubomir Rintel <lkundrak@v3.sk>
Acked-by: Maxime Coquelin <maxime.coquelin@st.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
  • Loading branch information
Pratyush Anand authored and Wim Van Sebroeck committed Sep 9, 2015
1 parent bf5125d commit 6551881
Show file tree
Hide file tree
Showing 37 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/misc/mei/wd.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ int mei_watchdog_register(struct mei_device *dev)

int ret;

amt_wd_dev.parent = dev->dev;
/* unlock to perserve correct locking order */
mutex_unlock(&dev->device_lock);
ret = watchdog_register_device(&amt_wd_dev);
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/bcm2835_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ static int bcm2835_wdt_probe(struct platform_device *pdev)
watchdog_set_drvdata(&bcm2835_wdt_wdd, wdt);
watchdog_init_timeout(&bcm2835_wdt_wdd, heartbeat, dev);
watchdog_set_nowayout(&bcm2835_wdt_wdd, nowayout);
bcm2835_wdt_wdd.parent = &pdev->dev;
err = watchdog_register_device(&bcm2835_wdt_wdd);
if (err) {
dev_err(dev, "Failed to register watchdog device");
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/bcm47xx_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ static int bcm47xx_wdt_probe(struct platform_device *pdev)

wdt->wdd.info = &bcm47xx_wdt_info;
wdt->wdd.timeout = WDT_DEFAULT_TIME;
wdt->wdd.parent = &pdev->dev;
ret = wdt->wdd.ops->set_timeout(&wdt->wdd, timeout);
if (ret)
goto err_timer;
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/bcm_kona_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ static int bcm_kona_wdt_probe(struct platform_device *pdev)
spin_lock_init(&wdt->lock);
platform_set_drvdata(pdev, wdt);
watchdog_set_drvdata(&bcm_kona_wdt_wdd, wdt);
bcm_kona_wdt_wdd.parent = &pdev->dev;

ret = bcm_kona_wdt_set_timeout_reg(&bcm_kona_wdt_wdd, 0);
if (ret) {
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/coh901327_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ static int __init coh901327_probe(struct platform_device *pdev)
if (ret < 0)
coh901327_wdt.timeout = 60;

coh901327_wdt.parent = &pdev->dev;
ret = watchdog_register_device(&coh901327_wdt);
if (ret == 0)
dev_info(&pdev->dev,
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/da9052_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ static int da9052_wdt_probe(struct platform_device *pdev)
da9052_wdt->timeout = DA9052_DEF_TIMEOUT;
da9052_wdt->info = &da9052_wdt_info;
da9052_wdt->ops = &da9052_wdt_ops;
da9052_wdt->parent = &pdev->dev;
watchdog_set_drvdata(da9052_wdt, driver_data);

kref_init(&driver_data->kref);
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/da9055_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ static int da9055_wdt_probe(struct platform_device *pdev)
da9055_wdt->timeout = DA9055_DEF_TIMEOUT;
da9055_wdt->info = &da9055_wdt_info;
da9055_wdt->ops = &da9055_wdt_ops;
da9055_wdt->parent = &pdev->dev;
watchdog_set_nowayout(da9055_wdt, nowayout);
watchdog_set_drvdata(da9055_wdt, driver_data);

Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/da9062_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ static int da9062_wdt_probe(struct platform_device *pdev)
wdt->wdtdev.max_timeout = DA9062_WDT_MAX_TIMEOUT;
wdt->wdtdev.timeout = DA9062_WDG_DEFAULT_TIMEOUT;
wdt->wdtdev.status = WATCHDOG_NOWAYOUT_INIT_STATUS;
wdt->wdtdev.parent = &pdev->dev;

watchdog_set_drvdata(&wdt->wdtdev, wdt);
dev_set_drvdata(&pdev->dev, wdt);
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/da9063_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ static int da9063_wdt_probe(struct platform_device *pdev)
wdt->wdtdev.min_timeout = DA9063_WDT_MIN_TIMEOUT;
wdt->wdtdev.max_timeout = DA9063_WDT_MAX_TIMEOUT;
wdt->wdtdev.timeout = DA9063_WDG_TIMEOUT;
wdt->wdtdev.parent = &pdev->dev;

wdt->wdtdev.status = WATCHDOG_NOWAYOUT_INIT_STATUS;

Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/davinci_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ static int davinci_wdt_probe(struct platform_device *pdev)
wdd->min_timeout = 1;
wdd->max_timeout = MAX_HEARTBEAT;
wdd->timeout = DEFAULT_HEARTBEAT;
wdd->parent = &pdev->dev;

watchdog_init_timeout(wdd, heartbeat, dev);

Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/digicolor_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ static int dc_wdt_probe(struct platform_device *pdev)
}
dc_wdt_wdd.max_timeout = U32_MAX / clk_get_rate(wdt->clk);
dc_wdt_wdd.timeout = dc_wdt_wdd.max_timeout;
dc_wdt_wdd.parent = &pdev->dev;

spin_lock_init(&wdt->lock);

Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/ep93xx_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ static int ep93xx_wdt_probe(struct platform_device *pdev)
val = readl(mmio_base + EP93XX_WATCHDOG);
ep93xx_wdt_wdd.bootstatus = (val & 0x01) ? WDIOF_CARDRESET : 0;
ep93xx_wdt_wdd.timeout = timeout;
ep93xx_wdt_wdd.parent = &pdev->dev;

watchdog_set_nowayout(&ep93xx_wdt_wdd, nowayout);

Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/gpio_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ static int gpio_wdt_probe(struct platform_device *pdev)
priv->wdd.ops = &gpio_wdt_ops;
priv->wdd.min_timeout = SOFT_TIMEOUT_MIN;
priv->wdd.max_timeout = SOFT_TIMEOUT_MAX;
priv->wdd.parent = &pdev->dev;

if (watchdog_init_timeout(&priv->wdd, 0, &pdev->dev) < 0)
priv->wdd.timeout = SOFT_TIMEOUT_DEF;
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/ie6xx_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ static int ie6xx_wdt_probe(struct platform_device *pdev)

ie6xx_wdt_dev.timeout = timeout;
watchdog_set_nowayout(&ie6xx_wdt_dev, nowayout);
ie6xx_wdt_dev.parent = &pdev->dev;

spin_lock_init(&ie6xx_wdt_data.unlock_sequence);

Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/intel-mid_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ static int mid_wdt_probe(struct platform_device *pdev)
wdt_dev->min_timeout = MID_WDT_TIMEOUT_MIN;
wdt_dev->max_timeout = MID_WDT_TIMEOUT_MAX;
wdt_dev->timeout = MID_WDT_DEFAULT_TIMEOUT;
wdt_dev->parent = &pdev->dev;

watchdog_set_drvdata(wdt_dev, &pdev->dev);
platform_set_drvdata(pdev, wdt_dev);
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/jz4740_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ static int jz4740_wdt_probe(struct platform_device *pdev)
jz4740_wdt->timeout = heartbeat;
jz4740_wdt->min_timeout = 1;
jz4740_wdt->max_timeout = MAX_HEARTBEAT;
jz4740_wdt->parent = &pdev->dev;
watchdog_set_nowayout(jz4740_wdt, nowayout);
watchdog_set_drvdata(jz4740_wdt, drvdata);

Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/mena21_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ static int a21_wdt_probe(struct platform_device *pdev)
watchdog_init_timeout(&a21_wdt, 30, &pdev->dev);
watchdog_set_nowayout(&a21_wdt, nowayout);
watchdog_set_drvdata(&a21_wdt, drv);
a21_wdt.parent = &pdev->dev;

reset = a21_wdt_get_bootstatus(drv);
if (reset == 2)
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/menf21bmc_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ static int menf21bmc_wdt_probe(struct platform_device *pdev)
drv_data->wdt.info = &menf21bmc_wdt_info;
drv_data->wdt.min_timeout = BMC_WD_TIMEOUT_MIN;
drv_data->wdt.max_timeout = BMC_WD_TIMEOUT_MAX;
drv_data->wdt.parent = &pdev->dev;
drv_data->i2c_client = i2c_client;

/*
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/omap_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ static int omap_wdt_probe(struct platform_device *pdev)
wdev->wdog.ops = &omap_wdt_ops;
wdev->wdog.min_timeout = TIMER_MARGIN_MIN;
wdev->wdog.max_timeout = TIMER_MARGIN_MAX;
wdev->wdog.parent = &pdev->dev;

if (watchdog_init_timeout(&wdev->wdog, timer_margin, &pdev->dev) < 0)
wdev->wdog.timeout = TIMER_MARGIN_DEFAULT;
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/orion_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ static int orion_wdt_probe(struct platform_device *pdev)

dev->wdt.timeout = wdt_max_duration;
dev->wdt.max_timeout = wdt_max_duration;
dev->wdt.parent = &pdev->dev;
watchdog_init_timeout(&dev->wdt, heartbeat, &pdev->dev);

platform_set_drvdata(pdev, &dev->wdt);
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/pnx4008_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ static int pnx4008_wdt_probe(struct platform_device *pdev)

pnx4008_wdd.bootstatus = (readl(WDTIM_RES(wdt_base)) & WDOG_RESET) ?
WDIOF_CARDRESET : 0;
pnx4008_wdd.parent = &pdev->dev;
watchdog_set_nowayout(&pnx4008_wdd, nowayout);

pnx4008_wdt_stop(&pnx4008_wdd); /* disable for now */
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/qcom-wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ static int qcom_wdt_probe(struct platform_device *pdev)
wdt->wdd.ops = &qcom_wdt_ops;
wdt->wdd.min_timeout = 1;
wdt->wdd.max_timeout = 0x10000000U / wdt->rate;
wdt->wdd.parent = &pdev->dev;

/*
* If 'timeout-sec' unspecified in devicetree, assume a 30 second
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/retu_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ static int retu_wdt_probe(struct platform_device *pdev)
retu_wdt->timeout = RETU_WDT_MAX_TIMER;
retu_wdt->min_timeout = 0;
retu_wdt->max_timeout = RETU_WDT_MAX_TIMER;
retu_wdt->parent = &pdev->dev;

watchdog_set_drvdata(retu_wdt, wdev);
watchdog_set_nowayout(retu_wdt, nowayout);
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/rt2880_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ static int rt288x_wdt_probe(struct platform_device *pdev)
rt288x_wdt_dev.dev = &pdev->dev;
rt288x_wdt_dev.bootstatus = rt288x_wdt_bootcause();
rt288x_wdt_dev.max_timeout = (0xfffful / rt288x_wdt_freq);
rt288x_wdt_dev.parent = &pdev->dev;

watchdog_init_timeout(&rt288x_wdt_dev, rt288x_wdt_dev.max_timeout,
&pdev->dev);
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/s3c2410_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
watchdog_set_nowayout(&wdt->wdt_device, nowayout);

wdt->wdt_device.bootstatus = s3c2410wdt_get_bootstatus(wdt);
wdt->wdt_device.parent = &pdev->dev;

ret = watchdog_register_device(&wdt->wdt_device);
if (ret) {
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/shwdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ static int sh_wdt_probe(struct platform_device *pdev)

watchdog_set_nowayout(&sh_wdt_dev, nowayout);
watchdog_set_drvdata(&sh_wdt_dev, wdt);
sh_wdt_dev.parent = &pdev->dev;

spin_lock_init(&wdt->lock);

Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/sirfsoc_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ static int sirfsoc_wdt_probe(struct platform_device *pdev)

watchdog_init_timeout(&sirfsoc_wdd, timeout, &pdev->dev);
watchdog_set_nowayout(&sirfsoc_wdd, nowayout);
sirfsoc_wdd.parent = &pdev->dev;

ret = watchdog_register_device(&sirfsoc_wdd);
if (ret)
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/sp805_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ sp805_wdt_probe(struct amba_device *adev, const struct amba_id *id)
wdt->adev = adev;
wdt->wdd.info = &wdt_info;
wdt->wdd.ops = &wdt_ops;
wdt->wdd.parent = &adev->dev;

spin_lock_init(&wdt->lock);
watchdog_set_nowayout(&wdt->wdd, nowayout);
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/st_lpc_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ static int st_wdog_probe(struct platform_device *pdev)
return -EINVAL;
}
st_wdog_dev.max_timeout = 0xFFFFFFFF / st_wdog->clkrate;
st_wdog_dev.parent = &pdev->dev;

ret = clk_prepare_enable(clk);
if (ret) {
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/stmp3xxx_rtc_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ static int stmp3xxx_wdt_probe(struct platform_device *pdev)
watchdog_set_drvdata(&stmp3xxx_wdd, &pdev->dev);

stmp3xxx_wdd.timeout = clamp_t(unsigned, heartbeat, 1, STMP3XXX_MAX_TIMEOUT);
stmp3xxx_wdd.parent = &pdev->dev;

ret = watchdog_register_device(&stmp3xxx_wdd);
if (ret < 0) {
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/tegra_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ static int tegra_wdt_probe(struct platform_device *pdev)
wdd->ops = &tegra_wdt_ops;
wdd->min_timeout = MIN_WDT_TIMEOUT;
wdd->max_timeout = MAX_WDT_TIMEOUT;
wdd->parent = &pdev->dev;

watchdog_set_drvdata(wdd, wdt);

Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/twl4030_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ static int twl4030_wdt_probe(struct platform_device *pdev)
wdt->timeout = 30;
wdt->min_timeout = 1;
wdt->max_timeout = 30;
wdt->parent = &pdev->dev;

watchdog_set_nowayout(wdt, nowayout);
platform_set_drvdata(pdev, wdt);
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/txx9wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ static int __init txx9wdt_probe(struct platform_device *dev)
txx9wdt.timeout = timeout;
txx9wdt.min_timeout = 1;
txx9wdt.max_timeout = WD_MAX_TIMEOUT;
txx9wdt.parent = &dev->dev;
watchdog_set_nowayout(&txx9wdt, nowayout);

ret = watchdog_register_device(&txx9wdt);
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/ux500_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ static int ux500_wdt_probe(struct platform_device *pdev)
ux500_wdt.max_timeout = WATCHDOG_MAX28;
}

ux500_wdt.parent = &pdev->dev;
watchdog_set_nowayout(&ux500_wdt, nowayout);

/* disable auto off on sleep */
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/via_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ static int wdt_probe(struct pci_dev *pdev,
timeout = WDT_TIMEOUT;

wdt_dev.timeout = timeout;
wdt_dev.parent = &pdev->dev;
watchdog_set_nowayout(&wdt_dev, nowayout);
if (readl(wdt_mem) & VIA_WDT_FIRED)
wdt_dev.bootstatus |= WDIOF_CARDRESET;
Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/wm831x_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ static int wm831x_wdt_probe(struct platform_device *pdev)

wm831x_wdt->info = &wm831x_wdt_info;
wm831x_wdt->ops = &wm831x_wdt_ops;
wm831x_wdt->parent = &pdev->dev;
watchdog_set_nowayout(wm831x_wdt, nowayout);
watchdog_set_drvdata(wm831x_wdt, driver_data);

Expand Down
1 change: 1 addition & 0 deletions drivers/watchdog/wm8350_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ static int wm8350_wdt_probe(struct platform_device *pdev)

watchdog_set_nowayout(&wm8350_wdt, nowayout);
watchdog_set_drvdata(&wm8350_wdt, wm8350);
wm8350_wdt.parent = &pdev->dev;

/* Default to 4s timeout */
wm8350_wdt_set_timeout(&wm8350_wdt, 4);
Expand Down

0 comments on commit 6551881

Please sign in to comment.