Skip to contentSkip to conversation

gpio: mxc: Remove unused .id_table support

PATCH Superseded Fabio Estevam 2 participants 3 messages Nov 16, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH 1/1 gpio: mxc: Remove unused .id_table support

Since 5.10-rc1 i.MX is a devicetree-only platform and the existing .id_table support in this driver was only useful for old non-devicetree platforms.

Get rid of the .id_table since it is no longer used.

---
 drivers/gpio/gpio-mxc.c | 29 +++++------------------------
 1 file changed, 5 insertions(+), 24 deletions(-)
drivers/gpio/gpio-mxc.c +5 -24
index 643f4c557ac2..aadc11064b74 100644
@@ -133,30 +133,12 @@ static struct mxc_gpio_hwdata *mxc_gpio_hwdata;
 #define GPIO_INT_FALL_EDGE	(mxc_gpio_hwdata->fall_edge)
 #define GPIO_INT_BOTH_EDGES	0x4
 
-static const struct platform_device_id mxc_gpio_devtype[] = {
-	{
-		.name = "imx1-gpio",
-		.driver_data = IMX1_GPIO,
-	}, {
-		.name = "imx21-gpio",
-		.driver_data = IMX21_GPIO,
-	}, {
-		.name = "imx31-gpio",
-		.driver_data = IMX31_GPIO,
-	}, {
-		.name = "imx35-gpio",
-		.driver_data = IMX35_GPIO,
-	}, {
-		/* sentinel */
-	}
-};
-
 static const struct of_device_id mxc_gpio_dt_ids[] = {
-	{ .compatible = "fsl,imx1-gpio", .data = &mxc_gpio_devtype[IMX1_GPIO], },
-	{ .compatible = "fsl,imx21-gpio", .data = &mxc_gpio_devtype[IMX21_GPIO], },
-	{ .compatible = "fsl,imx31-gpio", .data = &mxc_gpio_devtype[IMX31_GPIO], },
-	{ .compatible = "fsl,imx35-gpio", .data = &mxc_gpio_devtype[IMX35_GPIO], },
-	{ .compatible = "fsl,imx7d-gpio", .data = &mxc_gpio_devtype[IMX35_GPIO], },
+	{ .compatible = "fsl,imx1-gpio", .data = (const void *)IMX1_GPIO },
+	{ .compatible = "fsl,imx21-gpio", .data = (const void *)IMX21_GPIO },
+	{ .compatible = "fsl,imx31-gpio", .data = (const void *)IMX31_GPIO },
+	{ .compatible = "fsl,imx35-gpio", .data = (const void *)IMX35_GPIO },
+	{ .compatible = "fsl,imx7d-gpio", .data = (const void *)IMX35_GPIO },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, mxc_gpio_dt_ids);
@@ -596,7 +578,6 @@ static struct platform_driver mxc_gpio_driver = {
 		.suppress_bind_attrs = true,
 	},
 	.probe		= mxc_gpio_probe,
-	.id_table	= mxc_gpio_devtype,
 };
 
 static int __init gpio_mxc_init(void)
Signature · 1 line
2.17.1
#1 lore raw

Hi Fabio,

Quoted 52 lines · Fabio Estevam

Since 5.10-rc1 i.MX is a devicetree-only platform and the existing .id_table support in this driver was only useful for old non-devicetree platforms.

Get rid of the .id_table since it is no longer used.

---
 drivers/gpio/gpio-mxc.c | 29 +++++------------------------
 1 file changed, 5 insertions(+), 24 deletions(-)
drivers/gpio/gpio-mxc.c +5 -23
index 643f4c557ac2..aadc11064b74 100644
@@ -133,30 +133,12 @@ static struct mxc_gpio_hwdata *mxc_gpio_hwdata;
 #define GPIO_INT_FALL_EDGE	(mxc_gpio_hwdata->fall_edge)
 #define GPIO_INT_BOTH_EDGES	0x4
 
-static const struct platform_device_id mxc_gpio_devtype[] = {
-	{
-		.name = "imx1-gpio",
-		.driver_data = IMX1_GPIO,
-	}, {
-		.name = "imx21-gpio",
-		.driver_data = IMX21_GPIO,
-	}, {
-		.name = "imx31-gpio",
-		.driver_data = IMX31_GPIO,
-	}, {
-		.name = "imx35-gpio",
-		.driver_data = IMX35_GPIO,
-	}, {
-		/* sentinel */
-	}
-};
-
 static const struct of_device_id mxc_gpio_dt_ids[] = {
-	{ .compatible = "fsl,imx1-gpio", .data = &mxc_gpio_devtype[IMX1_GPIO], },
-	{ .compatible = "fsl,imx21-gpio", .data = &mxc_gpio_devtype[IMX21_GPIO], },
-	{ .compatible = "fsl,imx31-gpio", .data = &mxc_gpio_devtype[IMX31_GPIO], },
-	{ .compatible = "fsl,imx35-gpio", .data = &mxc_gpio_devtype[IMX35_GPIO], },
-	{ .compatible = "fsl,imx7d-gpio", .data = &mxc_gpio_devtype[IMX35_GPIO], },
+	{ .compatible = "fsl,imx1-gpio", .data = (const void *)IMX1_GPIO },
+	{ .compatible = "fsl,imx21-gpio", .data = (const void *)IMX21_GPIO },
+	{ .compatible = "fsl,imx31-gpio", .data = (const void *)IMX31_GPIO },
+	{ .compatible = "fsl,imx35-gpio", .data = (const void *)IMX35_GPIO },
+	{ .compatible = "fsl,imx7d-gpio", .data = (const void *)IMX35_GPIO },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, mxc_gpio_dt_ids);

drivers/gpio/gpio-mxc.c static struct platform_driver mxc_gpio_driver = { · line 583

Quoted 7 lines
drivers/gpio/gpio-mxc.c +0 -1
@@ -596,7 +578,6 @@ static struct platform_driver mxc_gpio_driver = {
 		.suppress_bind_attrs = true,
 	},
 	.probe		= mxc_gpio_probe,
-	.id_table	= mxc_gpio_devtype,
 };
 
 static int __init gpio_mxc_init(void)

This seems to be missing conversion of the code that uses the matched of_device_id. That currently has to expect .data to be a pointer to struct platform_device_id.

regards
Philipp

author reviewer
#2 lore raw

Hi Philipp,

Quoted 3 lines · Philipp Zabel

This seems to be missing conversion of the code that uses the matched of_device_id. That currently has to expect .data to be a pointer to struct platform_device_id.

Ops, you are right. I realized that I tested this on an imx7ulp-evk, which does not use the gpio mxc driver.

Fixed as per your suggestion and tested on an imx6 board now :-)

Thanks