From: Paul Mackerras Date: Thu, 15 Jun 2006 08:03:32 +0000 (+1000) Subject: powerpc: Simplify push_end definition in pci_32.c X-Git-Tag: firefly_0821_release~35458^2~225^2~58 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0f582bc1f2cccacd613c411fbea55873d17c3429;p=firefly-linux-kernel-4.4.55.git powerpc: Simplify push_end definition in pci_32.c The push_end macro in arch/powerpc/kernel/pci_32.c uses integer division and multiplication to achieve the effect of rounding a resource end address up and then advancing it to the end of a power-of-2 sized region. This changes it to an equivalent computation that only needs an integer add and OR. This is partly based on an earlier patch by Mel Gorman. Signed-off-by: Paul Mackerras --- diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c index b129d2e4b759..c858eb4bef17 100644 --- a/arch/powerpc/kernel/pci_32.c +++ b/arch/powerpc/kernel/pci_32.c @@ -1113,9 +1113,10 @@ check_for_io_childs(struct pci_bus *bus, struct resource* res, int *found_vga) int i; int rc = 0; -#define push_end(res, size) do { unsigned long __sz = (size) ; \ - res->end = ((res->end + __sz) / (__sz + 1)) * (__sz + 1) + __sz; \ - } while (0) +#define push_end(res, mask) do { \ + BUG_ON((mask+1) & mask); \ + res->end = (res->end + mask) | mask; \ +} while (0) list_for_each_entry(dev, &bus->devices, bus_list) { u16 class = dev->class >> 8;