Skip to content

Commit fd23823

Browse files
author
Dominik Brodowski
committed
[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 <[email protected]>
1 parent a78f4dd commit fd23823

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+446
-729
lines changed

drivers/bluetooth/bluecard_cs.c

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ MODULE_LICENSE("GPL");
6565

6666

6767
typedef struct bluecard_info_t {
68-
dev_link_t link;
68+
struct pcmcia_device *p_dev;
6969
dev_node_t node;
7070

7171
struct hci_dev *hdev;
@@ -162,7 +162,7 @@ static void bluecard_detach(struct pcmcia_device *p_dev);
162162
static void bluecard_activity_led_timeout(u_long arg)
163163
{
164164
bluecard_info_t *info = (bluecard_info_t *)arg;
165-
unsigned int iobase = info->link.io.BasePort1;
165+
unsigned int iobase = info->p_dev->io.BasePort1;
166166

167167
if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
168168
return;
@@ -179,7 +179,7 @@ static void bluecard_activity_led_timeout(u_long arg)
179179

180180
static void bluecard_enable_activity_led(bluecard_info_t *info)
181181
{
182-
unsigned int iobase = info->link.io.BasePort1;
182+
unsigned int iobase = info->p_dev->io.BasePort1;
183183

184184
if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
185185
return;
@@ -235,7 +235,7 @@ static void bluecard_write_wakeup(bluecard_info_t *info)
235235
}
236236

237237
do {
238-
register unsigned int iobase = info->link.io.BasePort1;
238+
register unsigned int iobase = info->p_dev->io.BasePort1;
239239
register unsigned int offset;
240240
register unsigned char command;
241241
register unsigned long ready_bit;
@@ -244,7 +244,7 @@ static void bluecard_write_wakeup(bluecard_info_t *info)
244244

245245
clear_bit(XMIT_WAKEUP, &(info->tx_state));
246246

247-
if (!(info->link.state & DEV_PRESENT))
247+
if (!(info->p_dev->state & DEV_PRESENT))
248248
return;
249249

250250
if (test_bit(XMIT_BUFFER_NUMBER, &(info->tx_state))) {
@@ -382,7 +382,7 @@ static void bluecard_receive(bluecard_info_t *info, unsigned int offset)
382382
return;
383383
}
384384

385-
iobase = info->link.io.BasePort1;
385+
iobase = info->p_dev->io.BasePort1;
386386

387387
if (test_bit(XMIT_SENDING_READY, &(info->tx_state)))
388388
bluecard_enable_activity_led(info);
@@ -512,7 +512,7 @@ static irqreturn_t bluecard_interrupt(int irq, void *dev_inst, struct pt_regs *r
512512
if (!test_bit(CARD_READY, &(info->hw_state)))
513513
return IRQ_HANDLED;
514514

515-
iobase = info->link.io.BasePort1;
515+
iobase = info->p_dev->io.BasePort1;
516516

517517
spin_lock(&(info->lock));
518518

@@ -626,7 +626,7 @@ static int bluecard_hci_flush(struct hci_dev *hdev)
626626
static int bluecard_hci_open(struct hci_dev *hdev)
627627
{
628628
bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data);
629-
unsigned int iobase = info->link.io.BasePort1;
629+
unsigned int iobase = info->p_dev->io.BasePort1;
630630

631631
if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
632632
bluecard_hci_set_baud_rate(hdev, DEFAULT_BAUD_RATE);
@@ -646,7 +646,7 @@ static int bluecard_hci_open(struct hci_dev *hdev)
646646
static int bluecard_hci_close(struct hci_dev *hdev)
647647
{
648648
bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data);
649-
unsigned int iobase = info->link.io.BasePort1;
649+
unsigned int iobase = info->p_dev->io.BasePort1;
650650

651651
if (!test_and_clear_bit(HCI_RUNNING, &(hdev->flags)))
652652
return 0;
@@ -713,7 +713,7 @@ static int bluecard_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned l
713713

714714
static int bluecard_open(bluecard_info_t *info)
715715
{
716-
unsigned int iobase = info->link.io.BasePort1;
716+
unsigned int iobase = info->p_dev->io.BasePort1;
717717
struct hci_dev *hdev;
718718
unsigned char id;
719719

@@ -831,7 +831,7 @@ static int bluecard_open(bluecard_info_t *info)
831831

832832
static int bluecard_close(bluecard_info_t *info)
833833
{
834-
unsigned int iobase = info->link.io.BasePort1;
834+
unsigned int iobase = info->p_dev->io.BasePort1;
835835
struct hci_dev *hdev = info->hdev;
836836

837837
if (!hdev)
@@ -859,14 +859,14 @@ static int bluecard_close(bluecard_info_t *info)
859859
static int bluecard_attach(struct pcmcia_device *p_dev)
860860
{
861861
bluecard_info_t *info;
862-
dev_link_t *link;
862+
dev_link_t *link = dev_to_instance(p_dev);
863863

864864
/* Create new info device */
865865
info = kzalloc(sizeof(*info), GFP_KERNEL);
866866
if (!info)
867867
return -ENOMEM;
868868

869-
link = &info->link;
869+
info->p_dev = p_dev;
870870
link->priv = info;
871871

872872
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
@@ -880,9 +880,6 @@ static int bluecard_attach(struct pcmcia_device *p_dev)
880880
link->conf.Attributes = CONF_ENABLE_IRQ;
881881
link->conf.IntType = INT_MEMORY_AND_IO;
882882

883-
link->handle = p_dev;
884-
p_dev->instance = link;
885-
886883
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
887884
bluecard_config(link);
888885

@@ -976,7 +973,7 @@ static void bluecard_config(dev_link_t *link)
976973
goto failed;
977974

978975
strcpy(info->node.dev_name, info->hdev->name);
979-
link->dev = &info->node;
976+
link->dev_node = &info->node;
980977
link->state &= ~DEV_CONFIG_PENDING;
981978

982979
return;

drivers/bluetooth/bt3c_cs.c

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ MODULE_LICENSE("GPL");
7272

7373

7474
typedef struct bt3c_info_t {
75-
dev_link_t link;
75+
struct pcmcia_device *p_dev;
7676
dev_node_t node;
7777

7878
struct hci_dev *hdev;
@@ -191,11 +191,11 @@ static void bt3c_write_wakeup(bt3c_info_t *info)
191191
return;
192192

193193
do {
194-
register unsigned int iobase = info->link.io.BasePort1;
194+
register unsigned int iobase = info->p_dev->io.BasePort1;
195195
register struct sk_buff *skb;
196196
register int len;
197197

198-
if (!(info->link.state & DEV_PRESENT))
198+
if (!(info->p_dev->state & DEV_PRESENT))
199199
break;
200200

201201

@@ -229,7 +229,7 @@ static void bt3c_receive(bt3c_info_t *info)
229229
return;
230230
}
231231

232-
iobase = info->link.io.BasePort1;
232+
iobase = info->p_dev->io.BasePort1;
233233

234234
avail = bt3c_read(iobase, 0x7006);
235235
//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)
350350
return IRQ_NONE;
351351
}
352352

353-
iobase = info->link.io.BasePort1;
353+
iobase = info->p_dev->io.BasePort1;
354354

355355
spin_lock(&(info->lock));
356356

@@ -481,7 +481,7 @@ static int bt3c_load_firmware(bt3c_info_t *info, unsigned char *firmware, int co
481481
unsigned int iobase, size, addr, fcs, tmp;
482482
int i, err = 0;
483483

484-
iobase = info->link.io.BasePort1;
484+
iobase = info->p_dev->io.BasePort1;
485485

486486
/* Reset */
487487
bt3c_io_write(iobase, 0x8040, 0x0404);
@@ -562,7 +562,6 @@ static int bt3c_open(bt3c_info_t *info)
562562
{
563563
const struct firmware *firmware;
564564
struct hci_dev *hdev;
565-
client_handle_t handle;
566565
int err;
567566

568567
spin_lock_init(&(info->lock));
@@ -594,10 +593,8 @@ static int bt3c_open(bt3c_info_t *info)
594593

595594
hdev->owner = THIS_MODULE;
596595

597-
handle = info->link.handle;
598-
599596
/* Load firmware */
600-
err = request_firmware(&firmware, "BT3CPCC.bin", &handle_to_dev(handle));
597+
err = request_firmware(&firmware, "BT3CPCC.bin", &info->p_dev->dev);
601598
if (err < 0) {
602599
BT_ERR("Firmware request failed");
603600
goto error;
@@ -651,14 +648,14 @@ static int bt3c_close(bt3c_info_t *info)
651648
static int bt3c_attach(struct pcmcia_device *p_dev)
652649
{
653650
bt3c_info_t *info;
654-
dev_link_t *link;
651+
dev_link_t *link = dev_to_instance(p_dev);
655652

656653
/* Create new info device */
657654
info = kzalloc(sizeof(*info), GFP_KERNEL);
658655
if (!info)
659656
return -ENOMEM;
660657

661-
link = &info->link;
658+
info->p_dev = p_dev;
662659
link->priv = info;
663660

664661
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
@@ -672,9 +669,6 @@ static int bt3c_attach(struct pcmcia_device *p_dev)
672669
link->conf.Attributes = CONF_ENABLE_IRQ;
673670
link->conf.IntType = INT_MEMORY_AND_IO;
674671

675-
link->handle = p_dev;
676-
p_dev->instance = link;
677-
678672
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
679673
bt3c_config(link);
680674

@@ -815,7 +809,7 @@ static void bt3c_config(dev_link_t *link)
815809
goto failed;
816810

817811
strcpy(info->node.dev_name, info->hdev->name);
818-
link->dev = &info->node;
812+
link->dev_node = &info->node;
819813
link->state &= ~DEV_CONFIG_PENDING;
820814

821815
return;

drivers/bluetooth/btuart_cs.c

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ MODULE_LICENSE("GPL");
6868

6969

7070
typedef struct btuart_info_t {
71-
dev_link_t link;
71+
struct pcmcia_device *p_dev;
7272
dev_node_t node;
7373

7474
struct hci_dev *hdev;
@@ -146,13 +146,13 @@ static void btuart_write_wakeup(btuart_info_t *info)
146146
}
147147

148148
do {
149-
register unsigned int iobase = info->link.io.BasePort1;
149+
register unsigned int iobase = info->p_dev->io.BasePort1;
150150
register struct sk_buff *skb;
151151
register int len;
152152

153153
clear_bit(XMIT_WAKEUP, &(info->tx_state));
154154

155-
if (!(info->link.state & DEV_PRESENT))
155+
if (!(info->p_dev->state & DEV_PRESENT))
156156
return;
157157

158158
if (!(skb = skb_dequeue(&(info->txq))))
@@ -187,7 +187,7 @@ static void btuart_receive(btuart_info_t *info)
187187
return;
188188
}
189189

190-
iobase = info->link.io.BasePort1;
190+
iobase = info->p_dev->io.BasePort1;
191191

192192
do {
193193
info->hdev->stat.byte_rx++;
@@ -301,7 +301,7 @@ static irqreturn_t btuart_interrupt(int irq, void *dev_inst, struct pt_regs *reg
301301
return IRQ_NONE;
302302
}
303303

304-
iobase = info->link.io.BasePort1;
304+
iobase = info->p_dev->io.BasePort1;
305305

306306
spin_lock(&(info->lock));
307307

@@ -357,7 +357,7 @@ static void btuart_change_speed(btuart_info_t *info, unsigned int speed)
357357
return;
358358
}
359359

360-
iobase = info->link.io.BasePort1;
360+
iobase = info->p_dev->io.BasePort1;
361361

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

@@ -481,7 +481,7 @@ static int btuart_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned lon
481481
static int btuart_open(btuart_info_t *info)
482482
{
483483
unsigned long flags;
484-
unsigned int iobase = info->link.io.BasePort1;
484+
unsigned int iobase = info->p_dev->io.BasePort1;
485485
struct hci_dev *hdev;
486486

487487
spin_lock_init(&(info->lock));
@@ -550,7 +550,7 @@ static int btuart_open(btuart_info_t *info)
550550
static int btuart_close(btuart_info_t *info)
551551
{
552552
unsigned long flags;
553-
unsigned int iobase = info->link.io.BasePort1;
553+
unsigned int iobase = info->p_dev->io.BasePort1;
554554
struct hci_dev *hdev = info->hdev;
555555

556556
if (!hdev)
@@ -579,14 +579,14 @@ static int btuart_close(btuart_info_t *info)
579579
static int btuart_attach(struct pcmcia_device *p_dev)
580580
{
581581
btuart_info_t *info;
582-
dev_link_t *link;
582+
dev_link_t *link = dev_to_instance(p_dev);
583583

584584
/* Create new info device */
585585
info = kzalloc(sizeof(*info), GFP_KERNEL);
586586
if (!info)
587587
return -ENOMEM;
588588

589-
link = &info->link;
589+
info->p_dev = p_dev;
590590
link->priv = info;
591591

592592
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
@@ -600,9 +600,6 @@ static int btuart_attach(struct pcmcia_device *p_dev)
600600
link->conf.Attributes = CONF_ENABLE_IRQ;
601601
link->conf.IntType = INT_MEMORY_AND_IO;
602602

603-
link->handle = p_dev;
604-
p_dev->instance = link;
605-
606603
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
607604
btuart_config(link);
608605

@@ -744,7 +741,7 @@ static void btuart_config(dev_link_t *link)
744741
goto failed;
745742

746743
strcpy(info->node.dev_name, info->hdev->name);
747-
link->dev = &info->node;
744+
link->dev_node = &info->node;
748745
link->state &= ~DEV_CONFIG_PENDING;
749746

750747
return;

0 commit comments

Comments
 (0)