From patchwork Tue Nov 6 18:36:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 10671299 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D0BC514BD for ; Tue, 6 Nov 2018 18:37:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C16712AAFD for ; Tue, 6 Nov 2018 18:37:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B48A22ABBF; Tue, 6 Nov 2018 18:37:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3FFFD2AAFD for ; Tue, 6 Nov 2018 18:37:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JSiemMl82uZ2h8UZjiJznjend1rqDY8LbhydyH6z4pY=; b=BNfPnrsF+TU6R1 W7IG57nPZxglttEr37WiiQcmMjiAUWtOXHl57n3q6D5LJUeRWmc2BibSSoflIn8a8QOn2eJD99kxl OTwuNTjwE3p1s6P1AjX1tQwebvXWJBSmbCJk0Jj/kFE6YQI5syMA0nkNJ5QWXyQrdVWe0PxxXc5Dz mLggwlePvFpR1Co6hMHShcXG+OpjX7Nm3hl6ztoxI8wMxQQDUAo7cpoUCjVDJtiUEeiKRWeHLK9FB PyIfnb90oaz6W8d42j+lgjC+LF/tJsExnP3MdlFa2FS+8HyWCcr2HxCdKfsGG45smXA/H9iZ6G/CD 0dziRKIdUqVAsTeiIdCA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gK6EU-0003pA-6s; Tue, 06 Nov 2018 18:37:46 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gK6DF-0002K8-Hg; Tue, 06 Nov 2018 18:36:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Txdcxs2tamV0DgjPLygklmNYppduaui8BbWfW20QS1w=; b=rQVLi6kScmJ9HVJhqywgYHLqoV 3jYm6DZjrg/cQ0GXSmPrvG/iCSNybBCWNdPbv8fFdyrlZg+itxKtfPqUFjdmX2TwnEY538ebuBV8Z pro1sasd6nhuDeIOH1tIZO3PqKMzx5Da3M+86SsxoXYIcRxWMvovmB0A4N/8/o90intFRK36vB8gs J/6hpczex3s+y37zajWmZ8OBjWQ7Ne9kYXVU2Y5yOrvTNPwAvMJfjB/Uk3Z3lRVLR7ioDvotrNhZa 88C05+nvriy5anSPBcYCp+YGqe0tHypBcQRp9myMBuRzcOMPSUhWIA8PxMORhQDcmKKKFuCo4cDzr Cv4/7q/A==; Received: from mail.kernel.org ([198.145.29.99]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gK6D9-0000HN-Vq; Tue, 06 Nov 2018 18:36:28 +0000 Received: from mail.kernel.org (unknown [104.132.0.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5C01F2086B; Tue, 6 Nov 2018 18:36:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541529371; bh=q3B12p+wVr/PsBAJxYQnI8sf+UI5V26gVqVsArmjRTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ixo8w9LWtrH5jSV0/9VkrnAYHTeBdpF/PEArvV13tue8eN1ZRlJ1scP2OhpxeGK8n 2KFPXQFssrRUNt+Q1VZJh2mZrZFoZOQOdJDu7ucSI7YPLfuMzVXBSCWQ5at9f37xiQ gXhxLHeUjpkpMHNhHi43M8Dbrx47oY6zCHE8hGOU= From: Stephen Boyd To: Michael Turquette , Stephen Boyd Subject: [PATCH 2/4] clk: mediatek: Convert to platform_driver_probe_by_match_data() Date: Tue, 6 Nov 2018 10:36:07 -0800 Message-Id: <20181106183609.207702-3-sboyd@kernel.org> X-Mailer: git-send-email 2.19.1.930.g4563a0d9d0-goog In-Reply-To: <20181106183609.207702-1-sboyd@kernel.org> References: <20181106183609.207702-1-sboyd@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181106_183624_437161_10E4FF0C X-CRM114-Status: GOOD ( 16.33 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Ryder Lee , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, Matthias Brugger , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Use this function to reduce the boiler-plate code that the mediatek clk driver needs to implement to probe clks for different devices within the same driver. Cc: Ryder Lee Signed-off-by: Stephen Boyd --- drivers/clk/mediatek/clk-mt2701.c | 20 +------------------- drivers/clk/mediatek/clk-mt2712.c | 20 +------------------- drivers/clk/mediatek/clk-mt6797.c | 20 +------------------- drivers/clk/mediatek/clk-mt7622-eth.c | 20 +------------------- drivers/clk/mediatek/clk-mt7622-hif.c | 20 +------------------- drivers/clk/mediatek/clk-mt7622.c | 20 +------------------- 6 files changed, 6 insertions(+), 114 deletions(-) diff --git a/drivers/clk/mediatek/clk-mt2701.c b/drivers/clk/mediatek/clk-mt2701.c index ab6ab07f53e6..5dd8fb98ce49 100644 --- a/drivers/clk/mediatek/clk-mt2701.c +++ b/drivers/clk/mediatek/clk-mt2701.c @@ -1009,26 +1009,8 @@ static const struct of_device_id of_match_clk_mt2701[] = { } }; -static int clk_mt2701_probe(struct platform_device *pdev) -{ - int (*clk_init)(struct platform_device *); - int r; - - clk_init = of_device_get_match_data(&pdev->dev); - if (!clk_init) - return -EINVAL; - - r = clk_init(pdev); - if (r) - dev_err(&pdev->dev, - "could not register clock provider: %s: %d\n", - pdev->name, r); - - return r; -} - static struct platform_driver clk_mt2701_drv = { - .probe = clk_mt2701_probe, + .probe = platform_driver_probe_by_of_match_data, .driver = { .name = "clk-mt2701", .of_match_table = of_match_clk_mt2701, diff --git a/drivers/clk/mediatek/clk-mt2712.c b/drivers/clk/mediatek/clk-mt2712.c index 991d4093726e..17c031d110ff 100644 --- a/drivers/clk/mediatek/clk-mt2712.c +++ b/drivers/clk/mediatek/clk-mt2712.c @@ -1441,26 +1441,8 @@ static const struct of_device_id of_match_clk_mt2712[] = { } }; -static int clk_mt2712_probe(struct platform_device *pdev) -{ - int (*clk_probe)(struct platform_device *); - int r; - - clk_probe = of_device_get_match_data(&pdev->dev); - if (!clk_probe) - return -EINVAL; - - r = clk_probe(pdev); - if (r != 0) - dev_err(&pdev->dev, - "could not register clock provider: %s: %d\n", - pdev->name, r); - - return r; -} - static struct platform_driver clk_mt2712_drv = { - .probe = clk_mt2712_probe, + .probe = platform_driver_probe_by_of_match_data, .driver = { .name = "clk-mt2712", .owner = THIS_MODULE, diff --git a/drivers/clk/mediatek/clk-mt6797.c b/drivers/clk/mediatek/clk-mt6797.c index 5702bc974ed9..2d7ff3098cc9 100644 --- a/drivers/clk/mediatek/clk-mt6797.c +++ b/drivers/clk/mediatek/clk-mt6797.c @@ -680,26 +680,8 @@ static const struct of_device_id of_match_clk_mt6797[] = { } }; -static int clk_mt6797_probe(struct platform_device *pdev) -{ - int (*clk_init)(struct platform_device *); - int r; - - clk_init = of_device_get_match_data(&pdev->dev); - if (!clk_init) - return -EINVAL; - - r = clk_init(pdev); - if (r) - dev_err(&pdev->dev, - "could not register clock provider: %s: %d\n", - pdev->name, r); - - return r; -} - static struct platform_driver clk_mt6797_drv = { - .probe = clk_mt6797_probe, + .probe = platform_driver_probe_by_of_match_data, .driver = { .name = "clk-mt6797", .of_match_table = of_match_clk_mt6797, diff --git a/drivers/clk/mediatek/clk-mt7622-eth.c b/drivers/clk/mediatek/clk-mt7622-eth.c index 6328127bbb3c..2ce825f19275 100644 --- a/drivers/clk/mediatek/clk-mt7622-eth.c +++ b/drivers/clk/mediatek/clk-mt7622-eth.c @@ -127,26 +127,8 @@ static const struct of_device_id of_match_clk_mt7622_eth[] = { } }; -static int clk_mt7622_eth_probe(struct platform_device *pdev) -{ - int (*clk_init)(struct platform_device *); - int r; - - clk_init = of_device_get_match_data(&pdev->dev); - if (!clk_init) - return -EINVAL; - - r = clk_init(pdev); - if (r) - dev_err(&pdev->dev, - "could not register clock provider: %s: %d\n", - pdev->name, r); - - return r; -} - static struct platform_driver clk_mt7622_eth_drv = { - .probe = clk_mt7622_eth_probe, + .probe = platform_driver_probe_by_of_match_data, .driver = { .name = "clk-mt7622-eth", .of_match_table = of_match_clk_mt7622_eth, diff --git a/drivers/clk/mediatek/clk-mt7622-hif.c b/drivers/clk/mediatek/clk-mt7622-hif.c index a6e8534276c6..65f13808155d 100644 --- a/drivers/clk/mediatek/clk-mt7622-hif.c +++ b/drivers/clk/mediatek/clk-mt7622-hif.c @@ -140,26 +140,8 @@ static const struct of_device_id of_match_clk_mt7622_hif[] = { } }; -static int clk_mt7622_hif_probe(struct platform_device *pdev) -{ - int (*clk_init)(struct platform_device *); - int r; - - clk_init = of_device_get_match_data(&pdev->dev); - if (!clk_init) - return -EINVAL; - - r = clk_init(pdev); - if (r) - dev_err(&pdev->dev, - "could not register clock provider: %s: %d\n", - pdev->name, r); - - return r; -} - static struct platform_driver clk_mt7622_hif_drv = { - .probe = clk_mt7622_hif_probe, + .probe = platform_driver_probe_by_of_match_data, .driver = { .name = "clk-mt7622-hif", .of_match_table = of_match_clk_mt7622_hif, diff --git a/drivers/clk/mediatek/clk-mt7622.c b/drivers/clk/mediatek/clk-mt7622.c index 92f7e32770c6..d7310fb5964f 100644 --- a/drivers/clk/mediatek/clk-mt7622.c +++ b/drivers/clk/mediatek/clk-mt7622.c @@ -746,26 +746,8 @@ static const struct of_device_id of_match_clk_mt7622[] = { } }; -static int clk_mt7622_probe(struct platform_device *pdev) -{ - int (*clk_init)(struct platform_device *); - int r; - - clk_init = of_device_get_match_data(&pdev->dev); - if (!clk_init) - return -EINVAL; - - r = clk_init(pdev); - if (r) - dev_err(&pdev->dev, - "could not register clock provider: %s: %d\n", - pdev->name, r); - - return r; -} - static struct platform_driver clk_mt7622_drv = { - .probe = clk_mt7622_probe, + .probe = platform_driver_probe_by_of_match_data, .driver = { .name = "clk-mt7622", .of_match_table = of_match_clk_mt7622,