Skip to content

Commit 1685e63

Browse files
committed
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: pcmcia: avoid buffer overflow in pcmcia_setup_isa_irq pcmcia: do not request windows if you don't need to pcmcia: insert PCMCIA device resources into resource tree pcmcia: export resource information to sysfs pcmcia: use struct resource for PCMCIA devices, part 2 pcmcia: remove memreq_t pcmcia: move local definitions out of include/pcmcia/cs.h pcmcia: do not use io_req_t when calling pcmcia_request_io() pcmcia: do not use io_req_t after call to pcmcia_request_io() pcmcia: use struct resource for PCMCIA devices pcmcia: clean up cs.h pcmcia: use pcmica_{read,write}_config_byte pcmcia: remove cs_types.h pcmcia: remove unused flag, simplify headers pcmcia: remove obsolete CS_EVENT_ definitions pcmcia: split up central event handler pcmcia: simplify event callback pcmcia: remove obsolete ioctl Conflicts in: - drivers/staging/comedi/drivers/* - drivers/staging/wlags49_h2/wl_cs.c due to dev_info_t and whitespace changes
2 parents 1cfd2bd + 127c03c commit 1685e63

97 files changed

Lines changed: 1197 additions & 3195 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Documentation/feature-removal-schedule.txt‎

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -116,29 +116,6 @@ Who: Mauro Carvalho Chehab <mchehab@infradead.org>
116116

117117
---------------------------
118118

119-
What: PCMCIA control ioctl (needed for pcmcia-cs [cardmgr, cardctl])
120-
When: 2.6.35/2.6.36
121-
Files: drivers/pcmcia/: pcmcia_ioctl.c
122-
Why: With the 16-bit PCMCIA subsystem now behaving (almost) like a
123-
normal hotpluggable bus, and with it using the default kernel
124-
infrastructure (hotplug, driver core, sysfs) keeping the PCMCIA
125-
control ioctl needed by cardmgr and cardctl from pcmcia-cs is
126-
unnecessary and potentially harmful (it does not provide for
127-
proper locking), and makes further cleanups and integration of the
128-
PCMCIA subsystem into the Linux kernel device driver model more
129-
difficult. The features provided by cardmgr and cardctl are either
130-
handled by the kernel itself now or are available in the new
131-
pcmciautils package available at
132-
http://kernel.org/pub/linux/utils/kernel/pcmcia/
133-
134-
For all architectures except ARM, the associated config symbol
135-
has been removed from kernel 2.6.34; for ARM, it will be likely
136-
be removed from kernel 2.6.35. The actual code will then likely
137-
be removed from kernel 2.6.36.
138-
Who: Dominik Brodowski <linux@dominikbrodowski.net>
139-
140-
---------------------------
141-
142119
What: sys_sysctl
143120
When: September 2010
144121
Option: CONFIG_SYSCTL_SYSCALL

‎Documentation/pcmcia/driver-changes.txt‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
This file details changes in 2.6 which affect PCMCIA card driver authors:
2+
* pcmcia_request_io changes (as of 2.6.36)
3+
Instead of io_req_t, drivers are now requested to fill out
4+
struct pcmcia_device *p_dev->resource[0,1] for up to two ioport
5+
ranges. After a call to pcmcia_request_io(), the ports found there
6+
are reserved, after calling pcmcia_request_configuration(), they may
7+
be used.
8+
9+
* No dev_info_t, no cs_types.h (as of 2.6.36)
10+
dev_info_t and a few other typedefs are removed. No longer use them
11+
in PCMCIA device drivers. Also, do not include pcmcia/cs_types.h, as
12+
this file is gone.
13+
214
* No dev_node_t (as of 2.6.35)
315
There is no more need to fill out a "dev_node_t" structure.
416

‎drivers/ata/pata_pcmcia.c‎

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#include <linux/ata.h>
3535
#include <linux/libata.h>
3636

37-
#include <pcmcia/cs_types.h>
3837
#include <pcmcia/cs.h>
3938
#include <pcmcia/cistpl.h>
4039
#include <pcmcia/ds.h>
@@ -201,23 +200,25 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev,
201200

