diff options
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r-- | drivers/pcmcia/pcmcia_ioctl.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index 7b424e0b0449..32c44040c1e8 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/proc_fs.h> | 27 | #include <linux/proc_fs.h> |
28 | #include <linux/poll.h> | 28 | #include <linux/poll.h> |
29 | #include <linux/pci.h> | 29 | #include <linux/pci.h> |
30 | #include <linux/seq_file.h> | ||
30 | #include <linux/smp_lock.h> | 31 | #include <linux/smp_lock.h> |
31 | #include <linux/workqueue.h> | 32 | #include <linux/workqueue.h> |
32 | 33 | ||
@@ -105,37 +106,40 @@ static struct pcmcia_driver *get_pcmcia_driver(dev_info_t *dev_info) | |||
105 | #ifdef CONFIG_PROC_FS | 106 | #ifdef CONFIG_PROC_FS |
106 | static struct proc_dir_entry *proc_pccard = NULL; | 107 | static struct proc_dir_entry *proc_pccard = NULL; |
107 | 108 | ||
108 | static int proc_read_drivers_callback(struct device_driver *driver, void *d) | 109 | static int proc_read_drivers_callback(struct device_driver *driver, void *_m) |
109 | { | 110 | { |
110 | char **p = d; | 111 | struct seq_file *m = _m; |
111 | struct pcmcia_driver *p_drv = container_of(driver, | 112 | struct pcmcia_driver *p_drv = container_of(driver, |
112 | struct pcmcia_driver, drv); | 113 | struct pcmcia_driver, drv); |
113 | 114 | ||
114 | *p += sprintf(*p, "%-24.24s 1 %d\n", p_drv->drv.name, | 115 | seq_printf(m, "%-24.24s 1 %d\n", p_drv->drv.name, |
115 | #ifdef CONFIG_MODULE_UNLOAD | 116 | #ifdef CONFIG_MODULE_UNLOAD |
116 | (p_drv->owner) ? module_refcount(p_drv->owner) : 1 | 117 | (p_drv->owner) ? module_refcount(p_drv->owner) : 1 |
117 | #else | 118 | #else |
118 | 1 | 119 | 1 |
119 | #endif | 120 | #endif |
120 | ); | 121 | ); |
121 | d = (void *) p; | ||
122 | |||
123 | return 0; | 122 | return 0; |
124 | } | 123 | } |
125 | 124 | ||
126 | static int proc_read_drivers(char *buf, char **start, off_t pos, | 125 | static int pccard_drivers_proc_show(struct seq_file *m, void *v) |
127 | int count, int *eof, void *data) | ||
128 | { | 126 | { |
129 | char *p = buf; | 127 | return bus_for_each_drv(&pcmcia_bus_type, NULL, |
130 | int rc; | 128 | m, proc_read_drivers_callback); |
131 | 129 | } | |
132 | rc = bus_for_each_drv(&pcmcia_bus_type, NULL, | ||
133 | (void *) &p, proc_read_drivers_callback); | ||
134 | if (rc < 0) | ||
135 | return rc; | ||
136 | 130 | ||
137 | return (p - buf); | 131 | static int pccard_drivers_proc_open(struct inode *inode, struct file *file) |
132 | { | ||
133 | return single_open(file, pccard_drivers_proc_show, NULL); | ||
138 | } | 134 | } |
135 | |||
136 | static const struct file_operations pccard_drivers_proc_fops = { | ||
137 | .owner = THIS_MODULE, | ||
138 | .open = pccard_drivers_proc_open, | ||
139 | .read = seq_read, | ||
140 | .llseek = seq_lseek, | ||
141 | .release = single_release, | ||
142 | }; | ||
139 | #endif | 143 | #endif |
140 | 144 | ||
141 | 145 | ||
@@ -1011,7 +1015,7 @@ void __init pcmcia_setup_ioctl(void) { | |||
1011 | #ifdef CONFIG_PROC_FS | 1015 | #ifdef CONFIG_PROC_FS |
1012 | proc_pccard = proc_mkdir("bus/pccard", NULL); | 1016 | proc_pccard = proc_mkdir("bus/pccard", NULL); |
1013 | if (proc_pccard) | 1017 | if (proc_pccard) |
1014 | create_proc_read_entry("drivers",0,proc_pccard,proc_read_drivers,NULL); | 1018 | proc_create("drivers", 0, proc_pccard, &pccard_drivers_proc_fops); |
1015 | #endif | 1019 | #endif |
1016 | } | 1020 | } |
1017 | 1021 | ||