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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C8829EE0211 for ; Wed, 11 Sep 2024 07:42:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0LtJuWg5rZzkpKKkENXUM608sDYwm9QANqJ5OTuJVDE=; b=AV5eJ87r3di2UvyNiL7+pf/jqD InhVpE/3dIQzFZMuWeDUnjYmshNK59swbwl7HnAuhYs/a+Uy2wENp6r47txso4BYJzvxHlQCqxNqY 1Lufll8jt9BI51PGZfbhm0CBigxs0D97AUF4DeU/PNEE67neTovG7MfXt56j3nFji1rvNxWnBm2aW 9GPRUVasFnflisrzevlbJs+0AtGexVXLq3RcpMXbG6D+WQ1kKG3lEbp+JXItzP0qqEoj4xgvdivwu RjsQCTO/p75A1BH9rtIdSheuHO/JKLmpvJKUe5LIikANBPgb3LhtRlsXt6+k7U9KTDMKygbR4BNpe wVkGmmrg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1soHzq-00000008Uiz-11C1; Wed, 11 Sep 2024 07:42:38 +0000 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1soHvA-00000008TG1-0x7O for linux-arm-kernel@lists.infradead.org; Wed, 11 Sep 2024 07:37:49 +0000 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-536748c7e9aso613369e87.0 for ; Wed, 11 Sep 2024 00:37:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1726040266; x=1726645066; darn=lists.infradead.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=0LtJuWg5rZzkpKKkENXUM608sDYwm9QANqJ5OTuJVDE=; b=TXEcL1rjsRis5CsJ0MUZV1+DSSqm821QtIgcOWFNET3RfO79YObAM9PzhnL7vBplrZ LQW7+qaBSSDDlr0KBJ/ZOE6IxsDcFI2eEclWYMkBpIDbHt11tJk4zcBwdvZzD5z4MOAb Wleff3/+gQvvQoYWoXcU2b1SvWy5L7OYWRMuY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726040266; x=1726645066; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0LtJuWg5rZzkpKKkENXUM608sDYwm9QANqJ5OTuJVDE=; b=bWTI8wGVspTPwBwxeZfMpMcY1zQkt0NosJAoyBrnbU+vyR6T97bzDa78K9XEzVZkjb WGiNcHGqbX1hpFPMIN1qSx8Fwgwa1iHTHtVW91Ib6aJdeToY1/VsEPbHVwbQN1kHtH8c bfOIyKwlOcUneecwZgUoXXCYgVZ0SOYqDVNtPbdhm/4NNd2p0BMyXGwwcIMrgNv62VnT jq/pjUFuLUeTg34UxaoHa+Jaq3FY4dxXZoqVDwsIQ4G44I+9r62qi4madmn0fgFpPomA DNaRmZnFdIex6AqJf2RF7ftOUZsPH3z0zJ7Fjm2RsNCPFOovnrYSOV5I2SWBQNLdYLQV EIjw== X-Forwarded-Encrypted: i=1; AJvYcCXTiDNQ+1WRBVzkXVXCge8pdG2trZFle+fjhrgqTp6Xvs4K33zWFL0JOWLmXzTFLCXnm8tNe4PWpP58fMzAlD+n@lists.infradead.org X-Gm-Message-State: AOJu0YwFRlRhpUeGHNs9ThyOYFNSW5PEzE2Hn4OKUHSbla6x7up2ccfX MZZES8gjGyBBlL6h1m0ieBCTlMFZnqMnONyQwmYQcgz4x4jkSff2JKInlzy3QJDSP3/CP3Z0koy Rf5G1vSN0gdFyWR+dOlsIOLvwr5gq1YB9OFj7 X-Google-Smtp-Source: AGHT+IEd4894jUMhTj+lpuZUCwhAQoDemTfiQND7C5Rfboo0QkW+QbXwdarpgS+S2rznD6UFho/GB5hhLLZk1Dxbtzw= X-Received: by 2002:a05:6512:b23:b0:52e:74d5:89ae with SMTP id 2adb3069b0e04-53673c95c1fmr1178265e87.39.1726040266114; Wed, 11 Sep 2024 00:37:46 -0700 (PDT) MIME-Version: 1.0 References: <20240904090016.2841572-1-wenst@chromium.org> <20240904090016.2841572-7-wenst@chromium.org> In-Reply-To: From: Chen-Yu Tsai Date: Wed, 11 Sep 2024 15:37:35 +0800 Message-ID: Subject: Re: [PATCH v6 06/12] gpiolib: Add gpio_get_property_name_length() To: Andy Shevchenko Cc: Rob Herring , Saravana Kannan , Matthias Brugger , AngeloGioacchino Del Regno , Wolfram Sang , Benson Leung , Tzung-Bi Shih , Mark Brown , Liam Girdwood , chrome-platform@lists.linux.dev, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Douglas Anderson , Johan Hovold , Jiri Kosina , linux-i2c@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240911_003748_294047_48A94F80 X-CRM114-Status: GOOD ( 31.37 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Sep 9, 2024 at 10:45=E2=80=AFAM Chen-Yu Tsai w= rote: > > On Wed, Sep 4, 2024 at 9:40=E2=80=AFPM Andy Shevchenko > wrote: > > > > On Wed, Sep 04, 2024 at 05:00:08PM +0800, Chen-Yu Tsai wrote: > > > The I2C device tree component prober needs to get and toggle GPIO lin= es > > > for the components it intends to probe. These components may not use = the > > > same name for their GPIO lines, so the prober must go through the dev= ice > > > tree, check each property to see it is a GPIO property, and get the G= PIO > > > line. > > > > > > Instead of duplicating the GPIO suffixes, or exporting them to the > > > prober to do pattern matching, simply add and export a new function t= hat > > > does the pattern matching and returns the length of the GPIO name. Th= e > > > caller can then use that to copy out the name if it needs to. > > > > > Andy suggested a much shorter implementation. > > > > No need to have this sentence in the commit message, changelog area is = fine. > > But if you wish... :-) > > It does seem out of place without any context. I'll move it to the > changelog area. :D > > > > Suggested-by: Andy Shevchenko > > > Signed-off-by: Chen-Yu Tsai > > > > ... > > > > > +/** > > > + * gpio_get_property_name_length - Returns the GPIO name length from= a property name > > > + * @propname: name of the property to check > > > + * > > > + * This function checks if the given property name matches the GPIO = property > > > + * patterns, and returns the length of the name of the GPIO. The pat= tern is > > > + * "*-" or just "". > > > + * > > > + * Returns: > > > + * The length of the string before '-' if it matches > > > + * "*-", or 0 if no name part, just the suffix, or > > > + * -EINVAL if the string doesn't match the pattern. > > > > Should be %-EINVAL as we agreed with Bart when I updated GPIOLIB kernel= -doc. > > Ack. > > In the regulator cleanups I did, I used -%EINVAL instead. But then I > realized that constants aren't really cross-referenced. I probably > have to go through all of them to fix those up. FTR this patch ended up getting dropped from the series as it was no longer needed. However if folks think there is still value in this patch, I can still send a new version. ChenYu