Skip to contentSkip to conversation

gpio: generic: Use platform_device_id->driver_data field for driver flags

PATCH RESEND In review Alexander Shiyan 3 participants 3 messages Mar 16, 2014 – Mar 17, 2014 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 gpio: generic: Use platform_device_id->driver_data field for driver flags

---
 drivers/gpio/gpio-generic.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/gpio/gpio-generic.c +9 -7
index d815dd2..b5dff9e 100644
@@ -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;
@@ -551,9 +548,14 @@ 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);
 
Signature · 1 line
1.8.3.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 35 lines · Alexander Shiyan
---
 drivers/gpio/gpio-generic.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/gpio/gpio-generic.c +1 -7
index d815dd2..b5dff9e 100644
@@ -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;
@@ -551,9 +548,14 @@ 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", },
-       {},

drivers/gpio/gpio-generic.c static int bgpio_pdev_remove(struct platform_device *pdev) · line 560

Quoted 10 lines
drivers/gpio/gpio-generic.c +8 -0
+       {
+               .name           = "basic-mmio-gpio",
+               .driver_data    = 0,
+       }, {
+               .name           = "basic-mmio-gpio-be",
+               .driver_data    = BGPIOF_BIG_ENDIAN,
+       },
+       { }
 };
 MODULE_DEVICE_TABLE(platform, bgpio_id_table);

Agreed that this kind of setup ought to be data-oriented.