aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/pcmcia_ioctl.c
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2009-09-21 20:03:55 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-22 10:17:42 -0400
commite6be4a8c26d0a9bacd811084c468e25863e3d069 (patch)
tree51f0e91aab763fc2af3235336ab501dc7c24263d /drivers/pcmcia/pcmcia_ioctl.c
parent470967dc6c38696f853b7f338eb9d743c28a9e11 (diff)
pcmcia: switch /proc/bus/pccard/drivers to seq_file
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Cc: Dominik Brodowski <linux@dominikbrodowski.net> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/pcmcia/pcmcia_ioctl.c')
-rw-r--r--drivers/pcmcia/pcmcia_ioctl.c36
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
106static struct proc_dir_entry *proc_pccard = NULL; 107static struct proc_dir_entry *proc_pccard = NULL;
107 108
108static int proc_read_drivers_callback(struct device_driver *driver, void *d) 109static 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
126static int proc_read_drivers(char *buf, char **start, off_t pos, 125static 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); 131static 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
136static 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