From patchwork Thu Sep 28 10:46:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 114408 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp579269qgf; Thu, 28 Sep 2017 03:46:38 -0700 (PDT) X-Google-Smtp-Source: AOwi7QARZpvlqQboH/UJNtIj78FgEtlZJh9xN2TY+rBZZa+FrMD3m9TIsfQqzZfW1QwPxKT/JU5B X-Received: by 10.98.74.4 with SMTP id x4mr3961312pfa.222.1506595598297; Thu, 28 Sep 2017 03:46:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506595598; cv=none; d=google.com; s=arc-20160816; b=G3OfzPm1ZtQxounpe2tGpYpDhtUCitERzHRt8lrKTdKu2JAdFJtGCl7EGd4nReOyq7 nCb57AnaFXZOpJi7z1bGh9v3C2IQkaPvh2VaK4MC+3Sh9Z68SbQ6LTjVPOVigKqGA5/7 +0EWGdi9dtpFWu6kgZ2DwMo03IJb9gOcp5XjvDPt4aouw90KQdxGKzAEc7z7vhFKE5Hf AGUGJkp4w7ea3JgUjL6mVUqgNfbkmYw2wn1vmQSYOFCAI3b8Uzc9z6RpypycwsutHIoj HEO3LxgI4SJPBt9+0FZlZ2mL7sUTmnGZR4rzq9KLM2flXb54uqHVAv59qj7BAzBxldZA ov4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=AyQ53jcqfJvWLzPbqxRQmdGc0YMMj9P80Vn1UBz3VcA=; b=u3yeWBjSkW3kFY3w7W8FRVvGneIG9fg1siFQkXHhBYY4c+Xn/tzf+x2jHva4z3gHiN 1ULcJB9PEZrxWJzf6OCAGwuoMhCSU28U9tEJFZzYOjnw9QoXkq9n/5+6DPQZoSjMwlqt +nu+nW7Gxhf1qG7LILoU6Evr6d2zvIeYEb0P3AooqZbJLJOThkvRZT671ILjmBxAplCd 5KwMrGADMeMK16ejyMEkEkTaV+7m5HqZQRqFD9/KYO16aCMnjBIOw590Osu3cS6m8Es8 4O1zwrtazcyXzwnPtPYahfSQCf/E1fe0mRP7oHyHlZcYktPlWuyx5CW3rtwK3AFL5Yao AjVg== 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 q3si1159180pgc.164.2017.09.28.03.46.38; Thu, 28 Sep 2017 03:46:38 -0700 (PDT) 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 S1752873AbdI1Kqf (ORCPT + 26 others); Thu, 28 Sep 2017 06:46:35 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:54992 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752708AbdI1KqT (ORCPT ); Thu, 28 Sep 2017 06:46:19 -0400 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 C7BB315BF; Thu, 28 Sep 2017 03:46:18 -0700 (PDT) Received: from e107155-lin.cambridge.arm.com (unknown [10.1.210.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4F04E3F53D; Thu, 28 Sep 2017 03:46:17 -0700 (PDT) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org Cc: Sudeep Holla , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Rob Herring , Carlo Caione , Kevin Hilman , linux-amlogic@lists.infradead.org Subject: [RESEND][PATCH 4/4] firmware: meson-sm: rework meson_sm_init to use module_platform_driver_probe Date: Thu, 28 Sep 2017 11:46:02 +0100 Message-Id: <1506595562-10592-5-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506595562-10592-1-git-send-email-sudeep.holla@arm.com> References: <1506595562-10592-1-git-send-email-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that of_platform_default_populate_init() takes care of populating all the devices under the /firmware/ node, this patch reworks meson_sm_init in favour of module_platform_driver_probe. Cc: Carlo Caione Cc: Kevin Hilman Cc: linux-amlogic@lists.infradead.org Signed-off-by: Sudeep Holla --- drivers/firmware/meson/meson_sm.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) -- 2.7.4 diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c index ff204421117b..ccd61be0dd49 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,17 +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; + chip = of_match_device(meson_sm_ids, &pdev->dev)->data; if (!chip) { pr_err("unable to setup secure-monitor data\n"); goto out; @@ -257,4 +253,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);