diff mbox series

[15/19] EDAC, ghes: Use standard kernel macros for page calculations

Message ID 20191010202418.25098-16-rrichter@marvell.com
State Superseded
Headers show
Series EDAC: Rework edac_mc and ghes drivers | expand

Commit Message

Robert Richter Oct. 10, 2019, 8:25 p.m. UTC
Use standard macros for page calculations.

Reviewed-by: James Morse <james.morse@arm.com>

Signed-off-by: Robert Richter <rrichter@marvell.com>

---
 drivers/edac/ghes_edac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.20.1

Comments

Mauro Carvalho Chehab Oct. 11, 2019, 11:10 a.m. UTC | #1
Em Thu, 10 Oct 2019 20:25:35 +0000
Robert Richter <rrichter@marvell.com> escreveu:

> Use standard macros for page calculations.

> 

> Reviewed-by: James Morse <james.morse@arm.com>

> Signed-off-by: Robert Richter <rrichter@marvell.com>


Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


> ---

>  drivers/edac/ghes_edac.c | 4 ++--

>  1 file changed, 2 insertions(+), 2 deletions(-)

> 

> diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c

> index 8078d4ec9631..851aad92e42d 100644

> --- a/drivers/edac/ghes_edac.c

> +++ b/drivers/edac/ghes_edac.c

> @@ -309,8 +309,8 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err)

>  

>  	/* Error address */

>  	if (mem_err->validation_bits & CPER_MEM_VALID_PA) {

> -		e->page_frame_number = mem_err->physical_addr >> PAGE_SHIFT;

> -		e->offset_in_page = mem_err->physical_addr & ~PAGE_MASK;

> +		e->page_frame_number = PHYS_PFN(mem_err->physical_addr);

> +		e->offset_in_page = offset_in_page(mem_err->physical_addr);

>  	}

>  

>  	/* Error grain */




Thanks,
Mauro
diff mbox series

Patch

diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c
index 8078d4ec9631..851aad92e42d 100644
--- a/drivers/edac/ghes_edac.c
+++ b/drivers/edac/ghes_edac.c
@@ -309,8 +309,8 @@  void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err)
 
 	/* Error address */
 	if (mem_err->validation_bits & CPER_MEM_VALID_PA) {
-		e->page_frame_number = mem_err->physical_addr >> PAGE_SHIFT;
-		e->offset_in_page = mem_err->physical_addr & ~PAGE_MASK;
+		e->page_frame_number = PHYS_PFN(mem_err->physical_addr);
+		e->offset_in_page = offset_in_page(mem_err->physical_addr);
 	}
 
 	/* Error grain */