202201
if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
203202
cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
204-
pdev->io.BasePort1 = io->win[0].base;
205-
pdev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
206-
if (!(io->flags & CISTPL_IO_16BIT))
207-
pdev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
203+
pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
204+
pdev->resource[0]->start = io->win[0].base;
205+
if (!(io->flags & CISTPL_IO_16BIT)) {
206+
pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
207+
pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
208+
}
208209
if (io->nwin == 2) {
209-
pdev->io.NumPorts1 = 8;
210-
pdev->io.BasePort2 = io->win[1].base;
211-
pdev->io.NumPorts2 = (stk->is_kme) ? 2 : 1;
212-
if (pcmcia_request_io(pdev, &pdev->io) != 0)
210+
pdev->resource[0]->end = 8;
211+
pdev->resource[1]->start = io->win[1].base;
212+
pdev->resource[1]->end = (stk->is_kme) ? 2 : 1;
213+
if (pcmcia_request_io(pdev) != 0)
213214
return -ENODEV;
214-
stk->ctl_base = pdev->io.BasePort2;
215+
stk->ctl_base = pdev->resource[1]->start;
215216
} else if ((io->nwin == 1) && (io->win[0].len >= 16)) {
216-
pdev->io.NumPorts1 = io->win[0].len;
217-
pdev->io.NumPorts2 = 0;
218-
if (pcmcia_request_io(pdev, &pdev->io) != 0)
217+
pdev->resource[0]->end = io->win[0].len;
218+
pdev->resource[1]->end = 0;
219+
if (pcmcia_request_io(pdev) != 0)
219220
return -ENODEV;
220-
stk->ctl_base = pdev->io.BasePort1 + 0x0e;
221+
stk->ctl_base = pdev->resource[0]->start + 0x0e;
221222
} else
222223
return -ENODEV;
223224
/* If we've got this far, we're done */
@@ -246,9 +247,8 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
246247
struct ata_port_operations *ops = &pcmcia_port_ops;
247248

248249
/* Set up attributes in order to probe card and get resources */
249-
pdev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
250-
pdev->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
251-
pdev->io.IOAddrLines = 3;
250+
pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
251+
pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
252252
pdev->conf.Attributes = CONF_ENABLE_IRQ;
253253
pdev->conf.IntType = INT_MEMORY_AND_IO;
254254

@@ -271,7 +271,7 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
271271
if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk))
272272
goto failed; /* No suitable config found */
273273
}
274-
io_base = pdev->io.BasePort1;
274+
io_base = pdev->resource[0]->start;
275275
ctl_base = stk->ctl_base;
276276
if (!pdev->irq)
277277
goto failed;
@@ -294,7 +294,7 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
294294

295295
/* FIXME: Could be more ports at base + 0x10 but we only deal with
296296
one right now */
297-
if (pdev->io.NumPorts1 >= 0x20)
297+
if (resource_size(pdev->resource[0]) >= 0x20)
298298
n_ports = 2;
299299

300300
if (pdev->manf_id == 0x0097 && pdev->card_id == 0x1620)

‎drivers/bluetooth/bluecard_cs.c‎

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#include <linux/skbuff.h>
4040
#include <linux/io.h>
4141

