From patchwork Tue Jun 1 17:59:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 12291983 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6E7DC4708F for ; Tue, 1 Jun 2021 18:00:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6C9FC61375 for ; Tue, 1 Jun 2021 18:00:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6C9FC61375 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=//Q/9jp/FIGX30QYfocHha6cQY33NKZ2Jf4T04jLpJM=; b=sINwEBVm3gQTkB NhLgn/qcXiYZlcOg56X4EYXR2ZM7c6QKqlsVEv0ltWJ7WVSL/BeZaeLThEkcPnRr060//BzvY0ZJ6 2VtPEO2erLqhguC4HoLCYhOfiSVmJWknTojIbzpk20TfM8im8+al800GxCgixi8Zxu/nhwFMhwPRP abcuPAQgQfKPDBq9l6L2qW2lEnaUtV98hgaSNPuW1666OJgP7p1IycsMiErzykB9yLbl48onRRua1 HwrglviHCbbuxP1SvmUmLbZEHBHcsXupbbKiA0WgKFLHdG+tA26cpQkKtTAtZQzo+ML+hOYFnsPx4 DmoZR1Qhyzu5pXfKFHoA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lo8f6-000C83-LV; Tue, 01 Jun 2021 17:58:44 +0000 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lo8ei-000C37-8j for linux-arm-kernel@lists.infradead.org; Tue, 01 Jun 2021 17:58:22 +0000 Received: by mail-ej1-x62a.google.com with SMTP id c10so1854889eja.11 for ; Tue, 01 Jun 2021 10:58:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D4DTNxk9Yl8qPqUlGFS/qn0d446IjQVbqxu1mMTb7YQ=; b=X3vawT4ImI3UT0ZaZpLVUcK3Fnl5IEFS5DvGqTxGfe/OxMSQOLl36AF1gKaCJGr6MA FyVCylhR6m8JxisOP5m6LZ1F/Ct9vKxP2UUA2RT5H2nBMviE1Fgllee/qldv0Dbxa3w/ kwiMJuewRXuIUDTi+pYIvUjMaHvqpFykYblvtEHoHk/mSAwdDjOZDwBOJktAqycslsP7 KZHdIW32RnXpzAwfB4FeoMyJ+aEChBEwCCClaTnEJkHVLQEfedKgowCsnz1NzQxOZz7e AO29X//IQ1iim4GQINYqLAWTWA4qEExUGJUDIa2oBcWDD7A0de51Pb913V0ZWvZ5TVAK N9GA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=D4DTNxk9Yl8qPqUlGFS/qn0d446IjQVbqxu1mMTb7YQ=; b=cvqA22chWLZpHtcXnsNFJMcled1xOTlwHQFQd88JMI3gxPMZZSpmyMmXvvF7/xvE67 lRL/YYcuYH7EvYzYeP674/rn45MJVd5ZkERqL6T6/aj16NjKKfmQOUGJgtL6AuWsGY3W FHWg3NxaqputkukTzrmN75bRmzwzFxPeYj1kzaBzqDxzbfvOXN38blbEzZ9xxTKrtXu6 MdEOvE9Qd5pLVeGtXjx5u4edlbzsinH4cybdulcTOSGEaCCj4wiZy7yKGNvIE2+TPzrl fJJdo2cPFiyXzsRLsqepdMDkHp90wMeyRxtcS++LAdAvB1o0IapDUOZlgwbwkNsF8VG6 hV3g== X-Gm-Message-State: AOAM532xnao6HinRdSKJn3ktCWBdlEmmGiSk1szpOEVv4jhELTpilaBi 8CK7CWkmot7LJoquo57FnBMl7DgKNLE= X-Google-Smtp-Source: ABdhPJyqGGaaSSSRZnYSmzaIoUHM3ZxCO4T20ZrxXj146AE+bKiLopgCLzO0Tsya238FX+EqSaz7Yw== X-Received: by 2002:a17:906:755:: with SMTP id z21mr29660812ejb.113.1622570298498; Tue, 01 Jun 2021 10:58:18 -0700 (PDT) Received: from localhost ([62.96.65.119]) by smtp.gmail.com with ESMTPSA id x9sm7840375eje.64.2021.06.01.10.58.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Jun 2021 10:58:17 -0700 (PDT) From: Thierry Reding To: Thierry Reding , Krzysztof Kozlowski Cc: Jon Hunter , Dmitry Osipenko , 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 Message-Id: <20210601175942.1920588-4-thierry.reding@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210601175942.1920588-1-thierry.reding@gmail.com> References: <20210601175942.1920588-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210601_105820_360174_DE7612F5 X-CRM114-Status: GOOD ( 16.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Thierry Reding 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 --- 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 {