From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95EEEEB64DA for ; Sun, 2 Jul 2023 09:16:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229753AbjGBJQ1 (ORCPT ); Sun, 2 Jul 2023 05:16:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229460AbjGBJQZ (ORCPT ); Sun, 2 Jul 2023 05:16:25 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA4D51AC; Sun, 2 Jul 2023 02:16:24 -0700 (PDT) Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Qv3Hn5sfCz6D8fQ; Sun, 2 Jul 2023 17:13:09 +0800 (CST) Received: from localhost (10.48.51.211) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Sun, 2 Jul 2023 10:16:19 +0100 Date: Sun, 2 Jul 2023 17:16:14 +0800 From: Jonathan Cameron To: George Stark CC: , , , , , , , , , , , , Subject: Re: [PATCH v3 4/5] meson saradc: add channel labels Message-ID: <20230702171614.00000480@Huawei.com> In-Reply-To: <20230627224017.1724097-5-gnstark@sberdevices.ru> References: <20230627224017.1724097-1-gnstark@sberdevices.ru> <20230627224017.1724097-5-gnstark@sberdevices.ru> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.48.51.211] X-ClientProxiedBy: lhrpeml500004.china.huawei.com (7.191.163.9) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 28 Jun 2023 01:37:17 +0300 George Stark wrote: > Add attribute 'label' to all iio channels. Why? Reasoning is more useful here than a simple statement of 'what'. > > Signed-off-by: George Stark > --- > drivers/iio/adc/meson_saradc.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c > index b87f05dfb322..85970fe852af 100644 > --- a/drivers/iio/adc/meson_saradc.c > +++ b/drivers/iio/adc/meson_saradc.c > @@ -1058,8 +1058,20 @@ static int meson_sar_adc_calib(struct iio_dev *indio_dev) > return ret; > } > > +static int read_label(struct iio_dev *indio_dev, > + struct iio_chan_spec const *chan, > + char *label) > +{ > + if (chan->type == IIO_TEMP) > + return sprintf(label, "%s\n", "temp-sensor"); > + if (chan->type == IIO_VOLTAGE) > + return sprintf(label, "channel-%d\n", chan->channel); > + return 0; > +} > + > static const struct iio_info meson_sar_adc_iio_info = { > .read_raw = meson_sar_adc_iio_info_read_raw, > + .read_label = read_label, > }; > > static const struct meson_sar_adc_param meson_sar_adc_meson8_param = {