From patchwork Sat Sep 17 03:32:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianqun Xu X-Patchwork-Id: 607023 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD0BBC6FA90 for ; Sat, 17 Sep 2022 03:32:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229539AbiIQDcq (ORCPT ); Fri, 16 Sep 2022 23:32:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229587AbiIQDco (ORCPT ); Fri, 16 Sep 2022 23:32:44 -0400 Received: from mail-m11873.qiye.163.com (mail-m11873.qiye.163.com [115.236.118.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 191F280341 for ; Fri, 16 Sep 2022 20:32:42 -0700 (PDT) Received: from localhost.localdomain (unknown [58.22.7.114]) by mail-m11873.qiye.163.com (Hmail) with ESMTPA id 0F49290047B; Sat, 17 Sep 2022 11:32:41 +0800 (CST) From: Jianqun Xu 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 Subject: [PATCH v2 2/2] pinctrl: rockchip: get match data by device_get_match_data Date: Sat, 17 Sep 2022 11:32:39 +0800 Message-Id: <20220917033239.626597-3-jay.xu@rock-chips.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220917033239.626597-1-jay.xu@rock-chips.com> References: <20220917033239.626597-1-jay.xu@rock-chips.com> MIME-Version: 1.0 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFJSktLSjdXWS1ZQUlXWQ8JGhUIEh9ZQVkZHkxKVh8aSE5KGUIeSBkZT1UTARMWGhIXJB QOD1lXWRgSC1lBWU5DVUlJVUxVSkpPWVdZFhoPEhUdFFlBWU9LSFVKSktISkxVSktLVUtZBg++ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6OBw6TCo*Gj0iURpICykXKTJJ GhQwCSFVSlVKTU1ISENOTk1KTUlNVTMWGhIXVREaAlUDDjsJFBgQVhgTEgsIVRgUFkVZV1kSC1lB WU5DVUlJVUxVSkpPWVdZCAFZQUlCQ083Bg++ X-HM-Tid: 0a83498168942eafkusn0f49290047b Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org 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 --- v2: - use fwnode instead of of node - add a second patch to this serail drivers/pinctrl/pinctrl-rockchip.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index 5b828798bfa5..11b9634063bb 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;