From: Jianqun Xu <jay.xu@rock-chips.com>
To: jbx6244@gmail.com, heiko@sntech.de, linus.walleij@linaro.org,
andriy.shevchenko@linux.intel.com
Cc: brgl@bgdev.pl, linux-gpio@vger.kernel.org,
linux-rockchip@lists.infradead.org,
Jianqun Xu <jay.xu@rock-chips.com>
Subject: [PATCH v2 2/2] pinctrl: rockchip: get match data by device_get_match_data
Date: Sat, 17 Sep 2022 14:09:29 +0800 [thread overview]
Message-ID: <20220917060929.657778-3-jay.xu@rock-chips.com> (raw)
In-Reply-To: <20220917060929.657778-1-jay.xu@rock-chips.com>
This patch fixes to use device_get_match_data to get match data, instead
of of_match_node to adapt for the acpi.
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
---
v2 RESEND:
- use fwnode instead of of node
- add a second patch to this serail
drivers/pinctrl/pinctrl-rockchip.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 5b828798bfa5..0ecb84d8dd2a 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -3033,11 +3033,15 @@ static int rockchip_pinctrl_parse_dt(struct platform_device *pdev,
struct rockchip_pinctrl *info)
{
struct device *dev = &pdev->dev;
- struct device_node *np = dev->of_node;
- struct device_node *child;
+ struct fwnode_handle *fwnode = dev_fwnode(dev);
+ struct device_node *np, *child;
int ret;
int i;
+ if (!is_of_node(fwnode))
+ return 0;
+
+ np = to_of_node(fwnode);
rockchip_pinctrl_child_count(info, np);
dev_dbg(dev, "nfunctions = %d\n", info->nfunctions);
@@ -3129,15 +3133,11 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data(
struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
- struct device_node *node = dev->of_node;
- const struct of_device_id *match;
struct rockchip_pin_ctrl *ctrl;
struct rockchip_pin_bank *bank;
int grf_offs, pmu_offs, drv_grf_offs, drv_pmu_offs, i, j;
- match = of_match_node(rockchip_pinctrl_dt_match, node);
- ctrl = (struct rockchip_pin_ctrl *)match->data;
-
+ ctrl = (struct rockchip_pin_ctrl *)device_get_match_data(&pdev->dev);
grf_offs = ctrl->grf_mux_offset;
pmu_offs = ctrl->pmu_mux_offset;
drv_pmu_offs = ctrl->pmu_drv_offset;
@@ -3308,7 +3308,7 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)
int ret, i;
if (is_of_node(fwnode)) {
- ret = of_platform_populate(np, NULL, NULL, NULL);
+ ret = of_platform_populate(to_of_node(fwnode), NULL, NULL, NULL);
if (ret)
return dev_err_probe(dev, ret, "failed to register gpio device\n");
}
--
2.25.1
next prev parent reply other threads:[~2022-09-17 6:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-17 6:09 [PATCH v2 RESEND 0/2] rockchip pinctrl for acpi Jianqun Xu
2022-09-17 6:09 ` [PATCH v2 1/2] pinctrl: rockchip: find gpiochip by name from gpio module Jianqun Xu
2022-09-17 6:09 ` Jianqun Xu [this message]
2022-09-20 9:26 ` [PATCH v2 RESEND 0/2] rockchip pinctrl for acpi Linus Walleij
2022-09-23 10:26 ` Heiko Stuebner
2022-09-23 10:33 ` Andy Shevchenko
[not found] ` <202209231835365953827@rock-chips.com>
2022-09-23 10:50 ` Heiko Stuebner
-- strict thread matches above, loose matches on Subject: below --
2022-09-17 3:32 [PATCH v2 " Jianqun Xu
2022-09-17 3:32 ` [PATCH v2 2/2] pinctrl: rockchip: get match data by device_get_match_data Jianqun Xu
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=20220917060929.657778-3-jay.xu@rock-chips.com \
--to=jay.xu@rock-chips.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=brgl@bgdev.pl \
--cc=heiko@sntech.de \
--cc=jbx6244@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.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