Re: [PATCH v3 2/7] gpio: davinci: move to platform device

From: Sekhar Nori
Date: Fri Aug 23 2013 - 14:03:32 EST


On 8/18/2013 10:48 AM, Lad, Prabhakar wrote:
> From: KV Sujith <sujithkv@xxxxxx>
>
> Modify GPIO Davinci driver to be compliant to standard platform drivers.
> The driver did not have platform driver structure or a probe. Instead,
> had a davinci_gpio_setup() function which is called in the pure_init
> sequence. The function also had dependency on davinci_soc_info structure
> of the corresponding platform. For Device Tree(DT) implementation, we
> need to get rid of the dependency on the davinci_soc_info structure.
> Hence as a first stage of DT conversion, we implement a probe. Future
> commits shall modify the probe to read platform related data from DT.
>
> - Add platform_driver structure and driver register function for davinci
> GPIO driver. The driver registration is made to happen in
> postcore_initcall. This is required since machine init functions like
> da850_lcd_hw_init() make use of GPIO.
> - Convert the davinci_gpio_setup() to davinci_gpio_probe().
> - Remove access of members in soc_info structure. Instead, relevant data
> are taken from davinci_gpio_platform_data structure pointed by
> pdev->dev.platform_data.
> - Change clk_get() to devm_clk_get() as devm_clk_get() is a device
> managed function and makes error handling simpler.
> - Change pr_err to dev_err for gpio error reporting.
> - Add struct davinci_gpio_platform_data davinci for gpio module.
>
> Signed-off-by: KV Sujith <sujithkv@xxxxxx>
> [avinashphilip@xxxxxx: Move global definition for "struct
> davinci_gpio_controller" variable to local in probe and set it as driver
> data.]
> Signed-off-by: Philip Avinash <avinashphilip@xxxxxx>
> Acked-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
> [nsekhar@xxxxxx: dropped unused structure member, rebased on new clean-up
> patch and fixes error messages]
> Signed-off-by: Sekhar Nori <nsekhar@xxxxxx>
> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@xxxxxxxxx>

Queuing this after editing the commit message for brevity and ...

> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (unlikely(!res)) {

... removing such unneeded unlikely() calls. This is not performance
critical path.

Updated patch attached for reference.

Thanks,
Sekhar