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/scsi/pcmcia/fdomain_stub.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/scsi/pcmcia/fdomain_stub.c')
-rw-r--r-- | drivers/scsi/pcmcia/fdomain_stub.c | 56 |
1 files changed, 12 insertions, 44 deletions
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c index 538fedb97924..788c58d805f3 100644 --- a/drivers/scsi/pcmcia/fdomain_stub.c +++ b/drivers/scsi/pcmcia/fdomain_stub.c | |||
@@ -80,27 +80,19 @@ typedef struct scsi_info_t { | |||
80 | 80 | ||
81 | 81 | ||
82 | static void fdomain_release(dev_link_t *link); | 82 | static void fdomain_release(dev_link_t *link); |
83 | static int fdomain_event(event_t event, int priority, | ||
84 | event_callback_args_t *args); | ||
85 | |||
86 | static dev_link_t *fdomain_attach(void); | ||
87 | static void fdomain_detach(struct pcmcia_device *p_dev); | 83 | static void fdomain_detach(struct pcmcia_device *p_dev); |
84 | static void fdomain_config(dev_link_t *link); | ||
88 | 85 | ||
89 | 86 | static int fdomain_attach(struct pcmcia_device *p_dev) | |
90 | static dev_info_t dev_info = "fdomain_cs"; | ||
91 | |||
92 | static dev_link_t *fdomain_attach(void) | ||
93 | { | 87 | { |
94 | scsi_info_t *info; | 88 | scsi_info_t *info; |
95 | client_reg_t client_reg; | ||
96 | dev_link_t *link; | 89 | dev_link_t *link; |
97 | int ret; | 90 | |
98 | |||
99 | DEBUG(0, "fdomain_attach()\n"); | 91 | DEBUG(0, "fdomain_attach()\n"); |
100 | 92 | ||
101 | /* Create new SCSI device */ | 93 | /* Create new SCSI device */ |
102 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 94 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
103 | if (!info) return NULL; | 95 | if (!info) return -ENOMEM; |
104 | memset(info, 0, sizeof(*info)); | 96 | memset(info, 0, sizeof(*info)); |
105 | link = &info->link; link->priv = info; | 97 | link = &info->link; link->priv = info; |
106 | link->io.NumPorts1 = 0x10; | 98 | link->io.NumPorts1 = 0x10; |
@@ -113,19 +105,13 @@ static dev_link_t *fdomain_attach(void) | |||
113 | link->conf.IntType = INT_MEMORY_AND_IO; | 105 | link->conf.IntType = INT_MEMORY_AND_IO; |
114 | link->conf.Present = PRESENT_OPTION; | 106 | link->conf.Present = PRESENT_OPTION; |
115 | 107 | ||
116 | /* Register with Card Services */ | 108 | link->handle = p_dev; |
117 | link->next = NULL; | 109 | p_dev->instance = link; |
118 | client_reg.dev_info = &dev_info; | 110 | |
119 | client_reg.Version = 0x0210; | 111 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
120 | client_reg.event_callback_args.client_data = link; | 112 | fdomain_config(link); |
121 | ret = pcmcia_register_client(&link->handle, &client_reg); | 113 | |
122 | if (ret != 0) { | 114 | return 0; |
123 | cs_error(link->handle, RegisterClient, ret); | ||
124 | fdomain_detach(link->handle); | ||
125 | return NULL; | ||
126 | } | ||
127 | |||
128 | return link; | ||
129 | } /* fdomain_attach */ | 115 | } /* fdomain_attach */ |
130 | 116 | ||
131 | /*====================================================================*/ | 117 | /*====================================================================*/ |
@@ -265,23 +251,6 @@ static int fdomain_resume(struct pcmcia_device *dev) | |||
265 | return 0; | 251 | return 0; |
266 | } | 252 | } |
267 | 253 | ||
268 | static int fdomain_event(event_t event, int priority, | ||
269 | event_callback_args_t *args) | ||
270 | { | ||
271 | dev_link_t *link = args->client_data; | ||
272 | |||
273 | DEBUG(1, "fdomain_event(0x%06x)\n", event); | ||
274 | |||
275 | switch (event) { | ||
276 | case CS_EVENT_CARD_INSERTION: | ||
277 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
278 | fdomain_config(link); | ||
279 | break; | ||
280 | } | ||
281 | return 0; | ||
282 | } /* fdomain_event */ | ||
283 | |||
284 | |||
285 | static struct pcmcia_device_id fdomain_ids[] = { | 254 | static struct pcmcia_device_id fdomain_ids[] = { |
286 | PCMCIA_DEVICE_PROD_ID12("IBM Corp.", "SCSI PCMCIA Card", 0xe3736c88, 0x859cad20), | 255 | PCMCIA_DEVICE_PROD_ID12("IBM Corp.", "SCSI PCMCIA Card", 0xe3736c88, 0x859cad20), |
287 | PCMCIA_DEVICE_PROD_ID1("SCSI PCMCIA Adapter Card", 0x8dacb57e), | 256 | PCMCIA_DEVICE_PROD_ID1("SCSI PCMCIA Adapter Card", 0x8dacb57e), |
@@ -295,8 +264,7 @@ static struct pcmcia_driver fdomain_cs_driver = { | |||
295 | .drv = { | 264 | .drv = { |
296 | .name = "fdomain_cs", | 265 | .name = "fdomain_cs", |
297 | }, | 266 | }, |
298 | .attach = fdomain_attach, | 267 | .probe = fdomain_attach, |
299 | .event = fdomain_event, | ||
300 | .remove = fdomain_detach, | 268 | .remove = fdomain_detach, |
301 | .id_table = fdomain_ids, | 269 | .id_table = fdomain_ids, |
302 | .suspend = fdomain_suspend, | 270 | .suspend = fdomain_suspend, |