summaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/mdio_bus.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2012-01-17 22:55:28 +1000
committerPaul Mundt <lethal@linux-sh.org>2012-01-17 22:55:28 +1000
commit0c929238ca4baefe47f4034732db4c154f2329c6 (patch)
tree2636079800fa045501982a70e1be0425c1b968c2 /drivers/net/phy/mdio_bus.c
parent6d7120a713300283a8b73e7d86cd1bab8b9d1971 (diff)
parent78da107a7ed14fbc6ef77ff4c41d92b11edc9036 (diff)
downloadop-kernel-dev-0c929238ca4baefe47f4034732db4c154f2329c6.zip
op-kernel-dev-0c929238ca4baefe47f4034732db4c154f2329c6.tar.gz
Merge branch 'sh/platform-updates' into sh-latest
Diffstat (limited to 'drivers/net/phy/mdio_bus.c')
-rw-r--r--drivers/net/phy/mdio_bus.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 6c58da2..88cc5db 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -37,22 +37,36 @@
#include <asm/uaccess.h>
/**
- * mdiobus_alloc - allocate a mii_bus structure
+ * mdiobus_alloc_size - allocate a mii_bus structure
*
* Description: called by a bus driver to allocate an mii_bus
* structure to fill in.
+ *
+ * 'size' is an an extra amount of memory to allocate for private storage.
+ * If non-zero, then bus->priv is points to that memory.
*/
-struct mii_bus *mdiobus_alloc(void)
+struct mii_bus *mdiobus_alloc_size(size_t size)
{
struct mii_bus *bus;
+ size_t aligned_size = ALIGN(sizeof(*bus), NETDEV_ALIGN);
+ size_t alloc_size;
+
+ /* If we alloc extra space, it should be aligned */
+ if (size)
+ alloc_size = aligned_size + size;
+ else
+ alloc_size = sizeof(*bus);
- bus = kzalloc(sizeof(*bus), GFP_KERNEL);
- if (bus != NULL)
+ bus = kzalloc(alloc_size, GFP_KERNEL);
+ if (bus) {
bus->state = MDIOBUS_ALLOCATED;
+ if (size)
+ bus->priv = (void *)bus + aligned_size;
+ }
return bus;
}
-EXPORT_SYMBOL(mdiobus_alloc);
+EXPORT_SYMBOL(mdiobus_alloc_size);
/**
* mdiobus_release - mii_bus device release callback
OpenPOWER on IntegriCloud