aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-07-24 11:23:51 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2010-08-03 03:04:11 -0400
commit90abdc3b973229bae98dd96649d9f7106cc177a4 (patch)
tree5c1a7a131b65560dd73b5103118d8c7631bd76a4 /drivers/staging/comedi
parent9a017a910346afd88ec2e065989903bf211a7d37 (diff)
pcmcia: do not use io_req_t when calling pcmcia_request_io()
Instead of io_req_t, drivers are now requested to fill out struct pcmcia_device *p_dev->resource[0,1] for up to two ioport ranges. After a call to pcmcia_request_io(), the ports found there are reserved, after calling pcmcia_request_configuration(), they may be used. CC: netdev@vger.kernel.org CC: linux-wireless@vger.kernel.org CC: linux-ide@vger.kernel.org CC: linux-usb@vger.kernel.org CC: laforge@gnumonks.org CC: linux-mtd@lists.infradead.org CC: alsa-devel@alsa-project.org CC: linux-serial@vger.kernel.org CC: Michael Buesch <mb@bu3sch.de> Acked-by: Marcel Holtmann <marcel@holtmann.org> (for drivers/bluetooth/) Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/staging/comedi')
-rw-r--r--drivers/staging/comedi/drivers/cb_das16_cs.c24
-rw-r--r--drivers/staging/comedi/drivers/das08_cs.c23
-rw-r--r--drivers/staging/comedi/drivers/ni_daq_700.c24
-rw-r--r--drivers/staging/comedi/drivers/ni_daq_dio24.c24
-rw-r--r--drivers/staging/comedi/drivers/ni_labpc_cs.c24
-rw-r--r--drivers/staging/comedi/drivers/ni_mio_cs.c13
-rw-r--r--drivers/staging/comedi/drivers/quatech_daqp_cs.c24
7 files changed, 72 insertions, 84 deletions
diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c
index 208f1b7a131..7cf0ccb5ade 100644
--- a/drivers/staging/comedi/drivers/cb_das16_cs.c
+++ b/drivers/staging/comedi/drivers/cb_das16_cs.c
@@ -736,24 +736,22 @@ static int das16cs_pcmcia_config_loop(struct pcmcia_device *p_dev,
736 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 736 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
737 737
738 /* IO window settings */ 738 /* IO window settings */
739 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 739 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
740 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 740 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
741 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 741 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
742 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 742 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
743 if (!(io->flags & CISTPL_IO_8BIT)) 743 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
744 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 744 p_dev->resource[0]->flags |=
745 if (!(io->flags & CISTPL_IO_16BIT)) 745 pcmcia_io_cfg_data_width(io->flags);
746 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 746 p_dev->resource[0]->start = io->win[0].base;
747 p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 747 p_dev->resource[0]->end = io->win[0].len;
748 p_dev->io.BasePort1 = io->win[0].base;
749 p_dev->io.NumPorts1 = io->win[0].len;
750 if (io->nwin > 1) { 748 if (io->nwin > 1) {
751 p_dev->io.Attributes2 = p_dev->io.Attributes1; 749 p_dev->resource[1]->flags = p_dev->resource[0]->flags;
752 p_dev->io.BasePort2 = io->win[1].base; 750 p_dev->resource[1]->start = io->win[1].base;
753 p_dev->io.NumPorts2 = io->win[1].len; 751 p_dev->resource[1]->end = io->win[1].len;
754 } 752 }
755 /* This reserves IO space but doesn't actually enable it */ 753 /* This reserves IO space but doesn't actually enable it */
756 return pcmcia_request_io(p_dev, &p_dev->io); 754 return pcmcia_request_io(p_dev);
757 } 755 }
758 756
759 return 0; 757 return 0;
diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c
index c4cfcffc633..9ee677f14b6 100644
--- a/drivers/staging/comedi/drivers/das08_cs.c
+++ b/drivers/staging/comedi/drivers/das08_cs.c
@@ -224,24 +224,23 @@ static int das08_pcmcia_config_loop(struct pcmcia_device *p_dev,
224 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 224 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
225 225
226 /* IO window settings */ 226 /* IO window settings */
227 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 227 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
228 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 228 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
229 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 229 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
230 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 230 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
231 if (!(io->flags & CISTPL_IO_8BIT)) 231 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
232 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 232 p_dev->resource[0]->flags |=
233 if (!(io->flags & CISTPL_IO_16BIT)) 233 pcmcia_io_cfg_data_width(io->flags);
234 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
235 p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 234 p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
236 p_dev->io.BasePort1 = io->win[0].base; 235 p_dev->resource[0]->start = io->win[0].base;
237 p_dev->io.NumPorts1 = io->win[0].len; 236 p_dev->resource[0]->end = io->win[0].len;
238 if (io->nwin > 1) { 237 if (io->nwin > 1) {
239 p_dev->io.Attributes2 = p_dev->io.Attributes1; 238 p_dev->resource[1]->flags = p_dev->resource[0]->flags;
240 p_dev->io.BasePort2 = io->win[1].base; 239 p_dev->resource[1]->start = io->win[1].base;
241 p_dev->io.NumPorts2 = io->win[1].len; 240 p_dev->resource[1]->end = io->win[1].len;
242 } 241 }
243 /* This reserves IO space but doesn't actually enable it */ 242 /* This reserves IO space but doesn't actually enable it */
244 return pcmcia_request_io(p_dev, &p_dev->io); 243 return pcmcia_request_io(p_dev);
245 } 244 }
246 return 0; 245 return 0;
247} 246}
diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c
index 6d569579d67..7e41ad93703 100644
--- a/drivers/staging/comedi/drivers/ni_daq_700.c
+++ b/drivers/staging/comedi/drivers/ni_daq_700.c
@@ -571,24 +571,22 @@ static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev,
571 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 571 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
572 572
573 /* IO window settings */ 573 /* IO window settings */
574 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 574 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
575 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 575 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
576 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 576 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
577 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 577 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
578 if (!(io->flags & CISTPL_IO_8BIT)) 578 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
579 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 579 p_dev->resource[0]->flags |=
580 if (!(io->flags & CISTPL_IO_16BIT)) 580 pcmcia_io_cfg_data_width(io->flags);
581 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 581 p_dev->resource[0]->start = io->win[0].base;
582 p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 582 p_dev->resource[0]->end = io->win[0].len;
583 p_dev->io.BasePort1 = io->win[0].base;
584 p_dev->io.NumPorts1 = io->win[0].len;
585 if (io->nwin > 1) { 583 if (io->nwin > 1) {
586 p_dev->io.Attributes2 = p_dev->io.Attributes1; 584 p_dev->resource[1]->flags = p_dev->resource[0]->flags;
587 p_dev->io.BasePort2 = io->win[1].base; 585 p_dev->resource[1]->start = io->win[1].base;
588 p_dev->io.NumPorts2 = io->win[1].len; 586 p_dev->resource[1]->end = io->win[1].len;
589 } 587 }
590 /* This reserves IO space but doesn't actually enable it */ 588 /* This reserves IO space but doesn't actually enable it */
591 if (pcmcia_request_io(p_dev, &p_dev->io) != 0) 589 if (pcmcia_request_io(p_dev) != 0)
592 return -ENODEV; 590 return -ENODEV;
593 } 591 }
594 592
diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c b/drivers/staging/comedi/drivers/ni_daq_dio24.c
index 29e1daf6a9e..b2483f86c24 100644
--- a/drivers/staging/comedi/drivers/ni_daq_dio24.c
+++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c
@@ -323,24 +323,22 @@ static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev,
323 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 323 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
324 324
325 /* IO window settings */ 325 /* IO window settings */
326 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 326 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
327 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 327 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
328 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 328 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
329 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 329 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
330 if (!(io->flags & CISTPL_IO_8BIT)) 330 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
331 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 331 p_dev->resource[0]->flags |=
332 if (!(io->flags & CISTPL_IO_16BIT)) 332 pcmcia_io_cfg_data_width(io->flags);
333 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 333 p_dev->resource[0]->start = io->win[0].base;
334 p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 334 p_dev->resource[0]->end = io->win[0].len;
335 p_dev->io.BasePort1 = io->win[0].base;
336 p_dev->io.NumPorts1 = io->win[0].len;
337 if (io->nwin > 1) { 335 if (io->nwin > 1) {
338 p_dev->io.Attributes2 = p_dev->io.Attributes1; 336 p_dev->resource[1]->flags = p_dev->resource[0]->flags;
339 p_dev->io.BasePort2 = io->win[1].base; 337 p_dev->resource[1]->start = io->win[1].base;
340 p_dev->io.NumPorts2 = io->win[1].len; 338 p_dev->resource[1]->end = io->win[1].len;
341 } 339 }
342 /* This reserves IO space but doesn't actually enable it */ 340 /* This reserves IO space but doesn't actually enable it */
343 if (pcmcia_request_io(p_dev, &p_dev->io) != 0) 341 if (pcmcia_request_io(p_dev) != 0)
344 return -ENODEV; 342 return -ENODEV;
345 } 343 }
346 344
diff --git a/drivers/staging/comedi/drivers/ni_labpc_cs.c b/drivers/staging/comedi/drivers/ni_labpc_cs.c
index fb10987a97b..c1444b4a5b4 100644
--- a/drivers/staging/comedi/drivers/ni_labpc_cs.c
+++ b/drivers/staging/comedi/drivers/ni_labpc_cs.c
@@ -301,24 +301,22 @@ static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev,
301 p_dev->conf.Attributes |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; 301 p_dev->conf.Attributes |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ;
302 302
303 /* IO window settings */ 303 /* IO window settings */
304 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 304 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
305 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 305 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
306 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 306 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
307 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 307 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
308 if (!(io->flags & CISTPL_IO_8BIT)) 308 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
309 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 309 p_dev->resource[0]->flags |=
310 if (!(io->flags & CISTPL_IO_16BIT)) 310 pcmcia_io_cfg_data_width(io->flags);
311 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 311 p_dev->resource[0]->start = io->win[0].base;
312 p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 312 p_dev->resource[0]->end = io->win[0].len;
313 p_dev->io.BasePort1 = io->win[0].base;
314 p_dev->io.NumPorts1 = io->win[0].len;
315 if (io->nwin > 1) { 313 if (io->nwin > 1) {
316 p_dev->io.Attributes2 = p_dev->io.Attributes1; 314 p_dev->resource[1]->flags = p_dev->resource[0]->flags;
317 p_dev->io.BasePort2 = io->win[1].base; 315 p_dev->resource[1]->start = io->win[1].base;
318 p_dev->io.NumPorts2 = io->win[1].len; 316 p_dev->resource[1]->end = io->win[1].len;
319 } 317 }
320 /* This reserves IO space but doesn't actually enable it */ 318 /* This reserves IO space but doesn't actually enable it */
321 if (pcmcia_request_io(p_dev, &p_dev->io) != 0) 319 if (pcmcia_request_io(p_dev) != 0)
322 return -ENODEV; 320 return -ENODEV;
323 } 321 }
324 322
diff --git a/drivers/staging/comedi/drivers/ni_mio_cs.c b/drivers/staging/comedi/drivers/ni_mio_cs.c
index f37dc22b4db..d50b6c409fe 100644
--- a/drivers/staging/comedi/drivers/ni_mio_cs.c
+++ b/drivers/staging/comedi/drivers/ni_mio_cs.c
@@ -264,8 +264,8 @@ static const dev_info_t dev_info = "ni_mio_cs";
264 264
265static int cs_attach(struct pcmcia_device *link) 265static int cs_attach(struct pcmcia_device *link)
266{ 266{
267 link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 267 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
268 link->io.NumPorts1 = 16; 268 link->resource[0]->end = 16;
269 link->conf.Attributes = CONF_ENABLE_IRQ; 269 link->conf.Attributes = CONF_ENABLE_IRQ;
270 link->conf.IntType = INT_MEMORY_AND_IO; 270 link->conf.IntType = INT_MEMORY_AND_IO;
271 271
@@ -310,13 +310,12 @@ static int mio_pcmcia_config_loop(struct pcmcia_device *p_dev,
310{ 310{
311 int base, ret; 311 int base, ret;
312 312
313 p_dev->io.NumPorts1 = cfg->io.win[0].len; 313 p_dev->resource[0]->end = cfg->io.win[0].len;
314 p_dev->io.IOAddrLines = cfg->io.flags & CISTPL_IO_LINES_MASK; 314 p_dev->io_lines = cfg->io.flags & CISTPL_IO_LINES_MASK;
315 p_dev->io.NumPorts2 = 0;
316 315
317 for (base = 0x000; base < 0x400; base += 0x20) { 316 for (base = 0x000; base < 0x400; base += 0x20) {
318 p_dev->io.BasePort1 = base; 317 p_dev->resource[0]->start = base;
319 ret = pcmcia_request_io(p_dev, &p_dev->io); 318 ret = pcmcia_request_io(p_dev);
320 if (!ret) 319 if (!ret)
321 return 0; 320 return 0;
322 } 321 }
diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
index 80b8d57c684..25f4e67e3e8 100644
--- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c
+++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
@@ -1102,26 +1102,24 @@ static int daqp_pcmcia_config_loop(struct pcmcia_device *p_dev,
1102 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 1102 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
1103 1103
1104 /* IO window settings */ 1104 /* IO window settings */
1105 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 1105 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
1106 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 1106 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
1107 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 1107 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
1108 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 1108 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
1109 if (!(io->flags & CISTPL_IO_8BIT)) 1109 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
1110 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 1110 p_dev->resource[0]->flags |=
1111 if (!(io->flags & CISTPL_IO_16BIT)) 1111 pcmcia_io_cfg_data_width(io->flags);
1112 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 1112 p_dev->resource[0]->start = io->win[0].base;
1113 p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 1113 p_dev->resource[0]->end = io->win[0].len;
1114 p_dev->io.BasePort1 = io->win[0].base;
1115 p_dev->io.NumPorts1 = io->win[0].len;
1116 if (io->nwin > 1) { 1114 if (io->nwin > 1) {
1117 p_dev->io.Attributes2 = p_dev->io.Attributes1; 1115 p_dev->resource[1]->flags = p_dev->resource[0]->flags;
1118 p_dev->io.BasePort2 = io->win[1].base; 1116 p_dev->resource[1]->start = io->win[1].base;
1119 p_dev->io.NumPorts2 = io->win[1].len; 1117 p_dev->resource[1]->end = io->win[1].len;
1120 } 1118 }
1121 } 1119 }
1122 1120
1123 /* This reserves IO space but doesn't actually enable it */ 1121 /* This reserves IO space but doesn't actually enable it */
1124 return pcmcia_request_io(p_dev, &p_dev->io); 1122 return pcmcia_request_io(p_dev);
1125} 1123}
1126 1124
1127static void daqp_cs_config(struct pcmcia_device *link) 1125static void daqp_cs_config(struct pcmcia_device *link)