aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-06-27 19:28:50 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-27 21:03:19 -0400
commitb5e43913cfe95a18ad8929585a0bb58e46cf3390 (patch)
tree2dbdcf979e3a300141c1ffdaf96e03127675cb1e
parent90c6cdd1fa8dd4d69af792541a37b38576aa9b5a (diff)
[PATCH] pcmcia: make PCMCIA status a bitfield
make pcmcia_bus_socket->state a bitfield, and rename it pcmcia_state to prepare for struct pcmcia_bus_socket integration into struct pcmcia_socket. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/pcmcia/ds.c12
-rw-r--r--drivers/pcmcia/ds_internal.h14
-rw-r--r--drivers/pcmcia/pcmcia_ioctl.c12
3 files changed, 20 insertions, 18 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 54068f451ee6..85e2cb2b9e91 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -622,14 +622,14 @@ static void pcmcia_delayed_add_pseudo_device(void *data)
622{ 622{
623 struct pcmcia_bus_socket *s = data; 623 struct pcmcia_bus_socket *s = data;
624 pcmcia_device_add(s, 0); 624 pcmcia_device_add(s, 0);
625 s->device_add_pending = 0; 625 s->pcmcia_state.device_add_pending = 0;
626} 626}
627 627
628static inline void pcmcia_add_pseudo_device(struct pcmcia_bus_socket *s) 628static inline void pcmcia_add_pseudo_device(struct pcmcia_bus_socket *s)
629{ 629{
630 if (!s->device_add_pending) { 630 if (!s->pcmcia_state.device_add_pending) {
631 schedule_work(&s->device_add); 631 schedule_work(&s->device_add);
632 s->device_add_pending = 1; 632 s->pcmcia_state.device_add_pending = 1;
633 } 633 }
634 return; 634 return;
635} 635}
@@ -981,14 +981,14 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
981 switch (event) { 981 switch (event) {
982 982
983 case CS_EVENT_CARD_REMOVAL: 983 case CS_EVENT_CARD_REMOVAL:
984 s->state &= ~DS_SOCKET_PRESENT; 984 s->pcmcia_state.present = 0;
985 send_event(skt, event, priority); 985 send_event(skt, event, priority);
986 unbind_request(s); 986 unbind_request(s);
987 handle_event(s, event); 987 handle_event(s, event);
988 break; 988 break;
989 989
990 case CS_EVENT_CARD_INSERTION: 990 case CS_EVENT_CARD_INSERTION:
991 s->state |= DS_SOCKET_PRESENT; 991 s->pcmcia_state.present = 1;
992 pcmcia_card_add(skt); 992 pcmcia_card_add(skt);
993 handle_event(s, event); 993 handle_event(s, event);
994 break; 994 break;
@@ -1229,7 +1229,7 @@ static void pcmcia_bus_remove_socket(struct class_device *class_dev)
1229 1229
1230 pccard_register_pcmcia(socket, NULL); 1230 pccard_register_pcmcia(socket, NULL);
1231 1231
1232 socket->pcmcia->state |= DS_SOCKET_DEAD; 1232 socket->pcmcia->pcmcia_state.dead = 1;
1233 pcmcia_put_bus_socket(socket->pcmcia); 1233 pcmcia_put_bus_socket(socket->pcmcia);
1234 socket->pcmcia = NULL; 1234 socket->pcmcia = NULL;
1235 1235
diff --git a/drivers/pcmcia/ds_internal.h b/drivers/pcmcia/ds_internal.h
index b05bc39d9cd6..2c3bb189dec6 100644
--- a/drivers/pcmcia/ds_internal.h
+++ b/drivers/pcmcia/ds_internal.h
@@ -5,7 +5,6 @@ struct user_info_t;
5/* Socket state information */ 5/* Socket state information */
6struct pcmcia_bus_socket { 6struct pcmcia_bus_socket {
7 struct kref refcount; 7 struct kref refcount;
8 int state;
9 struct pcmcia_socket *parent; 8 struct pcmcia_socket *parent;
10 9
11 /* the PCMCIA devices connected to this socket (normally one, more 10 /* the PCMCIA devices connected to this socket (normally one, more
@@ -15,7 +14,14 @@ struct pcmcia_bus_socket {
15 * only internally and subject 14 * only internally and subject
16 * to incorrectness and change */ 15 * to incorrectness and change */
17 16
18 u8 device_add_pending; 17 struct {
18 u8 present:1,
19 busy:1,
20 dead:1,
21 device_add_pending:1,
22 reserved:4;
23 } pcmcia_state;
24
19 struct work_struct device_add; 25 struct work_struct device_add;
20 26
21 27
@@ -29,10 +35,6 @@ extern spinlock_t pcmcia_dev_list_lock;
29extern struct bus_type pcmcia_bus_type; 35extern struct bus_type pcmcia_bus_type;
30 36
31 37
32#define DS_SOCKET_PRESENT 0x01
33#define DS_SOCKET_BUSY 0x02
34#define DS_SOCKET_DEAD 0x80
35
36extern struct pcmcia_device * pcmcia_get_dev(struct pcmcia_device *p_dev); 38extern struct pcmcia_device * pcmcia_get_dev(struct pcmcia_device *p_dev);
37extern void pcmcia_put_dev(struct pcmcia_device *p_dev); 39extern void pcmcia_put_dev(struct pcmcia_device *p_dev);
38 40
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index e8d2c95db1c9..b223f5235de7 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -404,12 +404,12 @@ static int ds_open(struct inode *inode, struct file *file)
404 return -ENODEV; 404 return -ENODEV;
405 405
406 if ((file->f_flags & O_ACCMODE) != O_RDONLY) { 406 if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
407 if (s->state & DS_SOCKET_BUSY) { 407 if (s->pcmcia_state.busy) {
408 pcmcia_put_bus_socket(s); 408 pcmcia_put_bus_socket(s);
409 return -EBUSY; 409 return -EBUSY;
410 } 410 }
411 else 411 else
412 s->state |= DS_SOCKET_BUSY; 412 s->pcmcia_state.busy = 1;
413 } 413 }
414 414
415 user = kmalloc(sizeof(user_info_t), GFP_KERNEL); 415 user = kmalloc(sizeof(user_info_t), GFP_KERNEL);
@@ -424,7 +424,7 @@ static int ds_open(struct inode *inode, struct file *file)
424 s->user = user; 424 s->user = user;
425 file->private_data = user; 425 file->private_data = user;
426 426
427 if (s->state & DS_SOCKET_PRESENT) 427 if (s->pcmcia_state.present)
428 queue_event(user, CS_EVENT_CARD_INSERTION); 428 queue_event(user, CS_EVENT_CARD_INSERTION);
429 return 0; 429 return 0;
430} /* ds_open */ 430} /* ds_open */
@@ -446,7 +446,7 @@ static int ds_release(struct inode *inode, struct file *file)
446 446
447 /* Unlink user data structure */ 447 /* Unlink user data structure */
448 if ((file->f_flags & O_ACCMODE) != O_RDONLY) { 448 if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
449 s->state &= ~DS_SOCKET_BUSY; 449 s->pcmcia_state.busy = 0;
450 } 450 }
451 file->private_data = NULL; 451 file->private_data = NULL;
452 for (link = &s->user; *link; link = &(*link)->next) 452 for (link = &s->user; *link; link = &(*link)->next)
@@ -480,7 +480,7 @@ static ssize_t ds_read(struct file *file, char __user *buf,
480 return -EIO; 480 return -EIO;
481 481
482 s = user->socket; 482 s = user->socket;
483 if (s->state & DS_SOCKET_DEAD) 483 if (s->pcmcia_state.dead)
484 return -EIO; 484 return -EIO;
485 485
486 ret = wait_event_interruptible(s->queue, !queue_empty(user)); 486 ret = wait_event_interruptible(s->queue, !queue_empty(user));
@@ -550,7 +550,7 @@ static int ds_ioctl(struct inode * inode, struct file * file,
550 return -EIO; 550 return -EIO;
551 551
552 s = user->socket; 552 s = user->socket;
553 if (s->state & DS_SOCKET_DEAD) 553 if (s->pcmcia_state.dead)
554 return -EIO; 554 return -EIO;
555 555
556 size = (cmd & IOCSIZE_MASK) >> IOCSIZE_SHIFT; 556 size = (cmd & IOCSIZE_MASK) >> IOCSIZE_SHIFT;