From patchwork Thu Mar 11 15:46:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 84939 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2BFkW4D007135 for ; Thu, 11 Mar 2010 15:46:32 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933132Ab0CKPq3 (ORCPT ); Thu, 11 Mar 2010 10:46:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:31923 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933109Ab0CKPq2 (ORCPT ); Thu, 11 Mar 2010 10:46:28 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2BFkRTg022315 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 11 Mar 2010 10:46:27 -0500 Received: from [10.3.234.51] (vpn-234-51.phx2.redhat.com [10.3.234.51]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2BFkJnp012361 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 11 Mar 2010 10:46:25 -0500 Message-ID: <4B99104B.3090307@redhat.com> Date: Thu, 11 Mar 2010 12:46:19 -0300 From: Mauro Carvalho Chehab User-Agent: Thunderbird 2.0.0.22 (X11/20090609) MIME-Version: 1.0 To: Linux Media Mailing List CC: Dmitry Torokhov , linux-input@vger.kernel.org Subject: [PATCH] V4L/DVB: ir: Add a link to associate /sys/class/ir/irrcv with the input device X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 11 Mar 2010 15:46:32 +0000 (UTC) diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c index bf5fbcd..7de32e7 100644 --- a/drivers/media/IR/ir-sysfs.c +++ b/drivers/media/IR/ir-sysfs.c @@ -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);