Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2396184ybl; Mon, 20 Jan 2020 02:05:41 -0800 (PST) X-Google-Smtp-Source: APXvYqyPT7xdeKEHft19zkXJNmRT2yMpqM+PMn/jAsz+BvOu6AWIGttWp5Oei8bBryJds5rsR7uz X-Received: by 2002:a05:6830:451:: with SMTP id d17mr14829718otc.53.1579514741004; Mon, 20 Jan 2020 02:05:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579514740; cv=none; d=google.com; s=arc-20160816; b=R13UPzwE1tLKKWeOijXxTVR9ygyju6Od6GtZkIS+Wl5MUlLb+lEkIb9PQrdMZftkEu q+hyGQQCen+IkCv8wfprQOsLp+sNEqhKTwRC0PZU2fkcwjNCVTht3hj+pSkiQJ2hvYt1 IIiKIWDw6ZRr4/gtw7VNSeeVb9crHIyOKA/RV1lxcEUf9BOP/iwFlnYRotDwkypqTvmp r1riNmrr3BdkSWCh86jz4v7XaNhac0zzlKd7tHPmRPgbew28q7LDn7HuKYesYgnOykhz d99sSuf1uYQH/07tJLhmkR+hDuzknmGfTBbo/gaXv0KTo/jC3MpDkWA7DlagGy5kPNc7 QexQ== 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; bh=wcgxQ9CfWbqvaVE5OWC9vHHg4QzNjILANYc8mtVHx+s=; b=p5oTVmTUZIej0kju69d8483WfYIKfwK/fyi6p8TGoGTRSphciuQMiUAzqWIOgZpSzU YfxppNeFGM1ogcJ3SPeptKON1Z2vWPPhRZt+v+8/uiiXOpguexme8BFdLooI+KNvL78G JlPkpDqEw/twS/HAB32dC1dg4o7AwZjYdXxpP/ia3+ELyt9/JKfo/0GUFnbWoCWlbm0o BVMpM9OO/cZvFmYHbHIOwgrcgnZNbIAE/nDtrQ8aPzXjN0QDQXySIEy9ICR7JGZ2NY5A oFmW/+ZF4fM8FecWWhaEkfpGhVcYIbQyuEBAEJHRyDzYGf6pPr6HKyTJ5rZjQa6gdhFT GTJg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x22si18807193otp.107.2020.01.20.02.05.26; Mon, 20 Jan 2020 02:05:40 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727118AbgATKDt (ORCPT + 99 others); Mon, 20 Jan 2020 05:03:49 -0500 Received: from mout.kundenserver.de ([212.227.126.130]:40911 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726421AbgATKDt (ORCPT ); Mon, 20 Jan 2020 05:03:49 -0500 Received: from mail-qt1-f172.google.com ([209.85.160.172]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPSA (Nemesis) id 1MmlGg-1jJR4f17pu-00jpkW for ; Mon, 20 Jan 2020 11:03:47 +0100 Received: by mail-qt1-f172.google.com with SMTP id k40so27189316qtk.8 for ; Mon, 20 Jan 2020 02:03:47 -0800 (PST) X-Gm-Message-State: APjAAAUoaxsMv/IdRMPEuHNKtW0KmbA9J2fIoDh6FalnrUajdWbVSJbE MIsLT3FeJTiqjWgK14MtiIom9Ze4hLrHcYpKbvM= X-Received: by 2002:ac8:6153:: with SMTP id d19mr19426566qtm.18.1579514626114; Mon, 20 Jan 2020 02:03:46 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Arnd Bergmann Date: Mon, 20 Jan 2020 11:03:29 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Question about dynamic minor number of misc device To: Zhenzhong Duan Cc: Greg Kroah-Hartman , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:axvGa0SVBkQotRREvZnUecy/yzRvvTyzKYydtXOYoXC5ht0nnhL 3K91MDLeGLpiQwJTXNu8sqlNHi8WCzm3MKD1cF2wa8QEy534WmWoj+ZKHkiheuKI3K990WW go8aOoKv0zTUr3KwdnPuxfw95zRoDwicjq0jlVGVEFEPFWzfb8jE1ihLGUbE8bdvbomdrIL Pgfx7HHVLpy45ArAz1IIw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:3HOqjbKXyTM=:YAxCiIZcto5vBEZ5l7MS3R xbymjNV5GLM8N7mSxhdLc6MADHHQif9XrQwRAByftGWAyf/J9/Cl79YCMaFivqFJAzwpMYlZo TP3jMPyB4HgC5pG6mI3H+1e5eYggwP73CGn1i5umMFj7Q6VjX2ucRfK0f/815fWb+CH4PAgXG nG8hGN0BlKiNTJh8cOb6iQmEXJYEGAr0JVPSc0tc8sFRdLBtOYHsdM45eCnlLwv4pv2921xxd WxIepSECXhY183BOFDS1ZWG9ZhFDHdZN1rys4Hp6kdJQy9YOedNlsLOuFD7ukLfx1zpQccSTf P6KL69dBZgHQfh0pci0PmNGJgP6OezzHs2otVf9oPjzD203WFXfMauH5gUmBSZoKfInYZpW1p o+tnwoRlmqGT6zJDV6ezpxSbJoDI2ADlLXqP0xL6jnQ+9UvwOInJrNVNwhp1LQeJJYCDNPMTq 38fHZ7TtK8ghZ3dlm4NlXw/j26kpWRFvpT2yGGY753mtaeIx0/e6o+28QW3xrMS1mBO4lx/YD WLCqauJehkDZNUfswvzdo/7UNpF0TrZsJwrfbAvfLP6G5UgWfHkh5Y0e70YKjZAp1pf1hwlNE eMW6zeVFriwi/YlaDtxKysbJ8ysICShKl1njuhQ1ojmWRd8+iWHj+/z2hb85YEzR03flRkt0e n3m7X1TcQ7JRF6xgPzorhob54+VKS4N9wQqCbNWm32TZFAERMjAxd1MYrMrtzOPoD74qOv39R S4e18A0/Xo3Z5u9w3KhPuaQpcqRSa7BVOYoCRECfcqvRp3dC+j1KpC4LFekWzCzAvkoKK9jQS HNAk9XrDETSDS2SLWv8Y9AFXxtXk2jUA7QYnOCUAdC5fvvQAmna3tM72ZKsxV0WZbnOZPX5O9 29uB/S6Epbc+aHXUDhEw== 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 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. 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. Arnd