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: 130782 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp3837786lja; Tue, 6 Mar 2018 03:48:17 -0800 (PST) X-Google-Smtp-Source: AG47ELsozdNSUgaE6OEBDPf07pCCGSst1IL/LnylfKxdctUmanGdqOCU0y+jZAOzWWU5Yx4Nrl9F X-Received: by 2002:a17:902:7613:: with SMTP id k19-v6mr9527589pll.251.1520336897611; Tue, 06 Mar 2018 03:48:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520336897; cv=none; d=google.com; s=arc-20160816; b=Wa4inKNt62DmJHrohuxILuLQh41SnufHNo5ztk0yJuoMmyVqNYmWstV2HmHlVGAJON HI89AUgECCCDSoxxowHYMT9AO5fJ8+gl/TQe1jscHV/dLSfZR8cCiBln/eEUP1275nXE 8TIRb3GLZIsThElEJzBqic6QoRJnyKAqYedpLkBmEt/ZYdjxBP2gVL+lOyzdrG40eDEk 6ir3mwYiznV+1NPEk/efMlkOA8swLwkapWOkmgMN1SKKje5Ru8cUhs1myAFLtGu2kDlc Ek6RbxjrGp6zSj/QfIwTsGvjFOxbjcPkYorTEqINZoDcaDpeGuAQR4HifiDyB/NcoVBs Igpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=F05sSe+sOge0rRYSkOimfI3Mw/W3yyT/n28/KpstOng=; b=pIFQ6vrFI14tKIVKZlyiOw4joqZ5HQOmZMDfk2TTpnNNFUE7OoYpHQsFHZiE3doe1w OfIOvexQM3PuwwqRYeqkBhzDgb7P19v3n4UZjGHCkJyOTszn5MjChzg7xyxxxcQiQSFj GUtN8A4qlZYy962I4Q2tZaD16HimVRP1dc5tdMZ5GccJ99Q54/tph9GPOX3JsTvA26F5 Ir1G+0iLP2A9KdFqbRONLeHW2VawHUlGqRKQ/CMUvDYb3zi3n6B6jv8uKDpKvHupikYl BVXQVPIfi+EhMCvJjC+UPqAQCOJlXwZhjvsrxvWECOCAhfrLW3768rl+W6jm1ay37Ogt X0gA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m3-v6si11065356pld.155.2018.03.06.03.48.17; Tue, 06 Mar 2018 03:48:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753596AbeCFLsP (ORCPT + 28 others); Tue, 6 Mar 2018 06:48:15 -0500 Received: from foss.arm.com ([217.140.101.70]:37132 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753332AbeCFLsC (ORCPT ); Tue, 6 Mar 2018 06:48:02 -0500 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 Cc: Sudeep Holla , linux-kernel@vger.kernel.org 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.7.4 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);