From: Alan Cox <alan@xxxxxxxxxxxxxxxxxxx> Add an iomap_name() function which translates an I/O map into a string to print. Use it for the Libata layer For now we use 0xXXXX for I/O and 0xXXXXXXXX for MMIO. I'm assuming that eventually some other platforms will want to use their own iomap_name() and we can add ARCH_HAVE_IOMAP_NAME later as such a platform needs it. Signed-off-by: Alan Cox <alan@xxxxxxxxxx> Cc: Jeff Garzik <jeff@xxxxxxxxxx> Cc: Tejun Heo <htejun@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/asm-generic/iomap.h | 5 +++++ lib/iomap.c | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff -puN include/asm-generic/iomap.h~iomap-sort-out-the-broken-address-reporting-caused-by-the-iomap-layer include/asm-generic/iomap.h --- a/include/asm-generic/iomap.h~iomap-sort-out-the-broken-address-reporting-caused-by-the-iomap-layer +++ a/include/asm-generic/iomap.h @@ -65,4 +65,9 @@ struct pci_dev; extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); extern void pci_iounmap(struct pci_dev *dev, void __iomem *); +/* Convert an iomap to text for this platform */ +extern char *iomap_name(void __iomem *addr, char *buf, size_t len); +#define IOMAP_NAMELEN 12 + + #endif diff -puN lib/iomap.c~iomap-sort-out-the-broken-address-reporting-caused-by-the-iomap-layer lib/iomap.c --- a/lib/iomap.c~iomap-sort-out-the-broken-address-reporting-caused-by-the-iomap-layer +++ a/lib/iomap.c @@ -268,3 +268,15 @@ void pci_iounmap(struct pci_dev *dev, vo } EXPORT_SYMBOL(pci_iomap); EXPORT_SYMBOL(pci_iounmap); + +char *iomap_name(void __iomem *port, char *buf, size_t len) +{ + if (port == NULL) { + snprintf(buf, len, "None"); + return buf; + } + IO_COND(port, snprintf(buf, len, "0x%04lx", port), + snprintf(buf, len, "%08lx", port)); + return buf; +} +EXPORT_SYMBOL(iomap_name); _ - To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html