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: 13824616 Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F16EE1D4153 for ; Mon, 7 Oct 2024 12:39:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728304797; cv=none; b=MfLbJmB121Ii3J6T/et6btUIGM4puQ2pc1smtga0bQparwHd+jCyRkDZzGTJFn5LXC0pa0KhJYvcuBskRbnCQoT9KGWXbmyMbMActSYHcP92KPnuRqq107qRzCQWEdt6JhrRDPBDQKskKxxVUpsxmWn39KYaiJHUebE698zhv3g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728304797; c=relaxed/simple; bh=keW+vT550WqqZOgWV5RvIAX0hhvZXHvpuvbMkV4b5MQ=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QK9nj+uKWqrAL+PCydLuGPcONKI24RI8rsn5jM3BdalymoecQY4ENJd11WtKYbLNbDUI1ET6GR8zlgjnt1jCCjhPzwaq28zM1Off45WkWKh1csBiFnik++8g0nN2nxvfcGePo9GV+Lb1cUPXcJVNAkiRzdWXJKF8Sq0GrlI7avo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=YmAYEbNf; arc=none smtp.client-ip=209.85.218.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="YmAYEbNf" Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a9941a48ac8so246687666b.3 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=vger.kernel.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=YmAYEbNfRsa+9ZquXK4zGHRxscymbJd6awqpfXIKu810sjLWv2SabVfJYFOGpGEvJl rNU8t9KyUdHDirnctl9N6k00X02lFRGVGWQkD4X0AJ7C8pKudEIgtLkp47MVh2QmooKG MBqNJ24SCrOSN0OFz0eY+ybE5RgGT22INAIfyl+ISh3M+xhLJqs7cKlDebQLnq8HjY7y 5Zefsro0WqT/OGHildlBvW9RfHajWqbpsUg7vDyhHIIAYB9hgcbbJ7mKx97yrXm+Xjl6 rHKMGN0LyD8fbOxeuZcOF63Ev/oybP4BzG1GoIYL6wmgE1A5LXAp+vM9VDZwJDCtsx/Y Q2wA== 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=pFogBL2UWX2eUFi6ubxonZl50lACKsWvcMUnp3QB054iAsb5XBh29gUoiBYq/eHxFE WjAcBdGdYi7kOyouRBm43QoB5ig14ogG8lzktJGJ0+F6grT4QpmwWUaUPifO8eSTZ4hN BZGJzragJ1RVLY/robnBvPYx6b3wXv9EovN2Lt9+ZleOXOd23yDILEAtBJAuLQjPIWQx Rh5mDeY+zg+uj4w6ulH12BZqKXZ6uqaPC1ANWyumk8LTiwHGlqXD/SqFH1Mj7MssH3JA doit3oFdDqpwRUH9us2D/O1zuzMdZr98xqqGctfpmCJCDvS6FQP9bYtGK+xRoLhkU3dG s80A== X-Forwarded-Encrypted: i=1; AJvYcCWnIGZR7tivFUrhntKBp/AX91HeuA03XPQCfnyLEN6JHevQmCI3eokuv8hXdMGaABy6YriiOECJr2A=@vger.kernel.org X-Gm-Message-State: AOJu0YzjoX1ip7thjVpMtWzubBnrUXLtGRhoY+dCNhju+Mz453ke/CBQ KsauAKNa58IO0VQsWYvLL61wldE29S1RoBlxaTeDPAB1GTiCBiTXnI2HofJkBQU= 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: Precedence: bulk X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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);