From patchwork Wed Jul 4 18:46:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 10507497 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 989CE6028F for ; Wed, 4 Jul 2018 18:47:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD00F28744 for ; Wed, 4 Jul 2018 18:47:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D1027288B9; Wed, 4 Jul 2018 18:47:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8157928744 for ; Wed, 4 Jul 2018 18:47:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752567AbeGDSrJ (ORCPT ); Wed, 4 Jul 2018 14:47:09 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:52574 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752251AbeGDSrI (ORCPT ); Wed, 4 Jul 2018 14:47:08 -0400 Received: by mail-wm0-f67.google.com with SMTP id w16-v6so7431587wmc.2 for ; Wed, 04 Jul 2018 11:47:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fUtkk5Jnrf3MIuGqsCK5GbkJ2ec2OmjuCTn/QfOFQ04=; b=VyKqWUjwzVfovwcxJViMAxHg1dqxUhxfF6HbISOQleHGT3eFABXIII6bOP34yY5FwW umAQVYQlQXl8VoCmnCZ4+zD82hxbdWk+IdrMoU/Fwr+1kOa9qHaB8XoVwW0YACFKEU7S XEZXNMRcjz4LRLT6+clKO8eRD5RvkkrSmNbd42PsFNVl9iXxr964jap0ajGB6OlrusCK eT0C0eXpFl341NAecXiVwQ1RdR9qKNLWNRgPVYsLA+Lje+R1ncwyG61+xgAPh/k0gDxQ P5GnV0OSKrEnvZ1St287sSfYtTpOvhV/DFZXZbphCy2qmQ7tWG/tOr+ScSRp7m7AwI3m PqGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fUtkk5Jnrf3MIuGqsCK5GbkJ2ec2OmjuCTn/QfOFQ04=; b=fqXxO+H0eRrjnbqRsetPef3l5KdUgjsZ6+c746/ln1e9KbANLgoKnK07ZqKEIitRYQ kIu0rhPIbm0flqouxY7qVJHlGQWtjR0LMaAFVtVa80iW25I/ht9YgsWiTdOtzinrXBGu /9TFfe886upqy6aLgALRIegyiRROK1PlYBzHxILgnHSwjV6ScTG9RAr7Yb98EiJJ8BYX AUHtG5lSK6mG12qxgEBGHFt77PM2bdVyE2P0d4eFuiCGB4SdTzau6w70gGR1Om7R2H9e trtczZ6uJF27H+V85EGPm1VKLv+oGh0aL2TEBXAzlE2KcNLM71x+g5BWr/I0wE4faTsm 99fg== X-Gm-Message-State: APt69E2lZXK/0n7TByTLJfoT8aax9mUrOHoSKNQaPOnFVry+2Vywi/e1 1AYYhYq+5x6eOIPh2XGU1WY= X-Google-Smtp-Source: AAOMgpfJW/xRAk0kOXTeQh91yaWK58/4LfCxdtvhOwBNITUkUoV3nBGJSzQ17jNfVUcsF8aFdV3C3g== X-Received: by 2002:a1c:c501:: with SMTP id v1-v6mr2439800wmf.112.1530730027333; Wed, 04 Jul 2018 11:47:07 -0700 (PDT) Received: from localhost.localdomain (bzq-79-179-11-238.red.bezeqint.net. [79.179.11.238]) by smtp.gmail.com with ESMTPSA id s12-v6sm262953wmc.2.2018.07.04.11.47.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Jul 2018 11:47:06 -0700 (PDT) From: Kamal Heib To: Doug Ledford , Jason Gunthorpe Cc: linux-rdma@vger.kernel.org, Kamal Heib Subject: [PATCH rdma-next 1/5] RDMA/ipoib: Use min_t() macro instead of min() Date: Wed, 4 Jul 2018 21:46:47 +0300 Message-Id: <20180704184651.26728-2-kamalheib1@gmail.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180704184651.26728-1-kamalheib1@gmail.com> References: <20180704184651.26728-1-kamalheib1@gmail.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use min_t() macro to avoid the casing when using min() macro, also use "unsigned int" instead of "unsigned" which is prefered. Signed-off-by: Kamal Heib --- drivers/infiniband/ulp/ipoib/ipoib_cm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 23cb1adc636f..9e7e5fd8eac6 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c @@ -547,7 +547,7 @@ static void skb_put_frags(struct sk_buff *skb, unsigned int hdr_space, 0, PAGE_SIZE); --skb_shinfo(skb)->nr_frags; } else { - size = min(length, (unsigned) PAGE_SIZE); + size = min_t(unsigned int, length, PAGE_SIZE); skb_frag_size_set(frag, size); skb->data_len += size; @@ -641,8 +641,8 @@ void ipoib_cm_handle_rx_wc(struct net_device *dev, struct ib_wc *wc) } } - frags = PAGE_ALIGN(wc->byte_len - min(wc->byte_len, - (unsigned)IPOIB_CM_HEAD_SIZE)) / PAGE_SIZE; + frags = PAGE_ALIGN(wc->byte_len - + min_t(unsigned int, wc->byte_len, IPOIB_CM_HEAD_SIZE)) / PAGE_SIZE; newskb = ipoib_cm_alloc_rx_skb(dev, rx_ring, wr_id, frags, mapping, GFP_ATOMIC);