Skip to content

Commit

Permalink
pcmcia: do not use io_req_t after call to pcmcia_request_io()
Browse files Browse the repository at this point in the history
After pcmcia_request_io(), do not make use of the values stored in
io_req_t, but instead use those found in struct pcmcia_device->resource[].

CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
Acked-by: Marcel Holtmann <[email protected]> (for drivers/bluetooth/)
Signed-off-by: Dominik Brodowski <[email protected]>
  • Loading branch information
Dominik Brodowski committed Aug 3, 2010
1 parent 2ce4905 commit 9a017a9
Show file tree
Hide file tree
Showing 51 changed files with 223 additions and 240 deletions.
8 changes: 4 additions & 4 deletions drivers/ata/pata_pcmcia.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,13 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev,
pdev->io.NumPorts2 = (stk->is_kme) ? 2 : 1;
if (pcmcia_request_io(pdev, &pdev->io) != 0)
return -ENODEV;
stk->ctl_base = pdev->io.BasePort2;
stk->ctl_base = pdev->resource[1]->start;
} else if ((io->nwin == 1) && (io->win[0].len >= 16)) {
pdev->io.NumPorts1 = io->win[0].len;
pdev->io.NumPorts2 = 0;
if (pcmcia_request_io(pdev, &pdev->io) != 0)
return -ENODEV;
stk->ctl_base = pdev->io.BasePort1 + 0x0e;
stk->ctl_base = pdev->resource[0]->start + 0x0e;
} else
return -ENODEV;
/* If we've got this far, we're done */
Expand Down Expand Up @@ -270,7 +270,7 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk))
goto failed; /* No suitable config found */
}
io_base = pdev->io.BasePort1;
io_base = pdev->resource[0]->start;
ctl_base = stk->ctl_base;
if (!pdev->irq)
goto failed;
Expand All @@ -293,7 +293,7 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)

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

if (pdev->manf_id == 0x0097 && pdev->card_id == 0x1620)
Expand Down
18 changes: 9 additions & 9 deletions drivers/bluetooth/bluecard_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ static void bluecard_detach(struct pcmcia_device *p_dev);
static void bluecard_activity_led_timeout(u_long arg)
{
bluecard_info_t *info = (bluecard_info_t *)arg;
unsigned int iobase = info->p_dev->io.BasePort1;
unsigned int iobase = info->p_dev->resource[0]->start;

if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
return;
Expand All @@ -176,7 +176,7 @@ static void bluecard_activity_led_timeout(u_long arg)

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

if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
return;
Expand Down Expand Up @@ -232,7 +232,7 @@ static void bluecard_write_wakeup(bluecard_info_t *info)
}

do {
register unsigned int iobase = info->p_dev->io.BasePort1;
register unsigned int iobase = info->p_dev->resource[0]->start;
register unsigned int offset;
register unsigned char command;
register unsigned long ready_bit;
Expand Down Expand Up @@ -379,7 +379,7 @@ static void bluecard_receive(bluecard_info_t *info, unsigned int offset)
return;
}

iobase = info->p_dev->io.BasePort1;
iobase = info->p_dev->resource[0]->start;

if (test_bit(XMIT_SENDING_READY, &(info->tx_state)))
bluecard_enable_activity_led(info);
Expand Down Expand Up @@ -508,7 +508,7 @@ static irqreturn_t bluecard_interrupt(int irq, void *dev_inst)
if (!test_bit(CARD_READY, &(info->hw_state)))
return IRQ_HANDLED;

iobase = info->p_dev->io.BasePort1;
iobase = info->p_dev->resource[0]->start;

spin_lock(&(info->lock));

Expand Down Expand Up @@ -622,7 +622,7 @@ static int bluecard_hci_flush(struct hci_dev *hdev)
static int bluecard_hci_open(struct hci_dev *hdev)
{
bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data);
unsigned int iobase = info->p_dev->io.BasePort1;
unsigned int iobase = info->p_dev->resource[0]->start;

