diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-05 04:45:09 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 10:15:57 -0500 |
commit | fd238232cd0ff4840ae6946bb338502154096d88 (patch) | |
tree | d20e8f5871f7cff9d0867a84f6ba088fbffcbe28 /drivers/char/pcmcia/cm4040_cs.c | |
parent | a78f4dd331a4f6a396eb5849656a4a72a70a56d7 (diff) |
[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>
Diffstat (limited to 'drivers/char/pcmcia/cm4040_cs.c')
-rw-r--r-- | drivers/char/pcmcia/cm4040_cs.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index 94ecd0342b72..97e32e7f84dc 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c | |||
@@ -41,7 +41,7 @@ | |||
41 | 41 | ||
42 | 42 | ||
43 | #ifdef PCMCIA_DEBUG | 43 | #ifdef PCMCIA_DEBUG |
44 | #define reader_to_dev(x) (&handle_to_dev(x->link.handle)) | 44 | #define reader_to_dev(x) (&handle_to_dev(x->p_dev->handle)) |
45 | static int pc_debug = PCMCIA_DEBUG; | 45 | static int pc_debug = PCMCIA_DEBUG; |
46 | module_param(pc_debug, int, 0600); | 46 | module_param(pc_debug, int, 0600); |
47 | #define DEBUGP(n, rdr, x, args...) do { \ | 47 | #define DEBUGP(n, rdr, x, args...) do { \ |
@@ -74,7 +74,7 @@ static struct class *cmx_class; | |||
74 | #define BS_WRITABLE 0x02 | 74 | #define BS_WRITABLE 0x02 |
75 | 75 | ||
76 | struct reader_dev { | 76 | struct reader_dev { |
77 | dev_link_t link; | 77 | struct pcmcia_device *p_dev; |
78 | dev_node_t node; | 78 | dev_node_t node; |
79 | wait_queue_head_t devq; | 79 | wait_queue_head_t devq; |
80 | wait_queue_head_t poll_wait; | 80 | wait_queue_head_t poll_wait; |
@@ -116,7 +116,7 @@ static inline unsigned char xinb(unsigned short port) | |||
116 | static void cm4040_do_poll(unsigned long dummy) | 116 | static void cm4040_do_poll(unsigned long dummy) |
117 | { | 117 | { |
118 | struct reader_dev *dev = (struct reader_dev *) dummy; | 118 | struct reader_dev *dev = (struct reader_dev *) dummy; |
119 | unsigned int obs = xinb(dev->link.io.BasePort1 | 119 | unsigned int obs = xinb(dev->p_dev->io.BasePort1 |
120 | + REG_OFFSET_BUFFER_STATUS); | 120 | + REG_OFFSET_BUFFER_STATUS); |
121 | 121 | ||
122 | if ((obs & BSR_BULK_IN_FULL)) { | 122 | if ((obs & BSR_BULK_IN_FULL)) { |
@@ -147,7 +147,7 @@ static void cm4040_stop_poll(struct reader_dev *dev) | |||
147 | static int wait_for_bulk_out_ready(struct reader_dev *dev) | 147 | static int wait_for_bulk_out_ready(struct reader_dev *dev) |
148 | { | 148 | { |
149 | int i, rc; | 149 | int i, rc; |
150 | int iobase = dev->link.io.BasePort1; | 150 | int iobase = dev->p_dev->io.BasePort1; |
151 | 151 | ||
152 | for (i = 0; i < POLL_LOOP_COUNT; i++) { | 152 | for (i = 0; i < POLL_LOOP_COUNT; i++) { |
153 | if ((xinb(iobase + REG_OFFSET_BUFFER_STATUS) | 153 | if ((xinb(iobase + REG_OFFSET_BUFFER_STATUS) |
@@ -177,7 +177,7 @@ static int wait_for_bulk_out_ready(struct reader_dev *dev) | |||
177 | /* Write to Sync Control Register */ | 177 | /* Write to Sync Control Register */ |
178 | static int write_sync_reg(unsigned char val, struct reader_dev *dev) | 178 | static int write_sync_reg(unsigned char val, struct reader_dev *dev) |
179 | { | 179 | { |
180 | int iobase = dev->link.io.BasePort1; | 180 | int iobase = dev->p_dev->io.BasePort1; |
181 | int rc; | 181 | int rc; |
182 | 182 | ||
183 | rc = wait_for_bulk_out_ready(dev); | 183 | rc = wait_for_bulk_out_ready(dev); |
@@ -195,7 +195,7 @@ static int write_sync_reg(unsigned char val, struct reader_dev *dev) | |||
195 | static int wait_for_bulk_in_ready(struct reader_dev *dev) | 195 | static int wait_for_bulk_in_ready(struct reader_dev *dev) |
196 | { | 196 | { |
197 | int i, rc; | 197 | int i, rc; |
198 | int iobase = dev->link.io.BasePort1; | 198 | int iobase = dev->p_dev->io.BasePort1; |
199 | 199 | ||
200 | for (i = 0; i < POLL_LOOP_COUNT; i++) { | 200 | for (i = 0; i < POLL_LOOP_COUNT; i++) { |
201 | if ((xinb(iobase + REG_OFFSET_BUFFER_STATUS) | 201 | if ((xinb(iobase + REG_OFFSET_BUFFER_STATUS) |
@@ -225,7 +225,7 @@ static ssize_t cm4040_read(struct file *filp, char __user *buf, | |||
225 | size_t count, loff_t *ppos) | 225 | size_t count, loff_t *ppos) |
226 | { | 226 | { |
227 | struct reader_dev *dev = filp->private_data; | 227 | struct reader_dev *dev = filp->private_data; |
228 | int iobase = dev->link.io.BasePort1; | 228 | int iobase = dev->p_dev->io.BasePort1; |
229 | size_t bytes_to_read; | 229 | size_t bytes_to_read; |
230 | unsigned long i; | 230 | unsigned long i; |
231 | size_t min_bytes_to_read; | 231 | size_t min_bytes_to_read; |
@@ -246,7 +246,7 @@ static ssize_t cm4040_read(struct file *filp, char __user *buf, | |||
246 | return -EAGAIN; | 246 | return -EAGAIN; |
247 | } | 247 | } |
248 | 248 | ||
249 | if ((dev->link.state & DEV_PRESENT)==0) | 249 | if ((dev->p_dev->state & DEV_PRESENT)==0) |
250 | return -ENODEV; | 250 | return -ENODEV; |
251 | 251 | ||
252 | for (i = 0; i < 5; i++) { | 252 | for (i = 0; i < 5; i++) { |
@@ -328,7 +328,7 @@ static ssize_t cm4040_write(struct file *filp, const char __user *buf, | |||
328 | size_t count, loff_t *ppos) | 328 | size_t count, loff_t *ppos) |
329 | { | 329 | { |
330 | struct reader_dev *dev = filp->private_data; | 330 | struct reader_dev *dev = filp->private_data; |
331 | int iobase = dev->link.io.BasePort1; | 331 | int iobase = dev->p_dev->io.BasePort1; |
332 | ssize_t rc; | 332 | ssize_t rc; |
333 | int i; | 333 | int i; |
334 | unsigned int bytes_to_write; | 334 | unsigned int bytes_to_write; |
@@ -351,7 +351,7 @@ static ssize_t cm4040_write(struct file *filp, const char __user *buf, | |||
351 | return -EAGAIN; | 351 | return -EAGAIN; |
352 | } | 352 | } |
353 | 353 | ||
354 | if ((dev->link.state & DEV_PRESENT) == 0) | 354 | if ((dev->p_dev->state & DEV_PRESENT) == 0) |
355 | return -ENODEV; | 355 | return -ENODEV; |
356 | 356 | ||
357 | bytes_to_write = count; | 357 | bytes_to_write = count; |
@@ -606,7 +606,7 @@ static void reader_config(dev_link_t *link, int devno) | |||
606 | dev->node.major = major; | 606 | dev->node.major = major; |
607 | dev->node.minor = devno; | 607 | dev->node.minor = devno; |
608 | dev->node.next = NULL; | 608 | dev->node.next = NULL; |
609 | link->dev = &dev->node; | 609 | link->dev_node = &dev->node; |
610 | link->state &= ~DEV_CONFIG_PENDING; | 610 | link->state &= ~DEV_CONFIG_PENDING; |
611 | 611 | ||
612 | DEBUGP(2, dev, "device " DEVICE_NAME "%d at 0x%.4x-0x%.4x\n", devno, | 612 | 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) | |||
631 | static int reader_attach(struct pcmcia_device *p_dev) | 631 | static int reader_attach(struct pcmcia_device *p_dev) |
632 | { | 632 | { |
633 | struct reader_dev *dev; | 633 | struct reader_dev *dev; |
634 | dev_link_t *link; | ||
635 | int i; | 634 | int i; |
635 | dev_link_t *link = dev_to_instance(p_dev); | ||
636 | 636 | ||
637 | for (i = 0; i < CM_MAX_DEV; i++) { | 637 | for (i = 0; i < CM_MAX_DEV; i++) { |
638 | if (dev_table[i] == NULL) | 638 | if (dev_table[i] == NULL) |
@@ -649,8 +649,8 @@ static int reader_attach(struct pcmcia_device *p_dev) | |||
649 | dev->timeout = CCID_DRIVER_MINIMUM_TIMEOUT; | 649 | dev->timeout = CCID_DRIVER_MINIMUM_TIMEOUT; |
650 | dev->buffer_status = 0; | 650 | dev->buffer_status = 0; |
651 | 651 | ||
652 | link = &dev->link; | ||
653 | link->priv = dev; | 652 | link->priv = dev; |
653 | dev->p_dev = p_dev; | ||
654 | 654 | ||
655 | link->conf.IntType = INT_MEMORY_AND_IO; | 655 | link->conf.IntType = INT_MEMORY_AND_IO; |
656 | dev_table[i] = link; | 656 | dev_table[i] = link; |
@@ -662,9 +662,6 @@ static int reader_attach(struct pcmcia_device *p_dev) | |||
662 | init_timer(&dev->poll_timer); | 662 | init_timer(&dev->poll_timer); |
663 | dev->poll_timer.function = &cm4040_do_poll; | 663 | dev->poll_timer.function = &cm4040_do_poll; |
664 | 664 | ||
665 | link->handle = p_dev; | ||
666 | p_dev->instance = link; | ||
667 | |||
668 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 665 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
669 | reader_config(link, i); | 666 | reader_config(link, i); |
670 | 667 | ||