@@ -138,6 +138,7 @@ int ir_register_class(struct input_dev *input_dev)
{
int rc;
struct kobject *kobj;
+ const char *path;
struct ir_input_dev *ir_dev = input_get_drvdata(input_dev);
int devno = find_first_zero_bit(&ir_core_dev_number,
@@ -152,13 +153,26 @@ int ir_register_class(struct input_dev *input_dev)
"irrcv%d", devno);
kobj = &ir_dev->class_dev->kobj;
- printk(KERN_WARNING "Creating IR device %s\n", kobject_name(kobj));
rc = sysfs_create_group(kobj, &ir_dev->attr);
if (unlikely(rc < 0)) {
device_destroy(ir_input_class, input_dev->dev.devt);
return -ENOMEM;
}
+ rc = sysfs_create_link(kobj, &input_dev->dev.kobj, "input");
+ if (unlikely(rc < 0)) {
+ sysfs_remove_group(kobj, &ir_dev->attr);
+ device_destroy(ir_input_class, input_dev->dev.devt);
+ return -ENOMEM;
+ }
+
+ path = kobject_get_path(&input_dev->dev.kobj, GFP_KERNEL);
+ printk(KERN_INFO "%s: %s associated with sysfs %s\n",
+ kobject_name(kobj),
+ input_dev->name ? input_dev->name : "Unspecified device",
+ path ? path : "N/A");
+ kfree(path);
+
ir_dev->devno = devno;
set_bit(devno, &ir_core_dev_number);
@@ -181,6 +195,8 @@ void ir_unregister_class(struct input_dev *input_dev)
kobj = &ir_dev->class_dev->kobj;
+ sysfs_remove_link(kobj, "input");
+
sysfs_remove_group(kobj, &ir_dev->attr);
device_destroy(ir_input_class, input_dev->dev.devt);