From patchwork Mon Sep 9 16:33:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 2862541 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E076BBF43F for ; Mon, 9 Sep 2013 16:34:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 802CC2037E for ; Mon, 9 Sep 2013 16:34:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3ECA120377 for ; Mon, 9 Sep 2013 16:34:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754355Ab3IIQeZ (ORCPT ); Mon, 9 Sep 2013 12:34:25 -0400 Received: from mail-bk0-f41.google.com ([209.85.214.41]:63529 "EHLO mail-bk0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752929Ab3IIQeY (ORCPT ); Mon, 9 Sep 2013 12:34:24 -0400 Received: by mail-bk0-f41.google.com with SMTP id na10so2509945bkb.28 for ; Mon, 09 Sep 2013 09:34:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=2G3v7pL2GmZRY0m9PwJDk+y2VNLF04XjNOagWT4jzDo=; b=qXQxU4WmEu6qsb5ApHERbj+gPX1EeAmY6noJnnvtga5l6HpchJmvejFKetMMNBk4pj BSRUAZlo1ZWrGpKnRf8O5exghvqIMaQZTIr/z0mlqnoHCYUfG+yeSIDHn2FR+VPPVlNq M3uZF7pOn63wpOpa2KqQXBN93E+DIZjOi1wpY++qsb39Lu9YAzPGp72vl+gHpX0FgNlV mMstG6GzTsf9JZ3qtvJVIAwG70bClEZWu5ciw0DM9zO8TF5LmUPBTqxIV9DfTdjqjIZ4 H8IZMpFX72diQDLysCPg6ZEkCiue8gCesY0QEhA+x9RynEGAkryrdmYbAzYXXYsZ1lJh DH/w== X-Received: by 10.204.121.201 with SMTP id i9mr15431071bkr.13.1378744463007; Mon, 09 Sep 2013 09:34:23 -0700 (PDT) Received: from localhost.localdomain (stgt-5f71a1fc.pool.mediaWays.net. [95.113.161.252]) by mx.google.com with ESMTPSA id pw1sm3632000bkb.8.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 09 Sep 2013 09:34:22 -0700 (PDT) From: David Herrmann To: linux-input@vger.kernel.org Cc: Tom Gundersen , Kay Sievers , Marcel Holtmann , linux-kernel@vger.kernel.org, David Herrmann Subject: [PATCH] HID: uhid: allocate static minor Date: Mon, 9 Sep 2013 18:33:54 +0200 Message-Id: <1378744434-10883-1-git-send-email-dh.herrmann@gmail.com> X-Mailer: git-send-email 1.8.4 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP udev has this nice feature of creating "dead" /dev/ device-nodes if it finds a devnode: modalias. Once the node is accessed, the kernel automatically loads the module that provides the node. However, this requires udev to know the major:minor code to use for the node. This feature was introduced by: commit 578454ff7eab61d13a26b568f99a89a2c9edc881 Author: Kay Sievers Date: Thu May 20 18:07:20 2010 +0200 driver core: add devname module aliases to allow module on-demand auto-loading However, uhid uses dynamic minor numbers so this doesn't actually work. We need to load uhid to know which minor it's going to use. Hence, allocate a static minor (just like uinput does) and we're good to go. Reported-by: Tom Gundersen Signed-off-by: David Herrmann --- drivers/hid/uhid.c | 3 ++- include/linux/miscdevice.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c index 5bf2fb7..93b00d7 100644 --- a/drivers/hid/uhid.c +++ b/drivers/hid/uhid.c @@ -615,7 +615,7 @@ static const struct file_operations uhid_fops = { static struct miscdevice uhid_misc = { .fops = &uhid_fops, - .minor = MISC_DYNAMIC_MINOR, + .minor = UHID_MINOR, .name = UHID_NAME, }; @@ -634,4 +634,5 @@ module_exit(uhid_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("David Herrmann "); MODULE_DESCRIPTION("User-space I/O driver support for HID subsystem"); +MODULE_ALIAS_MISCDEV(UHID_MINOR); MODULE_ALIAS("devname:" UHID_NAME); diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h index 09c2300..cb35835 100644 --- a/include/linux/miscdevice.h +++ b/include/linux/miscdevice.h @@ -45,6 +45,7 @@ #define MAPPER_CTRL_MINOR 236 #define LOOP_CTRL_MINOR 237 #define VHOST_NET_MINOR 238 +#define UHID_MINOR 239 #define MISC_DYNAMIC_MINOR 255 struct device;