[PATCH 7/9] soc: sunxi: sram: Save a pointer to the OF match data
From: Samuel Holland
Date: Sun Jul 31 2022 - 23:06:28 EST
It is inefficient to match the compatible string every time the regmap
is accessed.
Signed-off-by: Samuel Holland <samuel@xxxxxxxxxxxx>
---
drivers/soc/sunxi/sunxi_sram.c | 6 +++---
1 file 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);
--
2.35.1