diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2006-01-07 14:40:05 +0000 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-01-07 14:40:05 +0000 |
commit | 123656d4cc8c946f578ebd18c2050f5251720428 (patch) | |
tree | 3d5432eff034a3b9cfdc98b37e245abe5695342d /drivers/bluetooth/bluecard_cs.c | |
parent | a62c80e559809e6c7851ec04d30575e85ad6f6ed (diff) | |
parent | 0aec63e67c69545ca757a73a66f5dcf05fa484bf (diff) | |
download | op-kernel-dev-123656d4cc8c946f578ebd18c2050f5251720428.zip op-kernel-dev-123656d4cc8c946f578ebd18c2050f5251720428.tar.gz |
Merge with Linus' kernel.
Diffstat (limited to 'drivers/bluetooth/bluecard_cs.c')
-rw-r--r-- | drivers/bluetooth/bluecard_cs.c | 109 |
1 files changed, 30 insertions, 79 deletions
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c index f36c563..9888bc1 100644 --- a/drivers/bluetooth/bluecard_cs.c +++ b/drivers/bluetooth/bluecard_cs.c @@ -87,14 +87,8 @@ typedef struct bluecard_info_t { static void bluecard_config(dev_link_t *link); static void bluecard_release(dev_link_t *link); -static int bluecard_event(event_t event, int priority, event_callback_args_t *args); -static dev_info_t dev_info = "bluecard_cs"; - -static dev_link_t *bluecard_attach(void); -static void bluecard_detach(dev_link_t *); - -static dev_link_t *dev_list = NULL; +static void bluecard_detach(struct pcmcia_device *p_dev); /* Default baud rate: 57600, 115200, 230400 or 460800 */ @@ -862,17 +856,15 @@ static int bluecard_close(bluecard_info_t *info) return 0; } -static dev_link_t *bluecard_attach(void) +static int bluecard_attach(struct pcmcia_device *p_dev) { bluecard_info_t *info; - client_reg_t client_reg; dev_link_t *link; - int ret; /* Create new info device */ info = kzalloc(sizeof(*info), GFP_KERNEL); if (!info) - return NULL; + return -ENOMEM; link = &info->link; link->priv = info; @@ -889,50 +881,24 @@ static dev_link_t *bluecard_attach(void) link->conf.Vcc = 50; link->conf.IntType = INT_MEMORY_AND_IO; - /* Register with Card Services */ - link->next = dev_list; - dev_list = link; - client_reg.dev_info = &dev_info; - client_reg.Version = 0x0210; - client_reg.event_callback_args.client_data = link; - - ret = pcmcia_register_client(&link->handle, &client_reg); - if (ret != CS_SUCCESS) { - cs_error(link->handle, RegisterClient, ret); - bluecard_detach(link); - return NULL; - } + link->handle = p_dev; + p_dev->instance = link; - return link; + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; + bluecard_config(link); + + return 0; } -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) - if (*linkp == link) - break; - - if (*linkp == NULL) - return; 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; - kfree(info); } @@ -1045,39 +1011,24 @@ static void bluecard_release(dev_link_t *link) link->state &= ~DEV_CONFIG; } +static int bluecard_suspend(struct pcmcia_device *dev) +{ + dev_link_t *link = dev_to_instance(dev); + + link->state |= DEV_SUSPEND; + if (link->state & DEV_CONFIG) + pcmcia_release_configuration(link->handle); -static int bluecard_event(event_t event, int priority, event_callback_args_t *args) + return 0; +} + +static int bluecard_resume(struct pcmcia_device *dev) { - dev_link_t *link = args->client_data; - bluecard_info_t *info = link->priv; + dev_link_t *link = dev_to_instance(dev); - 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); - break; - case CS_EVENT_PM_SUSPEND: - link->state |= DEV_SUSPEND; - /* Fall through... */ - case CS_EVENT_RESET_PHYSICAL: - if (link->state & DEV_CONFIG) - pcmcia_release_configuration(link->handle); - break; - case CS_EVENT_PM_RESUME: - link->state &= ~DEV_SUSPEND; - /* Fall through... */ - case CS_EVENT_CARD_RESET: - if (DEV_OK(link)) - pcmcia_request_configuration(link->handle, &link->conf); - break; - } + link->state &= ~DEV_SUSPEND; + if (DEV_OK(link)) + pcmcia_request_configuration(link->handle, &link->conf); return 0; } @@ -1095,10 +1046,11 @@ static struct pcmcia_driver bluecard_driver = { .drv = { .name = "bluecard_cs", }, - .attach = bluecard_attach, - .event = bluecard_event, - .detach = bluecard_detach, + .probe = bluecard_attach, + .remove = bluecard_detach, .id_table = bluecard_ids, + .suspend = bluecard_suspend, + .resume = bluecard_resume, }; static int __init init_bluecard_cs(void) @@ -1110,7 +1062,6 @@ static int __init init_bluecard_cs(void) static void __exit exit_bluecard_cs(void) { pcmcia_unregister_driver(&bluecard_driver); - BUG_ON(dev_list != NULL); } module_init(init_bluecard_cs); |