pcmcia: add bus_type pcmcia_bus_type, struct pcmcia_driver
Subsystems (2)
PATCH 1/1 pcmcia: add bus_type pcmcia_bus_type, struct pcmcia_driver
This patch adds a new bus_type pcmcia_bus_type, and registers all pcmcia drivers with this bus within the old register_pccard_driver() function.
Alternatively, a new registration function "pcmcia_register_driver()" (and its counterpart, "pcmcia_unregister_driver()") can be used -- the pcnet_cs.c driver is converted as an example.
This updated version fixes the compilation breakage seen with gcc-2.95.3 because of incompatible C99 initializers (sorry, Russell).
Please apply,
Dominik
drivers/net/pcmcia/pcnet_cs.c | 13 ++ drivers/pcmcia/ds.c | 224 +++++++++++++++++++++++++++--------------- include/pcmcia/ds.h | 15 ++ 3 files changed, 175 insertions(+), 77 deletions(-)
drivers/net/pcmcia/pcnet_cs.c +11 -2
@@ -1617,6 +1617,15 @@/*====================================================================*/ +static struct pcmcia_driver pcnet_driver = { + .drv = { + .name ="pcnet_cs" , + }, + .attach = pcnet_attach, + .detach = pcnet_detach, + .owner =THIS_MODULE , +}; +static int __init init_pcnet_cs (void ) {servinfo_t serv;
@@ -1627,14 +1636,14 @@ "does not match!\n");return -EINVAL ; } -register_pccard_driver (&dev_info, &pcnet_attach, &pcnet_detach); +pcmcia_register_driver (&pcnet_driver);return 0 ; } static void __exit exit_pcnet_cs(void) {DEBUG (0 ,"pcnet_cs: unloading\n" ); -unregister_pccard_driver (&dev_info); +pcmcia_unregister_driver (&pcnet_driver);while (dev_list !=NULL )pcnet_detach (dev_list); }
drivers/pcmcia/ds.c +149 -75
335 lines not on this page · raw message
include/pcmcia/ds.h +15 -0
@@ -32,6 +32,7 @@#include <pcmcia/driver_ops.h> #include <pcmcia/bulkmem.h> +#include <linux/device.h> typedef struct tuple_parse_t { tuple_t tuple;
@@ -143,6 +144,20 @@#define register_pcmcia_driver register_pccard_driver#define unregister_pcmcia_driver unregister_pccard_driver + +extern struct bus_type pcmcia_bus_type; + +struct pcmcia_driver { +int use_count, status; +dev_link_t *(*attach)(void ); +void (*detach)(dev_link_t *); +struct module *owner; +struct device_driver drv; +}; + +int pcmcia_register_driver (struct pcmcia_driver *driver); +void pcmcia_unregister_driver (struct pcmcia_driver *driver); +#endif /* __KERNEL__ */ #endif /* _LINUX_DS_H */
Quoted 10 lines · Dominik Brodowski
This patch adds a new
bus_typepcmcia_bus_type, and registers all pcmcia drivers with this bus within the oldregister_pccard_driver()function.Alternatively, a new registration function "
pcmcia_register_driver()" (and its counterpart, "pcmcia_unregister_driver()") can be used -- thepcnet_cs.cdriver is converted as an example.This updated version fixes the compilation breakage seen with gcc-2.95.3 because of incompatible C99 initializers (sorry, Russell).
I've applied this patch, and have run the kernel for a few days without problems.
Do you have an example driver ported to this new api? I can help convert drivers.
Quoted 9 lines · John Weber
Quoted 8 lines · Dominik Brodowski
This patch adds a new
bus_typepcmcia_bus_type, and registers all pcmcia drivers with this bus within the oldregister_pccard_driver()function.Alternatively, a new registration function "
pcmcia_register_driver()" (and its counterpart, "pcmcia_unregister_driver()") can be used -- thepcnet_cs.cdriver is converted as an example.
Quoted 5 lines
Quoted 2 lines
This updated version fixes the compilation breakage seen with gcc-2.95.3 because of incompatible C99 initializers (sorry, Russell).
I've applied this patch, and have run the kernel for a few days without problems.
Thanks!
Quoted 2 lines
Do you have an example driver ported to this new api? I can help convert drivers.
That's great. However, this depends on Linus merging my patch. And it may well be (and I even suggest this) that he takes Russell King's pcmcia/cardbus patches first.
The actual changes (in this step of getting rid of cardmgr) are quite few, the larger ones will follow later:
there's a register_pccard_driver() call and a register_pccard_driver somewhere in the pcmcia drivers. forget the first parameter (&dev_info most of the time), the second one becomes the .attach call, the third one the .detach call in a
static struct pcmcia_driver dummy_driver = {
.drv = {
.name = "dummy_cs",
},
.attach = dummy_attach,
.detach = dummy_detach,
.owner = THIS_MODULE,
};Then replace the {un,}register_pccard_driver() with pcmcia_{un,}register_driver(&dummy_driver), respectively.
A sample conversion for the drivers/net/pcmcia/pcnet_cs.c driver can be found within the patch you replied to, btw.
Dominik
Quoted 3 lines · Dominik Brodowski
That's great. However, this depends on Linus merging my patch. And it may well be (and I even suggest this) that he takes Russell King's pcmcia/cardbus patches first.
I doubt my patches will be affecting anything in the area of this patch.
I'm going to try to get the stuff which doesn't touch the PCI related code merged asap so the overall patch size is back down to something managable. Currently, it's extremely hairy trying to sort stuff out into reasonably sized chunks...
Signature · 2 lines
Russell King ([email protected]) The developer of ARM Linux http://www.arm.linux.org.uk/personal/aboutme.html