From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48063EB64DD for ; Thu, 13 Jul 2023 09:56:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232331AbjGMJzk (ORCPT ); Thu, 13 Jul 2023 05:55:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233353AbjGMJzJ (ORCPT ); Thu, 13 Jul 2023 05:55:09 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 052CB2691 for ; Thu, 13 Jul 2023 02:54:51 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qJt1s-0003Ts-Kn; Thu, 13 Jul 2023 11:54:32 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1qJt1o-00E5Pf-9q; Thu, 13 Jul 2023 11:54:28 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qJt1n-004WRt-D8; Thu, 13 Jul 2023 11:54:27 +0200 Date: Thu, 13 Jul 2023 11:54:27 +0200 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Jani Nikula Cc: Geert Uytterhoeven , Xinliang Liu , Rodrigo Vivi , Alexey Kodanev , dri-devel@lists.freedesktop.org, Vandita Kulkarni , Alim Akhtar , Anitha Chrisanthus , Marijn Suijten , Jonathan Hunter , Arun R Murthy , Jerome Brunet , linux-samsung-soc@vger.kernel.org, Samuel Holland , Matt Roper , Wenjing Liu , Javier Martinez Canillas , Stanislav Lisovskiy , Danilo Krummrich , NXP Linux Team , spice-devel@lists.freedesktop.org, Niranjana Vishwanathapura , Dmitry Baryshkov , linux-sunxi@lists.linux.dev, Matthias Brugger , Stylon Wang , Tim Huang , Suraj Kandpal , =?utf-8?B?QW5kcsOp?= Almeida , Mika Kahola , Tvrtko Ursulin , Leo Li , Sascha Hauer , Lucas De Marchi , Hersen Wu , Dave Airlie , Kamlesh Gurudasani , Bhawanpreet Lakha , =?utf-8?Q?=C5=81ukasz?= Bartosik , Radhakrishna Sripada , Andrew Jeffery , Seung-Woo Kim , Noralf =?utf-8?Q?Tr=C3=B8nnes?= , kernel@pengutronix.de, Alex Deucher , freedreno@lists.freedesktop.org, Claudiu Beznea , Laurent Pinchart , Alexandre Belloni , linux-aspeed@lists.ozlabs.org, nouveau@lists.freedesktop.org, Mitul Golani , =?utf-8?B?Sm9zw6k=?= Roberto de Souza , virtualization@lists.linux-foundation.org, Thierry Reding , Yongqin Liu , Mario Limonciello , Fei Yang , Juha-Pekka Heikkila , Chunyan Zhang , David Francis , Vinod Govindapillai , Aaron Liu , Vinod Polimera , linux-rockchip@lists.infradead.org, Fangzhi Zuo , Aurabindo Pillai , VMware Graphics Reviewers , Ben Skeggs , Jouni =?utf-8?B?SMO2Z2FuZGVy?= , Jessica Zhang , Martin Blumenstingl , linux-arm-msm@vger.kernel.org, Animesh Manna , Nicolas Ferre , Maxime Ripard , Chaitanya Kumar Borah , Tian Tao , Biju Das , linux-amlogic@lists.infradead.org, Evan Quan , Michal Simek , linux-arm-kernel@lists.infradead.org, Sean Paul , Neil Armstrong , Kai Vehmanen , Boris Brezillon , Shawn Guo , Qingqing Zhuo , Sandy Huang , Swati Sharma , linux-renesas-soc@vger.kernel.org, Kyungmin Park , Maxime Coquelin , Kevin Hilman , Hawking Zhang , Haneen Mohammed , Paul Cercueil , Anusha Srivatsa , Dan Carpenter , Karol Herbst , linux-hyperv@vger.kernel.org, Melissa Wen , =?utf-8?B?TWHDrXJh?= Canal , Luca Coelho , Gerd Hoffmann , Andrzej Hajda , Likun Gao , "Jiri Slaby (SUSE)" , Emma Anholt , Alain Volmat , Chen-Yu Tsai , Jernej Skrabec , Deepak Rawat , Xinwei Kong , Joel Stanley , Orson Zhai , Ankit Nautiyal , Alan Liu , Philip Yang , intel-gfx@lists.freedesktop.org, Alison Wang , Wolfram Sang , Abhinav Kumar , Gustavo Sousa , Baolin Wang , Tomi Valkeinen , Mikko Perttunen , Yifan Zhang , Rodrigo Siqueira , Tomi Valkeinen , Deepak R Varma , "Pan, Xinhui" , Konrad Dybcio , Kieran Bingham , John Stultz , Roman Li , Sumit Semwal , Christian =?utf-8?B?S8O2bmln?= , Khaled Almahallawy , linux-stm32@st-md-mailman.stormreply.com, Sam Ravnborg , Chun-Kuang Hu , Liviu Dudau , Alexandre Torgue , Gurchetan Singh , Liu Shixin , Hamza Mahfooz , Marek Vasut , Paul Kocialkowski , xen-devel@lists.xenproject.org, Guchun Chen , Oleksandr Andrushchenko , Raphael Gallais-Pou , Rodrigo Siqueira , Russell King , Uma Shankar , Andi Shyti , Jiasheng Jiang , Srinivasan Shanmugam , David Lechner , Jiapeng Chong , Marek =?utf-8?B?T2zFocOhaw==?= , =?utf-8?Q?Joaqu=C3=ADn_Ignacio_Aramend=C3=ADa?= , Melissa Wen , Hans de Goede , linux-mediatek@lists.infradead.org, Laurentiu Palcu , linux-tegra@vger.kernel.org, David Tadokoro , AngeloGioacchino Del Regno , amd-gfx@lists.freedesktop.org, Lang Yu , Yannick Fertre , linux-mips@vger.kernel.org, Krzysztof Kozlowski , Philippe Cornu , Thomas Zimmermann , Wayne Lin , Drew Davenport , Nirmoy Das , Jyri Sarha Subject: Re: [PATCH RFC v1 00/52] drm/crtc: Rename struct drm_crtc::dev to drm_dev Message-ID: <20230713095427.swf7unzca4ahipsk@pengutronix.de> References: <20230712094702.1770121-1-u.kleine-koenig@pengutronix.de> <87fs5tgpvv.fsf@intel.com> <20230712161025.22op3gtzgujrhytb@pengutronix.de> <878rbkgp4m.fsf@intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="qeweu3qcdjoypth2" Content-Disposition: inline In-Reply-To: <878rbkgp4m.fsf@intel.com> X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-mips@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org --qeweu3qcdjoypth2 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 13, 2023 at 12:03:05PM +0300, Jani Nikula wrote: > On Wed, 12 Jul 2023, Uwe Kleine-K=F6nig = wrote: > > Hello Jani, > > > > On Wed, Jul 12, 2023 at 05:34:28PM +0300, Jani Nikula wrote: > >> On Wed, 12 Jul 2023, Uwe Kleine-K=F6nig wrote: > >> > Hello, > >> > > >> > while I debugged an issue in the imx-lcdc driver I was constantly > >> > irritated about struct drm_device pointer variables being named "dev" > >> > because with that name I usually expect a struct device pointer. > >> > > >> > I think there is a big benefit when these are all renamed to "drm_de= v". > >> > I have no strong preference here though, so "drmdev" or "drm" are fi= ne > >> > for me, too. Let the bikesheding begin! > >> > > >> > Some statistics: > >> > > >> > $ git grep -ohE 'struct drm_device *\* *[^ (),;]*' v6.5-rc1 | sort |= uniq -c | sort -n > >> > 1 struct drm_device *adev_to_drm > >> > 1 struct drm_device *drm_ > >> > 1 struct drm_device *drm_dev > >> > 1 struct drm_device *drm_dev > >> > 1 struct drm_device *pdev > >> > 1 struct drm_device *rdev > >> > 1 struct drm_device *vdev > >> > 2 struct drm_device *dcss_drv_dev_to_drm > >> > 2 struct drm_device **ddev > >> > 2 struct drm_device *drm_dev_alloc > >> > 2 struct drm_device *mock > >> > 2 struct drm_device *p_ddev > >> > 5 struct drm_device *device > >> > 9 struct drm_device * dev > >> > 25 struct drm_device *d > >> > 95 struct drm_device * > >> > 216 struct drm_device *ddev > >> > 234 struct drm_device *drm_dev > >> > 611 struct drm_device *drm > >> > 4190 struct drm_device *dev > >> > > >> > This series starts with renaming struct drm_crtc::dev to drm_dev. If > >> > it's not only me and others like the result of this effort it should= be > >> > followed up by adapting the other structs and the individual usages = in > >> > the different drivers. > >>=20 > >> I think this is an unnecessary change. In drm, a dev is usually a drm > >> device, i.e. struct drm_device *. > > > > Well, unless it's not. Prominently there is > > > > struct drm_device { > > ... > > struct device *dev; > > ... > > }; > > > > which yields quite a few code locations using dev->dev which is > > IMHO unnecessary irritating: > > > > $ git grep '\dev' v6.5-rc1 drivers/gpu/drm | wc -l > > 1633 > > > > Also the functions that deal with both a struct device and a struct > > drm_device often use "dev" for the struct device and then "ddev" for > > the drm_device (see for example amdgpu_device_get_pcie_replay_count()). >=20 > Why is specifically struct drm_device *dev so irritating to you? >=20 > You lead us to believe it's an outlier in kernel, something that goes > against common kernel style, but it's really not: >=20 > $ git grep -how "struct [A-Za-z0-9_]\+ \*dev" | sort | uniq -c | sort -rn= | head -20 > 38494 struct device *dev > 16388 struct net_device *dev > 4184 struct drm_device *dev > 2780 struct pci_dev *dev > 1916 struct comedi_device *dev > 1510 struct mlx5_core_dev *dev > 1057 struct mlx4_dev *dev > 894 struct b43_wldev *dev > 762 struct input_dev *dev > 623 struct usbnet *dev > 561 struct mlx5_ib_dev *dev > 525 struct mt76_dev *dev > 465 struct mt76x02_dev *dev > 435 struct platform_device *dev > 431 struct usb_device *dev > 411 struct mt7915_dev *dev > 398 struct cx231xx *dev > 378 struct mei_device *dev > 363 struct ksz_device *dev > 359 struct mthca_dev *dev >=20 > A good portion of the above also have a dev member. Yeah, other subsystems and drivers have the same problem. You're lucky that I noticed drm first and invested some effort to improve it. IMHO other subsystems being bad shouldn't stop drm to improve here. And note that for example for pci_dev there are 5794 instances that are named "pdev" and there are 9971 struct platform_device that are called "pdev", too. So the majority for these does it better. And agreed, net_device and others are also inconsistent. If you want an area that is better, look at the naming of i2c_client or spi_device. (And take into account that these are spread all over the tree and so are not in control of a single maintainer team.) > Are you planning on changing all of the above too, or are you only > annoyed by drm? Would you be more welcoming if I promised to tackle some of the above, too? If so: I might. I hesitate a bit because I didn't suffer from the others. (Apart from asking ctags for "dev" is a nightmare.) And regarding the second part of your question: I was annoyed by drm because that was the one that offended me while researching a problem in a drm driver. And the variable/struct member name irritated me enough to believe that with consistent naming I would have found it quicker. Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --qeweu3qcdjoypth2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmSvydIACgkQj4D7WH0S /k4hjAgAozFp653NVzmkpE7aXTRWhbDCNL3DGT9ODtF01d4F5Hj7wJVIryc1iT+i pKEV3mhZKNm6WpaQU9OtvO3zdC2E6lx4+fyvWXNW9JpRVgekEPJyl60rXGhU8fuN pghoNgpFQ2LJFVA81cUXRwu81TZBU3fMt/EUn6f4skEG0QVCIdVZNP8w5W9+5g5P ZTx8I6TkHDjubT+sZeYiWn1FQxah3EU9o9rk6Bj8aa61vJOuDKXo3NTSLN78Aitl e0aR9Ro4Vfdg3XW5b52IGHn+Sg8dzYClC4kPBBQtdUao8U6CO8hW7w9+pNraKIV8 T5zOCDUDryMjbJbNfnD2SSquB7gVlw== =7d5L -----END PGP SIGNATURE----- --qeweu3qcdjoypth2--