Re: [PATCH] smiapp: re-use clamp_t instead of min(..., max(...))

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Andy,

Thanks for the patch.

(Drop Mauro from cc.)

On Wed, Jul 24, 2013 at 06:21:18PM +0300, Andy Shevchenko wrote:
> clamp_t does the job to put a variable into the given range.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
>  drivers/media/i2c/smiapp/smiapp-core.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
> index 7ac7580..914e52f 100644
> --- a/drivers/media/i2c/smiapp/smiapp-core.c
> +++ b/drivers/media/i2c/smiapp/smiapp-core.c
> @@ -1835,12 +1835,12 @@ static void smiapp_set_compose_scaler(struct v4l2_subdev *subdev,
>  		* sensor->limits[SMIAPP_LIMIT_SCALER_N_MIN]
>  		/ sensor->limits[SMIAPP_LIMIT_MIN_X_OUTPUT_SIZE];
>  
> -	a = min(sensor->limits[SMIAPP_LIMIT_SCALER_M_MAX],
> -		max(a, sensor->limits[SMIAPP_LIMIT_SCALER_M_MIN]));
> -	b = min(sensor->limits[SMIAPP_LIMIT_SCALER_M_MAX],
> -		max(b, sensor->limits[SMIAPP_LIMIT_SCALER_M_MIN]));
> -	max_m = min(sensor->limits[SMIAPP_LIMIT_SCALER_M_MAX],
> -		    max(max_m, sensor->limits[SMIAPP_LIMIT_SCALER_M_MIN]));
> +	a = clamp_t(u32, a, sensor->limits[SMIAPP_LIMIT_SCALER_M_MIN],
> +		    sensor->limits[SMIAPP_LIMIT_SCALER_M_MAX]);
> +	b = clamp_t(u32, b, sensor->limits[SMIAPP_LIMIT_SCALER_M_MIN],
> +		    sensor->limits[SMIAPP_LIMIT_SCALER_M_MAX]);
> +	max_m = clamp_t(u32, max_m, sensor->limits[SMIAPP_LIMIT_SCALER_M_MIN],
> +			sensor->limits[SMIAPP_LIMIT_SCALER_M_MAX]);

Do you need clamp_t()? Wouldn't plain clamp() do?

I can change it if you're ok with that.

-- 
Cheers,

Sakari Ailus
e-mail: sakari.ailus@xxxxxx	XMPP: sailus@xxxxxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux