[PATCH] phylib: update mdiobus_alloc() to allocate extra private space

David Miller davem at davemloft.net
Sat Dec 17 07:31:37 EST 2011


From: Timur Tabi <timur at freescale.com>
Date: Thu, 15 Dec 2011 10:51:35 -0600

> Augment mdiobus_alloc() to take a parameter indicating the number of extra
> bytes to allocate for private data.  Almost all callers of mdiobus_alloc()
> separately allocate a private data structure.  By allowing mdiobus_alloc()
> to allocate extra memory, the two allocations can be merged into one.
> 
> This patch does not change any of the callers to actually take advantage
> of this feature, however.  That change can be made by the individual
> maintainers at their leisure.  For now, all callers ask for zero additional
> bytes, which mimics the previous behavior.
> 
> Signed-off-by: Timur Tabi <timur at freescale.com>

Come on...

Not one driver even uses the new facility, and on top of it you edit
all of these drivers for no reason at all.

You could edit only two source files instead of more than 30 by simply
doing:

struct mii_bus *mdiobus_alloc_size(size_t size);

static inline struct mii_bus *mdiobus_alloc(void)
{
	return mdiobus_alloc_size(0):
}


More information about the Linuxppc-dev mailing list