Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp509723ybg; Tue, 9 Jun 2020 06:22:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyj8APEkh0OZPvfitpo1pLCDRLghKe+jYspjuIvgPZep59/EsOHosL86t/loEacp7xj7Aa7 X-Received: by 2002:a17:906:a2c5:: with SMTP id by5mr25414702ejb.492.1591708926149; Tue, 09 Jun 2020 06:22:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591708926; cv=none; d=google.com; s=arc-20160816; b=p9hRPwXrbmal0h/VgB4cgQDRKrWQ4zItazSn6b8HZbSUJ0PWUzHRtoiehh1nwgQMbo gtqdPFzUJI83PR32UEih8Xpx9xWrIoVU/KXhN9ev4+K5e+rAbGdkNH1GdFxzPgdvSpA9 NM8EpYyLHeAATbmhfFFEyRbTbodA481Es6rZzm3gzjpbfL17SFFv+nvTmGRYXEdOstVK t3AEiyf0zeiP2jH8gCKCCHv/HdzGk3Omxaw/79loz89fy0E5I0zuj1rhAd6sh4Ej5VpO IS0F49OBVA2iBm/MMB+99ilmBQbpFVh8YtJfPJFxqoWn3ZKT0hme51ci8ra38nGnmRWV NfcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=inyU7uvEHXWNKdXjhZ+FWQ4T48QVySmS07lzlxMPA2A=; b=AZUWPHOLTxGtaIsrjZlrhCif0vT9W1Mae4eANzu/qGgaxFozUIq1QQEQvfCqmXpaP/ wJCz6mk7EGA5mxWPIERCRZzsDt7A/cNQ1NncLmaXbS/9QHNe3m762zi+1rw68NJI6xns +z3jHczA2iRmvqZHp4w7QQnr5ZAuFvYV8wa/Fw5afUcO5bvbmkBND6RrcaahFqK//xWw xREqkawyyw5PQvL35e9ITRTuqfxBg0w92opfRjGKvRH3lIZvSNsxZiRXRQXqDzgsuV4F X6akd+c3JGGcE2sLV7FnHRI2doGZRO+zVvqDXYthx/TuiJXET6C7V1XZQhppnrGJHhBg fG7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nG0smshM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id do15si16801734ejc.430.2020.06.09.06.21.41; Tue, 09 Jun 2020 06:22:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nG0smshM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730177AbgFINSm (ORCPT + 99 others); Tue, 9 Jun 2020 09:18:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728934AbgFINOd (ORCPT ); Tue, 9 Jun 2020 09:14:33 -0400 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5DF6C08C5C3; Tue, 9 Jun 2020 06:14:32 -0700 (PDT) Received: by mail-lj1-x241.google.com with SMTP id a9so21429565ljn.6; Tue, 09 Jun 2020 06:14:32 -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=inyU7uvEHXWNKdXjhZ+FWQ4T48QVySmS07lzlxMPA2A=; b=nG0smshMQaIEGwEl6n7reFqzXxM/XiBGrPpeUPtourd0l6otgnwUTjl9dqe6oNfhNf 0irvV2vMmxLa434Rf5krdH0owV9KrmNbNVKh+ep+r0c4F7zFUUilRCCkA8gxghoh6X/H BH8RsoJY1g+fMlK61IYak4x/WcCmZv6rlHNMY76o0uK/bIZtWA2GcrnsD5H21pOJGolV SPNVTz38VxE0tFWFecoqxLb0mWE3Uf49qhc29zOXjxzWjyFySISOQ/iBvbzowW3a0NEs 1TtvU/Qf4sFkmulR8FmrB0jL2xVBmdR2F2DC+GhpHt2c5n5jwbfNrRmoxF/f8+Cs1AI5 d+nQ== 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=inyU7uvEHXWNKdXjhZ+FWQ4T48QVySmS07lzlxMPA2A=; b=VJWdXXX59p3EMEKCSK9N4RVbpAKQPpp1F8hFF8JX5E/4H7x4TC6+2Ct8uGatfsRjGp w8LJT4FWa3HA1qHazyy1ujSyEbWxESn2y1mBRJ7XuhWlk0kRU2X3m5JY1X8w+X9VnI4p mBWgpWwoAILNk/7544zPfbarcHKc99k0Q7sG0lv76mkpVyiwlzxFQU1K72gYRpSMgc1K vn/Y0U5B5luKnX0q79lQbL4qbsG7f1mYd7fPtdkfoJGz9JboAAhEwH/OdMnW9w7QRbkb LzhuS640HKJnaMUP+34yFVpuBVOaXbvckg4lP48hwOTgSGmXNxMKK73/f4gf11aNNmef PZ0Q== X-Gm-Message-State: AOAM532XC+mvLskNEV/Xx6mrrKjYF1Vgl0gCYOczpRZ4tMuDgIhkH29H pOKOU6E7HZpyfcGsWDJ8jTY= X-Received: by 2002:a2e:140a:: with SMTP id u10mr13836531ljd.56.1591708470988; Tue, 09 Jun 2020 06:14:30 -0700 (PDT) Received: from localhost.localdomain (79-139-237-54.dynamic.spd-mgts.ru. [79.139.237.54]) by smtp.gmail.com with ESMTPSA id l22sm4323522lji.120.2020.06.09.06.14.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 06:14:30 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Georgi Djakov , Rob Herring , Michael Turquette , Stephen Boyd , Peter De Schrijver , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Mikko Perttunen Cc: =?UTF-8?q?Artur=20=C5=9Awigo=C5=84?= , linux-tegra@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org Subject: [PATCH v4 05/37] memory: tegra30-emc: Make driver modular Date: Tue, 9 Jun 2020 16:13:32 +0300 Message-Id: <20200609131404.17523-6-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200609131404.17523-1-digetx@gmail.com> References: <20200609131404.17523-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds modularization support to the Tegra30 EMC driver. Driver now can be compiled as a loadable kernel module. Signed-off-by: Dmitry Osipenko --- drivers/memory/tegra/Kconfig | 2 +- drivers/memory/tegra/mc.c | 3 +++ drivers/memory/tegra/tegra30-emc.c | 17 ++++++++++++----- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/drivers/memory/tegra/Kconfig b/drivers/memory/tegra/Kconfig index 7e0e1ef87763..bd453de9d446 100644 --- a/drivers/memory/tegra/Kconfig +++ b/drivers/memory/tegra/Kconfig @@ -18,7 +18,7 @@ config TEGRA20_EMC external memory. config TEGRA30_EMC - bool "NVIDIA Tegra30 External Memory Controller driver" + tristate "NVIDIA Tegra30 External Memory Controller driver" default y depends on TEGRA_MC && ARCH_TEGRA_3x_SOC help diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c index ec8403557ed4..772aa021b5f6 100644 --- a/drivers/memory/tegra/mc.c +++ b/drivers/memory/tegra/mc.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -298,6 +299,7 @@ int tegra_mc_write_emem_configuration(struct tegra_mc *mc, unsigned long rate) return 0; } +EXPORT_SYMBOL_GPL(tegra_mc_write_emem_configuration); unsigned int tegra_mc_get_emem_device_count(struct tegra_mc *mc) { @@ -309,6 +311,7 @@ unsigned int tegra_mc_get_emem_device_count(struct tegra_mc *mc) return dram_count; } +EXPORT_SYMBOL_GPL(tegra_mc_get_emem_device_count); static int load_one_timing(struct tegra_mc *mc, struct tegra_mc_timing *timing, diff --git a/drivers/memory/tegra/tegra30-emc.c b/drivers/memory/tegra/tegra30-emc.c index 055af0e08a2e..85d4effb8e6f 100644 --- a/drivers/memory/tegra/tegra30-emc.c +++ b/drivers/memory/tegra/tegra30-emc.c @@ -1343,6 +1343,13 @@ static int tegra_emc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, emc); tegra_emc_debugfs_init(emc); + /* + * Don't allow the kernel module to be unloaded. Unloading adds some + * extra complexity which doesn't really worth the effort in a case of + * this driver. + */ + try_module_get(THIS_MODULE); + return 0; unset_cb: @@ -1393,6 +1400,7 @@ static const struct of_device_id tegra_emc_of_match[] = { { .compatible = "nvidia,tegra30-emc", }, {}, }; +MODULE_DEVICE_TABLE(of, tegra_emc_of_match); static struct platform_driver tegra_emc_driver = { .probe = tegra_emc_probe, @@ -1403,9 +1411,8 @@ static struct platform_driver tegra_emc_driver = { .suppress_bind_attrs = true, }, }; +module_platform_driver(tegra_emc_driver); -static int __init tegra_emc_init(void) -{ - return platform_driver_register(&tegra_emc_driver); -} -subsys_initcall(tegra_emc_init); +MODULE_AUTHOR("Dmitry Osipenko "); +MODULE_DESCRIPTION("NVIDIA Tegra30 EMC driver"); +MODULE_LICENSE("GPL v2"); -- 2.26.0