diff options
Diffstat (limited to 'drivers/pcmcia/pcmcia_ioctl.c')
-rw-r--r-- | drivers/pcmcia/pcmcia_ioctl.c | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index c4d7908fa37f..f73fd5beaa37 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c | |||
@@ -88,12 +88,12 @@ static struct pcmcia_driver *get_pcmcia_driver(dev_info_t *dev_info) | |||
88 | 88 | ||
89 | p_drv = container_of(drv, struct pcmcia_driver, drv); | 89 | p_drv = container_of(drv, struct pcmcia_driver, drv); |
90 | 90 | ||
91 | return (p_drv); | 91 | return p_drv; |
92 | } | 92 | } |
93 | 93 | ||
94 | 94 | ||
95 | #ifdef CONFIG_PROC_FS | 95 | #ifdef CONFIG_PROC_FS |
96 | static struct proc_dir_entry *proc_pccard = NULL; | 96 | static struct proc_dir_entry *proc_pccard; |
97 | 97 | ||
98 | static int proc_read_drivers_callback(struct device_driver *driver, void *_m) | 98 | static int proc_read_drivers_callback(struct device_driver *driver, void *_m) |
99 | { | 99 | { |
@@ -158,7 +158,8 @@ static int adjust_irq(struct pcmcia_socket *s, adjust_t *adj) | |||
158 | 158 | ||
159 | #else | 159 | #else |
160 | 160 | ||
161 | static inline int adjust_irq(struct pcmcia_socket *s, adjust_t *adj) { | 161 | static inline int adjust_irq(struct pcmcia_socket *s, adjust_t *adj) |
162 | { | ||
162 | return 0; | 163 | return 0; |
163 | } | 164 | } |
164 | 165 | ||
@@ -195,7 +196,7 @@ static int pcmcia_adjust_resource_info(adjust_t *adj) | |||
195 | begin = adj->resource.memory.Base; | 196 | begin = adj->resource.memory.Base; |
196 | end = adj->resource.memory.Base + adj->resource.memory.Size - 1; | 197 | end = adj->resource.memory.Base + adj->resource.memory.Size - 1; |
197 | if (s->resource_ops->add_mem) | 198 | if (s->resource_ops->add_mem) |
198 | ret =s->resource_ops->add_mem(s, adj->Action, begin, end); | 199 | ret = s->resource_ops->add_mem(s, adj->Action, begin, end); |
199 | case RES_IO_RANGE: | 200 | case RES_IO_RANGE: |
200 | begin = adj->resource.io.BasePort; | 201 | begin = adj->resource.io.BasePort; |
201 | end = adj->resource.io.BasePort + adj->resource.io.NumPorts - 1; | 202 | end = adj->resource.io.BasePort + adj->resource.io.NumPorts - 1; |
@@ -215,7 +216,7 @@ static int pcmcia_adjust_resource_info(adjust_t *adj) | |||
215 | } | 216 | } |
216 | up_read(&pcmcia_socket_list_rwsem); | 217 | up_read(&pcmcia_socket_list_rwsem); |
217 | 218 | ||
218 | return (ret); | 219 | return ret; |
219 | } | 220 | } |
220 | 221 | ||
221 | 222 | ||
@@ -490,7 +491,7 @@ static int bind_request(struct pcmcia_socket *s, bind_info_t *bind_info) | |||
490 | } | 491 | } |
491 | 492 | ||
492 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); | 493 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); |
493 | list_for_each_entry(p_dev, &s->devices_list, socket_device_list) { | 494 | list_for_each_entry(p_dev, &s->devices_list, socket_device_list) { |
494 | if (p_dev->func == bind_info->function) { | 495 | if (p_dev->func == bind_info->function) { |
495 | if ((p_dev->dev.driver == &p_drv->drv)) { | 496 | if ((p_dev->dev.driver == &p_drv->drv)) { |
496 | if (p_dev->cardmgr) { | 497 | if (p_dev->cardmgr) { |
@@ -558,7 +559,7 @@ rescan: | |||
558 | err_put: | 559 | err_put: |
559 | pcmcia_put_socket(s); | 560 | pcmcia_put_socket(s); |
560 | 561 | ||
561 | return (ret); | 562 | return ret; |
562 | } /* bind_request */ | 563 | } /* bind_request */ |
563 | 564 | ||
564 | #ifdef CONFIG_CARDBUS | 565 | #ifdef CONFIG_CARDBUS |
@@ -655,7 +656,7 @@ static int get_device_info(struct pcmcia_socket *s, bind_info_t *bind_info, int | |||
655 | 656 | ||
656 | err_put: | 657 | err_put: |
657 | pcmcia_put_dev(p_dev); | 658 | pcmcia_put_dev(p_dev); |
658 | return (ret); | 659 | return ret; |
659 | } /* get_device_info */ | 660 | } /* get_device_info */ |
660 | 661 | ||
661 | 662 | ||
@@ -664,7 +665,7 @@ static int ds_open(struct inode *inode, struct file *file) | |||
664 | socket_t i = iminor(inode); | 665 | socket_t i = iminor(inode); |
665 | struct pcmcia_socket *s; | 666 | struct pcmcia_socket *s; |
666 | user_info_t *user; | 667 | user_info_t *user; |
667 | static int warning_printed = 0; | 668 | static int warning_printed; |
668 | int ret = 0; | 669 | int ret = 0; |
669 | 670 | ||
670 | pr_debug("ds_open(socket %d)\n", i); | 671 | pr_debug("ds_open(socket %d)\n", i); |
@@ -738,12 +739,13 @@ static int ds_release(struct inode *inode, struct file *file) | |||
738 | s = user->socket; | 739 | s = user->socket; |
739 | 740 | ||
740 | /* Unlink user data structure */ | 741 | /* Unlink user data structure */ |
741 | if ((file->f_flags & O_ACCMODE) != O_RDONLY) { | 742 | if ((file->f_flags & O_ACCMODE) != O_RDONLY) |
742 | s->pcmcia_state.busy = 0; | 743 | s->pcmcia_state.busy = 0; |
743 | } | 744 | |
744 | file->private_data = NULL; | 745 | file->private_data = NULL; |
745 | for (link = &s->user; *link; link = &(*link)->next) | 746 | for (link = &s->user; *link; link = &(*link)->next) |
746 | if (*link == user) break; | 747 | if (*link == user) |
748 | break; | ||
747 | if (link == NULL) | 749 | if (link == NULL) |
748 | goto out; | 750 | goto out; |
749 | *link = user->next; | 751 | *link = user->next; |
@@ -774,7 +776,7 @@ static ssize_t ds_read(struct file *file, char __user *buf, | |||
774 | 776 | ||
775 | s = user->socket; | 777 | s = user->socket; |
776 | if (s->pcmcia_state.dead) | 778 | if (s->pcmcia_state.dead) |
777 | return -EIO; | 779 | return -EIO; |
778 | 780 | ||
779 | ret = wait_event_interruptible(s->queue, !queue_empty(user)); | 781 | ret = wait_event_interruptible(s->queue, !queue_empty(user)); |
780 | if (ret == 0) | 782 | if (ret == 0) |
@@ -824,7 +826,7 @@ static u_int ds_poll(struct file *file, poll_table *wait) | |||
824 | 826 | ||
825 | /*====================================================================*/ | 827 | /*====================================================================*/ |
826 | 828 | ||
827 | static int ds_ioctl(struct inode * inode, struct file * file, | 829 | static int ds_ioctl(struct inode *inode, struct file *file, |
828 | u_int cmd, u_long arg) | 830 | u_int cmd, u_long arg) |
829 | { | 831 | { |
830 | struct pcmcia_socket *s; | 832 | struct pcmcia_socket *s; |
@@ -842,10 +844,11 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
842 | 844 | ||
843 | s = user->socket; | 845 | s = user->socket; |
844 | if (s->pcmcia_state.dead) | 846 | if (s->pcmcia_state.dead) |
845 | return -EIO; | 847 | return -EIO; |
846 | 848 | ||
847 | size = (cmd & IOCSIZE_MASK) >> IOCSIZE_SHIFT; | 849 | size = (cmd & IOCSIZE_MASK) >> IOCSIZE_SHIFT; |
848 | if (size > sizeof(ds_ioctl_arg_t)) return -EINVAL; | 850 | if (size > sizeof(ds_ioctl_arg_t)) |
851 | return -EINVAL; | ||
849 | 852 | ||
850 | /* Permission check */ | 853 | /* Permission check */ |
851 | if (!(cmd & IOC_OUT) && !capable(CAP_SYS_ADMIN)) | 854 | if (!(cmd & IOC_OUT) && !capable(CAP_SYS_ADMIN)) |
@@ -1024,8 +1027,8 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
1024 | } | 1027 | } |
1025 | 1028 | ||
1026 | if (cmd & IOC_OUT) { | 1029 | if (cmd & IOC_OUT) { |
1027 | if (__copy_to_user(uarg, (char *)buf, size)) | 1030 | if (__copy_to_user(uarg, (char *)buf, size)) |
1028 | err = -EFAULT; | 1031 | err = -EFAULT; |
1029 | } | 1032 | } |
1030 | 1033 | ||
1031 | free_out: | 1034 | free_out: |
@@ -1045,7 +1048,8 @@ static const struct file_operations ds_fops = { | |||
1045 | .poll = ds_poll, | 1048 | .poll = ds_poll, |
1046 | }; | 1049 | }; |
1047 | 1050 | ||
1048 | void __init pcmcia_setup_ioctl(void) { | 1051 | void __init pcmcia_setup_ioctl(void) |
1052 | { | ||
1049 | int i; | 1053 | int i; |
1050 | 1054 | ||
1051 | /* Set up character device for user mode clients */ | 1055 | /* Set up character device for user mode clients */ |
@@ -1064,7 +1068,8 @@ void __init pcmcia_setup_ioctl(void) { | |||
1064 | } | 1068 | } |
1065 | 1069 | ||
1066 | 1070 | ||
1067 | void __exit pcmcia_cleanup_ioctl(void) { | 1071 | void __exit pcmcia_cleanup_ioctl(void) |
1072 | { | ||
1068 | #ifdef CONFIG_PROC_FS | 1073 | #ifdef CONFIG_PROC_FS |
1069 | if (proc_pccard) { | 1074 | if (proc_pccard) { |
1070 | remove_proc_entry("drivers", proc_pccard); | 1075 | remove_proc_entry("drivers", proc_pccard); |