Skip to content

Commit

Permalink
[PATCH] pcmcia: embed dev_link_t into struct pcmcia_device
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dominik Brodowski committed Mar 31, 2006
1 parent a78f4dd commit fd23823
Show file tree
Hide file tree
Showing 52 changed files with 446 additions and 729 deletions.
31 changes: 14 additions & 17 deletions drivers/bluetooth/bluecard_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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))) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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));

Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -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);

Expand Down Expand Up @@ -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;
Expand Down
26 changes: 10 additions & 16 deletions drivers/bluetooth/bt3c_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;


Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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));

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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);

Expand Down Expand Up @@ -815,7 +809,7 @@ static void bt3c_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;
Expand Down
25 changes: 11 additions & 14 deletions drivers/bluetooth/btuart_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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))))
Expand Down Expand Up @@ -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++;
Expand Down Expand Up @@ -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));

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -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);

Expand Down Expand Up @@ -744,7 +741,7 @@ static void btuart_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;
Expand Down
Loading

0 comments on commit fd23823

Please sign in to comment.