Commit 201313f5 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Russell King

[PATCH] kill register_pccard_driver

I tried to get as much in as possible through the maintainers but
didn't get much feedback.. (Except two batches included and Kai
ACKing the ISDN stuff).

So here's a big patch to move the reamining users over to
pcmcia_register_driver and kill it off.
parent 23d2f992
......@@ -3170,9 +3170,18 @@ void mgslpc_remove_device(MGSLPC_INFO *remove_info)
}
}
static struct pcmcia_driver mgslpc_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "synclink_cs",
},
.attach = mgslpc_attach,
.detach = mgslpc_detach,
};
static int __init synclink_cs_init(void)
{
servinfo_t serv;
int error;
if (break_on_load) {
mgslpc_get_text_ptr();
......@@ -3181,13 +3190,9 @@ static int __init synclink_cs_init(void)
printk("%s %s\n", driver_name, driver_version);
CardServices(GetCardServicesInfo, &serv);
if (serv.Revision != CS_RELEASE_CODE) {
printk(KERN_NOTICE "synclink_cs: Card Services release "
"does not match!\n");
return -1;
}
register_pccard_driver(&dev_info, &mgslpc_attach, &mgslpc_detach);
error = pcmcia_register_driver(&mgslpc_driver);
if (error)
return error;
/* Initialize the tty_driver structure */
......@@ -3274,7 +3279,9 @@ static void __exit synclink_cs_exit(void)
printk("%s(%d) failed to unregister callout driver err=%d\n",
__FILE__,__LINE__,rc);
unregister_pccard_driver(&dev_info);
pcmcia_unregister_driver(&mgslpc_driver);
/* XXX: this really needs to move into generic code.. */
while (dev_list != NULL) {
if (dev_list->state & DEV_CONFIG)
mgslpc_release((u_long)dev_list);
......
......@@ -470,28 +470,25 @@ int ide_event(event_t event, int priority,
return 0;
} /* ide_event */
/*====================================================================*/
static struct pcmcia_driver ide_cs_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "ide_cs",
},
.attach = ide_attach,
.detach = ide_detach,
};
static int __init init_ide_cs(void)
{
servinfo_t serv;
DEBUG(0, "%s\n", version);
CardServices(GetCardServicesInfo, &serv);
if (serv.Revision != CS_RELEASE_CODE) {
printk(KERN_NOTICE "ide-cs: Card Services release "
"does not match!\n");
return -EINVAL;
}
register_pccard_driver(&dev_info, &ide_attach, &ide_detach);
return 0;
return pcmcia_register_driver(&ide_cs_driver);
}
static void __exit exit_ide_cs(void)
{
DEBUG(0, "ide-cs: unloading\n");
unregister_pccard_driver(&dev_info);
while (dev_list != NULL)
ide_detach(dev_list);
pcmcia_unregister_driver(&ide_cs_driver);
while (dev_list != NULL)
ide_detach(dev_list);
}
module_init(init_ide_cs);
......
......@@ -510,29 +510,30 @@ static int avmcs_event(event_t event, int priority,
return 0;
} /* avmcs_event */
/*====================================================================*/
static struct pcmcia_driver avmcs_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "avmcs_cs",
},
.attach = avmcs_attach,
.detach = avmcs_detach,
};
static int __init avmcs_init(void)
{
servinfo_t serv;
CardServices(GetCardServicesInfo, &serv);
if (serv.Revision != CS_RELEASE_CODE) {
printk(KERN_NOTICE "avm_cs: Card Services release "
"does not match!\n");
return -1;
}
register_pccard_driver(&dev_info, &avmcs_attach, &avmcs_detach);
return 0;
return pcmcia_register_driver(&avmcs_driver);
}
static void __exit avmcs_exit(void)
{
unregister_pccard_driver(&dev_info);
while (dev_list != NULL) {
if (dev_list->state & DEV_CONFIG)
avmcs_release((u_long)dev_list);
avmcs_detach(dev_list);
}
pcmcia_unregister_driver(&avmcs_driver);
/* XXX: this really needs to move into generic code.. */
while (dev_list != NULL) {
if (dev_list->state & DEV_CONFIG)
avmcs_release((u_long)dev_list);
avmcs_detach(dev_list);
}
}
module_init(avmcs_init);
......
......@@ -515,30 +515,30 @@ static int avma1cs_event(event_t event, int priority,
return 0;
} /* avma1cs_event */
/*====================================================================*/
static struct pcmcia_driver avma1cs_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "avma1_cs",
},
.attach = avma1cs_attach,
.detach = avma1cs_detach,
};
static int __init init_avma1_cs(void)
{
servinfo_t serv;
DEBUG(0, "%s\n", version);
CardServices(GetCardServicesInfo, &serv);
if (serv.Revision != CS_RELEASE_CODE) {
printk(KERN_NOTICE "avma1_cs: Card Services release "
"does not match!\n");
return -1;
}
register_pccard_driver(&dev_info, &avma1cs_attach, &avma1cs_detach);
return 0;
return pcmcia_register_driver(&avma1cs_driver);
}
static void __exit exit_avma1_cs(void)
{
DEBUG(0, "avma1_cs: unloading\n");
unregister_pccard_driver(&dev_info);
while (dev_list != NULL)
if (dev_list->state & DEV_CONFIG)
avma1cs_release((u_long)dev_list);
avma1cs_detach(dev_list);
pcmcia_unregister_driver(&avma1cs_driver);
/* XXX: this really needs to move into generic code.. */
while (dev_list != NULL) {
if (dev_list->state & DEV_CONFIG)
avma1cs_release((u_long)dev_list);
avma1cs_detach(dev_list);
}
}
module_init(init_avma1_cs);
......
......@@ -531,28 +531,27 @@ static int elsa_cs_event(event_t event, int priority,
return 0;
} /* elsa_cs_event */
/*====================================================================*/
static struct pcmcia_driver elsa_cs_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "elsa_cs",
},
.attach = elsa_cs_attach,
.detach = elsa_cs_detach,
};
static int __init init_elsa_cs(void)
{
servinfo_t serv;
DEBUG(0, "%s\n", version);
CardServices(GetCardServicesInfo, &serv);
if (serv.Revision != CS_RELEASE_CODE) {
printk(KERN_NOTICE "elsa_cs: Card Services release "
"does not match!\n");
return -1;
}
register_pccard_driver(&dev_info, &elsa_cs_attach, &elsa_cs_detach);
return 0;
return pcmcia_register_driver(&elsa_cs_driver);
}
static void __exit exit_elsa_cs(void)
{
DEBUG(0, "elsa_cs: unloading\n");
unregister_pccard_driver(&dev_info);
while (dev_list != NULL)
elsa_cs_detach(dev_list);
pcmcia_unregister_driver(&elsa_cs_driver);
/* XXX: this really needs to move into generic code.. */
while (dev_list != NULL)
elsa_cs_detach(dev_list);
}
module_init(init_elsa_cs);
......
......@@ -633,34 +633,32 @@ static int sedlbauer_event(event_t event, int priority,
return 0;
} /* sedlbauer_event */
/*====================================================================*/
static struct pcmcia_driver sedlbauer_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "sedlbauer_cs",
},
.attach = sedlbauer_attach,
.detach = sedlbauer_detach,
};
static int __init init_sedlbauer_cs(void)
{
servinfo_t serv;
DEBUG(0, "%s\n", version);
CardServices(GetCardServicesInfo, &serv);
if (serv.Revision != CS_RELEASE_CODE) {
printk(KERN_NOTICE "sedlbauer_cs: Card Services release "
"does not match!\n");
return -1;
}
register_pccard_driver(&dev_info, &sedlbauer_attach, &sedlbauer_detach);
return 0;
return pcmcia_register_driver(&sedlbauer_driver);
}
static void __exit exit_sedlbauer_cs(void)
{
DEBUG(0, "sedlbauer_cs: unloading\n");
unregister_pccard_driver(&dev_info);
while (dev_list != NULL) {
del_timer(&dev_list->release);
if (dev_list->state & DEV_CONFIG)
sedlbauer_release((u_long)dev_list);
sedlbauer_detach(dev_list);
}
pcmcia_unregister_driver(&sedlbauer_driver);
/* XXX: this really needs to move into generic code.. */
while (dev_list != NULL) {
del_timer(&dev_list->release);
if (dev_list->state & DEV_CONFIG)
sedlbauer_release((u_long)dev_list);
sedlbauer_detach(dev_list);
}
}
module_init(init_sedlbauer_cs);
module_exit(exit_sedlbauer_cs);
......@@ -836,17 +836,18 @@ static dev_link_t *pcmciamtd_attach(void)
return link;
}
static struct pcmcia_driver pcmciamtd_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "pcmciamtd",
},
.attach = pcmciamtd_attach,
.detach = pcmciamtd_detach,
};
static int __init init_pcmciamtd(void)
{
servinfo_t serv;
info(DRIVER_DESC " " DRIVER_VERSION);
CardServices(GetCardServicesInfo, &serv);
if (serv.Revision != CS_RELEASE_CODE) {
err("Card Services release does not match!");
return -1;
}
if(buswidth && buswidth != 1 && buswidth != 2) {
info("bad buswidth (%d), using default", buswidth);
......@@ -860,8 +861,8 @@ static int __init init_pcmciamtd(void)
info("bad mem_type (%d), using default", mem_type);
mem_type = 0;
}
register_pccard_driver(&dev_info, &pcmciamtd_attach, &pcmciamtd_detach);
return 0;
return pcmcia_register_driver(&pcmciamtd_driver);
}
......@@ -870,7 +871,10 @@ static void __exit exit_pcmciamtd(void)
struct list_head *temp1, *temp2;
DEBUG(1, DRIVER_DESC " unloading");
unregister_pccard_driver(&dev_info);
pcmcia_unregister_driver(&pcmciamtd_driver);
/* XXX: this really needs to move into generic code.. */
list_for_each_safe(temp1, temp2, &dev_list) {
dev_link_t *link = &list_entry(temp1, struct pcmciamtd_dev, list)->link;
if (link && (link->state & DEV_CONFIG)) {
......
......@@ -1620,16 +1620,7 @@ static struct pcmcia_driver pcnet_driver = {
static int __init init_pcnet_cs(void)
{
servinfo_t serv;
DEBUG(0, "%s\n", version);
CardServices(GetCardServicesInfo, &serv);
if (serv.Revision != CS_RELEASE_CODE) {
printk(KERN_NOTICE "pcnet_cs: Card Services release "
"does not match!\n");
return -EINVAL;
}
pcmcia_register_driver(&pcnet_driver);
return 0;
return pcmcia_register_driver(&pcnet_driver);
}
static void __exit exit_pcnet_cs(void)
......
......@@ -1743,31 +1743,28 @@ static int netwave_close(struct net_device *dev) {
return 0;
}
static int __init init_netwave_cs(void) {
servinfo_t serv;
DEBUG(0, "%s\n", version);
static struct pcmcia_driver netwave_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "netwave_cs",
},
.attach = netwave_attach,
.detach = netwave_detach,
};
CardServices(GetCardServicesInfo, &serv);
if (serv.Revision != CS_RELEASE_CODE) {
printk("netwave_cs: Card Services release does not match!\n");
return -1;
}
register_pccard_driver(&dev_info, &netwave_attach, &netwave_detach);
return 0;
static int __init init_netwave_cs(void)
{
return pcmcia_register_driver(&netwave_driver);
}
static void __exit exit_netwave_cs(void) {
DEBUG(1, "netwave_cs: unloading\n");
unregister_pccard_driver(&dev_info);
static void __exit exit_netwave_cs(void)
{
pcmcia_unregister_driver(&netwave_driver);
/* Do some cleanup of the device list */
netwave_flush_stale_links();
if(dev_list != NULL) /* Critical situation */
printk("netwave_cs: devices remaining when removing module\n");
/* Do some cleanup of the device list */
netwave_flush_stale_links();
if (dev_list != NULL) /* Critical situation */
printk("netwave_cs: devices remaining when removing module\n");
}
module_init(init_netwave_cs);
......
......@@ -687,29 +687,27 @@ orinoco_cs_event(event_t event, int priority,
* become const */
static char version[] __initdata = "orinoco_cs.c 0.13a (David Gibson <hermes@gibson.dropbear.id.au> and others)";
static struct pcmcia_driver orinoco_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "orinoco_cs",
},
.attach = orinoco_cs_attach,
.detach = orinoco_cs_detach,
};
static int __init
init_orinoco_cs(void)
{
servinfo_t serv;
printk(KERN_DEBUG "%s\n", version);
CardServices(GetCardServicesInfo, &serv);
if (serv.Revision != CS_RELEASE_CODE) {
printk(KERN_NOTICE "orinoco_cs: Card Services release "
"does not match!\n");
return -1;
}
register_pccard_driver(&dev_info, &orinoco_cs_attach, &orinoco_cs_detach);
return 0;
return pcmcia_register_driver(&orinoco_driver);
}
static void __exit
exit_orinoco_cs(void)
{
unregister_pccard_driver(&dev_info);
pcmcia_unregister_driver(&orinoco_driver);
if (dev_list)
DEBUG(0, "orinoco_cs: Removing leftover devices.\n");
......
......@@ -5026,77 +5026,28 @@ wavelan_event(event_t event, /* The event received */
return 0;
}
/****************************** MODULE ******************************/
/*
* Module entry points : insertion & removal
*/
static struct pcmcia_driver wavelan_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "wavelan_cs",
},
.attach = wavelan_attach,
.detach = wavelan_detach,
};
/*------------------------------------------------------------------*/
/*
* Module insertion : initialisation of the module.
* Register the card with cardmgr...
*/
static int __init
init_wavelan_cs(void)
{
servinfo_t serv;
#ifdef DEBUG_MODULE_TRACE
printk(KERN_DEBUG "-> init_wavelan_cs()\n");
#ifdef DEBUG_VERSION_SHOW
printk(KERN_DEBUG "%s", version);
#endif
#endif
CardServices(GetCardServicesInfo, &serv);
if(serv.Revision != CS_RELEASE_CODE)
{
#ifdef DEBUG_CONFIG_ERRORS
printk(KERN_WARNING "init_wavelan_cs: Card Services release does not match!\n");
#endif
return -1;
}
register_pccard_driver(&dev_info, &wavelan_attach, &wavelan_detach);
#ifdef DEBUG_MODULE_TRACE
printk(KERN_DEBUG "<- init_wavelan_cs()\n");
#endif
return 0;
return pcmcia_register_driver(&wavelan_driver);
}
/*------------------------------------------------------------------*/
/*
* Module removal
*/
static void __exit
exit_wavelan_cs(void)
{
#ifdef DEBUG_MODULE_TRACE
printk(KERN_DEBUG "-> cleanup_module()\n");
#endif
#ifdef DEBUG_BASIC_SHOW
printk(KERN_NOTICE "wavelan_cs: unloading\n");
#endif
/* Do some cleanup of the device list */
wv_flush_stale_links();
/* Do some cleanup of the device list */
wv_flush_stale_links();
/* If there remain some devices... */
#ifdef DEBUG_CONFIG_ERRORS
if(dev_list != NULL)
{
/* Honestly, if this happen we are in a deep s**t */
printk(KERN_INFO "wavelan_cs: devices remaining when removing module\n");
printk(KERN_INFO "Please flush your disks and reboot NOW !\n");
}
#endif
unregister_pccard_driver(&dev_info);
#ifdef DEBUG_MODULE_TRACE
printk(KERN_DEBUG "<- cleanup_module()\n");
#endif
pcmcia_unregister_driver(&wavelan_driver);
}
module_init(init_wavelan_cs);
......
......@@ -390,28 +390,27 @@ int parport_event(event_t event, int priority,
return 0;
} /* parport_event */
/*====================================================================*/
static struct pcmcia_driver parport_cs_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "parport_cs",
},
.attach = parport_attach,
.detach = parport_detach,
};
static int __init init_parport_cs(void)
{
servinfo_t serv;
DEBUG(0, "%s\n", version);
CardServices(GetCardServicesInfo, &serv);
if (serv.Revision != CS_RELEASE_CODE) {
printk(KERN_NOTICE "parport_cs: Card Services release "
"does not match!\n");
return -EINVAL;
}
register_pccard_driver(&dev_info, &parport_attach, &parport_detach);
return 0;
return pcmcia_register_driver(&parport_cs_driver);
}
static void __exit exit_parport_cs(void)
{
DEBUG(0, "parport_cs: unloading\n");
unregister_pccard_driver(&dev_info);
while (dev_list != NULL)
parport_detach(dev_list);
pcmcia_unregister_driver(&parport_cs_driver);
/* XXX: this really needs to move into generic code.. */
while (dev_list != NULL)
parport_detach(dev_list);
}
module_init(init_parport_cs);
......
......@@ -182,50 +182,6 @@ void pcmcia_unregister_driver(struct pcmcia_driver *driver)
}
EXPORT_SYMBOL(pcmcia_unregister_driver);
int register_pccard_driver(dev_info_t *dev_info,
dev_link_t *(*attach)(void),
void (*detach)(dev_link_t *))
{
struct pcmcia_driver *driver;
DEBUG(0, "ds: register_pccard_driver('%s')\n", (char *)dev_info);
driver = get_pcmcia_driver(dev_info);
if (driver)
return -EBUSY;
driver = kmalloc(sizeof(struct pcmcia_driver), GFP_KERNEL);
if (!driver) return -ENOMEM;
memset(driver, 0, sizeof(struct pcmcia_driver));
driver->drv.name = (char *)dev_info;
pcmcia_register_driver(driver);
driver->attach = attach;
driver->detach = detach;
return 0;
} /* register_pccard_driver */
/*====================================================================*/
int unregister_pccard_driver(dev_info_t *dev_info)
{
struct pcmcia_driver *driver;
DEBUG(0, "ds: unregister_pccard_driver('%s')\n",
(char *)dev_info);
driver = get_pcmcia_driver(dev_info);
if (!driver)
return -ENODEV;
pcmcia_unregister_driver(driver);
kfree(driver);
return 0;
} /* unregister_pccard_driver */
/*====================================================================*/
#ifdef CONFIG_PROC_FS
static int proc_read_drivers_callback(struct device_driver *driver, void *d)
{
......@@ -878,11 +834,6 @@ static struct file_operations ds_fops = {
.poll = ds_poll,
};
EXPORT_SYMBOL(register_pccard_driver);
EXPORT_SYMBOL(unregister_pccard_driver);
/*====================================================================*/
static int __devinit pcmcia_bus_add_socket(struct device *dev, unsigned int socket_nr)
{
client_reg_t client_reg;
......
......@@ -156,12 +156,6 @@ struct pcmcia_driver {
int pcmcia_register_driver(struct pcmcia_driver *driver);
void pcmcia_unregister_driver(struct pcmcia_driver *driver);
/* legacy driver registration interface. don't use in new code */
int register_pccard_driver(dev_info_t *dev_info,
dev_link_t *(*attach)(void),
void (*detach)(dev_link_t *));
int unregister_pccard_driver(dev_info_t *dev_info);
/* error reporting */
void cs_error(client_handle_t handle, int func, int ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment