From patchwork Wed Jul 4 21:52: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: 10507701 X-Patchwork-Delegate: jgg@ziepe.ca 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 4FE91603D7 for ; Wed, 4 Jul 2018 21:53:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4602528D83 for ; Wed, 4 Jul 2018 21:53:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3556328DB0; Wed, 4 Jul 2018 21:53:11 +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 2340428D83 for ; Wed, 4 Jul 2018 21:53:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752882AbeGDVxH (ORCPT ); Wed, 4 Jul 2018 17:53:07 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:50601 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752922AbeGDVxG (ORCPT ); Wed, 4 Jul 2018 17:53:06 -0400 Received: by mail-wm0-f68.google.com with SMTP id v25-v6so8141531wmc.0 for ; Wed, 04 Jul 2018 14:53:05 -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=/HyuKwCDzossNrKIc7Bpbv7mD4cvpv3eJINV/goRUQM=; b=tMkwSsGosown/ttcVKTNZFauymUr0erKWiakfFWAqz7El9xYfy8xlB+LHTZK8dZqxj 6zyI1Ptk+uBgYrf/LKJeigFBElw8dqBDFccvyifk2esKaexW38bmL6sKRxGCTqKv3lVM 7NnuIZlc9JZip/sZxxl30S94qyYvgAq3hyjD2mwzvPgXz3gM0Rs5rxrSK7bCB8lgNJOL ijCCdPR5qunOLylIdVb8nqxvmZA2yIEQ6E7qeCSKf5vqv826aiVr+Tn+DyQwvUlPWTLe +W4U7YAOv86EoEqIczX8f7HNt1SNDwlqAVcqBr6gI7wr4Pw83NbsGvghXyeIPft+c8Jo M0GA== 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=/HyuKwCDzossNrKIc7Bpbv7mD4cvpv3eJINV/goRUQM=; b=FURr7PEsXwzGs2svX0wqFK3fBk/YViqGpILSuoUG8ZoTgOQQemGi0QhJ7so1LvHgrp s+x7pC3L/34jbOTNRNqh6vc9HyhE/fVcUK3pUPcwGt0BNDLFyC1vh0sh4s67AzyXcNo0 sVKq5nbDZgZ+T+CgqFyUmlR5K0E4KVxnasj8oQoTuufkzhK1yQeS8GREd5sQaBu/0Hi9 TZrOOXXfb0SzjfvOnSdhgEqFaiV++jCmGwgSi7+UOH16m6cXMUovsikFkrwGBWKYxshJ FmgT4ToYMePpbzgqqJ4D567RYcT74VAoecGCgNUHAQOmFLkafudevWQ1U2JUR6kmahfy CLNA== X-Gm-Message-State: APt69E0PXXEbWSJ0tAJiaUEU3CobBFEkoIHSlmwcym0QE4IsRSlbwnBz IWrbff5QTwa1a5jinuRNLZQ= X-Google-Smtp-Source: AAOMgpfJVKazWWzc+f2L3Moca2A2xItR+4ejI1Z+xZLAzxqWajTep7tO2qWCVybyTfYzCnKxvOgCxg== X-Received: by 2002:a1c:2bc1:: with SMTP id r184-v6mr2391303wmr.13.1530741184884; Wed, 04 Jul 2018 14:53:04 -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 d102-v6sm9005353wma.10.2018.07.04.14.53.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Jul 2018 14:53:04 -0700 (PDT) From: Kamal Heib To: Doug Ledford , Jason Gunthorpe , Leon Romanovsky Cc: linux-rdma@vger.kernel.org, Kamal Heib Subject: [PATCH rdma-next V2 1/5] RDMA/ipoib: Use min_t() macro instead of min() Date: Thu, 5 Jul 2018 00:52:47 +0300 Message-Id: <20180704215251.10698-2-kamalheib1@gmail.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180704215251.10698-1-kamalheib1@gmail.com> References: <20180704215251.10698-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 casting when using min() macro, also fix the type of "length" and "wc->byte_len" to be "unsigned int" and "u32" which is the right type for each one of them. Signed-off-by: Kamal Heib Reviewed-by: Leon Romanovsky --- 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..9c7226b45766 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(u32, wc->byte_len, IPOIB_CM_HEAD_SIZE)) / PAGE_SIZE; newskb = ipoib_cm_alloc_rx_skb(dev, rx_ring, wr_id, frags, mapping, GFP_ATOMIC);