if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
bluecard_hci_set_baud_rate(hdev, DEFAULT_BAUD_RATE);
Expand All @@ -642,7 +642,7 @@ static int bluecard_hci_open(struct hci_dev *hdev)
static int bluecard_hci_close(struct hci_dev *hdev)
{
bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data);
unsigned int iobase = info->p_dev->io.BasePort1;
unsigned int iobase = info->p_dev->resource[0]->start;

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

static int bluecard_open(bluecard_info_t *info)
{
unsigned int iobase = info->p_dev->io.BasePort1;
unsigned int iobase = info->p_dev->resource[0]->start;
struct hci_dev *hdev;
unsigned char id;

Expand Down Expand Up @@ -828,7 +828,7 @@ static int bluecard_open(bluecard_info_t *info)

static int bluecard_close(bluecard_info_t *info)
{
unsigned int iobase = info->p_dev->io.BasePort1;
unsigned int iobase = info->p_dev->resource[0]->start;
struct hci_dev *hdev = info->hdev;

if (!hdev)
Expand Down
8 changes: 4 additions & 4 deletions drivers/bluetooth/bt3c_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ static void bt3c_write_wakeup(bt3c_info_t *info)
return;

do {
register unsigned int iobase = info->p_dev->io.BasePort1;
register unsigned int iobase = info->p_dev->resource[0]->start;
register struct sk_buff *skb;
register int len;

Expand Down Expand Up @@ -226,7 +226,7 @@ static void bt3c_receive(bt3c_info_t *info)
return;
}

iobase = info->p_dev->io.BasePort1;
iobase = info->p_dev->resource[0]->start;

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

iobase = info->p_dev->io.BasePort1;
iobase = info->p_dev->resource[0]->start;

spin_lock(&(info->lock));

Expand Down Expand Up @@ -480,7 +480,7 @@ static int bt3c_load_firmware(bt3c_info_t *info, const unsigned char *firmware,
unsigned int iobase, size, addr, fcs, tmp;
int i, err = 0;

iobase = info->p_dev->io.BasePort1;
iobase = info->p_dev->resource[0]->start;

/* Reset */
bt3c_io_write(iobase, 0x8040, 0x0404);
Expand Down
12 changes: 6 additions & 6 deletions drivers/bluetooth/btuart_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ static void btuart_write_wakeup(btuart_info_t *info)
}

do {
register unsigned int iobase = info->p_dev->io.BasePort1;
register unsigned int iobase = info->p_dev->resource[0]->start;
register struct sk_buff *skb;
register int len;

Expand Down Expand Up @@ -183,7 +183,7 @@ static void btuart_receive(btuart_info_t *info)
return;
}

iobase = info->p_dev->io.BasePort1;
iobase = info->p_dev->resource[0]->start;

do {
info->hdev->stat.byte_rx++;
Expand Down Expand Up @@ -297,7 +297,7 @@ static irqreturn_t btuart_interrupt(int irq, void *dev_inst)
/* our irq handler is shared */
return IRQ_NONE;

iobase = info->p_dev->io.BasePort1;
iobase = info->p_dev->resource[0]->start;

spin_lock(&(info->lock));

Expand Down Expand Up @@ -354,7 +354,7 @@ static void btuart_change_speed(btuart_info_t *info, unsigned int speed)
return;
}

iobase = info->p_dev->io.BasePort1;
iobase = info->p_dev->resource[0]->start;

spin_lock_irqsave(&(info->lock), flags);

Expand Down Expand Up @@ -478,7 +478,7 @@ static int btuart_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned lon
static int btuart_open(btuart_info_t *info)
{
unsigned long flags;
unsigned int iobase = info->p_dev->io.BasePort1;
unsigned int iobase = info->p_dev->resource[0]->start;
struct hci_dev *hdev;

spin_lock_init(&(info->lock));
Expand Down Expand Up @@ -548,7 +548,7 @@ static int btuart_open(btuart_info_t *info)
static int btuart_close(btuart_info_t *info)
{
unsigned long flags;
unsigned int iobase = info->p_dev->io.BasePort1;
unsigned int iobase = info->p_dev->resource[0]->start;
struct hci_dev *hdev = info->hdev;

if (!hdev)
Expand Down
13 changes: 7 additions & 6 deletions drivers/bluetooth/dtl1_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ static void dtl1_write_wakeup(dtl1_info_t *info)
}

do {
register unsigned int iobase = info->p_dev->io.BasePort1;
register unsigned int iobase = info->p_dev->resource[0]->start;
register struct sk_buff *skb;
register int len;

Expand Down Expand Up @@ -214,7 +214,7 @@ static void dtl1_receive(dtl1_info_t *info)
return;
}

iobase = info->p_dev->io.BasePort1;
iobase = info->p_dev->resource[0]->start;

do {
info->hdev->stat.byte_rx++;
Expand Down Expand Up @@ -301,7 +301,7 @@ static irqreturn_t dtl1_interrupt(int irq, void *dev_inst)
/* our irq handler is shared */
return IRQ_NONE;

iobase = info->p_dev->io.BasePort1;
iobase = info->p_dev->resource[0]->start;

spin_lock(&(info->lock));

Expand Down Expand Up @@ -461,7 +461,7 @@ static int dtl1_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long
static int dtl1_open(dtl1_info_t *info)
{
unsigned long flags;
unsigned int iobase = info->p_dev->io.BasePort1;
unsigned int iobase = info->p_dev->resource[0]->start;
struct hci_dev *hdev;

spin_lock_init(&(info->lock));
Expand Down Expand Up @@ -508,7 +508,8 @@ static int dtl1_open(dtl1_info_t *info)
outb(UART_LCR_WLEN8, iobase + UART_LCR); /* Reset DLAB */
outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase + UART_MCR);

info->ri_latch = inb(info->p_dev->io.BasePort1 + UART_MSR) & UART_MSR_RI;
info->ri_latch = inb(info->p_dev->resource[0]->start + UART_MSR)
& UART_MSR_RI;

/* Turn on interrupts */
outb(UART_IER_RLSI | UART_IER_RDI | UART_IER_THRI, iobase + UART_IER);
Expand All @@ -533,7 +534,7 @@ static int dtl1_open(dtl1_info_t *info)
static int dtl1_close(dtl1_info_t *info)
{
unsigned long flags;
unsigned int iobase = info->p_dev->io.BasePort1;
unsigned int iobase = info->p_dev->resource[0]->start;
struct hci_dev *hdev = info->hdev;

if (!hdev)
Expand Down
12 changes: 6 additions & 6 deletions drivers/char/pcmcia/cm4000_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ static struct card_fixup card_fixups[] = {
static void set_cardparameter(struct cm4000_dev *dev)
{
int i;
unsigned int iobase = dev->p_dev->io.BasePort1;
unsigned int iobase = dev->p_dev->resource[0]->start;
u_int8_t stopbits = 0x02; /* ISO default */

DEBUGP(3, dev, "-> set_cardparameter\n");
Expand Down Expand Up @@ -454,7 +454,7 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq)
unsigned short num_bytes_read;
unsigned char pts_reply[4];
ssize_t rc;
unsigned int iobase = dev->p_dev->io.BasePort1;
unsigned int iobase = dev->p_dev->resource[0]->start;

rc = 0;

Expand Down Expand Up @@ -663,7 +663,7 @@ static void terminate_monitor(struct cm4000_dev *dev)
static void monitor_card(unsigned long p)
{
struct cm4000_dev *dev = (struct cm4000_dev *) p;
unsigned int iobase = dev->p_dev->io.BasePort1;
unsigned int iobase = dev->p_dev->resource[0]->start;
unsigned short s;
struct ptsreq ptsreq;
int i, atrc;
Expand Down Expand Up @@ -924,7 +924,7 @@ static ssize_t cmm_read(struct file *filp, __user char *buf, size_t count,
loff_t *ppos)
{
struct cm4000_dev *dev = filp->private_data;
unsigned int iobase = dev->p_dev->io.BasePort1;
unsigned int iobase = dev->p_dev->resource[0]->start;
ssize_t rc;
int i, j, k;

Expand Down Expand Up @@ -1047,7 +1047,7 @@ static ssize_t cmm_write(struct file *filp, const char __user *buf,
size_t count, loff_t *ppos)
{
struct cm4000_dev *dev = filp->private_data;
unsigned int iobase = dev->p_dev->io.BasePort1;
unsigned int iobase = dev->p_dev->resource[0]->start;
unsigned short s;
unsigned char tmp;
unsigned char infolen;
Expand Down Expand Up @@ -1400,7 +1400,7 @@ static void stop_monitor(struct cm4000_dev *dev)
static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
struct cm4000_dev *dev = filp->private_data;
unsigned int iobase = dev->p_dev->io.BasePort1;
unsigned int iobase = dev->p_dev->resource[0]->start;
struct inode *inode = filp->f_path.dentry->d_inode;
struct pcmcia_device *link;
int size;
Expand Down
16 changes: 8 additions & 8 deletions drivers/char/pcmcia/cm4040_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static inline unsigned char xinb(unsigned short port)
static void cm4040_do_poll(unsigned long dummy)
{
struct reader_dev *dev = (struct reader_dev *) dummy;
unsigned int obs = xinb(dev->p_dev->io.BasePort1
unsigned int obs = xinb(dev->p_dev->resource[0]->start
+ REG_OFFSET_BUFFER_STATUS);

if ((obs & BSR_BULK_IN_FULL)) {
Expand Down Expand Up @@ -140,7 +140,7 @@ static void cm4040_stop_poll(struct reader_dev *dev)
static int wait_for_bulk_out_ready(struct reader_dev *dev)
{
int i, rc;
int iobase = dev->p_dev->io.BasePort1;
int iobase = dev->p_dev->resource[0]->start;

for (i = 0; i < POLL_LOOP_COUNT; i++) {
if ((xinb(iobase + REG_OFFSET_BUFFER_STATUS)
Expand Down Expand Up @@ -170,7 +170,7 @@ static int wait_for_bulk_out_ready(struct reader_dev *dev)
/* Write to Sync Control Register */
static int write_sync_reg(unsigned char val, struct reader_dev *dev)
{
int iobase = dev->p_dev->io.BasePort1;
int iobase = dev->p_dev->resource[0]->start;
int rc;

rc = wait_for_bulk_out_ready(dev);
Expand All @@ -188,7 +188,7 @@ static int write_sync_reg(unsigned char val, struct reader_dev *dev)
static int wait_for_bulk_in_ready(struct reader_dev *dev)
{
int i, rc;
int iobase = dev->p_dev->io.BasePort1;
int iobase = dev->p_dev->resource[0]->start;

for (i = 0; i < POLL_LOOP_COUNT; i++) {
if ((xinb(iobase + REG_OFFSET_BUFFER_STATUS)
Expand Down Expand Up @@ -218,7 +218,7 @@ static ssize_t cm4040_read(struct file *filp, char __user *buf,
size_t count, loff_t *ppos)
{
struct reader_dev *dev = filp->private_data;
int iobase = dev->p_dev->io.BasePort1;
int iobase = dev->p_dev->resource[0]->start;
size_t bytes_to_read;
unsigned long i;
size_t min_bytes_to_read;
Expand Down Expand Up @@ -320,7 +320,7 @@ static ssize_t cm4040_write(struct file *filp, const char __user *buf,
size_t count, loff_t *ppos)
{
struct reader_dev *dev = filp->private_data;
int iobase = dev->p_dev->io.BasePort1;
int iobase = dev->p_dev->resource[0]->start;
ssize_t rc;
int i;
unsigned int bytes_to_write;
Expand Down Expand Up @@ -567,8 +567,8 @@ static int reader_config(struct pcmcia_device *link, int devno)

dev = link->priv;

DEBUGP(2, dev, "device " DEVICE_NAME "%d at 0x%.4x-0x%.4x\n", devno,
link->io.BasePort1, link->io.BasePort1+link->io.NumPorts1);
DEBUGP(2, dev, "device " DEVICE_NAME "%d at %pR\n", devno,
link->resource[0]);
DEBUGP(2, dev, "<- reader_config (succ)\n");

return 0;
Expand Down
Loading

0 comments on commit 9a017a9

Please sign in to comment.