From nobody Wed Oct 8 04:10:19 2025 Received: from outbound.pv.icloud.com (p-west1-cluster4-host2-snip4-6.eps.apple.com [57.103.65.147]) (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 E9C10275AE7 for ; Wed, 2 Jul 2025 12:16:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=57.103.65.147 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751458574; cv=none; b=UIAU/nk4goC2id92Uu5/UdpQ9NaYxoI9mrtQEu+mkJD43LEYZtpSOI2SQReGSU1rHkvooK45lbir9uAEnlwrcg1QmB//On2TYaO6EjKptJfx92m7jmTjY+vXek4GLu51daEVFCsEvq2D2Vdu7hcPtuKwvGYtwY7yAelakiwxdJc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751458574; c=relaxed/simple; bh=GCOMtzNGxPOUXBf3m2hfp4nlIguiGZVOTq0XkcMtEDY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DHtF7asfKYKQ0cJUjgiVb2e15a4UVux7lAGrWI24/ewDavqxeW3dbPyY+hBV3++8/GhymK+ell9vRJB7P1PWoRnFSbBZKAa0irtptQR8nVD+rjRgOj2SJfwYr996KIEhjotl/9zBzxwv2DNiz0+eXvirfwTfIVEXsuJ0MUE+KfI= 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=Eh/7ipCu; arc=none smtp.client-ip=57.103.65.147 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="Eh/7ipCu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; bh=RqR2RocTuJG7qXywuU1YlEFHpJKHQCBUeEvNifOzZFs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:x-icloud-hme; b=Eh/7ipCuB037F477F8d6elXXNg3J92aI4Pd6TvTWF/DZkb9FV2UBk0U7b87tz0XnT 5UDia5Cobz+MSrgQTpjdtJuxvOQh8UJXaGwvEYSztKCF8hNUdDr5amk+ElxGKHeKll suG1hkZt7hC56Z6YqeZW0eLewT0qwP/3dB6//LF/8BIUKK3Urd3wYqRAXBEczzGb5e x5vQGXcJW3bUF7GZdKpNJKyVBDMTTp1EOY8+TxTrgo+kZ85OTvcVUjYtJ3BiNsGjuT yHwfaBdu6TQX4TK5VLiZTYzoSXEGGBjDHt6UpzAyQwKsvqc8K7Mm2Tym/1xpPpcMIP n3XuofTOs9apQ== Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by outbound.pv.icloud.com (Postfix) with ESMTPS id 8E8D918001C1; Wed, 2 Jul 2025 12:16:10 +0000 (UTC) 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 018E018002A8; Wed, 2 Jul 2025 12:16:07 +0000 (UTC) From: Zijun Hu Date: Wed, 02 Jul 2025 20:15:29 +0800 Subject: [PATCH v3 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: <20250702-rfc_miscdev-v3-1-d8925de7893d@oss.qualcomm.com> References: <20250702-rfc_miscdev-v3-0-d8925de7893d@oss.qualcomm.com> In-Reply-To: <20250702-rfc_miscdev-v3-0-d8925de7893d@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: rt-yOLfEan5MKj4mvMKR0bi2e9OEmHq_ X-Proofpoint-GUID: rt-yOLfEan5MKj4mvMKR0bi2e9OEmHq_ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzAyMDA5OSBTYWx0ZWRfX5jWvyHvcI4k0 pMqkbXbXet5KK1MW5p/MXHMv19kLDG8Oud1Z/YFNiJ20yefI2r0ckJW5MU8LKT32+I7DwlIHegW uEnWvQelZ6H/Ya5h4Mv4b/4LaxP/m9idxQW5y5zn7zt3hRxvVJfBeGD9hxDehlG0BIuEe2HxCZO iNKmxxbQcgImhOsC1rrjgUGdRr8Fl9wduHwgYqKr2dPUbZC35oPxF2yrMFvf72mBOxILqbPOOZx vTFo6/1aK/pHRLhxji9yazJ7OJqH921FN1rdklCUlqjzQeV1J/6yHGq06VvNhr6cfLXcNMCrs= 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-02_01,2025-06-27_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 suspectscore=0 malwarescore=0 clxscore=1015 adultscore=0 mlxlogscore=913 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.22.0-2506060001 definitions=main-2507020099 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..7d10d92edcedbff5957d6c5c342= 6aa9400c94e43 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 Wed Oct 8 04:10:19 2025 Received: from outbound.pv.icloud.com (p-west1-cluster6-host7-snip4-3.eps.apple.com [57.103.67.106]) (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 6CE742701D6 for ; Wed, 2 Jul 2025 12:16:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=57.103.67.106 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751458576; cv=none; b=KlMAczhNwkCDVKqxmpCtfsbY6C6MqV52LBnzBGtxn8rDb0TErfsAKiEzl56Q86wS+CQ84q89DZEgeNhWrsUzdxieuQ9E7OU4EM4ZEPl83oxhwWNoA/4RR4U9QHT0MmNBWd+gDHl8QyhIzBi1WeJk2Chh6bkUNUbkzr7KFaTyFUo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751458576; c=relaxed/simple; bh=t10c3wbLfWLj56jmjaq505ZPwwaPt3mIzV/jqx5DApE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Av+ubfY6ikEwprHZDuMjje8GMN7nquQUXNSBcRKRTsc/uhMZrQr1wkCpMA1Dj+4z6c07SKuZ2RHwa1JIj1sMQkbGPCxkTGALvURBbuQFCtBzKWqiAy/EL0qwK+t/oGzNDsy+c5SzfbaYtElsJpj2KGEUzCYifFxqiSOApY+UGWk= 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=gGUW1koX; arc=none smtp.client-ip=57.103.67.106 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="gGUW1koX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; bh=IRmMn0pZByR3RrqLBiZD8DYJUMudqkbpZZmmyi3kxio=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:x-icloud-hme; b=gGUW1koXpGXAjvtn+iFPdeuoVJvg75nFiYjBqXEis6AtHVOXIXVOMhoQ1uDuEOHJo LfJ6qwQzWhKtHaunEkYwJsfDH7YZK2SEbZ8OG5b+/+be2f0dgOYJUMUY2U8sc6+SZ2 qOqTI92u2YsDzKgnbXgS2vlSBZa7xUo6sL7sP7Bcd/PEBBgPblOwQgKY2rY65o6LCI s12bEFAoNi/BOKSpH0/HaZ0gU4t/U3/Fk1DxD6E8WxhYTiz9oAD5mg0eJuPF7txFSw VTC3q5fpyY+j3V3h4eF2R23QehnAdpPAnAf1DtkTMr9Z6WpjIQBcXFxfOa7CHOX2uL gBvwTjrLRNKUA== Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by outbound.pv.icloud.com (Postfix) with ESMTPS id 25E72180030D; Wed, 2 Jul 2025 12:16:13 +0000 (UTC) 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 85CA218002A5; Wed, 2 Jul 2025 12:16:10 +0000 (UTC) From: Zijun Hu Date: Wed, 02 Jul 2025 20:15:30 +0800 Subject: [PATCH v3 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: <20250702-rfc_miscdev-v3-2-d8925de7893d@oss.qualcomm.com> References: <20250702-rfc_miscdev-v3-0-d8925de7893d@oss.qualcomm.com> In-Reply-To: <20250702-rfc_miscdev-v3-0-d8925de7893d@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: AW1haW4tMjUwNzAyMDA5OSBTYWx0ZWRfX5tl+K5LAkx4a W/hHQBbLm8nnY6MAkkIcKEmOolW2cljnr50XQcTU6c0gfiw1xxEevX4V8VjowbCpmh6M7PIVfek fK6tvExZjwsvytDHa5KjrIsunLS2S75OoNKySMFJKx0v4mv3BEaSHVlY0gUaUmWSUeRQJ5+4Oha 2NQd6BGVTyKp2AccGgtm0DCXiqKjQSFFwWuew3yCU8o5GTF8/t8sArLM42/dc89pBmClbSX16VI Sf1f7B69WPYw5wYpCiSOkSWbreUVIov75oKRzaerP5FxtzuJqRUq2b2w6BHgn7SJSrgbbtbgY= X-Proofpoint-GUID: n2STKvAQMqEoEFFx0J-jN8b6NfkEF72R X-Proofpoint-ORIG-GUID: n2STKvAQMqEoEFFx0J-jN8b6NfkEF72R 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-02_01,2025-06-27_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 clxscore=1015 malwarescore=0 phishscore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.22.0-2506060001 definitions=main-2507020099 From: Zijun Hu Adapt and add test cases for next change which Regards minor which > MISC_DYNAMIC_MINOR as invalid parameter when register miscdevice, hence get a simple minor space division below: |< 255 : Fixed minor code |=3D=3D 255 : Indicator to request dynamic minor code |> 255 : Dynamic minor code requested, 1048320 minor codes totally. 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..81e2ef488a6f6ae7138c7dd8bcb= effe38aa65933 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 __init 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 Wed Oct 8 04:10:19 2025 Received: from outbound.pv.icloud.com (p-west1-cluster6-host1-snip4-4.eps.apple.com [57.103.67.27]) (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 8F3E22777F9 for ; Wed, 2 Jul 2025 12:16:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=57.103.67.27 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751458580; cv=none; b=nXL4b4hc1wssmuWlpR2/9pmxVI29YmYIuIwamhml0BN7ovA8RVzma969npXShpOsT1dXyiHHgmvOmZ6SE2KgWLuF8yVdM4KycmOWiwAZ7wLUd9RoKglUMbLUelRCCnd3aFCz7MC1IAdvbb5Dkl1PhMdju3tHFIksPB2puy87+MY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751458580; c=relaxed/simple; bh=u82rCBgKlEQYqhu1p86SsS2QRJmrpOTRiKIMamiJcNk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FLGVmDACDQY3Np3CNSEgVpYyDCIvg4fEX4Yh+DLlnz6ImcdQCd5lJM6B22DG5zimuZpzFwXjPCB4UyieNwGysJJ/Y0fPSPFN+z7+H6IKhZszJslVWkXaD2mV9duZYFglztjEnJM/MFYBAffhkU5fwqYkyIMhQuQOKvDfNGIO2js= 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=Wso9QrGE; arc=none smtp.client-ip=57.103.67.27 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="Wso9QrGE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; bh=VYM2nGliAAA138H4u5xVRviCZPDvG3NS2VBKVhrf82U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:x-icloud-hme; b=Wso9QrGELcRXHcT4jeMnoY87NHuBDc/mSWyvBiUSPzt8Oa3vYatOJIuVxRXXr528M WewjiZRrpedvHmH0ADjM1s8lMi3XlcPDNmIOoKeijp85Kkg/jJq/ig61oZY6LA1745 m6qtD01NNRvGYcqcfwEKazctvfWeUnQlfqm9tVCDycZL0L5/HI1oV/PJw+pFAqreew etgsicUlxf8r0nJ/OCdxhndJ9Z+VuxyenRCylhJb5zPysiFiCosLezy+1xbreuYAIn w6b5OpjLId39Oqy4dkMipzZp4Fino/zfhXHa9x9LD7v9P2JQPrSneMEWKKomvGMUTl VuxHwWPhnrJ+Q== Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by outbound.pv.icloud.com (Postfix) with ESMTPS id D343D180030C; Wed, 2 Jul 2025 12:16:15 +0000 (UTC) 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 194371800284; Wed, 2 Jul 2025 12:16:12 +0000 (UTC) From: Zijun Hu Date: Wed, 02 Jul 2025 20:15:31 +0800 Subject: [PATCH v3 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: <20250702-rfc_miscdev-v3-3-d8925de7893d@oss.qualcomm.com> References: <20250702-rfc_miscdev-v3-0-d8925de7893d@oss.qualcomm.com> In-Reply-To: <20250702-rfc_miscdev-v3-0-d8925de7893d@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: AW1haW4tMjUwNzAyMDA5OSBTYWx0ZWRfX+oRnsUYkj5bF weo5PVwXdVnu863gISpHSepdoICJ8aLW3ZzxUYgebK/tXmolF9tgZ9P8Be1hnPdqEai5EhDBIMP 4buaKTisk1byBiEqkW6s2/AAwHHghgx0i9ed4tn92PE1TLzFU5/qxK1esFeSvTqTMNwICvBw1jM lJXygEo9m+Mn2oK58sPw7qDjrklLWLz+c0C3it4OSiH6ywLBwIb4KLtT/Y/hBgqtgewvi5n6vlJ T3wlM9cEntOwzVfg8ScYshk9drhG/u3fb0CfofB0NEoQK7fb4gwdukNZ3t6zAEUS/6pZ5W57k= X-Proofpoint-GUID: z4HtHDGY6k9B87KKBCpBnIStB98aPXD9 X-Proofpoint-ORIG-GUID: z4HtHDGY6k9B87KKBCpBnIStB98aPXD9 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-02_01,2025-06-27_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 adultscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 suspectscore=0 clxscore=1015 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.22.0-2506060001 definitions=main-2507020099 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 Wed Oct 8 04:10:19 2025 Received: from outbound.pv.icloud.com (p-west1-cluster6-host11-snip4-8.eps.apple.com [57.103.67.11]) (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 CCB22277CBC for ; Wed, 2 Jul 2025 12:16:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=57.103.67.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751458583; cv=none; b=ubXLPoTjK2NGiygYbmb1NQWqNW9hG8Q/1ABrekl6McqQPkDGycYUrhheXD4NlfD7ocNJ6dY4gjzAOB0wabRYFNU1evJeuOYGXmheOV89tzQePSgwL4UecC447/UEsq0Im3fqPyw1O2kvAKlf/f1K8ngoUVNpbkEdy4WqgzpUxMA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751458583; c=relaxed/simple; bh=+/JsE8myi0XHHT50WY/Nol1Co+hPKThwPGO+1OZRN0A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=shc8lEuD1KZI13C9tVX8bNYcTSmhcjiiRG1T+jnrjWMMlvxxC/bN8pg71O7Jscv25Rqrzs1zmO4vL+U12m77wYFtPsibY4YHxD/36tZTA7hK3DC55xVl3r0YAqoHsj4odRYD6UIyiqOpgsWxoK/qco3zqsFUPsRpqioj0yHrHGE= 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=p/ILYXLN; arc=none smtp.client-ip=57.103.67.11 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="p/ILYXLN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; bh=CZy5/vDPG3HZvwIBs14wKw3g5IIvXPS7GeL0SSSRvtk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:x-icloud-hme; b=p/ILYXLNKjpwXwa/E/CxWalvuoY6G5VMmFU1J5xMQjVqvQFYC3i8P4r7Wjlqzfv8G OdRLQZhZIqV1zRUi/0nbWlQLd0PQbTSgNzHbPru2g/ezRCNRL2ASDHZyPB8dpsBE8j eHciSKMzcXJDPG3HBrLveBc85YE1RdQzfC+ZP+32cXKFSgggLI3cLSlTWDEOXoR0Il Rk5jFDE+7q+dWHWWKByebjZkjhzp/fbJsgnTY4zrWb/odmqak0cjzoBvViAF7hAvKn 2g5MgejStLTxKQRN21D37ngX7ZxNxjYgTn8MmNX4KinB2kcBPxDurlOAM/BLAz4hy8 k4CePbHBvDoog== Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by outbound.pv.icloud.com (Postfix) with ESMTPS id 96F851800C83; Wed, 2 Jul 2025 12:16:18 +0000 (UTC) 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 A0D8618002AD; Wed, 2 Jul 2025 12:16:15 +0000 (UTC) From: Zijun Hu Date: Wed, 02 Jul 2025 20:15:32 +0800 Subject: [PATCH v3 4/8] char: misc: Add a reentry test case about dynamic minor request 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: <20250702-rfc_miscdev-v3-4-d8925de7893d@oss.qualcomm.com> References: <20250702-rfc_miscdev-v3-0-d8925de7893d@oss.qualcomm.com> In-Reply-To: <20250702-rfc_miscdev-v3-0-d8925de7893d@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: A_SSvGMospJKfIYpJqUcCzdkI97bjkRS X-Proofpoint-ORIG-GUID: A_SSvGMospJKfIYpJqUcCzdkI97bjkRS X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzAyMDA5OSBTYWx0ZWRfXzrbx4CvmPvU/ Hk6TTJhSho8+2y4UX4s2un5VqAPEhXM/RWGas/yOhOY87i3qg1VmY7EF0XTuXlBdImoh5d/USli QRTunG5C9tzcZaOTDdPNQOXrCT/u5JSY4OqxXdMzC5IsrzQy1ckpYVRAVr8VvsCxhiph2UboL/B 1ennpTDqXbfG155IOUQccbDI/Dm390JacmORbvF2xA8wGADXLALByY6HgD8pomHhrcUXd1EpI/7 H7leczO13Spr76hPY/xacSfKIefAq4xTtYuVz5ZAYx2Ro/DUFcOvzYGYmRoo8+cLG28PdUiks= 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-02_01,2025-06-27_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 adultscore=0 spamscore=0 clxscore=1015 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.22.0-2506060001 definitions=main-2507020099 From: Zijun Hu Add a case to test reentry about requesting dynamic minor: 1) Provide Both @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 registered successfully. 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 81e2ef488a6f6ae7138c7dd8bcbeffe38aa65933..9f1f77c04f9f1be56bc94cab412= 7ecb941e128b2 100644 --- a/drivers/char/misc_minor_kunit.c +++ b/drivers/char/misc_minor_kunit.c @@ -602,6 +602,49 @@ static void __init miscdev_test_invalid_input(struct k= unit *test) 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 __init 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 Wed Oct 8 04:10:19 2025 Received: from outbound.pv.icloud.com (p-west1-cluster1-host5-snip4-10.eps.apple.com [57.103.64.53]) (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 71AC7279346 for ; Wed, 2 Jul 2025 12:16:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=57.103.64.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751458587; cv=none; b=R5L8Sd56h4tWSbZez1aDrgD8xlqffyFQcft4RUeH3LdcOPSOPsHteF6g7nFQLylx7xftjri/94aMgolI2V4SycrCWN7TeQKnRb277ulUrI1fhUaLFTM20xvyD/jFnC4XdrH+nfJA7x854cz0T+6Qa5M0T5vxNfXuF2E5TuDdAm8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751458587; c=relaxed/simple; bh=wFGpDXTdZuxmwa4jC4AUegIxrdfaKn8pxUX8kuIpn9E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MT+QtLL70CxKGUrSkdt/xQGucoSiQQTOlWYCfcSHqggno0aVtlxVbl8LpoiUgt9eMrm2m+gwJcmQjzOHK+XHcMUiSGcmT5L0JdE1gPl7y0jkN0wBxCdWzzqw0RF+/QXXBOPewpkBWYJAeA1Qy3NCorexiSTdMP6oD8+kr1A2H2E= 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=Y9DFgE1t; arc=none smtp.client-ip=57.103.64.53 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="Y9DFgE1t" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; bh=cbt7c0HlAVhmp4PCZp8Pa4hR5RztlzTvRA5ww/nditw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:x-icloud-hme; b=Y9DFgE1tlr6QsYOsrfK8DeUZa1MvZ+EBQtelAg9jfxk4G0zUtsuErD/1bn4d3DqXs +t6tzO6vzM+UCWF7EkKh3Xmloi3vP+cEo2xU3j3y2FunMxmY8AGMsXo9w6f0hOk1Ks iir6nIh5Vq4/OcnPqjsRoaOSZwlovIc+jQxWbOgh6956YXJntYSz6gDH88/0+QPMn1 i4MORW79gTYNZ1NGcqEJtqgjk3BQz4jvkVPdqcKo0oohItBSbIUhQUe7uUUiVLf8jj VrZgWMJcNiDbf/pZXJAIdHNT/zepYClhDQhx4Z60U5TyJIw2E2YY4D/9j4tEA5BMZn hv5rHso85THrA== Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by outbound.pv.icloud.com (Postfix) with ESMTPS id 7BFA61800283; Wed, 2 Jul 2025 12:16:21 +0000 (UTC) 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 3C7AF1800284; Wed, 2 Jul 2025 12:16:18 +0000 (UTC) From: Zijun Hu Date: Wed, 02 Jul 2025 20:15:33 +0800 Subject: [PATCH v3 5/8] char: misc: Make registering miscdevice reentry 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: <20250702-rfc_miscdev-v3-5-d8925de7893d@oss.qualcomm.com> References: <20250702-rfc_miscdev-v3-0-d8925de7893d@oss.qualcomm.com> In-Reply-To: <20250702-rfc_miscdev-v3-0-d8925de7893d@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: AW1haW4tMjUwNzAyMDA5OSBTYWx0ZWRfXxvQmbEUr3lYV Q/jAAZy9Q/UyyS1Tvrj9giGHSiz6MvSeR4vn5H4L4B9C7FLpV9OKBHZehFEp5LJz74Pn+AX4c1N nGSLSjxXg3EH6KYRBdyxKxoxfKVoJsZGsVCXE3izEV+qCUY5zneNWGzgLnujjJEczHfMg/0kMGt P8uCXMf1Ar0k9nK4RjQ58C+qxM4I8aHOnM+/bsxd9FrrVPIBWWsT2Nh13SymNGqm4tapN0EBreb RblREHOqqzPuptytVcI9zp7HCiF4ocVOMvMDBX6KWq5OMXGjY53YJ5m74LzX1LJWuSkwNnI9E= X-Proofpoint-GUID: J5D7vvmn1ZmxgFg9wtlErbDfK6A9C36b X-Proofpoint-ORIG-GUID: J5D7vvmn1ZmxgFg9wtlErbDfK6A9C36b 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-02_01,2025-06-27_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 malwarescore=0 adultscore=0 mlxscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.22.0-2506060001 definitions=main-2507020099 From: Zijun Hu misc_deregister() frees dynamic minor @misc->minor but does not reset it and cause kunit test case miscdev_test_dynamic_reentry() failure: | Invalid fixed minor 257 for miscdevice 'miscdyn_a' | #miscdev_test_dynamic_reentry: ASSERTION FAILED at misc_minor_kunit.c:639 | Expected ret =3D=3D 0, but | ret =3D=3D -22 (0xffffffffffffffea) | [FAILED] miscdev_test_dynamic_reentry misc_register()/misc_deregister() are sometimes invoked by driver's probe()/remove() separately, which has reentry requirement. Fix by resetting @misc->minor to MISC_DYNAMIC_MINOR in misc_deregister() as error handling of misc_register() does. Signed-off-by: Zijun Hu --- 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 Wed Oct 8 04:10:19 2025 Received: from outbound.pv.icloud.com (p-west1-cluster1-host6-snip4-10.eps.apple.com [57.103.64.63]) (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 C186427934E for ; Wed, 2 Jul 2025 12:16:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=57.103.64.63 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751458588; cv=none; b=LafVI4EQE/DAtcX6vXs7R7KsCADdbzCtHXgLar6Ik2YDNerDxiIq09dbCpAiNzykvnfIeA+NLVvxnuKmn1Zzi1xGfrOYgIv6adQbNj3uWqHGVVTOmw4e1H5fmQAoekfreMB5v2PC+BNY3lwdiMf/Uh2SAWbnIPaKhP4n1BmHZuU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751458588; c=relaxed/simple; bh=ldfknhlwCWcuoUqnJHEhTy4XSxhklb2aadv2s6gqlmo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hDlRFeWdUi9iBBnAV9zTr5VNAdelQklntxTPmpBmZoB8nr+hlj2E4m9lOUilU0wB2I1CR94TQokdWvOn6ncs90+leU0klOJP6W7pK7d+Z2qSkJeMlTlNAJUfBm25BB4+GuZHzP0on1Ca/MDsSc1hy0C8uAFfaLFToHTKr9OhAN4= 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=uCPn6t8d; arc=none smtp.client-ip=57.103.64.63 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="uCPn6t8d" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; bh=3z8k8G78hPHpRDrth8Hd7u7gyNsHougHo2QTHX0bCyE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:x-icloud-hme; b=uCPn6t8dH+nJ2w8xcUqRBexV693iW1umxuiEwZAIeoiCaPrcS/YPCkCqzfs+vniaO jkH75jpirK/7/Y3SzmwTIFCbL/EkSz2dUq0CN3D4aLlrHsEB27yFcaRyx5QuvBYh4i K7EDkWgt4UT5HQCIQIpkUM4XT23Smd18/JoXCTELBaLbh+R9FD7q9eAgRl9iLC5l5E zSi5pZkiPNgHH82rpPEAv5bDt01D63iY2qCO4KF2k4L365fHQazaTF0MjKlu3mqgff VMGHQcgS6p569HROzibgrouK6E/zxRquCg+nEjwcvyje36R60Jfx5tbePV5rEk/85O EvmAIhlVtVbTg== Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by outbound.pv.icloud.com (Postfix) with ESMTPS id A3FBA180033C; Wed, 2 Jul 2025 12:16:23 +0000 (UTC) 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 CE22518001DF; Wed, 2 Jul 2025 12:16:20 +0000 (UTC) From: Zijun Hu Date: Wed, 02 Jul 2025 20:15:34 +0800 Subject: [PATCH v3 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: <20250702-rfc_miscdev-v3-6-d8925de7893d@oss.qualcomm.com> References: <20250702-rfc_miscdev-v3-0-d8925de7893d@oss.qualcomm.com> In-Reply-To: <20250702-rfc_miscdev-v3-0-d8925de7893d@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: AW1haW4tMjUwNzAyMDA5OSBTYWx0ZWRfX/ml6G1yRNkgO +mG5JCm5LnBqWM2VgFHHJ8PQp3gGVWaLxTNJPoV5WJSKuQzW5dx5qU79BAgPVolPq5Qrvc+uzFp BJiF8zxuOyJnqcW+L9655kUP6OdLjNFPFbalj4gdzCFwelviBF7kN2CvhufcYrJORZckCRoZjR1 1JO+rfnxui6FbrqBhLN18h1B0ztgq6sPbpnQLawl+rnUFUC4hEeJQnS4p3S50GQGQvKGSNzSmmu 0zr6aj4iVbSbLmawaDFrwx+yP4ymvEF0euRESGOFEy4ZcRwtOk6s5OG4QiXAKSUMuq8iRWxco= X-Proofpoint-GUID: MVRitIxVaY9TnE3NU4-gXT4plGDtZak7 X-Proofpoint-ORIG-GUID: MVRitIxVaY9TnE3NU4-gXT4plGDtZak7 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-02_01,2025-06-27_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 adultscore=0 mlxlogscore=999 suspectscore=0 malwarescore=0 phishscore=0 spamscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.22.0-2506060001 definitions=main-2507020099 From: Zijun Hu misc_open() may request module for miscdevice with dynamic minor which is meaningless since macro MODULE_ALIAS_MISCDEV() is not applicable for dynamic minor. Fix by only requesting module for miscdevice with fixed minor. 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 Wed Oct 8 04:10:19 2025 Received: from outbound.pv.icloud.com (p-west1-cluster1-host8-snip4-10.eps.apple.com [57.103.64.43]) (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 4DAD327380F for ; Wed, 2 Jul 2025 12:16:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=57.103.64.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751458593; cv=none; b=GNjuAWdYn2jL04B6/irFUPg90EdSTgpoPMokJHtGJGxq1UOhFQeV5TPqoqRi1PCv6gCAnOJXgAwNprPChWOiFRQ7gBhzWULARngutOyiXkSTbWFf2jkuNFku1z3TTTb9CEUer/KGK6TEQQ3Yi0DUfCjl7tj4VHrxZUJa4ho/m28= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751458593; c=relaxed/simple; bh=abVLHhlrbRD4j7Q9knssLHFcwdKTohtl5aEN2e8X638=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TN5GBGl+9NgqAFd8HTkJqXR9Rk4zbi5f/qCMoxsNdnCJyw7btKxlAPZY2ctYZiKCBji0GaVdXzTCylShO9HJjlYC9msjjgIlSzm0cGnbdQ3Xj5o6nfwNYO17fzo1ZcOAWBZmWT7OivP1A/TSd88I4+KcgEOY3MD3NqGkh2dKf1Q= 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=g0RNJi97; arc=none smtp.client-ip=57.103.64.43 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="g0RNJi97" 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=g0RNJi97ieLB+20HpKaEVYcnN+VvZRAFryRxwcsBBIScgPipb09SDAVJ/hlMLCznk ZVQYYqjIcMo87XQTMo5+fdkQcqesF5Itg/g9vkUKOygq3/ljKEf9wsrWRwtyGNLPA2 7Axfa5b6qPHDFln/zdf3HuFsGc1e+SCfi6xHstGzmOtkeZ3bP6VqyylEnXyVlM7zdl 9CPRgeGi7tL4iWBoWPT1rbaAsco2TajCxgEnvmjzd9CYPGl2KlzAG12oP0L+3bw1Tk OJJLSUHNe3ui14UNFhvgFNOOhFQb4hgWdDo6uif/IFtejKF0+flzMYrEPHOCoRJ4KM pNSY4W5TrM8Dw== Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by outbound.pv.icloud.com (Postfix) with ESMTPS id B2DFB1800C8A; Wed, 2 Jul 2025 12:16:28 +0000 (UTC) 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 674611800287; Wed, 2 Jul 2025 12:16:23 +0000 (UTC) From: Zijun Hu Date: Wed, 02 Jul 2025 20:15:35 +0800 Subject: [PATCH v3 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: <20250702-rfc_miscdev-v3-7-d8925de7893d@oss.qualcomm.com> References: <20250702-rfc_miscdev-v3-0-d8925de7893d@oss.qualcomm.com> In-Reply-To: <20250702-rfc_miscdev-v3-0-d8925de7893d@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: WQ4kilVg5vzx9QZl5XL-9ZFRiKSpDEuy X-Proofpoint-ORIG-GUID: WQ4kilVg5vzx9QZl5XL-9ZFRiKSpDEuy X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzAyMDA5OSBTYWx0ZWRfX+JlrqmYMOzQo 4THQ0pDWv4AIl6/ti9RhXrJvl5LUMV4Hl75uAHhkbW3h4jmlCC0qcXfYCCd+e+ai4OL3e+crH7/ jMvl16uA1+wiCJeduSzaUdzgISU25SMhWQdzpUu6wqn8djUUrhTcnnrQ3ZS7WXG2hsacNvXZSpt VTgPDuVGTC8wEgqjeNZA17hjL2qSKSeW1LKBm/JOURCGe1BDzNj5HbJh5KLe3mVwpRZ0MGcOObH EaxcY3/KtNBHvVJGiM4oRnGHlIq2UYL7fI6V+TOeDXFPbc4/NffF1ayAhjXWpaXAVgfP5aJxY= 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-02_01,2025-06-27_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 suspectscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 clxscore=1015 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.22.0-2506060001 definitions=main-2507020099 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 Wed Oct 8 04:10:19 2025 Received: from outbound.pv.icloud.com (p-west1-cluster5-host6-snip4-10.eps.apple.com [57.103.66.151]) (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 81DC2273D9D for ; Wed, 2 Jul 2025 12:16:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=57.103.66.151 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751458595; cv=none; b=SQoIqcpUTaat2KBMxt2bHzfC642N266t9oWHkNkUyUtTvdUrZ5O9bcqrvaldUV3TnW5tznvJWrooKx5nLsJcfk6O3tQRDAc5+tZAcyCrqPCxZfu/Bix/3r5azkf9qBniHrLdr3b9kXkMtOj1sljigJ1y2SJy7PvMvyffECiQc0E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751458595; 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=LXETsWsGZeDc2UugrmAGa1JfcDcVslMpi55zV8MjhXRNlgX863SL0Clx947FIWgu5QpItalV0gAmvDkYqZlnWALYBTPcX7+3xXVIeNBcs9ztXKcJ6ImsmJGiK4SvMWkZ/LeeKwjYEN4ZVdXrBUWLWgA1V03urcRllCjbqfzujJ8= 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=ygTm1hMl; arc=none smtp.client-ip=57.103.66.151 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="ygTm1hMl" 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=ygTm1hMlAgK3bOAbflYvbUoUF2HQHzhCEjMeszabytsCrEmSfEmfziaOzro5ljQql uzDm5mcmcHKZ2fTc6+2z7+qa1WIaNr5P78GZJ199ULDOjE1zeH6wK2zBQGcdbOkohI 9CAtBvxUyp3nE1zjeo12EHEPodyHXYhnN0PaUNBFYmBOggHzzyD0mqGht5x6c03h2L VYvOj/xdR/XZaHs/rp3tl+pONK5M9e9NOi6Laxg3Q0SeKyVAyttB6bt+9tqjpaJn5s gkfWnnmBcxm5o+WygaZeiexTp//rCNU57ZKM4PLXC5qhFlklu9amr6g+RT7sfSy7dy Z+UvPYZ9AAyOw== Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by outbound.pv.icloud.com (Postfix) with ESMTPS id 83A96180030C; Wed, 2 Jul 2025 12:16:29 +0000 (UTC) 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 5B86B18001DF; Wed, 2 Jul 2025 12:16:25 +0000 (UTC) From: Zijun Hu Date: Wed, 02 Jul 2025 20:15:36 +0800 Subject: [PATCH v3 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: <20250702-rfc_miscdev-v3-8-d8925de7893d@oss.qualcomm.com> References: <20250702-rfc_miscdev-v3-0-d8925de7893d@oss.qualcomm.com> In-Reply-To: <20250702-rfc_miscdev-v3-0-d8925de7893d@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: AW1haW4tMjUwNzAyMDA5OSBTYWx0ZWRfX7jPqGiP88Bvt Mrf1fBR0qVNhm09VK837cmQ4sdZUtGUMbl7z2TGTkB7cD60w3wvDQAT+wEGHIU93q8Y/LvtZ74T STWYXmjeCBLQBEc/KORCrdGkRxzZbpXMq5h+vDTEKUW9MSdAgW7IDWz0FhH4LEfP05a48Kah6ZS k7LB7SwLis2pH6s/Aa+1SXiFpornkcpKetRdbq8i5UDiX6ZEIjF4P/yICUcW5tnx6TfsBWmoOvo MInE3+vN5yM4z/fATQUbKCPvcCt5AaEA918+QilAkz4b9j8se7Bz1HnIhoEU1XtIqj1hJALBg= X-Proofpoint-GUID: peyGdAL9Mvibq29xXykg2jRsJePrf_mP X-Proofpoint-ORIG-GUID: peyGdAL9Mvibq29xXykg2jRsJePrf_mP 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-02_01,2025-06-27_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 clxscore=1015 suspectscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.22.0-2506060001 definitions=main-2507020099 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