diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pcmcia/cs.c | 40 | ||||
-rw-r--r-- | drivers/pcmcia/ds.c | 14 | ||||
-rw-r--r-- | drivers/pcmcia/pcmcia_ioctl.c | 12 | ||||
-rw-r--r-- | drivers/pcmcia/rsrc_nonstatic.c | 40 | ||||
-rw-r--r-- | drivers/pcmcia/socket_sysfs.c | 9 |
5 files changed, 58 insertions, 57 deletions
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index 45cffbf285c2..907a6768e994 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c | |||
@@ -111,9 +111,9 @@ int pcmcia_socket_dev_suspend(struct device *dev, pm_message_t state) | |||
111 | list_for_each_entry(socket, &pcmcia_socket_list, socket_list) { | 111 | list_for_each_entry(socket, &pcmcia_socket_list, socket_list) { |
112 | if (socket->dev.dev != dev) | 112 | if (socket->dev.dev != dev) |
113 | continue; | 113 | continue; |
114 | down(&socket->skt_sem); | 114 | mutex_lock(&socket->skt_mutex); |
115 | socket_suspend(socket); | 115 | socket_suspend(socket); |
116 | up(&socket->skt_sem); | 116 | mutex_unlock(&socket->skt_mutex); |
117 | } | 117 | } |
118 | up_read(&pcmcia_socket_list_rwsem); | 118 | up_read(&pcmcia_socket_list_rwsem); |
119 | 119 | ||
@@ -129,9 +129,9 @@ int pcmcia_socket_dev_resume(struct device *dev) | |||
129 | list_for_each_entry(socket, &pcmcia_socket_list, socket_list) { | 129 | list_for_each_entry(socket, &pcmcia_socket_list, socket_list) { |
130 | if (socket->dev.dev != dev) | 130 | if (socket->dev.dev != dev) |
131 | continue; | 131 | continue; |
132 | down(&socket->skt_sem); | 132 | mutex_lock(&socket->skt_mutex); |
133 | socket_resume(socket); | 133 | socket_resume(socket); |
134 | up(&socket->skt_sem); | 134 | mutex_unlock(&socket->skt_mutex); |
135 | } | 135 | } |
136 | up_read(&pcmcia_socket_list_rwsem); | 136 | up_read(&pcmcia_socket_list_rwsem); |
137 | 137 | ||
@@ -237,7 +237,7 @@ int pcmcia_register_socket(struct pcmcia_socket *socket) | |||
237 | init_completion(&socket->socket_released); | 237 | init_completion(&socket->socket_released); |
238 | init_completion(&socket->thread_done); | 238 | init_completion(&socket->thread_done); |
239 | init_waitqueue_head(&socket->thread_wait); | 239 | init_waitqueue_head(&socket->thread_wait); |
240 | init_MUTEX(&socket->skt_sem); | 240 | mutex_init(&socket->skt_mutex); |
241 | spin_lock_init(&socket->thread_lock); | 241 | spin_lock_init(&socket->thread_lock); |
242 | 242 | ||
243 | ret = kernel_thread(pccardd, socket, CLONE_KERNEL); | 243 | ret = kernel_thread(pccardd, socket, CLONE_KERNEL); |
@@ -662,7 +662,7 @@ static int pccardd(void *__skt) | |||
662 | spin_unlock_irqrestore(&skt->thread_lock, flags); | 662 | spin_unlock_irqrestore(&skt->thread_lock, flags); |
663 | 663 | ||
664 | if (events) { | 664 | if (events) { |
665 | down(&skt->skt_sem); | 665 | mutex_lock(&skt->skt_mutex); |
666 | if (events & SS_DETECT) | 666 | if (events & SS_DETECT) |
667 | socket_detect_change(skt); | 667 | socket_detect_change(skt); |
668 | if (events & SS_BATDEAD) | 668 | if (events & SS_BATDEAD) |
@@ -671,7 +671,7 @@ static int pccardd(void *__skt) | |||
671 | send_event(skt, CS_EVENT_BATTERY_LOW, CS_EVENT_PRI_LOW); | 671 | send_event(skt, CS_EVENT_BATTERY_LOW, CS_EVENT_PRI_LOW); |
672 | if (events & SS_READY) | 672 | if (events & SS_READY) |
673 | send_event(skt, CS_EVENT_READY_CHANGE, CS_EVENT_PRI_LOW); | 673 | send_event(skt, CS_EVENT_READY_CHANGE, CS_EVENT_PRI_LOW); |
674 | up(&skt->skt_sem); | 674 | mutex_unlock(&skt->skt_mutex); |
675 | continue; | 675 | continue; |
676 | } | 676 | } |
677 | 677 | ||
@@ -715,8 +715,8 @@ int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c) | |||
715 | { | 715 | { |
716 | int ret = 0; | 716 | int ret = 0; |
717 | 717 | ||
718 | /* s->skt_sem also protects s->callback */ | 718 | /* s->skt_mutex also protects s->callback */ |
719 | down(&s->skt_sem); | 719 | mutex_lock(&s->skt_mutex); |
720 | 720 | ||
721 | if (c) { | 721 | if (c) { |
722 | /* registration */ | 722 | /* registration */ |
@@ -732,7 +732,7 @@ int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c) | |||
732 | } else | 732 | } else |
733 | s->callback = NULL; | 733 | s->callback = NULL; |
734 | err: | 734 | err: |
735 | up(&s->skt_sem); | 735 | mutex_unlock(&s->skt_mutex); |
736 | 736 | ||
737 | return ret; | 737 | return ret; |
738 | } | 738 | } |
@@ -750,7 +750,7 @@ int pccard_reset_card(struct pcmcia_socket *skt) | |||
750 | 750 | ||
751 | cs_dbg(skt, 1, "resetting socket\n"); | 751 | cs_dbg(skt, 1, "resetting socket\n"); |
752 | 752 | ||
753 | down(&skt->skt_sem); | 753 | mutex_lock(&skt->skt_mutex); |
754 | do { | 754 | do { |
755 | if (!(skt->state & SOCKET_PRESENT)) { | 755 | if (!(skt->state & SOCKET_PRESENT)) { |
756 | ret = CS_NO_CARD; | 756 | ret = CS_NO_CARD; |
@@ -779,7 +779,7 @@ int pccard_reset_card(struct pcmcia_socket *skt) | |||
779 | 779 | ||
780 | ret = CS_SUCCESS; | 780 | ret = CS_SUCCESS; |
781 | } while (0); | 781 | } while (0); |
782 | up(&skt->skt_sem); | 782 | mutex_unlock(&skt->skt_mutex); |
783 | 783 | ||
784 | return ret; | 784 | return ret; |
785 | } /* reset_card */ | 785 | } /* reset_card */ |
@@ -795,7 +795,7 @@ int pcmcia_suspend_card(struct pcmcia_socket *skt) | |||
795 | 795 | ||
796 | cs_dbg(skt, 1, "suspending socket\n"); | 796 | cs_dbg(skt, 1, "suspending socket\n"); |
797 | 797 | ||
798 | down(&skt->skt_sem); | 798 | mutex_lock(&skt->skt_mutex); |
799 | do { | 799 | do { |
800 | if (!(skt->state & SOCKET_PRESENT)) { | 800 | if (!(skt->state & SOCKET_PRESENT)) { |
801 | ret = CS_NO_CARD; | 801 | ret = CS_NO_CARD; |
@@ -812,7 +812,7 @@ int pcmcia_suspend_card(struct pcmcia_socket *skt) | |||
812 | } | 812 | } |
813 | ret = socket_suspend(skt); | 813 | ret = socket_suspend(skt); |
814 | } while (0); | 814 | } while (0); |
815 | up(&skt->skt_sem); | 815 | mutex_unlock(&skt->skt_mutex); |
816 | 816 | ||
817 | return ret; | 817 | return ret; |
818 | } /* suspend_card */ | 818 | } /* suspend_card */ |
@@ -825,7 +825,7 @@ int pcmcia_resume_card(struct pcmcia_socket *skt) | |||
825 | 825 | ||
826 | cs_dbg(skt, 1, "waking up socket\n"); | 826 | cs_dbg(skt, 1, "waking up socket\n"); |
827 | 827 | ||
828 | down(&skt->skt_sem); | 828 | mutex_lock(&skt->skt_mutex); |
829 | do { | 829 | do { |
830 | if (!(skt->state & SOCKET_PRESENT)) { | 830 | if (!(skt->state & SOCKET_PRESENT)) { |
831 | ret = CS_NO_CARD; | 831 | ret = CS_NO_CARD; |
@@ -839,7 +839,7 @@ int pcmcia_resume_card(struct pcmcia_socket *skt) | |||
839 | if (!ret && skt->callback) | 839 | if (!ret && skt->callback) |
840 | skt->callback->resume(skt); | 840 | skt->callback->resume(skt); |
841 | } while (0); | 841 | } while (0); |
842 | up(&skt->skt_sem); | 842 | mutex_unlock(&skt->skt_mutex); |
843 | 843 | ||
844 | return ret; | 844 | return ret; |
845 | } /* resume_card */ | 845 | } /* resume_card */ |
@@ -853,7 +853,7 @@ int pcmcia_eject_card(struct pcmcia_socket *skt) | |||
853 | 853 | ||
854 | cs_dbg(skt, 1, "user eject request\n"); | 854 | cs_dbg(skt, 1, "user eject request\n"); |
855 | 855 | ||
856 | down(&skt->skt_sem); | 856 | mutex_lock(&skt->skt_mutex); |
857 | do { | 857 | do { |
858 | if (!(skt->state & SOCKET_PRESENT)) { | 858 | if (!(skt->state & SOCKET_PRESENT)) { |
859 | ret = -ENODEV; | 859 | ret = -ENODEV; |
@@ -869,7 +869,7 @@ int pcmcia_eject_card(struct pcmcia_socket *skt) | |||
869 | socket_remove(skt); | 869 | socket_remove(skt); |
870 | ret = 0; | 870 | ret = 0; |
871 | } while (0); | 871 | } while (0); |
872 | up(&skt->skt_sem); | 872 | mutex_unlock(&skt->skt_mutex); |
873 | 873 | ||
874 | return ret; | 874 | return ret; |
875 | } /* eject_card */ | 875 | } /* eject_card */ |
@@ -882,7 +882,7 @@ int pcmcia_insert_card(struct pcmcia_socket *skt) | |||
882 | 882 | ||
883 | cs_dbg(skt, 1, "user insert request\n"); | 883 | cs_dbg(skt, 1, "user insert request\n"); |
884 | 884 | ||
885 | down(&skt->skt_sem); | 885 | mutex_lock(&skt->skt_mutex); |
886 | do { | 886 | do { |
887 | if (skt->state & SOCKET_PRESENT) { | 887 | if (skt->state & SOCKET_PRESENT) { |
888 | ret = -EBUSY; | 888 | ret = -EBUSY; |
@@ -894,7 +894,7 @@ int pcmcia_insert_card(struct pcmcia_socket *skt) | |||
894 | } | 894 | } |
895 | ret = 0; | 895 | ret = 0; |
896 | } while (0); | 896 | } while (0); |
897 | up(&skt->skt_sem); | 897 | mutex_unlock(&skt->skt_mutex); |
898 | 898 | ||
899 | return ret; | 899 | return ret; |
900 | } /* insert_card */ | 900 | } /* insert_card */ |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 37ba1246c282..3b7e1ba13c78 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -564,7 +564,7 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev) | |||
564 | * won't work, this doesn't matter much at the moment: the driver core doesn't | 564 | * won't work, this doesn't matter much at the moment: the driver core doesn't |
565 | * support it either. | 565 | * support it either. |
566 | */ | 566 | */ |
567 | static DECLARE_MUTEX(device_add_lock); | 567 | static DEFINE_MUTEX(device_add_lock); |
568 | 568 | ||
569 | struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int function) | 569 | struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int function) |
570 | { | 570 | { |
@@ -576,7 +576,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f | |||
576 | if (!s) | 576 | if (!s) |
577 | return NULL; | 577 | return NULL; |
578 | 578 | ||
579 | down(&device_add_lock); | 579 | mutex_lock(&device_add_lock); |
580 | 580 | ||
581 | /* max of 2 devices per card */ | 581 | /* max of 2 devices per card */ |
582 | if (s->device_count == 2) | 582 | if (s->device_count == 2) |
@@ -640,7 +640,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f | |||
640 | if (device_register(&p_dev->dev)) | 640 | if (device_register(&p_dev->dev)) |
641 | goto err_unreg; | 641 | goto err_unreg; |
642 | 642 | ||
643 | up(&device_add_lock); | 643 | mutex_unlock(&device_add_lock); |
644 | 644 | ||
645 | return p_dev; | 645 | return p_dev; |
646 | 646 | ||
@@ -654,7 +654,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f | |||
654 | kfree(p_dev); | 654 | kfree(p_dev); |
655 | s->device_count--; | 655 | s->device_count--; |
656 | err_put: | 656 | err_put: |
657 | up(&device_add_lock); | 657 | mutex_unlock(&device_add_lock); |
658 | pcmcia_put_socket(s); | 658 | pcmcia_put_socket(s); |
659 | 659 | ||
660 | return NULL; | 660 | return NULL; |
@@ -713,7 +713,7 @@ static void pcmcia_bus_rescan(struct pcmcia_socket *skt) | |||
713 | int no_devices=0; | 713 | int no_devices=0; |
714 | unsigned long flags; | 714 | unsigned long flags; |
715 | 715 | ||
716 | /* must be called with skt_sem held */ | 716 | /* must be called with skt_mutex held */ |
717 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); | 717 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); |
718 | if (list_empty(&skt->devices_list)) | 718 | if (list_empty(&skt->devices_list)) |
719 | no_devices=1; | 719 | no_devices=1; |
@@ -999,9 +999,9 @@ static ssize_t pcmcia_store_allow_func_id_match(struct device *dev, | |||
999 | if (!count) | 999 | if (!count) |
1000 | return -EINVAL; | 1000 | return -EINVAL; |
1001 | 1001 | ||
1002 | down(&p_dev->socket->skt_sem); | 1002 | mutex_lock(&p_dev->socket->skt_mutex); |
1003 | p_dev->allow_func_id_match = 1; | 1003 | p_dev->allow_func_id_match = 1; |
1004 | up(&p_dev->socket->skt_sem); | 1004 | mutex_unlock(&p_dev->socket->skt_mutex); |
1005 | 1005 | ||
1006 | bus_rescan_devices(&pcmcia_bus_type); | 1006 | bus_rescan_devices(&pcmcia_bus_type); |
1007 | 1007 | ||
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index 56b625d171ae..8eceba739102 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c | |||
@@ -269,9 +269,9 @@ rescan: | |||
269 | /* | 269 | /* |
270 | * Prevent this racing with a card insertion. | 270 | * Prevent this racing with a card insertion. |
271 | */ | 271 | */ |
272 | down(&s->skt_sem); | 272 | mutex_lock(&s->skt_mutex); |
273 | bus_rescan_devices(&pcmcia_bus_type); | 273 | bus_rescan_devices(&pcmcia_bus_type); |
274 | up(&s->skt_sem); | 274 | mutex_unlock(&s->skt_mutex); |
275 | 275 | ||
276 | /* check whether the driver indeed matched. I don't care if this | 276 | /* check whether the driver indeed matched. I don't care if this |
277 | * is racy or not, because it can only happen on cardmgr access | 277 | * is racy or not, because it can only happen on cardmgr access |
@@ -606,9 +606,9 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
606 | } | 606 | } |
607 | break; | 607 | break; |
608 | case DS_GET_FIRST_TUPLE: | 608 | case DS_GET_FIRST_TUPLE: |
609 | down(&s->skt_sem); | 609 | mutex_lock(&s->skt_mutex); |
610 | pcmcia_validate_mem(s); | 610 | pcmcia_validate_mem(s); |
611 | up(&s->skt_sem); | 611 | mutex_unlock(&s->skt_mutex); |
612 | ret = pccard_get_first_tuple(s, BIND_FN_ALL, &buf->tuple); | 612 | ret = pccard_get_first_tuple(s, BIND_FN_ALL, &buf->tuple); |
613 | break; | 613 | break; |
614 | case DS_GET_NEXT_TUPLE: | 614 | case DS_GET_NEXT_TUPLE: |
@@ -637,9 +637,9 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
637 | } | 637 | } |
638 | break; | 638 | break; |
639 | case DS_VALIDATE_CIS: | 639 | case DS_VALIDATE_CIS: |
640 | down(&s->skt_sem); | 640 | mutex_lock(&s->skt_mutex); |
641 | pcmcia_validate_mem(s); | 641 | pcmcia_validate_mem(s); |
642 | up(&s->skt_sem); | 642 | mutex_unlock(&s->skt_mutex); |
643 | ret = pccard_validate_cis(s, BIND_FN_ALL, &buf->cisinfo); | 643 | ret = pccard_validate_cis(s, BIND_FN_ALL, &buf->cisinfo); |
644 | break; | 644 | break; |
645 | case DS_SUSPEND_CARD: | 645 | case DS_SUSPEND_CARD: |
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c index 5301ac60358f..6da4a03d68e4 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c | |||
@@ -61,7 +61,7 @@ struct socket_data { | |||
61 | unsigned int rsrc_mem_probe; | 61 | unsigned int rsrc_mem_probe; |
62 | }; | 62 | }; |
63 | 63 | ||
64 | static DECLARE_MUTEX(rsrc_sem); | 64 | static DEFINE_MUTEX(rsrc_mutex); |
65 | #define MEM_PROBE_LOW (1 << 0) | 65 | #define MEM_PROBE_LOW (1 << 0) |
66 | #define MEM_PROBE_HIGH (1 << 1) | 66 | #define MEM_PROBE_HIGH (1 << 1) |
67 | 67 | ||
@@ -484,7 +484,7 @@ static int validate_mem(struct pcmcia_socket *s, unsigned int probe_mask) | |||
484 | 484 | ||
485 | 485 | ||
486 | /* | 486 | /* |
487 | * Locking note: Must be called with skt_sem held! | 487 | * Locking note: Must be called with skt_mutex held! |
488 | */ | 488 | */ |
489 | static int pcmcia_nonstatic_validate_mem(struct pcmcia_socket *s) | 489 | static int pcmcia_nonstatic_validate_mem(struct pcmcia_socket *s) |
490 | { | 490 | { |
@@ -495,7 +495,7 @@ static int pcmcia_nonstatic_validate_mem(struct pcmcia_socket *s) | |||
495 | if (!probe_mem) | 495 | if (!probe_mem) |
496 | return 0; | 496 | return 0; |
497 | 497 | ||
498 | down(&rsrc_sem); | 498 | mutex_lock(&rsrc_mutex); |
499 | 499 | ||
500 | if (s->features & SS_CAP_PAGE_REGS) | 500 | if (s->features & SS_CAP_PAGE_REGS) |
501 | probe_mask = MEM_PROBE_HIGH; | 501 | probe_mask = MEM_PROBE_HIGH; |
@@ -507,7 +507,7 @@ static int pcmcia_nonstatic_validate_mem(struct pcmcia_socket *s) | |||
507 | s_data->rsrc_mem_probe |= probe_mask; | 507 | s_data->rsrc_mem_probe |= probe_mask; |
508 | } | 508 | } |
509 | 509 | ||
510 | up(&rsrc_sem); | 510 | mutex_unlock(&rsrc_mutex); |
511 | 511 | ||
512 | return ret; | 512 | return ret; |
513 | } | 513 | } |
@@ -585,7 +585,7 @@ static int nonstatic_adjust_io_region(struct resource *res, unsigned long r_star | |||
585 | struct socket_data *s_data = s->resource_data; | 585 | struct socket_data *s_data = s->resource_data; |
586 | int ret = -ENOMEM; | 586 | int ret = -ENOMEM; |
587 | 587 | ||
588 | down(&rsrc_sem); | 588 | mutex_lock(&rsrc_mutex); |
589 | for (m = s_data->io_db.next; m != &s_data->io_db; m = m->next) { | 589 | for (m = s_data->io_db.next; m != &s_data->io_db; m = m->next) { |
590 | unsigned long start = m->base; | 590 | unsigned long start = m->base; |
591 | unsigned long end = m->base + m->num - 1; | 591 | unsigned long end = m->base + m->num - 1; |
@@ -596,7 +596,7 @@ static int nonstatic_adjust_io_region(struct resource *res, unsigned long r_star | |||
596 | ret = adjust_resource(res, r_start, r_end - r_start + 1); | 596 | ret = adjust_resource(res, r_start, r_end - r_start + 1); |
597 | break; | 597 | break; |
598 | } | 598 | } |
599 | up(&rsrc_sem); | 599 | mutex_unlock(&rsrc_mutex); |
600 | 600 | ||
601 | return ret; | 601 | return ret; |
602 | } | 602 | } |
@@ -630,7 +630,7 @@ static struct resource *nonstatic_find_io_region(unsigned long base, int num, | |||
630 | data.offset = base & data.mask; | 630 | data.offset = base & data.mask; |
631 | data.map = &s_data->io_db; | 631 | data.map = &s_data->io_db; |
632 | 632 | ||
633 | down(&rsrc_sem); | 633 | mutex_lock(&rsrc_mutex); |
634 | #ifdef CONFIG_PCI | 634 | #ifdef CONFIG_PCI |
635 | if (s->cb_dev) { | 635 | if (s->cb_dev) { |
636 | ret = pci_bus_alloc_resource(s->cb_dev->bus, res, num, 1, | 636 | ret = pci_bus_alloc_resource(s->cb_dev->bus, res, num, 1, |
@@ -639,7 +639,7 @@ static struct resource *nonstatic_find_io_region(unsigned long base, int num, | |||
639 | #endif | 639 | #endif |
640 | ret = allocate_resource(&ioport_resource, res, num, min, ~0UL, | 640 | ret = allocate_resource(&ioport_resource, res, num, min, ~0UL, |
641 | 1, pcmcia_align, &data); | 641 | 1, pcmcia_align, &data); |
642 | up(&rsrc_sem); | 642 | mutex_unlock(&rsrc_mutex); |
643 | 643 | ||
644 | if (ret != 0) { | 644 | if (ret != 0) { |
645 | kfree(res); | 645 | kfree(res); |
@@ -672,7 +672,7 @@ static struct resource * nonstatic_find_mem_region(u_long base, u_long num, | |||
672 | min = 0x100000UL + base; | 672 | min = 0x100000UL + base; |
673 | } | 673 | } |
674 | 674 | ||
675 | down(&rsrc_sem); | 675 | mutex_lock(&rsrc_mutex); |
676 | #ifdef CONFIG_PCI | 676 | #ifdef CONFIG_PCI |
677 | if (s->cb_dev) { | 677 | if (s->cb_dev) { |
678 | ret = pci_bus_alloc_resource(s->cb_dev->bus, res, num, | 678 | ret = pci_bus_alloc_resource(s->cb_dev->bus, res, num, |
@@ -682,7 +682,7 @@ static struct resource * nonstatic_find_mem_region(u_long base, u_long num, | |||
682 | #endif | 682 | #endif |
683 | ret = allocate_resource(&iomem_resource, res, num, min, | 683 | ret = allocate_resource(&iomem_resource, res, num, min, |
684 | max, 1, pcmcia_align, &data); | 684 | max, 1, pcmcia_align, &data); |
685 | up(&rsrc_sem); | 685 | mutex_unlock(&rsrc_mutex); |
686 | if (ret == 0 || low) | 686 | if (ret == 0 || low) |
687 | break; | 687 | break; |
688 | low = 1; | 688 | low = 1; |
@@ -705,7 +705,7 @@ static int adjust_memory(struct pcmcia_socket *s, unsigned int action, unsigned | |||
705 | if (end < start) | 705 | if (end < start) |
706 | return -EINVAL; | 706 | return -EINVAL; |
707 | 707 | ||
708 | down(&rsrc_sem); | 708 | mutex_lock(&rsrc_mutex); |
709 | switch (action) { | 709 | switch (action) { |
710 | case ADD_MANAGED_RESOURCE: | 710 | case ADD_MANAGED_RESOURCE: |
711 | ret = add_interval(&data->mem_db, start, size); | 711 | ret = add_interval(&data->mem_db, start, size); |
@@ -723,7 +723,7 @@ static int adjust_memory(struct pcmcia_socket *s, unsigned int action, unsigned | |||
723 | default: | 723 | default: |
724 | ret = -EINVAL; | 724 | ret = -EINVAL; |
725 | } | 725 | } |
726 | up(&rsrc_sem); | 726 | mutex_unlock(&rsrc_mutex); |
727 | 727 | ||
728 | return ret; | 728 | return ret; |
729 | } | 729 | } |
@@ -741,7 +741,7 @@ static int adjust_io(struct pcmcia_socket *s, unsigned int action, unsigned long | |||
741 | if (end > IO_SPACE_LIMIT) | 741 | if (end > IO_SPACE_LIMIT) |
742 | return -EINVAL; | 742 | return -EINVAL; |
743 | 743 | ||
744 | down(&rsrc_sem); | 744 | mutex_lock(&rsrc_mutex); |
745 | switch (action) { | 745 | switch (action) { |
746 | case ADD_MANAGED_RESOURCE: | 746 | case ADD_MANAGED_RESOURCE: |
747 | if (add_interval(&data->io_db, start, size) != 0) { | 747 | if (add_interval(&data->io_db, start, size) != 0) { |
@@ -760,7 +760,7 @@ static int adjust_io(struct pcmcia_socket *s, unsigned int action, unsigned long | |||
760 | ret = -EINVAL; | 760 | ret = -EINVAL; |
761 | break; | 761 | break; |
762 | } | 762 | } |
763 | up(&rsrc_sem); | 763 | mutex_unlock(&rsrc_mutex); |
764 | 764 | ||
765 | return ret; | 765 | return ret; |
766 | } | 766 | } |
@@ -867,7 +867,7 @@ static void nonstatic_release_resource_db(struct pcmcia_socket *s) | |||
867 | struct socket_data *data = s->resource_data; | 867 | struct socket_data *data = s->resource_data; |
868 | struct resource_map *p, *q; | 868 | struct resource_map *p, *q; |
869 | 869 | ||
870 | down(&rsrc_sem); | 870 | mutex_lock(&rsrc_mutex); |
871 | for (p = data->mem_db.next; p != &data->mem_db; p = q) { | 871 | for (p = data->mem_db.next; p != &data->mem_db; p = q) { |
872 | q = p->next; | 872 | q = p->next; |
873 | kfree(p); | 873 | kfree(p); |
@@ -876,7 +876,7 @@ static void nonstatic_release_resource_db(struct pcmcia_socket *s) | |||
876 | q = p->next; | 876 | q = p->next; |
877 | kfree(p); | 877 | kfree(p); |
878 | } | 878 | } |
879 | up(&rsrc_sem); | 879 | mutex_unlock(&rsrc_mutex); |
880 | } | 880 | } |
881 | 881 | ||
882 | 882 | ||
@@ -901,7 +901,7 @@ static ssize_t show_io_db(struct class_device *class_dev, char *buf) | |||
901 | struct resource_map *p; | 901 | struct resource_map *p; |
902 | ssize_t ret = 0; | 902 | ssize_t ret = 0; |
903 | 903 | ||
904 | down(&rsrc_sem); | 904 | mutex_lock(&rsrc_mutex); |
905 | data = s->resource_data; | 905 | data = s->resource_data; |
906 | 906 | ||
907 | for (p = data->io_db.next; p != &data->io_db; p = p->next) { | 907 | for (p = data->io_db.next; p != &data->io_db; p = p->next) { |
@@ -913,7 +913,7 @@ static ssize_t show_io_db(struct class_device *class_dev, char *buf) | |||
913 | ((unsigned long) p->base + p->num - 1)); | 913 | ((unsigned long) p->base + p->num - 1)); |
914 | } | 914 | } |
915 | 915 | ||
916 | up(&rsrc_sem); | 916 | mutex_unlock(&rsrc_mutex); |
917 | return (ret); | 917 | return (ret); |
918 | } | 918 | } |
919 | 919 | ||
@@ -953,7 +953,7 @@ static ssize_t show_mem_db(struct class_device *class_dev, char *buf) | |||
953 | struct resource_map *p; | 953 | struct resource_map *p; |
954 | ssize_t ret = 0; | 954 | ssize_t ret = 0; |
955 | 955 | ||
956 | down(&rsrc_sem); | 956 | mutex_lock(&rsrc_mutex); |
957 | data = s->resource_data; | 957 | data = s->resource_data; |
958 | 958 | ||
959 | for (p = data->mem_db.next; p != &data->mem_db; p = p->next) { | 959 | for (p = data->mem_db.next; p != &data->mem_db; p = p->next) { |
@@ -965,7 +965,7 @@ static ssize_t show_mem_db(struct class_device *class_dev, char *buf) | |||
965 | ((unsigned long) p->base + p->num - 1)); | 965 | ((unsigned long) p->base + p->num - 1)); |
966 | } | 966 | } |
967 | 967 | ||
968 | up(&rsrc_sem); | 968 | mutex_unlock(&rsrc_mutex); |
969 | return (ret); | 969 | return (ret); |
970 | } | 970 | } |
971 | 971 | ||
diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c index 5ab1cdef7c48..83c6b31133a8 100644 --- a/drivers/pcmcia/socket_sysfs.c +++ b/drivers/pcmcia/socket_sysfs.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/pm.h> | 25 | #include <linux/pm.h> |
26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
27 | #include <linux/device.h> | 27 | #include <linux/device.h> |
28 | #include <linux/mutex.h> | ||
28 | #include <asm/system.h> | 29 | #include <asm/system.h> |
29 | #include <asm/irq.h> | 30 | #include <asm/irq.h> |
30 | 31 | ||
@@ -183,7 +184,7 @@ static ssize_t pccard_store_resource(struct class_device *dev, const char *buf, | |||
183 | s->resource_setup_done = 1; | 184 | s->resource_setup_done = 1; |
184 | spin_unlock_irqrestore(&s->lock, flags); | 185 | spin_unlock_irqrestore(&s->lock, flags); |
185 | 186 | ||
186 | down(&s->skt_sem); | 187 | mutex_lock(&s->skt_mutex); |
187 | if ((s->callback) && | 188 | if ((s->callback) && |
188 | (s->state & SOCKET_PRESENT) && | 189 | (s->state & SOCKET_PRESENT) && |
189 | !(s->state & SOCKET_CARDBUS)) { | 190 | !(s->state & SOCKET_CARDBUS)) { |
@@ -192,7 +193,7 @@ static ssize_t pccard_store_resource(struct class_device *dev, const char *buf, | |||
192 | module_put(s->callback->owner); | 193 | module_put(s->callback->owner); |
193 | } | 194 | } |
194 | } | 195 | } |
195 | up(&s->skt_sem); | 196 | mutex_unlock(&s->skt_mutex); |
196 | 197 | ||
197 | return count; | 198 | return count; |
198 | } | 199 | } |
@@ -322,7 +323,7 @@ static ssize_t pccard_store_cis(struct kobject *kobj, char *buf, loff_t off, siz | |||
322 | kfree(cis); | 323 | kfree(cis); |
323 | 324 | ||
324 | if (!ret) { | 325 | if (!ret) { |
325 | down(&s->skt_sem); | 326 | mutex_lock(&s->skt_mutex); |
326 | if ((s->callback) && (s->state & SOCKET_PRESENT) && | 327 | if ((s->callback) && (s->state & SOCKET_PRESENT) && |
327 | !(s->state & SOCKET_CARDBUS)) { | 328 | !(s->state & SOCKET_CARDBUS)) { |
328 | if (try_module_get(s->callback->owner)) { | 329 | if (try_module_get(s->callback->owner)) { |
@@ -330,7 +331,7 @@ static ssize_t pccard_store_cis(struct kobject *kobj, char *buf, loff_t off, siz | |||
330 | module_put(s->callback->owner); | 331 | module_put(s->callback->owner); |
331 | } | 332 | } |
332 | } | 333 | } |
333 | up(&s->skt_sem); | 334 | mutex_unlock(&s->skt_mutex); |
334 | } | 335 | } |
335 | 336 | ||
336 | 337 | ||