Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2010405ybh; Sun, 8 Mar 2020 19:29:32 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuldqII1AF4zro83F2K7s3gA0eHgv4Yu+dnaLnXYhF73BFbnGHqA5gNH9Qfn/vSpIifyB0F X-Received: by 2002:a9d:450a:: with SMTP id w10mr4042395ote.114.1583720972067; Sun, 08 Mar 2020 19:29:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583720972; cv=none; d=google.com; s=arc-20160816; b=nJo4lxqLsPmy9qb49wUMM5DYVS6fOQjFjdzcAVHbao6IGcH+FokInb/s0XFBa27Wan QZekITXFtcZZISZmfrS1p4nOGvmfW0RzGrbV0+7A0BVuRBNAloMH2huEIkk3c9zQV6oL UlNEqLxj+zB/87nHDGhVSvmNWvVscXCqXDNJg4GCIo4wQSnGlZ5vGbXHglV92Fl6rD1b gMpmJgYg6rOme7GlszOYt024R0DzMTZ+P9nnxEN0kN2VApw37lfgoZh6GaNVftNNmEhi mLtG6JBjjF1vOt7LRCqWz3MYSpRdC4rsoBcaidZGArymIzwERJAjJhxknGnq6BummjEr KK3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=HMwZoEE+7ccFZK+8oLvgSBtGicHQVdPT9j30hR6yRhE=; b=HO1ZHJO/1OrIwQu2nOYk/CaMoyBDqsTLncEo+mlUjxNW3A8kyPUAjYcDTz05iR6pHC +eldH3//fOVmhTwE5QLGgAuCOha5Gv9WNGt1OklSstsU6234UCbXMby714InlXOqHFSN 0t7k9ifszph+3xPj/p0U/DZkFe6BiY5rY+2AdySpLqL3tQTa9lza8gwOc5akbOkVmGCU 6BvIDLPBn/w4IOya6uOW04lHcDYHy6sf5GOvGWZ+0zwse49jHPiix18A1dZAgPPtDVq6 SiEnHbyR7xnaue87TjS9dPNf2x13jbTyt9TLUdAANXMpy3f2xpbAg7N6J7s1ZjYmvMUh lNXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="G8/2ZwP3"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j80si3763408oib.144.2020.03.08.19.29.20; Sun, 08 Mar 2020 19:29:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="G8/2ZwP3"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727131AbgCICS2 (ORCPT + 99 others); Sun, 8 Mar 2020 22:18:28 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:34357 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726595AbgCICS2 (ORCPT ); Sun, 8 Mar 2020 22:18:28 -0400 Received: by mail-pl1-f193.google.com with SMTP id a23so642440plm.1 for ; Sun, 08 Mar 2020 19:18:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HMwZoEE+7ccFZK+8oLvgSBtGicHQVdPT9j30hR6yRhE=; b=G8/2ZwP3L6NLPQ75+Dw6l6SDFMEdcBa0fYV47kE5wH4poHvo++Fv8DFGP7j58HErYg 5BNzx1DaSu423F3a5nWbTWApFy5NFXjAcqkhiGdgiAN62nGNLpzxoTTphNfTqth6V4/N ZX/gYzoRA+tysRsDyKtrCBtDnZ1Q3hKFoJ7d0wuqLW9uWLEcQpmc2bXZ7uOIXrH75rLz FBUQMTNw9zihhA7j2Au2pC9K+N5L1GakWTyNXWkv6YJPXLnQI+Fbt3SHTfPfQDlZHvtn /f/eEfCledSVckE3WPJXdfRVvhcRSkOV6EGgpmmiHGdYe6uGeg9rWwwWlP4Tsre1IbK3 CzBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HMwZoEE+7ccFZK+8oLvgSBtGicHQVdPT9j30hR6yRhE=; b=ipcKvS619t3LZm8k3oItDixpyYlRyhx3jKVwM8NtliDrqMdLmDwCuLQoFaHYK3Ki6Z /RslnSgolTpaHeZ2+bBli4+RTmjtyPOmBQ8hK5/JLMMhDEdGl/SA3U0EqT7Scny6dShh MwkECMFPsqqMP1rZh+OioD2mPLNa/pkjSDJx8KAKch7CoB7bYPwnXbtRGpapA35eAoFV zkfCuY/ru0HVIvZPWV9+NazkGcOwdfeK+2ZVjdaSWwqso4Y6oAKie/3PNN8b3xS3+NIp fTOa+UowRAdR50lRJHkWqCPwUDiOJd7EHTPOl73R4oZ2j9JTikRrPTc51ATqe88HLiOv kLCA== X-Gm-Message-State: ANhLgQ2JK1mPZl0CmCvzWKFPBpK6uq2KJladyg/mIkp7zhGfX/sppJ50 4x7loSLc0qJoArXEYeqck7z+Mt1r X-Received: by 2002:a17:90a:3270:: with SMTP id k103mr16700071pjb.30.1583720305442; Sun, 08 Mar 2020 19:18:25 -0700 (PDT) Received: from ZB-PF114XEA.360buyad.local ([103.90.76.242]) by smtp.gmail.com with ESMTPSA id r12sm42394043pgu.93.2020.03.08.19.18.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Mar 2020 19:18:24 -0700 (PDT) From: Zhenzhong Duan To: linux-kernel@vger.kernel.org Cc: jdike@addtoit.com, richard@nod.at, anton.ivanov@cambridgegreys.com, miguel.ojeda.sandonis@gmail.com, willy@haproxy.com, ksenija.stanojevic@gmail.com, arnd@arndb.de, gregkh@linuxfoundation.org, mpm@selenic.com, herbert@gondor.apana.org.au, jonathan@buzzard.org.uk, benh@kernel.crashing.org, davem@davemloft.net, b.zolnierkie@samsung.com, rjw@rjwysocki.net, pavel@ucw.cz, len.brown@intel.com, Zhenzhong Duan , William Hubbs , Chris Brannon , Kirk Reiser , Samuel Thibault Subject: [PATCH RFC 3/3] speakup: misc: Use dynamic minor numbers for speakup devices Date: Mon, 9 Mar 2020 10:17:47 +0800 Message-Id: <20200309021747.626-4-zhenzhong.duan@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200309021747.626-1-zhenzhong.duan@gmail.com> References: <20200309021747.626-1-zhenzhong.duan@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Arnd notes in the link: | To clarify: the only numbers that I think should be changed to dynamic | allocation are for drivers/staging/speakup. While this is a fairly old | subsystem, I would expect that it being staging means we can be a | little more progressive with the changes. This releases misc device minor numbers 25-27 for dynamic usage. Link: https://lore.kernel.org/lkml/20200120221323.GJ15860@mit.edu/t/ Suggested-by: Arnd Bergmann Signed-off-by: Zhenzhong Duan Cc: William Hubbs Cc: Chris Brannon Cc: Kirk Reiser Cc: Samuel Thibault Cc: Greg Kroah-Hartman --- drivers/staging/speakup/devsynth.c | 10 +++------- drivers/staging/speakup/speakup_soft.c | 14 +++++++------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/staging/speakup/devsynth.c b/drivers/staging/speakup/devsynth.c index d920256..d305716 100644 --- a/drivers/staging/speakup/devsynth.c +++ b/drivers/staging/speakup/devsynth.c @@ -1,16 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 #include -#include /* for misc_register, and SYNTH_MINOR */ +#include /* for misc_register, and MISC_DYNAMIC_MINOR */ #include #include #include "speakup.h" #include "spk_priv.h" -#ifndef SYNTH_MINOR -#define SYNTH_MINOR 25 -#endif - static int misc_registered; static int dev_opened; @@ -67,7 +63,7 @@ static int speakup_file_release(struct inode *ip, struct file *fp) }; static struct miscdevice synth_device = { - .minor = SYNTH_MINOR, + .minor = MISC_DYNAMIC_MINOR, .name = "synth", .fops = &synth_fops, }; @@ -81,7 +77,7 @@ void speakup_register_devsynth(void) pr_warn("Couldn't initialize miscdevice /dev/synth.\n"); } else { pr_info("initialized device: /dev/synth, node (MAJOR %d, MINOR %d)\n", - MISC_MAJOR, SYNTH_MINOR); + MISC_MAJOR, synth_device.minor); misc_registered = 1; } } diff --git a/drivers/staging/speakup/speakup_soft.c b/drivers/staging/speakup/speakup_soft.c index 9d85a3a..eed246f 100644 --- a/drivers/staging/speakup/speakup_soft.c +++ b/drivers/staging/speakup/speakup_soft.c @@ -10,7 +10,7 @@ */ #include -#include /* for misc_register, and SYNTH_MINOR */ +#include /* for misc_register, and MISC_DYNAMIC_MINOR */ #include /* for poll_wait() */ /* schedule(), signal_pending(), TASK_INTERRUPTIBLE */ @@ -20,8 +20,6 @@ #include "speakup.h" #define DRV_VERSION "2.6" -#define SOFTSYNTH_MINOR 26 /* might as well give it one more than /dev/synth */ -#define SOFTSYNTHU_MINOR 27 /* might as well give it one more than /dev/synth */ #define PROCSPEECH 0x0d #define CLEAR_SYNTH 0x18 @@ -375,7 +373,7 @@ static int softsynth_probe(struct spk_synth *synth) if (misc_registered != 0) return 0; memset(&synth_device, 0, sizeof(synth_device)); - synth_device.minor = SOFTSYNTH_MINOR; + synth_device.minor = MISC_DYNAMIC_MINOR; synth_device.name = "softsynth"; synth_device.fops = &softsynth_fops; if (misc_register(&synth_device)) { @@ -384,7 +382,7 @@ static int softsynth_probe(struct spk_synth *synth) } memset(&synthu_device, 0, sizeof(synthu_device)); - synthu_device.minor = SOFTSYNTHU_MINOR; + synthu_device.minor = MISC_DYNAMIC_MINOR; synthu_device.name = "softsynthu"; synthu_device.fops = &softsynthu_fops; if (misc_register(&synthu_device)) { @@ -393,8 +391,10 @@ static int softsynth_probe(struct spk_synth *synth) } misc_registered = 1; - pr_info("initialized device: /dev/softsynth, node (MAJOR 10, MINOR 26)\n"); - pr_info("initialized device: /dev/softsynthu, node (MAJOR 10, MINOR 27)\n"); + pr_info("initialized device: /dev/softsynth, node (MAJOR 10, MINOR %d)\n", + synth_device.minor); + pr_info("initialized device: /dev/softsynthu, node (MAJOR 10, MINOR %d)\n", + synthu_device.minor); return 0; } -- 1.8.3.1