From patchwork Tue Mar 6 11:47:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 10261477 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 13B68602C8 for ; Tue, 6 Mar 2018 11:48:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02CF228C60 for ; Tue, 6 Mar 2018 11:48:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBB0028CC9; Tue, 6 Mar 2018 11:48:22 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID 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 A663828C60 for ; Tue, 6 Mar 2018 11:48:22 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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:In-Reply-To: References:List-Owner; bh=ytFwV89S/NlsQ5vOUZmvhPIv1h0lMXe85RMPg+mjnLk=; b=B2D amPvgiCBht9KF3URWUhIjKfw+kDwzQMFlZFjv9RxFMafKE/qd60alDaMXmAq4ATZ0N7cOax1a+qsq DYLUnp8pkUbtPBim2lsNW/zKfAN7K8sV4L5QcgNeoYsCaI0PhzeCj/IkXHFXNh/uOOneQYwWdWGfa nXE6IyYNG/S6ANOl7h7ff6F9ofmocoLOwcxZ8++p4mirwHfYyTL/c1VylLbEtI2TteOARXTZH5EV7 9KpGIE/Wq+o62f5ZX6IEXy1Rta0Pswd4eYteCreInrAoPP3q9k227tFwMpfN2PmoFw7ruuIPFMTxN LEb9lMP1IiGmndy+X2yan9j2dQvBepg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1etB4v-0002aE-9p; Tue, 06 Mar 2018 11:48:21 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1etB4o-0002Up-1T for linux-amlogic@lists.infradead.org; Tue, 06 Mar 2018 11:48:19 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6A6441435; Tue, 6 Mar 2018 03:48:02 -0800 (PST) Received: from e107155-lin.cambridge.arm.com (unknown [10.1.211.34]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 5A2683F24A; Tue, 6 Mar 2018 03:48:01 -0800 (PST) From: Sudeep Holla To: linux-amlogic@lists.infradead.org, Carlo Caione , Kevin Hilman Subject: [PATCH] firmware: meson-sm: rework meson_sm_init to use module_platform_driver_probe Date: Tue, 6 Mar 2018 11:47:49 +0000 Message-Id: <1520336869-25224-1-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180306_034814_250143_58ABFC0A X-CRM114-Status: UNSURE ( 9.46 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, Sudeep Holla MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Commit 3aa0582fdb82 ("of: platform: populate /firmware/ node from of_platform_default_populate_init()") takes care of populating all the devices under the /firmware/ node in of_platform_default_populate_init() This patch reworks meson_sm_init to use module_platform_driver_probe as the platform device is populated. Cc: Carlo Caione Cc: Kevin Hilman Cc: linux-amlogic@lists.infradead.org Signed-off-by: Sudeep Holla --- drivers/firmware/meson/meson_sm.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c index ff204421117b..0ec2ca87318c 100644 --- a/drivers/firmware/meson/meson_sm.c +++ b/drivers/firmware/meson/meson_sm.c @@ -17,8 +17,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -217,21 +219,11 @@ static const struct of_device_id meson_sm_ids[] = { { /* sentinel */ }, }; -int __init meson_sm_init(void) +static int __init meson_sm_probe(struct platform_device *pdev) { const struct meson_sm_chip *chip; - const struct of_device_id *matched_np; - struct device_node *np; - np = of_find_matching_node_and_match(NULL, meson_sm_ids, &matched_np); - if (!np) - return -ENODEV; - - chip = matched_np->data; - if (!chip) { - pr_err("unable to setup secure-monitor data\n"); - goto out; - } + chip = of_match_device(meson_sm_ids, &pdev->dev)->data; if (chip->cmd_shmem_in_base) { fw.sm_shmem_in_base = meson_sm_map_shmem(chip->cmd_shmem_in_base, @@ -257,4 +249,11 @@ int __init meson_sm_init(void) out: return -EINVAL; } -device_initcall(meson_sm_init); + +static struct platform_driver meson_sm_driver = { + .driver = { + .name = "meson-sm", + .of_match_table = of_match_ptr(meson_sm_ids), + }, +}; +module_platform_driver_probe(meson_sm_driver, meson_sm_probe);