mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Lubomir Rintel <lrintel@redhat.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Lubomir Rintel <lkundrak@v3.sk>,
	stable@vger.kernel.org
Subject: Re: [PATCH] media/mmp: Bring back registration of the device
Date: Tue, 7 Jan 2025 11:30:32 +0000	[thread overview]
Message-ID: <Z30QWA-LfZHwVbmm@kekkonen.localdomain> (raw)
In-Reply-To: <20241231190434.438517-1-lkundrak@v3.sk>

Hi Lubomir,

Thanks for the patch.

On Tue, Dec 31, 2024 at 08:04:34PM +0100, Lubomir Rintel wrote:
> In commit 4af65141e38e ("media: marvell: cafe: Register V4L2 device
> earlier"), a call to v4l2_device_register() was moved away from
> mccic_register() into its caller, marvell/cafe's cafe_pci_probe().
> This is not the only caller though -- there's also marvell/mmp.
> 
> Add v4l2_device_register() into mmpcam_probe() to unbreak the MMP camera
> driver, in a fashion analogous to what's been done to the Cafe driver.
> Same for the teardown path.
> 
> Fixes: 4af65141e38e ("media: marvell: cafe: Register V4L2 device earlier")
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> Cc: stable@vger.kernel.org # v6.6+
> ---
>  drivers/media/platform/marvell/mmp-driver.c | 21 +++++++++++++++++----
>  1 file changed, 17 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/marvell/mmp-driver.c b/drivers/media/platform/marvell/mmp-driver.c
> index 3fd4fc1b9c48..d3da7ebb4a2b 100644
> --- a/drivers/media/platform/marvell/mmp-driver.c
> +++ b/drivers/media/platform/marvell/mmp-driver.c
> @@ -231,13 +231,23 @@ static int mmpcam_probe(struct platform_device *pdev)
>  
>  	mcam_init_clk(mcam);
>  
> +	/*
> +	 * Register with V4L.
> +	 */
> +
> +	ret = v4l2_device_register(mcam->dev, &mcam->v4l2_dev);

I'd do this just before initialising the notifier (as in the patch in
Fixes: tag): registering the V4L2 device requires probably severe memory
pressure while it's entirely plausible there's no endpoint for the device.

> +	if (ret)
> +		return ret;
> +
>  	/*
>  	 * Create a match of the sensor against its OF node.
>  	 */
>  	ep = fwnode_graph_get_next_endpoint(of_fwnode_handle(pdev->dev.of_node),
>  					    NULL);
> -	if (!ep)
> -		return -ENODEV;
> +	if (!ep) {
> +		ret = -ENODEV;
> +		goto out_v4l2_device_unregister;
> +	}
>  
>  	v4l2_async_nf_init(&mcam->notifier, &mcam->v4l2_dev);
>  
> @@ -246,7 +256,7 @@ static int mmpcam_probe(struct platform_device *pdev)
>  	fwnode_handle_put(ep);
>  	if (IS_ERR(asd)) {
>  		ret = PTR_ERR(asd);
> -		goto out;
> +		goto out_v4l2_device_unregister;
>  	}
>  
>  	/*
> @@ -254,7 +264,7 @@ static int mmpcam_probe(struct platform_device *pdev)
>  	 */
>  	ret = mccic_register(mcam);
>  	if (ret)
> -		goto out;
> +		goto out_v4l2_device_unregister;
>  
>  	/*
>  	 * Add OF clock provider.
> @@ -283,6 +293,8 @@ static int mmpcam_probe(struct platform_device *pdev)
>  	return 0;
>  out:

For clarity, it'd be best to rename the out label to something more
specific, i.e. out_mccic_shutdown. Either way,

Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>

>  	mccic_shutdown(mcam);
> +out_v4l2_device_unregister:
> +	v4l2_device_unregister(&mcam->v4l2_dev);
>  
>  	return ret;
>  }
> @@ -293,6 +305,7 @@ static void mmpcam_remove(struct platform_device *pdev)
>  	struct mcam_camera *mcam = &cam->mcam;
>  
>  	mccic_shutdown(mcam);
> +	v4l2_device_unregister(&mcam->v4l2_dev);
>  	pm_runtime_force_suspend(mcam->dev);
>  }
>  

-- 
Regards,

Sakari Ailus

  parent reply	other threads:[~2025-01-07 11:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-31 19:04 Lubomir Rintel
2025-01-06 15:10 ` Hans Verkuil
2025-01-07 11:14   ` Lubomir Rintel
2025-01-07 11:30 ` Sakari Ailus [this message]
2025-01-07 12:11   ` Hans Verkuil

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=Z30QWA-LfZHwVbmm@kekkonen.localdomain \
    --to=sakari.ailus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=lkundrak@v3.sk \
    --cc=lrintel@redhat.com \
    --cc=mchehab@kernel.org \
    --cc=stable@vger.kernel.org \
    /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®