Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=422db8d229affd429b5a7389600877aa7dea2704
Commit:     422db8d229affd429b5a7389600877aa7dea2704
Parent:     28dd1b0b9191ac9cd0b96fa4d09d951498bfbadb
Author:     Dale Farnsworth <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 24 11:07:38 2007 -0700
Committer:  Wim Van Sebroeck <[EMAIL PROTECTED]>
CommitDate: Tue Jul 24 18:56:35 2007 +0000

    [WATCHDOG] mv64x60_wdt: set up platform_device in platform code
    
    The driver previously registered its platform device data in its own
    init function--that's bogus.  Move that code to platform-specific
    code in arch/ppc.  This is being done so that the platform code can
    decide at runtime whether to initialize this driver or not.
    
    Signed-off-by: Dale Farnsworth <[EMAIL PROTECTED]>
    Signed-off-by: Wim Van Sebroeck <[EMAIL PROTECTED]>
---
 arch/ppc/syslib/mv64x60.c           |   29 +++++++++++++++++++++++++++++
 drivers/char/watchdog/mv64x60_wdt.c |   26 +-------------------------
 include/asm-ppc/mv64x60.h           |    2 +-
 3 files changed, 31 insertions(+), 26 deletions(-)

diff --git a/arch/ppc/syslib/mv64x60.c b/arch/ppc/syslib/mv64x60.c
index d212b1c..2744b8a 100644
--- a/arch/ppc/syslib/mv64x60.c
+++ b/arch/ppc/syslib/mv64x60.c
@@ -441,6 +441,32 @@ static struct platform_device i2c_device = {
 };
 #endif
 
+#ifdef CONFIG_WATCHDOG
+static struct mv64x60_wdt_pdata mv64x60_wdt_pdata = {
+       .timeout                = 10,  /* default watchdog expiry in seconds */
+       .bus_clk                = 133, /* default bus clock in MHz */
+};
+
+static struct resource mv64x60_wdt_resources[] = {
+       [0] = {
+               .name   = "mv64x60 wdt base",
+               .start  = MV64x60_WDT_WDC,
+               .end    = MV64x60_WDT_WDC + 8 - 1, /* two 32-bit registers */
+               .flags  = IORESOURCE_MEM,
+       },
+};
+
+static struct platform_device wdt_device = {
+       .name           = MV64x60_WDT_NAME,
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(mv64x60_wdt_resources),
+       .resource       = mv64x60_wdt_resources,
+       .dev = {
+               .platform_data = &mv64x60_wdt_pdata,
+       },
+};
+#endif
+
 #if defined(CONFIG_SYSFS) && !defined(CONFIG_GT64260)
 static struct mv64xxx_pdata mv64xxx_pdata = {
        .hs_reg_valid   = 0,
@@ -476,6 +502,9 @@ static struct platform_device *mv64x60_pd_devs[] __initdata 
= {
 #ifdef CONFIG_I2C_MV64XXX
        &i2c_device,
 #endif
+#ifdef CONFIG_MV64X60_WDT
+       &wdt_device,
+#endif
 #if defined(CONFIG_SYSFS) && !defined(CONFIG_GT64260)
        &mv64xxx_device,
 #endif
diff --git a/drivers/char/watchdog/mv64x60_wdt.c 
b/drivers/char/watchdog/mv64x60_wdt.c
index b887cdb..038f76e 100644
--- a/drivers/char/watchdog/mv64x60_wdt.c
+++ b/drivers/char/watchdog/mv64x60_wdt.c
@@ -219,40 +219,16 @@ static struct platform_driver mv64x60_wdt_driver = {
        },
 };
 
-static struct platform_device *mv64x60_wdt_dev;
-
 static int __init mv64x60_wdt_init(void)
 {
-       int ret;
-
        printk(KERN_INFO "MV64x60 watchdog driver\n");
 
-       mv64x60_wdt_dev = platform_device_alloc(MV64x60_WDT_NAME, -1);
-       if (!mv64x60_wdt_dev) {
-               ret = -ENOMEM;
-               goto out;
-       }
-
-       ret = platform_device_add(mv64x60_wdt_dev);
-       if (ret) {
-               platform_device_put(mv64x60_wdt_dev);
-               goto out;
-       }
-
-       ret = platform_driver_register(&mv64x60_wdt_driver);
-       if (ret) {
-               platform_device_unregister(mv64x60_wdt_dev);
-               goto out;
-       }
-
- out:
-       return ret;
+       return platform_driver_register(&mv64x60_wdt_driver);
 }
 
 static void __exit mv64x60_wdt_exit(void)
 {
        platform_driver_unregister(&mv64x60_wdt_driver);
-       platform_device_unregister(mv64x60_wdt_dev);
 }
 
 module_init(mv64x60_wdt_init);
diff --git a/include/asm-ppc/mv64x60.h b/include/asm-ppc/mv64x60.h
index db3776f..fa6230f 100644
--- a/include/asm-ppc/mv64x60.h
+++ b/include/asm-ppc/mv64x60.h
@@ -121,7 +121,7 @@ extern spinlock_t mv64x60_lock;
 #define        MV64x60_64BIT_WIN_COUNT                 24
 
 /* Watchdog Platform Device, Driver Data */
-#define        MV64x60_WDT_NAME                        "wdt"
+#define        MV64x60_WDT_NAME                        "mv64x60_wdt"
 
 struct mv64x60_wdt_pdata {
        int     timeout;        /* watchdog expiry in seconds, default 10 */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to