[PATCH] i2c: devtree-aware iic support for PPC4xx

Eugene Surovegin ebs at ebshome.net
Mon Sep 17 16:22:57 EST 2007


On Mon, Sep 17, 2007 at 07:34:08AM +0200, Stefan Roese wrote:
> 
> My understanding was, that adding many #ifdef's into the code was not the 
> preferred way. 

But just making a copy seems to be a proffered one? Wow.

OCP and/or OF part is quite small part of the driver; another approach 
would been completely splitting OCP and OF specific part out 
(e.g. i2c-ibm_iic.c + i2c-ibm_iic_ocp.c / i2c_ibm_iic_of.c). I 
personally thing it's not worth the effort and just adding couple of 
ifdef'ed code is good enough, especially as a transitional thing.

> I could of course change this patch to not add an additional 
> driver but extend the existing driver with a bunch of #ifdef's to support 
> both versions.
> 
> This approach of multiple drivers seems to be common in the kernel right now:
> 
> drivers/mtd/maps/physmap.c
> drivers/mtd/maps/physmap_of.c
> 
> or
> 
> drivers/usb/host/ohci-ppc-soc.c
> drivers/usb/host/ohci-ppc-of.c

I don't think these are good examples, physmap.c seems to differ from 
physmap_of.c significantly. These drivers are mostly a glue, and it 
makes sense to have different versions, because there isn't much there 
except for platform/bus/glue specific code.

> Any other opinions on this? How should this be handled to get accepted 
> upstream? Two different drivers with removing the "old" one later when 
> arch/ppc is gone,

ppc has been going away for the last two years at least and still 
isn't gone. What makes you think this isn't gonna take another year or 
two :) ?

> 
> The "old" name "i2c-ibm_iic" is kind of redundant. Nearly all bus drivers are 
> named "i2c-platform". Perhaps a better name would be "i2c-ppc4xx" then. 

Sure, that'd be a much better choice.

-- 
Eugene




More information about the Linuxppc-dev mailing list