All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sylwester Nawrocki <s.nawrocki@samsung.com>
Cc: linux-media@vger.kernel.org, sw0312.kim@samsung.com,
	Kyungmin Park <kyungmin.park@samsung.com>
Subject: Re: [PATCH] s5p-fimc: Fix platform entities registration
Date: Thu, 25 Oct 2012 13:35:53 +0200	[thread overview]
Message-ID: <6007649.66KylGAjOu@avalon> (raw)
In-Reply-To: <1351156016-10970-1-git-send-email-s.nawrocki@samsung.com>

Hi Sylwester,

On Thursday 25 October 2012 11:06:56 Sylwester Nawrocki wrote:
> Make sure there is no v4l2_device_unregister_subdev() call
> on a subdev which wasn't registered.

I'm not implying that this fix is bad, but doesn't the V4L2 core already 
handle this ? v4l2_device_unregister_subdev() returns immediately without 
doing anything if the subdev hasn't been registered.

> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/media/platform/s5p-fimc/fimc-mdevice.c |   25  ++++++++++----------
>  1 file changed, 13 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/media/platform/s5p-fimc/fimc-mdevice.c
> b/drivers/media/platform/s5p-fimc/fimc-mdevice.c index 715b258..a69f053
> 100644
> --- a/drivers/media/platform/s5p-fimc/fimc-mdevice.c
> +++ b/drivers/media/platform/s5p-fimc/fimc-mdevice.c
> @@ -345,24 +345,23 @@ static int fimc_register_callback(struct device *dev,
> void *p) struct fimc_dev *fimc = dev_get_drvdata(dev);
>  	struct v4l2_subdev *sd = &fimc->vid_cap.subdev;
>  	struct fimc_md *fmd = p;
> -	int ret = 0;
> +	int ret;
> 
> -	if (!fimc || !fimc->pdev)
> +	if (fimc == NULL)
>  		return 0;
> 
> -	if (fimc->pdev->id < 0 || fimc->pdev->id >= FIMC_MAX_DEVS)
> +	if (fimc->id >= FIMC_MAX_DEVS)
>  		return 0;
> 
>  	fimc->pipeline_ops = &fimc_pipeline_ops;
> -	fmd->fimc[fimc->pdev->id] = fimc;
>  	sd->grp_id = FIMC_GROUP_ID;
> 
>  	ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd);
> -	if (ret) {
> +	if (!ret)
> +		fmd->fimc[fimc->id] = fimc;
> +	else
>  		v4l2_err(&fmd->v4l2_dev, "Failed to register FIMC.%d (%d)\n",
>  			 fimc->id, ret);
> -	}
> -
>  	return ret;
>  }
> 
> @@ -380,15 +379,15 @@ static int fimc_lite_register_callback(struct device
> *dev, void *p) return 0;
> 
>  	fimc->pipeline_ops = &fimc_pipeline_ops;
> -	fmd->fimc_lite[fimc->index] = fimc;
>  	sd->grp_id = FLITE_GROUP_ID;
> 
>  	ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd);
> -	if (ret) {
> +	if (!ret)
> +		fmd->fimc_lite[fimc->index] = fimc;
> +	else
>  		v4l2_err(&fmd->v4l2_dev,
>  			 "Failed to register FIMC-LITE.%d (%d)\n",
>  			 fimc->index, ret);
> -	}
>  	return ret;
>  }
> 
> @@ -407,10 +406,12 @@ static int csis_register_callback(struct device *dev,
> void *p) v4l2_info(sd, "csis%d sd: %s\n", pdev->id, sd->name);
> 
>  	id = pdev->id < 0 ? 0 : pdev->id;
> -	fmd->csis[id].sd = sd;
> +
>  	sd->grp_id = CSIS_GROUP_ID;
>  	ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd);
> -	if (ret)
> +	if (!ret)
> +		fmd->csis[id].sd = sd;
> +	else
>  		v4l2_err(&fmd->v4l2_dev,
>  			 "Failed to register CSIS subdevice: %d\n", ret);
>  	return ret;
-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2012-10-25 11:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-25  9:06 [PATCH] s5p-fimc: Fix platform entities registration Sylwester Nawrocki
2012-10-25 11:35 ` Laurent Pinchart [this message]
2012-10-25 12:42   ` Sylwester Nawrocki
2012-10-27 20:44     ` Sylwester Nawrocki
2012-10-25 14:07 ` Sylwester Nawrocki

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=6007649.66KylGAjOu@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-media@vger.kernel.org \
    --cc=s.nawrocki@samsung.com \
    --cc=sw0312.kim@samsung.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.