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=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 C6469C433DB for ; Fri, 26 Feb 2021 06:46:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8606164EE4 for ; Fri, 26 Feb 2021 06:46:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229800AbhBZGqr (ORCPT ); Fri, 26 Feb 2021 01:46:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229618AbhBZGqr (ORCPT ); Fri, 26 Feb 2021 01:46:47 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD6ACC061574 for ; Thu, 25 Feb 2021 22:46:06 -0800 (PST) Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lFWt0-0005Dx-CP; Fri, 26 Feb 2021 07:46:02 +0100 Received: from ore by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1lFWsz-0007ps-9S; Fri, 26 Feb 2021 07:46:01 +0100 Date: Fri, 26 Feb 2021 07:46:01 +0100 From: Oleksij Rempel To: William Breathitt Gray Cc: devicetree@vger.kernel.org, Ahmad Fatoum , linux-iio@vger.kernel.org, Robin van der Gracht , Linus Walleij , linux-kernel@vger.kernel.org, Rob Herring , Pengutronix Kernel Team , David Jander , Jonathan Cameron Subject: Re: [PATCH v5 2/2] counter: add IRQ or GPIO based event counter Message-ID: <20210226064601.io6tznddikhcmvb3@pengutronix.de> References: <20210208135347.18494-3-o.rempel@pengutronix.de> <20210215091737.fx6dwiz7tt56wbkr@pengutronix.de> <20210223100656.efbshsh5bz66uhj5@pengutronix.de> <20210223174516.wjlh7hnrd5qe5s6w@pengutronix.de> <20210224073506.GA24260@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 07:44:43 up 85 days, 20:51, 38 users, load average: 0.10, 0.06, 0.01 User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: devicetree@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Wed, Feb 24, 2021 at 05:20:21PM +0900, William Breathitt Gray wrote: > On Wed, Feb 24, 2021 at 05:11:03PM +0900, William Breathitt Gray wrote: > > On Wed, Feb 24, 2021 at 08:35:06AM +0100, Oleksij Rempel wrote: > > > On Wed, Feb 24, 2021 at 11:34:06AM +0900, William Breathitt Gray wrote: > > > > Alternatively, we can take a more generic approach: ignore the GPIO > > > > names and focus solely on the IRQ lines; because the GPIO lines will > > > > always be tied to respective IRQ lines here, using the IRQ as the basis > > > > of the name should always be valid. The "name" member of the struct > > > > irq_chip can work for this. I haven't tested this, but I think something > > > > like this would work: > > > > > > > > cnt_signals[0].name = irq_get_chip(priv->irq)->name; > > > > > > ok, i'll take a look at it. > > > > If that doesn't work, then use devm_kasprintf() to generate the name > > based on the IRQ line number. The idea here is that the user should be > > able to identify that the Signal component for this Count is the > > respective IRQ. > > > > William Breathitt Gray > > I realized that these irq_chip names are often just the device name > which isn't very useful either. :-( > > In that case, I suppose we really are just left with generating the name > based on the IRQ line number then. This should be fine then: > > cnt_signals[0].name = devm_kasprintf(dev, GFP_KERNEL, "IRQ %d", > priv->irq); > if (!cnt_signals[0].name) > return -ENOMEM; > > I think this would make it clear to the user that this Signal is the > respective IRQ (whether sourced from GPIO or not). ack, with one correction. cnt_signals should be allocated, otherwise this value will be set per driver not per device. Regards, Oleksij -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |