Re: [PATCH 12/31] nds32: Device specific operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 8, 2017 at 6:55 AM, Greentime Hu <green.hu@xxxxxxxxx> wrote:

> +
> +#define ioremap(cookie,size)           __ioremap(cookie,size,0,1)
> +#define ioremap_nocache(cookie,size)   __ioremap(cookie,size,0,1)
> +#define iounmap(cookie)                        __iounmap(cookie)

> +#include <asm-generic/io.h>

asm-generic/io.h now provides an ioremap_nocache() helper along with
ioremap_uc/ioremap_wc/ioremap_wt, so I think you can remove the
ioremap_nocache definition here. You might also be able to remove
__ioremap and __iounmap, and only provide ioremap/iounmap, plus
the identity macro 'define ioremap ioremap'

> +void __iomem *__ioremap(unsigned long phys_addr, size_t size,
> +                       unsigned long flags, unsigned long align)

The 'align' argument is unused here, and not used on other architectures
either.

> +{
> +       struct vm_struct *area;
> +       unsigned long addr, offset, last_addr;
> +       pgprot_t prot;
> +
> +       /* Don't allow wraparound or zero size */
> +       last_addr = phys_addr + size - 1;
> +       if (!size || last_addr < phys_addr)
> +               return NULL;
> +
> +       /*
> +        * Mappings have to be page-aligned
> +        */
> +       offset = phys_addr & ~PAGE_MASK;
> +       phys_addr &= PAGE_MASK;
> +       size = PAGE_ALIGN(last_addr + 1) - phys_addr;
> +
> +       /*
> +        * Ok, go for it..
> +        */
> +       area = get_vm_area(size, VM_IOREMAP);

Better use get_vm_area_caller here to have the ioremap areas show up
in a more useful form in /proc/vmallocinfo

Please also have a look at what you can do for memremap().

Since you have no cacheable version of ioremap_wb/wt, it will
return an uncached mapping all the time, which is not ideal.

     Arnd



[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux