From: Hugo Villeneuve <hugo@hugovil.com>
To: gregkh@linuxfoundation.org, jirislaby@kernel.org,
robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
conor+dt@kernel.org, hvilleneuve@dimonoff.com
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
devicetree@vger.kernel.org, hugo@hugovil.com
Subject: [PATCH 2/4] serial: sc16is7xx: recognize "nxp,irda-mode-ports" DT property
Date: Wed, 20 Sep 2023 11:20:13 -0400 [thread overview]
Message-ID: <20230920152015.1376838-3-hugo@hugovil.com> (raw)
In-Reply-To: <20230920152015.1376838-1-hugo@hugovil.com>
From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Vendor prefix "nxp," will be added in an upcoming commit to DT binding
property "irda-mode-ports".
Prepare to recognize this new property "nxp,irda-mode-ports" and
retain backward compatibility with old DTBs by falling back to
"irda-mode-ports" when needed.
Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
---
drivers/tty/serial/sc16is7xx.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index db2bb1c0d36c..b0154e901358 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -1415,13 +1415,19 @@ static void sc16is7xx_setup_irda_ports(struct sc16is7xx_port *s)
int count;
u32 irda_port[2];
struct device *dev = s->p[0].port.dev;
+ const char *prop_name = "nxp,irda-mode-ports";
+
+ count = device_property_count_u32(dev, prop_name);
+ if (count < 0) {
+ /* For backward compatibility with old DTBs. */
+ prop_name = "irda-mode-ports";
+ count = device_property_count_u32(dev, prop_name);
+ }
- count = device_property_count_u32(dev, "irda-mode-ports");
if (count < 0 || count > ARRAY_SIZE(irda_port))
return;
- ret = device_property_read_u32_array(dev, "irda-mode-ports",
- irda_port, count);
+ ret = device_property_read_u32_array(dev, prop_name, irda_port, count);
if (ret)
return;
--
2.30.2
next prev parent reply other threads:[~2023-09-20 15:20 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-20 15:20 [PATCH 0/4] serial: sc16is7xx: device tree improvements Hugo Villeneuve
2023-09-20 15:20 ` [PATCH 1/4] serial: sc16is7xx: use device_property APIs when configuring irda mode Hugo Villeneuve
2023-09-20 15:20 ` Hugo Villeneuve [this message]
2023-09-20 15:20 ` [PATCH 3/4] dt-bindings: sc16is7xx: add vendor prefix to irda-mode-ports property Hugo Villeneuve
2023-09-21 10:29 ` m.brock
2023-09-21 13:37 ` Hugo Villeneuve
2023-09-21 13:47 ` Conor Dooley
2023-09-21 16:24 ` Rob Herring
2023-09-21 16:32 ` Hugo Villeneuve
2023-09-22 19:52 ` Rob Herring
2023-09-27 14:28 ` Hugo Villeneuve
2023-09-20 15:20 ` [PATCH 4/4] dt-bindings: sc16is7xx: convert to YAML Hugo Villeneuve
2023-09-20 23:13 ` Rob Herring
2023-09-21 16:22 ` Hugo Villeneuve
2023-09-21 13:45 ` Conor Dooley
2023-09-21 15:30 ` Hugo Villeneuve
2023-09-22 11:35 ` Conor Dooley
2023-09-22 13:08 ` Hugo Villeneuve
2023-09-21 15:33 ` Rob Herring
2023-09-21 16:27 ` Hugo Villeneuve
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=20230920152015.1376838-3-hugo@hugovil.com \
--to=hugo@hugovil.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=hvilleneuve@dimonoff.com \
--cc=jirislaby@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=robh+dt@kernel.org \
/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).