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

[PCMCIA] Use a class interface to provide sysfs attributes.

Patch from Dominik Brodowski
parent 61e4f592
......@@ -695,13 +695,6 @@ static int pccardd(void *__skt)
skt->thread = NULL;
complete_and_exit(&skt->thread_done, 0);
}
if (pccard_sysfs_init(skt)) {
printk(KERN_WARNING "PCMCIA: unable to register sysfs attributes for socket 0x%p\n",
skt);
skt->thread = NULL;
class_device_unregister(&skt->dev);
complete_and_exit(&skt->thread_done, 0);
}
complete(&skt->thread_done);
add_wait_queue(&skt->thread_wait, &wait);
......@@ -2175,16 +2168,21 @@ EXPORT_SYMBOL(pcmcia_socket_class);
static int __init init_pcmcia_cs(void)
{
printk(KERN_INFO "%s\n", release);
printk(KERN_INFO " %s\n", options);
int ret;
printk(KERN_INFO "%s\n", release);
printk(KERN_INFO " %s\n", options);
return class_register(&pcmcia_socket_class);
ret = class_register(&pcmcia_socket_class);
if (ret)
return (ret);
return class_interface_register(&pccard_sysfs_interface);
}
static void __exit exit_pcmcia_cs(void)
{
printk(KERN_INFO "unloading Kernel Card Services\n");
release_resource_db();
class_interface_unregister(&pccard_sysfs_interface);
class_unregister(&pcmcia_socket_class);
}
......
......@@ -193,8 +193,9 @@ int adjust_resource_info(client_handle_t handle, adjust_t *adj);
void release_resource_db(void);
/* In socket_sysfs.c */
int pccard_sysfs_init(struct pcmcia_socket *s);
extern struct class_interface pccard_sysfs_interface;
/* In cs.c */
extern struct rw_semaphore pcmcia_socket_list_rwsem;
extern struct list_head pcmcia_socket_list;
......
......@@ -132,14 +132,27 @@ static struct class_device_attribute *pccard_socket_attributes[] = {
NULL,
};
int pccard_sysfs_init(struct pcmcia_socket *s)
static int __devinit pccard_sysfs_add_socket(struct class_device *class_dev)
{
struct class_device_attribute *attr;
unsigned int i;
int ret = 0;
for (i = 0; (attr = pccard_socket_attributes[i]); i++) {
if ((ret = class_device_create_file(&s->dev, attr)))
if ((ret = class_device_create_file(class_dev, attr)))
return (ret);
}
return (ret);
}
static void __devexit pccard_sysfs_remove_socket(struct class_device *class_dev)
{
struct class_device_attribute *attr;
unsigned int i;
for (i = 0; (attr = pccard_socket_attributes[i]); i++)
class_device_remove_file(class_dev, attr);
}
struct class_interface pccard_sysfs_interface = {
.class = &pcmcia_socket_class,
.add = &pccard_sysfs_add_socket,
.remove = __devexit_p(&pccard_sysfs_remove_socket),
};
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