staging: unisys: use the kernel min define
authorDavid Kershner <david.kershner@unisys.com>
Wed, 30 Aug 2017 17:36:08 +0000 (13:36 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 31 Aug 2017 16:17:38 +0000 (18:17 +0200)
The kernel already provides a min function, we should be using that
instead of creating our own MINNUM.

Reviewed-by: Sameer Wadgaonkar <sameer.wadgaonkar@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/unisys/include/iochannel.h
drivers/staging/unisys/visornic/visornic_main.c

index 956294734f25a17331113dc8d3837443e3c80b8d..a70760f48566bb8a5294166cc96e3ec9082d5499 100644 (file)
@@ -61,9 +61,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.
  *     IOCHAN_TO_IOPART -- used by guest to 'insert' signals to iopart.
index 3db414803f2a17804827fa0688f76ba0bc8a42d0..0c29d5306f1211e6c17793e13498096380dddd70 100644 (file)
@@ -198,12 +198,11 @@ struct visornic_devdata {
 };
 
 /* Returns next non-zero index on success or 0 on failure (i.e. out of room). */
-static u16 add_physinfo_entries(u64 inp_pfn, u16 inp_off, u32 inp_len,
+static u16 add_physinfo_entries(u64 inp_pfn, u16 inp_off, u16 inp_len,
                                u16 index, u16 max_pi_arr_entries,
                                struct phys_info pi_arr[])
 {
-       u32 len;
-       u16 i, firstlen;
+       u16 i, len, firstlen;
 
        firstlen = PI_PAGE_SIZE - inp_off;
        if (inp_len <= firstlen) {
@@ -227,8 +226,8 @@ static u16 add_physinfo_entries(u64 inp_pfn, u16 inp_off, u32 inp_len,
                        pi_arr[index].pi_len = firstlen;
                } else {
                        pi_arr[index + i].pi_off = 0;
-                       pi_arr[index + i].pi_len =
-                           (u16)MINNUM(len, (u32)PI_PAGE_SIZE);
+                       pi_arr[index + i].pi_len = min_t(u16, len,
+                                                        PI_PAGE_SIZE);
                }
        }
        return index + i;