aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-11-14 15:25:51 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-01-05 18:03:24 -0500
commitf8cfa618dccbdc6dab5297f75779566a388a98fd (patch)
treeb91e0952038dafc6e03bf8b1d8948b1fdefec031 /drivers/ide
parentb463581154f3f3eecda27cae60df813fefcd84d3 (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/ide')
-rw-r--r--drivers/ide/legacy/ide-cs.c56
1 files changed, 14 insertions, 42 deletions
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index c83068dd42a0..e36e6fbbf9e0 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -88,12 +88,8 @@ typedef struct ide_info_t {
88} ide_info_t; 88} ide_info_t;
89 89
90static void ide_release(dev_link_t *); 90static void ide_release(dev_link_t *);
91static int ide_event(event_t event, int priority, 91static void ide_config(dev_link_t *);
92 event_callback_args_t *args);
93 92
94static dev_info_t dev_info = "ide-cs";
95
96static dev_link_t *ide_attach(void);
97static void ide_detach(struct pcmcia_device *p_dev); 93static void ide_detach(struct pcmcia_device *p_dev);
98 94
99 95
@@ -107,18 +103,17 @@ static void ide_detach(struct pcmcia_device *p_dev);
107 103
108======================================================================*/ 104======================================================================*/
109 105
110static dev_link_t *ide_attach(void) 106static int ide_attach(struct pcmcia_device *p_dev)
111{ 107{
112 ide_info_t *info; 108 ide_info_t *info;
113 dev_link_t *link; 109 dev_link_t *link;
114 client_reg_t client_reg; 110
115 int ret;
116
117 DEBUG(0, "ide_attach()\n"); 111 DEBUG(0, "ide_attach()\n");
118 112
119 /* Create new ide device */ 113 /* Create new ide device */
120 info = kzalloc(sizeof(*info), GFP_KERNEL); 114 info = kzalloc(sizeof(*info), GFP_KERNEL);
121 if (!info) return NULL; 115 if (!info)
116 return -ENOMEM;
122 link = &info->link; link->priv = info; 117 link = &info->link; link->priv = info;
123 118
124 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 119 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
@@ -129,20 +124,14 @@ static dev_link_t *ide_attach(void)
129 link->conf.Attributes = CONF_ENABLE_IRQ; 124 link->conf.Attributes = CONF_ENABLE_IRQ;
130 link->conf.Vcc = 50; 125 link->conf.Vcc = 50;
131 link->conf.IntType = INT_MEMORY_AND_IO; 126 link->conf.IntType = INT_MEMORY_AND_IO;
132 127
133 /* Register with Card Services */ 128 link->handle = p_dev;
134 link->next = NULL; 129 p_dev->instance = link;
135 client_reg.dev_info = &dev_info; 130
136 client_reg.Version = 0x0210; 131 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
137 client_reg.event_callback_args.client_data = link; 132 ide_config(link);
138 ret = pcmcia_register_client(&link->handle, &client_reg); 133
139 if (ret != CS_SUCCESS) { 134 return 0;
140 cs_error(link->handle, RegisterClient, ret);
141 ide_detach(link->handle);
142 return NULL;
143 }
144
145 return link;
146} /* ide_attach */ 135} /* ide_attach */
147 136
148/*====================================================================== 137/*======================================================================
@@ -421,22 +410,6 @@ static int ide_resume(struct pcmcia_device *dev)
421 410
422======================================================================*/ 411======================================================================*/
423 412
424int ide_event(event_t event, int priority,
425 event_callback_args_t *args)
426{
427 dev_link_t *link = args->client_data;
428
429 DEBUG(1, "ide_event(0x%06x)\n", event);
430
431 switch (event) {
432 case CS_EVENT_CARD_INSERTION:
433 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
434 ide_config(link);
435 break;
436 }
437 return 0;
438} /* ide_event */
439
440static struct pcmcia_device_id ide_ids[] = { 413static struct pcmcia_device_id ide_ids[] = {
441 PCMCIA_DEVICE_FUNC_ID(4), 414 PCMCIA_DEVICE_FUNC_ID(4),
442 PCMCIA_DEVICE_MANF_CARD(0x0032, 0x0704), 415 PCMCIA_DEVICE_MANF_CARD(0x0032, 0x0704),
@@ -481,8 +454,7 @@ static struct pcmcia_driver ide_cs_driver = {
481 .drv = { 454 .drv = {
482 .name = "ide-cs", 455 .name = "ide-cs",
483 }, 456 },
484 .attach = ide_attach, 457 .probe = ide_attach,
485 .event = ide_event,
486 .remove = ide_detach, 458 .remove = ide_detach,
487 .id_table = ide_ids, 459 .id_table = ide_ids,
488 .suspend = ide_suspend, 460 .suspend = ide_suspend,