Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp28840592rwd; Wed, 5 Jul 2023 03:36:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlHpXB+Z4eZ3nxrauvOsqx+lBYJDQTBUxiaUJCmVMtu58pd6THonVxxEw9QYHUVjMOByeQqN X-Received: by 2002:a17:90a:8009:b0:263:311f:9bcc with SMTP id b9-20020a17090a800900b00263311f9bccmr14569242pjn.35.1688553412889; Wed, 05 Jul 2023 03:36:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688553412; cv=none; d=google.com; s=arc-20160816; b=EU7h5zGPAPMbTpkN/0sbyzTRDBjLYiexZnkm+6RKS0kS3KEhDLE4dCXHC79MhHiVjW npVQPRDlqHwcvmMi9jMK7ZyVJxVtBo1Fdhnpxcpo5F8In9nq556a8ZWwEItpVqDSlLCY r+ohasHrzDtb8y5g28oWQhCkUhPOhHoXkuf36wCgG/hqwrDskHklwlxuzCYysZjZG282 xuz66RNZveXvb9Zz31JlruVNSjWXIsKMbPpnJkl2GqP5/RZFnszYFl9rV8WYKRJbxsww 9K6i81+tCtcBbNvccmsH9/044tElWklENx/s5Ih9fds8Wyj6ZeAFdu5LwIsrVWHfzDiM tTyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:date:from; bh=tS1U9HAX9PBJghzzWCJ9b6Qjr7U1ssC/43Bl9/wb/9k=; fh=/az++KgjK/q9bi9T6WWZhI8zu4NNskmhBt26if0wFus=; b=Td3psm/FIbz+3g2X2d773ZSKjZBAunANaOXJhGotYSc41pP6+2af/LGNIMLs7n7QsT QE38KWf6hLSe9QT5JkKhA9mvbzJAl7K2E78kQ1h6Iv1ZQMQMvLbp7aGkyHhn/O/c+AVa KjEhpYT6VyKPCEreie8w1q5H+oShv+7p4D7WdjkpxB4m50q3SBIFh+2fh7WrWTVx60vO g9Lb1ywdUpoI4sRTpcHg7qDL6ynvnYWs3TjXt90lEkogKNH5p6dcCHwU8lrfFYfHQFYY MDgNlbYpbreAQMrbibajWGyuzNeMusd6GvyZxrWGjVTEYWw3PuNHLb3a2q+c6r/g1CGl uaVg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h6-20020a17090a648600b00263532fa6f5si1362159pjj.172.2023.07.05.03.36.35; Wed, 05 Jul 2023 03:36:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231758AbjGEKZB (ORCPT + 99 others); Wed, 5 Jul 2023 06:25:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231383AbjGEKZA (ORCPT ); Wed, 5 Jul 2023 06:25:00 -0400 Received: from fgw21-7.mail.saunalahti.fi (fgw21-7.mail.saunalahti.fi [62.142.5.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5193E122 for ; Wed, 5 Jul 2023 03:24:59 -0700 (PDT) Received: from localhost (88-113-24-87.elisa-laajakaista.fi [88.113.24.87]) by fgw21.mail.saunalahti.fi (Halon) with ESMTP id 2fe35dd4-1b1e-11ee-abf4-005056bdd08f; Wed, 05 Jul 2023 13:24:57 +0300 (EEST) From: andy.shevchenko@gmail.com Date: Wed, 5 Jul 2023 13:24:56 +0300 To: Geert Uytterhoeven Cc: Fabrizio Castro , Mark Brown , Philipp Zabel , Magnus Damm , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Chris Paterson , Biju Das Subject: Re: [PATCH v2 3/5] spi: Add support for Renesas CSI Message-ID: References: <20230622113341.657842-1-fabrizio.castro.jz@renesas.com> <20230622113341.657842-4-fabrizio.castro.jz@renesas.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mon, Jul 03, 2023 at 12:19:26PM +0200, Geert Uytterhoeven kirjoitti: > On Thu, Jun 22, 2023 at 1:34 PM Fabrizio Castro > wrote: ... > > + if (csi->txbuf) > > + /* > > + * Leaving a little bit of headroom in the FIFOs makes it very > > + * hard to raise an overflow error (which is only possible > > + * when IP transmits and receives at the same time). > > + */ > > + to_transfer = min_t(int, CSI_FIFO_HALF_SIZE, bytes_remaining); > > + else > > + to_transfer = min_t(int, CSI_FIFO_SIZE_BYTES, bytes_remaining); > > Why min_t(int, ...)? Both values are int. min_t() should be used with a great care. > It would be better to make both unsigned, though. I believe you are assuming 3 (three) values and not 2 (two) under "both" (one variable and two definitions). -- With Best Regards, Andy Shevchenko