Re: [NEW DRIVER V2 5/7] DA9058 GPIO driver

From: Mark Brown
Date: Mon Aug 13 2012 - 09:46:35 EST


On Mon, Aug 13, 2012 at 03:09:31PM +0200, Linus Walleij wrote:
> On Sun, Aug 5, 2012 at 10:43 PM, Anthony Olech

> > +#include <linux/regmap.h>

> If you're using regmap you better select it in Kconfig
> too, but it appears you don't. You should be using regmap in the
> main MFD driver in this case (I haven't looked at it though.)

For MFDs the MFD core should already be ensuring that regmap is
selected.

> > + gpio_cntrl |= 0x0F & gpio->out_config;

> > + ret = da9058_reg_write(da9058, DA9058_GPIO0001_REG, gpio_cntrl);

> Further, if you're checking that flag just in order to avoid doing this
> write if it's not necessary, it's the wrong solution. The right solution
> is to implement regmap in the MFD driver so it quickly sees that
> the right value is already in the register and bounces off.

Just using regmap_update_bits() will do the right thing.

> > + if (offset)
> > + return da9058_to_virt_irq_num(da9058, DA9058_IRQ_EGPI1);
> > + else
> > + return da9058_to_virt_irq_num(da9058, DA9058_IRQ_EGPI0);
> > +}

> Lee Jones and Mark Brown discussed these virtual IRQ mapping functions
> recently, and I think the outcome was to patch irqdomain to do the work
> and not sprinkle these custom interfaces to fetch virtual IRQs all over the
> place.

The easiest thing to do would be to pick the VIRQ numbers so that you
can just do

da9058_to_virt_irq_num(da9058, DA9058_IRQ_EGPI0 + offset);
--
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/