vsprintf: use %pR, %pr instead of %pRt, %pRf
Subsystems (6)
PATCH 1/1 vsprintf: use %pR, %pr instead of %pRt, %pRf
Jesse accidentally applied v1 [1] of the patchset instead of v2 [2]. This is the diff between v1 and v2.
The changes in this patch are:
- tidied vsprintf stack buffer to shrink and compute size more accurately
- use %pR for decoding and %pr for "raw" (with type and flags) instead of adding %pRt and %pRf
[1] http://lkml.org/lkml/2009/10/6/491
[2] http://lkml.org/lkml/2009/10/13/441
--- arch/ia64/pci/pci.c | 11 ++++--- arch/x86/pci/acpi.c | 7 ++-- arch/x86/pci/i386.c | 11 ++++--- drivers/pci/pci.c | 2 + drivers/pci/probe.c | 17 +++++----- drivers/pci/quirks.c | 2 + drivers/pci/setup-bus.c | 79 +++++++++++++++++++++-------------------------- drivers/pci/setup-res.c | 20 +++++++----- drivers/pnp/quirks.c | 5 ++- drivers/pnp/resource.c | 8 ++--- drivers/pnp/support.c | 2 + drivers/pnp/system.c | 2 + lib/vsprintf.c | 55 ++++++++++++++++++--------------- 13 files changed, 114 insertions(+), 107 deletions(-)
arch/ia64/pci/pci.c +7 -4
@@ -293,18 +293,19 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data) window->offset = offset;if (insert_resource (root, &window->resource)) { -dev_err (&info->bridge->dev,"can't allocate %pRt\n" , +dev_err (&info->bridge->dev, +"can't allocate host bridge window %pR\n" , &window->resource); }else {if (offset) -dev_info (&info->bridge->dev,"host bridge window: %pRt " +dev_info (&info->bridge->dev,"host bridge window %pR " "(PCI address [%#llx-%#llx])\n" , &window->resource, window->resource.start - offset, window->resource.end - offset);else dev_info (&info->bridge->dev, -"host bridge window: %pRt\n" , +"host bridge window %pR\n" , &window->resource); }
@@ -325,7 +326,9 @@ pcibios_setup_root_windows(struct pci_bus *bus, struct pci_controller *ctrl) (res->end - res->start < 16))continue ;if (j >=PCI_BUS_NUM_RESOURCES ) { -dev_warn (&bus->dev,"ignoring %pRf (no space)\n" , res); +dev_warn (&bus->dev, +"ignoring host bridge window %pR (no space)\n" , + res);continue ; } bus->resource[j++] = res;
arch/x86/pci/acpi.c +4 -3
@@ -108,18 +108,19 @@ setup_resource(struct acpi_resource *acpi_res, void *data) res->child =NULL ;if (insert_resource (root, res)) { -dev_err (&info->bridge->dev,"can't allocate %pRt\n" , res); +dev_err (&info->bridge->dev, +"can't allocate host bridge window %pR\n" , res); }else { info->bus->resource[info->res_num] = res; info->res_num++;if (addr.translation_offset) -dev_info (&info->bridge->dev,"host bridge window: %pRt " +dev_info (&info->bridge->dev,"host bridge window %pR " "(PCI address [%#llx-%#llx])\n" , res, res->start - addr.translation_offset, res->end - addr.translation_offset);else dev_info (&info->bridge->dev, -"host bridge window: %pRt\n" , res); +"host bridge window %pR\n" , res); }return AE_OK ; }
arch/x86/pci/i386.c +6 -5
@@ -129,7 +129,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)continue ;if (!r->start ||pci_claim_resource (dev, idx) <0 ) { -dev_info (&dev->dev,"BAR %d: can't allocate %pRt\n" , idx, r); +dev_info (&dev->dev,"BAR %d: can't allocate %pR\n" , idx, r);/* * Something is wrong with the region. * Invalidate the resource to prevent
@@ -164,10 +164,11 @@ static void __init pcibios_allocate_resources(int pass)else disabled = !(command &PCI_COMMAND_MEMORY );if (pass == disabled) { -dev_dbg (&dev->dev,"%pRf (d=%d, p=%d)\n" , r, - disabled, pass); +dev_dbg (&dev->dev, +"BAR %d: claiming %pr (d=%d, p=%d)\n" , + idx, r, disabled, pass);if (pci_claim_resource (dev, idx) <0 ) { -dev_info (&dev->dev,"BAR %d: can't allocate %pRt\n" , idx, r); +dev_info (&dev->dev,"BAR %d: can't claim %pR\n" , idx, r);/* We'll assign a new address later */ r->end -= r->start; r->start =0 ;
@@ -180,7 +181,7 @@ static void __init pcibios_allocate_resources(int pass)/* Turn the ROM off, leave the resource region, * but keep it unregistered. */ u32 reg; -dev_dbg (&dev->dev,"disabling ROM %pRt\n" , r); +dev_dbg (&dev->dev,"disabling ROM %pR\n" , r); r->flags &= ~IORESOURCE_ROM_ENABLE ;pci_read_config_dword (dev, dev->rom_base_reg, ®);
drivers/pci/pci.c +1 -1
@@ -1713,7 +1713,7 @@ static int __pci_request_region(struct pci_dev *pdev, int bar, const char *res_nreturn 0 ; err_out: -dev_warn (&pdev->dev,"BAR %d: can't reserve %pRt\n" , bar, +dev_warn (&pdev->dev,"BAR %d: can't reserve %pR\n" , bar, &pdev->resource[bar]);return -EBUSY ; }
drivers/pci/probe.c +9 -8
@@ -224,12 +224,13 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,if (!sz64) goto fail; - res->flags |=IORESOURCE_MEM_64 ; -if ((sizeof (resource_size_t) <8 ) && (sz64 >0x100000000ULL )) {dev_err (&dev->dev,"can't handle 64-bit BAR\n" ); goto fail; - }else if ((sizeof (resource_size_t) <8 ) && l) { + } + + res->flags |=IORESOURCE_MEM_64 ; +if ((sizeof (resource_size_t) <8 ) && l) {/* Address above 32-bit boundary; disable the BAR */ pci_write_config_dword (dev, pos,0 );pci_write_config_dword (dev, pos +4 ,0 );
@@ -238,7 +239,7 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, }else { res->start = l64; res->end = l64 + sz64; -dev_printk (KERN_DEBUG , &dev->dev,"reg %x: %pRt\n" , +dev_printk (KERN_DEBUG , &dev->dev,"reg %x: %pR\n" , pos, res); } }else {
@@ -250,7 +251,7 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, res->start = l; res->end = l + sz; -dev_printk (KERN_DEBUG , &dev->dev,"reg %x: %pRt\n" , pos, res); +dev_printk (KERN_DEBUG , &dev->dev,"reg %x: %pR\n" , pos, res); } out:
@@ -318,7 +319,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child) res->start = base;if (!res->end) res->end = limit +0xfff ; -dev_printk (KERN_DEBUG , &dev->dev,"bridge window: %pRt\n" , res); +dev_printk (KERN_DEBUG , &dev->dev," bridge window %pR\n" , res); } res = child->resource[1 ];
@@ -330,7 +331,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child) res->flags = (mem_base_lo &PCI_MEMORY_RANGE_TYPE_MASK ) |IORESOURCE_MEM ; res->start = base; res->end = limit +0xfffff ; -dev_printk (KERN_DEBUG , &dev->dev,"bridge window: %pRt\n" , res); +dev_printk (KERN_DEBUG , &dev->dev," bridge window %pR\n" , res); } res = child->resource[2 ];
@@ -369,7 +370,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child) res->flags |=IORESOURCE_MEM_64 ; res->start = base; res->end = limit +0xfffff ; -dev_printk (KERN_DEBUG , &dev->dev,"bridge window: %pRt\n" , res); +dev_printk (KERN_DEBUG , &dev->dev," bridge window %pR\n" , res); } }
drivers/pci/quirks.c +1 -1
@@ -357,7 +357,7 @@ static void __devinit quirk_io_region(struct pci_dev *dev, unsigned region,pcibios_bus_to_resource (dev, res, &bus_region);pci_claim_resource (dev, nr); -dev_info (&dev->dev,"quirk: region %04x-%04x claimed by %s\n" , region, region + size -1 , name); +dev_info (&dev->dev,"quirk: %pR claimed by %s\n" , res, name); } }
drivers/pci/setup-bus.c +36 -43
173 lines not on this page · raw message
drivers/pci/setup-res.c +11 -9
@@ -51,9 +51,11 @@ void pci_update_resource(struct pci_dev *dev, int resno)pcibios_resource_to_bus (dev, ®ion, res); -dev_dbg (&dev->dev,"BAR %d: got %pRf (bus addr [%#llx-%#llx])\n" , - resno, res, (unsigned long long )region.start, - (unsigned long long )region.end); +dev_dbg (&dev->dev,"BAR %d: got res %pR bus [%#llx-%#llx] " +"flags %#lx\n" , resno, res, + (unsigned long long )region.start, + (unsigned long long )region.end, + (unsigned long )res->flags); new = region.start | (res->flags &PCI_REGION_FLAG_MASK );if (res->flags &IORESOURCE_IO )
@@ -89,8 +91,8 @@ void pci_update_resource(struct pci_dev *dev, int resno) } } res->flags &= ~IORESOURCE_UNSET ; -dev_dbg (&dev->dev,"BAR %d: moved to bus addr [%#llx-%#llx]\n" , - resno, (unsigned long long )region.start, +dev_dbg (&dev->dev,"BAR %d: moved to %pR (bus addr [%#llx-%#llx])\n" , + resno, res, (unsigned long long )region.start, (unsigned long long )region.end); }
@@ -108,7 +110,7 @@ int pci_claim_resource(struct pci_dev *dev, int resource)if (err) {const char *dtype = resource <PCI_BRIDGE_RESOURCES ?"device" :"bridge" ; - dev_err(&dev->dev, "BAR %d: %s %s %pRt\n", + dev_err(&dev->dev, "BAR %d: %s of %s %pR\n", resource, root ? "address space collision on" : "no parent found for",
@@ -179,7 +181,7 @@ int pci_assign_resource(struct pci_dev *dev, int resno) align =pci_resource_alignment (dev, res);if (!align) { -dev_info (&dev->dev,"BAR %d: can't allocate %pRf " +dev_info (&dev->dev,"BAR %d: can't allocate %pR " "(bogus alignment)\n" , resno, res);return -EINVAL ; }
@@ -196,7 +198,7 @@ int pci_assign_resource(struct pci_dev *dev, int resno) }if (ret) -dev_info (&dev->dev,"BAR %d: can't allocate %pRt\n" , +dev_info (&dev->dev,"BAR %d: can't allocate %pR\n" , resno, res);return ret;
@@ -222,7 +224,7 @@ void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head) r_align =pci_resource_alignment (dev, r);if (!r_align) { -dev_warn (&dev->dev,"BAR %d: bogus alignment %pRf\n" , +dev_warn (&dev->dev,"BAR %d: %pR has bogus alignment\n" , i, r);continue ; }
drivers/pnp/quirks.c +3 -2
@@ -285,8 +285,9 @@ static void quirk_system_pci_resources(struct pnp_dev *dev)* the PCI region, and that might prevent a PCI * driver from requesting its resources. */ -dev_warn (&dev->dev,"resource %pRt overlaps %s " -"BAR %d %pRt, disabling\n" , res, +dev_warn (&dev->dev, +"disabling %pR because it overlaps " +"%s BAR %d %pR\n" , res,pci_name (pdev), i, &pdev->resource[i]); res->flags |=IORESOURCE_DISABLED ; }
drivers/pnp/resource.c +4 -4
@@ -517,7 +517,7 @@ struct pnp_resource *pnp_add_irq_resource(struct pnp_dev *dev, int irq, res->start = irq; res->end = irq; -pnp_dbg (&dev->dev," add %pRf\n" , res); +pnp_dbg (&dev->dev," add %pr\n" , res);return pnp_res; }
@@ -538,7 +538,7 @@ struct pnp_resource *pnp_add_dma_resource(struct pnp_dev *dev, int dma, res->start = dma; res->end = dma; -pnp_dbg (&dev->dev," add %pRf\n" , res); +pnp_dbg (&dev->dev," add %pr\n" , res);return pnp_res; }
@@ -562,7 +562,7 @@ struct pnp_resource *pnp_add_io_resource(struct pnp_dev *dev, res->start = start; res->end = end; -pnp_dbg (&dev->dev," add %pRf\n" , res); +pnp_dbg (&dev->dev," add %pr\n" , res);return pnp_res; }
@@ -586,7 +586,7 @@ struct pnp_resource *pnp_add_mem_resource(struct pnp_dev *dev, res->start = start; res->end = end; -pnp_dbg (&dev->dev," add %pRf\n" , res); +pnp_dbg (&dev->dev," add %pr\n" , res);return pnp_res; }
drivers/pnp/support.c +1 -1
@@ -82,7 +82,7 @@ void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc)else {pnp_dbg (&dev->dev,"%s: current resources:\n" , desc);list_for_each_entry (pnp_res, &dev->resources, list) -pnp_dbg (&dev->dev,"%pRf\n" , &pnp_res->res); +pnp_dbg (&dev->dev,"%pr\n" , &pnp_res->res); } }
drivers/pnp/system.c +1 -1
@@ -48,7 +48,7 @@ static void reserve_range(struct pnp_dev *dev, struct resource *r, int port)* example do reserve stuff they know about too, so we may well * have double reservations. */ -dev_info (&dev->dev,"%pRt %s reserved\n" , r, +dev_info (&dev->dev,"%pR %s reserved\n" , r, res ?"has been" :"could not be" ); }
lib/vsprintf.c +30 -25
95 lines not on this page · raw message
Jesse Barnes
AppliedQuoted 9 lines · On Tue, 27 Oct 2009 13:26:47 -0600 Bjorn Helgaas <[email protected]> wrote:
Jesse accidentally applied v1 [1] of the patchset instead of v2 [2]. This is the diff between v1 and v2.
The changes in this patch are:
- tidied vsprintf stack buffer to shrink and compute size more accurately
- use %pR for decoding and %pr for "raw" (with type and flags)
instead of adding %pRt and %pRf
Quoted 4 lines
[1] http://lkml.org/lkml/2009/10/6/491
[2] http://lkml.org/lkml/2009/10/13/441Signed-off-by Bjorn Helgaas <[email protected]>
Applied, thanks.
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center