[PATCH -mm2] CardServices compatibility layer

Russell King rmk+pcmcia at arm.linux.org.uk
Mon Dec 29 22:55:47 GMT 2003


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;
...

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core



More information about the linux-pcmcia mailing list