From: Wenyou Yang <wenyou.yang@atmel.com>
To: linux-arm-kernel@lists.infradead.org
Cc: wim@iguana.be, linux-watchdog@vger.kernel.org,
linux-kernel@vger.kernel.org, nicolas.ferre@atmel.com,
plagnioj@jcrosoft.com, wenyou.yang@atmel.com, JM.Lin@atmel.com
Subject: [PATCH 03/11] watchdog/at91sam9_wdt: change the wdt_read and wdt_write macro to the inline function
Date: Wed, 14 Nov 2012 15:16:01 +0800 [thread overview]
Message-ID: <1352877369-19740-4-git-send-email-wenyou.yang@atmel.com> (raw)
In-Reply-To: <1352877369-19740-1-git-send-email-wenyou.yang@atmel.com>
Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
---
drivers/watchdog/at91sam9_wdt.c | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c
index 31c914a..98e7d5a 100644
--- a/drivers/watchdog/at91sam9_wdt.c
+++ b/drivers/watchdog/at91sam9_wdt.c
@@ -34,11 +34,6 @@
#define DRV_NAME "AT91SAM9 Watchdog"
-#define wdt_read(field) \
- __raw_readl(at91wdt_private.base + field)
-#define wdt_write(field, val) \
- __raw_writel((val), at91wdt_private.base + field)
-
/* AT91SAM9 watchdog runs a 12bit counter @ 256Hz,
* use this to convert a watchdog
* value from/to milliseconds.
@@ -75,13 +70,24 @@ struct at91wdt_drvdata {
/* ......................................................................... */
+static inline unsigned int wdt_read(struct at91wdt_drvdata *driver_data,
+ unsigned int field)
+{
+ return __raw_readl(driver_data->base + field);
+}
+
+static inline void wdt_write(struct at91wdt_drvdata *driver_data,
+ unsigned int field, unsigned int val)
+{
+ __raw_writel((val), driver_data->base + field);
+}
/*
* Reload the watchdog timer. (ie, pat the watchdog)
*/
-static inline void at91_wdt_reset(void)
+static inline void at91_wdt_reset(struct at91wdt_drvdata *driver_data)
{
- wdt_write(AT91_WDT_CR, AT91_WDT_KEY | AT91_WDT_WDRSTT);
+ wdt_write(driver_data, AT91_WDT_CR, AT91_WDT_KEY | AT91_WDT_WDRSTT);
}
/*
@@ -103,13 +109,15 @@ static void at91_ping(unsigned long data)
* Set the watchdog time interval in 1/256Hz (write-once)
* Counter is 12 bit.
*/
-static int at91_wdt_settimeout(unsigned int timeout)
+static int at91_wdt_settimeout(struct watchdog_device *wddev,
+ unsigned int timeout)
{
+ struct at91wdt_drvdata *driver_data = watchdog_get_drvdata(wddev);
unsigned int reg;
unsigned int mr;
/* Check if disabled */
- mr = wdt_read(AT91_WDT_MR);
+ mr = wdt_read(driver_data, AT91_WDT_MR);
if (mr & AT91_WDT_WDDIS) {
pr_err("sorry, watchdog is disabled\n");
return -EIO;
@@ -126,7 +134,7 @@ static int at91_wdt_settimeout(unsigned int timeout)
| AT91_WDT_WDDBGHLT /* disabled in debug mode */
| AT91_WDT_WDD /* restart at any time */
| (timeout & AT91_WDT_WDV); /* timer value */
- wdt_write(AT91_WDT_MR, reg);
+ wdt_write(driver_data, AT91_WDT_MR, reg);
return 0;
}
--
1.7.9.5
next prev parent reply other threads:[~2012-11-14 7:19 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-14 7:15 [PATCH 00/11] watchdog/at91sam9_wdt: use watchdog framework, support DT Wenyou Yang
2012-11-14 7:15 ` [PATCH 01/11] watchdog/at91sam9_wdt: remove the file_operations struct Wenyou Yang
2012-11-16 13:54 ` Jean-Christophe PLAGNIOL-VILLARD
2012-12-04 3:26 ` Yang, Wenyou
[not found] ` <50BDAD44.7060200@atmel.com>
2012-12-04 8:07 ` Yang, Wenyou
2012-11-14 7:16 ` [PATCH 02/11] watchdog/at91sam9_wdt: change the at91wdt_private struct to the at91wdt_drvdata struct Wenyou Yang
2012-11-14 7:16 ` Wenyou Yang [this message]
2012-11-16 13:49 ` [PATCH 03/11] watchdog/at91sam9_wdt: change the wdt_read and wdt_write macro to the inline function Jean-Christophe PLAGNIOL-VILLARD
2012-12-04 3:13 ` Yang, Wenyou
2012-11-14 7:16 ` [PATCH 04/11] watchdog/at91sam9_wdt: change "at91_wdt_settimeout" function name to "at91wdt_enable" Wenyou Yang
2012-11-14 7:16 ` [PATCH 05/11] watchdog/at91sam9_wdt: add to use the watchdog framework Wenyou Yang
2012-11-14 7:16 ` [PATCH 06/11] watchdog/at91sam9_wdt: change the timer function name Wenyou Yang
2012-11-14 7:16 ` [PATCH 07/11] watchdog/at91sam9_wdt: add nowayout helpers to Watchdog Timer Driver Kernel API Wenyou Yang
2012-11-14 7:16 ` [PATCH 08/11] watchdog/at91sam9_wdt: use module_platform_driver() Wenyou Yang
2012-11-14 7:16 ` [PATCH 09/11] watchdog/at91sam9_wdt: add support to device tree Wenyou Yang
2012-11-16 13:56 ` Nicolas Ferre
2012-11-14 7:16 ` [PATCH 10/11] watchdog/at91sam9_wdt: using dev_info replaces pr_info, dev_crit repalces pr_crit Wenyou Yang
2012-11-14 7:16 ` [PATCH 11/11] ARM: dts: add the watchdog nodes for atmel SoC Wenyou Yang
2012-11-16 13:50 ` [PATCH 00/11] watchdog/at91sam9_wdt: use watchdog framework, support DT Jean-Christophe PLAGNIOL-VILLARD
2012-12-04 3:12 ` Yang, Wenyou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1352877369-19740-4-git-send-email-wenyou.yang@atmel.com \
--to=wenyou.yang@atmel.com \
--cc=JM.Lin@atmel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=nicolas.ferre@atmel.com \
--cc=plagnioj@jcrosoft.com \
--cc=wim@iguana.be \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®