Re: [RFC PATCH 04/10] OMAP: GPIO: Remove dependency on gpio_bank_count

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

 



Kevin,

On Thu, May 19, 2011 at 21:12, Kevin Hilman <khilman@xxxxxx> wrote:
> Tarun Kanti DebBarma <tarun.kanti@xxxxxx> writes:
>
>> From: Charulatha V <charu@xxxxxx>
>>
>> gpio_bank_count is the count of number of GPIO devices
>> in a SoC. Remove this dependency from the driver. Also remove
>> the dependency on array of pointers to gpio_bank struct of
>> all GPIO devices.
>>
>> The cpu_is*() checks used in omap2_gpio_prepare_for_idle() and
>> omap2_gpio_resume_after_idle() would be removed in one of the
>> patches in this series
>>
>> Signed-off-by: Charulatha V <charu@xxxxxx>
>> Cc: Santosh Shilimkar <santosh.shilimkar@xxxxxx>
>> Cc: Kevin Hilman <khilman@xxxxxx>
>> Cc: Tony Lindgren <tony@xxxxxxxxxxx>
>
>
> Nice.  I like this direction.... Some minor comments below...
>
>> ---
>>  arch/arm/mach-omap1/gpio15xx.c         |    1 -
>>  arch/arm/mach-omap1/gpio16xx.c         |    2 -
>>  arch/arm/mach-omap1/gpio7xx.c          |    2 -
>>  arch/arm/mach-omap2/gpio.c             |    1 -
>>  arch/arm/plat-omap/gpio.c              |  157 ++++++++++++++++---------------
>>  arch/arm/plat-omap/include/plat/gpio.h |    3 -
>>  6 files changed, 81 insertions(+), 85 deletions(-)
>>

[...]

>>
>> diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
>> index 12deb1c..0b76475 100644
>> --- a/arch/arm/plat-omap/gpio.c
>> +++ b/arch/arm/plat-omap/gpio.c
>> @@ -30,7 +30,10 @@
>>  #include <mach/gpio.h>
>>  #include <asm/mach/irq.h>
>>
>> +static LIST_HEAD(omap_gpio_list);
>> +
>>  struct gpio_bank {
>> +     struct list_head node;
>>       unsigned long pbase;
>>       void __iomem *base;
>>       u16 irq;
>> @@ -57,6 +60,7 @@ struct gpio_bank {
>>       bool dbck_flag;
>>       int stride;
>>       u32 width;
>> +     u16 id;
>>
>>       void (*set_dataout)(struct gpio_bank *bank, int gpio, int enable);
>>
>> @@ -80,15 +84,6 @@ struct omap3_gpio_regs {
>>  static struct omap3_gpio_regs gpio_context[OMAP34XX_NR_GPIOS];
>>  #endif
>>
>> -/*
>> - * TODO: Cleanup gpio_bank usage as it is having information
>> - * related to all instances of the device
>> - */
>> -static struct gpio_bank *gpio_bank;
>> -
>> -/* TODO: Analyze removing gpio_bank_count usage from driver code */
>> -int gpio_bank_count;
>> -
>>  #define GPIO_INDEX(bank, gpio) (gpio % bank->width)
>>  #define GPIO_BIT(bank, gpio) (1 << GPIO_INDEX(bank, gpio))
>>  #define GPIO_MOD_CTRL_BIT    BIT(0)
>> @@ -859,23 +854,29 @@ static struct platform_device omap_mpuio_device = {
>>       /* could list the /proc/iomem resources */
>>  };
>>
>> -static inline void mpuio_init(void)
>> +static inline void mpuio_init(struct gpio_bank *bank)
>>  {
>> -     struct gpio_bank *bank = &gpio_bank[0];
>> +     static int mpuio_init_done;
>
> Why is this flag needed?   isn't the bank->method check enough?

Correct. This flag is not required.

>
>> +     if (mpuio_init_done || (bank->method != METHOD_MPUIO))
>> +             return;
>> +
>>       platform_set_drvdata(&omap_mpuio_device, bank);
>>
>>       if (platform_driver_register(&omap_mpuio_driver) == 0)
>>               (void) platform_device_register(&omap_mpuio_device);
>> +
>> +     mpuio_init_done = 1;
>>  }
>>

[...]

>>
>>       bank->base = ioremap(res->start, resource_size(res));
>>       if (!bank->base) {
>> -             dev_err(&pdev->dev, "Could not ioremap gpio bank%i\n", id);
>> -             return -ENOMEM;
>> +             dev_err(&pdev->dev, "Could not ioremap gpio bank%i\n",
>> +                             pdev->id);
>> +             ret = -ENOMEM;
>> +             goto err_free;
>>       }
>>
>>       pm_runtime_enable(bank->dev);
>>       pm_runtime_get_sync(bank->dev);
>>
>> +     mpuio_init(bank);
>
> How about moving this call into _mod_init(), and call it only when
> ->method = MPUIO.

Sure. Will do that.

-V Charulatha

>
>>       omap_gpio_mod_init(bank);
>>       omap_gpio_chip_init(bank);
>>       omap_gpio_show_rev(bank);
>
> [...]
>
> Kevin
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux