linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Thierry Reding <thierry.reding@gmail.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Cc: Jon Hunter <jonathanh@nvidia.com>,
	Dmitry Osipenko <digetx@gmail.com>,
	linux-tegra@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 03/12] memory: tegra: Introduce struct tegra_mc_ops
Date: Tue,  1 Jun 2021 19:59:33 +0200	[thread overview]
Message-ID: <20210601175942.1920588-4-thierry.reding@gmail.com> (raw)
In-Reply-To: <20210601175942.1920588-1-thierry.reding@gmail.com>

From: Thierry Reding <treding@nvidia.com>

Subsequent patches will introduce further callbacks, so create a new
struct tegra_mc_ops to collect all of them in a single place. Move the
existing ->init() callback into the new structure.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
Changes in v2:
- new patch (suggested by Krzysztof)

 drivers/memory/tegra/mc.c      | 4 ++--
 drivers/memory/tegra/tegra20.c | 6 +++++-
 include/soc/tegra/mc.h         | 7 +++++--
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c
index b7e104bf6614..559ae1ef5633 100644
--- a/drivers/memory/tegra/mc.c
+++ b/drivers/memory/tegra/mc.c
@@ -829,8 +829,8 @@ static int tegra_mc_probe(struct platform_device *pdev)
 
 	mc->debugfs.root = debugfs_create_dir("mc", NULL);
 
-	if (mc->soc->init) {
-		err = mc->soc->init(mc);
+	if (mc->soc->ops && mc->soc->ops->init) {
+		err = mc->soc->ops->init(mc);
 		if (err < 0)
 			dev_err(&pdev->dev, "failed to initialize SoC driver: %d\n",
 				err);
diff --git a/drivers/memory/tegra/tegra20.c b/drivers/memory/tegra/tegra20.c
index 2db68a913b7a..3b7b93b96480 100644
--- a/drivers/memory/tegra/tegra20.c
+++ b/drivers/memory/tegra/tegra20.c
@@ -687,6 +687,10 @@ static int tegra20_mc_init(struct tegra_mc *mc)
 	return 0;
 }
 
+static const struct tegra_mc_ops tegra20_mc_ops = {
+	.init = tegra20_mc_init,
+};
+
 const struct tegra_mc_soc tegra20_mc_soc = {
 	.clients = tegra20_mc_clients,
 	.num_clients = ARRAY_SIZE(tegra20_mc_clients),
@@ -698,5 +702,5 @@ const struct tegra_mc_soc tegra20_mc_soc = {
 	.resets = tegra20_mc_resets,
 	.num_resets = ARRAY_SIZE(tegra20_mc_resets),
 	.icc_ops = &tegra20_mc_icc_ops,
-	.init = tegra20_mc_init,
+	.ops = &tegra20_mc_ops,
 };
diff --git a/include/soc/tegra/mc.h b/include/soc/tegra/mc.h
index 9da4ef52ce30..4f88da907a02 100644
--- a/include/soc/tegra/mc.h
+++ b/include/soc/tegra/mc.h
@@ -169,6 +169,10 @@ struct tegra_mc_icc_ops {
 						void *data);
 };
 
+struct tegra_mc_ops {
+	int (*init)(struct tegra_mc *mc);
+};
+
 struct tegra_mc_soc {
 	const struct tegra_mc_client *clients;
 	unsigned int num_clients;
@@ -190,8 +194,7 @@ struct tegra_mc_soc {
 	unsigned int num_resets;
 
 	const struct tegra_mc_icc_ops *icc_ops;
-
-	int (*init)(struct tegra_mc *mc);
+	const struct tegra_mc_ops *ops;
 };
 
 struct tegra_mc {
-- 
2.31.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-06-01 18:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-01 17:59 [PATCH v2 00/12] memory: tegra: Driver unification Thierry Reding
2021-06-01 17:59 ` [PATCH v2 02/12] memory: tegra: Unify struct tegra_mc across SoC generations Thierry Reding
2021-06-01 17:59 ` Thierry Reding [this message]
2021-06-01 17:59 ` [PATCH v2 04/12] memory: tegra: Push suspend/resume into SoC drivers Thierry Reding
2021-06-01 17:59 ` [PATCH v2 05/12] memory: tegra: Make per-SoC setup more generic Thierry Reding
2021-06-01 17:59 ` [PATCH v2 06/12] memory: tegra: Extract setup code into callback Thierry Reding
2021-06-01 17:59 ` [PATCH v2 07/12] memory: tegra: Parameterize interrupt handler Thierry Reding
2021-06-01 18:53   ` Dmitry Osipenko
2021-06-01 18:54     ` Dmitry Osipenko
2021-06-01 19:37     ` Dmitry Osipenko
2021-06-02  8:43       ` Thierry Reding
2021-06-01 17:59 ` [PATCH v2 08/12] memory: tegra: Make IRQ support opitonal Thierry Reding
2021-06-01 17:59 ` [PATCH v2 09/12] memory: tegra: Only initialize reset controller if available Thierry Reding
2021-06-01 17:59 ` [PATCH v2 10/12] memory: tegra: Unify drivers Thierry Reding
2021-06-01 17:59 ` [PATCH v2 11/12] memory: tegra: Add memory client IDs to tables Thierry Reding
2021-06-01 17:59 ` [PATCH v2 12/12] memory: tegra: Split Tegra194 data into separate file Thierry Reding
2021-06-02  7:53   ` Krzysztof Kozlowski
2021-06-02  8:29     ` Thierry Reding
2021-06-01 19:38 ` [PATCH v2 00/12] memory: tegra: Driver unification Dmitry Osipenko
2021-06-01 20:02   ` Dmitry Osipenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210601175942.1920588-4-thierry.reding@gmail.com \
    --to=thierry.reding@gmail.com \
    --cc=digetx@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=krzysztof.kozlowski@canonical.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-tegra@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).