mirror of
https://github.com/armbian/linux.git
synced 2026-01-06 10:13:00 -08:00
[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: Dominik Brodowski <linux@dominikbrodowski.net>
This commit is contained in:
@@ -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 */
|
||||
|
||||
/* Interrupt setup */
|
||||
link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
|
||||
link->irq.IRQInfo1 = IRQ_LEVEL_ID;
|
||||
link->irq.Handler = NULL;
|
||||
|
||||
|
||||
link->conf.Attributes = 0;
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
mgslpc_config(link);
|
||||
|
||||
@@ -673,7 +670,7 @@ static void mgslpc_config(dev_link_t *link)
|
||||
/* add to linked list of devices */
|
||||
sprintf(info->node.dev_name, "mgslpc0");
|
||||
info->node.major = info->node.minor = 0;
|
||||
link->dev = &info->node;
|
||||
link->dev_node = &info->node;
|
||||
|
||||
printk(KERN_INFO "%s: index 0x%02x:",
|
||||
info->node.dev_name, link->conf.ConfigIndex);
|
||||
@@ -1259,7 +1256,7 @@ static irqreturn_t mgslpc_isr(int irq, void *dev_id, struct pt_regs * regs)
|
||||
if (!info)
|
||||
return IRQ_NONE;
|
||||
|
||||
if (!(info->link.state & DEV_CONFIG))
|
||||
if (!(info->p_dev->state & DEV_CONFIG))
|
||||
return IRQ_HANDLED;
|
||||
|
||||
spin_lock(&info->lock);
|
||||
|
||||
@@ -81,7 +81,7 @@ static const char ide_major[] = {
|
||||
};
|
||||
|
||||
typedef struct ide_info_t {
|
||||
dev_link_t link;
|
||||
struct pcmcia_device *p_dev;
|
||||
int ndev;
|
||||
dev_node_t node;
|
||||
int hd;
|
||||
@@ -106,7 +106,7 @@ static void ide_detach(struct pcmcia_device *p_dev);
|
||||
static int ide_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
ide_info_t *info;
|
||||
dev_link_t *link;
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
|
||||
DEBUG(0, "ide_attach()\n");
|
||||
|
||||
@@ -114,7 +114,9 @@ static int ide_attach(struct pcmcia_device *p_dev)
|
||||
info = kzalloc(sizeof(*info), GFP_KERNEL);
|
||||
if (!info)
|
||||
return -ENOMEM;
|
||||
link = &info->link; link->priv = info;
|
||||
|
||||
info->p_dev = p_dev;
|
||||
link->priv = info;
|
||||
|
||||
link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
|
||||
link->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
|
||||
@@ -124,9 +126,6 @@ static int ide_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;
|
||||
ide_config(link);
|
||||
|
||||
@@ -326,7 +325,7 @@ static void ide_config(dev_link_t *link)
|
||||
info->node.major = ide_major[hd];
|
||||
info->node.minor = 0;
|
||||
info->hd = hd;
|
||||
link->dev = &info->node;
|
||||
link->dev_node = &info->node;
|
||||
printk(KERN_INFO "ide-cs: %s: Vpp = %d.%d\n",
|
||||
info->node.dev_name, link->conf.Vpp / 10, link->conf.Vpp % 10);
|
||||
|
||||
|
||||
@@ -101,49 +101,37 @@ typedef struct local_info_t {
|
||||
|
||||
static int avmcs_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
dev_link_t *link;
|
||||
local_info_t *local;
|
||||
|
||||
/* Initialize the dev_link_t structure */
|
||||
link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
|
||||
if (!link)
|
||||
goto err;
|
||||
memset(link, 0, sizeof(struct dev_link_t));
|
||||
|
||||
/* The io structure describes IO port mapping */
|
||||
link->io.NumPorts1 = 16;
|
||||
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
|
||||
link->io.NumPorts2 = 0;
|
||||
p_dev->io.NumPorts1 = 16;
|
||||
p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
|
||||
p_dev->io.NumPorts2 = 0;
|
||||
|
||||
/* Interrupt setup */
|
||||
link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
|
||||
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;
|
||||
p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
|
||||
p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;
|
||||
|
||||
p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID;
|
||||
|
||||
link->irq.IRQInfo1 = IRQ_LEVEL_ID;
|
||||
|
||||
/* General socket configuration */
|
||||
link->conf.Attributes = CONF_ENABLE_IRQ;
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
link->conf.ConfigIndex = 1;
|
||||
link->conf.Present = PRESENT_OPTION;
|
||||
p_dev->conf.Attributes = CONF_ENABLE_IRQ;
|
||||
p_dev->conf.IntType = INT_MEMORY_AND_IO;
|
||||
p_dev->conf.ConfigIndex = 1;
|
||||
p_dev->conf.Present = PRESENT_OPTION;
|
||||
|
||||
/* Allocate space for private device-specific data */
|
||||
local = kmalloc(sizeof(local_info_t), GFP_KERNEL);
|
||||
if (!local)
|
||||
goto err_kfree;
|
||||
goto err;
|
||||
memset(local, 0, sizeof(local_info_t));
|
||||
link->priv = local;
|
||||
p_dev->priv = local;
|
||||
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
avmcs_config(link);
|
||||
p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
avmcs_config(p_dev);
|
||||
|
||||
return 0;
|
||||
|
||||
err_kfree:
|
||||
kfree(link);
|
||||
err:
|
||||
return -EINVAL;
|
||||
} /* avmcs_attach */
|
||||
@@ -165,7 +153,6 @@ static void avmcs_detach(struct pcmcia_device *p_dev)
|
||||
avmcs_release(link);
|
||||
|
||||
kfree(link->priv);
|
||||
kfree(link);
|
||||
} /* avmcs_detach */
|
||||
|
||||
/*======================================================================
|
||||
@@ -330,7 +317,7 @@ found_port:
|
||||
|
||||
dev->node.major = 64;
|
||||
dev->node.minor = 0;
|
||||
link->dev = &dev->node;
|
||||
link->dev_node = &dev->node;
|
||||
|
||||
link->state &= ~DEV_CONFIG_PENDING;
|
||||
/* If any step failed, release any partially configured state */
|
||||
|
||||
@@ -118,50 +118,39 @@ typedef struct local_info_t {
|
||||
|
||||
static int avma1cs_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
dev_link_t *link;
|
||||
local_info_t *local;
|
||||
|
||||
DEBUG(0, "avma1cs_attach()\n");
|
||||
|
||||
/* Initialize the dev_link_t structure */
|
||||
link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
|
||||
if (!link)
|
||||
return -ENOMEM;
|
||||
memset(link, 0, sizeof(struct dev_link_t));
|
||||
|
||||
/* Allocate space for private device-specific data */
|
||||
local = kmalloc(sizeof(local_info_t), GFP_KERNEL);
|
||||
if (!local) {
|
||||
kfree(link);
|
||||
if (!local)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
memset(local, 0, sizeof(local_info_t));
|
||||
link->priv = local;
|
||||
p_dev->priv = local;
|
||||
|
||||
/* The io structure describes IO port mapping */
|
||||
link->io.NumPorts1 = 16;
|
||||
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
|
||||
link->io.NumPorts2 = 16;
|
||||
link->io.Attributes2 = IO_DATA_PATH_WIDTH_16;
|
||||
link->io.IOAddrLines = 5;
|
||||
p_dev->io.NumPorts1 = 16;
|
||||
p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
|
||||
p_dev->io.NumPorts2 = 16;
|
||||
p_dev->io.Attributes2 = IO_DATA_PATH_WIDTH_16;
|
||||
p_dev->io.IOAddrLines = 5;
|
||||
|
||||
/* Interrupt setup */
|
||||
link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
|
||||
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;
|
||||
p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
|
||||
p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;
|
||||
|
||||
link->irq.IRQInfo1 = IRQ_LEVEL_ID;
|
||||
p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID;
|
||||
|
||||
/* General socket configuration */
|
||||
link->conf.Attributes = CONF_ENABLE_IRQ;
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
link->conf.ConfigIndex = 1;
|
||||
link->conf.Present = PRESENT_OPTION;
|
||||
p_dev->conf.Attributes = CONF_ENABLE_IRQ;
|
||||
p_dev->conf.IntType = INT_MEMORY_AND_IO;
|
||||
p_dev->conf.ConfigIndex = 1;
|
||||
p_dev->conf.Present = PRESENT_OPTION;
|
||||
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
avma1cs_config(link);
|
||||
p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
avma1cs_config(p_dev);
|
||||
|
||||
return 0;
|
||||
} /* avma1cs_attach */
|
||||
@@ -185,7 +174,6 @@ static void avma1cs_detach(struct pcmcia_device *p_dev)
|
||||
avma1cs_release(link);
|
||||
|
||||
kfree(link->priv);
|
||||
kfree(link);
|
||||
} /* avma1cs_detach */
|
||||
|
||||
/*======================================================================
|
||||
@@ -335,7 +323,7 @@ found_port:
|
||||
strcpy(dev->node.dev_name, "A1");
|
||||
dev->node.major = 45;
|
||||
dev->node.minor = 0;
|
||||
link->dev = &dev->node;
|
||||
link->dev_node = &dev->node;
|
||||
|
||||
link->state &= ~DEV_CONFIG_PENDING;
|
||||
/* If any step failed, release any partially configured state */
|
||||
|
||||
@@ -121,7 +121,7 @@ static void elsa_cs_detach(struct pcmcia_device *p_dev);
|
||||
*/
|
||||
|
||||
typedef struct local_info_t {
|
||||
dev_link_t link;
|
||||
struct pcmcia_device *p_dev;
|
||||
dev_node_t node;
|
||||
int busy;
|
||||
int cardnr;
|
||||
@@ -141,8 +141,8 @@ typedef struct local_info_t {
|
||||
|
||||
static int elsa_cs_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
dev_link_t *link;
|
||||
local_info_t *local;
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
|
||||
DEBUG(0, "elsa_cs_attach()\n");
|
||||
|
||||
@@ -150,8 +150,11 @@ static int elsa_cs_attach(struct pcmcia_device *p_dev)
|
||||
local = kmalloc(sizeof(local_info_t), GFP_KERNEL);
|
||||
if (!local) return -ENOMEM;
|
||||
memset(local, 0, sizeof(local_info_t));
|
||||
|
||||
local->p_dev = p_dev;
|
||||
link->priv = local;
|
||||
|
||||
local->cardnr = -1;
|
||||
link = &local->link; link->priv = local;
|
||||
|
||||
/* Interrupt setup */
|
||||
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;
|
||||
@@ -172,9 +175,6 @@ static int elsa_cs_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;
|
||||
elsa_cs_config(link);
|
||||
|
||||
@@ -320,7 +320,7 @@ static void elsa_cs_config(dev_link_t *link)
|
||||
sprintf(dev->node.dev_name, "elsa");
|
||||
dev->node.major = dev->node.minor = 0x0;
|
||||
|
||||
link->dev = &dev->node;
|
||||
link->dev_node = &dev->node;
|
||||
|
||||
/* Finally, report what we've done */
|
||||
printk(KERN_INFO "%s: index 0x%02x: ",
|
||||
|
||||
@@ -130,7 +130,7 @@ static void sedlbauer_detach(struct pcmcia_device *p_dev);
|
||||
*/
|
||||
|
||||
typedef struct local_info_t {
|
||||
dev_link_t link;
|
||||
struct pcmcia_device *p_dev;
|
||||
dev_node_t node;
|
||||
int stop;
|
||||
int cardnr;
|
||||
@@ -151,7 +151,7 @@ typedef struct local_info_t {
|
||||
static int sedlbauer_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
local_info_t *local;
|
||||
dev_link_t *link;
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
|
||||
DEBUG(0, "sedlbauer_attach()\n");
|
||||
|
||||
@@ -160,8 +160,10 @@ static int sedlbauer_attach(struct pcmcia_device *p_dev)
|
||||
if (!local) return -ENOMEM;
|
||||
memset(local, 0, sizeof(local_info_t));
|
||||
local->cardnr = -1;
|
||||
link = &local->link; link->priv = local;
|
||||
|
||||
|
||||
local->p_dev = p_dev;
|
||||
link->priv = local;
|
||||
|
||||
/* Interrupt setup */
|
||||
link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
|
||||
link->irq.IRQInfo1 = IRQ_LEVEL_ID;
|
||||
@@ -182,13 +184,9 @@ static int sedlbauer_attach(struct pcmcia_device *p_dev)
|
||||
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
|
||||
link->io.IOAddrLines = 3;
|
||||
|
||||
|
||||
link->conf.Attributes = 0;
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
sedlbauer_config(link);
|
||||
|
||||
@@ -397,7 +395,7 @@ static void sedlbauer_config(dev_link_t *link)
|
||||
*/
|
||||
sprintf(dev->node.dev_name, "sedlbauer");
|
||||
dev->node.major = dev->node.minor = 0;
|
||||
link->dev = &dev->node;
|
||||
link->dev_node = &dev->node;
|
||||
|
||||
/* Finally, report what we've done */
|
||||
printk(KERN_INFO "%s: index 0x%02x:",
|
||||
|
||||
@@ -112,7 +112,7 @@ static void teles_detach(struct pcmcia_device *p_dev);
|
||||
*/
|
||||
|
||||
typedef struct local_info_t {
|
||||
dev_link_t link;
|
||||
struct pcmcia_device *p_dev;
|
||||
dev_node_t node;
|
||||
int busy;
|
||||
int cardnr;
|
||||
@@ -132,8 +132,8 @@ typedef struct local_info_t {
|
||||
|
||||
static int teles_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
dev_link_t *link;
|
||||
local_info_t *local;
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
|
||||
DEBUG(0, "teles_attach()\n");
|
||||
|
||||
@@ -142,7 +142,9 @@ static int teles_attach(struct pcmcia_device *p_dev)
|
||||
if (!local) return -ENOMEM;
|
||||
memset(local, 0, sizeof(local_info_t));
|
||||
local->cardnr = -1;
|
||||
link = &local->link; link->priv = local;
|
||||
|
||||
local->p_dev = p_dev;
|
||||
link->priv = local;
|
||||
|
||||
/* Interrupt setup */
|
||||
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;
|
||||
@@ -163,9 +165,6 @@ static int teles_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;
|
||||
teles_cs_config(link);
|
||||
|
||||
@@ -311,7 +310,7 @@ static void teles_cs_config(dev_link_t *link)
|
||||
sprintf(dev->node.dev_name, "teles");
|
||||
dev->node.major = dev->node.minor = 0x0;
|
||||
|
||||
link->dev = &dev->node;
|
||||
link->dev_node = &dev->node;
|
||||
|
||||
/* Finally, report what we've done */
|
||||
printk(KERN_INFO "%s: index 0x%02x:",
|
||||
|
||||
@@ -54,7 +54,7 @@ static const int debug = 0;
|
||||
#define MAX_PCMCIA_ADDR 0x4000000
|
||||
|
||||
struct pcmciamtd_dev {
|
||||
dev_link_t link; /* PCMCIA link */
|
||||
struct pcmcia_device *p_dev;
|
||||
dev_node_t node; /* device node */
|
||||
caddr_t win_base; /* ioremapped address of PCMCIA window */
|
||||
unsigned int win_size; /* size of window */
|
||||
@@ -111,8 +111,8 @@ static caddr_t remap_window(struct map_info *map, unsigned long to)
|
||||
memreq_t mrq;
|
||||
int ret;
|
||||
|
||||
if(!(dev->link.state & DEV_PRESENT)) {
|
||||
DEBUG(1, "device removed state = 0x%4.4X", dev->link.state);
|
||||
if(!(dev->p_dev->state & DEV_PRESENT)) {
|
||||
DEBUG(1, "device removed state = 0x%4.4X", dev->p_dev->state);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ static caddr_t remap_window(struct map_info *map, unsigned long to)
|
||||
dev->offset, mrq.CardOffset);
|
||||
mrq.Page = 0;
|
||||
if( (ret = pcmcia_map_mem_page(win, &mrq)) != CS_SUCCESS) {
|
||||
cs_error(dev->link.handle, MapMemPage, ret);
|
||||
cs_error(dev->p_dev->handle, MapMemPage, ret);
|
||||
return NULL;
|
||||
}
|
||||
dev->offset = mrq.CardOffset;
|
||||
@@ -319,7 +319,7 @@ static void pcmcia_copy_to(struct map_info *map, unsigned long to, const void *f
|
||||
static void pcmciamtd_set_vpp(struct map_info *map, int on)
|
||||
{
|
||||
struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1;
|
||||
dev_link_t *link = &dev->link;
|
||||
dev_link_t *link = dev->p_dev;
|
||||
modconf_t mod;
|
||||
int ret;
|
||||
|
||||
@@ -650,7 +650,7 @@ static void pcmciamtd_config(dev_link_t *link)
|
||||
use the faster non-remapping read/write functions */
|
||||
if(mtd->size <= dev->win_size) {
|
||||
DEBUG(1, "Using non remapping memory functions");
|
||||
dev->pcmcia_map.map_priv_1 = (unsigned long)&(dev->link.state);
|
||||
dev->pcmcia_map.map_priv_1 = (unsigned long)&(dev->p_dev->state);
|
||||
dev->pcmcia_map.map_priv_2 = (unsigned long)dev->win_base;
|
||||
if (dev->pcmcia_map.bankwidth == 1) {
|
||||
dev->pcmcia_map.read = pcmcia_read8;
|
||||
@@ -673,7 +673,7 @@ static void pcmciamtd_config(dev_link_t *link)
|
||||
snprintf(dev->node.dev_name, sizeof(dev->node.dev_name), "mtd%d", mtd->index);
|
||||
info("mtd%d: %s", mtd->index, mtd->name);
|
||||
link->state &= ~DEV_CONFIG_PENDING;
|
||||
link->dev = &dev->node;
|
||||
link->dev_node = &dev->node;
|
||||
return;
|
||||
|
||||
cs_failed:
|
||||
@@ -735,7 +735,7 @@ static void pcmciamtd_detach(struct pcmcia_device *p_dev)
|
||||
static int pcmciamtd_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
struct pcmciamtd_dev *dev;
|
||||
dev_link_t *link;
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
|
||||
/* Create new memory card device */
|
||||
dev = kmalloc(sizeof(*dev), GFP_KERNEL);
|
||||
@@ -743,16 +743,12 @@ static int pcmciamtd_attach(struct pcmcia_device *p_dev)
|
||||
DEBUG(1, "dev=0x%p", dev);
|
||||
|
||||
memset(dev, 0, sizeof(*dev));
|
||||
link = &dev->link;
|
||||
dev->p_dev = p_dev;
|
||||
link->priv = dev;
|
||||
|
||||
link->conf.Attributes = 0;
|
||||
link->conf.IntType = INT_MEMORY;
|
||||
|
||||
link->next = NULL;
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
pcmciamtd_config(link);
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ enum Window4 { /* Window 4: Xcvr/media bits. */
|
||||
#define MEDIA_TP 0x00C0 /* Enable link beat and jabber for 10baseT. */
|
||||
|
||||
struct el3_private {
|
||||
dev_link_t link;
|
||||
struct pcmcia_device *p_dev;
|
||||
dev_node_t node;
|
||||
struct net_device_stats stats;
|
||||
u16 advertising, partner; /* NWay media advertisement */
|
||||
@@ -259,8 +259,8 @@ static void tc574_detach(struct pcmcia_device *p_dev);
|
||||
static int tc574_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
struct el3_private *lp;
|
||||
dev_link_t *link;
|
||||
struct net_device *dev;
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
|
||||
DEBUG(0, "3c574_attach()\n");
|
||||
|
||||
@@ -269,8 +269,8 @@ static int tc574_attach(struct pcmcia_device *p_dev)
|
||||
if (!dev)
|
||||
return -ENOMEM;
|
||||
lp = netdev_priv(dev);
|
||||
link = &lp->link;
|
||||
link->priv = dev;
|
||||
lp->p_dev = p_dev;
|
||||
|
||||
spin_lock_init(&lp->window_lock);
|
||||
link->io.NumPorts1 = 32;
|
||||
@@ -297,9 +297,6 @@ static int tc574_attach(struct pcmcia_device *p_dev)
|
||||
dev->watchdog_timeo = TX_TIMEOUT;
|
||||
#endif
|
||||
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
tc574_config(link);
|
||||
|
||||
@@ -322,7 +319,7 @@ static void tc574_detach(struct pcmcia_device *p_dev)
|
||||
|
||||
DEBUG(0, "3c574_detach(0x%p)\n", link);
|
||||
|
||||
if (link->dev)
|
||||
if (link->dev_node)
|
||||
unregister_netdev(dev);
|
||||
|
||||
if (link->state & DEV_CONFIG)
|
||||
@@ -473,12 +470,12 @@ static void tc574_config(dev_link_t *link)
|
||||
}
|
||||
|
||||
link->state &= ~DEV_CONFIG_PENDING;
|
||||
link->dev = &lp->node;
|
||||
link->dev_node = &lp->node;
|
||||
SET_NETDEV_DEV(dev, &handle_to_dev(handle));
|
||||
|
||||
if (register_netdev(dev) != 0) {
|
||||
printk(KERN_NOTICE "3c574_cs: register_netdev() failed\n");
|
||||
link->dev = NULL;
|
||||
link->dev_node = NULL;
|
||||
goto failed;
|
||||
}
|
||||
|
||||
@@ -742,7 +739,7 @@ static void tc574_reset(struct net_device *dev)
|
||||
static int el3_open(struct net_device *dev)
|
||||
{
|
||||
struct el3_private *lp = netdev_priv(dev);
|
||||
dev_link_t *link = &lp->link;
|
||||
dev_link_t *link = lp->p_dev;
|
||||
|
||||
if (!DEV_OK(link))
|
||||
return -ENODEV;
|
||||
@@ -1188,7 +1185,7 @@ static int el3_close(struct net_device *dev)
|
||||
{
|
||||
kio_addr_t ioaddr = dev->base_addr;
|
||||
struct el3_private *lp = netdev_priv(dev);
|
||||
dev_link_t *link = &lp->link;
|
||||
dev_link_t *link = lp->p_dev;
|
||||
|
||||
DEBUG(2, "%s: shutting down ethercard.\n", dev->name);
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ enum RxFilter {
|
||||
#define TX_TIMEOUT ((400*HZ)/1000)
|
||||
|
||||
struct el3_private {
|
||||
dev_link_t link;
|
||||
struct pcmcia_device *p_dev;
|
||||
dev_node_t node;
|
||||
struct net_device_stats stats;
|
||||
/* For transceiver monitoring */
|
||||
@@ -173,8 +173,8 @@ static void tc589_detach(struct pcmcia_device *p_dev);
|
||||
static int tc589_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
struct el3_private *lp;
|
||||
dev_link_t *link;
|
||||
struct net_device *dev;
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
|
||||
DEBUG(0, "3c589_attach()\n");
|
||||
|
||||
@@ -183,8 +183,8 @@ static int tc589_attach(struct pcmcia_device *p_dev)
|
||||
if (!dev)
|
||||
return -ENOMEM;
|
||||
lp = netdev_priv(dev);
|
||||
link = &lp->link;
|
||||
link->priv = dev;
|
||||
lp->p_dev = p_dev;
|
||||
|
||||
spin_lock_init(&lp->lock);
|
||||
link->io.NumPorts1 = 16;
|
||||
@@ -212,9 +212,6 @@ static int tc589_attach(struct pcmcia_device *p_dev)
|
||||
#endif
|
||||
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
|
||||
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
tc589_config(link);
|
||||
|
||||
@@ -237,7 +234,7 @@ static void tc589_detach(struct pcmcia_device *p_dev)
|
||||
|
||||
DEBUG(0, "3c589_detach(0x%p)\n", link);
|
||||
|
||||
if (link->dev)
|
||||
if (link->dev_node)
|
||||
unregister_netdev(dev);
|
||||
|
||||
if (link->state & DEV_CONFIG)
|
||||
@@ -345,13 +342,13 @@ static void tc589_config(dev_link_t *link)
|
||||
else
|
||||
printk(KERN_ERR "3c589_cs: invalid if_port requested\n");
|
||||
|
||||
link->dev = &lp->node;
|
||||
link->dev_node = &lp->node;
|
||||
link->state &= ~DEV_CONFIG_PENDING;
|
||||
SET_NETDEV_DEV(dev, &handle_to_dev(handle));
|
||||
|
||||
if (register_netdev(dev) != 0) {
|
||||
printk(KERN_ERR "3c589_cs: register_netdev() failed\n");
|
||||
link->dev = NULL;
|
||||
link->dev_node = NULL;
|
||||
goto failed;
|
||||
}
|
||||
|
||||
@@ -572,7 +569,7 @@ static int el3_config(struct net_device *dev, struct ifmap *map)
|
||||
static int el3_open(struct net_device *dev)
|
||||
{
|
||||
struct el3_private *lp = netdev_priv(dev);
|
||||
dev_link_t *link = &lp->link;
|
||||
dev_link_t *link = lp->p_dev;
|
||||
|
||||
if (!DEV_OK(link))
|
||||
return -ENODEV;
|
||||
@@ -833,7 +830,7 @@ static struct net_device_stats *el3_get_stats(struct net_device *dev)
|
||||
{
|
||||
struct el3_private *lp = netdev_priv(dev);
|
||||
unsigned long flags;
|
||||
dev_link_t *link = &lp->link;
|
||||
dev_link_t *link = lp->p_dev;
|
||||
|
||||
if (DEV_OK(link)) {
|
||||
spin_lock_irqsave(&lp->lock, flags);
|
||||
@@ -935,7 +932,7 @@ static int el3_rx(struct net_device *dev)
|
||||
static void set_multicast_list(struct net_device *dev)
|
||||
{
|
||||
struct el3_private *lp = netdev_priv(dev);
|
||||
dev_link_t *link = &lp->link;
|
||||
dev_link_t *link = lp->p_dev;
|
||||
kio_addr_t ioaddr = dev->base_addr;
|
||||
u16 opts = SetRxFilter | RxStation | RxBroadcast;
|
||||
|
||||
@@ -950,7 +947,7 @@ static void set_multicast_list(struct net_device *dev)
|
||||
static int el3_close(struct net_device *dev)
|
||||
{
|
||||
struct el3_private *lp = netdev_priv(dev);
|
||||
dev_link_t *link = &lp->link;
|
||||
dev_link_t *link = lp->p_dev;
|
||||
kio_addr_t ioaddr = dev->base_addr;
|
||||
|
||||
DEBUG(1, "%s: shutting down ethercard.\n", dev->name);
|
||||
|
||||
@@ -117,7 +117,7 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id, struct pt_regs *regs);
|
||||
/*====================================================================*/
|
||||
|
||||
typedef struct axnet_dev_t {
|
||||
dev_link_t link;
|
||||
struct pcmcia_device *p_dev;
|
||||
dev_node_t node;
|
||||
caddr_t base;
|
||||
struct timer_list watchdog;
|
||||
@@ -145,8 +145,8 @@ static inline axnet_dev_t *PRIV(struct net_device *dev)
|
||||
static int axnet_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
axnet_dev_t *info;
|
||||
dev_link_t *link;
|
||||
struct net_device *dev;
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
|
||||
DEBUG(0, "axnet_attach()\n");
|
||||
|
||||
@@ -157,7 +157,7 @@ static int axnet_attach(struct pcmcia_device *p_dev)
|
||||
return -ENOMEM;
|
||||
|
||||
info = PRIV(dev);
|
||||
link = &info->link;
|
||||
info->p_dev = p_dev;
|
||||
link->priv = dev;
|
||||
link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
|
||||
link->irq.IRQInfo1 = IRQ_LEVEL_ID;
|
||||
@@ -169,9 +169,6 @@ static int axnet_attach(struct pcmcia_device *p_dev)
|
||||
dev->do_ioctl = &axnet_ioctl;
|
||||
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
|
||||
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
axnet_config(link);
|
||||
|
||||
@@ -194,7 +191,7 @@ static void axnet_detach(struct pcmcia_device *p_dev)
|
||||
|
||||
DEBUG(0, "axnet_detach(0x%p)\n", link);
|
||||
|
||||
if (link->dev)
|
||||
if (link->dev_node)
|
||||
unregister_netdev(dev);
|
||||
|
||||
if (link->state & DEV_CONFIG)
|
||||
@@ -409,13 +406,13 @@ static void axnet_config(dev_link_t *link)
|
||||
}
|
||||
|
||||
info->phy_id = (i < 32) ? i : -1;
|
||||
link->dev = &info->node;
|
||||
link->dev_node = &info->node;
|
||||
link->state &= ~DEV_CONFIG_PENDING;
|
||||
SET_NETDEV_DEV(dev, &handle_to_dev(handle));
|
||||
|
||||
if (register_netdev(dev) != 0) {
|
||||
printk(KERN_NOTICE "axnet_cs: register_netdev() failed\n");
|
||||
link->dev = NULL;
|
||||
link->dev_node = NULL;
|
||||
goto failed;
|
||||
}
|
||||
|
||||
@@ -543,7 +540,7 @@ static void mdio_write(kio_addr_t addr, int phy_id, int loc, int value)
|
||||
static int axnet_open(struct net_device *dev)
|
||||
{
|
||||
axnet_dev_t *info = PRIV(dev);
|
||||
dev_link_t *link = &info->link;
|
||||
dev_link_t *link = info->p_dev;
|
||||
|
||||
DEBUG(2, "axnet_open('%s')\n", dev->name);
|
||||
|
||||
@@ -569,7 +566,7 @@ static int axnet_open(struct net_device *dev)
|
||||
static int axnet_close(struct net_device *dev)
|
||||
{
|
||||
axnet_dev_t *info = PRIV(dev);
|
||||
dev_link_t *link = &info->link;
|
||||
dev_link_t *link = info->p_dev;
|
||||
|
||||
DEBUG(2, "axnet_close('%s')\n", dev->name);
|
||||
|
||||
|
||||
@@ -140,7 +140,6 @@ typedef struct com20020_dev_t {
|
||||
|
||||
static int com20020_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
dev_link_t *link;
|
||||
com20020_dev_t *info;
|
||||
struct net_device *dev;
|
||||
struct arcnet_local *lp;
|
||||
@@ -148,10 +147,6 @@ static int com20020_attach(struct pcmcia_device *p_dev)
|
||||
DEBUG(0, "com20020_attach()\n");
|
||||
|
||||
/* Create new network device */
|
||||
link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
|
||||
if (!link)
|
||||
return -ENOMEM;
|
||||
|
||||
info = kmalloc(sizeof(struct com20020_dev_t), GFP_KERNEL);
|
||||
if (!info)
|
||||
goto fail_alloc_info;
|
||||
@@ -161,7 +156,6 @@ static int com20020_attach(struct pcmcia_device *p_dev)
|
||||
goto fail_alloc_dev;
|
||||
|
||||
memset(info, 0, sizeof(struct com20020_dev_t));
|
||||
memset(link, 0, sizeof(struct dev_link_t));
|
||||
lp = dev->priv;
|
||||
lp->timeout = timeout;
|
||||
lp->backplane = backplane;
|
||||
@@ -172,27 +166,26 @@ static int com20020_attach(struct pcmcia_device *p_dev)
|
||||
/* fill in our module parameters as defaults */
|
||||
dev->dev_addr[0] = node;
|
||||
|
||||
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
|
||||
link->io.NumPorts1 = 16;
|
||||
link->io.IOAddrLines = 16;
|
||||
link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
|
||||
link->irq.IRQInfo1 = IRQ_LEVEL_ID;
|
||||
link->conf.Attributes = CONF_ENABLE_IRQ;
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
link->conf.Present = PRESENT_OPTION;
|
||||
p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
|
||||
p_dev->io.NumPorts1 = 16;
|
||||
p_dev->io.IOAddrLines = 16;
|
||||
p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
|
||||
p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID;
|
||||
p_dev->conf.Attributes = CONF_ENABLE_IRQ;
|
||||
p_dev->conf.IntType = INT_MEMORY_AND_IO;
|
||||
p_dev->conf.Present = PRESENT_OPTION;
|
||||
|
||||
link->irq.Instance = info->dev = dev;
|
||||
link->priv = info;
|
||||
p_dev->irq.Instance = info->dev = dev;
|
||||
p_dev->priv = info;
|
||||
|
||||
link->state |= DEV_PRESENT;
|
||||
com20020_config(link);
|
||||
p_dev->state |= DEV_PRESENT;
|
||||
com20020_config(p_dev);
|
||||
|
||||
return 0;
|
||||
|
||||
fail_alloc_dev:
|
||||
kfree(info);
|
||||
fail_alloc_info:
|
||||
kfree(link);
|
||||
return -ENOMEM;
|
||||
} /* com20020_attach */
|
||||
|
||||
@@ -215,7 +208,7 @@ static void com20020_detach(struct pcmcia_device *p_dev)
|
||||
|
||||
DEBUG(0, "com20020_detach(0x%p)\n", link);
|
||||
|
||||
if (link->dev) {
|
||||
if (link->dev_node) {
|
||||
DEBUG(1,"unregister...\n");
|
||||
|
||||
unregister_netdev(dev);
|
||||
@@ -244,8 +237,6 @@ static void com20020_detach(struct pcmcia_device *p_dev)
|
||||
DEBUG(1,"kfree2...\n");
|
||||
kfree(info);
|
||||
}
|
||||
DEBUG(1,"kfree3...\n");
|
||||
kfree(link);
|
||||
|
||||
} /* com20020_detach */
|
||||
|
||||
@@ -341,7 +332,7 @@ static void com20020_config(dev_link_t *link)
|
||||
lp->card_name = "PCMCIA COM20020";
|
||||
lp->card_flags = ARC_CAN_10MBIT; /* pretend all of them can 10Mbit */
|
||||
|
||||
link->dev = &info->node;
|
||||
link->dev_node = &info->node;
|
||||
link->state &= ~DEV_CONFIG_PENDING;
|
||||
SET_NETDEV_DEV(dev, &handle_to_dev(handle));
|
||||
|
||||
@@ -349,7 +340,7 @@ static void com20020_config(dev_link_t *link)
|
||||
|
||||
if (i != 0) {
|
||||
DEBUG(1,KERN_NOTICE "com20020_cs: com20020_found() failed\n");
|
||||
link->dev = NULL;
|
||||
link->dev_node = NULL;
|
||||
goto failed;
|
||||
}
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ typedef enum { MBH10302, MBH10304, TDK, CONTEC, LA501, UNGERMANN,
|
||||
driver specific data structure
|
||||
*/
|
||||
typedef struct local_info_t {
|
||||
dev_link_t link;
|
||||
struct pcmcia_device *p_dev;
|
||||
dev_node_t node;
|
||||
struct net_device_stats stats;
|
||||
long open_time;
|
||||
@@ -231,8 +231,8 @@ typedef struct local_info_t {
|
||||
static int fmvj18x_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
local_info_t *lp;
|
||||
dev_link_t *link;
|
||||
struct net_device *dev;
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
|
||||
DEBUG(0, "fmvj18x_attach()\n");
|
||||
|
||||
@@ -241,8 +241,8 @@ static int fmvj18x_attach(struct pcmcia_device *p_dev)
|
||||
if (!dev)
|
||||
return -ENOMEM;
|
||||
lp = netdev_priv(dev);
|
||||
link = &lp->link;
|
||||
link->priv = dev;
|
||||
lp->p_dev = p_dev;
|
||||
|
||||
/* The io structure describes IO port mapping */
|
||||
link->io.NumPorts1 = 32;
|
||||
@@ -273,9 +273,6 @@ static int fmvj18x_attach(struct pcmcia_device *p_dev)
|
||||
#endif
|
||||
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
|
||||
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
fmvj18x_config(link);
|
||||
|
||||
@@ -291,7 +288,7 @@ static void fmvj18x_detach(struct pcmcia_device *p_dev)
|
||||
|
||||
DEBUG(0, "fmvj18x_detach(0x%p)\n", link);
|
||||
|
||||
if (link->dev)
|
||||
if (link->dev_node)
|
||||
unregister_netdev(dev);
|
||||
|
||||
if (link->state & DEV_CONFIG)
|
||||
@@ -539,13 +536,13 @@ static void fmvj18x_config(dev_link_t *link)
|
||||
}
|
||||
|
||||
lp->cardtype = cardtype;
|
||||
link->dev = &lp->node;
|
||||
link->dev_node = &lp->node;
|
||||
link->state &= ~DEV_CONFIG_PENDING;
|
||||
SET_NETDEV_DEV(dev, &handle_to_dev(handle));
|
||||
|
||||
if (register_netdev(dev) != 0) {
|
||||
printk(KERN_NOTICE "fmvj18x_cs: register_netdev() failed\n");
|
||||
link->dev = NULL;
|
||||
link->dev_node = NULL;
|
||||
goto failed;
|
||||
}
|
||||
|
||||
@@ -1125,7 +1122,7 @@ static int fjn_config(struct net_device *dev, struct ifmap *map){
|
||||
static int fjn_open(struct net_device *dev)
|
||||
{
|
||||
struct local_info_t *lp = netdev_priv(dev);
|
||||
dev_link_t *link = &lp->link;
|
||||
dev_link_t *link = lp->p_dev;
|
||||
|
||||
DEBUG(4, "fjn_open('%s').\n", dev->name);
|
||||
|
||||
@@ -1150,7 +1147,7 @@ static int fjn_open(struct net_device *dev)
|
||||
static int fjn_close(struct net_device *dev)
|
||||
{
|
||||
struct local_info_t *lp = netdev_priv(dev);
|
||||
dev_link_t *link = &lp->link;
|
||||
dev_link_t *link = lp->p_dev;
|
||||
kio_addr_t ioaddr = dev->base_addr;
|
||||
|
||||
DEBUG(4, "fjn_close('%s').\n", dev->name);
|
||||
|
||||
@@ -113,7 +113,7 @@ static void ibmtr_detach(struct pcmcia_device *p_dev);
|
||||
/*====================================================================*/
|
||||
|
||||
typedef struct ibmtr_dev_t {
|
||||
dev_link_t link;
|
||||
struct pcmcia_device *p_dev;
|
||||
struct net_device *dev;
|
||||
dev_node_t node;
|
||||
window_handle_t sram_win_handle;
|
||||
@@ -141,8 +141,8 @@ static struct ethtool_ops netdev_ethtool_ops = {
|
||||
static int ibmtr_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
ibmtr_dev_t *info;
|
||||
dev_link_t *link;
|
||||
struct net_device *dev;
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
|
||||
DEBUG(0, "ibmtr_attach()\n");
|
||||
|
||||
@@ -156,7 +156,7 @@ static int ibmtr_attach(struct pcmcia_device *p_dev)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
link = &info->link;
|
||||
info->p_dev = p_dev;
|
||||
link->priv = info;
|
||||
info->ti = netdev_priv(dev);
|
||||
|
||||
@@ -171,11 +171,8 @@ static int ibmtr_attach(struct pcmcia_device *p_dev)
|
||||
link->conf.Present = PRESENT_OPTION;
|
||||
|
||||
link->irq.Instance = info->dev = dev;
|
||||
|
||||
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
|
||||
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
|
||||
|
||||
link->state |= DEV_PRESENT;
|
||||
ibmtr_config(link);
|
||||
@@ -200,7 +197,7 @@ static void ibmtr_detach(struct pcmcia_device *p_dev)
|
||||
|
||||
DEBUG(0, "ibmtr_detach(0x%p)\n", link);
|
||||
|
||||
if (link->dev)
|
||||
if (link->dev_node)
|
||||
unregister_netdev(dev);
|
||||
|
||||
{
|
||||
@@ -308,14 +305,14 @@ static void ibmtr_config(dev_link_t *link)
|
||||
Adapters Technical Reference" SC30-3585 for this info. */
|
||||
ibmtr_hw_setup(dev, mmiobase);
|
||||
|
||||
link->dev = &info->node;
|
||||
link->dev_node = &info->node;
|
||||
link->state &= ~DEV_CONFIG_PENDING;
|
||||
SET_NETDEV_DEV(dev, &handle_to_dev(handle));
|
||||
|
||||
i = ibmtr_probe_card(dev);
|
||||
if (i != 0) {
|
||||
printk(KERN_NOTICE "ibmtr_cs: register_netdev() failed\n");
|
||||
link->dev = NULL;
|
||||
link->dev_node = NULL;
|
||||
goto failed;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user