Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp211698ybb; Tue, 24 Mar 2020 20:33:58 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvybAVQfumCMH4iuQWwaXl4VXhqOhKvgjd1Nh51J5UpyIxsP3eR2L5MNTwyGfpsG5TpEwWX X-Received: by 2002:a9d:356:: with SMTP id 80mr966785otv.15.1585107238290; Tue, 24 Mar 2020 20:33:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585107238; cv=none; d=google.com; s=arc-20160816; b=EX3jq8XOwy7cBbNOyfa1syXIW/s0P8e8HgjAPVFngc+YxkJL1gyxMia9qoPhFdCRD8 RGk4RwxfkB8kmCvY4eYD2eKZS5C9FwJJNAjNAl+47B6rPFo3dfA1YUrEifwLr2DVuUmO 74DBrQV26K3kv4fuy0XU9qmeuKCGXGjf/PlaHOFhj9tBYXP7sx+lpJCu2iER2j6buycJ BZ4GjVQcOSK6+zIr9TAIPN9ZgwGEcf6Gr0vmOsKTs60x+ZBT5Kd7IppJ3dTC2/yAs/Ie osphkx3vPeOPErgtgOJx8gPp4qwur7srqAEPd7iN1qCdpL6a/WiJK0+ICDyl+u9Chofd yieQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=jIvdWurQrynQPs8bJVrUivnNx43ycQqIFEr2BSEWluk=; b=KmM18VplT91/fWijHaZfqEALuMMuOStdrdt8fYyDE5zyhKbgHuJU4IiyAM2eqgpYvn uoEH3rC4G2LtqlIMt5Q3xM/kl9eZ+BzmWc4X7zgkFAbYSsgrKPKCwF89mJwraeG5RWwh nptxRK+5lKZyTws1Zc60EU6ZT5IumxpzYZMqhkFxmhS8tjS2hcU9fvuSn6+weYOWfewT cdts6X/vdk+/llv4XyuCJbAUakOjcypq9fbyuyl8peulYLLWOKo75JbFv2RYbvQHorfh 4wn2M6fR/UccRiltL4yeFPUENpdGCb1spC8suO/IaspCpvyQVyk8Sa55vM0i7Q7uBIOA 4Qdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ccSpNGpD; 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 n26si10419054otr.78.2020.03.24.20.33.46; Tue, 24 Mar 2020 20:33:58 -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=ccSpNGpD; 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 S1727376AbgCYDcK (ORCPT + 99 others); Tue, 24 Mar 2020 23:32:10 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:34468 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727285AbgCYDcK (ORCPT ); Tue, 24 Mar 2020 23:32:10 -0400 Received: by mail-pl1-f196.google.com with SMTP id a23so283204plm.1 for ; Tue, 24 Mar 2020 20:32:09 -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; bh=jIvdWurQrynQPs8bJVrUivnNx43ycQqIFEr2BSEWluk=; b=ccSpNGpD6C2895cDQtq0ZJTPecpCphHKwHbe2fRQv3Dx4qC5leA2NooEr9SY0nvk9W FasSSGlppzIf1uIaRW9FfPvL2GlpokW7eLf/QNPf1ZzWV/RAo+tYgLUEGxd51kQeRaEI MK62IwckRCwGw0zvjfA10MoYUCPEpcwlRZdy7kxGgUo893Sdi42hhrNqy9ZRUKYRT9wJ p8l3xIhsqcn/Q0puMc+SM9/uBSWeIffknMn6Y55ghzpGch6Iq9ccTWL6T2Lw5GiSkGKp PEDLYPjDaCPuFx3wf/W56XVumoQKYWhWWNTMDewXMy4+4xUh537UEvJgokdUj4k7Nd7i C4WQ== 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; bh=jIvdWurQrynQPs8bJVrUivnNx43ycQqIFEr2BSEWluk=; b=kX5wwHZy/TVmv0iu/GOss6nVUCsyO+ik2WRb38Y08Nn5l6ONB158688ACIR4vHhThi QIuVL1BwYjiA7kswl9hCB5D2kH6vK2UF1/yi/jFy8ICV1KiFtLiFf5iiCzCuv1KwzIn5 idKWDURxm3HxEGR/JqA8LPaj/z1HR/9/lCNb4W2/n+eVn9a8lsjHBIMHIdsnpSTAL3L7 XoYj5KIN0iYJz5Xx7x/L19wgIZfh3bwipkkT7sXUdwBnt+wzfgm082yj25XEl5vVhbuF kQgQo/RqAVunMSs1hbxTjdSzjJq6GLcOTs0Pq8Znw1khw/1O/QgDqXXl7I8uXZrFSdM7 vpPA== X-Gm-Message-State: ANhLgQ2BHHZLvSeP3ZVUgA12gxuEifRQJ2MhPivcwX9cRpuSQJA1/hmd vcDBzZkk8eQ9mAnfsWyaU21GnG1E X-Received: by 2002:a17:902:59dd:: with SMTP id d29mr1217203plj.246.1585107128212; Tue, 24 Mar 2020 20:32:08 -0700 (PDT) Received: from ZB-PF114XEA.360buyad.local ([103.90.76.242]) by smtp.gmail.com with ESMTPSA id w127sm17194978pfb.70.2020.03.24.20.32.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 20:32:07 -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, benh@kernel.crashing.org, davem@davemloft.net, b.zolnierkie@samsung.com, rjw@rjwysocki.net, pavel@ucw.cz, len.brown@intel.com, speakup@linux-speakup.org, devel@driverdev.osuosl.org, Zhenzhong Duan , William Hubbs , Chris Brannon , Kirk Reiser Subject: [PATCH v2] speakup: misc: Use dynamic minor numbers for speakup devices Date: Wed, 25 Mar 2020 11:30:08 +0800 Message-Id: <20200325033008.9633-1-zhenzhong.duan@gmail.com> X-Mailer: git-send-email 2.17.1 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 Acked-by: Samuel Thibault Cc: William Hubbs Cc: Chris Brannon Cc: Kirk Reiser Cc: Greg Kroah-Hartman --- v2: Add Acked-by from Maintainer, no other change. 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