linux-fpga.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Charles Perry <charles.perry@savoirfairelinux.com>
To: mdf@kernel.org
Cc: avandiver@markem-imaje.com, bcody@markem-imaje.com,
	Charles Perry <charles.perry@savoirfairelinux.com>,
	Wu Hao <hao.wu@intel.com>, Xu Yilun <yilun.xu@intel.com>,
	Tom Rix <trix@redhat.com>, Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Michal Simek <michal.simek@amd.com>,
	kishore Manne <nava.kishore.manne@amd.com>,
	linux-fpga@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 3/5] fpga: xilinx-core: rename "prog_b" and "init-b" gpios
Date: Wed,  7 Feb 2024 13:01:26 -0500	[thread overview]
Message-ID: <20240207180142.79625-4-charles.perry@savoirfairelinux.com> (raw)
In-Reply-To: <20240207180142.79625-1-charles.perry@savoirfairelinux.com>

New bindings use "prog" and "init". The legacy name is used as a
fallback.

Signed-off-by: Charles Perry <charles.perry@savoirfairelinux.com>
---
 drivers/fpga/xilinx-core.c | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/drivers/fpga/xilinx-core.c b/drivers/fpga/xilinx-core.c
index 597e8b7a530b7..4d2416e71d59c 100644
--- a/drivers/fpga/xilinx-core.c
+++ b/drivers/fpga/xilinx-core.c
@@ -171,6 +171,28 @@ static int xilinx_core_write_complete(struct fpga_manager *mgr,
 	return -ETIMEDOUT;
 }
 
+/**
+ * xilinx_core_devm_gpiod_get - Obtain a resource-managed GPIO using a
+ *                              legacy consumer name fallback.
+ *
+ * @dev:           Device managing the GPIO
+ * @con_id:        Consumer id
+ * @legacy_con_id: Legacy consumer id
+ * @flags:         optional GPIO initialization flags
+ */
+static inline struct gpio_desc *
+xilinx_core_devm_gpiod_get(struct device *dev, const char *con_id,
+			   const char *legacy_con_id, enum gpiod_flags flags)
+{
+	struct gpio_desc *desc;
+
+	desc = devm_gpiod_get(dev, con_id, flags);
+	if (IS_ERR(desc) && PTR_ERR(desc) == -ENOENT)
+		desc = devm_gpiod_get(dev, legacy_con_id, flags);
+
+	return desc;
+}
+
 static const struct fpga_manager_ops xilinx_core_ops = {
 	.state = xilinx_core_state,
 	.write_init = xilinx_core_write_init,
@@ -186,12 +208,14 @@ int xilinx_core_probe(struct xilinx_fpga_core *core)
 		return -EINVAL;
 
 	/* PROGRAM_B is active low */
-	core->prog_b = devm_gpiod_get(core->dev, "prog_b", GPIOD_OUT_LOW);
+	core->prog_b = xilinx_core_devm_gpiod_get(core->dev, "prog", "prog_b",
+						  GPIOD_OUT_LOW);
 	if (IS_ERR(core->prog_b))
 		return dev_err_probe(core->dev, PTR_ERR(core->prog_b),
 				     "Failed to get PROGRAM_B gpio\n");
 
-	core->init_b = devm_gpiod_get_optional(core->dev, "init-b", GPIOD_IN);
+	core->init_b = xilinx_core_devm_gpiod_get(core->dev, "init", "init-b",
+						  GPIOD_IN);
 	if (IS_ERR(core->init_b))
 		return dev_err_probe(core->dev, PTR_ERR(core->init_b),
 				     "Failed to get INIT_B gpio\n");
-- 
2.43.0


  parent reply	other threads:[~2024-02-07 18:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-07 18:01 [PATCH v3 0/5] fpga: xilinx-selectmap: add new driver Charles Perry
2024-02-07 18:01 ` [PATCH v3 1/5] fpga: xilinx-spi: extract a common driver core Charles Perry
2024-02-07 18:01 ` [PATCH v3 2/5] dt-bindings: fpga: xlnx,fpga-slave-serial: rename gpios Charles Perry
2024-02-11 15:39   ` Krzysztof Kozlowski
2024-02-13 21:40     ` Charles Perry
2024-02-15 13:32   ` Rob Herring
2024-02-15 19:42     ` Charles Perry
2024-02-07 18:01 ` Charles Perry [this message]
2024-02-11 15:40   ` [PATCH v3 3/5] fpga: xilinx-core: rename "prog_b" and "init-b" gpios Krzysztof Kozlowski
2024-02-07 18:01 ` [PATCH v3 4/5] dt-bindings: fpga: xlnx,fpga-selectmap: add DT schema Charles Perry
2024-02-07 21:25   ` Rob Herring
2024-02-07 18:01 ` [PATCH v3 5/5] fpga: xilinx-selectmap: add new driver Charles Perry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240207180142.79625-4-charles.perry@savoirfairelinux.com \
    --to=charles.perry@savoirfairelinux.com \
    --cc=avandiver@markem-imaje.com \
    --cc=bcody@markem-imaje.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hao.wu@intel.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mdf@kernel.org \
    --cc=michal.simek@amd.com \
    --cc=nava.kishore.manne@amd.com \
    --cc=robh+dt@kernel.org \
    --cc=trix@redhat.com \
    --cc=yilun.xu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).