summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2022-08-14 23:12:45 -0500
committerJernej Skrabec <jernej.skrabec@gmail.com>2022-09-18 22:54:25 +0200
commitee07b9056e3e7cac6d13e0177b6c8cd9ce8a9c5f (patch)
treeb438d5ab285bd259c437316cd4270ff5ac67a7e0 /drivers
parent460d9cb62f7fe82cc835d6b3924a8d06fd2d510a (diff)
downloadlinux-ee07b9056e3e7cac6d13e0177b6c8cd9ce8a9c5f.tar.gz
linux-ee07b9056e3e7cac6d13e0177b6c8cd9ce8a9c5f.tar.bz2
linux-ee07b9056e3e7cac6d13e0177b6c8cd9ce8a9c5f.zip
soc: sunxi: sram: Save a pointer to the OF match data
It is inefficient to match the compatible string every time the regmap is accessed. Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Tested-by: Heiko Stuebner <heiko@sntech.de> Link: https://lore.kernel.org/r/20220815041248.53268-9-samuel@sholland.org Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/soc/sunxi/sunxi_sram.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c
index 9622fd45f5e5..7c6fb17cfe7f 100644
--- a/drivers/soc/sunxi/sunxi_sram.c
+++ b/drivers/soc/sunxi/sunxi_sram.c
@@ -305,9 +305,7 @@ static const struct sunxi_sramc_variant sun50i_h616_sramc_variant = {
static bool sunxi_sram_regmap_accessible_reg(struct device *dev,
unsigned int reg)
{
- const struct sunxi_sramc_variant *variant;
-
- variant = of_device_get_match_data(dev);
+ const struct sunxi_sramc_variant *variant = dev_get_drvdata(dev);
if (reg < SUNXI_SRAM_EMAC_CLOCK_REG)
return false;
@@ -340,6 +338,8 @@ static int __init sunxi_sram_probe(struct platform_device *pdev)
if (!variant)
return -EINVAL;
+ dev_set_drvdata(dev, (struct sunxi_sramc_variant *)variant);
+
base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base))
return PTR_ERR(base);