From: Kartik <kkartik@nvidia.com>
To: <thierry.reding@gmail.com>, <jonathanh@nvidia.com>,
<sumitg@nvidia.com>, <arnd@arndb.de>, <pshete@nvidia.co>,
<andriy.shevchenko@linux.intel.com>, <kkartik@nvidia.com>,
<digetx@gmail.com>, <petlozup@nvidia.com>, <windhl@126.com>,
<frank.li@vivo.com>, <robh@kernel.org>, <stefank@nvidia.com>,
<pdeschrijver@nvidia.com>, <linux-tegra@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH 3/6] soc/tegra: fuse: Add function to add lookups
Date: Fri, 18 Aug 2023 15:00:25 +0530 [thread overview]
Message-ID: <20230818093028.7807-4-kkartik@nvidia.com> (raw)
In-Reply-To: <20230818093028.7807-1-kkartik@nvidia.com>
Add helper function tegra_fuse_add_lookups() to register Tegra fuse
nvmem lookups. So, this can be shared between tegra_fuse_init() and
ACPI probe, which is to be introduced later.
Signed-off-by: Kartik <kkartik@nvidia.com>
---
drivers/soc/tegra/fuse/fuse-tegra.c | 29 +++++++++++++++++++++++------
1 file changed, 23 insertions(+), 6 deletions(-)
diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
index 45784ac6393d..bbb1a5c4823b 100644
--- a/drivers/soc/tegra/fuse/fuse-tegra.c
+++ b/drivers/soc/tegra/fuse/fuse-tegra.c
@@ -148,6 +148,24 @@ static int tegra_fuse_nvmem_register(struct tegra_fuse *fuse,
return 0;
}
+static int tegra_fuse_add_lookups(struct tegra_fuse *fuse)
+{
+ size_t size;
+
+ if (!fuse->soc->lookups)
+ return 0;
+
+ size = sizeof(*fuse->lookups) * fuse->soc->num_lookups;
+
+ fuse->lookups = kmemdup(fuse->soc->lookups, size, GFP_KERNEL);
+ if (!fuse->lookups)
+ return -ENOMEM;
+
+ nvmem_add_cell_lookups(fuse->lookups, fuse->soc->num_lookups);
+
+ return 0;
+}
+
static int tegra_fuse_probe(struct platform_device *pdev)
{
void __iomem *base = fuse->base;
@@ -419,6 +437,7 @@ static int __init tegra_init_fuse(void)
const struct of_device_id *match;
struct device_node *np;
struct resource regs;
+ int err;
tegra_init_apbmisc();
@@ -516,12 +535,10 @@ static int __init tegra_init_fuse(void)
pr_debug("Tegra CPU Speedo ID %d, SoC Speedo ID %d\n",
tegra_sku_info.cpu_speedo_id, tegra_sku_info.soc_speedo_id);
- if (fuse->soc->lookups) {
- size_t size = sizeof(*fuse->lookups) * fuse->soc->num_lookups;
-
- fuse->lookups = kmemdup(fuse->soc->lookups, size, GFP_KERNEL);
- if (fuse->lookups)
- nvmem_add_cell_lookups(fuse->lookups, fuse->soc->num_lookups);
+ err = tegra_fuse_add_lookups(fuse);
+ if (err) {
+ pr_err("failed to add FUSE lookups\n");
+ return err;
}
return 0;
--
2.34.1
next prev parent reply other threads:[~2023-08-18 9:32 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-18 9:30 [PATCH 0/6] soc/tegra: fuse: Add ACPI support Kartik
2023-08-18 9:30 ` [PATCH 1/6] soc/tegra: fuse: Add tegra_acpi_init_apbmisc() Kartik
2023-08-18 13:21 ` Andy Shevchenko
2023-08-21 11:32 ` Kartik
2023-08-21 12:32 ` Andy Shevchenko
2023-08-22 7:52 ` Thierry Reding
2023-08-22 3:12 ` kernel test robot
2023-08-22 4:01 ` kernel test robot
2023-08-18 9:30 ` [PATCH 2/6] soc/tegra: fuse: Add function to register nvmem Kartik
2023-08-18 13:50 ` Andy Shevchenko
2023-08-21 11:34 ` Kartik
2023-08-18 9:30 ` Kartik [this message]
2023-08-18 14:06 ` [PATCH 3/6] soc/tegra: fuse: Add function to add lookups Andy Shevchenko
2023-08-21 11:36 ` Kartik
2023-08-18 9:30 ` [PATCH 4/6] soc/tegra: fuse: Add function to print SKU info Kartik
2023-08-22 7:55 ` Thierry Reding
2023-08-18 9:30 ` [PATCH 5/6] soc/tegra: fuse: Add ACPI support for Tegra194 and Tegra234 Kartik
2023-08-18 15:07 ` Andy Shevchenko
2023-08-21 11:38 ` Kartik
2023-08-21 12:45 ` Andy Shevchenko
2023-08-18 9:30 ` [PATCH 6/6] soc/tegra: fuse: Add support for Tegra241 Kartik
2023-08-18 15:10 ` Andy Shevchenko
2023-08-21 11:40 ` Kartik
2023-08-21 12:47 ` Andy Shevchenko
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=20230818093028.7807-4-kkartik@nvidia.com \
--to=kkartik@nvidia.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=digetx@gmail.com \
--cc=frank.li@vivo.com \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=pdeschrijver@nvidia.com \
--cc=petlozup@nvidia.com \
--cc=pshete@nvidia.co \
--cc=robh@kernel.org \
--cc=stefank@nvidia.com \
--cc=sumitg@nvidia.com \
--cc=thierry.reding@gmail.com \
--cc=windhl@126.com \
/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
Powered by JetHome