Message ID | 20230615152631.224529-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 k13csp722564vqr; Thu, 15 Jun 2023 08:30:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4f6fcoSICzv4wOihREwt0vb0JJ7Y9X/WGnuZfAfWdg+AhmON+WIY0gzUPNfMxiWzg0GSw3 X-Received: by 2002:a17:902:dac5:b0:1b5:91:4693 with SMTP id q5-20020a170902dac500b001b500914693mr5543498plx.1.1686843043702; Thu, 15 Jun 2023 08:30:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686843043; cv=none; d=google.com; s=arc-20160816; b=ZscpEyD0HwhI+uuSwtv5I7dgmUnvgubSUGr09zko7dnpCEZVloXTPPUkLGAqjc1K3Z REk58a6HtphNmXVPPjZkzrRThe0I5XQsvY369S4SEz2dxc8K8EDHJYTTvcA4BOHHoikz rPvMW4IzUNK8zsJOQmm9XXi2mk5QvS5H8rX0z/CJBcNqrvXIJfx0LA1xNcXcoIJl9QsD B+MlR9NwOsB6KMtAYpHw+in9dW46Pajm32OzkKjyd0fvrMFC37dKOT8F1YQJLp7eZ/O6 5mSpPvlLwGW2vzbdjj4h6aW0GarP1km5A5PvkiBa0UVmv1ua8x+FFcJW/cWe0zj2RFym 56zA== 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=LumG9lQbCoaqWnFFIaPRrig8474uJ6glW5VjjTMChr8=; b=Mnt92Bf40/Ml4BTtikUDI2iMBKDY4E3JEK343ngv2+2mFPn7Xb/+Hi/g+NF3LuNswV eo1TRdId6KUwYa+pg/GXBTvKPhP45bWyfGYU5drXfG1xcqTWn47FEMrSvUK3Ii16PTGa lFJJwvJbJjqq3uzvEWPvauyaR4M2fiT5xmuvFVSXWXN+AdC80mFn5OSB4ZJeNics3KgE Ver1lOVJp1R1PLJHozogp+QNdW6cBkAdqcMTkp7d0ADtOmI8b+SYUfGXX64C4Y4Mg8F2 9alaq7mPomjxyKNsOMhPLx8ymUuP4wUEXbQ0jf6jS4TW7Gb9pSbeJiXTDF3lhzJ6tuT1 CWVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=C0+ccOGH; 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 a8-20020a170902b58800b001ae5eb838edsi12801596pls.152.2023.06.15.08.30.29; Thu, 15 Jun 2023 08:30:43 -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=C0+ccOGH; 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 S1345249AbjFOP1c (ORCPT <rfc822;n2h9z4@gmail.com> + 99 others); Thu, 15 Jun 2023 11:27:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345185AbjFOP0v (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 15 Jun 2023 11:26:51 -0400 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 624EB196; Thu, 15 Jun 2023 08:26:50 -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=1686842809; 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=LumG9lQbCoaqWnFFIaPRrig8474uJ6glW5VjjTMChr8=; b=C0+ccOGHKHKM70Ug0wQ6ZwGEeenn6Xz/MyH1DNCkFHQKamD2rS7kEXbScP4gRuSPnF5pL+ oWPaOm9gZ9wLz+92W/rhWYqiMKlDL3/hI1DwYQKnTNVl6mYn6/1W0YFlILdzVIeGnyYLNT gm7+zOqIa8uPNz9NjvceT5vrKuf49Xhawb1gYqFbK+xg0kw499OZuvMU/uIqodplYlWbe+ wWLzx0L9gLaCJmeuLc01AzWKo6A/t1xvX3UOnyCJWbVC/1FAU2D0uOGnDWLI7jWhB5iApe L67YVgIZxnRQ5mPjTqwpE3ME6jyu3ogVkEGMpdmEpMDGAP5/rjt/L81QGfPpXA== 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 9E4D3FF807; Thu, 15 Jun 2023 15:26:47 +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 v5 08/13] iio: inkern: Use max_array() to get the maximum value from an array Date: Thu, 15 Jun 2023 17:26:26 +0200 Message-Id: <20230615152631.224529-9-herve.codina@bootlin.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230615152631.224529-1-herve.codina@bootlin.com> References: <20230615152631.224529-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,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE 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?1768783131201384064?= X-GMAIL-MSGID: =?utf-8?q?1768783131201384064?= |
Series |
Add support for IIO devices in ASoC
|
|
Commit Message
Herve Codina
June 15, 2023, 3:26 p.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> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> --- drivers/iio/inkern.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
Comments
On Thu, 15 Jun 2023 17:26:26 +0200 Herve Codina <herve.codina@bootlin.com> wrote: > 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> > Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.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 */
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 */