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: 10671291 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 ECE3314BD for ; Tue, 6 Nov 2018 18:37:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD47A29006 for ; Tue, 6 Nov 2018 18:37:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D115A2AAF1; Tue, 6 Nov 2018 18:37:01 +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 543F529006 for ; Tue, 6 Nov 2018 18:37:01 +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=P1ob2XMDq3XaqOZl1l2pfG3tUPFFj96Nh2Y4pBL6hW8=; b=mUecayh4AVtZj0 09+j/PyZ1I6s4yJO8879fHp6jTV0cVLo7v9Pe+2NhyV5Wy7TqGRYkK4tPyuok1DU/rMCA3K6twuEX +bdkkT0vbK5IMixxzfa53Tb+L2LmC+MmqPA6E/SzUbrKXKe7WS+3u3ltqD2HBwOjgDLdWOH7HYnRB nWcWh02OP3Al4/VPnJRhvQul6F+c9NMM9swae4MERM6ieQOwP4B6IdSl8+eVTV2w0hwkR+KXXBNhE jABrjytxSeA8No6zx42eRty/MF1Mo2A467HeO5+paFpZVA/SfHVyC6jUWIUiuEf0XkrtgxPMHpQzo AkJ+SJPndf6bHS1Kintg==; 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 1gK6Da-0002mD-1w; Tue, 06 Nov 2018 18:36:50 +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-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=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: 10671297 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 C1A04175A for ; Tue, 6 Nov 2018 18:37:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3B392AAF1 for ; Tue, 6 Nov 2018 18:37:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A74AB2ABBF; Tue, 6 Nov 2018 18:37:31 +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 315922AAF1 for ; Tue, 6 Nov 2018 18:37:31 +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=OqFyhGYu6kvIwQ5pxFi/a6QHnS3yJLZ0PQ8Y5C0UAyc=; b=WCrDrhdAnmt3as 9UZMudgGOu1jTkXfwudokYrrQyUJyQ1PkELc5DP3ZiJ/UgRibeb7jYAORU7aLRcfY1ZVFU8ATgOmI RzNKJ3lgvMVHvzaFzo6ejOrjffzONDDAfnwCyGa4hfCIgNdybGK9qDR17KZy741Ydya5Q9JHq7Y/z 7VifusvYS4gjp9IZhooN6DTqhenjs2grAQky/u+AQ9357pEdgAWFMWZGSGlfXxso+didqZfw66s8P 8FQJxSJqrQPrZ/Mm1g+MAktoC47klYs/aaFmoABp/VHeNF5nX0g/zEox2oa5xv6nUy+/2iEmg3PzV vnG7kHKJFb9tsn4l7UqA==; 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 1gK6EC-0003Pg-HN; Tue, 06 Nov 2018 18:37:28 +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-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=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: 10671283 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 46BD41803 for ; Tue, 6 Nov 2018 18:36:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 39E9129006 for ; Tue, 6 Nov 2018 18:36:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E0EA2A9E7; Tue, 6 Nov 2018 18:36:40 +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 DA2642AAF1 for ; Tue, 6 Nov 2018 18:36:39 +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=CJomnkc9r39DI3uBw5GGj4CRgxdX40FjzHAW72cMrD8=; b=HuQlITMz5P92tt bqqh27vUYnKLKSUbjBfr7aQGgOGlYzG2Yo2d3K+sDY4rXmJ+akLmcryB80t7glHBYWIHR5jFN6yy8 yiNpgYlk8cw9DkH6/IPVd3wFlFJm6Hiibhm/KDDdcweIU1pNGAahyDaZtdrUphg7eSc3fK8+4Kmsd Sz5MorixnNQDegmXB7t98BU9zfM9VY5wJedgJzYbks0ySkYi3/xck9xiMoYaTMHYCJZFOAU/BKIHl RVTYXqOAwLb80gsYQgbiaP7Vuy1R7x/6nx6Lhtn3AyI9cKygMR9kvVOkCwocJvFZZPhXHqc29jIgy hvb2vRhZ1vi8hZle7QnQ==; 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 1gK6DN-0002SZ-JL; Tue, 06 Nov 2018 18:36:37 +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-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=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: 10671295 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 D8119175A for ; Tue, 6 Nov 2018 18:37:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C94C72AB9D for ; Tue, 6 Nov 2018 18:37:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB1C32AAFD; Tue, 6 Nov 2018 18:37:11 +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 9C6C22AAFD for ; Tue, 6 Nov 2018 18:37:10 +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=39WO0hl0TgPsHe3h3IxnUtTAdzx1npDvKmHc8allnLQ=; b=fJGwTj75VCahbR JPhOP5cRdA2u0HrrzsF+WZotwt0wpfgGh9U+P9J4gubuy7EPI+5rzY7wBnEgtgf0dPc1rO6JTETag R/chq6KqUo0S3A+YMR3h3kwmwus8E/S40JZXbdzH1z0uM1m/rwpQtsU2HiS92zuiydKzUdsEqKlFt fMRZxYPcyvYu1VEU8CrGkoJMVAuyoxASYT8gUppFMyq1Sg7x4hBNvPZoaQwTBHxjcstAhA1fmCXmY 87syp7e/EA4cB2/qCOFtqVKnGlVFKOOK7RZztc+0xFxA94HcNH2SNoDsJ+7p4fGzReow+NkKC2UsJ d5yTXDnxPEGBd0ruUssA==; 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 1gK6Ds-00036y-AE; Tue, 06 Nov 2018 18:37:08 +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-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=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,