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

Al Viro
2005-01-14T01:05:06Z

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.