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 X-Spam-Level: X-Spam-Status: No, score=-16.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BB45C07E96 for ; Sun, 11 Jul 2021 13:27:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D8B7D611F2 for ; Sun, 11 Jul 2021 13:27:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D8B7D611F2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dqS/2AXVyUJRNgLyDz5kfPbiHE9MIlDCOi8qVzDWA+4=; b=2R7z+dQ+NbYGKO 4K+0sSz0WY4GjXrhIADBkKDtjIwRQSCIOjQbakZ6n+ZtARmXzJUYKQYTH3jCf1HiRkWIPCs8vb4Ci ylcP+PrQ28SN+QGgbwJO7oqVaKYmr1LKJQIqMrIcmrH6wM63ruviQYe9F88twXN6gmEBW79bEercd BZ0CAVQT5xxWBs/T5agOhy6M2ltiEBH1aFWLXw2oValWsD4Qx6gfxeWXSfRQ4/9Zxh9SyuGbZs5Ep EtnzIWywcT3yS5qxECrt1Jq36xySY+gie7k635iApcg0kj3cjSg4Cjrw7TwMWf+pklVFZzsGzcv25 F11iedVKabsTcQ2V1HPw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2ZT1-0056Oq-Am; Sun, 11 Jul 2021 13:25:55 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2ZSx-0056O4-Ey for linux-arm-kernel@lists.infradead.org; Sun, 11 Jul 2021 13:25:53 +0000 Received: from jic23-huawei (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 43642611C0; Sun, 11 Jul 2021 13:25:45 +0000 (UTC) Date: Sun, 11 Jul 2021 14:28:00 +0100 From: Jonathan Cameron To: David Lechner Cc: William Breathitt Gray , linux-stm32@st-md-mailman.stormreply.com, kernel@pengutronix.de, a.fatoum@pengutronix.de, kamel.bouhara@bootlin.com, gwendal@chromium.org, alexandre.belloni@bootlin.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, syednwaris@gmail.com, patrick.havelange@essensium.com, fabrice.gasnier@st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, o.rempel@pengutronix.de, jarkko.nikula@linux.intel.com, Dan Carpenter Subject: Re: [PATCH v12 14/17] counter: Implement *_component_id sysfs attributes Message-ID: <20210711142800.60e94cc7@jic23-huawei> In-Reply-To: References: <0e04a9e6455faf171e5dd7885676e55b5321b1ea.1625471640.git.vilhelm.gray@gmail.com> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210711_062551_581921_62B33CF6 X-CRM114-Status: GOOD ( 26.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sat, 10 Jul 2021 12:06:53 -0500 David Lechner wrote: > On 7/5/21 3:19 AM, William Breathitt Gray wrote: > > The Generic Counter chrdev interface expects users to supply component > > IDs in order to select extensions for requests. In order for users to > > know what component ID belongs to which extension this information must > > be exposed. The *_component_id attribute provides a way for users to > > discover what component ID belongs to which respective extension. > > > > Cc: David Lechner > > Cc: Gwendal Grignou > > Cc: Dan Carpenter > > Signed-off-by: William Breathitt Gray > > --- > > Documentation/ABI/testing/sysfs-bus-counter | 16 ++++++++++- > > drivers/counter/counter-sysfs.c | 30 ++++++++++++++++----- > > 2 files changed, 39 insertions(+), 7 deletions(-) > > > > diff --git a/Documentation/ABI/testing/sysfs-bus-counter b/Documentation/ABI/testing/sysfs-bus-counter > > index 9809d8a47431..e0e99adb0ecc 100644 > > --- a/Documentation/ABI/testing/sysfs-bus-counter > > +++ b/Documentation/ABI/testing/sysfs-bus-counter > > @@ -203,12 +203,26 @@ Description: > > both edges: > > Any state transition. > > > > +What: /sys/bus/counter/devices/counterX/countY/ceiling_component_id > > +What: /sys/bus/counter/devices/counterX/countY/floor_component_id > > +What: /sys/bus/counter/devices/counterX/countY/count_mode_component_id > > +What: /sys/bus/counter/devices/counterX/countY/direction_component_id > > +What: /sys/bus/counter/devices/counterX/countY/enable_component_id > > +What: /sys/bus/counter/devices/counterX/countY/error_noise_component_id > > +What: /sys/bus/counter/devices/counterX/countY/prescaler_component_id > > +What: /sys/bus/counter/devices/counterX/countY/preset_component_id > > +What: /sys/bus/counter/devices/counterX/countY/preset_enable_component_id > > What: /sys/bus/counter/devices/counterX/countY/signalZ_action_component_id > > +What: /sys/bus/counter/devices/counterX/signalY/cable_fault_component_id > > +What: /sys/bus/counter/devices/counterX/signalY/cable_fault_enable_component_id > > +What: /sys/bus/counter/devices/counterX/signalY/filter_clock_prescaler_component_id > > +What: /sys/bus/counter/devices/counterX/signalY/index_polarity_component_id > > +What: /sys/bus/counter/devices/counterX/signalY/synchronous_mode_component_id > > Could we just write a single line? > > What: /sys/bus/counter/devices/counterX/signalY/_component_id Not nice for grepping so I think it's better to call them out explicitly. There has been a proposal to check this ABI doc against running kernels, and if we have too many wild cards that becomes very difficult to do. Jonathan > > > KernelVersion: 5.15 > > Contact: linux-iio@vger.kernel.org > > Description: > > Read-only attribute that indicates the component ID of the > > - respective Synapse of Count Y for Signal Z. > > + respective extension or Synapse. > > > > What: /sys/bus/counter/devices/counterX/countY/spike_filter_ns > > KernelVersion: 5.14 > > diff --git a/drivers/counter/counter-sysfs.c b/drivers/counter/counter-sysfs.c > > index bb49a10f160b..eb1505bfbd89 100644 > > --- a/drivers/counter/counter-sysfs.c > > +++ b/drivers/counter/counter-sysfs.c > > @@ -587,6 +587,7 @@ static int counter_signal_attrs_create(struct counter_device *const counter, > > int err; > > struct counter_comp comp; > > size_t i; > > + struct counter_comp *ext; > > > > /* Create main Signal attribute */ > > comp = counter_signal_comp; > > @@ -602,8 +603,13 @@ static int counter_signal_attrs_create(struct counter_device *const counter, > > > > /* Create an attribute for each extension */ > > for (i = 0; i < signal->num_ext; i++) { > > - err = counter_attr_create(dev, group, signal->ext + i, scope, > > - signal); > > + ext = signal->ext + i; > > + > > + err = counter_attr_create(dev, group, ext, scope, signal); > > + if (err < 0) > > + return err; > > + > > + err = counter_comp_id_attr_create(dev, group, ext->name, i); > > if (err < 0) > > return err; > > } > > @@ -694,6 +700,7 @@ static int counter_count_attrs_create(struct counter_device *const counter, > > int err; > > struct counter_comp comp; > > size_t i; > > + struct counter_comp *ext; > > > > /* Create main Count attribute */ > > comp = counter_count_comp; > > @@ -718,8 +725,13 @@ static int counter_count_attrs_create(struct counter_device *const counter, > > > > /* Create an attribute for each extension */ > > for (i = 0; i < count->num_ext; i++) { > > - err = counter_attr_create(dev, group, count->ext + i, scope, > > - count); > > + ext = count->ext + i; > > ext = &count->ext[i]; > > Could make it more clear we are dealing with pointers rather than integers. > > > + > > + err = counter_attr_create(dev, group, ext, scope, count); > > + if (err < 0) > > + return err; > > + > > + err = counter_comp_id_attr_create(dev, group, ext->name, i); > > if (err < 0) > > return err; > > } > > @@ -783,6 +795,7 @@ static int counter_sysfs_attr_add(struct counter_device *const counter, > > struct device *const dev = &counter->dev; > > int err; > > size_t i; > > + struct counter_comp *ext; > > > > /* Add Signals sysfs attributes */ > > err = counter_sysfs_signals_add(counter, group); > > @@ -815,8 +828,13 @@ static int counter_sysfs_attr_add(struct counter_device *const counter, > > > > /* Create an attribute for each extension */ > > for (i = 0; i < counter->num_ext; i++) { > > - err = counter_attr_create(dev, group, counter->ext + i, scope, > > - NULL); > > + ext = counter->ext + i; > > ditto > > > + > > + err = counter_attr_create(dev, group, ext, scope, NULL); > > + if (err < 0) > > + return err; > > + > > + err = counter_comp_id_attr_create(dev, group, ext->name, i); > > if (err < 0) > > return err; > > } > > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel