Commit 4356d73d authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

pcmcia: remove pccard_sysfs_interface warnings

Make the PCMCIA core stop using class_interface to hide socket attribute
registration.  This removes the associated section mismatch warnings, and
helps get to the point where that mechanism can finally be removed.

Simplify that attribute registration by using an attribute_group.
This is a net shrink in object size.
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 4f452e8a
...@@ -652,6 +652,9 @@ static int pccardd(void *__skt) ...@@ -652,6 +652,9 @@ static int pccardd(void *__skt)
complete(&skt->thread_done); complete(&skt->thread_done);
return 0; return 0;
} }
ret = pccard_sysfs_add_socket(&skt->dev);
if (ret)
dev_warn(&skt->dev, "err %d adding socket attributes\n", ret);
add_wait_queue(&skt->thread_wait, &wait); add_wait_queue(&skt->thread_wait, &wait);
complete(&skt->thread_done); complete(&skt->thread_done);
...@@ -694,6 +697,7 @@ static int pccardd(void *__skt) ...@@ -694,6 +697,7 @@ static int pccardd(void *__skt)
remove_wait_queue(&skt->thread_wait, &wait); remove_wait_queue(&skt->thread_wait, &wait);
/* remove from the device core */ /* remove from the device core */
pccard_sysfs_remove_socket(&skt->dev);
device_unregister(&skt->dev); device_unregister(&skt->dev);
return 0; return 0;
...@@ -940,20 +944,13 @@ EXPORT_SYMBOL(pcmcia_socket_class); ...@@ -940,20 +944,13 @@ EXPORT_SYMBOL(pcmcia_socket_class);
static int __init init_pcmcia_cs(void) static int __init init_pcmcia_cs(void)
{ {
int ret;
init_completion(&pcmcia_unload); init_completion(&pcmcia_unload);
ret = class_register(&pcmcia_socket_class); return class_register(&pcmcia_socket_class);
if (ret)
return (ret);
return class_interface_register(&pccard_sysfs_interface);
} }
static void __exit exit_pcmcia_cs(void) static void __exit exit_pcmcia_cs(void)
{ {
class_interface_unregister(&pccard_sysfs_interface);
class_unregister(&pcmcia_socket_class); class_unregister(&pcmcia_socket_class);
wait_for_completion(&pcmcia_unload); wait_for_completion(&pcmcia_unload);
} }
......
...@@ -121,7 +121,8 @@ struct resource *pcmcia_find_mem_region(u_long base, u_long num, u_long align, ...@@ -121,7 +121,8 @@ struct resource *pcmcia_find_mem_region(u_long base, u_long num, u_long align,
void release_resource_db(struct pcmcia_socket *s); void release_resource_db(struct pcmcia_socket *s);
/* In socket_sysfs.c */ /* In socket_sysfs.c */
extern struct class_interface pccard_sysfs_interface; extern int pccard_sysfs_add_socket(struct device *dev);
extern void pccard_sysfs_remove_socket(struct device *dev);
/* In cs.c */ /* In cs.c */
extern struct rw_semaphore pcmcia_socket_list_rwsem; extern struct rw_semaphore pcmcia_socket_list_rwsem;
......
...@@ -356,19 +356,23 @@ static ssize_t pccard_store_cis(struct kobject *kobj, ...@@ -356,19 +356,23 @@ static ssize_t pccard_store_cis(struct kobject *kobj,
} }
static struct device_attribute *pccard_socket_attributes[] = { static struct attribute *pccard_socket_attributes[] = {
&dev_attr_card_type, &dev_attr_card_type.attr,
&dev_attr_card_voltage, &dev_attr_card_voltage.attr,
&dev_attr_card_vpp, &dev_attr_card_vpp.attr,
&dev_attr_card_vcc, &dev_attr_card_vcc.attr,
&dev_attr_card_insert, &dev_attr_card_insert.attr,
&dev_attr_card_pm_state, &dev_attr_card_pm_state.attr,
&dev_attr_card_eject, &dev_attr_card_eject.attr,
&dev_attr_card_irq_mask, &dev_attr_card_irq_mask.attr,
&dev_attr_available_resources_setup_done, &dev_attr_available_resources_setup_done.attr,
NULL, NULL,
}; };
static const struct attribute_group socket_attrs = {
.attrs = pccard_socket_attributes,
};
static struct bin_attribute pccard_cis_attr = { static struct bin_attribute pccard_cis_attr = {
.attr = { .name = "cis", .mode = S_IRUGO | S_IWUSR }, .attr = { .name = "cis", .mode = S_IRUGO | S_IWUSR },
.size = 0x200, .size = 0x200,
...@@ -376,35 +380,21 @@ static struct bin_attribute pccard_cis_attr = { ...@@ -376,35 +380,21 @@ static struct bin_attribute pccard_cis_attr = {
.write = pccard_store_cis, .write = pccard_store_cis,
}; };
static int __devinit pccard_sysfs_add_socket(struct device *dev, int pccard_sysfs_add_socket(struct device *dev)
struct class_interface *class_intf)
{ {
struct device_attribute **attr;
int ret = 0; int ret = 0;
for (attr = pccard_socket_attributes; *attr; attr++) { ret = sysfs_create_group(&dev->kobj, &socket_attrs);
ret = device_create_file(dev, *attr); if (!ret) {
ret = sysfs_create_bin_file(&dev->kobj, &pccard_cis_attr);
if (ret) if (ret)
break; sysfs_remove_group(&dev->kobj, &socket_attrs);
} }
if (!ret)
ret = sysfs_create_bin_file(&dev->kobj, &pccard_cis_attr);
return ret; return ret;
} }
static void __devexit pccard_sysfs_remove_socket(struct device *dev, void pccard_sysfs_remove_socket(struct device *dev)
struct class_interface *class_intf)
{ {
struct device_attribute **attr;
sysfs_remove_bin_file(&dev->kobj, &pccard_cis_attr); sysfs_remove_bin_file(&dev->kobj, &pccard_cis_attr);
for (attr = pccard_socket_attributes; *attr; attr++) sysfs_remove_group(&dev->kobj, &socket_attrs);
device_remove_file(dev, *attr);
} }
struct class_interface pccard_sysfs_interface = {
.class = &pcmcia_socket_class,
.add_dev = &pccard_sysfs_add_socket,
.remove_dev = __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