diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-03-12 09:50:17 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-17 23:47:05 -0400 |
commit | 9c89a181a09eaafca5fc638c3b7ce1620227f60a (patch) | |
tree | e929f5d6c8da15e67a139fa7585ba605bd21c728 | |
parent | 2915e5ef35d103a5ecae15d9ecc614fcd0dc48f4 (diff) |
V4L/DVB: ir-core: Export IR name via uevent
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/IR/ir-keytable.c | 1 | ||||
-rw-r--r-- | drivers/media/IR/ir-sysfs.c | 25 |
2 files changed, 23 insertions, 3 deletions
diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index af1f4d7fb910..6db3ff74659b 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c | |||
@@ -419,6 +419,7 @@ int ir_input_register(struct input_dev *input_dev, | |||
419 | 419 | ||
420 | spin_lock_init(&ir_dev->rc_tab.lock); | 420 | spin_lock_init(&ir_dev->rc_tab.lock); |
421 | 421 | ||
422 | ir_dev->rc_tab.name = rc_tab->name; | ||
422 | ir_dev->rc_tab.size = ir_roundup_tablesize(rc_tab->size); | 423 | ir_dev->rc_tab.size = ir_roundup_tablesize(rc_tab->size); |
423 | ir_dev->rc_tab.scan = kzalloc(ir_dev->rc_tab.size * | 424 | ir_dev->rc_tab.scan = kzalloc(ir_dev->rc_tab.size * |
424 | sizeof(struct ir_scancode), GFP_KERNEL); | 425 | sizeof(struct ir_scancode), GFP_KERNEL); |
diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c index 59bd388be8d7..6d63657b5685 100644 --- a/drivers/media/IR/ir-sysfs.c +++ b/drivers/media/IR/ir-sysfs.c | |||
@@ -126,6 +126,24 @@ static ssize_t store_protocol(struct device *d, | |||
126 | return len; | 126 | return len; |
127 | } | 127 | } |
128 | 128 | ||
129 | |||
130 | #define ADD_HOTPLUG_VAR(fmt, val...) \ | ||
131 | do { \ | ||
132 | int err = add_uevent_var(env, fmt, val); \ | ||
133 | if (err) \ | ||
134 | return err; \ | ||
135 | } while (0) | ||
136 | |||
137 | static int ir_dev_uevent(struct device *device, struct kobj_uevent_env *env) | ||
138 | { | ||
139 | struct ir_input_dev *ir_dev = dev_get_drvdata(device); | ||
140 | |||
141 | if (ir_dev->rc_tab.name) | ||
142 | ADD_HOTPLUG_VAR("NAME=\"%s\"", ir_dev->rc_tab.name); | ||
143 | |||
144 | return 0; | ||
145 | } | ||
146 | |||
129 | /* | 147 | /* |
130 | * Static device attribute struct with the sysfs attributes for IR's | 148 | * Static device attribute struct with the sysfs attributes for IR's |
131 | */ | 149 | */ |
@@ -148,9 +166,9 @@ static const struct attribute_group *ir_dev_attr_groups[] = { | |||
148 | 166 | ||
149 | static struct device_type ir_dev_type = { | 167 | static struct device_type ir_dev_type = { |
150 | .groups = ir_dev_attr_groups, | 168 | .groups = ir_dev_attr_groups, |
169 | .uevent = ir_dev_uevent, | ||
151 | }; | 170 | }; |
152 | 171 | ||
153 | |||
154 | /** | 172 | /** |
155 | * ir_register_class() - creates the sysfs for /sys/class/irrcv/irrcv? | 173 | * ir_register_class() - creates the sysfs for /sys/class/irrcv/irrcv? |
156 | * @input_dev: the struct input_dev descriptor of the device | 174 | * @input_dev: the struct input_dev descriptor of the device |
@@ -173,6 +191,7 @@ int ir_register_class(struct input_dev *input_dev) | |||
173 | ir_dev->dev.class = &ir_input_class; | 191 | ir_dev->dev.class = &ir_input_class; |
174 | ir_dev->dev.parent = input_dev->dev.parent; | 192 | ir_dev->dev.parent = input_dev->dev.parent; |
175 | dev_set_name(&ir_dev->dev, "irrcv%d", devno); | 193 | dev_set_name(&ir_dev->dev, "irrcv%d", devno); |
194 | dev_set_drvdata(&ir_dev->dev, ir_dev); | ||
176 | rc = device_register(&ir_dev->dev); | 195 | rc = device_register(&ir_dev->dev); |
177 | if (rc) | 196 | if (rc) |
178 | return rc; | 197 | return rc; |
@@ -187,8 +206,8 @@ int ir_register_class(struct input_dev *input_dev) | |||
187 | 206 | ||
188 | __module_get(THIS_MODULE); | 207 | __module_get(THIS_MODULE); |
189 | 208 | ||
190 | path = kobject_get_path(&input_dev->dev.kobj, GFP_KERNEL); | 209 | path = kobject_get_path(&ir_dev->dev.kobj, GFP_KERNEL); |
191 | printk(KERN_INFO "%s: %s associated with sysfs %s\n", | 210 | printk(KERN_INFO "%s: %s as %s\n", |
192 | dev_name(&ir_dev->dev), | 211 | dev_name(&ir_dev->dev), |
193 | input_dev->name ? input_dev->name : "Unspecified device", | 212 | input_dev->name ? input_dev->name : "Unspecified device", |
194 | path ? path : "N/A"); | 213 | path ? path : "N/A"); |