mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Javier Martinez Canillas <javierm@redhat.com>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Cc: "Emma Anholt" <emma@anholt.net>,
	"Neil Armstrong" <narmstrong@baylibre.com>,
	"Xinliang Liu" <xinliang.liu@linaro.org>,
	"Edmund Dea" <edmund.j.dea@intel.com>,
	"Paul Cercueil" <paul@crapouillou.net>,
	"Tomi Valkeinen" <tomba@kernel.org>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
	"Benjamin Gaignard" <benjamin.gaignard@linaro.org>,
	"Anitha Chrisanthus" <anitha.chrisanthus@intel.com>,
	"Sam Ravnborg" <sam@ravnborg.org>, "Marek Vasut" <marex@denx.de>,
	"Joonyoung Shim" <jy0922.shim@samsung.com>,
	"Oleksandr Andrushchenko" <oleksandr_andrushchenko@epam.com>,
	"Alexey Brodkin" <abrodkin@synopsys.com>,
	"Russell King" <linux@armlinux.org.uk>,
	"Deepak Rawat" <drawat.floss@gmail.com>,
	"Chen-Yu Tsai" <wens@csie.org>,
	"Kieran Bingham" <kieran.bingham+renesas@ideasonboard.com>,
	"James (Qian) Wang" <james.qian.wang@arm.com>,
	"Joel Stanley" <joel@jms.id.au>,
	"Russell King" <linux+etnaviv@armlinux.org.uk>,
	"Qiang Yu" <yuq825@gmail.com>,
	"Chun-Kuang Hu" <chunkuang.hu@kernel.org>,
	"David Lechner" <david@lechnology.com>,
	"Liviu Dudau" <liviu.dudau@arm.com>,
	"Alison Wang" <alison.wang@nxp.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Laurentiu Palcu" <laurentiu.palcu@oss.nxp.com>,
	"Kamlesh Gurudasani" <kamlesh.gurudasani@gmail.com>,
	"Sean Paul" <sean@poorly.run>,
	"Tomeu Vizoso" <tomeu.vizoso@collabora.com>,
	"Hyun Kwon" <hyun.kwon@xilinx.com>,
	"Boris Brezillon" <bbrezillon@kernel.org>,
	"Yannick Fertre" <yannick.fertre@foss.st.com>,
	"Sandy Huang" <hjc@rock-chips.com>,
	"Noralf Trønnes" <noralf@tronnes.org>,
	"Philippe Cornu" <philippe.cornu@foss.st.com>,
	"Tian Tao" <tiantao6@hisilicon.com>,
	"Jyri Sarha" <jyri.sarha@iki.fi>,
	"Erico Nunes" <nunes.erico@gmail.com>
Subject: Re: [PATCH 00/60] drm: Make all drivers to honour the nomodeset parameter
Date: Wed, 15 Dec 2021 10:10:20 +0100	[thread overview]
Message-ID: <be79a619-491b-da9f-9db4-de3919e08fff@suse.de> (raw)
In-Reply-To: <1c1aeb13-6e90-ed2b-08db-11ceaa8d0de0@redhat.com>


