Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 192801
b: refs/heads/master
c: 9c89a18
h: refs/heads/master
i:
  192799: ffb4374
v: v3
  • Loading branch information
Mauro Carvalho Chehab committed May 18, 2010
1 parent 1b9ab30 commit 0908fc8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 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: 2915e5ef35d103a5ecae15d9ecc614fcd0dc48f4
refs/heads/master: 9c89a181a09eaafca5fc638c3b7ce1620227f60a
1 change: 1 addition & 0 deletions trunk/drivers/media/IR/ir-keytable.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ int ir_input_register(struct input_dev *input_dev,

spin_lock_init(&ir_dev->rc_tab.lock);

ir_dev->rc_tab.name = rc_tab->name;
ir_dev->rc_tab.size = ir_roundup_tablesize(rc_tab->size);
ir_dev->rc_tab.scan = kzalloc(ir_dev->rc_tab.size *
sizeof(struct ir_scancode), GFP_KERNEL);
Expand Down
25 changes: 22 additions & 3 deletions trunk/drivers/media/IR/ir-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,24 @@ static ssize_t store_protocol(struct device *d,
return len;
}


#define ADD_HOTPLUG_VAR(fmt, val...) \
do { \
int err = add_uevent_var(env, fmt, val); \
if (err) \
return err; \
} while (0)

static int ir_dev_uevent(struct device *device, struct kobj_uevent_env *env)
{
struct ir_input_dev *ir_dev = dev_get_drvdata(device);

if (ir_dev->rc_tab.name)
ADD_HOTPLUG_VAR("NAME=\"%s\"", ir_dev->rc_tab.name);

return 0;
}

/*
* Static device attribute struct with the sysfs attributes for IR's
*/
Expand All @@ -148,9 +166,9 @@ static const struct attribute_group *ir_dev_attr_groups[] = {

static struct device_type ir_dev_type = {
.groups = ir_dev_attr_groups,
.uevent = ir_dev_uevent,
};


/**
* ir_register_class() - creates the sysfs for /sys/class/irrcv/irrcv?
* @input_dev: the struct input_dev descriptor of the device
Expand All @@ -173,6 +191,7 @@ int ir_register_class(struct input_dev *input_dev)
ir_dev->dev.class = &ir_input_class;
ir_dev->dev.parent = input_dev->dev.parent;
dev_set_name(&ir_dev->dev, "irrcv%d", devno);
dev_set_drvdata(&ir_dev->dev, ir_dev);
rc = device_register(&ir_dev->dev);
if (rc)
return rc;
Expand All @@ -187,8 +206,8 @@ int ir_register_class(struct input_dev *input_dev)

__module_get(THIS_MODULE);

path = kobject_get_path(&input_dev->dev.kobj, GFP_KERNEL);
printk(KERN_INFO "%s: %s associated with sysfs %s\n",
path = kobject_get_path(&ir_dev->dev.kobj, GFP_KERNEL);
printk(KERN_INFO "%s: %s as %s\n",
dev_name(&ir_dev->dev),
input_dev->name ? input_dev->name : "Unspecified device",
path ? path : "N/A");
Expand Down

0 comments on commit 0908fc8

Please sign in to comment.