Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2412829ybl; Mon, 20 Jan 2020 02:27:20 -0800 (PST) X-Google-Smtp-Source: APXvYqzAsKEE2dZNnrC5xrgho6+4UXbp47jqKFCkmxJALu6sYF2ryRUNInt42zXUu2hyIo68qdHZ X-Received: by 2002:a05:6830:1487:: with SMTP id s7mr14765111otq.269.1579516040155; Mon, 20 Jan 2020 02:27:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579516040; cv=none; d=google.com; s=arc-20160816; b=zSV/y2mmXtmB1pOY6bAW87xDlR44TPXO0nCBYG2EQeSwNn0xPYinzuMTqOrDbwmbrx 0DzMDyLu/8pC7szh3LHRqTLEIafgl9iX5hDvdTMEWBNpzLbWXITrhZFV1m/ShRFUI1Cw w+h6S4e8TIl73R4rc1LRGUQ3yUXX+QDfB6+m/VdSwKqeW/686T0vCn5hySxdij4i4nnv R1eA8pFf3H+Isdsahd1faM+zfHmvunZ283ZbaH6CFYioWlll+aB5clfyvoNfWqfGgjXA iYhdkqe8V9Yr3/z4hM0O07E5VGLmX/vUfpFVUEWCZBp2oQ/6bX2P/ANbottMcL0qaYv2 K+aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=g8QaAxRvpIp1ZDk7uOnezFQpia7qFMkTmHcIdFJK54Y=; b=Z3piNwD+UN0vgT/pOb5WfAirYHV/JNoEZ3YCVBACK4gxkOQpbcWRPT7TzOfbtjVHGA QCCLxsV3wD67OEiofwrSrRl1wolEuyDUlEfw8OWhIrnK7bMx5ja/vIcdDGKG5VG3emT2 YuYP2GdymCMg8aM7SwNN2jsJd0Gkyd8BqaL9K6WrY0/cypmX9AyrxWxUGGMpuA6TR2Cn 67y7bX91iNqOv6lQfaPCfv3ZEB6Jr8LmF5rZU/2TtImqsdBGIAZepZkidtPvwGSWpDlH UhAlmARY3zit3EUBclGWNY4ncjO1yMTQms7Sx6ereGbqAJEbVyWaSn5jlxI6RZ5g+QfS i/Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=piFqKHIh; 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 v67si18782741oia.26.2020.01.20.02.27.07; Mon, 20 Jan 2020 02:27:20 -0800 (PST) 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=piFqKHIh; 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 S1726587AbgATK0M (ORCPT + 99 others); Mon, 20 Jan 2020 05:26:12 -0500 Received: from mail-lj1-f182.google.com ([209.85.208.182]:34621 "EHLO mail-lj1-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726125AbgATK0M (ORCPT ); Mon, 20 Jan 2020 05:26:12 -0500 Received: by mail-lj1-f182.google.com with SMTP id z22so33286917ljg.1 for ; Mon, 20 Jan 2020 02:26:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=g8QaAxRvpIp1ZDk7uOnezFQpia7qFMkTmHcIdFJK54Y=; b=piFqKHIhM1NPhef3UI4sHxEpVBFCVeduqD5372fh4X+KCsRGy5ASYUBoaRWZlGoW0j +n0mVb1HzJ9uDXvZHCVUYbAeixx0Z36wUwBfScwmZ9B92wYPcPG/M7H1/u9X4lbYP+xg VorMekBszSESzPhDCJeYR3OHBeBw5ZDnB0xI+qe00Q4ZrejqWQTLeJBZ1wBavOyjmjGm 9BT+F4LsA/RRLVf9YS0310lqVsFDHpRygWhcX/XtX8TbtC8y7Yqa9fD3GNI1jvnsMedS YEIxwAHt+BxYfKfoluelikxXoe6k2LzrQlrjH3+EU8kbEa1D7gpS8fa4EHkISSCAXxDX JQCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=g8QaAxRvpIp1ZDk7uOnezFQpia7qFMkTmHcIdFJK54Y=; b=QQ6vdIkHF0uUClv99cZlqVLyFI4ANlvgwUmQKqkoLIwAX+3KDq0AEk8Bubshq4ytSf PaEOnbElIfzKISgPUSs47LvGbYljike2QKQUo35XYIsZbATdUdH772W1Bkl1jSIPv3+m O4OoK8foApbQR7BBCJR7AFFtspYS2etmeii7hXpINXYjdeIqQ1uIKcFMmVK3FTv+pcZ8 ZV8iGJq9oYlOU1gBeyd43UALjfs5tVPngVofFcb6ARYMtHoOJLds/oGYTF2NQHue+DoX JMyZQ/rN9y33NWR6SLjpK4ZQu9ATrfpOwses1fckN6MA1HiRNnN107CUMLLW8mN2PTXq IO4Q== X-Gm-Message-State: APjAAAXNNy30m7/MuAfY/SBCJletWcewsv2DBKl/whT53nt9UWkU0FQz 98+BCfUtHOrzomoRynFgyWeHhdtJ7WFufZMSDaTXTA== X-Received: by 2002:a2e:9e55:: with SMTP id g21mr13412186ljk.245.1579515970733; Mon, 20 Jan 2020 02:26:10 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Zhenzhong Duan Date: Mon, 20 Jan 2020 18:25:58 +0800 Message-ID: Subject: Re: Question about dynamic minor number of misc device To: Arnd Bergmann Cc: Greg Kroah-Hartman , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 20, 2020 at 6:03 PM Arnd Bergmann wrote: > > On Mon, Jan 20, 2020 at 9:33 AM Zhenzhong Duan wrote: > > > > Hi Maintainers, > > > > I see there are 64 free slots(0-63) used for misc devices with dynamic > > minor number. But PSMOUSE_MINOR(1) overlaps with that dynamic range. > > > > So if the dynamic minor number exhaust, psaux driver will fail with > > "could not register psaux device, error: -16", is this expected? > > Should we preserve a slot for psaux and serio_raw which use static > > minor number PSMOUSE_MINOR? > > Is this a theoretical question, or are you actually running out of dynamic > minor numbers? I would guess that if we change the limit to only allow > dynamic minors 2 through 63, that would technically be a correct > change, but the result would be that in the same situation another random > driver fails, which is not much of an improvement, unless the dynamic > minor numbers also continue into the range above 255. It's theoretical question. Thanks for your explanation. > > On a related note, I checked for drivers that call misc_register() > with a minor number that is not defined in include/linux/misc.h > and found a bunch, including some that have conflicting numbers, > conflicting names or numbers from the dynamic range: > > drivers/staging/speakup/devsynth.c:#define SYNTH_MINOR 25 > drivers/staging/speakup/speakup_soft.c:#define SOFTSYNTH_MINOR 26 /* > might as well give it one more than /dev/synth */ > drivers/staging/speakup/speakup_soft.c:#define SOFTSYNTHU_MINOR 27 /* > might as well give it one more than /dev/synth */ > drivers/macintosh/via-pmu.c:#define PMU_MINOR 154 > drivers/macintosh/ans-lcd.h:#define ANSLCD_MINOR 156 > drivers/auxdisplay/charlcd.c:#define LCD_MINOR 156 > drivers/char/applicom.c:#define AC_MINOR 157 > drivers/char/nwbutton.h:#define BUTTON_MINOR 158 > arch/arm/include/asm/nwflash.h:#define FLASH_MINOR 160 > drivers/sbus/char/envctrl.c:#define ENVCTRL_MINOR 162 > drivers/sbus/char/flash.c:#define FLASH_MINOR 152 > drivers/sbus/char/uctrl.c:#define UCTRL_MINOR 174 > drivers/char/toshiba.c:#define TOSH_MINOR_DEV 181 > arch/um/drivers/random.c:#define RNG_MISCDEV_MINOR 183 /* > official */ > drivers/auxdisplay/panel.c:#define KEYPAD_MINOR 185 > drivers/video/fbdev/pxa3xx-gcu.c:#define MISCDEV_MINOR 197 > kernel/power/user.c:#define SNAPSHOT_MINOR 231 > drivers/parisc/eisa_eeprom.c:#define EISA_EEPROM_MINOR 241 > > If you would like to help clean that up, you are definitely welcome > to send patches. Ok, should that be a patch for all drivers or seperate patch for each driver? Thanks Zhenzhong