[-- Attachment #1.1: Type: text/plain, Size: 3080 bytes --]

Hi

Am 15.12.21 um 09:50 schrieb Javier Martinez Canillas:
> Hello Thomas,
> 
> On 12/15/21 09:31, Thomas Zimmermann wrote:
>> Hi Javier,
>>
>> nothing wrong with your patches, but I'd like to propose slightly
>> differnt solution.
>>
>> For many USB drivers, you put the drm_firmware_drivers_only() call into
>> the probe function. For registering, these drivers use
>> module_usb_driver(), which expands to generic device-register functions.
>>
>> I'd like to propose a similar macro for DRM drivers that includes the
>> test for drm_firmware_drivers_only().
>>
>> In drm_drv.h :
>>
>>     #if defined(USB)
>>     static int drm_usb_register(struct usb_driver *usb)
>>     {
>> 	if (drm_firmware_drivers_only())
>> 		return -ENODEV;
>> 	return usb_register_driver(usb);
>>     }
>>     #define drm_module_usb_driver(__usb)
>> 	module_driver(drm_usb_register, usb_deregister)
>>     #endif
>>
>> In each of the USB-based DRM drivers, replace module_usb_driver with
>> drm_module_usb_driver.
>>
>> And then there's PCI [3] and platform drivers, [4] which can be handled
>> similarly. Many PCI drivers open-code the module init and device
> 
> Thanks for the suggestion. I actually thought about this approach as well,
> since seems unnecessary to have all that duplicated logic in every driver.
> 
> But at the end decided to just do the less intrusive change, because can't
> do any testing for most of the drivers.
> 
>> registering with the driver-specific enable parameter. Maybe adding a
>> driver-specific register function would make sense.
>>
> 
> If I understood you correctly, suggested something similar in #dri-devel but
> danvet's suggestion [0] was to keep it simple:
> 
> 16:32 javierm: danvet: yes, I don't think we would be able to do it at this point. I'll add a function pointer
>                         param to the check function so drivers can also define their own check besides nomodeset
> 16:33 danvet: javierm, uh that sounds a bit like overkill? just keep that part of the check in drivers?
> 16:33 javierm: danvet: Ok. Wanted to get rid of the duplicated code but I'm indeed over engineering this :)

An extra pointer sounds indeed like over-engineering. If we take ast for 
example, I'd just do something like this:

   static ast_pci_register_driver(struct pci_driver *pci)
   {
	if (drm_firmware_drivers_only() && ast_modeset == -1)
		return -ENODEV;
	if (ast_modeset == 0)
		return -ENODEV;

	return pci_register_driver(pci);
   }

   module_driver(&ast_pci_driver, ast_pci_register_driver,
		pci_unregister_driver)

That removes some of the boiler-plate module code without changing the 
driver's behavior.

Best regards
Thomas

> 
> [0]: https://people.freedesktop.org/~cbrill/dri-log/?channel=dri-devel&date=2021-11-02
> 
>> Best regards
>> Thomas
>>
> Best regards,
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

  reply	other threads:[~2021-12-15  9:10 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-15  0:59 Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 01/60] drm/komeda: Add support for the nomodeset kernel parameter Javier Martinez Canillas
2022-01-24 17:09   ` Carsten Haitzler
2021-12-15  0:59 ` [PATCH 02/60] drm/arm/hdlcd: " Javier Martinez Canillas
2022-01-24 17:09   ` Carsten Haitzler
2021-12-15  0:59 ` [PATCH 03/60] drm/malidp: " Javier Martinez Canillas
2022-01-24 17:09   ` Carsten Haitzler
2021-12-15  0:59 ` [PATCH 04/60] drm/armada: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 05/60] drm/aspeed: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 06/60] drm/atmel-hlcdc: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 07/60] drm/etnaviv: " Javier Martinez Canillas
2021-12-15  9:18   ` Lucas Stach
2021-12-15  9:39     ` Thomas Zimmermann
2021-12-15  9:45       ` Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 08/60] drm/exynos: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 09/60] drm/fsl-dcu: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 10/60] drm/gma500: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 11/60] drm/gud: " Javier Martinez Canillas
2021-12-15 21:37   ` Noralf Trønnes
2021-12-15 21:50     ` Javier Martinez Canillas
2021-12-16  8:20     ` Thomas Zimmermann
2021-12-16 15:47       ` Noralf Trønnes
2021-12-15  0:59 ` [PATCH 12/60] drm/hisilicon/hibmc: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 13/60] drm/hisilicon/kirin: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 14/60] drm/hyperv: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 15/60] drm/i810: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 16/60] drm/imx/dcss: " Javier Martinez Canillas
2021-12-15  9:20   ` Lucas Stach
2021-12-15  0:59 ` [PATCH 17/60] drm/imx: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 18/60] drm/ingenic: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 19/60] drm/kmb: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 20/60] drm/lima: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 21/60] drm/mcde: " Javier Martinez Canillas
2021-12-15  1:02   ` Linus Walleij
2021-12-15  0:59 ` [PATCH 22/60] drm/mediatek: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 23/60] drm/meson: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 24/60] drm/mga: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 25/60] drm/msm: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 26/60] drm: mxsfb: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 27/60] drm/omap: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 28/60] drm/panel: ilitek-ili9341: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 29/60] drm/panfrost: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 30/60] drm/pl111: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 31/60] drm/r128: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 32/60] drm: rcar-du: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 33/60] drm/rockchip: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 34/60] drm/savage: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 35/60] drm/shmobile: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 36/60] drm/sis: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 37/60] drm/sprd: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 38/60] drm/sti: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 39/60] drm/stm: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 40/60] drm/sun4i: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 41/60] drm/tdfx: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 42/60] drm/tegra: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 43/60] drm/tidss: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 44/60] drm/tilcdc: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 45/60] drm/arc: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 46/60] drm/gm12u320: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 47/60] drm/hx8357d: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 48/60] drm/ili9163: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 49/60] drm/ili9225: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 50/60] drm/ili9341: " Javier Martinez Canillas
2021-12-15  0:59 ` [PATCH 51/60] drm/ili9486: " Javier Martinez Canillas
2021-12-15  1:00 ` [PATCH 52/60] drm/mi0283qt: " Javier Martinez Canillas
2021-12-16 15:48   ` Noralf Trønnes
2021-12-15  1:00 ` [PATCH 53/60] drm/repaper: " Javier Martinez Canillas
2021-12-16 15:48   ` Noralf Trønnes
2021-12-15  1:00 ` [PATCH 54/60] drm/st7586: " Javier Martinez Canillas
2021-12-15  1:00 ` [PATCH 55/60] drm/st7735r: " Javier Martinez Canillas
2021-12-15  1:00 ` [PATCH 56/60] drm/tve200: " Javier Martinez Canillas
2021-12-15  1:03   ` Linus Walleij
2021-12-15  1:00 ` [PATCH 57/60] drm/udl: " Javier Martinez Canillas
2021-12-15  1:00 ` [PATCH 58/60] drm/via: " Javier Martinez Canillas
2021-12-15  1:00 ` [PATCH 59/60] drm/xen: " Javier Martinez Canillas
2021-12-15  5:58   ` Oleksandr Andrushchenko
2021-12-15  8:14     ` Javier Martinez Canillas
2021-12-15  1:00 ` [PATCH 60/60] drm/xlnx: " Javier Martinez Canillas
2021-12-15  8:31 ` [PATCH 00/60] drm: Make all drivers to honour the nomodeset parameter Thomas Zimmermann
2021-12-15  8:50   ` Javier Martinez Canillas
2021-12-15  9:10     ` Thomas Zimmermann [this message]
2021-12-15 23:26       ` Javier Martinez Canillas
2021-12-15  9:12   ` Thomas Zimmermann
2021-12-15  9:25     ` Javier Martinez Canillas
2021-12-15 23:35 ` Laurent Pinchart
2021-12-16  0:13   ` Javier Martinez Canillas
2021-12-16  0:24     ` Laurent Pinchart
2021-12-16  0:38       ` Javier Martinez Canillas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=be79a619-491b-da9f-9db4-de3919e08fff@suse.de \
    --to=tzimmermann@suse.de \
    --cc=abrodkin@synopsys.com \
    --cc=alison.wang@nxp.com \
    --cc=anitha.chrisanthus@intel.com \
    --cc=bbrezillon@kernel.org \
    --cc=benjamin.gaignard@linaro.org \
    --cc=chunkuang.hu@kernel.org \
    --cc=david@lechnology.com \
    --cc=drawat.floss@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=edmund.j.dea@intel.com \
    --cc=emma@anholt.net \
    --cc=hdegoede@redhat.com \
    --cc=hjc@rock-chips.com \
    --cc=hyun.kwon@xilinx.com \
    --cc=james.qian.wang@arm.com \
    --cc=javierm@redhat.com \
    --cc=joel@jms.id.au \
    --cc=jy0922.shim@samsung.com \
    --cc=jyri.sarha@iki.fi \
    --cc=kamlesh.gurudasani@gmail.com \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=laurentiu.palcu@oss.nxp.com \
    --cc=linux+etnaviv@armlinux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=liviu.dudau@arm.com \
    --cc=marex@denx.de \
    --cc=narmstrong@baylibre.com \
    --cc=noralf@tronnes.org \
    --cc=nunes.erico@gmail.com \
    --cc=oleksandr_andrushchenko@epam.com \
    --cc=paul@crapouillou.net \
    --cc=philippe.cornu@foss.st.com \
    --cc=sam@ravnborg.org \
    --cc=sean@poorly.run \
    --cc=thierry.reding@gmail.com \
    --cc=tiantao6@hisilicon.com \
    --cc=tomba@kernel.org \
    --cc=tomeu.vizoso@collabora.com \
    --cc=wens@csie.org \
    --cc=xinliang.liu@linaro.org \
    --cc=yannick.fertre@foss.st.com \
    --cc=yuq825@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®