Message ID | 20230623085830.749991-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 k13csp5629663vqr; Fri, 23 Jun 2023 02:00:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Tv7eP41LSiVhs7b2h50ElCKtAkp/9Vrn8RM9b52GBzWb+u6W6/c7zF44YhLjewAPdfdqK X-Received: by 2002:a05:6a20:748c:b0:106:9266:4448 with SMTP id p12-20020a056a20748c00b0010692664448mr31960998pzd.16.1687510853961; Fri, 23 Jun 2023 02:00:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687510853; cv=none; d=google.com; s=arc-20160816; b=MrPbVl1EYj4KQygxi/Xdvh98JeeHYV/xYdAcnVlMobeVxTA2Av1b8Lp90XsA3gIEQQ xdifAZo7R2AF+gTtrOdXjhE9tTNHwhMIZchAXQs0DNMdebBkgoP/vNAYKO3zQKyYerJp VfAIZFWjix9jk8Qmrl1Sb8/FKZOk79AsGwl4Nm+iwWKSfRsyXgGBxTB/9VhuCfXpbPGv BI1XAXs+ndTsSht867T99vEqSszBtU1SWc0Zwj6IJ+xZTmP76DqLPPluAk8ybWll0DV1 EjzZX9klz1k3RMk2BtVBFCgGXC7WCrv2DcXfzXvhsnfLjCKhsajY07v8eKT60a/0QLCm MeQA== 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=E9t2e1q3XqXgkAJ8mkN8CCPIM4SOxAmZg6pkigwfbv4=; b=UcnhP/NHvrjNLvfDYAEhp8kcHp4la2tXlAbo9nfedSxP2sB1jinvpyj/5KzKgyUE/f R0+CAot/cGIsg9rMpJ5+3Td6+Ar/yNdy1cuUtA0Ycad6oqJRVbZ/o/34Hr2DThQm9MnS FeIPZLDTISyw+ZhqkAG6W+irLjdrwNZgVvW+Je7eCNvOQ3hvw4/Xu2hNJHrgErqyxk0T mshRymY0jQfe/VZHFpMF5IoJtCJJ/N8ZR6MmjTMFTs2suwfcL3p567v2qiPyZCYAOe+C 3r6qniTWGy+4WKha3KECRGr44buv2wb4lXsWaY2mi1SZ90ioduseyuZYYJSzl15VPikx eRqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=LEQ97ShR; 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 j137-20020a636e8f000000b0053578f3de77si6009225pgc.239.2023.06.23.02.00.36; Fri, 23 Jun 2023 02:00:53 -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=LEQ97ShR; 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 S231974AbjFWI7X (ORCPT <rfc822;maxin.john@gmail.com> + 99 others); Fri, 23 Jun 2023 04:59:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231935AbjFWI7E (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 23 Jun 2023 04:59:04 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72C5B26A1; Fri, 23 Jun 2023 01:58:57 -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=1687510735; 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=E9t2e1q3XqXgkAJ8mkN8CCPIM4SOxAmZg6pkigwfbv4=; b=LEQ97ShR1EMDXWLw8NWSlhKLPMTuk+/B/eKxLPY/qhtYF6SRZwlX2JrVaLWrq4TnQnGEQC 4d3JhmMIvOowmnxRcxn3Si9I6Yc39FqHSL9RIBAFhDtIcqtfSF6mf+mldQ6bkAi8gL43Qr SDI6gwfa1OnNFQ+N/zHFVsKFPcF99J49K8zCtJqgyUAHMhVbQXiibUsQ1AgUBpjeAtlW8n E9lb+Pe/C0I42rRMp0mCPuJmgcwDG57v/dTE4f/2YZ/JQCNaQthZS6cwMW3hjxI+yxY0U5 h8Kq0JpayMWc79ddAyyfso4nj+bCyfpoZhjvt7o0t6aG2f42QWVJv8k3fFzLiw== 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 X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPA id DBB0FE000C; Fri, 23 Jun 2023 08:58:53 +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, Wojciech Ziemba <wojciech.ziemba@intel.com>, Christophe Leroy <christophe.leroy@csgroup.eu>, Thomas Petazzoni <thomas.petazzoni@bootlin.com>, Jonathan Cameron <Jonathan.Cameron@huawei.com> Subject: [PATCH v6 08/13] iio: inkern: Use max_array() to get the maximum value from an array Date: Fri, 23 Jun 2023 10:58:25 +0200 Message-Id: <20230623085830.749991-9-herve.codina@bootlin.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230623085830.749991-1-herve.codina@bootlin.com> References: <20230623085830.749991-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,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?1769483380888871617?= X-GMAIL-MSGID: =?utf-8?q?1769483380888871617?= |
Series |
Add support for IIO devices in ASoC
|
|
Commit Message
Herve Codina
June 23, 2023, 8:58 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> 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(-)
Comments
Le 23/06/2023 à 10:58, Herve Codina a écrit : > 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> Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu> > --- > 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 */