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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham 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 83C04C433FF for ; Wed, 14 Aug 2019 13:38:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 638AD21872 for ; Wed, 14 Aug 2019 13:38:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728311AbfHNNi4 (ORCPT ); Wed, 14 Aug 2019 09:38:56 -0400 Received: from mga06.intel.com ([134.134.136.31]:25387 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727956AbfHNNi4 (ORCPT ); Wed, 14 Aug 2019 09:38:56 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Aug 2019 06:38:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,385,1559545200"; d="scan'208";a="167427132" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.145]) by orsmga007.jf.intel.com with ESMTP; 14 Aug 2019 06:38:52 -0700 Received: from andy by smile with local (Exim 4.92.1) (envelope-from ) id 1hxtUI-0004EE-NS; Wed, 14 Aug 2019 16:38:50 +0300 Date: Wed, 14 Aug 2019 16:38:50 +0300 From: Andy Shevchenko To: Stefan Roese Cc: Linus Walleij , Geert Uytterhoeven , "open list:SERIAL DRIVERS" , "open list:GPIO SUBSYSTEM" , Pavel Machek , Greg Kroah-Hartman Subject: Re: [PATCH 1/2] gpiolib: Add for_each_gpio_suffix() helper Message-ID: <20190814133850.GU30120@smile.fi.intel.com> References: <20190808132543.26274-1-sr@denx.de> <2f78c3f4-08a4-480e-ff70-8526d0a671ba@denx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2f78c3f4-08a4-480e-ff70-8526d0a671ba@denx.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org On Wed, Aug 14, 2019 at 03:17:44PM +0200, Stefan Roese wrote: > On 14.08.19 10:48, Linus Walleij wrote: > > On Mon, Aug 12, 2019 at 1:18 PM Geert Uytterhoeven wrote: > > > On Sat, Aug 10, 2019 at 10:27 AM Linus Walleij wrote: > > > > On Thu, Aug 8, 2019 at 3:25 PM Stefan Roese wrote: > > > > > Add a helper macro to enable the interation over all supported GPIO > > > > > suffixes (currently "gpios" & "gpio"). This will be used by the serial > > > > > mctrl code to check, if a GPIO property exists before requesting it. > > > > > > > > > > Signed-off-by: Stefan Roese > > > > > Suggested-by: Andy Shevchenko > > > > > Cc: Andy Shevchenko > > > > > Cc: Geert Uytterhoeven > > > > > Cc: Pavel Machek > > > > > Cc: Linus Walleij > > > > > Cc: Greg Kroah-Hartman > > > > > > > > I really like this patch, it makes things so much more readable. > > > > > > Do we really need to spread this *-gpio" legacy support all over the kernel? > > > > Not really :/ > > > > Isn't it possible to use something like gpiod_count(dev, "foo") to > > check for any GPIOs instead? > > Good idea. I can rework my patch to use gpiod_count() to check if the > GPIO exists before requesting it. This way, we're not spreading the > legacy "-gpio" support any more. > > But I'm unsure, if I should change the string malloc (kasprintf) to the > fixed length string on the stack as I've done in this patch version. You don't need suffix for gpiod_count(). Will you need that at all? -- With Best Regards, Andy Shevchenko