42-
#include <pcmcia/cs_types.h>
4342
#include <pcmcia/cs.h>
4443
#include <pcmcia/cistpl.h>
4544
#include <pcmcia/ciscode.h>
@@ -160,7 +159,7 @@ static void bluecard_detach(struct pcmcia_device *p_dev);
160159
static void bluecard_activity_led_timeout(u_long arg)
161160
{
162161
bluecard_info_t *info = (bluecard_info_t *)arg;
163-
unsigned int iobase = info->p_dev->io.BasePort1;
162+
unsigned int iobase = info->p_dev->resource[0]->start;
164163

165164
if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
166165
return;
@@ -177,7 +176,7 @@ static void bluecard_activity_led_timeout(u_long arg)
177176

178177
static void bluecard_enable_activity_led(bluecard_info_t *info)
179178
{
180-
unsigned int iobase = info->p_dev->io.BasePort1;
179+
unsigned int iobase = info->p_dev->resource[0]->start;
181180

182181
if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
183182
return;
@@ -233,7 +232,7 @@ static void bluecard_write_wakeup(bluecard_info_t *info)
233232
}
234233

235234
do {
236-
register unsigned int iobase = info->p_dev->io.BasePort1;
235+
register unsigned int iobase = info->p_dev->resource[0]->start;
237236
register unsigned int offset;
238237
register unsigned char command;
239238
register unsigned long ready_bit;
@@ -380,7 +379,7 @@ static void bluecard_receive(bluecard_info_t *info, unsigned int offset)
380379
return;
381380
}
382381

383-
iobase = info->p_dev->io.BasePort1;
382+
iobase = info->p_dev->resource[0]->start;
384383

385384
if (test_bit(XMIT_SENDING_READY, &(info->tx_state)))
386385
bluecard_enable_activity_led(info);
@@ -509,7 +508,7 @@ static irqreturn_t bluecard_interrupt(int irq, void *dev_inst)
509508
if (!test_bit(CARD_READY, &(info->hw_state)))
510509
return IRQ_HANDLED;
511510

512-
iobase = info->p_dev->io.BasePort1;
511+
iobase = info->p_dev->resource[0]->start;
513512

514513
spin_lock(&(info->lock));
515514

@@ -623,7 +622,7 @@ static int bluecard_hci_flush(struct hci_dev *hdev)
623622
static int bluecard_hci_open(struct hci_dev *hdev)
624623
{
625624
bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data);
626-
unsigned int iobase = info->p_dev->io.BasePort1;
625+
unsigned int iobase = info->p_dev->resource[0]->start;
627626

628627
if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
629628
bluecard_hci_set_baud_rate(hdev, DEFAULT_BAUD_RATE);
@@ -643,7 +642,7 @@ static int bluecard_hci_open(struct hci_dev *hdev)
643642
static int bluecard_hci_close(struct hci_dev *hdev)
644643
{
645644
bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data);
646-
unsigned int iobase = info->p_dev->io.BasePort1;
645+
unsigned int iobase = info->p_dev->resource[0]->start;
647646

648647
if (!test_and_clear_bit(HCI_RUNNING, &(hdev->flags)))
649648
return 0;
@@ -710,7 +709,7 @@ static int bluecard_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned l
710709

711710
static int bluecard_open(bluecard_info_t *info)
712711
{
713-
unsigned int iobase = info->p_dev->io.BasePort1;
712+
unsigned int iobase = info->p_dev->resource[0]->start;
714713
struct hci_dev *hdev;
715714
unsigned char id;
716715

@@ -829,7 +828,7 @@ static int bluecard_open(bluecard_info_t *info)
829828

830829
static int bluecard_close(bluecard_info_t *info)
831830
{
832-
unsigned int iobase = info->p_dev->io.BasePort1;
831+
unsigned int iobase = info->p_dev->resource[0]->start;
833832
struct hci_dev *hdev = info->hdev;
834833

835834
if (!hdev)
@@ -866,9 +865,6 @@ static int bluecard_probe(struct pcmcia_device *link)
866865
info->p_dev = link;
867866
link->priv = info;
868867

869-
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
870-
link->io.NumPorts1 = 8;
871-
872868
link->conf.Attributes = CONF_ENABLE_IRQ;
873869
link->conf.IntType = INT_MEMORY_AND_IO;
874870

@@ -891,12 +887,14 @@ static int bluecard_config(struct pcmcia_device *link)
891887
int i, n;
892888

893889
link->conf.ConfigIndex = 0x20;
894-
link->io.NumPorts1 = 64;
895-
link->io.IOAddrLines = 6;
890+
891+
link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
892+
link->resource[0]->end = 64;
893+
link->io_lines = 6;
896894

897895
for (n = 0; n < 0x400; n += 0x40) {
898-
link->io.BasePort1 = n ^ 0x300;
899-
i = pcmcia_request_io(link, &link->io);
896+
link->resource[0]->start = n ^ 0x300;
897+
i = pcmcia_request_io(link);
900898
if (i == 0)
901899
break;
902900
}

‎drivers/bluetooth/bt3c_cs.c‎

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
#include <linux/device.h>
4646
#include <linux/firmware.h>
4747

48-
#include <pcmcia/cs_types.h>
4948
#include <pcmcia/cs.h>
5049
#include <pcmcia/cistpl.h>
5150
#include <pcmcia/ciscode.h>
@@ -189,7 +188,7 @@ static void bt3c_write_wakeup(bt3c_info_t *info)
189188
return;
190189

191190
do {
192-
register unsigned int iobase = info->p_dev->io.BasePort1;
191+
register unsigned int iobase = info->p_dev->resource[0]->start;
193192
register struct sk_buff *skb;
194193
register int len;
195194

@@ -227,7 +226,7 @@ static void bt3c_receive(bt3c_info_t *info)
227226
return;
228227
}
229228

230-
iobase = info->p_dev->io.BasePort1;
229+
iobase = info->p_dev->resource[0]->start;
231230

232231
avail = bt3c_read(iobase, 0x7006);
233232
//printk("bt3c_cs: receiving %d bytes\n", avail);
@@ -348,7 +347,7 @@ static irqreturn_t bt3c_interrupt(int irq, void *dev_inst)
348347
/* our irq handler is shared */
349348
return IRQ_NONE;
350349

351-
iobase = info->p_dev->io.BasePort1;
350+
iobase = info->p_dev->resource[0]->start;
352351

353352
spin_lock(&(info->lock));
354353

@@ -481,7 +480,7 @@ static int bt3c_load_firmware(bt3c_info_t *info, const unsigned char *firmware,
481480
unsigned int iobase, size, addr, fcs, tmp;
482481
int i, err = 0;
483482

484-
iobase = info->p_dev->io.BasePort1;
483+
iobase = info->p_dev->resource[0]->start;
485484

486485
/* Reset */
487486
bt3c_io_write(iobase, 0x8040, 0x0404);
@@ -658,8 +657,8 @@ static int bt3c_probe(struct pcmcia_device *link)
658657
info->p_dev = link;
659658
link->priv = info;
660659

661-
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
662-
link->io.NumPorts1 = 8;
660+
link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
661+
link->resource[0]->end = 8;
663662

664663
link->conf.Attributes = CONF_ENABLE_IRQ;
665664
link->conf.IntType = INT_MEMORY_AND_IO;
@@ -684,14 +683,14 @@ static int bt3c_check_config(struct pcmcia_device *p_dev,
684683
{
685684
unsigned long try = (unsigned long) priv_data;
686685

686+
p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
687+
687688
if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM))
688689
p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
689690
if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) &&
690691
(cf->io.win[0].base != 0)) {
691-
p_dev->io.BasePort1 = cf->io.win[0].base;
692-
p_dev->io.IOAddrLines = (try == 0) ? 16 :
693-
cf->io.flags & CISTPL_IO_LINES_MASK;
694-
if (!pcmcia_request_io(p_dev, &p_dev->io))
692+
p_dev->resource[0]->start = cf->io.win[0].base;
693+
if (!pcmcia_request_io(p_dev))
695694
return 0;
696695
}
697696
return -ENODEV;
@@ -708,9 +707,9 @@ static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev,
708707

709708
if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
710709
for (j = 0; j < 5; j++) {
711-
p_dev->io.BasePort1 = base[j];
712-
p_dev->io.IOAddrLines = base[j] ? 16 : 3;
713-
if (!pcmcia_request_io(p_dev, &p_dev->io))
710+
p_dev->resource[0]->start = base[j];
711+
p_dev->io_lines = base[j] ? 16 : 3;
712+
if (!pcmcia_request_io(p_dev))
714713
return 0;
715714
}
716715
}

0 commit comments

Comments
 (0)