EDAC: Use of_address_to_resource()
Subsystems (4)
PATCH 1/1 EDAC: Use of_address_to_resource()
Replace of_get_address() and of_translate_address() calls with single call to of_address_to_resource().
--- drivers/edac/altera_edac.c | 5 +++-- drivers/edac/ti_edac.c | 10 +++++----- 2 files changed, 8 insertions(+), 7 deletions(-)
drivers/edac/altera_edac.c +3 -2
@@ -1096,6 +1096,7 @@ static int altr_s10_sdram_check_ecc_deps(struct altr_edac_device_dev *device)struct arm_smccc_res result;struct device_node *np;phys_addr_t sdram_addr; +struct resource res;u32 read_reg;int ret;
@@ -1103,8 +1104,8 @@ static int altr_s10_sdram_check_ecc_deps(struct altr_edac_device_dev *device)if (!np) goto sdram_err; - sdram_addr =of_translate_address (np,of_get_address (np,0 , -NULL ,NULL )); +of_address_to_resource (np,0 , &res); + sdram_addr = res->start;of_node_put (np); sdram_ecc_addr = (unsigned long )sdram_addr + prv->ecc_en_ofst; arm_smccc_smc(INTEL_SIP_SMC_REG_READ, sdram_ecc_addr,
drivers/edac/ti_edac.c +5 -5
@@ -202,19 +202,19 @@ MODULE_DEVICE_TABLE(of, ti_edac_of_match);static int _emif_get_id (struct device_node *node) {struct device_node *np; -const __be32 *addrp; +struct resource res;u32 addr, my_addr;int my_id =0 ; - addrp =of_get_address (node,0 ,NULL ,NULL ); - my_addr = (u32 )of_translate_address (node, addrp); +of_address_to_resource (node,0 , &res); + my_addr = (u32 )res.start;for_each_matching_node (np, ti_edac_of_match) {if (np == node)continue ; - addrp =of_get_address (np,0 ,NULL ,NULL ); - addr = (u32 )of_translate_address (np, addrp); +of_address_to_resource (np,0 , &res); + addr = (u32 )res.start; edac_printk(KERN_INFO, EDAC_MOD_NAME, "addr=%x, my_addr=%x\n",
Signature · 1 line
2.39.2
kernel test robot
build botI love your patch! Yet something to improve:
Hi Rob,
I love your patch! Yet something to improve:
[auto build test ERROR on ras/edac-for-next]
[cannot apply to bp/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Rob-Herring/EDAC-Use-of_address_to_resource/20230320-003703 base: https://git.kernel.org/pub/scm/linux/kernel/git/ras/ras.git edac-for-next patch link: https://lore.kernel.org/r/20230319163224.226479-1-robh%40kernel.org patch subject: [PATCH] EDAC: Use of_address_to_resource() config: arm-allyesconfig (https://download.01.org/0day-ci/archive/20230320/[email protected]/config) compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/a128482ade3b4c37d55aa60604caf14e4570fbe5
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Rob-Herring/EDAC-Use-of_address_to_resource/20230320-003703 git checkout a128482ade3b4c37d55aa60604caf14e4570fbe5
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
drivers/edac/altera_edac.c: In function 'altr_s10_sdram_check_ecc_deps':
>> drivers/edac/altera_edac.c:1108:25: error: invalid type argument of '->' (have 'struct resource')
1108 | sdram_addr = res->start;
| ^~vim +1108 drivers/edac/altera_edac.c
1085
1086 /*
1087 * A legacy U-Boot bug only enabled memory mapped access to the ECC Enable
1088 * register if ECC is enabled. Linux checks the ECC Enable register to
1089 * determine ECC status.
1090 * Use an SMC call (which always works) to determine ECC enablement.
1091 */
1092 static int altr_s10_sdram_check_ecc_deps(struct altr_edac_device_dev *device)
1093 {
1094 const struct edac_device_prv_data *prv = device->data;
1095 unsigned long sdram_ecc_addr;
1096 struct arm_smccc_res result;
1097 struct device_node *np;
1098 phys_addr_t sdram_addr;
1099 struct resource res;
1100 u32 read_reg;
1101 int ret;
1102
1103 np = of_find_compatible_node(NULL, NULL, "altr,sdr-ctl");
1104 if (!np)
1105 goto sdram_err;
1106
1107 of_address_to_resource(np, 0, &res);
> 1108 sdram_addr = res->start;
1109 of_node_put(np);
1110 sdram_ecc_addr = (unsigned long)sdram_addr + prv->ecc_en_ofst;
1111 arm_smccc_smc(INTEL_SIP_SMC_REG_READ, sdram_ecc_addr,
1112 0, 0, 0, 0, 0, 0, &result);
1113 read_reg = (unsigned int)result.a1;
1114 ret = (int)result.a0;
1115 if (!ret && (read_reg & prv->ecc_enable_mask))
1116 return 0;
1117
1118 sdram_err:
1119 edac_printk(KERN_ERR, EDAC_DEVICE,
1120 "%s: No ECC present or ECC disabled.\n",
1121 device->edac_dev_name);
1122 return -ENODEV;
1123 }
1124
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests