lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1444340074-15437-3-git-send-email-sylvain.rochet@finsecur.com>
Date:	Thu,  8 Oct 2015 23:34:30 +0200
From:	Sylvain Rochet <sylvain.rochet@...secur.com>
To:	Guenter Roeck <linux@...ck-us.net>,
	Boris BREZILLON <boris.brezillon@...e-electrons.com>,
	linux-kernel@...r.kernel.org,
	Nicolas Ferre <nicolas.ferre@...el.com>,
	Ludovic Desroches <ludovic.desroches@...el.com>,
	linux-arm-kernel@...ts.infradead.org,
	Alexandre Belloni <alexandre.belloni@...e-electrons.com>,
	Wenyou Yang <wenyou.yang@...el.com>,
	Wim Van Sebroeck <wim@...ana.be>
Cc:	Sylvain Rochet <sylvain.rochet@...secur.com>
Subject: [PATCH 2/6] watchdog: at91sam9: use watchdog_get_drvdata instead of container_of

Use watchdog_get_drvdata instead of container_of.

Signed-off-by: Sylvain Rochet <sylvain.rochet@...secur.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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