[PATCH 07/10] ARM: clps711x: Add CLPS711X irqchip driver

Arnd Bergmann arnd at arndb.de
Sun Aug 4 16:46:54 EDT 2013


On Sunday 04 August 2013, Alexander Shiyan wrote:
> On Sat, 3 Aug 2013 21:45:41 +0200
> Arnd Bergmann <arnd at arndb.de> wrote:
> 
> [...]
> > > +static void __iomem __init *clps711x_ioremap_one(phys_addr_t reg)
> > > +{
> > > +       void __iomem *ret;
> > > +
> > > +       if (!request_mem_region(clps711x_intc->phys_base + reg, SZ_4, NULL))
> > > +               return ERR_PTR(-EBUSY);
> > > +
> > > +       ret = ioremap(clps711x_intc->phys_base + reg, SZ_4);
> > > +       if (!ret)
> > > +               return ERR_PTR(-ENOMEM);
> > > +
> > > +       return ret;
> > 
> > Another unrelated comment: Doing repeated ioremap() and request_mem_region calls
> > is rather wasteful as every single call will consume resources. Better do a single
> > ioremap in the probe function and just add the offsets later.
> 
> Registers are not arranged linearly for each submodule, so for example there are
> registers for LCD, Timers, PWM, UART etc. between INTMR1 and INTMR2.
> Single request cannot be used here, since it block access to these holes from drivers.

Well, you could still have a single ioremap() but separate request_mem_region()
calls then. Each ioremap() actually installs a full page anyway.

Alternatively, you could use the syscon driver to provide access to all the registers.

	Arnd



More information about the linux-arm-kernel mailing list