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

memory: stm32_omm: Use syscon_regmap_lookup_by_phandle_args

Use syscon_regmap_lookup_by_phandle_args() which is a wrapper over
syscon_regmap_lookup_by_phandle() combined with getting the syscon
argument. Except simpler code this annotates within one line that given
phandle has arguments, so grepping for code would be easier.

Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Link: https://lore.kernel.org/r/20250525191300.50873-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

+6 -15
+6 -15
drivers/memory/stm32_omm.c
··· 46 46 struct regmap *syscfg_regmap; 47 47 struct device_node *node; 48 48 struct resource res, res1; 49 - u32 amcr_base, amcr_mask; 49 + unsigned int syscon_args[2]; 50 50 int ret, idx; 51 51 unsigned int i, amcr, read_amcr; 52 52 ··· 98 98 of_node_put(node); 99 99 } 100 100 101 - syscfg_regmap = syscon_regmap_lookup_by_phandle(dev->of_node, "st,syscfg-amcr"); 101 + syscfg_regmap = syscon_regmap_lookup_by_phandle_args(dev->of_node, "st,syscfg-amcr", 102 + 2, syscon_args); 102 103 if (IS_ERR(syscfg_regmap)) 103 104 return dev_err_probe(dev, PTR_ERR(syscfg_regmap), 104 105 "Failed to get st,syscfg-amcr property\n"); 105 106 106 - ret = of_property_read_u32_index(dev->of_node, "st,syscfg-amcr", 1, 107 - &amcr_base); 108 - if (ret) 109 - return ret; 110 - 111 - ret = of_property_read_u32_index(dev->of_node, "st,syscfg-amcr", 2, 112 - &amcr_mask); 113 - if (ret) 114 - return ret; 115 - 116 107 amcr = mm_ospi2_size / SZ_64M; 117 108 118 109 if (set) 119 - regmap_update_bits(syscfg_regmap, amcr_base, amcr_mask, amcr); 110 + regmap_update_bits(syscfg_regmap, syscon_args[0], syscon_args[1], amcr); 120 111 121 112 /* read AMCR and check coherency with memory-map areas defined in DT */ 122 - regmap_read(syscfg_regmap, amcr_base, &read_amcr); 123 - read_amcr = read_amcr >> (ffs(amcr_mask) - 1); 113 + regmap_read(syscfg_regmap, syscon_args[0], &read_amcr); 114 + read_amcr = read_amcr >> (ffs(syscon_args[1]) - 1); 124 115 125 116 if (amcr != read_amcr) { 126 117 dev_err(dev, "AMCR value not coherent with DT memory-map areas\n");