mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Luca Ceresoli <luca@lucaceresoli.net>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Eugen Hristev <eugen.hristev@microchip.com>,
	leonl@leopardimaging.com, linux-media@vger.kernel.org,
	skomatineni@nvidia.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: i2c: imx274: implement enum_mbus_code
Date: Thu, 18 Nov 2021 18:39:09 +0100	[thread overview]
Message-ID: <f7a04ae1-de4f-2e76-1baa-7bafb970dc10@lucaceresoli.net> (raw)
In-Reply-To: <YZaMtGhqaXIOLhox@paasikivi.fi.intel.com>

Hi,

On 18/11/21 18:26, Sakari Ailus wrote:
> Hi Luca,
> 
> On Thu, Nov 18, 2021 at 06:11:35PM +0100, Luca Ceresoli wrote:
>> Hi Eugen,
>>
>> On 18/11/21 16:40, Eugen Hristev wrote:
>>> Current driver supports only SRGGB 10 bit RAW bayer format.
>>> Add the enum_mbus_code implementation to report this format supported.
>>>
>>>  # v4l2-ctl -d /dev/v4l-subdev3 --list-subdev-mbus-codes
>>> ioctl: VIDIOC_SUBDEV_ENUM_MBUS_CODE (pad=0)
>>>         0x300f: MEDIA_BUS_FMT_SRGGB10_1X10
>>>  #
>>>
>>> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
>>
>> Generally OK, but I have a few minor comments.
>>
>>> ---
>>>  drivers/media/i2c/imx274.c | 14 ++++++++++++++
>>>  1 file changed, 14 insertions(+)
>>>
>>> diff --git a/drivers/media/i2c/imx274.c b/drivers/media/i2c/imx274.c
>>> index 2e804e3b70c4..25a4ef8f6187 100644
>>> --- a/drivers/media/i2c/imx274.c
>>> +++ b/drivers/media/i2c/imx274.c
>>> @@ -1909,7 +1909,21 @@ static int imx274_set_frame_interval(struct stimx274 *priv,
>>>  	return err;
>>>  }
>>>  
>>> +static int imx274_enum_mbus_code(struct v4l2_subdev *sd,
>>> +				 struct v4l2_subdev_state *sd_state,
>>> +				 struct v4l2_subdev_mbus_code_enum *code)
>>> +{
>>> +	if (code->index > 0)
>>> +		return -EINVAL;
>>
>> Many driver do check code->pad too, so you might want to do
>>
>> 	if (code->pad > 0 || code->index > 0)
>> 		return -EINVAL;
> 
> The caller will have checked the pad exists, and there's a single one on
> the subdev I suppose.

Thanks for your explanation. That's very reasonable indeed.

Now, why do many drivers do that? Old checks that later turned useless
and nobody ever removed?

-- 
Luca

  parent reply	other threads:[~2021-11-18 17:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-18 15:40 Eugen Hristev
2021-11-18 17:11 ` Luca Ceresoli
2021-11-18 17:26   ` Sakari Ailus
2021-11-18 17:34     ` Eugen.Hristev
2021-11-18 17:37       ` Luca Ceresoli
2021-11-18 17:39     ` Luca Ceresoli [this message]
2021-11-19  8:26       ` Sakari Ailus

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=f7a04ae1-de4f-2e76-1baa-7bafb970dc10@lucaceresoli.net \
    --to=luca@lucaceresoli.net \
    --cc=eugen.hristev@microchip.com \
    --cc=leonl@leopardimaging.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=skomatineni@nvidia.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®