aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/serial_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial/serial_cs.c')
-rw-r--r--drivers/serial/serial_cs.c58
1 files changed, 8 insertions, 50 deletions
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
index 6e7a1a0ae015..96969cb960a9 100644
--- a/drivers/serial/serial_cs.c
+++ b/drivers/serial/serial_cs.c
@@ -114,13 +114,7 @@ struct serial_cfg_mem {
114 114
115 115
116static void serial_config(dev_link_t * link); 116static void serial_config(dev_link_t * link);
117static int serial_event(event_t event, int priority,
118 event_callback_args_t * args);
119 117
120static dev_info_t dev_info = "serial_cs";
121
122static dev_link_t *serial_attach(void);
123static void serial_detach(struct pcmcia_device *p_dev);
124 118
125/*====================================================================== 119/*======================================================================
126 120
@@ -203,19 +197,17 @@ static int serial_resume(struct pcmcia_device *dev)
203 197
204======================================================================*/ 198======================================================================*/
205 199
206static dev_link_t *serial_attach(void) 200static int serial_probe(struct pcmcia_device *p_dev)
207{ 201{
208 struct serial_info *info; 202 struct serial_info *info;
209 client_reg_t client_reg;
210 dev_link_t *link; 203 dev_link_t *link;
211 int ret;
212 204
213 DEBUG(0, "serial_attach()\n"); 205 DEBUG(0, "serial_attach()\n");
214 206
215 /* Create new serial device */ 207 /* Create new serial device */
216 info = kmalloc(sizeof (*info), GFP_KERNEL); 208 info = kmalloc(sizeof (*info), GFP_KERNEL);
217 if (!info) 209 if (!info)
218 return NULL; 210 return -ENOMEM;
219 memset(info, 0, sizeof (*info)); 211 memset(info, 0, sizeof (*info));
220 link = &info->link; 212 link = &info->link;
221 link->priv = info; 213 link->priv = info;
@@ -231,19 +223,12 @@ static dev_link_t *serial_attach(void)
231 } 223 }
232 link->conf.IntType = INT_MEMORY_AND_IO; 224 link->conf.IntType = INT_MEMORY_AND_IO;
233 225
234 /* Register with Card Services */ 226 link->handle = p_dev;
235 link->next = NULL; /* not needed */ 227 p_dev->instance = link;
236 client_reg.dev_info = &dev_info; 228 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
237 client_reg.Version = 0x0210; 229 serial_config(link);
238 client_reg.event_callback_args.client_data = link;
239 ret = pcmcia_register_client(&link->handle, &client_reg);
240 if (ret != CS_SUCCESS) {
241 cs_error(link->handle, RegisterClient, ret);
242 serial_detach(link->handle);
243 return NULL;
244 }
245 230
246 return link; 231 return 0;
247} 232}
248 233
249/*====================================================================== 234/*======================================================================
@@ -706,32 +691,6 @@ void serial_config(dev_link_t * link)
706 kfree(cfg_mem); 691 kfree(cfg_mem);
707} 692}
708 693
709/*======================================================================
710
711 The card status event handler. Mostly, this schedules other
712 stuff to run after an event is received. A CARD_REMOVAL event
713 also sets some flags to discourage the serial drivers from
714 talking to the ports.
715
716======================================================================*/
717
718static int
719serial_event(event_t event, int priority, event_callback_args_t * args)
720{
721 dev_link_t *link = args->client_data;
722
723 DEBUG(1, "serial_event(0x%06x)\n", event);
724
725 switch (event) {
726
727 case CS_EVENT_CARD_INSERTION:
728 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
729 serial_config(link);
730 break;
731 }
732 return 0;
733}
734
735static struct pcmcia_device_id serial_ids[] = { 694static struct pcmcia_device_id serial_ids[] = {
736 PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0057, 0x0021), 695 PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0057, 0x0021),
737 PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0089, 0x110a), 696 PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0089, 0x110a),
@@ -843,8 +802,7 @@ static struct pcmcia_driver serial_cs_driver = {
843 .drv = { 802 .drv = {
844 .name = "serial_cs", 803 .name = "serial_cs",
845 }, 804 },
846 .attach = serial_attach, 805 .probe = serial_probe,
847 .event = serial_event,
848 .remove = serial_detach, 806 .remove = serial_detach,
849 .id_table = serial_ids, 807 .id_table = serial_ids,
850 .suspend = serial_suspend, 808 .suspend = serial_suspend,