From patchwork Mon Oct 7 12:39:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea della Porta X-Patchwork-Id: 13824670 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 D5C19CFB43F for ; Mon, 7 Oct 2024 13:20:11 +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: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=E3hAOrRw5xQdhMiyBTBpAF1zCHGDS1up/fzBs4ITHy4=; b=3Pk72xeO2OstN3fFhR7uXdZ1F/ lgHcXDu3nCbp+iT7pj/zKVRtav1/3DcQwRZqTKQMqUfovCtxjfTNrCdeMjx5EUpRnTSfGf+fbhejB MZCvWdxbxxKdqk6bPCGFQBKr1BWpjQHroDzD1rtm19nkVbkW4vsldf/GUuvOWw3dxOQ1umckaOdFg JUodOoFVAC3YTxiqNePKh2KtKEBkH3CWpotk9V2bZZh30llc33PfdzH4iISPOny5FvwJBTcNcTqtk Jz4OXHQM+kq3Wq5hZctkxGgjRxYh7qfjYGjaToUN3XCb69EOCdM+7+O8FgWpIPgbPbqOZsJ4K2sXV DlmIiMAA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sxneZ-00000002U53-3sYW; Mon, 07 Oct 2024 13:20:00 +0000 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sxn1n-00000002MaW-1qs3 for linux-arm-kernel@lists.infradead.org; Mon, 07 Oct 2024 12:39:56 +0000 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a994cd82a3bso189592966b.2 for ; Mon, 07 Oct 2024 05:39:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1728304793; x=1728909593; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=E3hAOrRw5xQdhMiyBTBpAF1zCHGDS1up/fzBs4ITHy4=; b=D820egjJV5DL6R1Y61mqmC1ZM7XW7/VpfjU7ScRE0Y8/uOK/68DsfkIaRU6Qwx1zYI OsRyBcDvHYTUBME5hmeZ8rnnxXPWTkHdddS/xZzTcG1Z4rx4NzNNTKOdOJp2C03gjKyO Iv+9mFL/35Z7hSYzH998/k4us9qEz8bolDE8eLb41OAfjx9PwO/qjYr03GvEMssNTu9R 4khul5PMas7f+SO5FutXH2tkPVd8s99WEmina1zMMQGPChJRrYlvIeyun35x1aijqFZf M9/QA4MhJEYedOvSDz4Rs8BCwJvhkFf7mE8tHo2qqjmtQnPY23nc5llMQ5flIOX1SwD2 gglg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728304793; x=1728909593; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=E3hAOrRw5xQdhMiyBTBpAF1zCHGDS1up/fzBs4ITHy4=; b=adkd1iA/trEx0nR5ViVP30KhgK6+E2aBFwv03vW0Z2b/k18bTP75uF8icc+tnPt6lk qvOyKIvMpKhSEh45OExK469ADRBZ7GOvXku7D/dS7WYxkosV4Z7s9n3Sks0QlxreL7P+ pbvz3uC4fR6by+5EX38BhSi/lHJ2zQtvx2eSk2YZs9AqenRcE4xBBE1tt60xwIihf05G vE2qI5OqSNHmtr5+qpDW8d02Vlg+XgQiBNb7M3I0S+maxi3lGn9k4HlwBGj2x3ne/l96 P+FsfaWTEKDAaSrwOP0QZeL9gRb6hCEfwI758Ew3ZbFJLUhF0LvPODR4li5mrknOZoYj IyiA== X-Forwarded-Encrypted: i=1; AJvYcCXr7ghXQ5oBTtNN0Jl+OTi29PmOUJoSyxtrGOfWvVGpitJYPbSoiMBPBGfDxZoZKCLEYXbX++9B/AGcFsXj4vuG@lists.infradead.org X-Gm-Message-State: AOJu0YzydNCtkow8kZoAxypTM9dlLD20h0AAywEppuUmuCifp2u9+C9q RZt6YP/zgEhIcOuCW3FL/y+UroicqK+Bpuxy1nESYp25am3y82q9wgyTGBDvTKY= X-Google-Smtp-Source: AGHT+IFAuS51Efpu99SVNutmZJk8el6z6Su02r4hqkQ+BkrfYww1vueUey7cM49AcZEtj5NuSSmKaA== X-Received: by 2002:a17:907:972a:b0:a8d:555f:eeda with SMTP id a640c23a62f3a-a991bce5aecmr1345288866b.8.1728304793310; Mon, 07 Oct 2024 05:39:53 -0700 (PDT) Received: from localhost (host-87-21-212-62.retail.telecomitalia.it. [87.21.212.62]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a994e6e571asm189794266b.85.2024.10.07.05.39.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 05:39:53 -0700 (PDT) From: Andrea della Porta To: Andrea della Porta , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Manivannan Sadhasivam , Bjorn Helgaas , Linus Walleij , Catalin Marinas , Will Deacon , Bartosz Golaszewski , Derek Kiernan , Dragan Cvetic , Arnd Bergmann , Greg Kroah-Hartman , Saravana Kannan , linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-gpio@vger.kernel.org, Masahiro Yamada , Stefan Wahren , Herve Codina , Luca Ceresoli , Thomas Petazzoni , Andrew Lunn Subject: [PATCH v2 07/14] gpiolib: Export symbol gpiochip_set_names() Date: Mon, 7 Oct 2024 14:39:50 +0200 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241007_053955_506392_2226A9F8 X-CRM114-Status: GOOD ( 17.11 ) 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 Being able to assign gpio line names dynamically is a feature that could be used by drivers that do not have the exact naming (e.g. through the DTB/DTBO) at probing time. An example of this is the RP1 driver that populates the DT at late time through a DT overlay. In this case a custom overlay can be loaded from userspace with the gpio line names. Export gpiochip_set_names() to allow refreshing the gpio line names from the driver module. Signed-off-by: Andrea della Porta --- drivers/gpio/gpiolib.c | 3 ++- include/linux/gpio/driver.h | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index c6afbf434366..a2aa3560094a 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -522,7 +522,7 @@ static void gpiochip_set_desc_names(struct gpio_chip *gc) * names belong to the underlying firmware node and should not be released * by the caller. */ -static int gpiochip_set_names(struct gpio_chip *chip) +int gpiochip_set_names(struct gpio_chip *chip) { struct gpio_device *gdev = chip->gpiodev; struct device *dev = &gdev->dev; @@ -589,6 +589,7 @@ static int gpiochip_set_names(struct gpio_chip *chip) return 0; } +EXPORT_SYMBOL(gpiochip_set_names); static unsigned long *gpiochip_allocate_mask(struct gpio_chip *gc) { diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h index 2dd7cb9cc270..6e4cd7b7e47e 100644 --- a/include/linux/gpio/driver.h +++ b/include/linux/gpio/driver.h @@ -679,6 +679,9 @@ bool gpiochip_line_is_open_source(struct gpio_chip *gc, unsigned int offset); bool gpiochip_line_is_persistent(struct gpio_chip *gc, unsigned int offset); bool gpiochip_line_is_valid(const struct gpio_chip *gc, unsigned int offset); +/* Assign gpio line names from device property */ +int gpiochip_set_names(struct gpio_chip *chip); + /* get driver data */ void *gpiochip_get_data(struct gpio_chip *gc);