Re: [PATCH 2/2] gpio: davinci: Remove gpio2regs function to accommodate multi instances

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

 



On Wed, Jan 4, 2017 at 9:26 AM, Keerthy <j-keerthy@xxxxxx> wrote:

> gpio2regs is written making an assumption that driver supports only
> one instance of gpio controller. Removing this and adding a generic
> array so as to support multiple instances of gpio controllers.
>
> Signed-off-by: Keerthy <j-keerthy@xxxxxx>

> -               regs = gpio2regs(base);
> +               regs = gpio_base + offset_array[i];

I understand this.

> -       struct davinci_gpio_regs __iomem *g = gpio2regs(hw);
> +       struct davinci_gpio_controller *chips =
> +                               (struct davinci_gpio_controller *)d->host_data;
> +       struct davinci_gpio_regs __iomem *g = chips[hw / 32].regs;

And this, if each instans has 32 GPIOs.

> -               g = gpio2regs(0);
> +               g = chips[0].regs;

Also makes sense.

> -               g = gpio2regs(gpio);
> +               g = chips[bank / 2].regs;

But what is this? I don't understand that /2 at all. Please insert a
comment explaining it so I can figure it out. Are there two banks
per instance?

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux