[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>
Šī revīzija ir iekļauta:
@@ -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;
|
||||
|
Atsaukties uz šo jaunā problēmā
Block a user