Message ID | 1376687156-6737-11-git-send-email-julien.grall@linaro.org |
---|---|
State | Superseded, archived |
Headers | show |
On Fri, 2013-08-16 at 22:05 +0100, Julien Grall wrote: > The function device_get_reg will be removed in a future patch. Why? It appears to be a useful helper. > > Signed-off-by: Julien Grall <julien.grall@linaro.org> > --- > xen/common/device_tree.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c > index 95635f0..ea01a5a 100644 > --- a/xen/common/device_tree.c > +++ b/xen/common/device_tree.c > @@ -385,7 +385,7 @@ static void __init process_memory_node(const void *fdt, int node, > const struct fdt_property *prop; > int i; > int banks; > - const u32 *cell; > + const __be32 *cell; > paddr_t start, size; > > if ( address_cells < 1 || size_cells < 1 ) > @@ -402,12 +402,13 @@ static void __init process_memory_node(const void *fdt, int node, > return; > } > > - cell = (const u32 *)prop->data; > + cell = (const __be32 *)prop->data; > banks = device_tree_nr_reg_ranges(prop, address_cells, size_cells); > > for ( i = 0; i < banks && early_info.mem.nr_banks < NR_MEM_BANKS; i++ ) > { > - device_tree_get_reg(&cell, address_cells, size_cells, &start, &size); > + start = dt_next_cell(address_cells, &cell); > + size = dt_next_cell(size_cells, &cell); > early_info.mem.bank[early_info.mem.nr_banks].start = start; > early_info.mem.bank[early_info.mem.nr_banks].size = size; > early_info.mem.nr_banks++;
On 08/22/2013 02:23 PM, Ian Campbell wrote: > On Fri, 2013-08-16 at 22:05 +0100, Julien Grall wrote: >> The function device_get_reg will be removed in a future patch. > > Why? It appears to be a useful helper. This helper is only used in few places and can be replaced by: - dt_read_number because #address-cells and #size-cells have no meaning - 2 consecutive call to dt_next_cell - dt_get_address > >> >> Signed-off-by: Julien Grall <julien.grall@linaro.org> >> --- >> xen/common/device_tree.c | 7 ++++--- >> 1 file changed, 4 insertions(+), 3 deletions(-) >> >> diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c >> index 95635f0..ea01a5a 100644 >> --- a/xen/common/device_tree.c >> +++ b/xen/common/device_tree.c >> @@ -385,7 +385,7 @@ static void __init process_memory_node(const void *fdt, int node, >> const struct fdt_property *prop; >> int i; >> int banks; >> - const u32 *cell; >> + const __be32 *cell; >> paddr_t start, size; >> >> if ( address_cells < 1 || size_cells < 1 ) >> @@ -402,12 +402,13 @@ static void __init process_memory_node(const void *fdt, int node, >> return; >> } >> >> - cell = (const u32 *)prop->data; >> + cell = (const __be32 *)prop->data; >> banks = device_tree_nr_reg_ranges(prop, address_cells, size_cells); >> >> for ( i = 0; i < banks && early_info.mem.nr_banks < NR_MEM_BANKS; i++ ) >> { >> - device_tree_get_reg(&cell, address_cells, size_cells, &start, &size); >> + start = dt_next_cell(address_cells, &cell); >> + size = dt_next_cell(size_cells, &cell); >> early_info.mem.bank[early_info.mem.nr_banks].start = start; >> early_info.mem.bank[early_info.mem.nr_banks].size = size; >> early_info.mem.nr_banks++; > >
On Thu, 2013-08-22 at 14:54 +0100, Julien Grall wrote: > On 08/22/2013 02:23 PM, Ian Campbell wrote: > > On Fri, 2013-08-16 at 22:05 +0100, Julien Grall wrote: > >> The function device_get_reg will be removed in a future patch. > > > > Why? It appears to be a useful helper. > > This helper is only used in few places and can be replaced by: > - dt_read_number because #address-cells and #size-cells have no meaning > - 2 consecutive call to dt_next_cell It seemed like a helper for this case would remain useful, even if it isn't exactly device_get_reg. Up to you though. > - dt_get_address > > > > >> > >> Signed-off-by: Julien Grall <julien.grall@linaro.org> > >> --- > >> xen/common/device_tree.c | 7 ++++--- > >> 1 file changed, 4 insertions(+), 3 deletions(-) > >> > >> diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c > >> index 95635f0..ea01a5a 100644 > >> --- a/xen/common/device_tree.c > >> +++ b/xen/common/device_tree.c > >> @@ -385,7 +385,7 @@ static void __init process_memory_node(const void *fdt, int node, > >> const struct fdt_property *prop; > >> int i; > >> int banks; > >> - const u32 *cell; > >> + const __be32 *cell; > >> paddr_t start, size; > >> > >> if ( address_cells < 1 || size_cells < 1 ) > >> @@ -402,12 +402,13 @@ static void __init process_memory_node(const void *fdt, int node, > >> return; > >> } > >> > >> - cell = (const u32 *)prop->data; > >> + cell = (const __be32 *)prop->data; > >> banks = device_tree_nr_reg_ranges(prop, address_cells, size_cells); > >> > >> for ( i = 0; i < banks && early_info.mem.nr_banks < NR_MEM_BANKS; i++ ) > >> { > >> - device_tree_get_reg(&cell, address_cells, size_cells, &start, &size); > >> + start = dt_next_cell(address_cells, &cell); > >> + size = dt_next_cell(size_cells, &cell); > >> early_info.mem.bank[early_info.mem.nr_banks].start = start; > >> early_info.mem.bank[early_info.mem.nr_banks].size = size; > >> early_info.mem.nr_banks++; > > > > > >
diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c index 95635f0..ea01a5a 100644 --- a/xen/common/device_tree.c +++ b/xen/common/device_tree.c @@ -385,7 +385,7 @@ static void __init process_memory_node(const void *fdt, int node, const struct fdt_property *prop; int i; int banks; - const u32 *cell; + const __be32 *cell; paddr_t start, size; if ( address_cells < 1 || size_cells < 1 ) @@ -402,12 +402,13 @@ static void __init process_memory_node(const void *fdt, int node, return; } - cell = (const u32 *)prop->data; + cell = (const __be32 *)prop->data; banks = device_tree_nr_reg_ranges(prop, address_cells, size_cells); for ( i = 0; i < banks && early_info.mem.nr_banks < NR_MEM_BANKS; i++ ) { - device_tree_get_reg(&cell, address_cells, size_cells, &start, &size); + start = dt_next_cell(address_cells, &cell); + size = dt_next_cell(size_cells, &cell); early_info.mem.bank[early_info.mem.nr_banks].start = start; early_info.mem.bank[early_info.mem.nr_banks].size = size; early_info.mem.nr_banks++;
The function device_get_reg will be removed in a future patch. Signed-off-by: Julien Grall <julien.grall@linaro.org> --- xen/common/device_tree.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)