linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Revert "i2c: imx: Remove unused .id_table support"
@ 2021-01-20  2:41 Fabio Estevam
  2021-01-22  8:52 ` Wolfram Sang
  0 siblings, 1 reply; 2+ messages in thread
From: Fabio Estevam @ 2021-01-20  2:41 UTC (permalink / raw)
  To: linux; +Cc: s.hauer, kernel, linux-i2c, wsa, Fabio Estevam, Sascha Hauer

Coldfire platforms are non-DT users of this driver, so
keep the .id_table support.

This reverts commit c610199cd392e6e2d41811ef83d85355c1b862b3.

Fixes: c610199cd392 (i2c: imx: Remove unused .id_table support")
Reported-by: Sascha Hauer <sha@pengutronix.de>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 drivers/i2c/busses/i2c-imx.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 149e2898cd2f..ca47e4041ca5 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -241,6 +241,19 @@ static struct imx_i2c_hwdata vf610_i2c_hwdata = {
 
 };
 
+static const struct platform_device_id imx_i2c_devtype[] = {
+	{
+		.name = "imx1-i2c",
+		.driver_data = (kernel_ulong_t)&imx1_i2c_hwdata,
+	}, {
+		.name = "imx21-i2c",
+		.driver_data = (kernel_ulong_t)&imx21_i2c_hwdata,
+	}, {
+		/* sentinel */
+	}
+};
+MODULE_DEVICE_TABLE(platform, imx_i2c_devtype);
+
 static const struct of_device_id i2c_imx_dt_ids[] = {
 	{ .compatible = "fsl,imx1-i2c", .data = &imx1_i2c_hwdata, },
 	{ .compatible = "fsl,imx21-i2c", .data = &imx21_i2c_hwdata, },
@@ -1330,7 +1343,11 @@ static int i2c_imx_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	match = device_get_match_data(&pdev->dev);
-	i2c_imx->hwdata = match;
+	if (match)
+		i2c_imx->hwdata = match;
+	else
+		i2c_imx->hwdata = (struct imx_i2c_hwdata *)
+				platform_get_device_id(pdev)->driver_data;
 
 	/* Setup i2c_imx driver structure */
 	strlcpy(i2c_imx->adapter.name, pdev->name, sizeof(i2c_imx->adapter.name));
@@ -1498,6 +1515,7 @@ static struct platform_driver i2c_imx_driver = {
 		.of_match_table = i2c_imx_dt_ids,
 		.acpi_match_table = i2c_imx_acpi_ids,
 	},
+	.id_table = imx_i2c_devtype,
 };
 
 static int __init i2c_adap_imx_init(void)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Revert "i2c: imx: Remove unused .id_table support"
  2021-01-20  2:41 [PATCH] Revert "i2c: imx: Remove unused .id_table support" Fabio Estevam
@ 2021-01-22  8:52 ` Wolfram Sang
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2021-01-22  8:52 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: linux, s.hauer, kernel, linux-i2c, Sascha Hauer

[-- Attachment #1: Type: text/plain, Size: 466 bytes --]

On Tue, Jan 19, 2021 at 11:41:23PM -0300, Fabio Estevam wrote:
> Coldfire platforms are non-DT users of this driver, so
> keep the .id_table support.
> 
> This reverts commit c610199cd392e6e2d41811ef83d85355c1b862b3.
> 
> Fixes: c610199cd392 (i2c: imx: Remove unused .id_table support")
> Reported-by: Sascha Hauer <sha@pengutronix.de>
> Signed-off-by: Fabio Estevam <festevam@gmail.com>

Applied to for-current, thanks! imx21 could be removed, though.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-22  8:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20  2:41 [PATCH] Revert "i2c: imx: Remove unused .id_table support" Fabio Estevam
2021-01-22  8:52 ` Wolfram Sang

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).