Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

soc/tegra: fuse: Add function to add lookups

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.

Use kmemdup_array to duplicate fuse->soc->lookups.

Signed-off-by: Kartik <kkartik@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>

authored by

Kartik and committed by
Thierry Reding
71661c1c 7b0c505e

+17 -8
+17 -8
drivers/soc/tegra/fuse/fuse-tegra.c
··· 113 113 fuse->clk = NULL; 114 114 } 115 115 116 + static int tegra_fuse_add_lookups(struct tegra_fuse *fuse) 117 + { 118 + fuse->lookups = kmemdup_array(fuse->soc->lookups, sizeof(*fuse->lookups), 119 + fuse->soc->num_lookups, GFP_KERNEL); 120 + if (!fuse->lookups) 121 + return -ENOMEM; 122 + 123 + nvmem_add_cell_lookups(fuse->lookups, fuse->soc->num_lookups); 124 + 125 + return 0; 126 + } 127 + 116 128 static int tegra_fuse_probe(struct platform_device *pdev) 117 129 { 118 130 void __iomem *base = fuse->base; ··· 410 398 const struct of_device_id *match; 411 399 struct device_node *np; 412 400 struct resource regs; 401 + int err; 413 402 414 403 tegra_init_apbmisc(); 415 404 ··· 508 495 pr_debug("Tegra CPU Speedo ID %d, SoC Speedo ID %d\n", 509 496 tegra_sku_info.cpu_speedo_id, tegra_sku_info.soc_speedo_id); 510 497 511 - if (fuse->soc->lookups) { 512 - size_t size = sizeof(*fuse->lookups) * fuse->soc->num_lookups; 498 + err = tegra_fuse_add_lookups(fuse); 499 + if (err) 500 + pr_err("failed to add FUSE lookups\n"); 513 501 514 - fuse->lookups = kmemdup(fuse->soc->lookups, size, GFP_KERNEL); 515 - if (fuse->lookups) 516 - nvmem_add_cell_lookups(fuse->lookups, fuse->soc->num_lookups); 517 - } 518 - 519 - return 0; 502 + return err; 520 503 } 521 504 early_initcall(tegra_init_fuse); 522 505