aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/firmware_class.c59
1 files changed, 24 insertions, 35 deletions
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index d45d1e1c40a4..d351e773f439 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -101,9 +101,26 @@ firmware_timeout_store(struct class *class,
101 return count; 101 return count;
102} 102}
103 103
104static CLASS_ATTR(timeout, 0644, firmware_timeout_show, firmware_timeout_store); 104static struct class_attribute firmware_class_attrs[] = {
105 __ATTR(timeout, S_IWUSR | S_IRUGO,
106 firmware_timeout_show, firmware_timeout_store),
107 __ATTR_NULL
108};
105 109
106static void fw_dev_release(struct device *dev); 110static void fw_dev_release(struct device *dev)
111{
112 struct firmware_priv *fw_priv = dev_get_drvdata(dev);
113 int i;
114
115 for (i = 0; i < fw_priv->nr_pages; i++)
116 __free_page(fw_priv->pages[i]);
117 kfree(fw_priv->pages);
118 kfree(fw_priv->fw_id);
119 kfree(fw_priv);
120 kfree(dev);
121
122 module_put(THIS_MODULE);
123}
107 124
108static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env) 125static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env)
109{ 126{
@@ -121,6 +138,7 @@ static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env)
121 138
122static struct class firmware_class = { 139static struct class firmware_class = {
123 .name = "firmware", 140 .name = "firmware",
141 .class_attrs = firmware_class_attrs,
124 .dev_uevent = firmware_uevent, 142 .dev_uevent = firmware_uevent,
125 .dev_release = fw_dev_release, 143 .dev_release = fw_dev_release,
126}; 144};
@@ -370,21 +388,6 @@ static struct bin_attribute firmware_attr_data_tmpl = {
370 .write = firmware_data_write, 388 .write = firmware_data_write,
371}; 389};
372 390
373static void fw_dev_release(struct device *dev)
374{
375 struct firmware_priv *fw_priv = dev_get_drvdata(dev);
376 int i;
377
378 for (i = 0; i < fw_priv->nr_pages; i++)
379 __free_page(fw_priv->pages[i]);
380 kfree(fw_priv->pages);
381 kfree(fw_priv->fw_id);
382 kfree(fw_priv);
383 kfree(dev);
384
385 module_put(THIS_MODULE);
386}
387
388static void 391static void
389firmware_class_timeout(u_long data) 392firmware_class_timeout(u_long data)
390{ 393{
@@ -689,26 +692,12 @@ request_firmware_nowait(
689 return 0; 692 return 0;
690} 693}
691 694
692static int __init 695static int __init firmware_class_init(void)
693firmware_class_init(void)
694{ 696{
695 int error; 697 return class_register(&firmware_class);
696 error = class_register(&firmware_class);
697 if (error) {
698 printk(KERN_ERR "%s: class_register failed\n", __func__);
699 return error;
700 }
701 error = class_create_file(&firmware_class, &class_attr_timeout);
702 if (error) {
703 printk(KERN_ERR "%s: class_create_file failed\n",
704 __func__);
705 class_unregister(&firmware_class);
706 }
707 return error;
708
709} 698}
710static void __exit 699
711firmware_class_exit(void) 700static void __exit firmware_class_exit(void)
712{ 701{
713 class_unregister(&firmware_class); 702 class_unregister(&firmware_class);
714} 703}