diff mbox series

[1/2] edac: cpc925: Drop unused memory size DT parsing

Message ID 20230319150141.67824-1-robh@kernel.org (mailing list archive)
State New, archived
Headers show
Series [1/2] edac: cpc925: Drop unused memory size DT parsing | expand

Commit Message

Rob Herring (Arm) March 19, 2023, 3:01 p.m. UTC
The 'total_mem' memory size is parsed from DT, but never used anywhere.
Just drop it as drivers shouldn't really do their own parsing of common
bindings, and memblock would be a better way to get memory size now
anyways.

Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/edac/cpc925_edac.c | 34 ----------------------------------
 1 file changed, 34 deletions(-)

Comments

Rob Herring (Arm) April 18, 2023, 4:05 p.m. UTC | #1
On Sun, Mar 19, 2023 at 10:01:40AM -0500, Rob Herring wrote:
> The 'total_mem' memory size is parsed from DT, but never used anywhere.
> Just drop it as drivers shouldn't really do their own parsing of common
> bindings, and memblock would be a better way to get memory size now
> anyways.
> 
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  drivers/edac/cpc925_edac.c | 34 ----------------------------------
>  1 file changed, 34 deletions(-)

Ping.

> 
> diff --git a/drivers/edac/cpc925_edac.c b/drivers/edac/cpc925_edac.c
> index 9797e6d60dde..ee193aae8e14 100644
> --- a/drivers/edac/cpc925_edac.c
> +++ b/drivers/edac/cpc925_edac.c
> @@ -263,7 +263,6 @@ enum brgctrl_bits {
>  /* Private structure for edac memory controller */
>  struct cpc925_mc_pdata {
>  	void __iomem *vbase;
> -	unsigned long total_mem;
>  	const char *name;
>  	int edac_idx;
>  };
> @@ -280,37 +279,6 @@ struct cpc925_dev_info {
>  	void (*check)(struct edac_device_ctl_info *edac_dev);
>  };
>  
> -/* Get total memory size from Open Firmware DTB */
> -static void get_total_mem(struct cpc925_mc_pdata *pdata)
> -{
> -	struct device_node *np = NULL;
> -	const unsigned int *reg, *reg_end;
> -	int len, sw, aw;
> -	unsigned long start, size;
> -
> -	np = of_find_node_by_type(NULL, "memory");
> -	if (!np)
> -		return;
> -
> -	aw = of_n_addr_cells(np);
> -	sw = of_n_size_cells(np);
> -	reg = (const unsigned int *)of_get_property(np, "reg", &len);
> -	reg_end = reg + len/4;
> -
> -	pdata->total_mem = 0;
> -	do {
> -		start = of_read_number(reg, aw);
> -		reg += aw;
> -		size = of_read_number(reg, sw);
> -		reg += sw;
> -		edac_dbg(1, "start 0x%lx, size 0x%lx\n", start, size);
> -		pdata->total_mem += size;
> -	} while (reg < reg_end);
> -
> -	of_node_put(np);
> -	edac_dbg(0, "total_mem 0x%lx\n", pdata->total_mem);
> -}
> -
>  static void cpc925_init_csrows(struct mem_ctl_info *mci)
>  {
>  	struct cpc925_mc_pdata *pdata = mci->pvt_info;
> @@ -321,8 +289,6 @@ static void cpc925_init_csrows(struct mem_ctl_info *mci)
>  	u32 mbmr, mbbar, bba, grain;
>  	unsigned long row_size, nr_pages, last_nr_pages = 0;
>  
> -	get_total_mem(pdata);
> -
>  	for (index = 0; index < mci->nr_csrows; index++) {
>  		mbmr = __raw_readl(pdata->vbase + REG_MBMR_OFFSET +
>  				   0x20 * index);
> -- 
> 2.39.2
>
diff mbox series

Patch

diff --git a/drivers/edac/cpc925_edac.c b/drivers/edac/cpc925_edac.c
index 9797e6d60dde..ee193aae8e14 100644
--- a/drivers/edac/cpc925_edac.c
+++ b/drivers/edac/cpc925_edac.c
@@ -263,7 +263,6 @@  enum brgctrl_bits {
 /* Private structure for edac memory controller */
 struct cpc925_mc_pdata {
 	void __iomem *vbase;
-	unsigned long total_mem;
 	const char *name;
 	int edac_idx;
 };
@@ -280,37 +279,6 @@  struct cpc925_dev_info {
 	void (*check)(struct edac_device_ctl_info *edac_dev);
 };
 
-/* Get total memory size from Open Firmware DTB */
-static void get_total_mem(struct cpc925_mc_pdata *pdata)
-{
-	struct device_node *np = NULL;
-	const unsigned int *reg, *reg_end;
-	int len, sw, aw;
-	unsigned long start, size;
-
-	np = of_find_node_by_type(NULL, "memory");
-	if (!np)
-		return;
-
-	aw = of_n_addr_cells(np);
-	sw = of_n_size_cells(np);
-	reg = (const unsigned int *)of_get_property(np, "reg", &len);
-	reg_end = reg + len/4;
-
-	pdata->total_mem = 0;
-	do {
-		start = of_read_number(reg, aw);
-		reg += aw;
-		size = of_read_number(reg, sw);
-		reg += sw;
-		edac_dbg(1, "start 0x%lx, size 0x%lx\n", start, size);
-		pdata->total_mem += size;
-	} while (reg < reg_end);
-
-	of_node_put(np);
-	edac_dbg(0, "total_mem 0x%lx\n", pdata->total_mem);
-}
-
 static void cpc925_init_csrows(struct mem_ctl_info *mci)
 {
 	struct cpc925_mc_pdata *pdata = mci->pvt_info;
@@ -321,8 +289,6 @@  static void cpc925_init_csrows(struct mem_ctl_info *mci)
 	u32 mbmr, mbbar, bba, grain;
 	unsigned long row_size, nr_pages, last_nr_pages = 0;
 
-	get_total_mem(pdata);
-
 	for (index = 0; index < mci->nr_csrows; index++) {
 		mbmr = __raw_readl(pdata->vbase + REG_MBMR_OFFSET +
 				   0x20 * index);