Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1242746

[PATCH 2/6] watchdog: at91sam9: use watchdog_get_drvdata instead of container_of

From Sylvain Rochet <sylvain.rochet@finsecur.com>
Newsgroups linux.kernel
Subject [PATCH 2/6] watchdog: at91sam9: use watchdog_get_drvdata instead of container_of
Date 2015-10-08 23:40 +0200
Message-ID <qhr4S-7fJ-17@gated-at.bofh.it> (permalink)
References <qhr4S-7fJ-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Use watchdog_get_drvdata instead of container_of.

Signed-off-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
---
 drivers/watchdog/at91sam9_wdt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c
index 88f56b5..8c1c9de 100644
--- a/drivers/watchdog/at91sam9_wdt.c
+++ b/drivers/watchdog/at91sam9_wdt.c
@@ -80,7 +80,6 @@ module_param(nowayout, bool, 0);
 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started "
 	"(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
-#define to_wdt(wdd) container_of(wdd, struct at91wdt, wdd)
 struct at91wdt {
 	struct watchdog_device wdd;
 	void __iomem *base;
@@ -134,7 +133,7 @@ static void at91_ping(unsigned long data)
 
 static int at91_wdt_start(struct watchdog_device *wdd)
 {
-	struct at91wdt *wdt = to_wdt(wdd);
+	struct at91wdt *wdt = watchdog_get_drvdata(wdd);
 	/* calculate when the next userspace timeout will be */
 	wdt->next_heartbeat = jiffies + wdd->timeout * HZ;
 	return 0;
@@ -349,6 +348,8 @@ static int __init at91wdt_probe(struct platform_device *pdev)
 	wdt->wdd.min_timeout = 1;
 	wdt->wdd.max_timeout = 0xFFFF;
 
+	watchdog_set_drvdata(&wdt->wdd, wdt);
+
 	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	wdt->base = devm_ioremap_resource(&pdev->dev, r);
 	if (IS_ERR(wdt->base))
-- 
2.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/6] watchdog: sama5d4 and at91sam9: trivial rework Sylvain Rochet <sylvain.rochet@finsecur.com> - 2015-10-08 23:40 +0200
  [PATCH 5/6] watchdog: at91sam9: remove unused pdata support Sylvain Rochet <sylvain.rochet@finsecur.com> - 2015-10-08 23:40 +0200
  [PATCH 6/6] watchdog: sama5d4: try to set timeout from device tree first Sylvain Rochet <sylvain.rochet@finsecur.com> - 2015-10-08 23:40 +0200
    Re: [PATCH 6/6] watchdog: sama5d4: try to set timeout from device  tree first Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2015-10-12 10:00 +0200
      RE: [PATCH 6/6] watchdog: sama5d4: try to set timeout from device  tree first "Yang, Wenyou" <Wenyou.Yang@atmel.com> - 2015-10-12 10:20 +0200
        Re: [PATCH 6/6] watchdog: sama5d4: try to set timeout from device  tree first Sylvain Rochet <sylvain.rochet@finsecur.com> - 2015-10-12 16:00 +0200
      Re: [PATCH 6/6] watchdog: sama5d4: try to set timeout from device  tree first Sylvain Rochet <sylvain.rochet@finsecur.com> - 2015-10-12 11:10 +0200
  [PATCH 2/6] watchdog: at91sam9: use watchdog_get_drvdata instead of container_of Sylvain Rochet <sylvain.rochet@finsecur.com> - 2015-10-08 23:40 +0200
  [PATCH 4/6] watchdog: at91sam9: remove nowayout useless copy Sylvain Rochet <sylvain.rochet@finsecur.com> - 2015-10-08 23:40 +0200

csiph-web