of: use pr_fmt prefix for all console printing
Rob Herring
maintainerPATCH 1/1 of: use pr_fmt prefix for all console printing
Clean-up all the DT printk functions to use common pr_fmt prefix.
Some print statements such as kmalloc errors were redundant, so just drop those.
--- drivers/of/address.c | 49 ++++++++++++++++++++++---------------------- drivers/of/base.c | 11 ++++++---- drivers/of/dynamic.c | 47 +++++++++++++++++++++--------------------- drivers/of/fdt.c | 12 +++++------ drivers/of/fdt_address.c | 35 ++++++++++++++++--------------- drivers/of/irq.c | 2 ++ drivers/of/of_numa.c | 22 ++++++-------------- drivers/of/of_pci.c | 6 ++++-- drivers/of/of_reserved_mem.c | 22 ++++++++++---------- drivers/of/overlay.c | 43 +++++++++++++++----------------------- drivers/of/platform.c | 16 +++++++-------- drivers/of/resolver.c | 2 ++ 12 files changed, 130 insertions(+), 137 deletions(-)
drivers/of/address.c +25 -24
@@ -1,4 +1,6 @@ +#define pr_fmt (fmt) "OF: " fmt +#include <linux/device.h> #include <linux/io.h> #include <linux/ioport.h>
@@ -24,10 +26,10 @@ static int __of_address_to_resource(struct device_node *dev,#ifdef DEBUG static void of_dump_addr (const char *s,const __be32 *addr,int na) { -printk (KERN_DEBUG "%s" , s); +pr_debug ("%s" , s);while (na--) -printk (" %08x" ,be32_to_cpu (*(addr++))); -printk ("\n" ); +pr_cont (" %08x" ,be32_to_cpu (*(addr++))); +pr_cont ("\n" ); }#else static void of_dump_addr (const char *s,const __be32 *addr,int na) { }
@@ -68,7 +70,7 @@ static u64 of_bus_default_map(__be32 *addr, const __be32 *range, s =of_read_number (range + na + pna, ns); da =of_read_number (addr, na); -pr_debug ("OF: default map, cp=%llx, s=%llx, da=%llx\n" , +pr_debug ("default map, cp=%llx, s=%llx, da=%llx\n" , (unsigned long long )cp, (unsigned long long )s, (unsigned long long )da);
@@ -156,7 +158,7 @@ static u64 of_bus_pci_map(__be32 *addr, const __be32 *range, int na, int ns, s =of_read_number (range + na + pna, ns); da =of_read_number (addr +1 , na -1 ); -pr_debug ("OF: PCI map, cp=%llx, s=%llx, da=%llx\n" , +pr_debug ("PCI map, cp=%llx, s=%llx, da=%llx\n" , (unsigned long long )cp, (unsigned long long )s, (unsigned long long )da);
@@ -381,7 +383,7 @@ static u64 of_bus_isa_map(__be32 *addr, const __be32 *range, int na, int ns, s =of_read_number (range + na + pna, ns); da =of_read_number (addr +1 , na -1 ); -pr_debug ("OF: ISA map, cp=%llx, s=%llx, da=%llx\n" , +pr_debug ("ISA map, cp=%llx, s=%llx, da=%llx\n" , (unsigned long long )cp, (unsigned long long )s, (unsigned long long )da);
@@ -504,17 +506,17 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,*/ ranges =of_get_property (parent, rprop, &rlen);if (ranges ==NULL && !of_empty_ranges_quirk (parent)) { -pr_debug ("OF: no ranges; cannot translate\n" ); +pr_debug ("no ranges; cannot translate\n" );return 1 ; }if (ranges ==NULL || rlen ==0 ) { offset =of_read_number (addr, na);memset (addr,0 , pna *4 ); -pr_debug ("OF: empty ranges; 1:1 translation\n" ); +pr_debug ("empty ranges; 1:1 translation\n" ); goto finish; } -pr_debug ("OF: walking ranges...\n" ); +pr_debug ("walking ranges...\n" );/* Now walk through the ranges */ rlen /=4 ;
@@ -525,14 +527,14 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,break ; }if (offset ==OF_BAD_ADDR ) { -pr_debug ("OF: not found !\n" ); +pr_debug ("not found !\n" );return 1 ; }memcpy (addr, ranges + na,4 * pna); finish: -of_dump_addr ("OF: parent translation for:" , addr, pna); -pr_debug ("OF: with offset: %llx\n" , (unsigned long long )offset); +of_dump_addr ("parent translation for:" , addr, pna); +pr_debug ("with offset: %llx\n" , (unsigned long long )offset);/* Translate it into parent bus space */ return pbus->translate (addr, offset, pna);
@@ -557,7 +559,7 @@ static u64 __of_translate_address(struct device_node *dev,int na, ns, pna, pns;u64 result =OF_BAD_ADDR ; -pr_debug ("OF: ** translation for device %s **\n" ,of_node_full_name (dev)); +pr_debug ("** translation for device %s **\n" ,of_node_full_name (dev));/* Increase refcount at current level */ of_node_get (dev);
@@ -571,14 +573,14 @@ static u64 __of_translate_address(struct device_node *dev,/* Count address cells & copy address locally */ bus->count_cells (dev, &na, &ns);if (!OF_CHECK_COUNTS (na, ns)) { -pr_debug ("OF: Bad cell count for %s\n" ,of_node_full_name (dev)); +pr_debug ("Bad cell count for %s\n" ,of_node_full_name (dev)); goto bail; }memcpy (addr, in_addr, na *4 ); -pr_debug ("OF: bus is %s (na=%d, ns=%d) on %s\n" , +pr_debug ("bus is %s (na=%d, ns=%d) on %s\n" , bus->name, na, ns,of_node_full_name (parent)); -of_dump_addr ("OF: translating address:" , addr, na); +of_dump_addr ("translating address:" , addr, na);/* Translate */ for (;;) {
@@ -589,7 +591,7 @@ static u64 __of_translate_address(struct device_node *dev,/* If root, we have finished */ if (parent ==NULL ) { -pr_debug ("OF: reached root node\n" ); +pr_debug ("reached root node\n" ); result =of_read_number (addr, na);break ; }
@@ -598,12 +600,12 @@ static u64 __of_translate_address(struct device_node *dev, pbus =of_match_bus (parent); pbus->count_cells (dev, &pna, &pns);if (!OF_CHECK_COUNTS (pna, pns)) { -pr_err ("prom_parse: Bad cell count for %s\n" , +pr_err ("Bad cell count for %s\n" ,of_node_full_name (dev));break ; } -pr_debug ("OF: parent bus is %s (na=%d, ns=%d) on %s\n" , +pr_debug ("parent bus is %s (na=%d, ns=%d) on %s\n" , pbus->name, pna, pns,of_node_full_name (parent));/* Apply bus translation */
@@ -615,7 +617,7 @@ static u64 __of_translate_address(struct device_node *dev, ns = pns; bus = pbus; -of_dump_addr ("OF: one level translation:" , addr, na); +of_dump_addr ("one level translation:" , addr, na); } bail:of_node_put (parent);
@@ -853,8 +855,7 @@ int of_dma_get_range(struct device_node *np, u64 *dma_addr, u64 *paddr, u64 *siz }if (!ranges) { -pr_debug ("%s: no dma-ranges found for node(%s)\n" , - __func__, np->full_name); +pr_debug ("no dma-ranges found for node(%s)\n" , np->full_name); ret = -ENODEV ; goto out; }
@@ -871,8 +872,8 @@ int of_dma_get_range(struct device_node *np, u64 *dma_addr, u64 *paddr, u64 *siz dmaaddr =of_read_number (ranges, naddr); *paddr =of_translate_dma_address (np, ranges);if (*paddr ==OF_BAD_ADDR ) { -pr_err ("%s: translation of DMA address(%pad) to CPU address failed node(%s)\n" , - __func__, dma_addr, np->full_name); +pr_err ("translation of DMA address(%pad) to CPU address failed node(%s)\n" , + dma_addr, np->full_name); ret = -EINVAL ; goto out; }
drivers/of/base.c +7 -4
@@ -17,6 +17,9 @@* as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ + +#define pr_fmt (fmt) "OF: " fmt +#include <linux/console.h> #include <linux/ctype.h> #include <linux/cpu.h>
@@ -127,7 +130,7 @@ static const char *safe_name(struct kobject *kobj, const char *orig_name) }if (name != orig_name) -pr_warn ("device-tree: Duplicate name in %s, renamed to \"%s\"\n" , +pr_warn ("Duplicate name in %s, renamed to \"%s\"\n" ,kobject_name (kobj), name);return name; }
@@ -198,7 +201,7 @@ void __init of_core_init(void) of_kset =kset_create_and_add ("devicetree" ,NULL , firmware_kobj);if (!of_kset) {mutex_unlock (&of_mutex); -pr_err ("devicetree: failed to register existing nodes\n" ); +pr_err ("failed to register existing nodes\n" );return ; }for_each_of_allnodes (np)
@@ -2257,8 +2260,8 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,of_node_put (node);if (!port) { -pr_err ("%s(): no port node found in %s\n" , - __func__, parent->full_name); +pr_err ("graph: no port node found in %s\n" , + parent->full_name);return NULL ; } }else {
drivers/of/dynamic.c +24 -23
150 lines not on this page · raw message
drivers/of/fdt.c +6 -6
@@ -9,6 +9,8 @@* version 2 as published by the Free Software Foundation. */ +#define pr_fmt (fmt) "OF: fdt:" fmt +#include <linux/crc32.h> #include <linux/kernel.h> #include <linux/initrd.h>
@@ -182,14 +184,12 @@ static void populate_properties(const void *blob, val =fdt_getprop_by_offset (blob, cur, &pname, &sz);if (!val) { -pr_warn ("%s: Cannot locate property at 0x%x\n" , - __func__, cur); +pr_warn ("Cannot locate property at 0x%x\n" , cur);continue ; }if (!pname) { -pr_warn ("%s: Cannot find property name at 0x%x\n" , - __func__, cur); +pr_warn ("Cannot find property name at 0x%x\n" , cur);continue ; }
@@ -428,7 +428,7 @@ static int unflatten_dt_nodes(const void *blob, }if (offset <0 && offset != -FDT_ERR_NOTFOUND ) { -pr_err ("%s: Error %d processing FDT\n" , __func__, offset); +pr_err ("Error %d processing FDT\n" , offset);return -EINVAL ; }
@@ -1270,7 +1270,7 @@ static int __init of_fdt_raw_init(void)if (of_fdt_crc32 !=crc32_be (~0 , initial_boot_params,fdt_totalsize (initial_boot_params))) { -pr_warn ("fdt: not creating '/sys/firmware/fdt': CRC check failed\n" ); +pr_warn ("not creating '/sys/firmware/fdt': CRC check failed\n" );return 0 ; } of_fdt_raw_attr.size =fdt_totalsize (initial_boot_params);
drivers/of/fdt_address.c +19 -16
@@ -12,6 +12,9 @@* the Free Software Foundation; either version 2, or (at your option) * any later version. */ + +#define pr_fmt (fmt) "OF: fdt: " fmt +#include <linux/kernel.h> #include <linux/libfdt.h> #include <linux/of.h>
@@ -30,7 +33,7 @@ static void __init of_dump_addr(const char *s, const __be32 *addr, int na)pr_debug ("%s" , s);while (na--)pr_cont (" %08x" , *(addr++)); - pr_debug("\n"); + pr_cont("\n"); }#else static void __init of_dump_addr (const char *s,const __be32 *addr,int na) { }
@@ -77,7 +80,7 @@ static u64 __init fdt_bus_default_map(__be32 *addr, const __be32 *range, s =of_read_number (range + na + pna, ns); da =of_read_number (addr, na); -pr_debug ("FDT: default map, cp=%llx, s=%llx, da=%llx\n" , +pr_debug ("default map, cp=%llx, s=%llx, da=%llx\n" , cp, s, da);if (da < cp || da >= (cp + s))
@@ -123,11 +126,11 @@ static int __init fdt_translate_one(const void *blob, int parent,if (rlen ==0 ) { offset =of_read_number (addr, na);memset (addr,0 , pna *4 ); -pr_debug ("FDT: empty ranges, 1:1 translation\n" ); +pr_debug ("empty ranges, 1:1 translation\n" ); goto finish; } -pr_debug ("FDT: walking ranges...\n" ); +pr_debug ("walking ranges...\n" );/* Now walk through the ranges */ rlen /=4 ;
@@ -138,14 +141,14 @@ static int __init fdt_translate_one(const void *blob, int parent,break ; }if (offset ==OF_BAD_ADDR ) { -pr_debug ("FDT: not found !\n" ); +pr_debug ("not found !\n" );return 1 ; }memcpy (addr, ranges + na,4 * pna); finish: -of_dump_addr ("FDT: parent translation for:" , addr, pna); -pr_debug ("FDT: with offset: %llx\n" , offset); +of_dump_addr ("parent translation for:" , addr, pna); +pr_debug ("with offset: %llx\n" , offset);/* Translate it into parent bus space */ return pbus->translate (addr, offset, pna);
@@ -170,12 +173,12 @@ static u64 __init fdt_translate_address(const void *blob, int node_offset)int na, ns, pna, pns;u64 result =OF_BAD_ADDR ; -pr_debug ("FDT: ** translation for device %s **\n" , +pr_debug ("** translation for device %s **\n" ,fdt_get_name (blob, node_offset,NULL )); reg =fdt_getprop (blob, node_offset,"reg" , &len);if (!reg) { -pr_err ("FDT: warning: device tree node '%s' has no address.\n" , +pr_err ("warning: device tree node '%s' has no address.\n" ,fdt_get_name (blob, node_offset,NULL )); goto bail; }
@@ -189,15 +192,15 @@ static u64 __init fdt_translate_address(const void *blob, int node_offset)/* Cound address cells & copy address locally */ bus->count_cells (blob, parent, &na, &ns);if (!OF_CHECK_COUNTS (na, ns)) { -pr_err ("FDT: Bad cell count for %s\n" , +pr_err ("Bad cell count for %s\n" ,fdt_get_name (blob, node_offset,NULL )); goto bail; }memcpy (addr, reg, na *4 ); -pr_debug ("FDT: bus (na=%d, ns=%d) on %s\n" , +pr_debug ("bus (na=%d, ns=%d) on %s\n" , na, ns,fdt_get_name (blob, parent,NULL )); -of_dump_addr ("OF: translating address:" , addr, na); +of_dump_addr ("translating address:" , addr, na);/* Translate */ for (;;) {
@@ -207,7 +210,7 @@ static u64 __init fdt_translate_address(const void *blob, int node_offset)/* If root, we have finished */ if (parent <0 ) { -pr_debug ("FDT: reached root node\n" ); +pr_debug ("reached root node\n" ); result =of_read_number (addr, na);break ; }
@@ -216,12 +219,12 @@ static u64 __init fdt_translate_address(const void *blob, int node_offset) pbus = &of_busses[0 ]; pbus->count_cells (blob, parent, &pna, &pns);if (!OF_CHECK_COUNTS (pna, pns)) { -pr_err ("FDT: Bad cell count for %s\n" , +pr_err ("Bad cell count for %s\n" ,fdt_get_name (blob, node_offset,NULL ));break ; } -pr_debug ("FDT: parent bus (na=%d, ns=%d) on %s\n" , +pr_debug ("parent bus (na=%d, ns=%d) on %s\n" , pna, pns,fdt_get_name (blob, parent,NULL ));/* Apply bus translation */
@@ -234,7 +237,7 @@ static u64 __init fdt_translate_address(const void *blob, int node_offset) ns = pns; bus = pbus; -of_dump_addr ("FDT: one level translation:" , addr, na); +of_dump_addr ("one level translation:" , addr, na); } bail:return result;
drivers/of/irq.c +2 -0
@@ -18,6 +18,8 @@* driver. */ +#define pr_fmt (fmt) "OF: " fmt +#include <linux/device.h> #include <linux/errno.h> #include <linux/list.h>
drivers/of/of_numa.c +6 -16
@@ -16,6 +16,8 @@* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#define pr_fmt (fmt) "OF: " fmt +#include <linux/of.h> #include <linux/of_address.h> #include <linux/nodemask.h>
@@ -65,11 +67,7 @@ static int __init of_numa_parse_memory_nodes(void)u32 nid;int r =0 ; -for (;;) { - np =of_find_node_by_type (np,"memory" ); -if (!np) -break ; - +for_each_node_by_type (np,"memory" ) { r =of_property_read_u32 (np,"numa-node-id" , &nid);if (r == -EINVAL )/*
@@ -83,18 +81,10 @@ static int __init of_numa_parse_memory_nodes(void)break ; r =of_address_to_resource (np,0 , &rsrc); -if (r) { -pr_err ("NUMA: bad reg property in memory node\n" ); -break ; - } - -pr_debug ("NUMA: base = %llx len = %llx, node = %u\n" , - rsrc.start, rsrc.end - rsrc.start +1 , nid); - - r =numa_add_memblk (nid, rsrc.start, +for (i =0 ; !r; i++, r =of_address_to_resource (np, i, &rsrc)) { + r =numa_add_memblk (nid, rsrc.start, rsrc.end - rsrc.start +1 ); -if (r) -break ; + } }of_node_put (np);
drivers/of/of_pci.c +4 -2
@@ -1,3 +1,5 @@ +#define pr_fmt (fmt) "OF: PCI: " fmt +#include <linux/kernel.h> #include <linux/export.h> #include <linux/of.h>
@@ -138,7 +140,7 @@ void of_pci_check_probe_only(void)else pci_clear_flags (PCI_PROBE_ONLY ); -pr_info ("PCI: PROBE_ONLY %sabled\n" , val ?"en" :"dis" ); +pr_info ("PROBE_ONLY %sabled\n" , val ?"en" :"dis" ); }EXPORT_SYMBOL_GPL (of_pci_check_probe_only);
@@ -181,7 +183,7 @@ int of_pci_get_host_bridge_resources(struct device_node *dev,if (!bus_range)return -ENOMEM ; -pr_info ("PCI host bridge %s ranges:\n" , dev->full_name); +pr_info ("host bridge %s ranges:\n" , dev->full_name); err =of_pci_parse_bus_range (dev, bus_range);if (err) {
drivers/of/of_reserved_mem.c +11 -11
@@ -13,6 +13,8 @@* License or (at your optional) any later version of the license. */ +#define pr_fmt (fmt) "OF: reserved mem: " fmt +#include <linux/err.h> #include <linux/of.h> #include <linux/of_fdt.h>
@@ -75,7 +77,7 @@ void __init fdt_reserved_mem_save_node(unsigned long node, const char *uname,struct reserved_mem *rmem = &reserved_mem[reserved_mem_count];if (reserved_mem_count ==ARRAY_SIZE (reserved_mem)) { -pr_err ("Reserved memory: not enough space all defined regions.\n" ); +pr_err ("not enough space all defined regions.\n" );return ; }
@@ -108,8 +110,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node,return -EINVAL ;if (len != dt_root_size_cells *sizeof (__be32)) { -pr_err ("Reserved memory: invalid size property in '%s' node.\n" , - uname); +pr_err ("invalid size property in '%s' node.\n" , uname);return -EINVAL ; } size =dt_mem_next_cell (dt_root_size_cells, &prop);
@@ -119,7 +120,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node, prop =of_get_flat_dt_prop (node,"alignment" , &len);if (prop) {if (len != dt_root_addr_cells *sizeof (__be32)) { -pr_err ("Reserved memory: invalid alignment property in '%s' node.\n" , +pr_err ("invalid alignment property in '%s' node.\n" , uname);return -EINVAL ; }
@@ -134,7 +135,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node,if (prop) {if (len % t_len !=0 ) { -pr_err ("Reserved memory: invalid alloc-ranges property in '%s', skipping node.\n" , +pr_err ("invalid alloc-ranges property in '%s', skipping node.\n" , uname);return -EINVAL ; }
@@ -149,7 +150,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node, ret =early_init_dt_alloc_reserved_memory_arch (size, align, start, end, nomap, &base);if (ret ==0 ) { -pr_debug ("Reserved memory: allocated memory for '%s' node: base %pa, size %ld MiB\n" , +pr_debug ("allocated memory for '%s' node: base %pa, size %ld MiB\n" , uname, &base, (unsigned long )size /SZ_1M );break ;
@@ -161,13 +162,12 @@ static int __init __reserved_mem_alloc_size(unsigned long node, ret =early_init_dt_alloc_reserved_memory_arch (size, align,0 ,0 , nomap, &base);if (ret ==0 ) -pr_debug ("Reserved memory: allocated memory for '%s' node: base %pa, size %ld MiB\n" , +pr_debug ("allocated memory for '%s' node: base %pa, size %ld MiB\n" , uname, &base, (unsigned long )size /SZ_1M ); }if (base ==0 ) { -pr_info ("Reserved memory: failed to allocate memory for node '%s'\n" , - uname); +pr_info ("failed to allocate memory for node '%s'\n" , uname);return -ENOMEM ; }
@@ -196,7 +196,7 @@ static int __init __reserved_mem_init_node(struct reserved_mem *rmem)continue ;if (initfn (rmem) ==0 ) { -pr_info ("Reserved memory: initialized node %s, compatible id %s\n" , +pr_info ("initialized node %s, compatible id %s\n" , rmem->name, compat);return 0 ; }
@@ -238,7 +238,7 @@ static void __init __rmem_check_for_overlap(void) this_end = this->base + this->size; next_end = next->base + next->size; -pr_err ("Reserved memory: OVERLAP DETECTED!\n%s (%pa--%pa) overlaps with %s (%pa--%pa)\n" , +pr_err ("OVERLAP DETECTED!\n%s (%pa--%pa) overlaps with %s (%pa--%pa)\n" , this->name, &this->base, &this_end, next->name, &next->base, &next_end); }
drivers/of/overlay.c +16 -27
113 lines not on this page · raw message
drivers/of/platform.c +8 -8
@@ -11,6 +11,9 @@* 2 of the License, or (at your option) any later version. * */ + +#define pr_fmt (fmt) "OF: " fmt +#include <linux/errno.h> #include <linux/module.h> #include <linux/amba/bus.h>
@@ -234,11 +237,8 @@ static struct amba_device *of_amba_device_create(struct device_node *node,return NULL ; dev =amba_device_alloc (NULL ,0 ,0 ); -if (!dev) { -pr_err ("%s(): amba_device_alloc() failed for %s\n" , - __func__, node->full_name); +if (!dev) goto err_clear_flag; - }/* setup generic device info */ dev->dev.of_node =of_node_get (node);
@@ -261,15 +261,15 @@ static struct amba_device *of_amba_device_create(struct device_node *node, ret =of_address_to_resource (node,0 , &dev->res);if (ret) { -pr_err ("%s(): of_address_to_resource() failed (%d) for %s\n" , - __func__, ret, node->full_name); +pr_err ("amba: of_address_to_resource() failed (%d) for %s\n" , + ret, node->full_name); goto err_free; } ret =amba_device_add (dev, &iomem_resource);if (ret) { -pr_err ("%s(): amba_device_add() failed (%d) for %s\n" , - __func__, ret, node->full_name); +pr_err ("amba_device_add() failed (%d) for %s\n" , + ret, node->full_name); goto err_free; }
drivers/of/resolver.c +2 -0
@@ -9,6 +9,8 @@* version 2 as published by the Free Software Foundation. */ +#define pr_fmt (fmt) "OF: resolver: " fmt +#include <linux/kernel.h> #include <linux/module.h> #include <linux/of.h>
Signature · 1 line
2.7.4
Quoted 8 lines · Rob Herring
Clean-up all the DT printk functions to use common
pr_fmtprefix.Some print statements such as kmalloc errors were redundant, so just drop those.
Cc Frank Rowand <[email protected]>Cc Pantelis Antoniou <pantelis.antoniou-OWPKS81ov/FWk0Htik3J/[email protected]>Signed-off-by Rob Herring <[email protected]>
Quoted 15 lines
--- drivers/of/address.c | 49 ++++++++++++++++++++++---------------------- drivers/of/base.c | 11 ++++++---- drivers/of/dynamic.c | 47 +++++++++++++++++++++--------------------- drivers/of/fdt.c | 12 +++++------ drivers/of/fdt_address.c | 35 ++++++++++++++++--------------- drivers/of/irq.c | 2 ++ drivers/of/of_numa.c | 22 ++++++-------------- drivers/of/of_pci.c | 6 ++++-- drivers/of/of_reserved_mem.c | 22 ++++++++++---------- drivers/of/overlay.c | 43 +++++++++++++++----------------------- drivers/of/platform.c | 16 +++++++-------- drivers/of/resolver.c | 2 ++ 12 files changed, 130 insertions(+), 137 deletions(-)
Nice cleanup. A couple of comments below.
< snip >
Quoted 29 lines
drivers/of/of_numa.c +3
-5@@ -16,6 +16,8 @@* along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#define pr_fmt (fmt) "OF: " fmt +#include <linux/of.h> #include <linux/of_address.h> #include <linux/nodemask.h> @@ -65,11 +67,7 @@ static int __init of_numa_parse_memory_nodes(void)u32 nid;int r =0 ; -for (;;) { - np =of_find_node_by_type (np,"memory" ); -if (!np) -break ; - +for_each_node_by_type (np,"memory" ) { r =of_property_read_u32 (np,"numa-node-id" , &nid);if (r == -EINVAL )/* @@ -83,18 +81,10 @@ static int __init of_numa_parse_memory_nodes(void)break ;
drivers/of/of_numa.c static int __init of_numa_parse_memory_nodes(void) · line 94
Quoted 10 lines
drivers/of/of_numa.c +0
-9r =of_address_to_resource (np,0 , &rsrc); -if (r) { -pr_err ("NUMA: bad reg property in memory node\n" ); -break ; - } - -pr_debug ("NUMA: base = %llx len = %llx, node = %u\n" , - rsrc.start, rsrc.end - rsrc.start +1 , nid); - - r = numa_add_memblk(nid, rsrc.start,
Missing declaration: int i;
Calling of_address_to_resource() with index > 0 and then calling numa_add_memblk() with the resulting resource(s) is a change in functionality. This should be in a separate patch.
Quoted 9 lines
drivers/of/of_numa.c +3
-2+for (i =0 ; !r; i++, r =of_address_to_resource (np, i, &rsrc)) { + r =numa_add_memblk (nid, rsrc.start, rsrc.end - rsrc.start +1 ); -if (r) -break ; + } }of_node_put (np);
< snip >
Quoted 58 lines
drivers/of/overlay.c +9
-9@@ -8,7 +8,9 @@* modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. */ -#undef DEBUG + +#define pr_fmt (fmt) "OF: overlay: " fmt +#include <linux/kernel.h> #include <linux/module.h> #include <linux/of.h> @@ -137,8 +139,8 @@ static int of_overlay_apply_one(struct of_overlay *ov,for_each_property_of_node (overlay, prop) { ret =of_overlay_apply_single_property (ov, target, prop);if (ret) { -pr_err ("%s: Failed to apply prop @%s/%s\n" , - __func__, target->full_name, prop->name); +pr_err ("Failed to apply prop @%s/%s\n" , + target->full_name, prop->name);return ret; } }@@ -146,9 +148,8 @@ static int of_overlay_apply_one(struct of_overlay *ov,for_each_child_of_node (overlay, child) { ret =of_overlay_apply_single_device_node (ov, target, child);if (ret !=0 ) { -pr_err ("%s: Failed to apply single node @%s/%s\n" , - __func__, target->full_name, - child->name); +pr_err ("Failed to apply single node @%s/%s\n" , + target->full_name, child->name);of_node_put (child);return ret; }@@ -176,8 +177,7 @@ static int of_overlay_apply(struct of_overlay *ov) err =of_overlay_apply_one (ov, ovinfo->target, ovinfo->overlay);if (err !=0 ) { -pr_err ("%s: overlay failed '%s'\n" , - __func__, ovinfo->target->full_name); +pr_err ("apply failed '%s'\n" , ovinfo->target->full_name);return err; } }@@ -208,7 +208,7 @@ static struct device_node *find_target_node(struct device_node *info_node)if (ret ==0 )return of_find_node_by_path (path); -pr_err ("%s: Failed to find target for node %p (%s)\n" , __func__, +pr_err ("Failed to find target for node %p (%s)\n" , info_node, info_node->name);return NULL ;
drivers/of/overlay.c int of_overlay_create(struct device_node *tree) · line 359
Quoted 5 lines
drivers/of/overlay.c +0
-2@@ -355,8 +355,6 @@ int of_overlay_create(struct device_node *tree) id =idr_alloc (&ov_idr, ov,0 ,0 ,GFP_KERNEL );if (id <0 ) { -pr_err ("%s: idr_alloc() failed for tree@%s\n" , - __func__, tree->full_name);
Every other error in of_overlay_create() results in a pr_err(). (The other cases of removing pr_err() in this file are fine, because the errors are already reported in the functions called from this function.)
I would recommend leaving in the pr_err() for idr_alloc() failure.
Quoted 53 lines
drivers/of/overlay.c +7
-14err = id; goto err_destroy_trans; }@@ -365,26 +363,21 @@ int of_overlay_create(struct device_node *tree)/* build the overlay info structures */ err =of_build_overlay_info (ov, tree);if (err) { -pr_err ("%s: of_build_overlay_info() failed for tree@%s\n" , - __func__, tree->full_name); +pr_err ("of_build_overlay_info() failed for tree@%s\n" , + tree->full_name); goto err_free_idr; }/* apply the overlay */ err =of_overlay_apply (ov); -if (err) { -pr_err ("%s: of_overlay_apply() failed for tree@%s\n" , - __func__, tree->full_name); +if (err) goto err_abort_trans; - }/* apply the changeset */ err =__of_changeset_apply (&ov->cset); -if (err) { -pr_err ("%s: __of_changeset_apply() failed for tree@%s\n" , - __func__, tree->full_name); +if (err) goto err_revert_overlay; - } +/* add to the tail of the overlay list */ list_add_tail (&ov->node, &ov_list);@@ -469,8 +462,7 @@ static int overlay_removal_is_ok(struct of_overlay *ov)list_for_each_entry (ce, &ov->cset.entries, node) {if (!overlay_is_topmost (ov, ce->np)) { -pr_err ("%s: overlay #%d is not topmost\n" , - __func__, ov->id); +pr_err ("overlay #%d is not topmost\n" , ov->id);return 0 ; } }@@ -496,16 +488,13 @@ int of_overlay_destroy(int id) ov =idr_find (&ov_idr, id);if (ov ==NULL ) { err = -ENODEV ; -pr_err ("%s: Could not find overlay #%d\n" , - __func__, id); +pr_err ("destroy: Could not find overlay #%d\n" , id); goto out;
drivers/of/overlay.c int of_overlay_destroy(int id) · line 500
Quoted 10 lines
drivers/of/overlay.c +0
-2}/* check whether the overlay is safe to remove */ if (!overlay_removal_is_ok (ov)) { err = -EBUSY ; -pr_err ("%s: removal check failed for overlay #%d\n" , - __func__, id); goto out; }
< snip >
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Rob Herring
maintainerQuoted 60 lines · Frank Rowand
Quoted 8 lines · Rob Herring
Clean-up all the DT printk functions to use common
pr_fmtprefix.Some print statements such as kmalloc errors were redundant, so just drop those.
Cc Frank Rowand <[email protected]>Cc Pantelis Antoniou <[email protected]>Signed-off-by Rob Herring <[email protected]>Quoted 15 lines
--- drivers/of/address.c | 49 ++++++++++++++++++++++---------------------- drivers/of/base.c | 11 ++++++---- drivers/of/dynamic.c | 47 +++++++++++++++++++++--------------------- drivers/of/fdt.c | 12 +++++------ drivers/of/fdt_address.c | 35 ++++++++++++++++--------------- drivers/of/irq.c | 2 ++ drivers/of/of_numa.c | 22 ++++++-------------- drivers/of/of_pci.c | 6 ++++-- drivers/of/of_reserved_mem.c | 22 ++++++++++---------- drivers/of/overlay.c | 43 +++++++++++++++----------------------- drivers/of/platform.c | 16 +++++++-------- drivers/of/resolver.c | 2 ++ 12 files changed, 130 insertions(+), 137 deletions(-)Nice cleanup. A couple of comments below.
Reviewed-by Frank Rowand <[email protected]>< snip >
Quoted 16 lines
drivers/of/of_numa.c +1
-5@@ -65,11 +67,7 @@ static int __init of_numa_parse_memory_nodes(void)u32 nid;int r =0 ; -for (;;) { - np =of_find_node_by_type (np,"memory" ); -if (!np) -break ; - +for_each_node_by_type (np,"memory" ) { r =of_property_read_u32 (np,"numa-node-id" , &nid);if (r == -EINVAL )/* @@ -83,18 +81,10 @@ static int __init of_numa_parse_memory_nodes(void)break ;drivers/of/of_numa.c static int __init of_numa_parse_memory_nodes(void) · line 94
Quoted 10 lines
drivers/of/of_numa.c +0
-9r =of_address_to_resource (np,0 , &rsrc); -if (r) { -pr_err ("NUMA: bad reg property in memory node\n" ); -break ; - } - -pr_debug ("NUMA: base = %llx len = %llx, node = %u\n" , - rsrc.start, rsrc.end - rsrc.start +1 , nid); - - r = numa_add_memblk(nid, rsrc.start,Missing declaration: int i;
Quoted 3 lines
Calling
of_address_to_resource()with index > 0 and then callingnuma_add_memblk()with the resulting resource(s) is a change in functionality. This should be in a separate patch.
This shouldn't be here. This was my rewriting the NUMA patches under review...
Quoted 82 lines
Quoted 10 lines
drivers/of/of_numa.c +3
-2+for (i =0 ; !r; i++, r =of_address_to_resource (np, i, &rsrc)) { + r =numa_add_memblk (nid, rsrc.start, rsrc.end - rsrc.start +1 ); -if (r) -break ; + } }of_node_put (np);< snip >
Quoted 58 lines
drivers/of/overlay.c +9
-9@@ -8,7 +8,9 @@* modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. */ -#undef DEBUG + +#define pr_fmt (fmt) "OF: overlay: " fmt +#include <linux/kernel.h> #include <linux/module.h> #include <linux/of.h> @@ -137,8 +139,8 @@ static int of_overlay_apply_one(struct of_overlay *ov,for_each_property_of_node (overlay, prop) { ret =of_overlay_apply_single_property (ov, target, prop);if (ret) { -pr_err ("%s: Failed to apply prop @%s/%s\n" , - __func__, target->full_name, prop->name); +pr_err ("Failed to apply prop @%s/%s\n" , + target->full_name, prop->name);return ret; } }@@ -146,9 +148,8 @@ static int of_overlay_apply_one(struct of_overlay *ov,for_each_child_of_node (overlay, child) { ret =of_overlay_apply_single_device_node (ov, target, child);if (ret !=0 ) { -pr_err ("%s: Failed to apply single node @%s/%s\n" , - __func__, target->full_name, - child->name); +pr_err ("Failed to apply single node @%s/%s\n" , + target->full_name, child->name);of_node_put (child);return ret; }@@ -176,8 +177,7 @@ static int of_overlay_apply(struct of_overlay *ov) err =of_overlay_apply_one (ov, ovinfo->target, ovinfo->overlay);if (err !=0 ) { -pr_err ("%s: overlay failed '%s'\n" , - __func__, ovinfo->target->full_name); +pr_err ("apply failed '%s'\n" , ovinfo->target->full_name);return err; } }@@ -208,7 +208,7 @@ static struct device_node *find_target_node(struct device_node *info_node)if (ret ==0 )return of_find_node_by_path (path); -pr_err ("%s: Failed to find target for node %p (%s)\n" , __func__, +pr_err ("Failed to find target for node %p (%s)\n" , info_node, info_node->name);return NULL ;drivers/of/overlay.c int of_overlay_create(struct device_node *tree) · line 359
Quoted 5 lines
drivers/of/overlay.c +0
-2@@ -355,8 +355,6 @@ int of_overlay_create(struct device_node *tree) id =idr_alloc (&ov_idr, ov,0 ,0 ,GFP_KERNEL );if (id <0 ) { -pr_err ("%s: idr_alloc() failed for tree@%s\n" , - __func__, tree->full_name);Every other error in
of_overlay_create()results in apr_err(). (The other cases of removingpr_err()in this file are fine, because the errors are already reported in the functions called from this function.)
Quoted 1 line
I would recommend leaving in the
pr_err()foridr_alloc()failure.
I was thinking idr_alloc is going to call kmalloc which will print errors on failure, but there may be some case it doesn't.
Rob
Quoted 1 line · Rob Herring
On Thu, Jun 2, 2016 at 12:33 PM, Frank Rowand <[email protected]> wrote:
[]
Quoted 11 lines
Quoted 11 lines
drivers/of/overlay.c int of_overlay_create(struct device_node *tree) · line 359
Quoted 6 lines
drivers/of/overlay.c +0
-2@@ -355,8 +355,6 @@ int of_overlay_create(struct device_node *tree) id = idr_alloc(&ov_idr, ov, 0, 0, GFP_KERNEL); if (id < 0) { - pr_err("%s: idr_alloc() failed for tree@%s\n", - __func__, tree->full_name);Every other error in
of_overlay_create()results in apr_err(). (The other cases of removingpr_err()in this file are fine, because the errors are already reported in the functions called from this function.)
Quoted 3 lines
Quoted 1 line
I would recommend leaving in the
pr_err()foridr_alloc()failure.I was thinking
idr_allocis going to call kmalloc which will print errors on failure, but there may be some case it doesn't.
Only if __GFP_NOWARN is used.
And it's not used in any idr_alloc call.
Quoted 31 lines · Rob Herring
Quoted 30 lines · Frank Rowand
Quoted 8 lines · Rob Herring
Clean-up all the DT printk functions to use common
pr_fmtprefix.Some print statements such as kmalloc errors were redundant, so just drop those.
Cc Frank Rowand <[email protected]>Cc Pantelis Antoniou <[email protected]>Signed-off-by Rob Herring <[email protected]>Quoted 15 lines
--- drivers/of/address.c | 49 ++++++++++++++++++++++---------------------- drivers/of/base.c | 11 ++++++---- drivers/of/dynamic.c | 47 +++++++++++++++++++++--------------------- drivers/of/fdt.c | 12 +++++------ drivers/of/fdt_address.c | 35 ++++++++++++++++--------------- drivers/of/irq.c | 2 ++ drivers/of/of_numa.c | 22 ++++++-------------- drivers/of/of_pci.c | 6 ++++-- drivers/of/of_reserved_mem.c | 22 ++++++++++---------- drivers/of/overlay.c | 43 +++++++++++++++----------------------- drivers/of/platform.c | 16 +++++++-------- drivers/of/resolver.c | 2 ++ 12 files changed, 130 insertions(+), 137 deletions(-)Nice cleanup. A couple of comments below.
Reviewed-by Frank Rowand <[email protected]>< snip >
< snip >
Quoted 12 lines
Quoted 12 lines
drivers/of/overlay.c int of_overlay_create(struct device_node *tree) · line 359
Quoted 6 lines
drivers/of/overlay.c +0
-2@@ -355,8 +355,6 @@ int of_overlay_create(struct device_node *tree) id =idr_alloc (&ov_idr, ov,0 ,0 ,GFP_KERNEL );if (id <0 ) { -pr_err ("%s: idr_alloc() failed for tree@%s\n" , - __func__, tree->full_name);Every other error in
of_overlay_create()results in apr_err(). (The other cases of removingpr_err()in this file are fine, because the errors are already reported in the functions called from this function.)
Quoted 6 lines
Quoted 1 line
I would recommend leaving in the
pr_err()foridr_alloc()failure.I was thinking
idr_allocis going to call kmalloc which will print errors on failure, but there may be some case it doesn't.Rob
I did not read idr_alloc() carefully enough. Given the arguments it is called with, none of the non-kmalloc error returns are possible. So you were correct to remove this pr_err().
-Frank
kbuild test robot
build boturl: https://github.com/0day-ci/linux/commits/Rob-Herring/of-use-pr_fmt-prefix-for-all-console-printing/20160602-231816 config: arm64-allmodconfig (attached as .config) compiler…
Hi,
[auto build test ERROR on v4.7-rc1]
[also build test ERROR on next-20160602]
[cannot apply to glikely/devicetree/next]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Rob-Herring/of-use-pr_fmt-prefix-for-all-console-printing/20160602-231816
config: arm64-allmodconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 5.3.1-8) 5.3.1 20160205
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm64
All error/warnings (new ones prefixed by >>):
drivers/of/of_numa.c: In function 'of_numa_parse_memory_nodes':
>> drivers/of/of_numa.c:84:8: error: 'i' undeclared (first use in this function)
for (i = 0; !r; i++, r = of_address_to_resource(np, i, &rsrc)) {
^
drivers/of/of_numa.c:84:8: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/of/of_numa.c:84:22: warning: left-hand operand of comma expression has no effect [-Wunused-value]
for (i = 0; !r; i++, r = of_address_to_resource(np, i, &rsrc)) {
^vim +/i +84 drivers/of/of_numa.c
78 continue;
79 else if (r)
80 /* some other error */
81 break;
82
83 r = of_address_to_resource(np, 0, &rsrc);
> 84 for (i = 0; !r; i++, r = of_address_to_resource(np, i, &rsrc)) {
85 r = numa_add_memblk(nid, rsrc.start,
86 rsrc.end - rsrc.start + 1);
87 }---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation