Commit cc3b4866 authored by Dominik Brodowski's avatar Dominik Brodowski

[PATCH] pcmcia: unify detach, REMOVAL_EVENT handlers into one remove callback

Unify the "detach" and REMOVAL_EVENT handlers to one "remove" function.
Old functionality is preserved, for the moment.
Signed-off-by: 's avatarDominik Brodowski <linux@dominikbrodowski.net>
parent 8e9e793d
This file details changes in 2.6 which affect PCMCIA card driver authors:
* Unify detach and REMOVAL event code (as of 2.6.16)
void (*remove) (struct pcmcia_device *dev);
* Move suspend, resume and reset out of event handler (as of 2.6.16)
int (*suspend) (struct pcmcia_device *dev);
int (*resume) (struct pcmcia_device *dev);
......
......@@ -92,7 +92,7 @@ static int bluecard_event(event_t event, int priority, event_callback_args_t *ar
static dev_info_t dev_info = "bluecard_cs";
static dev_link_t *bluecard_attach(void);
static void bluecard_detach(dev_link_t *);
static void bluecard_detach(struct pcmcia_device *p_dev);
static dev_link_t *dev_list = NULL;
......@@ -899,7 +899,7 @@ static dev_link_t *bluecard_attach(void)
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != CS_SUCCESS) {
cs_error(link->handle, RegisterClient, ret);
bluecard_detach(link);
bluecard_detach(link->handle);
return NULL;
}
......@@ -907,11 +907,11 @@ static dev_link_t *bluecard_attach(void)
}
static void bluecard_detach(dev_link_t *link)
static void bluecard_detach(struct pcmcia_device *p_dev)
{
dev_link_t *link = dev_to_instance(p_dev);
bluecard_info_t *info = link->priv;
dev_link_t **linkp;
int ret;
/* Locate device structure */
for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
......@@ -924,12 +924,6 @@ static void bluecard_detach(dev_link_t *link)
if (link->state & DEV_CONFIG)
bluecard_release(link);
if (link->handle) {
ret = pcmcia_deregister_client(link->handle);
if (ret != CS_SUCCESS)
cs_error(link->handle, DeregisterClient, ret);
}
/* Unlink device structure, free bits */
*linkp = link->next;
......@@ -1070,16 +1064,8 @@ static int bluecard_resume(struct pcmcia_device *dev)
static int bluecard_event(event_t event, int priority, event_callback_args_t *args)
{
dev_link_t *link = args->client_data;
bluecard_info_t *info = link->priv;
switch (event) {
case CS_EVENT_CARD_REMOVAL:
link->state &= ~DEV_PRESENT;
if (link->state & DEV_CONFIG) {
bluecard_close(info);
bluecard_release(link);
}
break;
case CS_EVENT_CARD_INSERTION:
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
bluecard_config(link);
......@@ -1104,7 +1090,7 @@ static struct pcmcia_driver bluecard_driver = {
},
.attach = bluecard_attach,
.event = bluecard_event,
.detach = bluecard_detach,
.remove = bluecard_detach,
.id_table = bluecard_ids,
.suspend = bluecard_suspend,
.resume = bluecard_resume,
......
......@@ -95,7 +95,7 @@ static int bt3c_event(event_t event, int priority, event_callback_args_t *args);
static dev_info_t dev_info = "bt3c_cs";
static dev_link_t *bt3c_attach(void);
static void bt3c_detach(dev_link_t *);
static void bt3c_detach(struct pcmcia_device *p_dev);
static dev_link_t *dev_list = NULL;
......@@ -700,7 +700,7 @@ static dev_link_t *bt3c_attach(void)
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != CS_SUCCESS) {
cs_error(link->handle, RegisterClient, ret);
bt3c_detach(link);
bt3c_detach(link->handle);
return NULL;
}
......@@ -708,11 +708,11 @@ static dev_link_t *bt3c_attach(void)
}
static void bt3c_detach(dev_link_t *link)
static void bt3c_detach(struct pcmcia_device *p_dev)
{
dev_link_t *link = dev_to_instance(p_dev);
bt3c_info_t *info = link->priv;
dev_link_t **linkp;
int ret;
/* Locate device structure */
for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
......@@ -725,12 +725,6 @@ static void bt3c_detach(dev_link_t *link)
if (link->state & DEV_CONFIG)
bt3c_release(link);
if (link->handle) {
ret = pcmcia_deregister_client(link->handle);
if (ret != CS_SUCCESS)
cs_error(link->handle, DeregisterClient, ret);
}
/* Unlink device structure, free bits */
*linkp = link->next;
......@@ -916,16 +910,8 @@ static int bt3c_resume(struct pcmcia_device *dev)
static int bt3c_event(event_t event, int priority, event_callback_args_t *args)
{
dev_link_t *link = args->client_data;
bt3c_info_t *info = link->priv;
switch (event) {
case CS_EVENT_CARD_REMOVAL:
link->state &= ~DEV_PRESENT;
if (link->state & DEV_CONFIG) {
bt3c_close(info);
bt3c_release(link);
}
break;
case CS_EVENT_CARD_INSERTION:
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
bt3c_config(link);
......@@ -948,7 +934,7 @@ static struct pcmcia_driver bt3c_driver = {
},
.attach = bt3c_attach,
.event = bt3c_event,
.detach = bt3c_detach,
.remove = bt3c_detach,
.id_table = bt3c_ids,
.suspend = bt3c_suspend,
.resume = bt3c_resume,
......
......@@ -91,7 +91,7 @@ static int btuart_event(event_t event, int priority, event_callback_args_t *args
static dev_info_t dev_info = "btuart_cs";
static dev_link_t *btuart_attach(void);
static void btuart_detach(dev_link_t *);
static void btuart_detach(struct pcmcia_device *p_dev);
static dev_link_t *dev_list = NULL;
......@@ -619,7 +619,7 @@ static dev_link_t *btuart_attach(void)
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != CS_SUCCESS) {
cs_error(link->handle, RegisterClient, ret);
btuart_detach(link);
btuart_detach(link->handle);
return NULL;
}
......@@ -627,11 +627,11 @@ static dev_link_t *btuart_attach(void)
}
static void btuart_detach(dev_link_t *link)
static void btuart_detach(struct pcmcia_device *p_dev)
{
dev_link_t *link = dev_to_instance(p_dev);
btuart_info_t *info = link->priv;
dev_link_t **linkp;
int ret;
/* Locate device structure */
for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
......@@ -644,12 +644,6 @@ static void btuart_detach(dev_link_t *link)
if (link->state & DEV_CONFIG)
btuart_release(link);
if (link->handle) {
ret = pcmcia_deregister_client(link->handle);
if (ret != CS_SUCCESS)
cs_error(link->handle, DeregisterClient, ret);
}
/* Unlink device structure, free bits */
*linkp = link->next;
......@@ -837,16 +831,8 @@ static int btuart_resume(struct pcmcia_device *dev)
static int btuart_event(event_t event, int priority, event_callback_args_t *args)
{
dev_link_t *link = args->client_data;
btuart_info_t *info = link->priv;
switch (event) {
case CS_EVENT_CARD_REMOVAL:
link->state &= ~DEV_PRESENT;
if (link->state & DEV_CONFIG) {
btuart_close(info);
btuart_release(link);
}
break;
case CS_EVENT_CARD_INSERTION:
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
btuart_config(link);
......@@ -869,7 +855,7 @@ static struct pcmcia_driver btuart_driver = {
},
.attach = btuart_attach,
.event = btuart_event,
.detach = btuart_detach,
.remove = btuart_detach,
.id_table = btuart_ids,
.suspend = btuart_suspend,
.resume = btuart_resume,
......
......@@ -94,7 +94,7 @@ static int dtl1_event(event_t event, int priority, event_callback_args_t *args);
static dev_info_t dev_info = "dtl1_cs";
static dev_link_t *dtl1_attach(void);
static void dtl1_detach(dev_link_t *);
static void dtl1_detach(struct pcmcia_device *p_dev);
static dev_link_t *dev_list = NULL;
......@@ -598,7 +598,7 @@ static dev_link_t *dtl1_attach(void)
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != CS_SUCCESS) {
cs_error(link->handle, RegisterClient, ret);
dtl1_detach(link);
dtl1_detach(link->handle);
return NULL;
}
......@@ -606,11 +606,11 @@ static dev_link_t *dtl1_attach(void)
}
static void dtl1_detach(dev_link_t *link)
static void dtl1_detach(struct pcmcia_device *p_dev)
{
dev_link_t *link = dev_to_instance(p_dev);
dtl1_info_t *info = link->priv;
dev_link_t **linkp;
int ret;
/* Locate device structure */
for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
......@@ -623,12 +623,6 @@ static void dtl1_detach(dev_link_t *link)
if (link->state & DEV_CONFIG)
dtl1_release(link);
if (link->handle) {
ret = pcmcia_deregister_client(link->handle);
if (ret != CS_SUCCESS)
cs_error(link->handle, DeregisterClient, ret);
}
/* Unlink device structure, free bits */
*linkp = link->next;
......@@ -788,16 +782,8 @@ static int dtl1_resume(struct pcmcia_device *dev)
static int dtl1_event(event_t event, int priority, event_callback_args_t *args)
{
dev_link_t *link = args->client_data;
dtl1_info_t *info = link->priv;
switch (event) {
case CS_EVENT_CARD_REMOVAL:
link->state &= ~DEV_PRESENT;
if (link->state & DEV_CONFIG) {
dtl1_close(info);
dtl1_release(link);
}
break;
case CS_EVENT_CARD_INSERTION:
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
dtl1_config(link);
......@@ -821,7 +807,7 @@ static struct pcmcia_driver dtl1_driver = {
},
.attach = dtl1_attach,
.event = dtl1_event,
.detach = dtl1_detach,
.remove = dtl1_detach,
.id_table = dtl1_ids,
.suspend = dtl1_suspend,
.resume = dtl1_resume,
......
......@@ -66,7 +66,7 @@ static char *version = "cm4000_cs.c v2.4.0gm5 - All bugs added by Harald Welte";
#define T_100MSEC msecs_to_jiffies(100)
#define T_500MSEC msecs_to_jiffies(500)
static void cm4000_detach(dev_link_t *link);
static void cm4000_detach(struct pcmcia_device *p_dev);
static void cm4000_release(dev_link_t *link);
static int major; /* major number we get from the kernel */
......@@ -1888,11 +1888,6 @@ static int cm4000_event(event_t event, int priority,
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
cm4000_config(link, devno);
break;
case CS_EVENT_CARD_REMOVAL:
DEBUGP(5, dev, "CS_EVENT_CARD_REMOVAL\n");
link->state &= ~DEV_PRESENT;
stop_monitor(dev);
break;
default:
DEBUGP(5, dev, "unknown event %.2x\n", event);
break;
......@@ -1978,7 +1973,7 @@ static dev_link_t *cm4000_attach(void)
i = pcmcia_register_client(&link->handle, &client_reg);
if (i) {
cs_error(link->handle, RegisterClient, i);
cm4000_detach(link);
cm4000_detach(link->handle);
return NULL;
}
......@@ -1990,39 +1985,28 @@ static dev_link_t *cm4000_attach(void)
return link;
}
static void cm4000_detach_by_devno(int devno, dev_link_t * link)
static void cm4000_detach(struct pcmcia_device *p_dev)
{
dev_link_t *link = dev_to_instance(p_dev);
struct cm4000_dev *dev = link->priv;
int devno;
DEBUGP(3, dev, "-> detach_by_devno(devno=%d)\n", devno);
/* find device */
for (devno = 0; devno < CM4000_MAX_DEV; devno++)
if (dev_table[devno] == link)
break;
if (devno == CM4000_MAX_DEV)
return;
if (link->state & DEV_CONFIG) {
DEBUGP(5, dev, "device still configured (try to release it)\n");
cm4000_release(link);
}
link->state &= ~DEV_PRESENT;
stop_monitor(dev);
if (link->handle) {
pcmcia_deregister_client(link->handle);
}
if (link->state & DEV_CONFIG)
cm4000_release(link);
dev_table[devno] = NULL;
kfree(dev);
return;
}
static void cm4000_detach(dev_link_t * link)
{
int i;
kfree(dev);
/* find device */
for (i = 0; i < CM4000_MAX_DEV; i++)
if (dev_table[i] == link)
break;
if (i == CM4000_MAX_DEV)
return;
cm4000_detach_by_devno(i, link);
return;
}
......@@ -2048,7 +2032,7 @@ static struct pcmcia_driver cm4000_driver = {
.name = "cm4000_cs",
},
.attach = cm4000_attach,
.detach = cm4000_detach,
.remove = cm4000_detach,
.suspend = cm4000_suspend,
.resume = cm4000_resume,
.event = cm4000_event,
......@@ -2071,13 +2055,8 @@ static int __init cmm_init(void)
static void __exit cmm_exit(void)
{
int i;
printk(KERN_INFO MODULE_NAME ": unloading\n");
pcmcia_unregister_driver(&cm4000_driver);
for (i = 0; i < CM4000_MAX_DEV; i++)
if (dev_table[i])
cm4000_detach_by_devno(i, dev_table[i]);
unregister_chrdev(major, DEVICE_NAME);
};
......
......@@ -65,7 +65,7 @@ static char *version =
#define POLL_PERIOD msecs_to_jiffies(10)
static void reader_release(dev_link_t *link);
static void reader_detach(dev_link_t *link);
static void reader_detach(struct pcmcia_device *p_dev);
static int major;
......@@ -652,10 +652,6 @@ static int reader_event(event_t event, int priority,
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
reader_config(link, devno);
break;
case CS_EVENT_CARD_REMOVAL:
DEBUGP(5, dev, "CS_EVENT_CARD_REMOVAL\n");
link->state &= ~DEV_PRESENT;
break;
default:
DEBUGP(5, dev, "reader_event: unknown event %.2x\n",
......@@ -734,7 +730,7 @@ static dev_link_t *reader_attach(void)
i = pcmcia_register_client(&link->handle, &client_reg);
if (i) {
cs_error(link->handle, RegisterClient, i);
reader_detach(link);
reader_detach(link->handle);
return NULL;
}
init_waitqueue_head(&dev->devq);
......@@ -747,36 +743,28 @@ static dev_link_t *reader_attach(void)
return link;
}
static void reader_detach_by_devno(int devno, dev_link_t *link)
static void reader_detach(struct pcmcia_device *p_dev)
{
dev_link_t *link = dev_to_instance(p_dev);
struct reader_dev *dev = link->priv;
if (link->state & DEV_CONFIG) {
DEBUGP(5, dev, "device still configured (try to release it)\n");
reader_release(link);
}
pcmcia_deregister_client(link->handle);
dev_table[devno] = NULL;
DEBUGP(5, dev, "freeing dev=%p\n", dev);
cm4040_stop_poll(dev);
kfree(dev);
return;
}
static void reader_detach(dev_link_t *link)
{
int i;
int devno;
/* find device */
for (i = 0; i < CM_MAX_DEV; i++) {
if (dev_table[i] == link)
for (devno = 0; devno < CM_MAX_DEV; devno++) {
if (dev_table[devno] == link)
break;
}
if (i == CM_MAX_DEV)
if (devno == CM_MAX_DEV)
return;
reader_detach_by_devno(i, link);
link->state &= ~DEV_PRESENT;
if (link->state & DEV_CONFIG)
reader_release(link);
dev_table[devno] = NULL;
kfree(dev);
return;
}
......@@ -803,7 +791,7 @@ static struct pcmcia_driver reader_driver = {
.name = "cm4040_cs",
},
.attach = reader_attach,
.detach = reader_detach,
.remove = reader_detach,
.suspend = reader_suspend,
.resume = reader_resume,
.event = reader_event,
......@@ -825,14 +813,8 @@ static int __init cm4040_init(void)
static void __exit cm4040_exit(void)
{
int i;
printk(KERN_INFO MODULE_NAME ": unloading\n");
pcmcia_unregister_driver(&reader_driver);
for (i = 0; i < CM_MAX_DEV; i++) {
if (dev_table[i])
reader_detach_by_devno(i, dev_table[i]);
}
unregister_chrdev(major, DEVICE_NAME);
}
......
......@@ -489,7 +489,7 @@ static void mgslpc_release(u_long arg);
static int mgslpc_event(event_t event, int priority,
event_callback_args_t *args);
static dev_link_t *mgslpc_attach(void);
static void mgslpc_detach(dev_link_t *);
static void mgslpc_detach(struct pcmcia_device *p_dev);
static dev_info_t dev_info = "synclink_cs";
static dev_link_t *dev_list = NULL;
......@@ -598,7 +598,7 @@ static dev_link_t *mgslpc_attach(void)
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != CS_SUCCESS) {
cs_error(link->handle, RegisterClient, ret);
mgslpc_detach(link);
mgslpc_detach(link->handle);
return NULL;
}
......@@ -736,17 +736,16 @@ static void mgslpc_release(u_long arg)
pcmcia_release_io(link->handle, &link->io);
if (link->irq.AssignedIRQ)
pcmcia_release_irq(link->handle, &link->irq);
if (link->state & DEV_STALE_LINK)
mgslpc_detach(link);
}
static void mgslpc_detach(dev_link_t *link)
static void mgslpc_detach(struct pcmcia_device *p_dev)
{
dev_link_t *link = dev_to_instance(p_dev);
dev_link_t **linkp;
if (debug_level >= DEBUG_LEVEL_INFO)
printk("mgslpc_detach(0x%p)\n", link);
/* find device */
for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
if (*linkp == link) break;
......@@ -754,20 +753,10 @@ static void mgslpc_detach(dev_link_t *link)
return;
if (link->state & DEV_CONFIG) {
/* device is configured/active, mark it so when
* release() is called a proper detach() occurs.
*/
if (debug_level >= DEBUG_LEVEL_INFO)
printk(KERN_DEBUG "synclinkpc: detach postponed, '%s' "
"still locked\n", link->dev->dev_name);
link->state |= DEV_STALE_LINK;
return;
((MGSLPC_INFO *)link->priv)->stop = 1;
mgslpc_release((u_long)link);
}
/* Break the link with Card Services */
if (link->handle)
pcmcia_deregister_client(link->handle);
/* Unlink device structure, and free it */
*linkp = link->next;
mgslpc_remove_device((MGSLPC_INFO *)link->priv);
......@@ -809,13 +798,6 @@ static int mgslpc_event(event_t event, int priority,
printk("mgslpc_event(0x%06x)\n", event);
switch (event) {
case CS_EVENT_CARD_REMOVAL:
link->state &= ~DEV_PRESENT;
if (link->state & DEV_CONFIG) {
((MGSLPC_INFO *)link->priv)->stop = 1;
mgslpc_release((u_long)link);
}
break;
case CS_EVENT_CARD_INSERTION:
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
mgslpc_config(link);
......@@ -3102,7 +3084,7 @@ static struct pcmcia_driver mgslpc_driver = {
},
.attach = mgslpc_attach,
.event = mgslpc_event,
.detach = mgslpc_detach,
.remove = mgslpc_detach,
.id_table = mgslpc_ids,
.suspend = mgslpc_suspend,
.resume = mgslpc_resume,
......
......@@ -94,7 +94,7 @@ static int ide_event(event_t event, int priority,
static dev_info_t dev_info = "ide-cs";
static dev_link_t *ide_attach(void);
static void ide_detach(dev_link_t *);
static void ide_detach(struct pcmcia_device *p_dev);
static dev_link_t *dev_list = NULL;
......@@ -138,7 +138,7 @@ static dev_link_t *ide_attach(void)
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != CS_SUCCESS) {
cs_error(link->handle, RegisterClient, ret);
ide_detach(link);
ide_detach(link->handle);
return NULL;
}
......@@ -154,10 +154,10 @@ static dev_link_t *ide_attach(void)
======================================================================*/
static void ide_detach(dev_link_t *link)
static void ide_detach(struct pcmcia_device *p_dev)
{
dev_link_t *link = dev_to_instance(p_dev);
dev_link_t **linkp;
int ret;
DEBUG(0, "ide_detach(0x%p)\n", link);
......@@ -170,12 +170,6 @@ static void ide_detach(dev_link_t *link)
if (link->state & DEV_CONFIG)
ide_release(link);
if (link->handle) {
ret = pcmcia_deregister_client(link->handle);
if (ret != CS_SUCCESS)
cs_error(link->handle, DeregisterClient, ret);
}
/* Unlink, free device structure */
*linkp = link->next;
kfree(link->priv);
......@@ -445,11 +439,6 @@ int ide_event(event_t event, int priority,
DEBUG(1, "ide_event(0x%06x)\n", event);
switch (event) {
case CS_EVENT_CARD_REMOVAL:
link->state &= ~DEV_PRESENT;
if (link->state & DEV_CONFIG)
ide_release(link);
break;
case CS_EVENT_CARD_INSERTION:
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
ide_config(link);
......@@ -504,7 +493,7 @@ static struct pcmcia_driver ide_cs_driver = {
},
.attach = ide_attach,
.event = ide_event,
.detach = ide_detach,
.remove = ide_detach,
.id_table = ide_ids,
.suspend = ide_suspend,
.resume = ide_resume,
......
......@@ -63,7 +63,7 @@ static int avmcs_event(event_t event, int priority,
*/
static dev_link_t *avmcs_attach(void);
static void avmcs_detach(dev_link_t *);
static void avmcs_detach(struct pcmcia_device *p_dev);
/*
The dev_info variable is the "key" that is used to match up this
......@@ -165,7 +165,7 @@ static dev_link_t *avmcs_attach(void)
ret = pcmcia_register_client(&link->handle, &client_reg);
if (ret != 0) {
cs_error(link->handle, RegisterClient, ret);
avmcs_detach(link);
avmcs_detach(link->handle);
goto err;
}
return link;
......@@ -185,8 +185,9 @@ static dev_link_t *avmcs_attach(void)
======================================================================*/
static void avmcs_detach(dev_link_t *link)
static void avmcs_detach(struct pcmcia_device *p_dev)
{
dev_link_t *link = dev_to_instance(p_dev);
dev_link_t **linkp;
/* Locate device structure */
......@@ -195,21 +196,9 @@ static void avmcs_detach(dev_link_t *link)
if (*linkp == NULL)
return;
/*
If the device is currently configured and active, we won't
actually delete it yet. Instead, it is marked so that when
the release() function is called, that will trigger a proper
detach().
*/
if (link->state & DEV_CONFIG) {
link->state |= DEV_STALE_LINK;
return;
}
if (link->state & DEV_CONFIG)
avmcs_release(link);
/* Break the link with Card Services */
if (link->handle)
pcmcia_deregister_client(link->handle);
/* Unlink device structure, free pieces */
*linkp = link->next;
kfree(link->priv);
......@@ -424,10 +413,6 @@ static void avmcs_release(dev_link_t *link)
pcmcia_release_io(link->handle, &link->io);
pcmcia_release_irq(link->handle, &link->irq);
link->state &= ~DEV_CONFIG;
if (link->state & DEV_STALE_LINK)
avmcs_detach(link);
} /* avmcs_release */
static int avmcs_suspend(struct pcmcia_device *dev)
......@@ -472,11 +457,6 @@ static int avmcs_event(event_t event, int priority,
dev_link_t *link = args->client_data;
switch (event) {
case CS_EVENT_CARD_REMOVAL:
link->state &= ~DEV_PRESENT;
if (link->state & DEV_CONFIG)
avmcs_release(link);
break;
case CS_EVENT_CARD_INSERTION:
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
avmcs_config(link);
......@@ -500,7 +480,7 @@ static struct pcmcia_driver avmcs_driver = {
},
.attach = avmcs_attach,
.event = avmcs_event,
.