Message ID | 20230614074904.29085-9-herve.codina@bootlin.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1071088vqr; Wed, 14 Jun 2023 01:02:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4xpq4i4HnzIdZyzvzRNkTtwXTi/Z5YjOOAS2ppLKiTyrHUXw+4zv+C8eHUHnZAQQdpGaYl X-Received: by 2002:a92:d207:0:b0:33f:e84c:8dfd with SMTP id y7-20020a92d207000000b0033fe84c8dfdmr10122931ily.13.1686729721965; Wed, 14 Jun 2023 01:02:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686729721; cv=none; d=google.com; s=arc-20160816; b=JM+075vbl86GXZt7fxpWoFBs//zDFBMGAuS5rctmR2dBkUYK24WY0VhFCF85ozz4OS nQkh10I6RAi+B4HgQOdxl60eH6qUQtNtc5QZM5BnaNpEpC26i++elAamusXSwnC15Lut TyWT20zAAY/GtaI3w9wY4Mc3yKbfT8vt2fT+AABRsAh6Qk6sPPUIB9fbW7vDLAxt/KKk tfqRr7ZGMinsWNGHVb5IfBVUmCcxLKgS+8cNuJvu+fh4+Xx2nmlTFXC0jzUuljqLN0hu bBQy4aIW4LNwTr0CL1ymibpbR0VyjgOK0WvoZSVGMko5T7pgwbO5jdRcR474P6y7Ubj/ mkAg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bEU/M9TWTD2ATcBXVcwi+5zOlMT/Ey14qtpqXFcMwg0=; b=wWn8sOUU2SW5FDhzuamTtWb5980sck15MwB8JpjZJlNONL09pOLSd9TLtGFxIhncb9 igOa81xRIktPxmXPBbImVDnM69iVI0iqUTVq+owwMl20LCz5KrhkwIFILj0UBv8BpdEL 3zkUkGu8dL9pgcdVo41Kt4q5r5OVQxolacJTRA4pohX0gjyX56d8rrel2mGcUEvs+KIV HYBWbOezdK5LWb4hL+e9+wL2irY9mqxx7Wb+UJHMCH7oecKqh2Srv6kaHWtAqC3Re0rV mb6StqZQ2zeixdAoWcY10v4fJ4XevijCuycYHugTzEV/0+1eOsEig9IAxTWr4RhWlzyt f3xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=fxRUSgV6; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b27-20020a63931b000000b0051b65f4d94asi10408763pge.484.2023.06.14.01.01.48; Wed, 14 Jun 2023 01:02:01 -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=fxRUSgV6; 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 S243530AbjFNHuo (ORCPT <rfc822;jesperjuhl76@gmail.com> + 99 others); Wed, 14 Jun 2023 03:50:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243417AbjFNHtm (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 14 Jun 2023 03:49:42 -0400 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59C7410DA; Wed, 14 Jun 2023 00:49:41 -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=1686728980; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bEU/M9TWTD2ATcBXVcwi+5zOlMT/Ey14qtpqXFcMwg0=; b=fxRUSgV6MvV8yHiwR23oux91UeSscsys6K2HxWMc8Fcu/XQjNj05GEKuAHOSg/E/Cl/vfP 5OaVbKbe+3eEVj2N6wWSo0nBbpHV2qvXjjcq9BcOd74DybOn6zOOCL/fLmdtfUvFycBeeV GQjbpq6+KCv77fMtLnfJwPGbKBtjE+es2lQ/aaZBoMZ/Uf4swrNJE0u+ILYvm8hkvmuPfK k+24/VrEpuJSvwD0Q4Zltb0PYYOq+YMzVbgjpWk3yQ5GDFS9rZEyzT9SG2LZP0Qpy0DO2X 9h/0IfWru0dmVqByEVSbGiHRfkwB1MmHV2PRGLXAxUOpRJ92BtSXz32tAYs8gg== 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 X-GND-Sasl: herve.codina@bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPA id C18C11C0008; Wed, 14 Jun 2023 07:49:38 +0000 (UTC) From: Herve Codina <herve.codina@bootlin.com> To: Herve Codina <herve.codina@bootlin.com>, Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, Jonathan Cameron <jic23@kernel.org>, Lars-Peter Clausen <lars@metafoo.de>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>, Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>, Andy Shevchenko <andy.shevchenko@gmail.com> Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, Christophe Leroy <christophe.leroy@csgroup.eu>, Thomas Petazzoni <thomas.petazzoni@bootlin.com> Subject: [PATCH v4 08/13] iio: inkern: Use max_array() to get the maximum value from an array Date: Wed, 14 Jun 2023 09:48:59 +0200 Message-Id: <20230614074904.29085-9-herve.codina@bootlin.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230614074904.29085-1-herve.codina@bootlin.com> References: <20230614074904.29085-1-herve.codina@bootlin.com> MIME-Version: 1.0 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_H5,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768664305255984352?= X-GMAIL-MSGID: =?utf-8?q?1768664305255984352?= |
Series |
Add support for IIO devices in ASoC
|
|
Commit Message
Herve Codina
June 14, 2023, 7:48 a.m. UTC
Use max_array() to get the maximum value from an array instead of a
custom local loop.
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
drivers/iio/inkern.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
Comments
On Wed, Jun 14, 2023 at 10:49 AM Herve Codina <herve.codina@bootlin.com> wrote: > > Use max_array() to get the maximum value from an array instead of a > custom local loop. Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> > Signed-off-by: Herve Codina <herve.codina@bootlin.com> > --- > drivers/iio/inkern.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c > index 71d0424383b6..8bfd91f74101 100644 > --- a/drivers/iio/inkern.c > +++ b/drivers/iio/inkern.c > @@ -5,6 +5,7 @@ > */ > #include <linux/err.h> > #include <linux/export.h> > +#include <linux/minmax.h> > #include <linux/mutex.h> > #include <linux/property.h> > #include <linux/slab.h> > @@ -875,11 +876,7 @@ static int iio_channel_read_max(struct iio_channel *chan, > return -EINVAL; > switch (*type) { > case IIO_VAL_INT: > - *val = vals[--length]; > - while (length) { > - if (vals[--length] > *val) > - *val = vals[length]; > - } > + *val = max_array(vals, length); > break; > default: > /* FIXME: learn about max for other iio values */ > -- > 2.40.1 >
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index 71d0424383b6..8bfd91f74101 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c @@ -5,6 +5,7 @@ */ #include <linux/err.h> #include <linux/export.h> +#include <linux/minmax.h> #include <linux/mutex.h> #include <linux/property.h> #include <linux/slab.h> @@ -875,11 +876,7 @@ static int iio_channel_read_max(struct iio_channel *chan, return -EINVAL; switch (*type) { case IIO_VAL_INT: - *val = vals[--length]; - while (length) { - if (vals[--length] > *val) - *val = vals[length]; - } + *val = max_array(vals, length); break; default: /* FIXME: learn about max for other iio values */