Commit fd238232 authored by Dominik Brodowski's avatar Dominik Brodowski

[PATCH] pcmcia: embed dev_link_t into struct pcmcia_device

Embed dev_link_t into struct pcmcia_device(), as they basically address the
same entity. The actual contents of dev_link_t will be cleaned up step by step.
This patch includes a bugfix from and signed-off-by Andrew Morton.
Signed-off-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
parent a78f4dd3
......@@ -65,7 +65,7 @@ MODULE_LICENSE("GPL");
typedef struct bluecard_info_t {
dev_link_t link;
struct pcmcia_device *p_dev;
dev_node_t node;
struct hci_dev *hdev;
......@@ -162,7 +162,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->link.io.BasePort1;
unsigned int iobase = info->p_dev->io.BasePort1;
if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
return;
......@@ -179,7 +179,7 @@ static void bluecard_activity_led_timeout(u_long arg)
static void bluecard_enable_activity_led(bluecard_info_t *info)
{
unsigned int iobase = info->link.io.BasePort1;
unsigned int iobase = info->p_dev->io.BasePort1;
if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
return;
......@@ -235,7 +235,7 @@ static void bluecard_write_wakeup(bluecard_info_t *info)
}
do {
register unsigned int iobase = info->link.io.BasePort1;
register unsigned int iobase = info->p_dev->io.BasePort1;
register unsigned int offset;
register unsigned char command;
register unsigned long ready_bit;
......@@ -244,7 +244,7 @@ static void bluecard_write_wakeup(bluecard_info_t *info)
clear_bit(XMIT_WAKEUP, &(info->tx_state));
if (!(info->link.state & DEV_PRESENT))
if (!(info->p_dev->state & DEV_PRESENT))
return;
if (test_bit(XMIT_BUFFER_NUMBER, &(info->tx_state))) {
......@@ -382,7 +382,7 @@ static void bluecard_receive(bluecard_info_t *info, unsigned int offset)
return;
}
iobase = info->link.io.BasePort1;
iobase = info->p_dev->io.BasePort1;
if (test_bit(XMIT_SENDING_READY, &(info->tx_state)))
bluecard_enable_activity_led(info);
......@@ -512,7 +512,7 @@ static irqreturn_t bluecard_interrupt(int irq, void *dev_inst, struct pt_regs *r
if (!test_bit(CARD_READY, &(info->hw_state)))
return IRQ_HANDLED;
iobase = info->link.io.BasePort1;
iobase = info->p_dev->io.BasePort1;
spin_lock(&(info->lock));
......@@ -626,7 +626,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->link.io.BasePort1;
unsigned int iobase = info->p_dev->io.BasePort1;
if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
bluecard_hci_set_baud_rate(hdev, DEFAULT_BAUD_RATE);
......@@ -646,7 +646,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->link.io.BasePort1;
unsigned int iobase = info->p_dev->io.BasePort1;
if (!test_and_clear_bit(HCI_RUNNING, &(hdev->flags)))
return 0;
......@@ -713,7 +713,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->link.io.BasePort1;
unsigned int iobase = info->p_dev->io.BasePort1;
struct hci_dev *hdev;
unsigned char id;
......@@ -831,7 +831,7 @@ static int bluecard_open(bluecard_info_t *info)
static int bluecard_close(bluecard_info_t *info)
{
unsigned int iobase = info->link.io.BasePort1;
unsigned int iobase = info->p_dev->io.BasePort1;
struct hci_dev *hdev = info->hdev;
if (!hdev)
......@@ -859,14 +859,14 @@ static int bluecard_close(bluecard_info_t *info)
static int bluecard_attach(struct pcmcia_device *p_dev)
{
bluecard_info_t *info;
dev_link_t *link;
dev_link_t *link = dev_to_instance(p_dev);
/* Create new info device */
info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;
link = &info->link;
info->p_dev = p_dev;
link->priv = info;
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
......@@ -880,9 +880,6 @@ static int bluecard_attach(struct pcmcia_device *p_dev)
link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO;
link->handle = p_dev;
p_dev->instance = link;
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
bluecard_config(link);
......@@ -976,7 +973,7 @@ static void bluecard_config(dev_link_t *link)
goto failed;
strcpy(info->node.dev_name, info->hdev->name);
link->dev = &info->node;
link->dev_node = &info->node;
link->state &= ~DEV_CONFIG_PENDING;
return;
......
......@@ -72,7 +72,7 @@ MODULE_LICENSE("GPL");
typedef struct bt3c_info_t {
dev_link_t link;
struct pcmcia_device *p_dev;
dev_node_t node;
struct hci_dev *hdev;
......@@ -191,11 +191,11 @@ static void bt3c_write_wakeup(bt3c_info_t *info)
return;
do {
register unsigned int iobase = info->link.io.BasePort1;
register unsigned int iobase = info->p_dev->io.BasePort1;
register struct sk_buff *skb;
register int len;
if (!(info->link.state & DEV_PRESENT))
if (!(info->p_dev->state & DEV_PRESENT))
break;
......@@ -229,7 +229,7 @@ static void bt3c_receive(bt3c_info_t *info)
return;
}
iobase = info->link.io.BasePort1;
iobase = info->p_dev->io.BasePort1;
avail = bt3c_read(iobase, 0x7006);
//printk("bt3c_cs: receiving %d bytes\n", avail);
......@@ -350,7 +350,7 @@ static irqreturn_t bt3c_interrupt(int irq, void *dev_inst, struct pt_regs *regs)
return IRQ_NONE;
}
iobase = info->link.io.BasePort1;
iobase = info->p_dev->io.BasePort1;
spin_lock(&(info->lock));
......@@ -481,7 +481,7 @@ static int bt3c_load_firmware(bt3c_info_t *info, unsigned char *firmware, int co
unsigned int iobase, size, addr, fcs, tmp;
int i, err = 0;
iobase = info->link.io.BasePort1;
iobase = info->p_dev->io.BasePort1;
/* Reset */
bt3c_io_write(iobase, 0x8040, 0x0404);
......@@ -562,7 +562,6 @@ static int bt3c_open(bt3c_info_t *info)
{
const struct firmware *firmware;
struct hci_dev *hdev;
client_handle_t handle;
int err;
spin_lock_init(&(info->lock));
......@@ -594,10 +593,8 @@ static int bt3c_open(bt3c_info_t *info)
hdev->owner = THIS_MODULE;
handle = info->link.handle;
/* Load firmware */
err = request_firmware(&firmware, "BT3CPCC.bin", &handle_to_dev(handle));
err = request_firmware(&firmware, "BT3CPCC.bin", &info->p_dev->dev);
if (err < 0) {
BT_ERR("Firmware request failed");
goto error;
......@@ -651,14 +648,14 @@ static int bt3c_close(bt3c_info_t *info)
static int bt3c_attach(struct pcmcia_device *p_dev)
{
bt3c_info_t *info;
dev_link_t *link;
dev_link_t *link = dev_to_instance(p_dev);
/* Create new info device */
info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;
link = &info->link;
info->p_dev = p_dev;
link->priv = info;
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
......@@ -672,9 +669,6 @@ static int bt3c_attach(struct pcmcia_device *p_dev)
link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO;
link->handle = p_dev;
p_dev->instance = link;
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
bt3c_config(link);
......@@ -815,7 +809,7 @@ found_port:
goto failed;
strcpy(info->node.dev_name, info->hdev->name);
link->dev = &info->node;
link->dev_node = &info->node;
link->state &= ~DEV_CONFIG_PENDING;
return;
......
......@@ -68,7 +68,7 @@ MODULE_LICENSE("GPL");
typedef struct btuart_info_t {
dev_link_t link;
struct pcmcia_device *p_dev;
dev_node_t node;
struct hci_dev *hdev;
......@@ -146,13 +146,13 @@ static void btuart_write_wakeup(btuart_info_t *info)
}
do {
register unsigned int iobase = info->link.io.BasePort1;
register unsigned int iobase = info->p_dev->io.BasePort1;
register struct sk_buff *skb;
register int len;
clear_bit(XMIT_WAKEUP, &(info->tx_state));
if (!(info->link.state & DEV_PRESENT))
if (!(info->p_dev->state & DEV_PRESENT))
return;
if (!(skb = skb_dequeue(&(info->txq))))
......@@ -187,7 +187,7 @@ static void btuart_receive(btuart_info_t *info)
return;
}
iobase = info->link.io.BasePort1;
iobase = info->p_dev->io.BasePort1;
do {
info->hdev->stat.byte_rx++;
......@@ -301,7 +301,7 @@ static irqreturn_t btuart_interrupt(int irq, void *dev_inst, struct pt_regs *reg
return IRQ_NONE;
}
iobase = info->link.io.BasePort1;
iobase = info->p_dev->io.BasePort1;
spin_lock(&(info->lock));
......@@ -357,7 +357,7 @@ static void btuart_change_speed(btuart_info_t *info, unsigned int speed)
return;
}
iobase = info->link.io.BasePort1;
iobase = info->p_dev->io.BasePort1;
spin_lock_irqsave(&(info->lock), flags);
......@@ -481,7 +481,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->link.io.BasePort1;
unsigned int iobase = info->p_dev->io.BasePort1;
struct hci_dev *hdev;
spin_lock_init(&(info->lock));
......@@ -550,7 +550,7 @@ static int btuart_open(btuart_info_t *info)
static int btuart_close(btuart_info_t *info)
{
unsigned long flags;
unsigned int iobase = info->link.io.BasePort1;
unsigned int iobase = info->p_dev->io.BasePort1;
struct hci_dev *hdev = info->hdev;
if (!hdev)
......@@ -579,14 +579,14 @@ static int btuart_close(btuart_info_t *info)
static int btuart_attach(struct pcmcia_device *p_dev)
{
btuart_info_t *info;
dev_link_t *link;
dev_link_t *link = dev_to_instance(p_dev);
/* Create new info device */
info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;
link = &info->link;
info->p_dev = p_dev;
link->priv = info;
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
......@@ -600,9 +600,6 @@ static int btuart_attach(struct pcmcia_device *p_dev)
link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO;
link->handle = p_dev;
p_dev->instance = link;
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
btuart_config(link);
......@@ -744,7 +741,7 @@ found_port:
goto failed;
strcpy(info->node.dev_name, info->hdev->name);
link->dev = &info->node;
link->dev_node = &info->node;
link->state &= ~DEV_CONFIG_PENDING;
return;
......
......@@ -68,7 +68,7 @@ MODULE_LICENSE("GPL");
typedef struct dtl1_info_t {
dev_link_t link;
struct pcmcia_device *p_dev;
dev_node_t node;
struct hci_dev *hdev;
......@@ -153,13 +153,13 @@ static void dtl1_write_wakeup(dtl1_info_t *info)
}
do {
register unsigned int iobase = info->link.io.BasePort1;
register unsigned int iobase = info->p_dev->io.BasePort1;
register struct sk_buff *skb;
register int len;
clear_bit(XMIT_WAKEUP, &(info->tx_state));
if (!(info->link.state & DEV_PRESENT))
if (!(info->p_dev->state & DEV_PRESENT))
return;
if (!(skb = skb_dequeue(&(info->txq))))
......@@ -218,7 +218,7 @@ static void dtl1_receive(dtl1_info_t *info)
return;
}
iobase = info->link.io.BasePort1;
iobase = info->p_dev->io.BasePort1;
do {
info->hdev->stat.byte_rx++;
......@@ -305,7 +305,7 @@ static irqreturn_t dtl1_interrupt(int irq, void *dev_inst, struct pt_regs *regs)
return IRQ_NONE;
}
iobase = info->link.io.BasePort1;
iobase = info->p_dev->io.BasePort1;
spin_lock(&(info->lock));
......@@ -458,7 +458,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->link.io.BasePort1;
unsigned int iobase = info->p_dev->io.BasePort1;
struct hci_dev *hdev;
spin_lock_init(&(info->lock));
......@@ -504,7 +504,7 @@ 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->link.io.BasePort1 + UART_MSR) & UART_MSR_RI;
info->ri_latch = inb(info->p_dev->io.BasePort1 + UART_MSR) & UART_MSR_RI;
/* Turn on interrupts */
outb(UART_IER_RLSI | UART_IER_RDI | UART_IER_THRI, iobase + UART_IER);
......@@ -529,7 +529,7 @@ static int dtl1_open(dtl1_info_t *info)
static int dtl1_close(dtl1_info_t *info)
{
unsigned long flags;
unsigned int iobase = info->link.io.BasePort1;
unsigned int iobase = info->p_dev->io.BasePort1;
struct hci_dev *hdev = info->hdev;
if (!hdev)
......@@ -558,14 +558,14 @@ static int dtl1_close(dtl1_info_t *info)
static int dtl1_attach(struct pcmcia_device *p_dev)
{
dtl1_info_t *info;
dev_link_t *link;
dev_link_t *link = dev_to_instance(p_dev);
/* Create new info device */
info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;
link = &info->link;
info->p_dev = p_dev;
link->priv = info;
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
......@@ -579,9 +579,6 @@ static int dtl1_attach(struct pcmcia_device *p_dev)
link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO;
link->handle = p_dev;
p_dev->instance = link;
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
dtl1_config(link);
......@@ -696,7 +693,7 @@ static void dtl1_config(dev_link_t *link)
goto failed;
strcpy(info->node.dev_name, info->hdev->name);
link->dev = &info->node;
link->dev_node = &info->node;
link->state &= ~DEV_CONFIG_PENDING;
return;
......
......@@ -46,7 +46,7 @@
/* #define ATR_CSUM */
#ifdef PCMCIA_DEBUG
#define reader_to_dev(x) (&handle_to_dev(x->link.handle))
#define reader_to_dev(x) (&handle_to_dev(x->p_dev->handle))
static int pc_debug = PCMCIA_DEBUG;
module_param(pc_debug, int, 0600);
#define DEBUGP(n, rdr, x, args...) do { \
......@@ -106,7 +106,7 @@ static int major; /* major number we get from the kernel */
#define REG_STOPBITS(x) (x + 7)
struct cm4000_dev {
dev_link_t link; /* pcmcia link */
struct pcmcia_device *p_dev;
dev_node_t node; /* OS node (major,minor) */
unsigned char atr[MAX_ATR];
......@@ -454,7 +454,7 @@ static struct card_fixup card_fixups[] = {
static void set_cardparameter(struct cm4000_dev *dev)
{
int i;
ioaddr_t iobase = dev->link.io.BasePort1;
ioaddr_t iobase = dev->p_dev->io.BasePort1;
u_int8_t stopbits = 0x02; /* ISO default */
DEBUGP(3, dev, "-> set_cardparameter\n");
......@@ -487,7 +487,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;
ioaddr_t iobase = dev->link.io.BasePort1;
ioaddr_t iobase = dev->p_dev->io.BasePort1;
rc = 0;
......@@ -699,7 +699,7 @@ static void terminate_monitor(struct cm4000_dev *dev)
static void monitor_card(unsigned long p)
{
struct cm4000_dev *dev = (struct cm4000_dev *) p;
ioaddr_t iobase = dev->link.io.BasePort1;
ioaddr_t iobase = dev->p_dev->io.BasePort1;
unsigned short s;
struct ptsreq ptsreq;
int i, atrc;
......@@ -962,7 +962,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;
ioaddr_t iobase = dev->link.io.BasePort1;
ioaddr_t iobase = dev->p_dev->io.BasePort1;
ssize_t rc;
int i, j, k;
......@@ -971,7 +971,7 @@ static ssize_t cmm_read(struct file *filp, __user char *buf, size_t count,
if (count == 0) /* according to manpage */
return 0;
if ((dev->link.state & DEV_PRESENT) == 0 || /* socket removed */
if ((dev->p_dev->state & DEV_PRESENT) == 0 || /* socket removed */
test_bit(IS_CMM_ABSENT, &dev->flags))
return -ENODEV;
......@@ -1083,7 +1083,7 @@ static ssize_t cmm_write(struct file *filp, const char __user *buf,
size_t count, loff_t *ppos)
{
struct cm4000_dev *dev = (struct cm4000_dev *) filp->private_data;
ioaddr_t iobase = dev->link.io.BasePort1;
ioaddr_t iobase = dev->p_dev->io.BasePort1;
unsigned short s;
unsigned char tmp;
unsigned char infolen;
......@@ -1108,7 +1108,7 @@ static ssize_t cmm_write(struct file *filp, const char __user *buf,
sendT0 = dev->proto ? 0 : nr > 5 ? 0x08 : 0;
if ((dev->link.state & DEV_PRESENT) == 0 || /* socket removed */
if ((dev->p_dev->state & DEV_PRESENT) == 0 || /* socket removed */
test_bit(IS_CMM_ABSENT, &dev->flags))
return -ENODEV;
......@@ -1440,7 +1440,7 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
{
struct cm4000_dev *dev = filp->private_data;
ioaddr_t iobase = dev->link.io.BasePort1;
ioaddr_t iobase = dev->p_dev->io.BasePort1;
dev_link_t *link;
int size;
int rc;
......@@ -1844,7 +1844,7 @@ static void cm4000_config(dev_link_t * link, int devno)
dev->node.major = major;
dev->node.minor = devno;
dev->node.next = NULL;
link->dev = &dev->node;
link->dev_node = &dev->node;
link->state &= ~DEV_CONFIG_PENDING;
return;
......@@ -1889,8 +1889,8 @@ static void cm4000_release(dev_link_t *link)
static int cm4000_attach(struct pcmcia_device *p_dev)
{
struct cm4000_dev *dev;
dev_link_t *link;
int i;
dev_link_t *link = dev_to_instance(p_dev);
for (i = 0; i < CM4000_MAX_DEV; i++)
if (dev_table[i] == NULL)
......@@ -1906,7 +1906,7 @@ static int cm4000_attach(struct pcmcia_device *p_dev)
if (dev == NULL)
return -ENOMEM;
link = &dev->link;
dev->p_dev = p_dev;
link->priv = dev;
link->conf.IntType = INT_MEMORY_AND_IO;
dev_table[i] = link;
......@@ -1916,9 +1916,6 @@ static int cm4000_attach(struct pcmcia_device *p_dev)
init_waitqueue_head(&dev->atrq);
init_waitqueue_head(&dev->readq);
link->handle = p_dev;
p_dev->instance = link;
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
cm4000_config(link, i);
......
......@@ -41,7 +41,7 @@
#ifdef PCMCIA_DEBUG
#define reader_to_dev(x) (&handle_to_dev(x->link.handle))
#define reader_to_dev(x) (&handle_to_dev(x->p_dev->handle))
static int pc_debug = PCMCIA_DEBUG;
module_param(pc_debug, int, 0600);
#define DEBUGP(n, rdr, x, args...) do { \
......@@ -74,7 +74,7 @@ static struct class *cmx_class;
#define BS_WRITABLE 0x02
struct reader_dev {
dev_link_t link;
struct pcmcia_device *p_dev;
dev_node_t node;
wait_queue_head_t devq;
wait_queue_head_t poll_wait;
......@@ -116,7 +116,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->link.io.BasePort1
unsigned int obs = xinb(dev->p_dev->io.BasePort1
+ REG_OFFSET_BUFFER_STATUS);
if ((obs & BSR_BULK_IN_FULL)) {
......@@ -147,7 +147,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->link.io.BasePort1;
int iobase = dev->p_dev->io.BasePort1;
for (i = 0; i < POLL_LOOP_COUNT; i++) {
if ((xinb(iobase + REG_OFFSET_BUFFER_STATUS)
......@@ -177,7 +177,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->link.io.BasePort1;
int iobase = dev->p_dev->io.BasePort1;
int rc;
rc = wait_for_bulk_out_ready(dev);
......@@ -195,7 +195,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->link.io.BasePort1;
int iobase = dev->p_dev->io.BasePort1;
for (i = 0; i < POLL_LOOP_COUNT; i++) {
if ((xinb(iobase + REG_OFFSET_BUFFER_STATUS)
......@@ -225,7 +225,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->link.io.BasePort1;
int iobase = dev->p_dev->io.BasePort1;
size_t bytes_to_read;
unsigned long i;
size_t min_bytes_to_read;
......@@ -246,7 +246,7 @@ static ssize_t cm4040_read(struct file *filp, char __user *buf,
return -EAGAIN;
}
if ((dev->link.state & DEV_PRESENT)==0)
if ((dev->p_dev->state & DEV_PRESENT)==0)
return -ENODEV;
for (i = 0; i < 5; i++) {
......@@ -328,7 +328,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->link.io.BasePort1;
int iobase = dev->p_dev->io.BasePort1;
ssize_t rc;
int i;
unsigned int bytes_to_write;
......@@ -351,7 +351,7 @@ static ssize_t cm4040_write(struct file *filp, const char __user *buf,
return -EAGAIN;
}
if ((dev->link.state & DEV_PRESENT) == 0)
if ((dev->p_dev->state & DEV_PRESENT) == 0)
return -ENODEV;
bytes_to_write = count;
......@@ -606,7 +606,7 @@ static void reader_config(dev_link_t *link, int devno)
dev->node.major = major;
dev->node.minor = devno;
dev->node.next = NULL;
link->dev = &dev->node;
link->dev_node = &dev->node;
link->state &= ~DEV_CONFIG_PENDING;
DEBUGP(2, dev, "device " DEVICE_NAME "%d at 0x%.4x-0x%.4x\n", devno,
......@@ -631,8 +631,8 @@ static void reader_release(dev_link_t *link)
static int reader_attach(struct pcmcia_device *p_dev)
{
struct reader_dev *dev;
dev_link_t *link;
int i;
dev_link_t *link = dev_to_instance(p_dev);
for (i = 0; i < CM_MAX_DEV; i++) {
if (dev_table[i] == NULL)
......@@ -649,8 +649,8 @@ static int reader_attach(struct pcmcia_device *p_dev)
dev->timeout = CCID_DRIVER_MINIMUM_TIMEOUT;
dev->buffer_status = 0;
link = &dev->link;
link->priv = dev;
dev->p_dev = p_dev;
link->conf.IntType = INT_MEMORY_AND_IO;
dev_table[i] = link;
......@@ -662,9 +662,6 @@ static int reader_attach(struct pcmcia_device *p_dev)
init_timer(&dev->poll_timer);
dev->poll_timer.function = &cm4040_do_poll;
link->handle = p_dev;
p_dev->instance = link;
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
reader_config(link, i);
......
......@@ -228,7 +228,7 @@ typedef struct _mgslpc_info {
struct _input_signal_events input_signal_events;
/* PCMCIA support */
dev_link_t link;
struct pcmcia_device *p_dev;
dev_node_t node;
int stop;
......@@ -536,11 +536,11 @@ static void ldisc_receive_buf(struct tty_struct *tty,
static int mgslpc_attach(struct pcmcia_device *p_dev)
{
MGSLPC_INFO *info;
dev_link_t *link;
dev_link_t *link = dev_to_instance(p_dev);
if (debug_level >= DEBUG_LEVEL_INFO)
printk("mgslpc_attach\n");
info = (MGSLPC_INFO *)kmalloc(sizeof(MGSLPC_INFO), GFP_KERNEL);
if (!info) {
printk("Error can't allocate device instance data\n");
......@@ -565,22 +565,19 @@ static int mgslpc_attach(struct pcmcia_device *p_dev)
info->imrb_value = 0xffff;
info->pim_value = 0xff;
link = &info->link;
info->p_dev = p_dev;
link->priv = info;
/* Initialize the dev_link_t structure */