From patchwork Mon Oct 9 17:29:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 150236 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp2022570vqo; Mon, 9 Oct 2023 10:33:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHt+vBz2FM+pzw23IJ92D5pVjd6v1GLUnzDrJkpKpb3qKNYwEOZL0peRnXuh3XjsT4lTpnz X-Received: by 2002:a17:90a:8804:b0:274:111c:c14d with SMTP id s4-20020a17090a880400b00274111cc14dmr12741389pjn.13.1696872810693; Mon, 09 Oct 2023 10:33:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696872810; cv=none; d=google.com; s=arc-20160816; b=pSzG5JUjnW9Y+a8GL9ugT5+mI+DD8+OM8JxSsn6Sgc9AhBkdm/zr25nMfPNv0HtwT1 Q6NNTWRUNr1ruFgkaCsoGmuM1ZtU4OTgTv93Zr/7p5UexVPiADmTj1YvJD4MIGa2igXV EC4oy+nV2kkT1Az/VZImgNoVOKV32fE+Gc4SyPpmLOeabbWMDxBCnXTIr/MVTjdnZU8x 3+ccn2UCkM3DrosSVtTl2yXKVe0YSwOdiBcuGfxssMaZfzalOEZJO72uJw5ICVQCVBls QyQ6VaTJkbji55NewnEytVG0elXuG8LGqieJDbJAGMnjALEu9IOwm8n8A74Yr/bv1pKI WINw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=8TYBhGhrqXrQWT5OXzN1ymtVb6+fP7fQH8cwnmy7nMU=; fh=VXY2Xp/ALXAe/jIoTe2a1mM/XvNmMytw2TPHTg+Jh58=; b=Ifh9hufsXiKP97fnFWmOSHikmozjhZMvfhF6Jbx6+O6Qw3+9hcYiT5GAN4rTtMJyt+ IWvlbOloeLlbcFltmurBDloKPlb5sQKO+egsEsIAYrEHxd3DNA5OJKUK2/EiMgaY5NZt Dy3N8PHhmHkZJJDbbVVXsUgfVpbWg6pOmydWuQq9DKH7j0MEeABDozv4UbRDID+4OX0I VJPiRyBLDNpQK6LBut99tLB9aZmNgZEY69umhathQtmYe22QnPiXcUhoCsVgoEM/EYXM 83AgCESYM3/rRH3E3JX7I3QuJwWg/7JrVxnXdId6eDIXkSRsqxw4OYrI6MIlmdqvU1yh 6dhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qVg2iUt6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id c13-20020a17090a8d0d00b002773af24826si7497633pjo.123.2023.10.09.10.33.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 10:33:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qVg2iUt6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id E6B83801C18F; Mon, 9 Oct 2023 10:33:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378110AbjJIRdT (ORCPT + 18 others); Mon, 9 Oct 2023 13:33:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378136AbjJIRdB (ORCPT ); Mon, 9 Oct 2023 13:33:01 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5797AF; Mon, 9 Oct 2023 10:32:56 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8964C433C7; Mon, 9 Oct 2023 17:32:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696872776; bh=bD811IgL0XahLtC2Pif9I+JwkjBeOZFPqh5qFzCRf2c=; h=From:To:Cc:Subject:Date:From; b=qVg2iUt6vREdwmAre4ElvI0A0VeTwh07kCIrc+4DaZQONQosglU55G6RQrMNPBggN GPdlmJu+aO00tJ3ZkQ3XTlvpf+WubIkbBVjzYRa/ZvN4/JdM5sFu6jl5syjrpPLAVG 2NhfCMWFBij149icxxGt8QCoYiahbif3R1M0c7hhBygnGEFneb1sJe/SbZ7CcX53qZ U7V7ExfjKeqMAOQN5zs7h1Pr9JnpRapgLbxgzsPVMAG+2vVzd58eOgM9mZ5yhbk9Pz lhlmqiqU7Ot1ANmlZvyFElRSFiaFgy7XRSR1WfjxM+WqrtbBSkDQt8BjfnnF8hMlhH 2PT5nAr+i/GQA== Received: (nullmailer pid 2534592 invoked by uid 1000); Mon, 09 Oct 2023 17:32:54 -0000 From: Rob Herring To: Thierry Reding , =?utf-8?q?Uwe_Kleine-K=C3=B6n?= =?utf-8?q?ig?= , Heiko Stuebner Cc: linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: [PATCH] pwm: Use device_get_match_data() Date: Mon, 9 Oct 2023 12:29:16 -0500 Message-ID: <20231009172923.2457844-21-robh@kernel.org> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 09 Oct 2023 10:33:30 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779300104404148521 X-GMAIL-MSGID: 1779300104404148521 Use preferred device_get_match_data() instead of of_match_device() to get the driver match data. With this, adjust the includes to explicitly include the correct headers. Signed-off-by: Rob Herring --- drivers/pwm/pwm-img.c | 8 ++------ drivers/pwm/pwm-rockchip.c | 9 ++------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/pwm/pwm-img.c b/drivers/pwm/pwm-img.c index 326af85888e7..e32b5e8c203d 100644 --- a/drivers/pwm/pwm-img.c +++ b/drivers/pwm/pwm-img.c @@ -13,9 +13,9 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -261,7 +261,6 @@ static int img_pwm_probe(struct platform_device *pdev) u64 val; unsigned long clk_rate; struct img_pwm_chip *imgchip; - const struct of_device_id *of_dev_id; imgchip = devm_kzalloc(&pdev->dev, sizeof(*imgchip), GFP_KERNEL); if (!imgchip) @@ -273,10 +272,7 @@ static int img_pwm_probe(struct platform_device *pdev) if (IS_ERR(imgchip->base)) return PTR_ERR(imgchip->base); - of_dev_id = of_match_device(img_pwm_of_match, &pdev->dev); - if (!of_dev_id) - return -ENODEV; - imgchip->data = of_dev_id->data; + imgchip->data = device_get_match_data(&pdev->dev); imgchip->periph_regs = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "img,cr-periph"); diff --git a/drivers/pwm/pwm-rockchip.c b/drivers/pwm/pwm-rockchip.c index 03ee18fb82d5..339165ef1f07 100644 --- a/drivers/pwm/pwm-rockchip.c +++ b/drivers/pwm/pwm-rockchip.c @@ -10,8 +10,8 @@ #include #include #include -#include #include +#include #include #include @@ -297,16 +297,11 @@ MODULE_DEVICE_TABLE(of, rockchip_pwm_dt_ids); static int rockchip_pwm_probe(struct platform_device *pdev) { - const struct of_device_id *id; struct rockchip_pwm_chip *pc; u32 enable_conf, ctrl; bool enabled; int ret, count; - id = of_match_device(rockchip_pwm_dt_ids, &pdev->dev); - if (!id) - return -EINVAL; - pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL); if (!pc) return -ENOMEM; @@ -345,7 +340,7 @@ static int rockchip_pwm_probe(struct platform_device *pdev) platform_set_drvdata(pdev, pc); - pc->data = id->data; + pc->data = device_get_match_data(&pdev->dev); pc->chip.dev = &pdev->dev; pc->chip.ops = &rockchip_pwm_ops; pc->chip.npwm = 1;