Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

powerpc/io: Wrap port calculation in a macro

The calculation of the IO port is repeated several times, wrap it in
a macro, in particular to avoid spelling out the cast multiple times.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20241218105523.416573-14-mpe@ellerman.id.au

authored by

Michael Ellerman and committed by
Madhavan Srinivasan
8a55941a 41c8992c

+14 -12
+14 -12
arch/powerpc/include/asm/io.h
··· 277 277 /* Shortcut to the MMIO argument pointer */ 278 278 #define PCI_IO_ADDR volatile void __iomem * 279 279 280 + #define _IO_PORT(port) ((PCI_IO_ADDR)(_IO_BASE + (port))) 281 + 280 282 /* 281 283 * Non ordered and non-swapping "raw" accessors 282 284 */ ··· 534 532 #define __do_inw(port) _rec_inw(port) 535 533 #define __do_inl(port) _rec_inl(port) 536 534 #else /* CONFIG_PPC32 */ 537 - #define __do_outb(val, port) writeb(val,(PCI_IO_ADDR)(_IO_BASE+port)); 538 - #define __do_outw(val, port) writew(val,(PCI_IO_ADDR)(_IO_BASE+port)); 539 - #define __do_outl(val, port) writel(val,(PCI_IO_ADDR)(_IO_BASE+port)); 540 - #define __do_inb(port) readb((PCI_IO_ADDR)(_IO_BASE + port)); 541 - #define __do_inw(port) readw((PCI_IO_ADDR)(_IO_BASE + port)); 542 - #define __do_inl(port) readl((PCI_IO_ADDR)(_IO_BASE + port)); 535 + #define __do_outb(val, port) writeb(val,_IO_PORT(port)); 536 + #define __do_outw(val, port) writew(val,_IO_PORT(port)); 537 + #define __do_outl(val, port) writel(val,_IO_PORT(port)); 538 + #define __do_inb(port) readb(_IO_PORT(port)); 539 + #define __do_inw(port) readw(_IO_PORT(port)); 540 + #define __do_inl(port) readl(_IO_PORT(port)); 543 541 #endif /* !CONFIG_PPC32 */ 544 542 545 543 #ifdef CONFIG_EEH ··· 555 553 #define __do_writesw(a, b, n) _outsw(a, (b), (n)) 556 554 #define __do_writesl(a, b, n) _outsl(a, (b), (n)) 557 555 558 - #define __do_insb(p, b, n) readsb((PCI_IO_ADDR)(_IO_BASE+(p)), (b), (n)) 559 - #define __do_insw(p, b, n) readsw((PCI_IO_ADDR)(_IO_BASE+(p)), (b), (n)) 560 - #define __do_insl(p, b, n) readsl((PCI_IO_ADDR)(_IO_BASE+(p)), (b), (n)) 561 - #define __do_outsb(p, b, n) writesb((PCI_IO_ADDR)(_IO_BASE+(p)),(b),(n)) 562 - #define __do_outsw(p, b, n) writesw((PCI_IO_ADDR)(_IO_BASE+(p)),(b),(n)) 563 - #define __do_outsl(p, b, n) writesl((PCI_IO_ADDR)(_IO_BASE+(p)),(b),(n)) 556 + #define __do_insb(p, b, n) readsb(_IO_PORT(p), (b), (n)) 557 + #define __do_insw(p, b, n) readsw(_IO_PORT(p), (b), (n)) 558 + #define __do_insl(p, b, n) readsl(_IO_PORT(p), (b), (n)) 559 + #define __do_outsb(p, b, n) writesb(_IO_PORT(p),(b),(n)) 560 + #define __do_outsw(p, b, n) writesw(_IO_PORT(p),(b),(n)) 561 + #define __do_outsl(p, b, n) writesl(_IO_PORT(p),(b),(n)) 564 562 565 563 #ifdef CONFIG_EEH 566 564 #define __do_memcpy_fromio(dst, src, n) \