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>
This commit is contained in:
parent
460d9cb62f
commit
ee07b9056e
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue