Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 196045
b: refs/heads/master
c: 673fae9
h: refs/heads/master
i:
  196043: 567c243
v: v3
  • Loading branch information
Dmitry Torokhov authored and Greg Kroah-Hartman committed May 21, 2010
1 parent f3628ed commit 9ab8a68
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 36 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e9045f9178f3e3445a3a5b85206f8681b3869562
refs/heads/master: 673fae90d5ee4ae2b6403f9d45af7ff640f06a60
59 changes: 24 additions & 35 deletions trunk/drivers/base/firmware_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,26 @@ firmware_timeout_store(struct class *class,
return count;
}

static CLASS_ATTR(timeout, 0644, firmware_timeout_show, firmware_timeout_store);
static struct class_attribute firmware_class_attrs[] = {
__ATTR(timeout, S_IWUSR | S_IRUGO,
firmware_timeout_show, firmware_timeout_store),
__ATTR_NULL
};

static void fw_dev_release(struct device *dev);
static void fw_dev_release(struct device *dev)
{
struct firmware_priv *fw_priv = dev_get_drvdata(dev);
int i;

for (i = 0; i < fw_priv->nr_pages; i++)
__free_page(fw_priv->pages[i]);
kfree(fw_priv->pages);
kfree(fw_priv->fw_id);
kfree(fw_priv);
kfree(dev);

module_put(THIS_MODULE);
}

static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env)
{
Expand All @@ -121,6 +138,7 @@ static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env)

static struct class firmware_class = {
.name = "firmware",
.class_attrs = firmware_class_attrs,
.dev_uevent = firmware_uevent,
.dev_release = fw_dev_release,
};
Expand Down Expand Up @@ -370,21 +388,6 @@ static struct bin_attribute firmware_attr_data_tmpl = {
.write = firmware_data_write,
};

static void fw_dev_release(struct device *dev)
{
struct firmware_priv *fw_priv = dev_get_drvdata(dev);
int i;

for (i = 0; i < fw_priv->nr_pages; i++)
__free_page(fw_priv->pages[i]);
kfree(fw_priv->pages);
kfree(fw_priv->fw_id);
kfree(fw_priv);
kfree(dev);

module_put(THIS_MODULE);
}

static void
firmware_class_timeout(u_long data)
{
Expand Down Expand Up @@ -689,26 +692,12 @@ request_firmware_nowait(
return 0;
}

static int __init
firmware_class_init(void)
static int __init firmware_class_init(void)
{
int error;
error = class_register(&firmware_class);
if (error) {
printk(KERN_ERR "%s: class_register failed\n", __func__);
return error;
}
error = class_create_file(&firmware_class, &class_attr_timeout);
if (error) {
printk(KERN_ERR "%s: class_create_file failed\n",
__func__);
class_unregister(&firmware_class);
}
return error;

return class_register(&firmware_class);
}
static void __exit
firmware_class_exit(void)

static void __exit firmware_class_exit(void)
{
class_unregister(&firmware_class);
}
Expand Down

0 comments on commit 9ab8a68

Please sign in to comment.