diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-03-08 23:21:04 +0300 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-03-08 23:21:04 +0300 |
commit | 988addf82e4c03739375279de73929580a2d4a6a (patch) | |
tree | 989ae1cd4e264bbad80c65f04480486246e7b9f3 /drivers/pcmcia/pcmcia_ioctl.c | |
parent | 004c1c7096659d352b83047a7593e91d8a30e3c5 (diff) | |
parent | 25cf84cf377c0aae5dbcf937ea89bc7893db5176 (diff) | |
download | linux-988addf82e4c03739375279de73929580a2d4a6a.tar.xz |
Merge branch 'origin' into devel-stable
Conflicts:
arch/arm/mach-mx2/devices.c
arch/arm/mach-mx2/devices.h
sound/soc/pxa/pxa-ssp.c
Diffstat (limited to 'drivers/pcmcia/pcmcia_ioctl.c')
-rw-r--r-- | drivers/pcmcia/pcmcia_ioctl.c | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index f73fd5beaa37..13a7132cf688 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c @@ -62,16 +62,15 @@ static struct pcmcia_device *get_pcmcia_device(struct pcmcia_socket *s, unsigned int function) { struct pcmcia_device *p_dev = NULL; - unsigned long flags; - spin_lock_irqsave(&pcmcia_dev_list_lock, flags); + mutex_lock(&s->ops_mutex); list_for_each_entry(p_dev, &s->devices_list, socket_device_list) { if (p_dev->func == function) { - spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); + mutex_unlock(&s->ops_mutex); return pcmcia_get_dev(p_dev); } } - spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); + mutex_unlock(&s->ops_mutex); return NULL; } @@ -169,7 +168,6 @@ static int pcmcia_adjust_resource_info(adjust_t *adj) { struct pcmcia_socket *s; int ret = -ENOSYS; - unsigned long flags; down_read(&pcmcia_socket_list_rwsem); list_for_each_entry(s, &pcmcia_socket_list, socket_list) { @@ -182,14 +180,13 @@ static int pcmcia_adjust_resource_info(adjust_t *adj) /* you can't use the old interface if the new * one was used before */ - spin_lock_irqsave(&s->lock, flags); + mutex_lock(&s->ops_mutex); if ((s->resource_setup_new) && !(s->resource_setup_old)) { - spin_unlock_irqrestore(&s->lock, flags); + mutex_unlock(&s->ops_mutex); continue; } else if (!(s->resource_setup_old)) s->resource_setup_old = 1; - spin_unlock_irqrestore(&s->lock, flags); switch (adj->Resource) { case RES_MEMORY_RANGE: @@ -208,10 +205,9 @@ static int pcmcia_adjust_resource_info(adjust_t *adj) * last call to adjust_resource_info, we * always need to assume this is the latest * one... */ - spin_lock_irqsave(&s->lock, flags); s->resource_setup_done = 1; - spin_unlock_irqrestore(&s->lock, flags); } + mutex_unlock(&s->ops_mutex); } } up_read(&pcmcia_socket_list_rwsem); @@ -470,7 +466,6 @@ static int bind_request(struct pcmcia_socket *s, bind_info_t *bind_info) struct pcmcia_driver *p_drv; struct pcmcia_device *p_dev; int ret = 0; - unsigned long flags; s = pcmcia_get_socket(s); if (!s) @@ -490,7 +485,7 @@ static int bind_request(struct pcmcia_socket *s, bind_info_t *bind_info) goto err_put_driver; } - spin_lock_irqsave(&pcmcia_dev_list_lock, flags); + mutex_lock(&s->ops_mutex); list_for_each_entry(p_dev, &s->devices_list, socket_device_list) { if (p_dev->func == bind_info->function) { if ((p_dev->dev.driver == &p_drv->drv)) { @@ -499,7 +494,7 @@ static int bind_request(struct pcmcia_socket *s, bind_info_t *bind_info) * registered, and it was registered * by userspace before, we need to * return the "instance". */ - spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); + mutex_unlock(&s->ops_mutex); bind_info->instance = p_dev; ret = -EBUSY; goto err_put_module; @@ -507,7 +502,7 @@ static int bind_request(struct pcmcia_socket *s, bind_info_t *bind_info) /* the correct driver managed to bind * itself magically to the correct * device. */ - spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); + mutex_unlock(&s->ops_mutex); p_dev->cardmgr = p_drv; ret = 0; goto err_put_module; @@ -516,12 +511,12 @@ static int bind_request(struct pcmcia_socket *s, bind_info_t *bind_info) /* there's already a device available where * no device has been bound to yet. So we don't * need to register a device! */ - spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); + mutex_unlock(&s->ops_mutex); goto rescan; } } } - spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); + mutex_unlock(&s->ops_mutex); p_dev = pcmcia_device_add(s, bind_info->function); if (!p_dev) { @@ -578,7 +573,6 @@ static int get_device_info(struct pcmcia_socket *s, bind_info_t *bind_info, int dev_node_t *node; struct pcmcia_device *p_dev; struct pcmcia_driver *p_drv; - unsigned long flags; int ret = 0; #ifdef CONFIG_CARDBUS @@ -617,7 +611,7 @@ static int get_device_info(struct pcmcia_socket *s, bind_info_t *bind_info, int } #endif - spin_lock_irqsave(&pcmcia_dev_list_lock, flags); + mutex_lock(&s->ops_mutex); list_for_each_entry(p_dev, &s->devices_list, socket_device_list) { if (p_dev->func == bind_info->function) { p_dev = pcmcia_get_dev(p_dev); @@ -626,11 +620,11 @@ static int get_device_info(struct pcmcia_socket *s, bind_info_t *bind_info, int goto found; } } - spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); + mutex_unlock(&s->ops_mutex); return -ENODEV; found: - spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); + mutex_unlock(&s->ops_mutex); p_drv = to_pcmcia_drv(p_dev->dev.driver); if (p_drv && !p_dev->_locked) { @@ -931,16 +925,16 @@ static int ds_ioctl(struct inode *inode, struct file *file, ret = pccard_validate_cis(s, &buf->cisinfo.Chains); break; case DS_SUSPEND_CARD: - ret = pcmcia_suspend_card(s); + pcmcia_parse_uevents(s, PCMCIA_UEVENT_SUSPEND); break; case DS_RESUME_CARD: - ret = pcmcia_resume_card(s); + pcmcia_parse_uevents(s, PCMCIA_UEVENT_RESUME); break; case DS_EJECT_CARD: - err = pcmcia_eject_card(s); + pcmcia_parse_uevents(s, PCMCIA_UEVENT_EJECT); break; case DS_INSERT_CARD: - err = pcmcia_insert_card(s); + pcmcia_parse_uevents(s, PCMCIA_UEVENT_INSERT); break; case DS_ACCESS_CONFIGURATION_REGISTER: if ((buf->conf_reg.Action == CS_WRITE) && !capable(CAP_SYS_ADMIN)) { |