From nobody Tue Oct 7 03:46:22 2025 Received: from outbound.pv.icloud.com (p-west1-cluster3-host9-snip4-10.eps.apple.com [57.103.66.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B7C9265CBB for ; Mon, 14 Jul 2025 15:34:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=57.103.66.93 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752507289; cv=none; b=lVVwV49jLjvxNsFGgjjd6gwYeJvGEKS1Yli94bdaxBly9vC3X4tjc/BkaL5qFpCS42Ymn3DaT2oDme4eMtXuFN4YcmeC1AJPXNuwUCJYfAu9L1uKonKG01LhhnHFsCN3Y19K8YQHnImVd/IIzcUNdFC+kvNhYE+cszzKTSyx04g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752507289; c=relaxed/simple; bh=1Rhoe7BHxRF/MuarYDxZKPJyK9zbtaR0YOq3N+f0hSg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=erScgnchoUGhYXn+WzFPw4vt4C8frE8Zce3cxh3ReFK9NDb0C1ut9ebVt2SaY4UtnccMha4Qw9cBf7DkZ/9xDcG8c5aOfhL/gNNe2G2fGCfNYs1AJVnKbN9Dh0T1sVwOuV0Ux2e2QO5R4EkBhWvywS8cdC1w0hDuq7wxbkBEyL8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=pgninnp4; arc=none smtp.client-ip=57.103.66.93 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="pgninnp4" Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by outbound.pv.icloud.com (Postfix) with ESMTPS id 8190618004B8; Mon, 14 Jul 2025 15:34:45 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; bh=3cxFlBecLs+olRGOsshuIdceYjGpKxI6JcAkEkmJa30=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:x-icloud-hme; b=pgninnp4Cy8NiifPte6Sc5Oo3xNMRQ6jmY3JLYJDP6g0+Bg9iI71G/pWC33fB13ODyJHKE4bcqVkDqV/1ucbarB1pVCotOs7SLbY4NWIBLPY7I6R8YQ+zpUCxOz6dPM7jYBBtqo7awwcIuGmnSuyXBuPRZbQRlM2jaN3Wo/40LcyhRoSCFnxzdXX2w62LynZsMKA16dXxO87pazeWgO5NxxjFGuERDl+ZdR8wZ9l45+w3Ot9cC/jg54pR6nPz+hbFp3e8qeSajPD60oFQ2FqWibl44oxUqX/Ad8586S/kYesD/KyeMOHCumk3tp4w0rrKKilIUKVCmxi/YVGqHBlwQ== Received: from [192.168.1.26] (pv-asmtp-me-k8s.p00.prod.me.com [17.56.9.36]) by outbound.pv.icloud.com (Postfix) with ESMTPSA id 5B7E918004B9; Mon, 14 Jul 2025 15:34:39 +0000 (UTC) From: Zijun Hu Date: Mon, 14 Jul 2025 23:34:12 +0800 Subject: [PATCH v6 1/8] char: misc: Move drivers/misc/misc_minor_kunit.c to drivers/char/ Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250714-rfc_miscdev-v6-1-2ed949665bde@oss.qualcomm.com> References: <20250714-rfc_miscdev-v6-0-2ed949665bde@oss.qualcomm.com> In-Reply-To: <20250714-rfc_miscdev-v6-0-2ed949665bde@oss.qualcomm.com> To: Arnd Bergmann , Greg Kroah-Hartman , "James E.J. Bottomley" , Helge Deller , "David S. Miller" , Andreas Larsson Cc: Thadeu Lima de Souza Cascardo , Zijun Hu , linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, sparclinux@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzE0MDA5MyBTYWx0ZWRfXypSaXGJZQrSz hj6OZS9PrvESYtKA4P+C8XG9F+kR7voe+k6kfNS550Ak5PQzOllyHXPl/3pD8ypElrzGDlXdyc2 tGrxAvhvltP1GSy8XQyfy+narLBfL6GIEQ7lr0Xt+Mw+sReuPYBsWw5siWvqSlEVveW3/ZuGc8c CtVuQ3uhKa7axRmdtunxQ+qJePELhQ7jTH2KlLiUaFb/6a+pqy+z/U5dVEoqz5uV9il50AThkcX hfgGZ3JwiqISpb+1aIPqbST6zVo6JIs6RvtG2F+5yN2JefWLPOMC9Gg3uScWTDPKJOra/gNOM= X-Proofpoint-ORIG-GUID: XrslPMHi9w6wP2WTHeNKJIponVMCJMTG X-Proofpoint-GUID: XrslPMHi9w6wP2WTHeNKJIponVMCJMTG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-07-14_01,2025-07-14_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 bulkscore=0 malwarescore=0 adultscore=0 mlxlogscore=935 spamscore=0 suspectscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.22.0-2506060001 definitions=main-2507140093 From: Zijun Hu drivers/misc/misc_minor_kunit.c is to test APIs defined in drivers/char/misc.c, but is not in the same directory as the later. Move misc_minor_kunit.c to drivers/char/. Signed-off-by: Zijun Hu --- drivers/char/Makefile | 1 + drivers/{misc =3D> char}/misc_minor_kunit.c | 0 drivers/misc/Makefile | 1 - 3 files changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/Makefile b/drivers/char/Makefile index e9b360cdc99a7fee9c70eabcffe9caf763552aa2..1291369b9126511ff41a06f956a= f4bb1de7ea4b2 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile @@ -6,6 +6,7 @@ obj-y +=3D mem.o random.o obj-$(CONFIG_TTY_PRINTK) +=3D ttyprintk.o obj-y +=3D misc.o +obj-$(CONFIG_TEST_MISC_MINOR) +=3D misc_minor_kunit.o obj-$(CONFIG_ATARI_DSP56K) +=3D dsp56k.o obj-$(CONFIG_VIRTIO_CONSOLE) +=3D virtio_console.o obj-$(CONFIG_UV_MMTIMER) +=3D uv_mmtimer.o diff --git a/drivers/misc/misc_minor_kunit.c b/drivers/char/misc_minor_kuni= t.c similarity index 100% rename from drivers/misc/misc_minor_kunit.c rename to drivers/char/misc_minor_kunit.c diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index 917b9a7183aa1db63cc4049c042c3437f6756a1a..94f44e6c2db79dedc3839bbfb53= e10cde103fbc6 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -23,7 +23,6 @@ obj-$(CONFIG_SENSORS_BH1770) +=3D bh1770glc.o obj-$(CONFIG_SENSORS_APDS990X) +=3D apds990x.o obj-$(CONFIG_ENCLOSURE_SERVICES) +=3D enclosure.o obj-$(CONFIG_KGDB_TESTS) +=3D kgdbts.o -obj-$(CONFIG_TEST_MISC_MINOR) +=3D misc_minor_kunit.o obj-$(CONFIG_SGI_XP) +=3D sgi-xp/ obj-$(CONFIG_SGI_GRU) +=3D sgi-gru/ obj-$(CONFIG_SMPRO_ERRMON) +=3D smpro-errmon.o --=20 2.34.1 From nobody Tue Oct 7 03:46:22 2025 Received: from outbound.pv.icloud.com (p-west1-cluster2-host9-snip4-1.eps.apple.com [57.103.64.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 26E9B26CE08 for ; Mon, 14 Jul 2025 15:34:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=57.103.64.132 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752507294; cv=none; b=MpToe4/OXbiCRXzEZaP1gq1OifTWV4WlARGDTEvD1UlMZqmXTLqZIEHntmyTAzND9THTUl1g299S0Nn7/Ql7FPG0KEaxf5CtyUljckBZP8LxJS5vOkoPBGCn2vZOxDzh/TFeEIewJPH1f4cIcV5YXZVqcKiAN3kQDTw3wRpfjiA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752507294; c=relaxed/simple; bh=/AiRylSRcwzhmEunQGArB6XDZj9I/BaM5Nh2Os2DP/c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EVPzgTW8vTsaGHZEUVUjX+oUUKpPIa7ckbNvdv414WwQcbxFbU0oaTQoD3ELu5Qq84oYIpoURzHevGzyphDJ+iCEkHnxBRN7HODDA79VQ6sjgtK3mtryg1a9RKuVtKi/HguZk/N/3xKP7JKlWBi4cAykjvF1bmSgunFxecL1Ikg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=DiBVibHL; arc=none smtp.client-ip=57.103.64.132 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="DiBVibHL" Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by outbound.pv.icloud.com (Postfix) with ESMTPS id 36AF1180049B; Mon, 14 Jul 2025 15:34:48 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; bh=JeZl4nRCpi5VgV5lnrDHfHn6bzW2jbEiCRbRoFnllBU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:x-icloud-hme; b=DiBVibHLx2J7TBJFM/E4yv2t68kD/Vh3VMZ0RFgef5fQ+OUgHHtJp5K0xuM1PShi9nwmhE5yNJzK9xDSemznBEyX6pzrlxfC8LnA52nEzXxADNKKl66yuiebsnG4NmzYrZFTM+VhinlNN7HBj8iC4FD+MyqUUapsGsPbNWgebXY5y3APdbHcEwrFAZ9Po56L7AB6GYHxSiKBacGorr8gQMyzl81nTUxv5LHX6OIIp1P0PDsoKtoYV46FDvF6HSwCsYeINRjZkQVRL+h84bWKMEuzc7pv9HU+aHnqK1N/zF7bblga/xlbzlWrbx96N06Wsvu07P+U9Cfqxnow0u6wTw== Received: from [192.168.1.26] (pv-asmtp-me-k8s.p00.prod.me.com [17.56.9.36]) by outbound.pv.icloud.com (Postfix) with ESMTPSA id 57E6118004B5; Mon, 14 Jul 2025 15:34:45 +0000 (UTC) From: Zijun Hu Date: Mon, 14 Jul 2025 23:34:13 +0800 Subject: [PATCH v6 2/8] char: misc: Adapt and add test cases for simple minor space division Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250714-rfc_miscdev-v6-2-2ed949665bde@oss.qualcomm.com> References: <20250714-rfc_miscdev-v6-0-2ed949665bde@oss.qualcomm.com> In-Reply-To: <20250714-rfc_miscdev-v6-0-2ed949665bde@oss.qualcomm.com> To: Arnd Bergmann , Greg Kroah-Hartman , "James E.J. Bottomley" , Helge Deller , "David S. Miller" , Andreas Larsson Cc: Thadeu Lima de Souza Cascardo , Zijun Hu , linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, sparclinux@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-GUID: YRqWB6wEIstpDcwn_OOWvxFMUoGUXjAV X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzE0MDA5MyBTYWx0ZWRfXwb9WmfZZRWWJ BF48BcC91N1HWrzYzYc/h6lJzDC6q3eP99A8/7p1qLncAqUybar16VbqHZOaGIKTNk7Rgi60TeZ j7uf+yXanKd1qbKxc7PBrGW5iG41X3uHEO9C0qIm+/wmCCsNihdyuPjhB+KIruQAM3P9yd/2fqJ VUtlyCZeQTKhFMiJGWlImgZb8eOgPIQpLhnd/woNJi8t5QKKemRlLa2hSPW3MzO4J5wTtudHE4/ Di4WUmChnd+LmzawoEvKInfq40emnlFlZGs62aGaGmRSWP+De6XRka4XWIJzjBo/crx4EBv2Q= X-Proofpoint-ORIG-GUID: YRqWB6wEIstpDcwn_OOWvxFMUoGUXjAV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-07-14_01,2025-07-14_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 spamscore=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.22.0-2506060001 definitions=main-2507140093 From: Zijun Hu Adapt and add test cases for next change which regards minor whose value > macro MISC_DYNAMIC_MINOR as invalid parameter when register miscdevice, hence get a simple minor space division below: < MISC_DYNAMIC_MINOR: fixed minor code =3D=3D MISC_DYNAMIC_MINOR: indicator to request dynamic minor code > MISC_DYNAMIC_MINOR: dynamic minor code requested Signed-off-by: Zijun Hu --- drivers/char/misc_minor_kunit.c | 51 +++++++++++++++++--------------------= ---- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/drivers/char/misc_minor_kunit.c b/drivers/char/misc_minor_kuni= t.c index 30eceac5f1b6402b0f918af6f56602ed1a6c14ec..3184f383bea8c77cbca69ff5e31= 5ea5de2d5512e 100644 --- a/drivers/char/misc_minor_kunit.c +++ b/drivers/char/misc_minor_kunit.c @@ -7,12 +7,6 @@ #include #include =20 -/* dynamic minor (2) */ -static struct miscdevice dev_dynamic_minor =3D { - .minor =3D 2, - .name =3D "dev_dynamic_minor", -}; - /* static minor (LCD_MINOR) */ static struct miscdevice dev_static_minor =3D { .minor =3D LCD_MINOR, @@ -25,16 +19,6 @@ static struct miscdevice dev_misc_dynamic_minor =3D { .name =3D "dev_misc_dynamic_minor", }; =20 -static void kunit_dynamic_minor(struct kunit *test) -{ - int ret; - - ret =3D misc_register(&dev_dynamic_minor); - KUNIT_EXPECT_EQ(test, 0, ret); - KUNIT_EXPECT_EQ(test, 2, dev_dynamic_minor.minor); - misc_deregister(&dev_dynamic_minor); -} - static void kunit_static_minor(struct kunit *test) { int ret; @@ -157,13 +141,7 @@ static bool is_valid_dynamic_minor(int minor) { if (minor < 0) return false; - if (minor =3D=3D MISC_DYNAMIC_MINOR) - return false; - if (minor >=3D 0 && minor <=3D 15) - return false; - if (minor >=3D 128 && minor < MISC_DYNAMIC_MINOR) - return false; - return true; + return minor > MISC_DYNAMIC_MINOR; } =20 static int miscdev_test_open(struct inode *inode, struct file *file) @@ -557,7 +535,7 @@ static void __init miscdev_test_conflict(struct kunit *= test) */ miscstat.minor =3D miscdyn.minor; ret =3D misc_register(&miscstat); - KUNIT_EXPECT_EQ(test, ret, -EBUSY); + KUNIT_EXPECT_EQ(test, ret, -EINVAL); if (ret =3D=3D 0) misc_deregister(&miscstat); =20 @@ -590,8 +568,9 @@ static void __init miscdev_test_conflict_reverse(struct= kunit *test) misc_deregister(&miscdyn); =20 ret =3D misc_register(&miscstat); - KUNIT_EXPECT_EQ(test, ret, 0); - KUNIT_EXPECT_EQ(test, miscstat.minor, miscdyn.minor); + KUNIT_EXPECT_EQ(test, ret, -EINVAL); + if (ret =3D=3D 0) + misc_deregister(&miscstat); =20 /* * Try to register a dynamic minor after registering a static minor @@ -601,20 +580,32 @@ static void __init miscdev_test_conflict_reverse(stru= ct kunit *test) miscdyn.minor =3D MISC_DYNAMIC_MINOR; ret =3D misc_register(&miscdyn); KUNIT_EXPECT_EQ(test, ret, 0); - KUNIT_EXPECT_NE(test, miscdyn.minor, miscstat.minor); + KUNIT_EXPECT_EQ(test, miscdyn.minor, miscstat.minor); KUNIT_EXPECT_TRUE(test, is_valid_dynamic_minor(miscdyn.minor)); if (ret =3D=3D 0) misc_deregister(&miscdyn); +} =20 - miscdev_test_can_open(test, &miscstat); +/* Take minor(> MISC_DYNAMIC_MINOR) as invalid when register miscdevice */ +static void miscdev_test_invalid_input(struct kunit *test) +{ + struct miscdevice misc_test =3D { + .minor =3D MISC_DYNAMIC_MINOR + 1, + .name =3D "misc_test", + .fops =3D &miscdev_test_fops, + }; + int ret; =20 - misc_deregister(&miscstat); + ret =3D misc_register(&misc_test); + KUNIT_EXPECT_EQ(test, ret, -EINVAL); + if (ret =3D=3D 0) + misc_deregister(&misc_test); } =20 static struct kunit_case test_cases[] =3D { - KUNIT_CASE(kunit_dynamic_minor), KUNIT_CASE(kunit_static_minor), KUNIT_CASE(kunit_misc_dynamic_minor), + KUNIT_CASE(miscdev_test_invalid_input), KUNIT_CASE_PARAM(miscdev_test_twice, miscdev_gen_params), KUNIT_CASE_PARAM(miscdev_test_duplicate_minor, miscdev_gen_params), KUNIT_CASE(miscdev_test_duplicate_name), --=20 2.34.1 From nobody Tue Oct 7 03:46:22 2025 Received: from outbound.pv.icloud.com (p-west1-cluster3-host7-snip4-1.eps.apple.com [57.103.66.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8EF5D26C3BF for ; Mon, 14 Jul 2025 15:34:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=57.103.66.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752507296; cv=none; b=U2iBhLkXRgp+D7QrZCNwz3LZht0GU+KT/HbgZ5lDLSdrA2MTYCbJFJbHPnXEC2BTPcXnqjiLHL7T49iNuSdfFxcV1jS1YzIW5rnSqR29PZ5zrh/6pYDTtQMXuKuN9KZbi5McUAjnT7EScpdb1VdL009arc4K4Y7O0xQgTEBlv8c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752507296; c=relaxed/simple; bh=TTuqobUufVwrnwuD1IpvKVLEgpKlWt0plFOqbx/QrjY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OVv8zayfSiCVxnasPLTqY8fHTsVZ07Icwaz+B24+1wil8H2zjItqILstwqQZ98nJNWwAJfmVLtJH/bzVZ0n+kcwvj2pdei0SZkJ9fVXuJwlRMfnn0ewutZAmMUVVZxVE13IFCS4bfS2eCkUFAd0aRoeh+T22TUSqxnr2bF/M5/4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=Bz+j76Ap; arc=none smtp.client-ip=57.103.66.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="Bz+j76Ap" Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by outbound.pv.icloud.com (Postfix) with ESMTPS id 6EEFD1801880; Mon, 14 Jul 2025 15:34:52 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; bh=wluaQIx6vNF4mIxEAfAmvtmQ3di1DI0LWcOfCkaux/0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:x-icloud-hme; b=Bz+j76ApzBjawY/3TpvihGTDAxWLfwc1I8VLCVMAaMLvsoGvOc5JC0ctaXXbjj9nkAgZrz/1cgnKI8/Ia+5TVXwIuXm4K1AQHXkMx52VQHNx3cxxlnFfSX4jnRWRZrlsDF2vDmh+aYWqsjmJtXrTHxlP3W6cTyqP2sqC/QV2fpENmDBTXi8CsAVkQ1qALiEue6qk3SKyUs2YEMRd64xuyDJzZse9wQ8uaze20y3XQLcMwy6hGchrjxu4+4AksD57IyW18A/t5s45/fOUUVKD1MHvdDnA7UtDAZmxSu62/yz9WEfZz0Ay4AZ9wlZf/ujrK0RLKfIh8u82REKpr0MARg== Received: from [192.168.1.26] (pv-asmtp-me-k8s.p00.prod.me.com [17.56.9.36]) by outbound.pv.icloud.com (Postfix) with ESMTPSA id BBD0F180048E; Mon, 14 Jul 2025 15:34:48 +0000 (UTC) From: Zijun Hu Date: Mon, 14 Jul 2025 23:34:14 +0800 Subject: [PATCH v6 3/8] char: misc: Disallow registering miscdevice whose minor > MISC_DYNAMIC_MINOR Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250714-rfc_miscdev-v6-3-2ed949665bde@oss.qualcomm.com> References: <20250714-rfc_miscdev-v6-0-2ed949665bde@oss.qualcomm.com> In-Reply-To: <20250714-rfc_miscdev-v6-0-2ed949665bde@oss.qualcomm.com> To: Arnd Bergmann , Greg Kroah-Hartman , "James E.J. Bottomley" , Helge Deller , "David S. Miller" , Andreas Larsson Cc: Thadeu Lima de Souza Cascardo , Zijun Hu , linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, sparclinux@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzE0MDA5MyBTYWx0ZWRfX+/898YEU3enI D9VTEule/6ak4DxfVWMjjssMMXh2InYWKlTvX4OxHzkXwmC/2tbmF9Fr0R2agQYPwHQ/GerCNhY Y0BgeVjPYAszPTKyoytAheLWGQWDZUCCwOGLRKD6mnwj/SeRBoGgzg3eBzV1u4MlTxI7rfrZI5h 2HOXzLvAxaIK01SVj/LjQ84vAUZ6d4zJwd4eqWIwNXlPks6FkMLjvEPTQa5Kf3u6ni85U9jvDVE srN1qk6/9KglhmS6t1fquO0bXMiPm29kMzJRI6hvQkSUz108g9gdKMo9hcvMgmVRsKKWKrNug= X-Proofpoint-GUID: mt4cdlquCnfqFGgMLV1eLZ1npNrDguKk X-Proofpoint-ORIG-GUID: mt4cdlquCnfqFGgMLV1eLZ1npNrDguKk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-07-14_01,2025-07-14_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 bulkscore=0 clxscore=1015 adultscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.22.0-2506060001 definitions=main-2507140093 From: Zijun Hu Currently, It is allowed to register miscdevice with minor > 255 which is defined by macro MISC_DYNAMIC_MINOR, and cause: - Chaos regarding division and management of minor codes. - Registering failure if the minor was allocated to other dynamic request. Fortunately, in-kernel users have not had such usage yet. Fix by refusing to register miscdevice whose minor > 255. Also bring in a very simple minor code space division and management: < 255 : Fixed minor code =3D=3D 255 : Indicator to request dynamic minor code > 255 : Dynamic minor code requested, 1048320 minor codes totally And all fixed minors allocated should be registered in 'linux/miscdevice.h' Signed-off-by: Zijun Hu --- drivers/char/misc.c | 6 ++++++ include/linux/miscdevice.h | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/drivers/char/misc.c b/drivers/char/misc.c index 558302a64dd908aee30341547a5413df1af71459..b8e66466184fa21fb66d968db79= 50e0b5669ac43 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c @@ -210,6 +210,12 @@ int misc_register(struct miscdevice *misc) int err =3D 0; bool is_dynamic =3D (misc->minor =3D=3D MISC_DYNAMIC_MINOR); =20 + if (misc->minor > MISC_DYNAMIC_MINOR) { + pr_err("Invalid fixed minor %d for miscdevice '%s'\n", + misc->minor, misc->name); + return -EINVAL; + } + INIT_LIST_HEAD(&misc->list); =20 mutex_lock(&misc_mtx); diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h index 3e6deb00fc8535a7571f85489c74979e18385bad..565b88efeb23d02b7d91df1cd7d= f4bdcf2898224 100644 --- a/include/linux/miscdevice.h +++ b/include/linux/miscdevice.h @@ -71,6 +71,14 @@ #define USERIO_MINOR 240 #define VHOST_VSOCK_MINOR 241 #define RFKILL_MINOR 242 + +/* + * Misc char device minor code space division related to below macro: + * + * < 255 : Fixed minor code + * =3D=3D 255 : Indicator to request dynamic minor code + * > 255 : Dynamic minor code requested, 1048320 minor codes totally. + */ #define MISC_DYNAMIC_MINOR 255 =20 struct miscdevice { --=20 2.34.1 From nobody Tue Oct 7 03:46:22 2025 Received: from outbound.pv.icloud.com (p-west1-cluster3-host10-snip4-10.eps.apple.com [57.103.66.103]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EDAA126D4EB for ; Mon, 14 Jul 2025 15:35:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=57.103.66.103 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752507303; cv=none; b=kfEsBy0lAd5Y0foJv+6Ms9wWGtYL+TY0oNjVLB33I6vHLgePtZIgRlGpJseyiB6O73qd4gVQWmBixtYwbDV4O873mU/shD4RRJVkHNidEfjhf9VRDbO77s8Yo883/JitSIF8i6hbB5DNM4hY3gBYB2N7pP1muQzBdlZYAT6Y0OA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752507303; c=relaxed/simple; bh=wKm5Ok1D3zI9n6oV/H9sgCnwtCpc6AvdeR7Tt6S9+jU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lur/5oMCtR+Ox9P2sOvIzV5vx/KmhIreWKaebWsfeH5ygg9pZXPR7BYYfyCeDo6GdIbFMc1k/wKRBbdVFc00cRBgWlolRh+zN7bT6EM2YwrFubW3E0d/4IeJpHmdnGqkAZDIbjDzt4XowEoaE6Mqu+bpOCRhSLLjav2J6BYyIhI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=a9MJB15w; arc=none smtp.client-ip=57.103.66.103 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="a9MJB15w" Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by outbound.pv.icloud.com (Postfix) with ESMTPS id 9C581180188A; Mon, 14 Jul 2025 15:34:57 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; bh=J5y+0r7klm10pX3hlor2G5tej0Jv9rOx8255KUf0j6Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:x-icloud-hme; b=a9MJB15waNw3lCcuCI+EU7IOe59DBuGuLJULVmR3FMWMCHc9tyS2FKz5q7PnXHMA1vqYkTM7IL6iYste6s1vCrBmcno5VOcRSlYPvXQDtGVcd7fVgA0WshhyWpqaseMQqPPlI1DYClCmHojKbV1AkegmpCoFFroeGy80mqOeyfoFewNGNAixQqLEbPYzwimvPdaypxkjd4NFMNflP5Qkvyvx/9Ei1OU28wDtYZAX+xbeeqHPfqeB+0W4gqPlqO3sqxx02Qec8J4HjhtS9/2kzH4C0AE/ID4e1QVILIVBswbdlMqJv5s9iJqlBPAioNSaGmRkmu675pUDiurBqejkIg== Received: from [192.168.1.26] (pv-asmtp-me-k8s.p00.prod.me.com [17.56.9.36]) by outbound.pv.icloud.com (Postfix) with ESMTPSA id 9B5871801882; Mon, 14 Jul 2025 15:34:51 +0000 (UTC) From: Zijun Hu Date: Mon, 14 Jul 2025 23:34:15 +0800 Subject: [PATCH v6 4/8] char: misc: Add a case to test registering miscdevice again without reinitialization Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250714-rfc_miscdev-v6-4-2ed949665bde@oss.qualcomm.com> References: <20250714-rfc_miscdev-v6-0-2ed949665bde@oss.qualcomm.com> In-Reply-To: <20250714-rfc_miscdev-v6-0-2ed949665bde@oss.qualcomm.com> To: Arnd Bergmann , Greg Kroah-Hartman , "James E.J. Bottomley" , Helge Deller , "David S. Miller" , Andreas Larsson Cc: Thadeu Lima de Souza Cascardo , Zijun Hu , linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, sparclinux@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-GUID: PqOyCh97thQlN21iSEb8dgac6fqGku04 X-Proofpoint-ORIG-GUID: PqOyCh97thQlN21iSEb8dgac6fqGku04 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzE0MDA5MyBTYWx0ZWRfX6EGHniU6gdYW fX+6aquLvCGR3Vg75ECGAW5XHoyvhn/gKSMVBRai2yQH9xaoUZ2zJS8cZBjOe5gR2JhPAcN5bje B02naDuwIQtDsmO5o8x0llrPtL/rl8+vdP6uTDi1333rKnb9POtr1nt0DXTTwU6JVM/BRCnPY4g gfzOvrahhv3brqU33GVlERqEMs6PHoUhCfEL3CEM44i+RjmXYFDCHOHFU+QfRpoXDJd4Ddo2ZZD Kw1z09LuovIzAhN6Pk/OKeAqSIFjpUmR2ib9cLrArwXmAMj9KEhYAh2t8V+jmBPeYloafrvdQ= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-07-14_01,2025-07-14_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 spamscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 clxscore=1015 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.22.0-2506270000 definitions=main-2507140093 From: Zijun Hu For miscdevice who wants dynamic minor, add a cast to test if it can be successfully registered again without reinitialization: 1) Provide Both miscdevice @dev_A and @dev_B want to request dynamic minor by initializing their minor to MISC_DYNAMIC_MINOR. 2) Register then de-register @dev_A. 3) Register @dev_B. 4) Register @dev_A again without reinitialization. 5) Check if @dev_A can be successfully registered. Signed-off-by: Zijun Hu --- drivers/char/misc_minor_kunit.c | 44 +++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 44 insertions(+) diff --git a/drivers/char/misc_minor_kunit.c b/drivers/char/misc_minor_kuni= t.c index 3184f383bea8c77cbca69ff5e315ea5de2d5512e..6fc8b05169c5754b96588088471= a844a2e2ee29b 100644 --- a/drivers/char/misc_minor_kunit.c +++ b/drivers/char/misc_minor_kunit.c @@ -602,6 +602,49 @@ static void miscdev_test_invalid_input(struct kunit *t= est) misc_deregister(&misc_test); } =20 +/* + * Verify if @miscdyn_a can still be registered successfully without + * reinitialization even if its minor ever owned was requested by + * another miscdevice such as @miscdyn_b. + */ +static void miscdev_test_dynamic_reentry(struct kunit *test) +{ + struct miscdevice miscdyn_a =3D { + .name =3D "miscdyn_a", + .minor =3D MISC_DYNAMIC_MINOR, + .fops =3D &miscdev_test_fops, + }; + struct miscdevice miscdyn_b =3D { + .name =3D "miscdyn_b", + .minor =3D MISC_DYNAMIC_MINOR, + .fops =3D &miscdev_test_fops, + }; + int ret, minor_a; + + ret =3D misc_register(&miscdyn_a); + KUNIT_ASSERT_EQ(test, ret, 0); + KUNIT_EXPECT_TRUE(test, is_valid_dynamic_minor(miscdyn_a.minor)); + minor_a =3D miscdyn_a.minor; + if (ret !=3D 0) + return; + misc_deregister(&miscdyn_a); + + ret =3D misc_register(&miscdyn_b); + KUNIT_ASSERT_EQ(test, ret, 0); + KUNIT_EXPECT_EQ(test, miscdyn_b.minor, minor_a); + if (ret !=3D 0) + return; + + ret =3D misc_register(&miscdyn_a); + KUNIT_ASSERT_EQ(test, ret, 0); + KUNIT_EXPECT_TRUE(test, is_valid_dynamic_minor(miscdyn_a.minor)); + KUNIT_EXPECT_NE(test, miscdyn_a.minor, miscdyn_b.minor); + if (ret =3D=3D 0) + misc_deregister(&miscdyn_a); + + misc_deregister(&miscdyn_b); +} + static struct kunit_case test_cases[] =3D { KUNIT_CASE(kunit_static_minor), KUNIT_CASE(kunit_misc_dynamic_minor), @@ -611,6 +654,7 @@ static struct kunit_case test_cases[] =3D { KUNIT_CASE(miscdev_test_duplicate_name), KUNIT_CASE(miscdev_test_duplicate_name_leak), KUNIT_CASE_PARAM(miscdev_test_duplicate_error, miscdev_gen_params), + KUNIT_CASE(miscdev_test_dynamic_reentry), {} }; =20 --=20 2.34.1 From nobody Tue Oct 7 03:46:22 2025 Received: from outbound.pv.icloud.com (p-west1-cluster4-host5-snip4-1.eps.apple.com [57.103.65.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 52D5126E70A for ; Mon, 14 Jul 2025 15:35:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=57.103.65.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752507306; cv=none; b=jxHWjQvGMxeVwcEMsyJDKWij5Yzy2FyuNx8V5rwRAfs7OPy1mpQJO28msdu3aEpdn+ffAlCS4A9Kz/qW46Q7xnZEYY4vEwzUTa4wgvHNQNC/IaxWTYaINN92eyws89+s5sLpng9Zo6N/Dj0gaEVDOZAYgvuroIDPZmiWYF6zhKo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752507306; c=relaxed/simple; bh=eshisZtYAF5M0I/Zut15wV8ExZsTXycJdpBzHiNHH1w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PHbeCyuqucViSCkKbowmwKJZcwY5RQfyXbnZcEPyUsRgvypq8sxYwa54ydFkTuyQNzbk9Sgt0QoC+8ICyHn9Rg+EGc/dRnNdGfvvHxqbIn7sV7hkLx7EaeLGo6H2i6pxB22ATvB55ANL7nIcveNMs9OLwoNITqLbJ0EuapiPAik= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=TwqYTf6b; arc=none smtp.client-ip=57.103.65.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="TwqYTf6b" Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by outbound.pv.icloud.com (Postfix) with ESMTPS id 1951A18001D6; Mon, 14 Jul 2025 15:35:00 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; bh=BCo7Uun6O1breLXuGzMI+t3D8x2YIh7KSj6H+MOUQrQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:x-icloud-hme; b=TwqYTf6bj5RX+JLlCSfqq3FknjM6iAHH28uV1ZiVUYhFHn8Wcim9Ipc5Nz6kBcCKh3TpWp6dMx7z98gXe0hIILfMtSgRC/GUGZJoXNzAtmJ24IkjrOTwPimn3VINzZ4mCs0TH0kWsG0xTFHVGNM53Ew+Kc+bUKDzSwUoHlJcERqwv6piEsl9har024hIxKUjdG+Bnq9hhlp7c68j8Ew4I1Ci+s164TSTW9JOb8B4orUPElHUVCIn9y4lwo7i56ignx5fhEUa4jlgWN/2eeOOOepedJQrtg5/W+OPB04HEllJu/KcmGKCbxhxJKqDPGhZCK1i75KTdFMKkixpCTTt3A== Received: from [192.168.1.26] (pv-asmtp-me-k8s.p00.prod.me.com [17.56.9.36]) by outbound.pv.icloud.com (Postfix) with ESMTPSA id E2C641801886; Mon, 14 Jul 2025 15:34:56 +0000 (UTC) From: Zijun Hu Date: Mon, 14 Jul 2025 23:34:16 +0800 Subject: [PATCH v6 5/8] char: misc: Make misc_register() reentry for miscdevice who wants dynamic minor Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250714-rfc_miscdev-v6-5-2ed949665bde@oss.qualcomm.com> References: <20250714-rfc_miscdev-v6-0-2ed949665bde@oss.qualcomm.com> In-Reply-To: <20250714-rfc_miscdev-v6-0-2ed949665bde@oss.qualcomm.com> To: Arnd Bergmann , Greg Kroah-Hartman , "James E.J. Bottomley" , Helge Deller , "David S. Miller" , Andreas Larsson Cc: Thadeu Lima de Souza Cascardo , Zijun Hu , linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, sparclinux@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-ORIG-GUID: HNaKUjZ26-DxH1C_2H7Pe8wga-WN7GGw X-Proofpoint-GUID: HNaKUjZ26-DxH1C_2H7Pe8wga-WN7GGw X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzE0MDA5MyBTYWx0ZWRfXyjLFBeOX2rTe TkR1yBQDUrEzCze/iVhxTemxyhhJeo10nFosoNwj01K27CapgwcuGZVXSTQssP4nRapgcPntZAf SbTZweO7pT10ACdNoKMT3Wv9CXC2llQSkPRt2vAQRllQ+JxNNJFFgAJxJSyloHZIZbFeqVlRcZn yU+nFBu5XtNKz5j1ortgkBFBPgi4fIveMLbv4qYvP5QZnrIEgOxwGQtBvUYiEyJMGfmMAF+SrKH CoTf5pKs88hswiYCr/o9fnKhXNNbhnByEKzP5wU7TYv+ZSzpogfUEtR5Nce3u6mWbNjR+s6cc= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-07-14_01,2025-07-14_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 suspectscore=0 clxscore=1015 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.22.0-2506060001 definitions=main-2507140093 From: Zijun Hu For miscdevice who wants dynamic minor, it may fail to be registered again without reinitialization after being de-registered, which is illustrated by kunit test case miscdev_test_dynamic_reentry() newly added. There is a real case found by cascardo when a part of minor range were contained by range [0, 255): 1) wmi/dell-smbios registered minor 122, and acpi_thermal_rel registered minor 123 2) unbind "int3400 thermal" driver from its device, this will de-register acpi_thermal_rel 3) rmmod then insmod dell_smbios again, now wmi/dell-smbios is using minor 123 4) bind the device to "int3400 thermal" driver again, acpi_thermal_rel fails to register. Some drivers may reuse the miscdevice structure after they are deregistered If the intention is to allocate a dynamic minor, if the minor number is not reset to MISC_DYNAMIC_MINOR before calling misc_register(), it will try to register a previously dynamically allocated minor number, which may have been registered by a different driver. One such case is the acpi_thermal_rel misc device, registered by the int3400 thermal driver. If the device is unbound from the driver and later bound, if there was another dynamic misc device registered in between, it would fail to register the acpi_thermal_rel misc device. Other drivers behave similarly. Actually, this kind of issue is prone to happen if APIs misc_register()/misc_deregister() are invoked by driver's probe()/remove() separately. Instead of fixing all the drivers, just reset the minor member to MISC_DYNAMIC_MINOR in misc_deregister() in case it was a dynamically allocated minor number, as error handling of misc_register() does. Cc: Thadeu Lima de Souza Cascardo Signed-off-by: Zijun Hu --- Thank you cascardo for sharing a real case and help to rework commit message. (^^)(^^) --- drivers/char/misc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/char/misc.c b/drivers/char/misc.c index b8e66466184fa21fb66d968db7950e0b5669ac43..96ed343cf5c8509a09855020049= a9af82a3ede95 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c @@ -288,6 +288,8 @@ void misc_deregister(struct miscdevice *misc) list_del(&misc->list); device_destroy(&misc_class, MKDEV(MISC_MAJOR, misc->minor)); misc_minor_free(misc->minor); + if (misc->minor > MISC_DYNAMIC_MINOR) + misc->minor =3D MISC_DYNAMIC_MINOR; mutex_unlock(&misc_mtx); } EXPORT_SYMBOL(misc_deregister); --=20 2.34.1 From nobody Tue Oct 7 03:46:22 2025 Received: from outbound.pv.icloud.com (p-west1-cluster6-host6-snip4-4.eps.apple.com [57.103.67.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 99B3D26F467 for ; Mon, 14 Jul 2025 15:35:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=57.103.67.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752507309; cv=none; b=ZH6rlY4hBdOgYG0ExKUkpHVj7evHLah26AFJrEjf2rOMC37SWpSAOnm3ZKLv18wGG7+eTeDhc20Du3utAmi+xZtRf+vD+VYHPKnQteNnU/HjkthK+mNo3MnO3bSWpub3RRZF3WZWKT0plMzvNd+eAodJfRQONthNb4nDvMcUJwQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752507309; c=relaxed/simple; bh=GmLJREgMmOkeIecrSY+/IN5+fI/c8dpwLjgxKhe9ThQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PfxkxhjMEPdoMQ+TV4sGZ9lnVtl9SDfHFCfBYp1oDH+yYhcoKoA40epmOWktwFAgiroPR+2EismvH3otrsjg8BQepQyEroJwFJVPxW1w9/O10bQLa86nmJVxQeb5gkpyYINSgf1THehdUSVJP2vrtCy4Js8/opFZxwe03SYip2U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=c7oLF3lk; arc=none smtp.client-ip=57.103.67.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="c7oLF3lk" Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by outbound.pv.icloud.com (Postfix) with ESMTPS id 6219C18001EB; Mon, 14 Jul 2025 15:35:05 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; bh=NlEAtJr1Bx/RZGVdSX3DjVXIyd/dRfrLp0ZsvLqNLMw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:x-icloud-hme; b=c7oLF3lkGaoWWjNUBf6tXwVr3j6jgbrGMq90CSsK/13aCWSIo+A/v7lQwZ7S+tKZt0uYtKB0DKwYcU34jGGl6T0TanWlIZ3zuaxidyQLAADcO5YzebAawFyaAQWbcqFJcSPoHPrh++yGiJHu+g8o6gwe1urgh8Y+s5YPf2hOkus9DCO0MuFAsRbycIsg07EZXgVvbvxQc1rmK4rCxLl2q4f37nS3igtfFSRLPfFXLPTFUb3cpWdJjN8DvZlANj+eElj5qhtTRyuf+j8embemTPVRQYhDXTp5dzMexE9koXfTSKmz0aVvZeKf568wdaQkSW6goDwEBqZRwvCAWWOwdg== Received: from [192.168.1.26] (pv-asmtp-me-k8s.p00.prod.me.com [17.56.9.36]) by outbound.pv.icloud.com (Postfix) with ESMTPSA id C296018004A7; Mon, 14 Jul 2025 15:35:00 +0000 (UTC) From: Zijun Hu Date: Mon, 14 Jul 2025 23:34:17 +0800 Subject: [PATCH v6 6/8] char: misc: Does not request module for miscdevice with dynamic minor Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250714-rfc_miscdev-v6-6-2ed949665bde@oss.qualcomm.com> References: <20250714-rfc_miscdev-v6-0-2ed949665bde@oss.qualcomm.com> In-Reply-To: <20250714-rfc_miscdev-v6-0-2ed949665bde@oss.qualcomm.com> To: Arnd Bergmann , Greg Kroah-Hartman , "James E.J. Bottomley" , Helge Deller , "David S. Miller" , Andreas Larsson Cc: Thadeu Lima de Souza Cascardo , Zijun Hu , linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, sparclinux@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-GUID: PqswYpUNmBr6YvuF4Saoh2xAbmeigoXf X-Proofpoint-ORIG-GUID: PqswYpUNmBr6YvuF4Saoh2xAbmeigoXf X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzE0MDA5MyBTYWx0ZWRfXwQgd2T59rOmN OMek1/hivKot52/D/iylgEGlY9iFWzhswTHIpzZSCmpUOvZrH9RP5+2s7mc+O3oU9db3jnvfVUp jXk4VZo2/TiQBHpO8EnV9I6mYAt4fAIsYYfmQMiSxtKZ4Tt2VX9dIdy4xi7P2sNm+ZoTGfihH/J dKjntu7e/PUMxvkfSNJzd29Xi11lNokdLBZq4QkFwcuZr6tV38EuBcv2DO4GzhUSxbcsuM9D61L cD4JOZX35O4GqcMLsdw/kX4IkoFGAn9ARy1Bf/BIQbna/J/0IHdugjcsGkrC3XRGkTr0sQ1+A= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-07-14_01,2025-07-14_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 spamscore=0 malwarescore=0 mlxscore=0 bulkscore=0 adultscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.22.0-2506270000 definitions=main-2507140093 From: Zijun Hu misc_open() may request module for miscdevice with dynamic minor, which is meaningless since: - The dynamic minor allocated is unknown in advance without registering miscdevice firstly. - Macro MODULE_ALIAS_MISCDEV() is not applicable for dynamic minor. Fix by only requesting module for miscdevice with fixed minor. Acked-by: Thadeu Lima de Souza Cascardo Signed-off-by: Zijun Hu --- drivers/char/misc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/char/misc.c b/drivers/char/misc.c index 96ed343cf5c8509a09855020049a9af82a3ede95..a0aae0fc792666a7bdc0ba00da9= dc02ff9cead42 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c @@ -132,7 +132,8 @@ static int misc_open(struct inode *inode, struct file *= file) break; } =20 - if (!new_fops) { + /* Only request module for fixed minor code */ + if (!new_fops && minor < MISC_DYNAMIC_MINOR) { mutex_unlock(&misc_mtx); request_module("char-major-%d-%d", MISC_MAJOR, minor); mutex_lock(&misc_mtx); @@ -144,10 +145,11 @@ static int misc_open(struct inode *inode, struct file= *file) new_fops =3D fops_get(iter->fops); break; } - if (!new_fops) - goto fail; } =20 + if (!new_fops) + goto fail; + /* * Place the miscdevice in the file's * private_data so it can be used by the --=20 2.34.1 From nobody Tue Oct 7 03:46:22 2025 Received: from outbound.pv.icloud.com (p-west1-cluster3-host10-snip4-1.eps.apple.com [57.103.66.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6632626F467 for ; Mon, 14 Jul 2025 15:35:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=57.103.66.94 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752507314; cv=none; b=VT5vnaZvxwFvydstax6o/cUyg9kM0gzGfW4JuJ6ddF5BLrlZwpCD0dfyeqdv7D/zlzzj88Td3cWgA8hA5nwZj1PcnrBJf5+26o4o03nxA/BZNzk1SBxj0EQVFbAJByoNfLqdiGU+Ata+jbGlmP4/Dyw4lDiH2XoN1PFJLH6rNQA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752507314; c=relaxed/simple; bh=abVLHhlrbRD4j7Q9knssLHFcwdKTohtl5aEN2e8X638=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OLTUicYmyHcScIwISMvieMiPWNzJfnTd9g8OhAl+vgG1s58/gjdcM6p7kixgFtry6I2sRdVujGy3t93KDTfqzwQR1Su5XOScA7H8fC4CkiqgM1RxpsUnS4+ZeUnKPPTfhSMT+hXuoQQsJr8aJYy9boG+2dS9lBTUhXUUHQqszCk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=kNg+BrQo; arc=none smtp.client-ip=57.103.66.94 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="kNg+BrQo" Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by outbound.pv.icloud.com (Postfix) with ESMTPS id 39EAD1800200; Mon, 14 Jul 2025 15:35:09 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; bh=OZilOEgmhkbniE4e1rdKTYefieL2PDjJBxvY1WxL31Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:x-icloud-hme; b=kNg+BrQoXkvffPGUi5n/9f/Jnc0+GwYbCdzztqGR7RZMah3BQQiubSxG9AWaQIpmm0XlbZ2Jr3nUkOZUA0Iuc+hw9wDPmJWibDqpRzO2zak33beBDUYSuvnLps5uf7rPLbKL/3tKq+gBaFTXjVk2Iw9xRhMJs1b5vh30GoEvoexUP/pUHP7dy9GkFTHnJaln3rL5J5rQ0odmQAYrNq9H4Xk7iVkZczzQa+rwbCogo4GYyAIaDZ1tReHyH/EOHIMjiwgu56OkJXVozucdgBSBOE7sbErTUzuRe4W+NJfxirwiYOM8Zw3ELvr5woUWA5A0EfphU+5IKhjFtcrtBPbwWA== Received: from [192.168.1.26] (pv-asmtp-me-k8s.p00.prod.me.com [17.56.9.36]) by outbound.pv.icloud.com (Postfix) with ESMTPSA id 17CEB18004AE; Mon, 14 Jul 2025 15:35:04 +0000 (UTC) From: Zijun Hu Date: Mon, 14 Jul 2025 23:34:18 +0800 Subject: [PATCH v6 7/8] char: misc: Register fixed minor EISA_EEPROM_MINOR in linux/miscdevice.h Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250714-rfc_miscdev-v6-7-2ed949665bde@oss.qualcomm.com> References: <20250714-rfc_miscdev-v6-0-2ed949665bde@oss.qualcomm.com> In-Reply-To: <20250714-rfc_miscdev-v6-0-2ed949665bde@oss.qualcomm.com> To: Arnd Bergmann , Greg Kroah-Hartman , "James E.J. Bottomley" , Helge Deller , "David S. Miller" , Andreas Larsson Cc: Thadeu Lima de Souza Cascardo , Zijun Hu , linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, sparclinux@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-ORIG-GUID: A_SWEXpZH4lOMO2gf5QVLjFiD8bnOcy1 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzE0MDA5MyBTYWx0ZWRfX+MdopjM0NIx9 EMB4s6jqLmSqVVkQubV6RlLcZPwNwmZhlGNndnOAQbD2tyge+G3kYHi58diHkFGIfANHGRtkn5B dZ3PP/nMdX5yRbLs4JZb0KZ2P7MOjQaOjXSyx4TijQ33eubTWkE99ESGIJP87oZp6HOBzuY6dFb mcfmATHZH6FXcVCM5XCvJHWrg40IItNRwFLsfTnNueWbLOR4a75E6ly/xDmBlrxSgmp1c76fVP/ ImdtX6nJGzUXNuExgG52wAgykHSCeszpevcnpzQAwdd64KumBIc9rIQSgkr1jpFSvOBpyaGNA= X-Proofpoint-GUID: A_SWEXpZH4lOMO2gf5QVLjFiD8bnOcy1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-07-14_01,2025-07-14_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 clxscore=1015 malwarescore=0 phishscore=0 bulkscore=0 adultscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.22.0-2506270000 definitions=main-2507140093 From: Zijun Hu Move fixed minor EISA_EEPROM_MINOR definition to linux/miscdevice.h. Signed-off-by: Zijun Hu --- drivers/parisc/eisa_eeprom.c | 2 -- include/linux/miscdevice.h | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/parisc/eisa_eeprom.c b/drivers/parisc/eisa_eeprom.c index 443b15422fc179c7379082bb165ea2bb80785fb3..601cbb22574fd64b0c6be568442= d5064d38a2c20 100644 --- a/drivers/parisc/eisa_eeprom.c +++ b/drivers/parisc/eisa_eeprom.c @@ -15,8 +15,6 @@ #include #include =20 -#define EISA_EEPROM_MINOR 241 - static loff_t eisa_eeprom_llseek(struct file *file, loff_t offset, int ori= gin) { return fixed_size_llseek(file, offset, origin, HPEE_MAX_LENGTH); diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h index 565b88efeb23d02b7d91df1cd7df4bdcf2898224..7d0aa718499cc1867790e98eb6b= 84c1673091905 100644 --- a/include/linux/miscdevice.h +++ b/include/linux/miscdevice.h @@ -70,6 +70,7 @@ #define UHID_MINOR 239 #define USERIO_MINOR 240 #define VHOST_VSOCK_MINOR 241 +#define EISA_EEPROM_MINOR 241 #define RFKILL_MINOR 242 =20 /* --=20 2.34.1 From nobody Tue Oct 7 03:46:22 2025 Received: from outbound.pv.icloud.com (p-west1-cluster1-host8-snip4-6.eps.apple.com [57.103.64.39]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6BA5326528B for ; Mon, 14 Jul 2025 15:35:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=57.103.64.39 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752507321; cv=none; b=o/jzbtW6l5JRGD3uPwMdLjyxLc3u9LqS+AgvjJCw1MqZcOiUtgj1TZS8noY1wY3nhkMIIgRFnqxWWN38TrT0kCmvirrrtJvde6TQ/w1LW5ZtmEtgsF3kS0NpfT1qBEwJwj4m91pyL74JmSB94J8bJ5I7P1t++HrmR7VICIpAa3M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752507321; c=relaxed/simple; bh=rUPc6HarIFgYCi5PCcb/6kreZya/jVbJye2++gX7mpw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IrFszb8V1zjSUAoFBqrNbSHZkmvbDCVSjLv1S0PmtR6dCbiw2H7yo3cNitmXFg7X2fayjpKeS1FCP+KNrYOxCOeq/3IOOCBs3wwxk9Nxluw5sIY/J5IKfkabv1krTUGp0g64bNq1t+MVkVeM0f+LmUDbm7LNWLLtN2cDv+J0hXo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=xbD9u5Fj; arc=none smtp.client-ip=57.103.64.39 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="xbD9u5Fj" Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by outbound.pv.icloud.com (Postfix) with ESMTPS id 5240B18004BC; Mon, 14 Jul 2025 15:35:13 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; bh=MxR3vmUTXOypUpeb+mW6WO9zX6HevJTvOmfA6oc0iJM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:x-icloud-hme; b=xbD9u5FjnQyANUrmKm4jq+QkelC03JFjr828Ui2YO4h85h+vm22GwNY3Kea6aC6Q+Exrxksz+eIZeWEiLcG6zyim/IOjeUmrKjiLPV1otAPR6k1R1LdNdnyvf//l74cmbectrQmZ8L/aSHEIP8R++U26F1CzWb6NOCr/lID/LfSU0JgEJDf6eIM9STaC74bjuJS6ZBZXSU4Tf3Vl/oJ3hbboqMiFKMHxFPE7wlpALBplewQGHRA7BTgiMvR+swWTL1Y8suDaWE+Z7+8CPH6kfJXTUfSeofjPqhwJfkZWwpjBUSorivA2vQM8jZmSBamh9RiDcmQpg1bIa2wdiGY4dg== Received: from [192.168.1.26] (pv-asmtp-me-k8s.p00.prod.me.com [17.56.9.36]) by outbound.pv.icloud.com (Postfix) with ESMTPSA id 2DBFB18004AF; Mon, 14 Jul 2025 15:35:09 +0000 (UTC) From: Zijun Hu Date: Mon, 14 Jul 2025 23:34:19 +0800 Subject: [PATCH v6 8/8] sparc: kernel: apc: Remove macro APC_MINOR definition Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250714-rfc_miscdev-v6-8-2ed949665bde@oss.qualcomm.com> References: <20250714-rfc_miscdev-v6-0-2ed949665bde@oss.qualcomm.com> In-Reply-To: <20250714-rfc_miscdev-v6-0-2ed949665bde@oss.qualcomm.com> To: Arnd Bergmann , Greg Kroah-Hartman , "James E.J. Bottomley" , Helge Deller , "David S. Miller" , Andreas Larsson Cc: Thadeu Lima de Souza Cascardo , Zijun Hu , linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, sparclinux@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzE0MDA5MyBTYWx0ZWRfX151xmLBW09/b K6SHkvSFhVdFlcP1XXLoCRvCCPNoIyN/0q/Cs7GGvom4FL+32RH2LKxuUf9LplGAGxGwmLlNV5R 5UPkQrBSDYtQM5TqbMYBtUHGKIM39bgLS07h9EZsYZEfAh820uyVThm+tqB5XjofiECAOCYsIOb XihCJcAwPrYWa/5zSpFwSm6e51fkSrjiiyO31iAiGuv0ucA1T8LF334p5Yq7Y5Qlg3LMgpUrB8U PypG1/xMlf1QNxxN8RJIWEoU/EX6C6bjva90eV/Wa8KtZ3bv00pksSZtnFxwgsvjexwv13RTw= X-Proofpoint-ORIG-GUID: CZIDtwtu-DxiERIJsUoSJz_qQvAo2zwW X-Proofpoint-GUID: CZIDtwtu-DxiERIJsUoSJz_qQvAo2zwW X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-07-14_01,2025-07-14_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 mlxscore=0 phishscore=0 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.22.0-2506060001 definitions=main-2507140093 From: Zijun Hu Macro APC_MINOR is defined as MISC_DYNAMIC_MINOR to request dynamic minor, but its name 'APC_MINOR' looks like fixed minor. Remove the macro definition and directly use MISC_DYNAMIC_MINOR instead. Signed-off-by: Zijun Hu --- arch/sparc/kernel/apc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/sparc/kernel/apc.c b/arch/sparc/kernel/apc.c index d44725d37e30f388bf8cf19d72baf720f94da084..849db20e7165cdf48d4d36cf770= dd6aaaa191b41 100644 --- a/arch/sparc/kernel/apc.c +++ b/arch/sparc/kernel/apc.c @@ -28,7 +28,6 @@ * #define APC_DEBUG_LED */ =20 -#define APC_MINOR MISC_DYNAMIC_MINOR #define APC_OBPNAME "power-management" #define APC_DEVNAME "apc" =20 @@ -138,7 +137,7 @@ static const struct file_operations apc_fops =3D { .llseek =3D noop_llseek, }; =20 -static struct miscdevice apc_miscdev =3D { APC_MINOR, APC_DEVNAME, &apc_fo= ps }; +static struct miscdevice apc_miscdev =3D { MISC_DYNAMIC_MINOR, APC_DEVNAME= , &apc_fops }; =20 static int apc_probe(struct platform_device *op) { --=20 2.34.1