On Tue, Aug 22, 2017 at 01:27:06PM -0400, David Kershner wrote:
> The kernel already provides a min function, we should be using that
> instead of creating our own MINNUM.
> 
> Reviewed-by: Sameer Wadgaonkar <sameer.wadgaon...@unisys.com>
> Signed-off-by: David Kershner <david.kersh...@unisys.com>
> Reviewed-by: Tim Sell <timothy.s...@unisys.com>
> ---
>  drivers/staging/unisys/include/iochannel.h      | 3 ---
>  drivers/staging/unisys/visornic/visornic_main.c | 2 +-
>  2 files changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/unisys/include/iochannel.h 
> b/drivers/staging/unisys/include/iochannel.h
> index ca9d6f9..e6f1d55 100644
> --- a/drivers/staging/unisys/include/iochannel.h
> +++ b/drivers/staging/unisys/include/iochannel.h
> @@ -46,9 +46,6 @@
>   * IO Partition is defined below.
>   */
>  
> -/* Defines and enums. */
> -#define MINNUM(a, b) (((a) < (b)) ? (a) : (b))
> -
>  /* Define the two queues per data channel between iopart and ioguestparts. */
>  
>  /* Used by ioguestpart to 'insert' signals to iopart. */
> diff --git a/drivers/staging/unisys/visornic/visornic_main.c 
> b/drivers/staging/unisys/visornic/visornic_main.c
> index 135d37c..7856ed1 100644
> --- a/drivers/staging/unisys/visornic/visornic_main.c
> +++ b/drivers/staging/unisys/visornic/visornic_main.c
> @@ -221,7 +221,7 @@ static u16 add_physinfo_entries(u64 inp_pfn, u16 inp_off, 
> u32 inp_len,
>               } else {
>                       pi_arr[index + i].pi_off = 0;
>                       pi_arr[index + i].pi_len =
> -                         (u16)MINNUM(len, (u32)PI_PAGE_SIZE);
> +                         (u16)min_t(u32, len, (u32)PI_PAGE_SIZE);

Why do you need to cast PI_PAGE_SIZE if you are using min_t()?  And are
you sure you can then cast the result to u16?  If len is u16, why not
just use min_t(u16,...) ?

thanks,

greg k-h
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to