[PATCH V2] Watchdog: Fix parent of watchdog_devices

2015-08-18 Thread Pratyush Anand
/sys/class/watchdog/watchdogn/device/modalias can help to identify the
driver/module for a given watchdog node. However, many wdt devices does not set
its 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, mpc8xxx, octeon, softdog and w83627hf -- They do not
have any parent. Not sure, how we can we identify driver for these devices.

Signed-off-by: Pratyush Anand 
---
Changes since v1:
Squash all commits of V1 into a single patch.
V1 was here:
http://www.spinics.net/lists/linux-watchdog/msg07220.html

 drivers/misc/mei/wd.c   | 1 +
 drivers/watchdog/bcm2835_wdt.c  | 1 +
 drivers/watchdog/bcm47xx_wdt.c  | 1 +
 drivers/watchdog/bcm_kona_wdt.c | 1 +
 drivers/watchdog/coh901327_wdt.c| 1 +
 drivers/watchdog/da9052_wdt.c   | 1 +
 drivers/watchdog/da9055_wdt.c   | 1 +
 drivers/watchdog/da9062_wdt.c   | 1 +
 drivers/watchdog/da9063_wdt.c   | 1 +
 drivers/watchdog/davinci_wdt.c  | 1 +
 drivers/watchdog/digicolor_wdt.c| 1 +
 drivers/watchdog/ep93xx_wdt.c   | 1 +
 drivers/watchdog/gpio_wdt.c | 1 +
 drivers/watchdog/ie6xx_wdt.c| 1 +
 drivers/watchdog/intel-mid_wdt.c| 1 +
 drivers/watchdog/jz4740_wdt.c   | 1 +
 drivers/watchdog/mena21_wdt.c   | 1 +
 drivers/watchdog/menf21bmc_wdt.c| 1 +
 drivers/watchdog/omap_wdt.c | 1 +
 drivers/watchdog/orion_wdt.c| 1 +
 drivers/watchdog/pnx4008_wdt.c  | 1 +
 drivers/watchdog/qcom-wdt.c | 1 +
 drivers/watchdog/retu_wdt.c | 1 +
 drivers/watchdog/rt2880_wdt.c   | 1 +
 drivers/watchdog/s3c2410_wdt.c  | 1 +
 drivers/watchdog/shwdt.c| 1 +
 drivers/watchdog/sirfsoc_wdt.c  | 1 +
 drivers/watchdog/sp805_wdt.c| 1 +
 drivers/watchdog/st_lpc_wdt.c   | 1 +
 drivers/watchdog/stmp3xxx_rtc_wdt.c | 1 +
 drivers/watchdog/tegra_wdt.c| 1 +
 drivers/watchdog/twl4030_wdt.c  | 1 +
 drivers/watchdog/txx9wdt.c  | 1 +
 drivers/watchdog/ux500_wdt.c| 1 +
 drivers/watchdog/via_wdt.c  | 1 +
 drivers/watchdog/wm831x_wdt.c   | 1 +
 drivers/watchdog/wm8350_wdt.c   | 1 +
 37 files changed, 37 insertions(+)

diff --git a/drivers/misc/mei/wd.c b/drivers/misc/mei/wd.c
index 2bc0f5089f82..b346638833b0 100644
--- a/drivers/misc/mei/wd.c
+++ b/drivers/misc/mei/wd.c
@@ -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);
diff --git a/drivers/watchdog/bcm2835_wdt.c b/drivers/watchdog/bcm2835_wdt.c
index 7116968dee12..66c3e656a616 100644
--- a/drivers/watchdog/bcm2835_wdt.c
+++ b/drivers/watchdog/bcm2835_wdt.c
@@ -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");
diff --git a/drivers/watchdog/bcm47xx_wdt.c b/drivers/watchdog/bcm47xx_wdt.c
index b28a072abf78..4064a43f1360 100644
--- a/drivers/watchdog/bcm47xx_wdt.c
+++ b/drivers/watchdog/bcm47xx_wdt.c
@@ -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;
diff --git a/drivers/watchdog/bcm_kona_wdt.c b/drivers/watchdog/bcm_kona_wdt.c
index 22d8ae65772a..e0c98423f2c9 100644
--- a/drivers/watchdog/bcm_kona_wdt.c
+++ b/drivers/watchdog/bcm_kona_wdt.c
@@ -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) {
diff --git a/drivers/watchdog/coh901327_wdt.c b/drivers/watchdog/coh901327_wdt.c
index ce12f437f195..a099b77fc0b9 100644
--- a/drivers/watchdog/coh901327_wdt.c
+++ b/drivers/watchdog/coh901327_wdt.c
@@ -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,
diff --git a/drivers/watchdog/da9052_wdt.c b/drivers/watchdog/da9052_wdt.c
index 

RE: [PATCH V2] Watchdog: Fix parent of watchdog_devices

2015-08-18 Thread Hartley Sweeten
On Tuesday, August 18, 2015 9:34 AM, Pratyush Anand wrote:
> 
> /sys/class/watchdog/watchdogn/device/modalias can help to identify the
> driver/module for a given watchdog node. However, many wdt devices does not 
> set
> its 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, mpc8xxx, octeon, softdog and w83627hf -- They do 
> not
> have any parent. Not sure, how we can we identify driver for these devices.
>
> Signed-off-by: Pratyush Anand 
> ---
[snip]

drivers/watchdog/ep93xx_wdt.c   | 1 +

[snip]

diff --git a/drivers/watchdog/ep93xx_wdt.c b/drivers/watchdog/ep93xx_wdt.c
index 7a2cc7191c58..0a4d7cc05d54 100644
--- a/drivers/watchdog/ep93xx_wdt.c
+++ b/drivers/watchdog/ep93xx_wdt.c
@@ -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);

For ep93xx_wdt.c, use whichever tag you prefer:

Reviewed-by: H Hartley Sweeten 
Acked-by: H Hartley Sweeten 

Thanks,
Hartley

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V2] Watchdog: Fix parent of watchdog_devices

2015-08-26 Thread Linus Walleij
On Tue, Aug 18, 2015 at 6:34 PM, Pratyush Anand  wrote:

> /sys/class/watchdog/watchdogn/device/modalias can help to identify the
> driver/module for a given watchdog node. However, many wdt devices does not 
> set
> its 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, mpc8xxx, octeon, softdog and w83627hf -- They do 
> not
> have any parent. Not sure, how we can we identify driver for these devices.
>
> Signed-off-by: Pratyush Anand 

Acked-by: Linus Walleij 

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html