diff mbox series

[v2] EDAC: Use of_address_to_resource()

Message ID 20230327201411.529948-1-robh@kernel.org (mailing list archive)
State New, archived
Headers show
Series [v2] EDAC: Use of_address_to_resource() | expand

Commit Message

Rob Herring (Arm) March 27, 2023, 8:14 p.m. UTC
Replace of_get_address() and of_translate_address() calls with single
call to of_address_to_resource().

Signed-off-by: Rob Herring <robh@kernel.org>
---
v2:
 - Fix compile error
---
 drivers/edac/altera_edac.c |  5 +++--
 drivers/edac/ti_edac.c     | 10 +++++-----
 2 files changed, 8 insertions(+), 7 deletions(-)

Comments

Rob Herring (Arm) April 18, 2023, 4:40 p.m. UTC | #1
On Mon, Mar 27, 2023 at 03:14:11PM -0500, Rob Herring wrote:
> Replace of_get_address() and of_translate_address() calls with single
> call to of_address_to_resource().
> 
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
> v2:
>  - Fix compile error
> ---
>  drivers/edac/altera_edac.c |  5 +++--
>  drivers/edac/ti_edac.c     | 10 +++++-----
>  2 files changed, 8 insertions(+), 7 deletions(-)

Ping!

> 
> diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
> index e7e8e624a436..be33329c6f18 100644
> --- a/drivers/edac/altera_edac.c
> +++ b/drivers/edac/altera_edac.c
> @@ -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,
> diff --git a/drivers/edac/ti_edac.c b/drivers/edac/ti_edac.c
> index 6971ded598de..7befcf6c6637 100644
> --- a/drivers/edac/ti_edac.c
> +++ b/drivers/edac/ti_edac.c
> @@ -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",
> -- 
> 2.39.2
>
Dinh Nguyen April 24, 2023, 6:33 p.m. UTC | #2
On 4/18/23 11:40, Rob Herring wrote:
> On Mon, Mar 27, 2023 at 03:14:11PM -0500, Rob Herring wrote:
>> Replace of_get_address() and of_translate_address() calls with single
>> call to of_address_to_resource().
>>
>> Signed-off-by: Rob Herring <robh@kernel.org>
>> ---
>> v2:
>>   - Fix compile error
>> ---
>>   drivers/edac/altera_edac.c |  5 +++--
>>   drivers/edac/ti_edac.c     | 10 +++++-----
>>   2 files changed, 8 insertions(+), 7 deletions(-)
> 
> Ping!
> 

Acked-by: Dinh Nguyen <dinguyen@kernel.org>
diff mbox series

Patch

diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
index e7e8e624a436..be33329c6f18 100644
--- a/drivers/edac/altera_edac.c
+++ b/drivers/edac/altera_edac.c
@@ -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,
diff --git a/drivers/edac/ti_edac.c b/drivers/edac/ti_edac.c
index 6971ded598de..7befcf6c6637 100644
--- a/drivers/edac/ti_edac.c
+++ b/drivers/edac/ti_edac.c
@@ -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",