From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D31FCC2D0D1 for ; Sun, 29 Dec 2019 17:32:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AEB4D21D7E for ; Sun, 29 Dec 2019 17:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640743; bh=xfKwsvcvmHgYlI1ldJXlYOch5B0XS55Ja6bDBmwmAHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Mn6jx/WC5IaIfmQ6IAwcdIv4c4xwgQIwFV1IWp4YdtKz35vdBPVNi8OmRFXi6jFd4 NeiSH0W7wsHHxzWvf6HydiPixQ+kgreRr3k0vi4S9nGsy5SMiXZAj2GRJPu1zHw8eQ 3/xz+AJN5qHWMuu1QR4Su52kCQ0UAacVInFy50VE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729292AbfL2RcV (ORCPT ); Sun, 29 Dec 2019 12:32:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:60824 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729300AbfL2RcV (ORCPT ); Sun, 29 Dec 2019 12:32:21 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2D7E520409; Sun, 29 Dec 2019 17:32:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640740; bh=xfKwsvcvmHgYlI1ldJXlYOch5B0XS55Ja6bDBmwmAHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q/OuuGHy5DCAbNZS3/KngVjNf/uE992i926qOxHL7Z6t4AIPoWYgHqYlrcPr3LLIh P/4I+fpPq9m8jVj2UpQefBjahAkG/5svciPmyy/ypA4T11M6vCkCzc6OMP1Rn7HtwD 5n42qV3x1MVoTTOP1D8tqQErEko/7ZmLsC5dyRXM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marcel Holtmann , Sasha Levin Subject: [PATCH 4.19 118/219] rfkill: allocate static minor Date: Sun, 29 Dec 2019 18:18:40 +0100 Message-Id: <20191229162526.353368525@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162508.458551679@linuxfoundation.org> References: <20191229162508.458551679@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Marcel Holtmann [ Upstream commit 8670b2b8b029a6650d133486be9d2ace146fd29a ] udev has a feature of creating /dev/ device-nodes if it finds a devnode: modalias. This allows for auto-loading of modules that provide the node. This requires to use a statically allocated minor number for misc character devices. However, rfkill uses dynamic minor numbers and prevents auto-loading of the module. So allocate the next static misc minor number and use it for rfkill. Signed-off-by: Marcel Holtmann Link: https://lore.kernel.org/r/20191024174042.19851-1-marcel@holtmann.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- include/linux/miscdevice.h | 1 + net/rfkill/core.c | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h index 3247a3dc7934..b06b75776a32 100644 --- a/include/linux/miscdevice.h +++ b/include/linux/miscdevice.h @@ -57,6 +57,7 @@ #define UHID_MINOR 239 #define USERIO_MINOR 240 #define VHOST_VSOCK_MINOR 241 +#define RFKILL_MINOR 242 #define MISC_DYNAMIC_MINOR 255 struct device; diff --git a/net/rfkill/core.c b/net/rfkill/core.c index 1355f5ca8d22..7fbc8314f626 100644 --- a/net/rfkill/core.c +++ b/net/rfkill/core.c @@ -1328,10 +1328,12 @@ static const struct file_operations rfkill_fops = { .llseek = no_llseek, }; +#define RFKILL_NAME "rfkill" + static struct miscdevice rfkill_miscdev = { - .name = "rfkill", .fops = &rfkill_fops, - .minor = MISC_DYNAMIC_MINOR, + .name = RFKILL_NAME, + .minor = RFKILL_MINOR, }; static int __init rfkill_init(void) @@ -1383,3 +1385,6 @@ static void __exit rfkill_exit(void) class_unregister(&rfkill_class); } module_exit(rfkill_exit); + +MODULE_ALIAS_MISCDEV(RFKILL_MINOR); +MODULE_ALIAS("devname:" RFKILL_NAME); -- 2.20.1