Re: [PATCH 1/5] Convert resource to u64 from unsigned long

From: Al Viro
Date: Thu Jan 13 2005 - 20:25:33 EST


On Thu, Jan 13, 2005 at 04:23:09PM -0800, Andrew Morton wrote:
> +#if BITS_PER_LONG == 64
> return (void __iomem *)pci_resource_start(pdev, PCI_ROM_RESOURCE);
> +#else
> + return (void __iomem *)(u32)pci_resource_start(pdev, PCI_ROM_RESOURCE);
> +#endif
>
> We really should find a way of avoiding this. Even if it is
>
> #if BITS_PER_LONG == 64
> #define resource_to_ptr(r) ((void *)(r))
> #else
> #define resource_to_ptr(r) ((void *)((u32)r))
> #endif
>
> in a header file somewhere. Open-coding the decision all over the place is
> unsightly.

This is wrong anyway - ioremap() on these will give you __iomem pointers,
but cast like that looks very bogus.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/