lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZYAe0pa/oBmw/Mis@tom-HP-ZBook-Fury-15-G7-Mobile-Workstation>
Date: Mon, 18 Dec 2023 11:28:34 +0100
From: Tommaso Merciai <tomm.merciai@...il.com>
To: Laurent Pinchart <laurent.pinchart@...asonboard.com>
Cc: linuxfancy@...glegroups.com, sakari.ailus@...ux.intel.com,
	Martin Hecht <martin.hecht@...et.eu>,
	Mauro Carvalho Chehab <mchehab@...nel.org>,
	linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] media: i2c: alvium: inline set_frame_interval into
 s_frame_interval

Hi Laurent,

On Mon, Dec 18, 2023 at 04:55:07AM +0200, Laurent Pinchart wrote:
> Hi Tommaso,
> 
> Thank you for the patch.
> 
> On Fri, Dec 15, 2023 at 09:24:51AM +0100, Tommaso Merciai wrote:
> > Inline alvium_s_frame_interval function into alvium_s_frame_interval.
> 
> I think you mean "alvium_set_frame_interval() function into
> alvium_s_frame_interval.()"
> 
> > This to clean the driver code.
> 
> You can describe the reason more precisely:
> 
> The alvium_set_frame_interval() is called once only, by
> alvium_s_frame_interval(). The latter is a thin wrapper around the
> former. Inline the function in its caller to make the code more
> readable.
> 
> The rest looks good to me.

Yep, thanks for the review and for fixing commit body.
I will fix that in v2.

Thanks & Regards,
Tommaso

> 
> > Signed-off-by: Tommaso Merciai <tomm.merciai@...il.com>
> > ---
> >  drivers/media/i2c/alvium-csi2.c | 56 ++++++++++++---------------------
> >  1 file changed, 20 insertions(+), 36 deletions(-)
> > 
> > diff --git a/drivers/media/i2c/alvium-csi2.c b/drivers/media/i2c/alvium-csi2.c
> > index c4b7851045a1..fde456357be1 100644
> > --- a/drivers/media/i2c/alvium-csi2.c
> > +++ b/drivers/media/i2c/alvium-csi2.c
> > @@ -1662,16 +1662,25 @@ static int alvium_g_frame_interval(struct v4l2_subdev *sd,
> >  	return 0;
> >  }
> >  
> > -static int alvium_set_frame_interval(struct alvium_dev *alvium,
> > -				     struct v4l2_subdev *sd,
> > -				     struct v4l2_subdev_state *sd_state,
> > -				     struct v4l2_subdev_frame_interval *fi,
> > -				     u64 *req_fr)
> > +static int alvium_s_frame_interval(struct v4l2_subdev *sd,
> > +				   struct v4l2_subdev_state *sd_state,
> > +				   struct v4l2_subdev_frame_interval *fi)
> >  {
> > +	struct alvium_dev *alvium = sd_to_alvium(sd);
> >  	struct device *dev = &alvium->i2c_client->dev;
> > -	u64 dft_fr, min_fr, max_fr;
> > +	u64 req_fr, dft_fr, min_fr, max_fr;
> >  	int ret;
> >  
> > +	/*
> > +	 * FIXME: Implement support for V4L2_SUBDEV_FORMAT_TRY, using the V4L2
> > +	 * subdev active state API.
> > +	 */
> > +	if (fi->which != V4L2_SUBDEV_FORMAT_ACTIVE)
> > +		return -EINVAL;
> > +
> > +	if (alvium->streaming)
> > +		return -EBUSY;
> > +
> >  	if (fi->interval.denominator == 0)
> >  		return -EINVAL;
> >  
> > @@ -1686,42 +1695,17 @@ static int alvium_set_frame_interval(struct alvium_dev *alvium,
> >  	dev_dbg(dev, "fi->interval.denominator = %d\n",
> >  		fi->interval.denominator);
> >  
> > -	*req_fr = (u64)((fi->interval.denominator * USEC_PER_SEC) /
> > +	req_fr = (u64)((fi->interval.denominator * USEC_PER_SEC) /
> >  		       fi->interval.numerator);
> >  
> > -	if (*req_fr >= max_fr && *req_fr <= min_fr)
> > -		*req_fr = dft_fr;
> > +	if (req_fr >= max_fr && req_fr <= min_fr)
> > +		req_fr = dft_fr;
> >  
> > -	alvium->fr = *req_fr;
> > +	alvium->fr = req_fr;
> >  	alvium->frame_interval.numerator = fi->interval.numerator;
> >  	alvium->frame_interval.denominator = fi->interval.denominator;
> >  
> > -	return 0;
> > -}
> > -
> > -static int alvium_s_frame_interval(struct v4l2_subdev *sd,
> > -				   struct v4l2_subdev_state *sd_state,
> > -				   struct v4l2_subdev_frame_interval *fi)
> > -{
> > -	struct alvium_dev *alvium = sd_to_alvium(sd);
> > -	u64 req_fr;
> > -	int ret;
> > -
> > -	/*
> > -	 * FIXME: Implement support for V4L2_SUBDEV_FORMAT_TRY, using the V4L2
> > -	 * subdev active state API.
> > -	 */
> > -	if (fi->which != V4L2_SUBDEV_FORMAT_ACTIVE)
> > -		return -EINVAL;
> > -
> > -	if (alvium->streaming)
> > -		return -EBUSY;
> > -
> > -	ret = alvium_set_frame_interval(alvium, sd, sd_state, fi, &req_fr);
> > -	if (!ret)
> > -		ret = alvium_set_frame_rate(alvium, req_fr);
> > -
> > -	return ret;
> > +	return alvium_set_frame_rate(alvium, req_fr);
> >  }
> >  
> >  static int alvium_enum_mbus_code(struct v4l2_subdev *sd,
> 
> -- 
> Regards,
> 
> Laurent Pinchart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