* [PATCH] gpio: generic: Use platform_device_id->driver_data field for driver flags
@ 2013-12-21 20:15 Alexander Shiyan
2014-01-02 13:13 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Shiyan @ 2013-12-21 20:15 UTC (permalink / raw)
To: linux-gpio; +Cc: Linus Walleij, Alexandre Courbot, Alexander Shiyan
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
drivers/gpio/gpio-generic.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c
index d2196bf..82d36fc 100644
--- a/drivers/gpio/gpio-generic.c
+++ b/drivers/gpio/gpio-generic.c
@@ -488,7 +488,7 @@ static int bgpio_pdev_probe(struct platform_device *pdev)
void __iomem *dirout;
void __iomem *dirin;
unsigned long sz;
- unsigned long flags = 0;
+ unsigned long flags = pdev->id_entry->driver_data;
int err;
struct bgpio_chip *bgc;
struct bgpio_pdata *pdata = dev_get_platdata(dev);
@@ -519,9 +519,6 @@ static int bgpio_pdev_probe(struct platform_device *pdev)
if (err)
return err;
- if (!strcmp(platform_get_device_id(pdev)->name, "basic-mmio-gpio-be"))
- flags |= BGPIOF_BIG_ENDIAN;
-
bgc = devm_kzalloc(&pdev->dev, sizeof(*bgc), GFP_KERNEL);
if (!bgc)
return -ENOMEM;
@@ -549,9 +546,15 @@ static int bgpio_pdev_remove(struct platform_device *pdev)
}
static const struct platform_device_id bgpio_id_table[] = {
- { "basic-mmio-gpio", },
- { "basic-mmio-gpio-be", },
- {},
+ {
+ .name = "basic-mmio-gpio",
+ .driver_data = 0,
+ },
+ {
+ .name = "basic-mmio-gpio-be",
+ .driver_data = BGPIOF_BIG_ENDIAN,
+ },
+ { }
};
MODULE_DEVICE_TABLE(platform, bgpio_id_table);
--
1.8.3.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] gpio: generic: Use platform_device_id->driver_data field for driver flags
2013-12-21 20:15 [PATCH] gpio: generic: Use platform_device_id->driver_data field for driver flags Alexander Shiyan
@ 2014-01-02 13:13 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2014-01-02 13:13 UTC (permalink / raw)
To: Alexander Shiyan, Anton Vorontsov, Anton Vorontsov
Cc: linux-gpio@vger.kernel.org, Alexandre Courbot
On Sat, Dec 21, 2013 at 9:15 PM, Alexander Shiyan <shc_work@mail.ru> wrote:
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
> drivers/gpio/gpio-generic.c | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c
> index d2196bf..82d36fc 100644
> --- a/drivers/gpio/gpio-generic.c
> +++ b/drivers/gpio/gpio-generic.c
> @@ -488,7 +488,7 @@ static int bgpio_pdev_probe(struct platform_device *pdev)
> void __iomem *dirout;
> void __iomem *dirin;
> unsigned long sz;
> - unsigned long flags = 0;
> + unsigned long flags = pdev->id_entry->driver_data;
> int err;
> struct bgpio_chip *bgc;
> struct bgpio_pdata *pdata = dev_get_platdata(dev);
> @@ -519,9 +519,6 @@ static int bgpio_pdev_probe(struct platform_device *pdev)
> if (err)
> return err;
>
> - if (!strcmp(platform_get_device_id(pdev)->name, "basic-mmio-gpio-be"))
> - flags |= BGPIOF_BIG_ENDIAN;
> -
> bgc = devm_kzalloc(&pdev->dev, sizeof(*bgc), GFP_KERNEL);
> if (!bgc)
> return -ENOMEM;
> @@ -549,9 +546,15 @@ static int bgpio_pdev_remove(struct platform_device *pdev)
> }
>
> static const struct platform_device_id bgpio_id_table[] = {
> - { "basic-mmio-gpio", },
> - { "basic-mmio-gpio-be", },
> - {},
> + {
> + .name = "basic-mmio-gpio",
> + .driver_data = 0,
> + },
> + {
> + .name = "basic-mmio-gpio-be",
> + .driver_data = BGPIOF_BIG_ENDIAN,
> + },
> + { }
> };
> MODULE_DEVICE_TABLE(platform, bgpio_id_table);
Looks right to me, but I'd like Anton to ACK this patch as this is his
driver.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-01-02 13:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-21 20:15 [PATCH] gpio: generic: Use platform_device_id->driver_data field for driver flags Alexander Shiyan
2014-01-02 13:13 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).