Commit c6617c1d authored by Dominik Brodowski's avatar Dominik Brodowski Committed by Russell King

[PCMCIA] Move socket /proc to sysfs

Remove the proc_setup callback. The drivers can use CLASS_DEVICE_ATTR
instead. Example: i82365.c.
parent e3183796
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/proc_fs.h>
#define IN_CARD_SERVICES #define IN_CARD_SERVICES
#include <pcmcia/cs_types.h> #include <pcmcia/cs_types.h>
......
...@@ -281,24 +281,7 @@ static int init_socket(struct pcmcia_socket *s) ...@@ -281,24 +281,7 @@ static int init_socket(struct pcmcia_socket *s)
return s->ss_entry->init(s); return s->ss_entry->init(s);
} }
/*====================================================================*/ /*====================================================================
#if defined(CONFIG_PROC_FS) && defined(PCMCIA_DEBUG)
static int proc_read_clients(char *buf, char **start, off_t pos,
int count, int *eof, void *data)
{
struct pcmcia_socket *s = data;
client_handle_t c;
char *p = buf;
for (c = s->clients; c; c = c->next)
p += sprintf(p, "fn %x: '%s' [attr 0x%04x] [state 0x%04x]\n",
c->Function, c->dev_info, c->Attributes, c->state);
return (p - buf);
}
#endif
/*======================================================================
Low-level PC Card interface drivers need to register with Card Low-level PC Card interface drivers need to register with Card
Services using these calls. Services using these calls.
...@@ -388,20 +371,6 @@ static int pcmcia_add_socket(struct class_device *class_dev) ...@@ -388,20 +371,6 @@ static int pcmcia_add_socket(struct class_device *class_dev)
wait_for_completion(&socket->thread_done); wait_for_completion(&socket->thread_done);
BUG_ON(!socket->thread); BUG_ON(!socket->thread);
#ifdef CONFIG_PROC_FS
if (proc_pccard) {
char name[3];
sprintf(name, "%02d", socket->sock);
socket->proc = proc_mkdir(name, proc_pccard);
if (socket->proc)
socket->ss_entry->proc_setup(socket, socket->proc);
#ifdef PCMCIA_DEBUG
if (socket->proc)
create_proc_read_entry("clients", 0, socket->proc,
proc_read_clients, socket);
#endif
}
#endif
return 0; return 0;
} }
...@@ -410,16 +379,6 @@ static void pcmcia_remove_socket(struct class_device *class_dev) ...@@ -410,16 +379,6 @@ static void pcmcia_remove_socket(struct class_device *class_dev)
struct pcmcia_socket *socket = class_get_devdata(class_dev); struct pcmcia_socket *socket = class_get_devdata(class_dev);
client_t *client; client_t *client;
#ifdef CONFIG_PROC_FS
if (proc_pccard) {
char name[3];
sprintf(name, "%02d", socket->sock);
#ifdef PCMCIA_DEBUG
remove_proc_entry("clients", socket->proc);
#endif
remove_proc_entry(name, proc_pccard);
}
#endif
if (socket->thread) { if (socket->thread) {
init_completion(&socket->thread_done); init_completion(&socket->thread_done);
socket->thread = NULL; socket->thread = NULL;
......
...@@ -173,10 +173,6 @@ int try_irq(u_int Attributes, int irq, int specific); ...@@ -173,10 +173,6 @@ int try_irq(u_int Attributes, int irq, int specific);
void undo_irq(u_int Attributes, int irq); void undo_irq(u_int Attributes, int irq);
int adjust_resource_info(client_handle_t handle, adjust_t *adj); int adjust_resource_info(client_handle_t handle, adjust_t *adj);
void release_resource_db(void); void release_resource_db(void);
int proc_read_io(char *buf, char **start, off_t pos,
int count, int *eof, void *data);
int proc_read_mem(char *buf, char **start, off_t pos,
int count, int *eof, void *data);
extern struct rw_semaphore pcmcia_socket_list_rwsem; extern struct rw_semaphore pcmcia_socket_list_rwsem;
extern struct list_head pcmcia_socket_list; extern struct list_head pcmcia_socket_list;
......
...@@ -74,7 +74,6 @@ static struct pccard_operations i82092aa_operations = { ...@@ -74,7 +74,6 @@ static struct pccard_operations i82092aa_operations = {
.set_socket = i82092aa_set_socket, .set_socket = i82092aa_set_socket,
.set_io_map = i82092aa_set_io_map, .set_io_map = i82092aa_set_io_map,
.set_mem_map = i82092aa_set_mem_map, .set_mem_map = i82092aa_set_mem_map,
.proc_setup = i82092aa_proc_setup,
}; };
/* The card can do upto 4 sockets, allocate a structure for each of them */ /* The card can do upto 4 sockets, allocate a structure for each of them */
...@@ -832,12 +831,6 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_ ...@@ -832,12 +831,6 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
return 0; return 0;
} }
static void i82092aa_proc_setup(struct pcmcia_socket *socket, struct proc_dir_entry *base)
{
}
/* Module stuff */
static int i82092aa_module_init(void) static int i82092aa_module_init(void)
{ {
enter("i82092aa_module_init"); enter("i82092aa_module_init");
......
...@@ -37,7 +37,6 @@ static int i82092aa_init(struct pcmcia_socket *socket); ...@@ -37,7 +37,6 @@ static int i82092aa_init(struct pcmcia_socket *socket);
static int i82092aa_suspend(struct pcmcia_socket *socket); static int i82092aa_suspend(struct pcmcia_socket *socket);
static int i82092aa_register_callback(struct pcmcia_socket *socket, void (*handler)(void *, unsigned int), void * info); static int i82092aa_register_callback(struct pcmcia_socket *socket, void (*handler)(void *, unsigned int), void * info);
static int i82092aa_inquire_socket(struct pcmcia_socket *socket, socket_cap_t *cap); static int i82092aa_inquire_socket(struct pcmcia_socket *socket, socket_cap_t *cap);
static void i82092aa_proc_setup(struct pcmcia_socket *socket, struct proc_dir_entry *base);
#endif #endif
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/proc_fs.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/device.h> #include <linux/device.h>
...@@ -168,9 +167,6 @@ struct i82365_socket { ...@@ -168,9 +167,6 @@ struct i82365_socket {
u_char cs_irq, intr; u_char cs_irq, intr;
void (*handler)(void *info, u_int events); void (*handler)(void *info, u_int events);
void *info; void *info;
#ifdef CONFIG_PROC_FS
struct proc_dir_entry *proc;
#endif
union { union {
cirrus_state_t cirrus; cirrus_state_t cirrus;
vg46x_state_t vg46x; vg46x_state_t vg46x;
...@@ -1288,71 +1284,42 @@ static int i365_set_mem_map(u_short sock, struct pccard_mem_map *mem) ...@@ -1288,71 +1284,42 @@ static int i365_set_mem_map(u_short sock, struct pccard_mem_map *mem)
/*====================================================================== /*======================================================================
Routines for accessing socket information and register dumps via Routines for accessing socket information and register dumps via
/proc/bus/pccard/... /sys/class/pcmcia_socket/...
======================================================================*/ ======================================================================*/
#ifdef CONFIG_PROC_FS static ssize_t show_info(struct class_device *class_dev, char *buf)
static int proc_read_info(char *buf, char **start, off_t pos,
int count, int *eof, void *data)
{ {
struct i82365_socket *s = data; struct i82365_socket *s = container_of(class_dev, struct i82365_socket, socket.dev);
char *p = buf; return sprintf(buf, "type: %s\npsock: %d\n",
p += sprintf(p, "type: %s\npsock: %d\n",
pcic[s->type].name, s->psock); pcic[s->type].name, s->psock);
return (p - buf);
} }
static int proc_read_exca(char *buf, char **start, off_t pos, static ssize_t show_exca(struct class_device *class_dev, char *buf)
int count, int *eof, void *data)
{ {
u_short sock = (struct i82365_socket *)data - socket; struct i82365_socket *s = container_of(class_dev, struct i82365_socket, socket.dev);
char *p = buf; unsigned short sock;
int i, top; int i;
ssize_t ret = 0;
unsigned long flags = 0;
sock = s->number;
u_long flags = 0;
ISA_LOCK(sock, flags); ISA_LOCK(sock, flags);
top = 0x40; for (i = 0; i < 0x40; i += 4) {
for (i = 0; i < top; i += 4) { ret += sprintf(buf, "%02x %02x %02x %02x%s",
if (i == 0x50) {
p += sprintf(p, "\n");
i = 0x100;
}
p += sprintf(p, "%02x %02x %02x %02x%s",
i365_get(sock,i), i365_get(sock,i+1), i365_get(sock,i), i365_get(sock,i+1),
i365_get(sock,i+2), i365_get(sock,i+3), i365_get(sock,i+2), i365_get(sock,i+3),
((i % 16) == 12) ? "\n" : " "); ((i % 16) == 12) ? "\n" : " ");
buf += ret;
} }
ISA_UNLOCK(sock, flags); ISA_UNLOCK(sock, flags);
return (p - buf);
}
static void pcic_proc_setup(struct pcmcia_socket *sock, struct proc_dir_entry *base)
{
struct i82365_socket *s = container_of(sock, struct i82365_socket, socket);
if (s->flags & IS_ALIVE)
return;
create_proc_read_entry("info", 0, base, proc_read_info, s); return ret;
create_proc_read_entry("exca", 0, base, proc_read_exca, s);
s->proc = base;
} }
static void pcic_proc_remove(u_short sock) static CLASS_DEVICE_ATTR(exca, S_IRUGO, show_exca, NULL);
{ static CLASS_DEVICE_ATTR(info, S_IRUGO, show_info, NULL);
struct proc_dir_entry *base = socket[sock].proc;
if (base == NULL) return;
remove_proc_entry("info", base);
remove_proc_entry("exca", base);
}
#else
#define pcic_proc_setup NULL
#endif /* CONFIG_PROC_FS */
/*====================================================================*/ /*====================================================================*/
...@@ -1453,7 +1420,6 @@ static struct pccard_operations pcic_operations = { ...@@ -1453,7 +1420,6 @@ static struct pccard_operations pcic_operations = {
.set_socket = pcic_set_socket, .set_socket = pcic_set_socket,
.set_io_map = pcic_set_io_map, .set_io_map = pcic_set_io_map,
.set_mem_map = pcic_set_mem_map, .set_mem_map = pcic_set_mem_map,
.proc_setup = pcic_proc_setup,
}; };
/*====================================================================*/ /*====================================================================*/
...@@ -1527,6 +1493,9 @@ static int __init init_i82365(void) ...@@ -1527,6 +1493,9 @@ static int __init init_i82365(void)
add_timer(&poll_timer); add_timer(&poll_timer);
} }
class_device_create_file(&socket[i].socket.dev, &class_device_attr_info);
class_device_create_file(&socket[i].socket.dev, &class_device_attr_exca);
return 0; return 0;
} /* init_i82365 */ } /* init_i82365 */
...@@ -1534,11 +1503,9 @@ static int __init init_i82365(void) ...@@ -1534,11 +1503,9 @@ static int __init init_i82365(void)
static void __exit exit_i82365(void) static void __exit exit_i82365(void)
{ {
int i; int i;
for (i = 0; i < sockets; i++) { for (i = 0; i < sockets; i++) {
pcmcia_unregister_socket(&socket[i].socket); pcmcia_unregister_socket(&socket[i].socket);
#ifdef CONFIG_PROC_FS
pcic_proc_remove(i);
#endif
} }
platform_device_unregister(&i82365_device); platform_device_unregister(&i82365_device);
if (poll_interval != 0) if (poll_interval != 0)
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/proc_fs.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/io.h> #include <asm/io.h>
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/config.h> #include <linux/config.h>
#include <linux/proc_fs.h>
#include <pcmcia/version.h> #include <pcmcia/version.h>
#include <pcmcia/cs_types.h> #include <pcmcia/cs_types.h>
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/proc_fs.h>
#include <pcmcia/ss.h> #include <pcmcia/ss.h>
#include <asm/hardware.h> #include <asm/hardware.h>
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/notifier.h> #include <linux/notifier.h>
#include <linux/proc_fs.h>
#include <linux/version.h> #include <linux/version.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
...@@ -615,9 +614,6 @@ sa1100_pcmcia_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *map ...@@ -615,9 +614,6 @@ sa1100_pcmcia_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *map
return 0; return 0;
} }
#if defined(CONFIG_PROC_FS)
struct bittbl { struct bittbl {
unsigned int mask; unsigned int mask;
const char *name; const char *name;
...@@ -659,17 +655,16 @@ dump_bits(char **p, const char *prefix, unsigned int val, struct bittbl *bits, i ...@@ -659,17 +655,16 @@ dump_bits(char **p, const char *prefix, unsigned int val, struct bittbl *bits, i
*p = b; *p = b;
} }
/* sa1100_pcmcia_proc_status() /* show_status()
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^ * ^^^^^^^^^^^^^^^^^^^^^^^^^^^
* Implements the /proc/bus/pccard/??/status file. * Implements the /sys/class/pcmcia_socket/??/status file.
* *
* Returns: the number of characters added to the buffer * Returns: the number of characters added to the buffer
*/ */
static int static ssize_t show_status(struct class_device *class_dev, char *buf)
sa1100_pcmcia_proc_status(char *buf, char **start, off_t pos,
int count, int *eof, void *data)
{ {
struct sa1100_pcmcia_socket *skt = data; struct sa1100_pcmcia_socket *skt = container_of(class_dev,
struct sa1100_pcmcia_socket, socket.dev);
unsigned int clock = cpufreq_get(0); unsigned int clock = cpufreq_get(0);
unsigned long mecr = MECR; unsigned long mecr = MECR;
char *p = buf; char *p = buf;
...@@ -701,29 +696,8 @@ sa1100_pcmcia_proc_status(char *buf, char **start, off_t pos, ...@@ -701,29 +696,8 @@ sa1100_pcmcia_proc_status(char *buf, char **start, off_t pos,
return p-buf; return p-buf;
} }
static CLASS_DEVICE_ATTR(status, S_IRUGO, show_status, NULL);
/* sa1100_pcmcia_proc_setup()
* ^^^^^^^^^^^^^^^^^^^^^^^^^^
* Implements the proc_setup() operation for the in-kernel PCMCIA
* service (formerly SS_ProcSetup in Card Services).
*
* Returns: 0 on success, -1 on error
*/
static void
sa1100_pcmcia_proc_setup(struct pcmcia_socket *sock, struct proc_dir_entry *base)
{
struct proc_dir_entry *entry;
if ((entry = create_proc_entry("status", 0, base)) == NULL){
printk(KERN_ERR "unable to install \"status\" procfs entry\n");
return;
}
entry->read_proc = sa1100_pcmcia_proc_status;
entry->data = to_sa1100_socket(sock);
}
#else
#define sa1100_pcmcia_proc_setup NULL
#endif /* defined(CONFIG_PROC_FS) */
static struct pccard_operations sa11xx_pcmcia_operations = { static struct pccard_operations sa11xx_pcmcia_operations = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
...@@ -736,7 +710,6 @@ static struct pccard_operations sa11xx_pcmcia_operations = { ...@@ -736,7 +710,6 @@ static struct pccard_operations sa11xx_pcmcia_operations = {
.set_socket = sa1100_pcmcia_set_socket, .set_socket = sa1100_pcmcia_set_socket,
.set_io_map = sa1100_pcmcia_set_io_map, .set_io_map = sa1100_pcmcia_set_io_map,
.set_mem_map = sa1100_pcmcia_set_mem_map, .set_mem_map = sa1100_pcmcia_set_mem_map,
.proc_setup = sa1100_pcmcia_proc_setup
}; };
int sa11xx_request_irqs(struct sa1100_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr) int sa11xx_request_irqs(struct sa1100_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr)
...@@ -914,6 +887,8 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, in ...@@ -914,6 +887,8 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, in
WARN_ON(skt->socket.sock != i); WARN_ON(skt->socket.sock != i);
add_timer(&skt->poll_timer); add_timer(&skt->poll_timer);
class_device_create_file(&skt->socket.dev, &class_device_attr_status);
} }
dev_set_drvdata(dev, sinfo); dev_set_drvdata(dev, sinfo);
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#ifndef _ASM_ARCH_PCMCIA #ifndef _ASM_ARCH_PCMCIA
#define _ASM_ARCH_PCMCIA #define _ASM_ARCH_PCMCIA
#include <linux/proc_fs.h>
/* include the world */ /* include the world */
#include <pcmcia/version.h> #include <pcmcia/version.h>
#include <pcmcia/cs_types.h> #include <pcmcia/cs_types.h>
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/proc_fs.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/device.h> #include <linux/device.h>
...@@ -897,10 +896,6 @@ static int tcic_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *m ...@@ -897,10 +896,6 @@ static int tcic_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *m
/*====================================================================*/ /*====================================================================*/
static void tcic_proc_setup(struct pcmcia_socket *sock, struct proc_dir_entry *base)
{
}
static int tcic_init(struct pcmcia_socket *s) static int tcic_init(struct pcmcia_socket *s)
{ {
int i; int i;
...@@ -936,7 +931,6 @@ static struct pccard_operations tcic_operations = { ...@@ -936,7 +931,6 @@ static struct pccard_operations tcic_operations = {
.set_socket = tcic_set_socket, .set_socket = tcic_set_socket,
.set_io_map = tcic_set_io_map, .set_io_map = tcic_set_io_map,
.set_mem_map = tcic_set_mem_map, .set_mem_map = tcic_set_mem_map,
.proc_setup = tcic_proc_setup,
}; };
/*====================================================================*/ /*====================================================================*/
......
...@@ -394,10 +394,6 @@ static int yenta_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map * ...@@ -394,10 +394,6 @@ static int yenta_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *
return 0; return 0;
} }
static void yenta_proc_setup(struct pcmcia_socket *sock, struct proc_dir_entry *base)
{
/* Not done yet */
}
static unsigned int yenta_events(struct yenta_socket *socket) static unsigned int yenta_events(struct yenta_socket *socket)
{ {
...@@ -803,7 +799,6 @@ static struct pccard_operations yenta_socket_operations = { ...@@ -803,7 +799,6 @@ static struct pccard_operations yenta_socket_operations = {
.set_socket = yenta_set_socket, .set_socket = yenta_set_socket,
.set_io_map = yenta_set_io_map, .set_io_map = yenta_set_io_map,
.set_mem_map = yenta_set_mem_map, .set_mem_map = yenta_set_mem_map,
.proc_setup = yenta_proc_setup,
}; };
......
...@@ -139,7 +139,6 @@ struct pccard_operations { ...@@ -139,7 +139,6 @@ struct pccard_operations {
int (*set_socket)(struct pcmcia_socket *sock, socket_state_t *state); int (*set_socket)(struct pcmcia_socket *sock, socket_state_t *state);
int (*set_io_map)(struct pcmcia_socket *sock, struct pccard_io_map *io); int (*set_io_map)(struct pcmcia_socket *sock, struct pccard_io_map *io);
int (*set_mem_map)(struct pcmcia_socket *sock, struct pccard_mem_map *mem); int (*set_mem_map)(struct pcmcia_socket *sock, struct pccard_mem_map *mem);
void (*proc_setup)(struct pcmcia_socket *sock, struct proc_dir_entry *base);
}; };
/* /*
...@@ -210,10 +209,6 @@ struct pcmcia_socket { ...@@ -210,10 +209,6 @@ struct pcmcia_socket {
/* deprecated */ /* deprecated */
unsigned int sock; /* socket number */ unsigned int sock; /* socket number */
#ifdef CONFIG_PROC_FS
struct proc_dir_entry *proc;
#endif
/* state thread */ /* state thread */
struct semaphore skt_sem; /* protects socket h/w state */ struct semaphore skt_sem; /* protects socket h/w state */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment