From patchwork Tue Nov 6 18:36:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 10671293 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 1393514BD for ; Tue, 6 Nov 2018 18:37:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 062752AAF1 for ; Tue, 6 Nov 2018 18:37:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ECB282AB9D; Tue, 6 Nov 2018 18:37:06 +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 94BD22AAF1 for ; Tue, 6 Nov 2018 18:37:06 +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=siFITNew04LyzOwVzR5u+0YEqSHWPE5FCU//YKwJltc=; b=LmudTd7KJJKzHi /64WtCFi5Xhe5nrsaYPTk+H2gRD8LFnnURySweEN5F0679h8Vdlj8pJbnmVQyetXwR1Nc7nbZg3p7 +9IinsEldqPKHLBuIQ6ImCWNcaL3uYlN0QdYC9jT7illLbKQlizNuyh5DNl+pElG007EUWSFaWkU2 4SuyWgcJqqUnoEteAXaFF3uUEIVO36fnrWZctAyKBe0Eqs2cnUT5G7Lqpyi9YOKDJF2PQcsh8rD5w WkEx5rBm5hQUpQs2upiHQqCZ2apQ8Ue0GgMmDYJPTZ+2NtfrRaQ/QfySvbPuccikHQQugrdqt/vMu aTYLv2c/xOU2mXhRKHjw==; 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 1gK6Do-00034k-GD; Tue, 06 Nov 2018 18:37:04 +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-0002K6-AY; 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=gj6WRiqmNoW0bmYW98fbS5/BK2B5npYLuXEjbBUQhjY=; b=VXEu8gkD16IUzTDL/jQ8xo4UaI 8lpjtfkV4lBdzwav2HTT//eC18JCB/Wtasb05cZGEu0W7LfFRRz7gxcWAxk9RYiEBSz7K9ZdabJyb NMg361MZKmRTtsXL4VnwFuayKgc7QGcbjbBKg06GUhgj9T5H1ojY2r+yJH5y/piZ9Xdi+U+94B8na chFxdbuo63BAECFUzJB0IcYWUqpg7U39JFLnUGa/1CZdjlcy6DIbFsnn4nuTnT01bCPZDWNxpsfmE OWqS0mc28RDbeK/CrFjet/pLFS625Urt4zmqRq0hsDa+A/Svu9Ze+K7+4AuYSAmSWq5L85iMT71g2 STPDKYxg==; 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-0000HM-Vv; Tue, 06 Nov 2018 18:36:27 +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 DEE1E2086A; Tue, 6 Nov 2018 18:36:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541529371; bh=DKKrHcZEDvckhztoXQTQEnrDWU/3m1rqWN3NL85hfTU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YvlFanP6vaGAN6nhlrLV9C/on7L+sJ+of5UEB5QRLkPhIQ5XB27/g28ynEAXbbHG3 BXNZ8QfDfRJelJVaoXrD6pVTwgjA3lxCPmmW9K4y0v64jh0f/ugqteJR67h1I4AwjJ 3ksKm5x5YOg38CQjU+kyINxXkuhjg7ldCK1MbTUI= From: Stephen Boyd To: Michael Turquette , Stephen Boyd Subject: [PATCH 1/4] of/device: Add a way to probe drivers by match data Date: Tue, 6 Nov 2018 10:36:06 -0800 Message-Id: <20181106183609.207702-2-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_422131_A245732A X-CRM114-Status: GOOD ( 17.40 ) 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, Rob Herring , linux-mediatek@lists.infradead.org, Matthias Brugger , Frank Rowand , 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 We have a handful of clk drivers that have a collection of slightly variant device support keyed off of the compatible string. In each of these drivers, we demux the variant and then call the "real" probe function based on whatever is stored in the match data for that compatible string. Let's generalize this function so that it can be re-used as the platform_driver probe function directly. Cc: Ryder Lee Cc: Rob Herring Cc: Frank Rowand Signed-off-by: Stephen Boyd --- drivers/of/device.c | 31 +++++++++++++++++++++++++++++++ include/linux/of_device.h | 1 + 2 files changed, 32 insertions(+) diff --git a/drivers/of/device.c b/drivers/of/device.c index 0f27fad9fe94..8381f33ed2d8 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -195,6 +195,37 @@ const void *of_device_get_match_data(const struct device *dev) } EXPORT_SYMBOL(of_device_get_match_data); +/** + * platform_driver_probe_by_of_match_data - Probe a platform device using match data + * @pdev: platform device to probe + * + * For use by device drivers that multiplex their probe function through DT + * match data. Drivers can use this function to call their platform + * device probe directly without having to implement a wrapper function. + * + * static const struct of_device_id probe_funcs[] = { + * { .compatible = "compat,foo", .data = foo_probe }, + * {} + * }; + * + * struct platform_driver foo_driver = { + * .probe = platform_driver_probe_by_of_match_data, + * .driver = { + * of_match_table = probe_funcs, + * }, + * }; + * + */ +int platform_driver_probe_by_of_match_data(struct platform_device *pdev) +{ + int (*probe_func)(struct platform_device *pdev); + + probe_func = of_device_get_match_data(&pdev->dev); + + return probe_func(pdev); +} +EXPORT_SYMBOL_GPL(platform_driver_probe_by_of_match_data); + static ssize_t of_device_get_modalias(struct device *dev, char *str, ssize_t len) { const char *compat; diff --git a/include/linux/of_device.h b/include/linux/of_device.h index 8d31e39dd564..4de84691d1c6 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h @@ -33,6 +33,7 @@ extern int of_device_add(struct platform_device *pdev); extern int of_device_register(struct platform_device *ofdev); extern void of_device_unregister(struct platform_device *ofdev); +extern int platform_driver_probe_by_of_match_data(struct platform_device *pdev); extern const void *of_device_get_match_data(const struct device *dev); extern ssize_t of_device_modalias(struct device *dev, char *str, ssize_t len); 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, From patchwork Tue Nov 6 18:36:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 10671289 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 BBBC81803 for ; Tue, 6 Nov 2018 18:36:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AAF8829006 for ; Tue, 6 Nov 2018 18:36:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9BF782AAF1; Tue, 6 Nov 2018 18:36:50 +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=ham 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 578AA29006 for ; Tue, 6 Nov 2018 18:36:50 +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=eTWJJ314K1Z/bh7vFGoIRfSQDejAdcl75AjSbeDpoG8=; b=KTtguGLnu9Kwdc 4t82de/Rffi/FmvPd3Gypi6AMJigSD0lQrDsgCt+68hqfXubi61V7lCWrLQ+egEKmCmjXd1w7ayV/ Ijmoy916NykRy/XaNbJvUW0ECmdz1Ejz2VmsqqQosKv7gBO7+nj3grdUzrywjFEp3KOeiNz9IGlDX 2TGLvlTCcDSyDqysU8GKCsED/kPIatwVbrW4uqcaYVUIXhUClIDI6YJ4DGzHnpHYXge0nW8zL58vQ DWUKniDaR0GLP62zpstE+JIJM5nyLS/+RkzCvdEZJuXzp7k+45TV7cJ0dVr/nPMrJV5abGayxkTKk FcilrO2p0qlKUTupZPMQ==; 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 1gK6DX-0002kW-Tl; Tue, 06 Nov 2018 18:36:47 +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 1gK6DD-0002JH-OD; Tue, 06 Nov 2018 18:36:27 +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=ihI0CUDaqIL2bdkrXlFupCpj71hTGO21PAWmz7ulTag=; b=iHE3gPNEM0hSHkWqBuKB7K6/or wXlmZwco5Efl8xEU+p8Ybs5wa3B+Tdrt90H25D9uMyjVqSn0EZQyGlC7PaVsM7R6JT+vFGVmVS52n Aznqe82tS6eRv+HuIxgpusyKA3sgPJfdGYwoZxbIOyQ7MITFFOz6G/zTKtdD3ESAr7/9AhYtSg6RZ XYmdL1uHXDGLtWjlE+LIhp5cEdrNRUCBVo7168WMxNuTTuIoT+BVdGLWwRVxyyEOh80p+HfXssYT8 xWz+oA7sPmfgBZS6Uvp9rpZwp1tElUIv/vtxCrDjGgbwiEWbb/2PiosCuizrW0fMvwXYl3Xug/lgi qP3nDFAg==; 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-0000HO-Vw; Tue, 06 Nov 2018 18:36:26 +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 C040D20869; 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=1541529372; bh=m2D/prEYBrhF0OH5OtMLAaYkwsXTQSW4K5o4XvfP7l0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=taLWSUCJdbjNfDn6z8uCzZn6o+aEzelkHa1J51ulobd+QXy4/izDsmcfrIdz/4yc1 5x6I4v9bpeZ6Xm9gD4T2gn8tps1kZuG307p2VC9fh4jd0ly3/fj30ltEwEXM6VIQqF kJyc/X5S4Aj19uCXSrwQOBEeWO56r3Qu1SB4KKm4= From: Stephen Boyd To: Michael Turquette , Stephen Boyd Subject: [PATCH 3/4] clk: mediatek: Drop THIS_MODULE from platform_driver Date: Tue, 6 Nov 2018 10:36:08 -0800 Message-Id: <20181106183609.207702-4-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_150670_F130B21A X-CRM114-Status: GOOD ( 13.03 ) 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 This is already set by platform_driver_register(), so we can remove it here. Cc: Ryder Lee Signed-off-by: Stephen Boyd --- drivers/clk/mediatek/clk-mt2712.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/clk/mediatek/clk-mt2712.c b/drivers/clk/mediatek/clk-mt2712.c index 17c031d110ff..55f81f9bfdb5 100644 --- a/drivers/clk/mediatek/clk-mt2712.c +++ b/drivers/clk/mediatek/clk-mt2712.c @@ -1445,7 +1445,6 @@ static struct platform_driver clk_mt2712_drv = { .probe = platform_driver_probe_by_of_match_data, .driver = { .name = "clk-mt2712", - .owner = THIS_MODULE, .of_match_table = of_match_clk_mt2712, }, }; From patchwork Tue Nov 6 18:36:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 10671303 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 D9D021751 for ; Tue, 6 Nov 2018 18:51:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE8192B04D for ; Tue, 6 Nov 2018 18:51:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC10E2B043; Tue, 6 Nov 2018 18:51:08 +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 597F32B049 for ; Tue, 6 Nov 2018 18:51:08 +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=XnBaTOBXO4HH0jQUJF/+iDHyvQDVIa6X8Z/ncHwa/ZY=; b=TYKMUiaeaYFoKi uLMMK9AS2tJdqgOydjyIMbIqw4StJW4rKLr6UjEsMY2n5lD1zzrQs+H8BY8GZwy8EBOHzv7ZPWSSU sAjmmOzOgXMR8ha/LodYDGP4+tNt+2BlgInNsaWC0eEov8252gRWFkmErBGcAHLNs2djuvtN5MZwo OJZWzoXrlQBkBV1HV/vU90V26QKusOocTYudwI5MgX9ks3am3I7Lb9dYzgm6z6OgQfukhxWRiKlOm ZK1pJcEpom/pohR6gTZGQIYYEAstjfYV8xvyMwfjrSiVnwQeWn7KC9yg1uL4MxAGHS9snVSCvl5Ra KQ8GhGF1BJVD3ygJH9sA==; 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 1gK6RP-000074-C8; Tue, 06 Nov 2018 18:51:07 +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-0002K7-Gb; 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=o9i7YTQeQ/Ty3eC0kZoUVh8ZBa6WC87sYjlbRiqFK+A=; b=WDg29IO8e6XVgbqIXwL8WTYJ8l sFQ2JJd56MyN2nc7qB5kUPWXFSVDkhQx7d/3P9HdQXXwAJM0b+d5QX88ELL5+97BHb6mxQnauQefE /3Jr35YuNZy6WNrOSG82qkyMUpFHJ1eVHlrbhszQjNGGJpQbR5i7L1VK/jlkJNfi40vyIuYjjb5Vc eswdn9ODjLiSnyOWuxvNenT3cPsUUIZ010e/QkUVJ6O1MKDZxqjbI28e/QFmHRZ3nuoL6sug+kaeQ JvYJtcz2LEc2JbQLM2B1bzlHuXYpllCWEiatcybCeHncK9P9EHryWMzy/6EyhKQqunFhHzep4Pomn LayT/YOw==; 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-0000HT-Vv; 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 3163E20881; Tue, 6 Nov 2018 18:36:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541529372; bh=+9J3ejrJhvN91DXb6pD9tMuM96sMeF+VM5wZyYshQfc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WG/v+jSLtJ+9GQpzRJpzep9xSa1/GXoI2fqtDYW7DfBbWX42OJcuUBxKtkPUuhiJP yeTyYcwEPKkaQLPn0pUC2k75DB18lJGb7yE53a6Z9PnCqjgoPf1hQtGrSD+BA1Pj0h kNB7mODeHn+C/iC4OOgGnhIjV6IHuPg+hTEtNXiU= From: Stephen Boyd To: Michael Turquette , Stephen Boyd Subject: [PATCH 4/4] clk: mediatek: Simplify single driver probes Date: Tue, 6 Nov 2018 10:36:09 -0800 Message-Id: <20181106183609.207702-5-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_411978_183BF2A1 X-CRM114-Status: GOOD ( 16.38 ) 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 We don't need to do the multiplex probe design here when we only have one compatible string. Just setup probe to point at the one probe function for now. Cc: Ryder Lee Signed-off-by: Stephen Boyd --- drivers/clk/mediatek/clk-mt2701-g3d.c | 28 +++------------------------ drivers/clk/mediatek/clk-mt7622-aud.c | 28 +++------------------------ 2 files changed, 6 insertions(+), 50 deletions(-) diff --git a/drivers/clk/mediatek/clk-mt2701-g3d.c b/drivers/clk/mediatek/clk-mt2701-g3d.c index 1328c112a38f..58b13f12051a 100644 --- a/drivers/clk/mediatek/clk-mt2701-g3d.c +++ b/drivers/clk/mediatek/clk-mt2701-g3d.c @@ -58,34 +58,12 @@ static int clk_mt2701_g3dsys_init(struct platform_device *pdev) } static const struct of_device_id of_match_clk_mt2701_g3d[] = { - { - .compatible = "mediatek,mt2701-g3dsys", - .data = clk_mt2701_g3dsys_init, - }, { - /* sentinel */ - } + { .compatible = "mediatek,mt2701-g3dsys", }, + { /* sentinel */ } }; -static int clk_mt2701_g3d_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_g3d_drv = { - .probe = clk_mt2701_g3d_probe, + .probe = clk_mt2701_g3dsys_init, .driver = { .name = "clk-mt2701-g3d", .of_match_table = of_match_clk_mt2701_g3d, diff --git a/drivers/clk/mediatek/clk-mt7622-aud.c b/drivers/clk/mediatek/clk-mt7622-aud.c index 4f3d47b41b3e..2b10d13a8a37 100644 --- a/drivers/clk/mediatek/clk-mt7622-aud.c +++ b/drivers/clk/mediatek/clk-mt7622-aud.c @@ -171,34 +171,12 @@ static int clk_mt7622_audiosys_init(struct platform_device *pdev) } static const struct of_device_id of_match_clk_mt7622_aud[] = { - { - .compatible = "mediatek,mt7622-audsys", - .data = clk_mt7622_audiosys_init, - }, { - /* sentinel */ - } + { .compatible = "mediatek,mt7622-audsys", }, + { /* sentinel */ } }; -static int clk_mt7622_aud_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_aud_drv = { - .probe = clk_mt7622_aud_probe, + .probe = clk_mt7622_audiosys_init, .driver = { .name = "clk-mt7622-aud", .of_match_table = of_match_clk_mt7622_aud,