aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/telephony
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/telephony
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/telephony')
-rw-r--r--drivers/telephony/ixj_pcmcia.c48
1 files changed, 13 insertions, 35 deletions
diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c
index 6b992985d782..d3a7b0c3d38b 100644
--- a/drivers/telephony/ixj_pcmcia.c
+++ b/drivers/telephony/ixj_pcmcia.c
@@ -34,23 +34,19 @@ typedef struct ixj_info_t {
34 struct ixj *port; 34 struct ixj *port;
35} ixj_info_t; 35} ixj_info_t;
36 36
37static dev_link_t *ixj_attach(void);
38static void ixj_detach(struct pcmcia_device *p_dev); 37static void ixj_detach(struct pcmcia_device *p_dev);
39static void ixj_config(dev_link_t * link); 38static void ixj_config(dev_link_t * link);
40static void ixj_cs_release(dev_link_t * link); 39static void ixj_cs_release(dev_link_t * link);
41static int ixj_event(event_t event, int priority, event_callback_args_t * args);
42static dev_info_t dev_info = "ixj_cs";
43 40
44static dev_link_t *ixj_attach(void) 41static int ixj_attach(struct pcmcia_device *p_dev)
45{ 42{
46 client_reg_t client_reg;
47 dev_link_t *link; 43 dev_link_t *link;
48 int ret; 44
49 DEBUG(0, "ixj_attach()\n"); 45 DEBUG(0, "ixj_attach()\n");
50 /* Create new ixj device */ 46 /* Create new ixj device */
51 link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); 47 link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
52 if (!link) 48 if (!link)
53 return NULL; 49 return -ENOMEM;
54 memset(link, 0, sizeof(struct dev_link_t)); 50 memset(link, 0, sizeof(struct dev_link_t));
55 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 51 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
56 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 52 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
@@ -60,21 +56,17 @@ static dev_link_t *ixj_attach(void)
60 link->priv = kmalloc(sizeof(struct ixj_info_t), GFP_KERNEL); 56 link->priv = kmalloc(sizeof(struct ixj_info_t), GFP_KERNEL);
61 if (!link->priv) { 57 if (!link->priv) {
62 kfree(link); 58 kfree(link);
63 return NULL; 59 return -ENOMEM;
64 } 60 }
65 memset(link->priv, 0, sizeof(struct ixj_info_t)); 61 memset(link->priv, 0, sizeof(struct ixj_info_t));
66 /* Register with Card Services */ 62
67 link->next = NULL; 63 link->handle = p_dev;
68 client_reg.dev_info = &dev_info; 64 p_dev->instance = link;
69 client_reg.Version = 0x0210; 65
70 client_reg.event_callback_args.client_data = link; 66 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
71 ret = pcmcia_register_client(&link->handle, &client_reg); 67 ixj_config(link);
72 if (ret != CS_SUCCESS) { 68
73 cs_error(link->handle, RegisterClient, ret); 69 return 0;
74 ixj_detach(link->handle);
75 return NULL;
76 }
77 return link;
78} 70}
79 71
80static void ixj_detach(struct pcmcia_device *p_dev) 72static void ixj_detach(struct pcmcia_device *p_dev)
@@ -265,19 +257,6 @@ static int ixj_resume(struct pcmcia_device *dev)
265 return 0; 257 return 0;
266} 258}
267 259
268static int ixj_event(event_t event, int priority, event_callback_args_t * args)
269{
270 dev_link_t *link = args->client_data;
271 DEBUG(1, "ixj_event(0x%06x)\n", event);
272 switch (event) {
273 case CS_EVENT_CARD_INSERTION:
274 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
275 ixj_config(link);
276 break;
277 }
278 return 0;
279}
280
281static struct pcmcia_device_id ixj_ids[] = { 260static struct pcmcia_device_id ixj_ids[] = {
282 PCMCIA_DEVICE_MANF_CARD(0x0257, 0x0600), 261 PCMCIA_DEVICE_MANF_CARD(0x0257, 0x0600),
283 PCMCIA_DEVICE_NULL 262 PCMCIA_DEVICE_NULL
@@ -289,8 +268,7 @@ static struct pcmcia_driver ixj_driver = {
289 .drv = { 268 .drv = {
290 .name = "ixj_cs", 269 .name = "ixj_cs",
291 }, 270 },
292 .attach = ixj_attach, 271 .probe = ixj_attach,
293 .event = ixj_event,
294 .remove = ixj_detach, 272 .remove = ixj_detach,
295 .id_table = ixj_ids, 273 .id_table = ixj_ids,
296 .suspend = ixj_suspend, 274 .suspend = ixj_suspend,