From patchwork Thu Sep 28 10:45:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 114406 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp578971qgf; Thu, 28 Sep 2017 03:46:19 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDEO+1wG9Cdov4ynmJ8MelzlEQ+tWtzHra67uda8oGAqRq4OoLdgYHbS27sIueNfBxEGihx X-Received: by 10.101.66.70 with SMTP id d6mr3846340pgq.169.1506595579435; Thu, 28 Sep 2017 03:46:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506595579; cv=none; d=google.com; s=arc-20160816; b=bWco/UxwN1qdcKv7aPyjQ7sxaW66XXWoST9KuytKYTZ4c1Ldj6gJ4KuVv5XYQxxwPB 53QKKyhF/Tj+yxE042JcSfSe2A0A/y8ZCNouBT2mb4zafIcirW/bu/k1/PFMJJSlCzzH hOtsIrbmt8Zrp3As4auLKXJYb4a2WcPt5bVEudsvq9UTkVxVvFfDHd0rtNy/OYTdhPJX n3QVCeMYgFwVeRhNsmkuvl/jFmb14ZEc0LJX6B9se+0ohdIJ/inVvfvCB7wNZ1QvPzgt S58ZwhCGa8HpTtAUaJPOrbIc/IZJ2Vbj+Q6DMiLckQuNr5lu1fMx24cWhLKPdbwIvkmC Zxqg== 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=h6kFAnZKICx5HPBb3Wmenv/Rj1rY+pw7NSOpu9QL2/Y=; b=JKOPKjWzF6klGpKTY0BRtLjoodfz+MHIFZ80QESWZY5rhlRE/8HWT81HpvET6KBAA1 dx1ACLVJ7vRCT/BcdBaB0a9JsanWiTbQklD4N1oOrNbJY70IsygFzMWVYshp1nCTtVo5 tUekq1ZQpvAGo08ukM7W1cgMDxx2RoscU+wqVfYVqpuC/zOAQImTO/ReSmDHjZYSO2Yd BSnhFV7E0AuY2RbBpcD2eFq1zx1hrnbRFWOCHAy8Pc5l4NzWwQsBUDLX79BJr7SI3FAZ 94CP0KxhAXsLIJnHVS4STeffRKbFjWwkLakB1fkjrBfTeSAphif4vEb63epLYy0QppmQ cuzw== 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 m3si1183626pld.825.2017.09.28.03.46.18; Thu, 28 Sep 2017 03:46:19 -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 S1752833AbdI1KqQ (ORCPT + 26 others); Thu, 28 Sep 2017 06:46:16 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:54960 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751082AbdI1KqO (ORCPT ); Thu, 28 Sep 2017 06:46:14 -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 C67411596; Thu, 28 Sep 2017 03:46:13 -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 6837E3F53D; Thu, 28 Sep 2017 03:46:12 -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 , Arnd Bergmann , Rob Herring Subject: [RESEND][PATCH 1/4] of: platform: populate /firmware/ node from of_platform_default_populate_init() Date: Thu, 28 Sep 2017 11:45:59 +0100 Message-Id: <1506595562-10592-2-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 Since "/firmware" does not have its own "compatible" property as it's just collection of nodes representing firmware interface, it's sub-nodes are not populated during system initialization. Currently different firmware drivers search the /firmware/ node and populate the sub-node devices selectively. Instead we can populate the /firmware/ node during init to avoid more drivers continuing to populate the devices selectively. To generalize the solution this patch populates the /firmware/ node explicitly from of_platform_default_populate_init(). Cc: Arnd Bergmann Cc: Rob Herring Signed-off-by: Sudeep Holla --- drivers/of/platform.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.7.4 Acked-by: Rob Herring diff --git a/drivers/of/platform.c b/drivers/of/platform.c index ac15d0e3d27d..3a213a6aee89 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -515,6 +515,10 @@ static int __init of_platform_default_populate_init(void) of_platform_device_create(node, NULL, NULL); } + node = of_find_node_by_path("/firmware"); + if (node) + of_platform_populate(node, NULL, NULL, NULL); + /* Populate everything else. */ of_platform_default_populate(NULL, NULL, NULL); From patchwork Thu Sep 28 10:46:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 114409 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp579552qgf; Thu, 28 Sep 2017 03:46:56 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBYrSHDDpkPdqaNp5D+9cWYA/XRtKzpVL3k75c2VAismVkCLB8YEiE58s8xdcEhKo2YMp6A X-Received: by 10.84.216.6 with SMTP id m6mr3781814pli.143.1506595616303; Thu, 28 Sep 2017 03:46:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506595616; cv=none; d=google.com; s=arc-20160816; b=kCUJhadJdioK5Vsf/JJWEsiD2QwCBUc6Fr5Z1QV1BiHj/hdo4K1+VKr6iqHKmHL1qI HEdMohQ8X62jatOHqYtQZc/Ky5bI+JBFYVaqP2s8mRttZtkB+RP/Zt2/fiAVL7i9njmk cOZdSXIpRvCp5Rcn3pT6q0XG/BK0C/nTI3PIVj4kB6mZWBZ6u36tUi39y+w8Fy0qBrgL RmnwMf+kMa54pbvxY1MceSWDs/lbpc+DUwmU0Aumed7x81u2qzkhXEkfBnzyaQdrOxfy oJPzGlOUdhXTHOZTiHvBzF5Nf3LVQnuJFjHACj7rU0pXRuJRqhwwaetXNy0Lq6FoBzcI Cj+A== 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=2cbzLFAd+JyMUfJ77ohFKp5fGMdZErHcrMHk+Xzlj88=; b=fdj29mwD6SayUNR6MvjEUd55BA0FpLtn6oNa1sQl7vE0ahqqPcp7GomDVIzjUDGcJh hXCJ7LzUVHksaakuHIf0Q6ROAtLzB/u8GrlpyoFt6d1fhC/W9s+iOul75NA+pWb7YARu ejBh2OzkMYoPtczcWNeGjLkELT+W9XI1B/So68tbQpEAMX064OVXXFiviquSFnJg0wtv x3bNb9lsttqDIIiALgGS3lCviAD+PW+FUEmugnW+SzWcmnr3tdhh1c8lDhXhcnRRiZ7A UNe2XZUfwheGZkLeDCYteih7nvwEtU1BhPeeimI9I/2TbolOau/RMtrYHiB8GloSy2mW Uq0A== 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 b11si1201933pls.503.2017.09.28.03.46.55; Thu, 28 Sep 2017 03:46:56 -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 S1752902AbdI1Kqy (ORCPT + 26 others); Thu, 28 Sep 2017 06:46:54 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:54972 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752580AbdI1KqP (ORCPT ); Thu, 28 Sep 2017 06:46:15 -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 938E3164F; Thu, 28 Sep 2017 03:46:15 -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 118993F53D; Thu, 28 Sep 2017 03:46:13 -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 , Andy Gross , David Brown , linux-arm-msm@vger.kernel.org Subject: [RESEND][PATCH 2/4] firmware: qcom_scm: drop redandant of_platform_populate Date: Thu, 28 Sep 2017 11:46:00 +0100 Message-Id: <1506595562-10592-3-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 removes the redandant call to of_platform_populate here. Cc: Andy Gross Cc: David Brown Cc: linux-arm-msm@vger.kernel.org Signed-off-by: Sudeep Holla --- drivers/firmware/qcom_scm.c | 24 ------------------------ 1 file changed, 24 deletions(-) -- 2.7.4 diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c index bb16510d75ba..a11e06e5cdb0 100644 --- a/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c @@ -440,30 +440,6 @@ static struct platform_driver qcom_scm_driver = { static int __init qcom_scm_init(void) { - struct device_node *np, *fw_np; - int ret; - - fw_np = of_find_node_by_name(NULL, "firmware"); - - if (!fw_np) - return -ENODEV; - - np = of_find_matching_node(fw_np, qcom_scm_dt_match); - - if (!np) { - of_node_put(fw_np); - return -ENODEV; - } - - of_node_put(np); - - ret = of_platform_populate(fw_np, qcom_scm_dt_match, NULL, NULL); - - of_node_put(fw_np); - - if (ret) - return ret; - return platform_driver_register(&qcom_scm_driver); } subsys_initcall(qcom_scm_init); From patchwork Thu Sep 28 10:46:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 114407 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp579025qgf; Thu, 28 Sep 2017 03:46:22 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDodEfAZt34lcijr52XD+TW6HffnZdTzl1+eVbN8y2Cj5qXfI6E6nPltjXcaQch/eI42ssj X-Received: by 10.159.197.6 with SMTP id bj6mr3767460plb.178.1506595582722; Thu, 28 Sep 2017 03:46:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506595582; cv=none; d=google.com; s=arc-20160816; b=EVCAN4kppQD0YY5MwVMCYZYTsipXqTQbFJRu9dzksz3Lt0CO2FJN+yAJ19eOCXnPCs KfD/ZiMa+ehAqFT0YwksALFGZPOJCaTCYytekgvpmOMjYDyx/S+hKqayU1Y3Ep2DddgO g6AFLcS1bbIZMnNjZson1ug0zP0ovswdEP5RmC47anFZYxmiVf6GiRk7WNhfFLoKg4UF aeEgdRNpsIPADDLfP91P0o1gmW1Lxq/aXNqTG2/tl2wAVLjPAEYQyxMwD1+XiFrrXUO0 EfqTOMKHQwbo+MSs4liBbQCOPfL7WYZxn4VagE2+dJLnTKrDHKvwFQ2Rnx2Yw6lXaikq vSZA== 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=+1ACMSmtV7CiRqOYlpgXBcKRzgWAGa1xAWwLCfQoa1I=; b=hxIe4YGLi/MqMYVQ0PC4zw0qQB80r415ECpU1Te5vGIeD2+If+31vQZ5F8eVQhJFyE an/B5gpq+QqBalJfbQ8OzAtW/DY4XD2LyTgXrJoS92fWneYKKtAj7Evdk/1b8t5h4MWd xZdilsTgRU8TTfxsY5K/ztycf8jru5nfFJwDJtcQopMOTEiahBVPDWV0TMbd8zJf+Rme 8+Bj4UpyzRIGJUO9V0XQEUyOobCXolfeJy4u3P8yY1GZ188FcWBUfIHMP6DdXY0RV+OU GtoKkAGdIUe0sOwWkS220ntgOw2UfZHWHzJR5nsJaRgzhNN5qw8z7pB+3UhN/kTAoMle Gljg== 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 m3si1183626pld.825.2017.09.28.03.46.22; Thu, 28 Sep 2017 03:46:22 -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 S1752860AbdI1KqU (ORCPT + 26 others); Thu, 28 Sep 2017 06:46:20 -0400 Received: from foss.arm.com ([217.140.101.70]:54982 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751082AbdI1KqR (ORCPT ); Thu, 28 Sep 2017 06:46:17 -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 0FFE4165C; Thu, 28 Sep 2017 03:46:17 -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 D25BE3F53D; Thu, 28 Sep 2017 03:46:15 -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 , Jens Wiklander Subject: [RESEND][PATCH 3/4] drivers: tee: rework optee_driver_{init, exit} to use platform device Date: Thu, 28 Sep 2017 11:46:01 +0100 Message-Id: <1506595562-10592-4-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/removes custom optee_driver_{init,exit} in favour of module_platform_driver. Cc: Jens Wiklander Signed-off-by: Sudeep Holla --- drivers/tee/optee/core.c | 74 ++++++++++++++++-------------------------------- 1 file changed, 25 insertions(+), 49 deletions(-) -- 2.7.4 diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c index 7952357df9c8..98be0e688949 100644 --- a/drivers/tee/optee/core.c +++ b/drivers/tee/optee/core.c @@ -446,8 +446,9 @@ static optee_invoke_fn *get_invoke_func(struct device_node *np) return ERR_PTR(-EINVAL); } -static struct optee *optee_probe(struct device_node *np) +static int optee_probe(struct platform_device *pdev) { + struct device_node *np = pdev->dev.of_node; optee_invoke_fn *invoke_fn; struct tee_shm_pool *pool; struct optee *optee = NULL; @@ -458,21 +459,21 @@ static struct optee *optee_probe(struct device_node *np) invoke_fn = get_invoke_func(np); if (IS_ERR(invoke_fn)) - return (void *)invoke_fn; + return PTR_ERR(invoke_fn); if (!optee_msg_api_uid_is_optee_api(invoke_fn)) { pr_warn("api uid mismatch\n"); - return ERR_PTR(-EINVAL); + return -EINVAL; } if (!optee_msg_api_revision_is_compatible(invoke_fn)) { pr_warn("api revision mismatch\n"); - return ERR_PTR(-EINVAL); + return -EINVAL; } if (!optee_msg_exchange_capabilities(invoke_fn, &sec_caps)) { pr_warn("capabilities mismatch\n"); - return ERR_PTR(-EINVAL); + return -EINVAL; } /* @@ -480,11 +481,11 @@ static struct optee *optee_probe(struct device_node *np) * doesn't have any reserved memory we can use we can't continue. */ if (!(sec_caps & OPTEE_SMC_SEC_CAP_HAVE_RESERVED_SHM)) - return ERR_PTR(-EINVAL); + return -EINVAL; pool = optee_config_shm_memremap(invoke_fn, &memremaped_shm); if (IS_ERR(pool)) - return (void *)pool; + return PTR_ERR(pool); optee = kzalloc(sizeof(*optee), GFP_KERNEL); if (!optee) { @@ -524,9 +525,10 @@ static struct optee *optee_probe(struct device_node *np) optee->pool = pool; optee_enable_shm_cache(optee); + platform_set_drvdata(pdev, optee); pr_info("initialized driver\n"); - return optee; + return 0; err: if (optee) { /* @@ -542,11 +544,12 @@ static struct optee *optee_probe(struct device_node *np) tee_shm_pool_free(pool); if (memremaped_shm) memunmap(memremaped_shm); - return ERR_PTR(rc); + return rc; } -static void optee_remove(struct optee *optee) +static int optee_remove(struct platform_device *pdev) { + struct optee *optee = platform_get_drvdata(pdev); /* * Ask OP-TEE to free all cached shared memory objects to decrease * reference counters and also avoid wild pointers in secure world @@ -569,52 +572,25 @@ static void optee_remove(struct optee *optee) mutex_destroy(&optee->call_queue.mutex); kfree(optee); + return 0; } static const struct of_device_id optee_match[] = { { .compatible = "linaro,optee-tz" }, {}, }; +MODULE_DEVICE_TABLE(of, optee_match); + +static struct platform_driver optee_platdrv = { + .driver = { + .name = "optee", + .of_match_table = of_match_ptr(optee_match), + }, + .probe = optee_probe, + .remove = optee_remove, +}; -static struct optee *optee_svc; - -static int __init optee_driver_init(void) -{ - struct device_node *fw_np; - struct device_node *np; - struct optee *optee; - - /* Node is supposed to be below /firmware */ - fw_np = of_find_node_by_name(NULL, "firmware"); - if (!fw_np) - return -ENODEV; - - np = of_find_matching_node(fw_np, optee_match); - of_node_put(fw_np); - if (!np) - return -ENODEV; - - optee = optee_probe(np); - of_node_put(np); - - if (IS_ERR(optee)) - return PTR_ERR(optee); - - optee_svc = optee; - - return 0; -} -module_init(optee_driver_init); - -static void __exit optee_driver_exit(void) -{ - struct optee *optee = optee_svc; - - optee_svc = NULL; - if (optee) - optee_remove(optee); -} -module_exit(optee_driver_exit); +module_platform_driver(optee_platdrv); MODULE_AUTHOR("Linaro"); MODULE_DESCRIPTION("OP-TEE driver"); 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);