[PATCH -mm2] CardServices compatibility layer

Andrew Morton akpm at osdl.org
Mon Dec 29 14:57:21 GMT 2003


Russell King <rmk+pcmcia at arm.linux.org.uk> wrote:
>
> On Mon, Dec 29, 2003 at 01:26:50PM -0800, Andrew Morton wrote:
> > Russell King <rmk+pcmcia at arm.linux.org.uk> wrote:
> > >  There are two solutions to this problem:
> > >   - keep the old CardServices() as is with all its broken quirks
> > >   - use the preprocessor to convert the old API to something better.
> > >     iow:
> > > 
> > >  #define CardServices(x,args...) __pcmcia_##x(args)
> > > 
> > >  #define __pcmcia_RegisterClient pcmcia_register_client
> > > 
> > >  and so forth.  I think the latter is preferable than the former from a
> > >  correctness point of view if we have to keep the old calling convention,
> > >  even though it means a fairly disgusting set of #defines.
> > 
> > Well there's the third way, which is what Dominik did: implement a real
> > CardServices() function which has a big switch statement, calls out to the
> > new API.  Seems reasonable, doesn't it?
> 
> Isn't that exactly what we've just removed from cs.c, and was the
> cause of the original problem which Arjan reported?
> 
> int CardServices(int func, void *a1, void *a2, void *a3)
> {
> ...
>     switch (func) {
>     case AccessConfigurationRegister:
>         return pcmcia_access_configuration_register(a1, a2); break;
>     case AdjustResourceInfo:
>         return pcmcia_adjust_resource_info(a1, a2); break;
> ...
> 

yup, but this is a *compatibility* layer, for thus-far unconverted drivers.
 Out-of-tree ones, presumably.




More information about the linux-pcmcia mailing list