Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1567796rwd; Tue, 13 Jun 2023 10:50:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5x9grVFHBi1Z07pzLOzunogGvM0KaOTpuMRr4cSqI0I5M5LpigUPE8rYLjSjrDlVEqlvHg X-Received: by 2002:adf:fd0a:0:b0:307:cf55:a7d8 with SMTP id e10-20020adffd0a000000b00307cf55a7d8mr7705630wrr.42.1686678657263; Tue, 13 Jun 2023 10:50:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686678657; cv=none; d=google.com; s=arc-20160816; b=cBTXoNM9DuYufenR2SjnfET4Ks4Fn9e4oraK7kZ+fu9mdEj7FFQycQNJWvqNjMKSno wV9Holp2E5DUo1YH85DoiYbUibe8Ls/jfPHfnbZ14/PbZGn4qMPRY6ZtIe8d/jGCa6ai d+Gk/phOZXzvZj/eHQpGTMtuPWmIBkL/Ku8lPm26vM5rORYG4ecXhoQemiPHleC8XlNc TJppIvi+bcXDohYDUG0aw6/+9dAuk8mnaFWpwKo5IcWC696yNk5HrEdNdCbaQRB1FPDB t4SPOiPM7is10wT9LiYYVcRB+FewZ3Gs8xb4OaYUgXArMarKMwzFygy+WlnMrS/Q+Uup Anzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=86rh1f0HBKfOE+lzuTwLJdkE+7pPjEWV2pIeiL0qQXk=; b=qt3DnOnxx3taAw3Q/3QvJPYxRCWyDI7CMQLKWhLIW9Q1j9OtCOZ2APH4FksjAC1OOX cj58LO1I2jYeFpmqZBgGkOqEbHGEeK5a7ZrauDT1vMdx8haOAvfRslvhVzDHj/qCP/2n ev+fTeE4vmr1/Y6UlRumuXsHQ+iILDC1fibik27x+l4WvWvqR4d/1LumrbFDuwYseyIp awmLFqOcF3ux3LGxKndTq8Mr4pJL0v3MvqxsZUhtSLGJyqm0A7gb+iLIh06u8CinpHrY 3kRx4o1MpW73+2aPFFBidhDCO9t6eH7QbhPrdrrjReo2BNSa9KPOGekG1cDn1O8Bk+wb VmGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="pF/oK2cw"; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c9-20020aa7c989000000b0050da1ef2edasi7873702edt.340.2023.06.13.10.50.32; Tue, 13 Jun 2023 10:50:57 -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; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="pF/oK2cw"; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232995AbjFMRfY (ORCPT + 99 others); Tue, 13 Jun 2023 13:35:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232554AbjFMRfJ (ORCPT ); Tue, 13 Jun 2023 13:35:09 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E9B41FE5; Tue, 13 Jun 2023 10:34:44 -0700 (PDT) X-GND-Sasl: herve.codina@bootlin.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1686677683; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=86rh1f0HBKfOE+lzuTwLJdkE+7pPjEWV2pIeiL0qQXk=; b=pF/oK2cwuHCGuxVOM6DoseXfu83gnXuDTUpUvA9KEn0otsbNNzAA4pJPLVlJc5JrD3dGbr V0NpyMNa0sSRNqbb3yOvL0S10jM9O8IGKL+jAbnAuDQZB9SQpm9XrkvoIKG3brJIIhGRRM EcNFZEmvFvUb5QYmp9+Wd5Pnrf2Y8tv7aXv/Y/3hALFfIF356bK6jdj3nthmcCefNokuhy Hb+vEuC8h9JBolygcQDRKCAAo5m2LFYvNdRcu0hbzUjh9vP3fRhNAs2jKaGxdoL6X7iBMm pvVGec+DO94oFRPp6mXKfp+Og4FmeHRt4ldea3l3CoU9Q1/zxbN5bzyXeUX3Jg== X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 3B8E8E0003; Tue, 13 Jun 2023 17:34:41 +0000 (UTC) Date: Tue, 13 Jun 2023 19:34:40 +0200 From: Herve Codina To: Andy Shevchenko Cc: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Cameron , Lars-Peter Clausen , Jaroslav Kysela , Takashi Iwai , Kuninori Morimoto , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, Christophe Leroy , Thomas Petazzoni Subject: Re: [PATCH v3 06/12] minmax: Introduce {min,max}_array() Message-ID: <20230613193440.1940c3a7@bootlin.com> In-Reply-To: References: <20230612122926.107333-1-herve.codina@bootlin.com> <20230612122926.107333-7-herve.codina@bootlin.com> <20230613100000.6bd9e690@bootlin.com> Organization: Bootlin X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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 On Tue, 13 Jun 2023 20:08:08 +0300 Andy Shevchenko wrote: > On Tue, Jun 13, 2023 at 11:00 AM Herve Codina wrote: > > On Mon, 12 Jun 2023 17:10:40 +0300 > > Andy Shevchenko wrote: > > > On Mon, Jun 12, 2023 at 3:30 PM Herve Codina wrote: > > > > > > > > Introduce min_array() (resp max_array()) in order to get the > > > > minimal (resp maximum) of values present in an array. > > > > > > Some comments below, after addressing them, > > > Reviewed-by: Andy Shevchenko > > ... > > > > > + typeof(array) __array = (array); \ > > > > > > We have __must_be_array() > > > > Using __must_be_array() will lead to some failure. > > Indeed, we can have: > > --- 8< --- > > int *buff > > ... > > min = min_array(buff, nb_item); > > --- 8< --- > > > > In this case, __must_be_array() will report that buff is not an array. > > Oh, I missed that. > > > To avoid any confusion, what do you think if I renamed {min,max}_array() > > to {min,max}_buffer() and replace __array by __buff and use *(__buff + xxx) > > instead of array[xxx] in the macro. > > But functionally it's still against an array. > > I would stick with "array" in the name, but add a comment why > __must_be_array() is not used. If we need a stricter variant, we may > add a new wrapper with that check. That said, I think we can use > __array[0] and similar indexed accesses. > Right, I will provide an updated version on the next iteration. Thanks for your feedback. Hervé