public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Abhinav Kumar <quic_abhinavk@quicinc.com>
Cc: Krzysztof Kozlowski <krzk@kernel.org>,
	Dikshita Agarwal <quic_dikshita@quicinc.com>,
	quic_vgarodia@quicinc.com, mchehab@kernel.org, robh@kernel.org,
	krzk+dt@kernel.org, p.zabel@pengutronix.de, hverkuil@xs4all.nl,
	sebastian.fricke@collabora.com, bryan.odonoghue@linaro.org,
	dmitry.baryshkov@linaro.org, neil.armstrong@linaro.org,
	nicolas@ndufresne.ca, u.kleine-koenig@baylibre.com,
	stefan.schmidt@linaro.org, lujianhua000@gmail.com,
	linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	krzysztof.kozlowski@linaro.org
Subject: Re: [RFC PATCH v10 1/2] media: iris: introduce helper module to select video driver
Date: Mon, 3 Feb 2025 09:22:51 +0100	[thread overview]
Message-ID: <Z6B822-6UTxQfX46@hovoldconsulting.com> (raw)
In-Reply-To: <f1344e49-61b6-4115-ae88-55b4a3cfed28@quicinc.com>

On Fri, Jan 31, 2025 at 10:44:28AM -0800, Abhinav Kumar wrote:
> On 1/29/2025 2:44 AM, Krzysztof Kozlowski wrote:
> > On 28/01/2025 09:04, Dikshita Agarwal wrote:

> >> diff --git a/drivers/media/platform/qcom/iris/iris_probe.c b/drivers/media/platform/qcom/iris/iris_probe.c
> >> index 954cc7c0cc97..276461ade811 100644
> >> --- a/drivers/media/platform/qcom/iris/iris_probe.c
> >> +++ b/drivers/media/platform/qcom/iris/iris_probe.c
> >> @@ -196,6 +196,9 @@ static int iris_probe(struct platform_device *pdev)
> >>   	u64 dma_mask;
> >>   	int ret;
> >>   
> >> +	if (!video_drv_should_bind(&pdev->dev, true))
> >> +		return -ENODEV;
> > 
> > Wouldn't it mark the probe as failed and cause dmesg regressions?

No, this is perfectly fine. Probe can return -ENODEV and driver core
will continue with any further matches.

> >> +#if !IS_REACHABLE(CONFIG_VIDEO_QCOM_VENUS) || !IS_REACHABLE(CONFIG_VIDEO_QCOM_IRIS)
> >> +bool video_drv_should_bind(struct device *dev, bool is_iris_driver)
> >> +{
> >> +	/* If just a single driver is enabled, use it no matter what */
> >> +	return true;
> >> +}
> >> +
> >> +#else
> >> +static bool prefer_venus = true;
> >> +MODULE_PARM_DESC(prefer_venus, "Select whether venus or iris driver should be preferred");
> >> +module_param(prefer_venus, bool, 0444);
> > 
> > 
> > The choice of driver is by module blacklisting, not by failing probes.
> > 
> > I don't understand why this patchset is needed and neither commit msg
> > nor above longer code comment explain me that. Just blacklist the module.

> Summarizing the discussion with myself, Krzysztof and Dmitry:
> 
> 1) module blacklisting solution will not be ideal if users want to have 
> both venus and iris or either of them built-in

Module blacklisting is not the way to go, you shouldn't have two drivers
racing to bind to the same device ever.

> 2) with current approach, one of the probes (either venus or iris) will 
> certainly fail as video_drv_should_bind() will fail for one of them. 
> This can be considered as a regression and should not happen.

How can that be a regression? One driver must fail to probe (see above).
 
> Solution: If the user prefers iris driver and iris driver has not probed 
> yet, and if venus tries to probe ahead of iris we keep -EDEFERing till 
> iris probes and succeeds. Vice-versa when the preference is venus as well.

This sounds wrong too.

Look, first you guys need to explain *why* you want to have two drivers
for the same hardware (not just to me, in the commit message and cover
letter).

That's something that really should never be the case and would need to
be motivated properly.

Second, if the reasons for keeping both drivers are deemed justifiable,
you need to come up with mechanism for only binding one of them.

I already told you that module parameters is not the way to go here (and
the msm drm driver's abuse of module parameters is not a good precedent
here).

If this is a transitional thing (which it must be), then just add a
Kconfig symbol to determine which driver should probe. That's good
enough for evaluating whatever needs to be evaluated, and doesn't
depend on adding anti-patterns like module parameters (and helper
modules for them).

Keep it simple.

Johan

  reply	other threads:[~2025-02-03  8:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-28  8:04 [RFC PATCH v10 0/2] Add helper module to select video driver Dikshita Agarwal
2025-01-28  8:04 ` [RFC PATCH v10 1/2] media: iris: introduce " Dikshita Agarwal
2025-01-28 16:14   ` Dmitry Baryshkov
2025-01-29  9:53     ` Dikshita Agarwal
2025-01-29 11:27       ` Dmitry Baryshkov
2025-01-29 10:44   ` Krzysztof Kozlowski
2025-01-31 18:44     ` Abhinav Kumar
2025-02-03  8:22       ` Johan Hovold [this message]
2025-02-03 15:16         ` Dmitry Baryshkov
2025-02-03 16:34           ` Krzysztof Kozlowski
2025-02-04  9:35             ` Johan Hovold
2025-02-04  9:31           ` Johan Hovold
2025-02-04 14:55             ` Dmitry Baryshkov
2025-02-04 16:00               ` Johan Hovold
2025-02-04 23:09                 ` Dmitry Baryshkov
2025-02-05  6:17                   ` Dikshita Agarwal
2025-02-05  8:30                     ` Johan Hovold
2025-02-04 15:08             ` Vikash Garodia
2025-02-04 16:05               ` Johan Hovold
2025-01-28  8:04 ` [RFC PATCH v10 2/2] media: iris: enable video driver probe of SM8250 SoC Dikshita Agarwal

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=Z6B822-6UTxQfX46@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=hverkuil@xs4all.nl \
    --cc=krzk+dt@kernel.org \
    --cc=krzk@kernel.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=lujianhua000@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=nicolas@ndufresne.ca \
    --cc=p.zabel@pengutronix.de \
    --cc=quic_abhinavk@quicinc.com \
    --cc=quic_dikshita@quicinc.com \
    --cc=quic_vgarodia@quicinc.com \
    --cc=robh@kernel.org \
    --cc=sebastian.fricke@collabora.com \
    --cc=stefan.schmidt@linaro.org \
    --cc=u.kleine-koenig@baylibre.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