include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / net / ibm_newemac / zmii.c
index d06312901848f75b8dcb0b00303e70fcfc9bf2a7..1f038f808ab32512fdb78ae01b4f54f9f152d5a2 100644 (file)
@@ -3,6 +3,11 @@
  *
  * Driver for PowerPC 4xx on-chip ethernet controller, ZMII bridge support.
  *
+ * Copyright 2007 Benjamin Herrenschmidt, IBM Corp.
+ *                <benh@kernel.crashing.org>
+ *
+ * Based on the arch/ppc version of the driver:
+ *
  * Copyright (c) 2004, 2005 Zultys Technologies.
  * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
  *
@@ -16,6 +21,7 @@
  * option) any later version.
  *
  */
+#include <linux/slab.h>
 #include <linux/kernel.h>
 #include <linux/ethtool.h>
 #include <asm/io.h>
@@ -79,16 +85,18 @@ static inline u32 zmii_mode_mask(int mode, int input)
 int __devinit zmii_attach(struct of_device *ofdev, int input, int *mode)
 {
        struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev);
-       struct zmii_regs *p = dev->base;
+       struct zmii_regs __iomem *p = dev->base;
 
        ZMII_DBG(dev, "init(%d, %d)" NL, input, *mode);
 
-       if (!zmii_valid_mode(*mode))
+       if (!zmii_valid_mode(*mode)) {
                /* Probably an EMAC connected to RGMII,
                 * but it still may need ZMII for MDIO so
                 * we don't fail here.
                 */
+               dev->users++;
                return 0;
+       }
 
        mutex_lock(&dev->lock);
 
@@ -182,7 +190,7 @@ void zmii_set_speed(struct of_device *ofdev, int input, int speed)
        mutex_unlock(&dev->lock);
 }
 
-void __devexit zmii_detach(struct of_device *ofdev, int input)
+void zmii_detach(struct of_device *ofdev, int input)
 {
        struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev);
 
@@ -250,7 +258,7 @@ static int __devinit zmii_probe(struct of_device *ofdev,
        }
 
        rc = -ENOMEM;
-       dev->base = (struct zmii_regs *)ioremap(regs.start,
+       dev->base = (struct zmii_regs __iomem *)ioremap(regs.start,
                                                sizeof(struct zmii_regs));
        if (dev->base == NULL) {
                printk(KERN_ERR "%s: Can't map device registers!\n",