aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 17:12:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 17:12:40 -0400
commit2be4ff2f084842839b041b793ed6237e8d1d315a (patch)
tree1d776ac1717edeff4ee7d59ab0aea2782cb86dba /drivers/char
parentcf2fa66055d718ae13e62451bb546505f63906a2 (diff)
parenta45b3fb19ba1e4dfc3fc53563a072612092930a9 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6: (49 commits) pcmcia: ioctl-internal definitions pcmcia: cistpl header cleanup pcmcia: remove unused argument to pcmcia_parse_tuple() pcmcia: card services header cleanup pcmcia: device_id header cleanup pcmcia: encapsulate ioaddr_t pcmcia: cleanup device driver header file pcmcia: cleanup socket services header file pcmcia: merge ds_internal.h into cs_internal.h pcmcia: cleanup cs_internal.h pcmcia: cs_internal.h is internal pcmcia: use dev_printk for cs_error() pcmcia: remove CS_ error codes alltogether pcmcia: deprecate CS_BAD_TUPLE pcmcia: deprecate CS_BAD_ARGS pcmcia: deprecate CS_BAD_BASE, CS_BAD_IRQ, CS_BAD_OFFSET and CS_BAD_SIZE pcmcia: deprecate CS_BAD_ATTRIBUTE, CS_BAD_TYPE and CS_BAD_PAGE pcmcia: deprecate CS_NO_MORE_ITEMS pcmcia: deprecate CS_IN_USE pcmcia: deprecate CS_CONFIGURATION_LOCKED ... Fix trivial conflict in drivers/pcmcia/ds.c manually
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c73
-rw-r--r--drivers/char/pcmcia/cm4040_cs.c80
-rw-r--r--drivers/char/pcmcia/ipwireless/main.c54
-rw-r--r--drivers/char/pcmcia/synclink_cs.c2
4 files changed, 79 insertions, 130 deletions
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index f070ae7bd91a..1c5bf99895ed 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -1759,65 +1759,40 @@ static void cmm_cm4000_release(struct pcmcia_device * link)
1759 1759
1760/*==== Interface to PCMCIA Layer =======================================*/ 1760/*==== Interface to PCMCIA Layer =======================================*/
1761 1761
1762static int cm4000_config_check(struct pcmcia_device *p_dev,
1763 cistpl_cftable_entry_t *cfg,
1764 cistpl_cftable_entry_t *dflt,
1765 unsigned int vcc,
1766 void *priv_data)
1767{
1768 if (!cfg->io.nwin)
1769 return -ENODEV;
1770
1771 /* Get the IOaddr */
1772 p_dev->io.BasePort1 = cfg->io.win[0].base;
1773 p_dev->io.NumPorts1 = cfg->io.win[0].len;
1774 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
1775 if (!(cfg->io.flags & CISTPL_IO_8BIT))
1776 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
1777 if (!(cfg->io.flags & CISTPL_IO_16BIT))
1778 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
1779 p_dev->io.IOAddrLines = cfg->io.flags & CISTPL_IO_LINES_MASK;
1780
1781 return pcmcia_request_io(p_dev, &p_dev->io);
1782}
1783
1762static int cm4000_config(struct pcmcia_device * link, int devno) 1784static int cm4000_config(struct pcmcia_device * link, int devno)
1763{ 1785{
1764 struct cm4000_dev *dev; 1786 struct cm4000_dev *dev;
1765 tuple_t tuple;
1766 cisparse_t parse;
1767 u_char buf[64];
1768 int fail_fn, fail_rc;
1769 int rc;
1770 1787
1771 /* read the config-tuples */ 1788 /* read the config-tuples */
1772 tuple.Attributes = 0; 1789 if (pcmcia_loop_config(link, cm4000_config_check, NULL))
1773 tuple.TupleData = buf;
1774 tuple.TupleDataMax = sizeof(buf);
1775 tuple.TupleOffset = 0;
1776
1777 link->io.BasePort2 = 0;
1778 link->io.NumPorts2 = 0;
1779 link->io.Attributes2 = 0;
1780 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
1781 for (rc = pcmcia_get_first_tuple(link, &tuple);
1782 rc == CS_SUCCESS; rc = pcmcia_get_next_tuple(link, &tuple)) {
1783
1784 rc = pcmcia_get_tuple_data(link, &tuple);
1785 if (rc != CS_SUCCESS)
1786 continue;
1787 rc = pcmcia_parse_tuple(link, &tuple, &parse);
1788 if (rc != CS_SUCCESS)
1789 continue;
1790
1791 link->conf.ConfigIndex = parse.cftable_entry.index;
1792
1793 if (!parse.cftable_entry.io.nwin)
1794 continue;
1795
1796 /* Get the IOaddr */
1797 link->io.BasePort1 = parse.cftable_entry.io.win[0].base;
1798 link->io.NumPorts1 = parse.cftable_entry.io.win[0].len;
1799 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
1800 if (!(parse.cftable_entry.io.flags & CISTPL_IO_8BIT))
1801 link->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
1802 if (!(parse.cftable_entry.io.flags & CISTPL_IO_16BIT))
1803 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
1804 link->io.IOAddrLines = parse.cftable_entry.io.flags
1805 & CISTPL_IO_LINES_MASK;
1806
1807 rc = pcmcia_request_io(link, &link->io);
1808 if (rc == CS_SUCCESS)
1809 break; /* we are done */
1810 }
1811 if (rc != CS_SUCCESS)
1812 goto cs_release; 1790 goto cs_release;
1813 1791
1814 link->conf.IntType = 00000002; 1792 link->conf.IntType = 00000002;
1815 1793
1816 if ((fail_rc = 1794 if (pcmcia_request_configuration(link, &link->conf))
1817 pcmcia_request_configuration(link, &link->conf)) != CS_SUCCESS) {
1818 fail_fn = RequestConfiguration;
1819 goto cs_release; 1795 goto cs_release;
1820 }
1821 1796
1822 dev = link->priv; 1797 dev = link->priv;
1823 sprintf(dev->node.dev_name, DEVICE_NAME "%d", devno); 1798 sprintf(dev->node.dev_name, DEVICE_NAME "%d", devno);
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c
index 0b5934bef7a4..2d7c906435b7 100644
--- a/drivers/char/pcmcia/cm4040_cs.c
+++ b/drivers/char/pcmcia/cm4040_cs.c
@@ -526,65 +526,49 @@ static void cm4040_reader_release(struct pcmcia_device *link)
526 return; 526 return;
527} 527}
528 528
529static int reader_config(struct pcmcia_device *link, int devno) 529static int cm4040_config_check(struct pcmcia_device *p_dev,
530 cistpl_cftable_entry_t *cfg,
531 cistpl_cftable_entry_t *dflt,
532 unsigned int vcc,
533 void *priv_data)
530{ 534{
531 struct reader_dev *dev;
532 tuple_t tuple;
533 cisparse_t parse;
534 u_char buf[64];
535 int fail_fn, fail_rc;
536 int rc; 535 int rc;
536 if (!cfg->io.nwin)
537 return -ENODEV;
538
539 /* Get the IOaddr */
540 p_dev->io.BasePort1 = cfg->io.win[0].base;
541 p_dev->io.NumPorts1 = cfg->io.win[0].len;
542 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
543 if (!(cfg->io.flags & CISTPL_IO_8BIT))
544 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
545 if (!(cfg->io.flags & CISTPL_IO_16BIT))
546 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
547 p_dev->io.IOAddrLines = cfg->io.flags & CISTPL_IO_LINES_MASK;
548
549 rc = pcmcia_request_io(p_dev, &p_dev->io);
550 dev_printk(KERN_INFO, &handle_to_dev(p_dev),
551 "pcmcia_request_io returned 0x%x\n", rc);
552 return rc;
553}
554
537 555
538 tuple.Attributes = 0; 556static int reader_config(struct pcmcia_device *link, int devno)
539 tuple.TupleData = buf; 557{
540 tuple.TupleDataMax = sizeof(buf); 558 struct reader_dev *dev;
541 tuple.TupleOffset = 0; 559 int fail_rc;
542 560
543 link->io.BasePort2 = 0; 561 link->io.BasePort2 = 0;
544 link->io.NumPorts2 = 0; 562 link->io.NumPorts2 = 0;
545 link->io.Attributes2 = 0; 563 link->io.Attributes2 = 0;
546 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 564
547 for (rc = pcmcia_get_first_tuple(link, &tuple); 565 if (pcmcia_loop_config(link, cm4040_config_check, NULL))
548 rc == CS_SUCCESS;
549 rc = pcmcia_get_next_tuple(link, &tuple)) {
550 rc = pcmcia_get_tuple_data(link, &tuple);
551 if (rc != CS_SUCCESS)
552 continue;
553 rc = pcmcia_parse_tuple(link, &tuple, &parse);
554 if (rc != CS_SUCCESS)
555 continue;
556
557 link->conf.ConfigIndex = parse.cftable_entry.index;
558
559 if (!parse.cftable_entry.io.nwin)
560 continue;
561
562 link->io.BasePort1 = parse.cftable_entry.io.win[0].base;
563 link->io.NumPorts1 = parse.cftable_entry.io.win[0].len;
564 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
565 if (!(parse.cftable_entry.io.flags & CISTPL_IO_8BIT))
566 link->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
567 if (!(parse.cftable_entry.io.flags & CISTPL_IO_16BIT))
568 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
569 link->io.IOAddrLines = parse.cftable_entry.io.flags
570 & CISTPL_IO_LINES_MASK;
571 rc = pcmcia_request_io(link, &link->io);
572
573 dev_printk(KERN_INFO, &handle_to_dev(link), "foo");
574 if (rc == CS_SUCCESS)
575 break;
576 else
577 dev_printk(KERN_INFO, &handle_to_dev(link),
578 "pcmcia_request_io failed 0x%x\n", rc);
579 }
580 if (rc != CS_SUCCESS)
581 goto cs_release; 566 goto cs_release;
582 567
583 link->conf.IntType = 00000002; 568 link->conf.IntType = 00000002;
584 569
585 if ((fail_rc = pcmcia_request_configuration(link,&link->conf)) 570 fail_rc = pcmcia_request_configuration(link, &link->conf);
586 !=CS_SUCCESS) { 571 if (fail_rc != 0) {
587 fail_fn = RequestConfiguration;
588 dev_printk(KERN_INFO, &handle_to_dev(link), 572 dev_printk(KERN_INFO, &handle_to_dev(link),
589 "pcmcia_request_configuration failed 0x%x\n", 573 "pcmcia_request_configuration failed 0x%x\n",
590 fail_rc); 574 fail_rc);
diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/char/pcmcia/ipwireless/main.c
index 5eca7a99afe6..5216fce0c62d 100644
--- a/drivers/char/pcmcia/ipwireless/main.c
+++ b/drivers/char/pcmcia/ipwireless/main.c
@@ -65,9 +65,9 @@ static void signalled_reboot_work(struct work_struct *work_reboot)
65 struct ipw_dev *ipw = container_of(work_reboot, struct ipw_dev, 65 struct ipw_dev *ipw = container_of(work_reboot, struct ipw_dev,
66 work_reboot); 66 work_reboot);
67 struct pcmcia_device *link = ipw->link; 67 struct pcmcia_device *link = ipw->link;
68 int ret = pccard_reset_card(link->socket); 68 int ret = pcmcia_reset_card(link->socket);
69 69
70 if (ret != CS_SUCCESS) 70 if (ret != 0)
71 cs_error(link, ResetCard, ret); 71 cs_error(link, ResetCard, ret);
72} 72}
73 73
@@ -83,7 +83,6 @@ static int config_ipwireless(struct ipw_dev *ipw)
83{ 83{
84 struct pcmcia_device *link = ipw->link; 84 struct pcmcia_device *link = ipw->link;
85 int ret; 85 int ret;
86 config_info_t conf;
87 tuple_t tuple; 86 tuple_t tuple;
88 unsigned short buf[64]; 87 unsigned short buf[64];
89 cisparse_t parse; 88 cisparse_t parse;
@@ -105,7 +104,7 @@ static int config_ipwireless(struct ipw_dev *ipw)
105 while (ret == 0) { 104 while (ret == 0) {
106 ret = pcmcia_get_tuple_data(link, &tuple); 105 ret = pcmcia_get_tuple_data(link, &tuple);
107 106
108 if (ret != CS_SUCCESS) { 107 if (ret != 0) {
109 cs_error(link, GetTupleData, ret); 108 cs_error(link, GetTupleData, ret);
110 goto exit0; 109 goto exit0;
111 } 110 }
@@ -116,21 +115,21 @@ static int config_ipwireless(struct ipw_dev *ipw)
116 115
117 ret = pcmcia_get_first_tuple(link, &tuple); 116 ret = pcmcia_get_first_tuple(link, &tuple);
118 117
119 if (ret != CS_SUCCESS) { 118 if (ret != 0) {
120 cs_error(link, GetFirstTuple, ret); 119 cs_error(link, GetFirstTuple, ret);
121 goto exit0; 120 goto exit0;
122 } 121 }
123 122
124 ret = pcmcia_get_tuple_data(link, &tuple); 123 ret = pcmcia_get_tuple_data(link, &tuple);
125 124
126 if (ret != CS_SUCCESS) { 125 if (ret != 0) {
127 cs_error(link, GetTupleData, ret); 126 cs_error(link, GetTupleData, ret);
128 goto exit0; 127 goto exit0;
129 } 128 }
130 129
131 ret = pcmcia_parse_tuple(link, &tuple, &parse); 130 ret = pcmcia_parse_tuple(&tuple, &parse);
132 131
133 if (ret != CS_SUCCESS) { 132 if (ret != 0) {
134 cs_error(link, ParseTuple, ret); 133 cs_error(link, ParseTuple, ret);
135 goto exit0; 134 goto exit0;
136 } 135 }
@@ -152,21 +151,21 @@ static int config_ipwireless(struct ipw_dev *ipw)
152 151
153 ret = pcmcia_get_first_tuple(link, &tuple); 152 ret = pcmcia_get_first_tuple(link, &tuple);
154 153
155 if (ret != CS_SUCCESS) { 154 if (ret != 0) {
156 cs_error(link, GetFirstTuple, ret); 155 cs_error(link, GetFirstTuple, ret);
157 goto exit0; 156 goto exit0;
158 } 157 }
159 158
160 ret = pcmcia_get_tuple_data(link, &tuple); 159 ret = pcmcia_get_tuple_data(link, &tuple);
161 160
162 if (ret != CS_SUCCESS) { 161 if (ret != 0) {
163 cs_error(link, GetTupleData, ret); 162 cs_error(link, GetTupleData, ret);
164 goto exit0; 163 goto exit0;
165 } 164 }
166 165
167 ret = pcmcia_parse_tuple(link, &tuple, &parse); 166 ret = pcmcia_parse_tuple(&tuple, &parse);
168 167
169 if (ret != CS_SUCCESS) { 168 if (ret != 0) {
170 cs_error(link, GetTupleData, ret); 169 cs_error(link, GetTupleData, ret);
171 goto exit0; 170 goto exit0;
172 } 171 }
@@ -181,7 +180,7 @@ static int config_ipwireless(struct ipw_dev *ipw)
181 180
182 ret = pcmcia_request_io(link, &link->io); 181 ret = pcmcia_request_io(link, &link->io);
183 182
184 if (ret != CS_SUCCESS) { 183 if (ret != 0) {
185 cs_error(link, RequestIO, ret); 184 cs_error(link, RequestIO, ret);
186 goto exit0; 185 goto exit0;
187 } 186 }
@@ -195,21 +194,21 @@ static int config_ipwireless(struct ipw_dev *ipw)
195 194
196 ret = pcmcia_get_first_tuple(link, &tuple); 195 ret = pcmcia_get_first_tuple(link, &tuple);
197 196
198 if (ret != CS_SUCCESS) { 197 if (ret != 0) {
199 cs_error(link, GetFirstTuple, ret); 198 cs_error(link, GetFirstTuple, ret);
200 goto exit1; 199 goto exit1;
201 } 200 }
202 201
203 ret = pcmcia_get_tuple_data(link, &tuple); 202 ret = pcmcia_get_tuple_data(link, &tuple);
204 203
205 if (ret != CS_SUCCESS) { 204 if (ret != 0) {
206 cs_error(link, GetTupleData, ret); 205 cs_error(link, GetTupleData, ret);
207 goto exit1; 206 goto exit1;
208 } 207 }
209 208
210 ret = pcmcia_parse_tuple(link, &tuple, &parse); 209 ret = pcmcia_parse_tuple(&tuple, &parse);
211 210
212 if (ret != CS_SUCCESS) { 211 if (ret != 0) {
213 cs_error(link, ParseTuple, ret); 212 cs_error(link, ParseTuple, ret);
214 goto exit1; 213 goto exit1;
215 } 214 }
@@ -227,7 +226,7 @@ static int config_ipwireless(struct ipw_dev *ipw)
227 ret = pcmcia_request_window(&link, &ipw->request_common_memory, 226 ret = pcmcia_request_window(&link, &ipw->request_common_memory,
228 &ipw->handle_common_memory); 227 &ipw->handle_common_memory);
229 228
230 if (ret != CS_SUCCESS) { 229 if (ret != 0) {
231 cs_error(link, RequestWindow, ret); 230 cs_error(link, RequestWindow, ret);
232 goto exit1; 231 goto exit1;
233 } 232 }
@@ -239,7 +238,7 @@ static int config_ipwireless(struct ipw_dev *ipw)
239 ret = pcmcia_map_mem_page(ipw->handle_common_memory, 238 ret = pcmcia_map_mem_page(ipw->handle_common_memory,
240 &memreq_common_memory); 239 &memreq_common_memory);
241 240
242 if (ret != CS_SUCCESS) { 241 if (ret != 0) {
243 cs_error(link, MapMemPage, ret); 242 cs_error(link, MapMemPage, ret);
244 goto exit1; 243 goto exit1;
245 } 244 }
@@ -261,7 +260,7 @@ static int config_ipwireless(struct ipw_dev *ipw)
261 ret = pcmcia_request_window(&link, &ipw->request_attr_memory, 260 ret = pcmcia_request_window(&link, &ipw->request_attr_memory,
262 &ipw->handle_attr_memory); 261 &ipw->handle_attr_memory);
263 262
264 if (ret != CS_SUCCESS) { 263 if (ret != 0) {
265 cs_error(link, RequestWindow, ret); 264 cs_error(link, RequestWindow, ret);
266 goto exit2; 265 goto exit2;
267 } 266 }
@@ -272,7 +271,7 @@ static int config_ipwireless(struct ipw_dev *ipw)
272 ret = pcmcia_map_mem_page(ipw->handle_attr_memory, 271 ret = pcmcia_map_mem_page(ipw->handle_attr_memory,
273 &memreq_attr_memory); 272 &memreq_attr_memory);
274 273
275 if (ret != CS_SUCCESS) { 274 if (ret != 0) {
276 cs_error(link, MapMemPage, ret); 275 cs_error(link, MapMemPage, ret);
277 goto exit2; 276 goto exit2;
278 } 277 }
@@ -292,20 +291,11 @@ static int config_ipwireless(struct ipw_dev *ipw)
292 291
293 ret = pcmcia_request_irq(link, &link->irq); 292 ret = pcmcia_request_irq(link, &link->irq);
294 293
295 if (ret != CS_SUCCESS) { 294 if (ret != 0) {
296 cs_error(link, RequestIRQ, ret); 295 cs_error(link, RequestIRQ, ret);
297 goto exit3; 296 goto exit3;
298 } 297 }
299 298
300 /* Look up current Vcc */
301
302 ret = pcmcia_get_configuration_info(link, &conf);
303
304 if (ret != CS_SUCCESS) {
305 cs_error(link, GetConfigurationInfo, ret);
306 goto exit4;
307 }
308
309 printk(KERN_INFO IPWIRELESS_PCCARD_NAME ": Card type %s\n", 299 printk(KERN_INFO IPWIRELESS_PCCARD_NAME ": Card type %s\n",
310 ipw->is_v2_card ? "V2/V3" : "V1"); 300 ipw->is_v2_card ? "V2/V3" : "V1");
311 printk(KERN_INFO IPWIRELESS_PCCARD_NAME 301 printk(KERN_INFO IPWIRELESS_PCCARD_NAME
@@ -341,7 +331,7 @@ static int config_ipwireless(struct ipw_dev *ipw)
341 */ 331 */
342 ret = pcmcia_request_configuration(link, &link->conf); 332 ret = pcmcia_request_configuration(link, &link->conf);
343 333
344 if (ret != CS_SUCCESS) { 334 if (ret != 0) {
345 cs_error(link, RequestConfiguration, ret); 335 cs_error(link, RequestConfiguration, ret);
346 goto exit4; 336 goto exit4;
347 } 337 }
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index c240562c218b..9a626e50b793 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -601,7 +601,7 @@ static int mgslpc_config(struct pcmcia_device *link)
601 601
602 cfg = &(parse.cftable_entry); 602 cfg = &(parse.cftable_entry);
603 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); 603 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
604 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); 604 CS_CHECK(ParseTuple, pcmcia_parse_tuple(&tuple, &parse));
605 605
606 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; 606 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg;
607 if (cfg->index == 0) 607 if (cfg->index == 0)