Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp990618pxb; Thu, 25 Feb 2021 22:48:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwseoiXLLo9ZUvtJghT+/yj3JjYCoivNq/mzCs+TeqSFcbxNnaORjNnTThe2ezUzFsubh5I X-Received: by 2002:a17:906:cf90:: with SMTP id um16mr1664603ejb.389.1614322099297; Thu, 25 Feb 2021 22:48:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614322099; cv=none; d=google.com; s=arc-20160816; b=WRSZTnYrxSsK0ONAxtvVJhGCP3lOhAY31RiBZKFelnAQvz1+cZP9Bw5EQzhJsP4I4R d0igavQ1P6VAHBs9ciWjaMi6prwwRh8i0qogvy8iz+9CHN2tGZb2panGma+Dd4TpMxrc Ip93T5IUpxo8hX77yhlVs9GtbuDvuyYguppY5/D6mbza26uRS6F+wI5RQF7SKyf+i/Ly UZhK5LpUa72DsQSpf5c4F6t90MRP/9eKj92deXoUH29c3UwgQGC8vCVhBTjPoIotN+X7 wjMWEeoN8gCbdrLjgWdVRyIAA4URahN+VYSVaA/kM8baGsj1WTPyOqVcXUc7NVrJOMij yjMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=epwYePq/OpwdEIHb3Nz3Xe4iux96sadqHefxXwN/WqQ=; b=LcNdc8arBWY+ICYkCGj/hMYFf+rjhmyJkUyQL+Sf5EmdfwGDO683vvCoPt4ascNazb 6+Ov/ZP9vfpnIhzT9rxIQr1fR6vo4PkyTu3gvMbQPFDInsckI0uXfFi7O7Hmzw/N5iAe kVDTaDJRApsZxlOcBEzjqy04mQk7usJeTCa3pjYAnNxaHWAG9UID2Nxl3/H0UYuE/EnJ Vc2ie2WfBcfZl00xRqs00q0KIRkUiEtVBxoHziQFKLN0IN5AnF6aTrCxfDTLnJNgcIoO 6sp7FKOdlBb1wsY0t0O/OmVdDCsdEvmjcY4wzdh6WexytyNDSZk71s9r8gMozEj9B24d qlZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c15si4572206edr.312.2021.02.25.22.47.57; Thu, 25 Feb 2021 22:48:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229849AbhBZGqt (ORCPT + 99 others); Fri, 26 Feb 2021 01:46:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229618AbhBZGqs (ORCPT ); Fri, 26 Feb 2021 01:46:48 -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 5F59EC061756 for ; Thu, 25 Feb 2021 22:46:08 -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: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 |