diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2005-11-14 15:25:51 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-01-05 18:03:24 -0500 |
commit | f8cfa618dccbdc6dab5297f75779566a388a98fd (patch) | |
tree | b91e0952038dafc6e03bf8b1d8948b1fdefec031 /drivers/usb/host/sl811_cs.c | |
parent | b463581154f3f3eecda27cae60df813fefcd84d3 (diff) |
[PATCH] pcmcia: unify attach, EVENT_CARD_INSERTION handlers into one probe callback
Unify the EVENT_CARD_INSERTION and "attach" callbacks to one unified
probe() callback. As all in-kernel drivers are changed to this new
callback, there will be no temporary backwards-compatibility. Inside a
probe() function, each driver _must_ set struct pcmcia_device
*p_dev->instance and instance->handle correctly.
With these patches, the basic driver interface for 16-bit PCMCIA drivers
now has the classic four callbacks known also from other buses:
int (*probe) (struct pcmcia_device *dev);
void (*remove) (struct pcmcia_device *dev);
int (*suspend) (struct pcmcia_device *dev);
int (*resume) (struct pcmcia_device *dev);
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/usb/host/sl811_cs.c')
-rw-r--r-- | drivers/usb/host/sl811_cs.c | 44 |
1 files changed, 9 insertions, 35 deletions
diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c index 439709670d0..466384d7c79 100644 --- a/drivers/usb/host/sl811_cs.c +++ b/drivers/usb/host/sl811_cs.c | |||
@@ -325,32 +325,14 @@ static int sl811_resume(struct pcmcia_device *dev) | |||
325 | return 0; | 325 | return 0; |
326 | } | 326 | } |
327 | 327 | ||
328 | static int | 328 | static int sl811_cs_attach(struct pcmcia_device *p_dev) |
329 | sl811_cs_event(event_t event, int priority, event_callback_args_t *args) | ||
330 | { | ||
331 | dev_link_t *link = args->client_data; | ||
332 | |||
333 | DBG(1, "sl811_cs_event(0x%06x)\n", event); | ||
334 | |||
335 | switch (event) { | ||
336 | case CS_EVENT_CARD_INSERTION: | ||
337 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
338 | sl811_cs_config(link); | ||
339 | break; | ||
340 | } | ||
341 | return 0; | ||
342 | } | ||
343 | |||
344 | static dev_link_t *sl811_cs_attach(void) | ||
345 | { | 329 | { |
346 | local_info_t *local; | 330 | local_info_t *local; |
347 | dev_link_t *link; | 331 | dev_link_t *link; |
348 | client_reg_t client_reg; | ||
349 | int ret; | ||
350 | 332 | ||
351 | local = kmalloc(sizeof(local_info_t), GFP_KERNEL); | 333 | local = kmalloc(sizeof(local_info_t), GFP_KERNEL); |
352 | if (!local) | 334 | if (!local) |
353 | return NULL; | 335 | return -ENOMEM; |
354 | memset(local, 0, sizeof(local_info_t)); | 336 | memset(local, 0, sizeof(local_info_t)); |
355 | link = &local->link; | 337 | link = &local->link; |
356 | link->priv = local; | 338 | link->priv = local; |
@@ -364,20 +346,13 @@ static dev_link_t *sl811_cs_attach(void) | |||
364 | link->conf.Vcc = 33; | 346 | link->conf.Vcc = 33; |
365 | link->conf.IntType = INT_MEMORY_AND_IO; | 347 | link->conf.IntType = INT_MEMORY_AND_IO; |
366 | 348 | ||
367 | /* Register with Card Services */ | 349 | link->handle = p_dev; |
368 | link->next = NULL; | 350 | p_dev->instance = link; |
369 | client_reg.dev_info = (dev_info_t *) &driver_name; | ||
370 | client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE; | ||
371 | client_reg.Version = 0x0210; | ||
372 | client_reg.event_callback_args.client_data = link; | ||
373 | ret = pcmcia_register_client(&link->handle, &client_reg); | ||
374 | if (ret != CS_SUCCESS) { | ||
375 | cs_error(link->handle, RegisterClient, ret); | ||
376 | sl811_cs_detach(link->handle); | ||
377 | return NULL; | ||
378 | } | ||
379 | 351 | ||
380 | return link; | 352 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
353 | sl811_cs_config(link); | ||
354 | |||
355 | return 0; | ||
381 | } | 356 | } |
382 | 357 | ||
383 | static struct pcmcia_device_id sl811_ids[] = { | 358 | static struct pcmcia_device_id sl811_ids[] = { |
@@ -391,8 +366,7 @@ static struct pcmcia_driver sl811_cs_driver = { | |||
391 | .drv = { | 366 | .drv = { |
392 | .name = (char *)driver_name, | 367 | .name = (char *)driver_name, |
393 | }, | 368 | }, |
394 | .attach = sl811_cs_attach, | 369 | .probe = sl811_cs_attach, |
395 | .event = sl811_cs_event, | ||
396 | .remove = sl811_cs_detach, | 370 | .remove = sl811_cs_detach, |
397 | .id_table = sl811_ids, | 371 | .id_table = sl811_ids, |
398 | .suspend = sl811_suspend, | 372 | .suspend = sl811_suspend, |