[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v5 05/16] xen/device-tree: Remove use of *_to_cpup() helpers
From: Lin Liu <lin.liu@xxxxxxxxxx> These wrappers simply hide a deference, which adds to the cognitive complexity of reading the code. As such, they're not going to be included in the new byteswap infrastructure. No functional change. Signed-off-by: Lin Liu <lin.liu@xxxxxxxxxx> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- CC: Anthony PERARD <anthony.perard@xxxxxxxxxx> CC: Michal Orzel <michal.orzel@xxxxxxx> CC: Jan Beulich <jbeulich@xxxxxxxx> CC: Julien Grall <julien@xxxxxxx> CC: Roger Pau Monné <roger.pau@xxxxxxxxxx> CC: Stefano Stabellini <sstabellini@xxxxxxxxxx> CC: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx> CC: Bertrand Marquis <bertrand.marquis@xxxxxxx> CC: Shawn Anastasio <sanastasio@xxxxxxxxxxxxxxxxxxxxx> CC: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx> CC: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx> CC: Lin Liu <lin.liu@xxxxxxxxxx> v5: * Rebase * Split out of later patch --- xen/common/device-tree/device-tree.c | 44 ++++++++++++++-------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/xen/common/device-tree/device-tree.c b/xen/common/device-tree/device-tree.c index e8f810b2fe10..90fee2ba0315 100644 --- a/xen/common/device-tree/device-tree.c +++ b/xen/common/device-tree/device-tree.c @@ -173,7 +173,7 @@ bool dt_property_read_u32(const struct dt_device_node *np, if ( !val || len < sizeof(*out_value) ) return 0; - *out_value = be32_to_cpup(val); + *out_value = be32_to_cpu(*val); return 1; } @@ -266,7 +266,7 @@ int dt_property_read_variable_u32_array(const struct dt_device_node *np, count = sz; while ( count-- ) - *out_values++ = be32_to_cpup(val++); + *out_values++ = be32_to_cpu(*val++); return sz; } @@ -493,7 +493,7 @@ static int __dt_n_addr_cells(const struct dt_device_node *np, bool parent) ip = dt_get_property(np, "#address-cells", NULL); if ( ip ) - return be32_to_cpup(ip); + return be32_to_cpu(*ip); } while ( np->parent ); /* No #address-cells property for the root node */ return DT_ROOT_NODE_ADDR_CELLS_DEFAULT; @@ -510,7 +510,7 @@ static int __dt_n_size_cells(const struct dt_device_node *np, bool parent) ip = dt_get_property(np, "#size-cells", NULL); if ( ip ) - return be32_to_cpup(ip); + return be32_to_cpu(*ip); } while ( np->parent ); /* No #address-cells property for the root node */ return DT_ROOT_NODE_SIZE_CELLS_DEFAULT; @@ -643,7 +643,7 @@ static void dt_bus_pci_count_cells(const struct dt_device_node *np, static unsigned int dt_bus_pci_get_flags(const __be32 *addr) { unsigned int flags = 0; - u32 w = be32_to_cpup(addr); + u32 w = be32_to_cpu(*addr); switch((w >> 24) & 0x03) { case 0x01: @@ -1096,7 +1096,7 @@ dt_irq_find_parent(const struct dt_device_node *child) if ( parp == NULL ) p = dt_get_parent(child); else - p = dt_find_node_by_phandle(be32_to_cpup(parp)); + p = dt_find_node_by_phandle(be32_to_cpu(*parp)); child = p; } while ( p && dt_get_property(p, "#interrupt-cells", NULL) == NULL ); @@ -1129,7 +1129,7 @@ unsigned int dt_number_of_irq(const struct dt_device_node *device) intlen /= sizeof(*intspec); dt_dprintk(" using 'interrupts' property\n"); - dt_dprintk(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen); + dt_dprintk(" intspec=%d intlen=%d\n", be32_to_cpu(*intspec), intlen); /* Look for the interrupt parent. */ p = dt_irq_find_parent(device); @@ -1260,7 +1260,7 @@ int dt_for_each_irq_map(const struct dt_device_node *dev, imaplen -= addrsize + intsize; /* Get the interrupt parent */ - ipar = dt_find_node_by_phandle(be32_to_cpup(imap)); + ipar = dt_find_node_by_phandle(be32_to_cpu(*imap)); imap++; --imaplen; @@ -1377,8 +1377,8 @@ static int dt_irq_map_raw(const struct dt_device_node *parent, int match, i; dt_dprintk("dt_irq_map_raw: par=%s,intspec=[0x%08x 0x%08x...],ointsize=%d\n", - parent->full_name, be32_to_cpup(intspec), - be32_to_cpup(intspec + 1), ointsize); + parent->full_name, be32_to_cpu(*intspec), + be32_to_cpu(*(intspec+1)), ointsize); ipar = parent; @@ -1490,7 +1490,7 @@ static int dt_irq_map_raw(const struct dt_device_node *parent, dt_dprintk(" -> match=%d (imaplen=%d)\n", match, imaplen); /* Get the interrupt parent */ - newpar = dt_find_node_by_phandle(be32_to_cpup(imap)); + newpar = dt_find_node_by_phandle(be32_to_cpu(*imap)); imap++; --imaplen; @@ -1584,7 +1584,7 @@ int dt_device_get_raw_irq(const struct dt_device_node *device, intlen /= sizeof(*intspec); dt_dprintk(" using 'interrupts' property\n"); - dt_dprintk(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen); + dt_dprintk(" intspec=%d intlen=%d\n", be32_to_cpu(*intspec), intlen); /* Look for the interrupt parent. */ p = dt_irq_find_parent(device); @@ -1695,7 +1695,7 @@ static int __dt_parse_phandle_with_args(const struct dt_device_node *np, * If phandle is 0, then it is an empty entry with no * arguments. Skip forward to the next entry. * */ - phandle = be32_to_cpup(list++); + phandle = be32_to_cpu(*list++); if ( phandle ) { /* @@ -1764,7 +1764,7 @@ static int __dt_parse_phandle_with_args(const struct dt_device_node *np, out_args->np = node; out_args->args_count = count; for ( i = 0; i < count; i++ ) - out_args->args[i] = be32_to_cpup(list++); + out_args->args[i] = be32_to_cpu(*list++); } /* Found it! return success */ @@ -1845,7 +1845,7 @@ static unsigned long unflatten_dt_node(const void *fdt, int has_name = 0; int new_format = 0; - tag = be32_to_cpup((__be32 *)(*p)); + tag = be32_to_cpu(*(__be32 *)(*p)); if ( tag != FDT_BEGIN_NODE ) { printk(XENLOG_WARNING "Weird tag at start of node: %x\n", tag); @@ -1938,7 +1938,7 @@ static unsigned long unflatten_dt_node(const void *fdt, u32 sz, noff; const char *pname; - tag = be32_to_cpup((__be32 *)(*p)); + tag = be32_to_cpu(*(__be32 *)(*p)); if ( tag == FDT_NOP ) { *p += 4; @@ -1947,8 +1947,8 @@ static unsigned long unflatten_dt_node(const void *fdt, if ( tag != FDT_PROP ) break; *p += 4; - sz = be32_to_cpup((__be32 *)(*p)); - noff = be32_to_cpup((__be32 *)((*p) + 4)); + sz = be32_to_cpu(*(__be32 *)(*p)); + noff = be32_to_cpu(*(__be32 *)((*p) + 4)); *p += 8; if ( fdt_version(fdt) < 0x10 ) *p = ROUNDUP(*p, sz >= 8 ? 8 : 4); @@ -1975,13 +1975,13 @@ static unsigned long unflatten_dt_node(const void *fdt, (strcmp(pname, "linux,phandle") == 0) ) { if ( np->phandle == 0 ) - np->phandle = be32_to_cpup((__be32*)*p); + np->phandle = be32_to_cpu(*(__be32*)*p); } /* And we process the "ibm,phandle" property * used in pSeries dynamic device tree * stuff */ if ( strcmp(pname, "ibm,phandle") == 0 ) - np->phandle = be32_to_cpup((__be32 *)*p); + np->phandle = be32_to_cpu(*(__be32 *)*p); pp->name = pname; pp->length = sz; pp->value = (void *)*p; @@ -2053,7 +2053,7 @@ static unsigned long unflatten_dt_node(const void *fdt, *p += 4; else mem = unflatten_dt_node(fdt, mem, p, np, allnextpp, fpsize); - tag = be32_to_cpup((__be32 *)(*p)); + tag = be32_to_cpu(*(__be32 *)(*p)); } if ( tag != FDT_END_NODE ) { @@ -2099,7 +2099,7 @@ int unflatten_device_tree(const void *fdt, struct dt_device_node **mynodes) /* Second pass, do actual unflattening */ start = ((unsigned long)fdt) + fdt_off_dt_struct(fdt); unflatten_dt_node(fdt, mem, &start, NULL, &allnextp, 0); - if ( be32_to_cpup((__be32 *)start) != FDT_END ) + if ( be32_to_cpu(*(__be32 *)start) != FDT_END ) { printk(XENLOG_ERR "Weird tag at end of tree: %08x\n", *((u32 *)start)); -- 2.39.5
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |