diff mbox series

[v5,06/12] usb: cdns3-ti: grab auxdata from match data

Message ID 20240726-s2r-cdns-v5-6-8664bfb032ac@bootlin.com (mailing list archive)
State New
Headers show
Series Fix USB suspend on TI J7200 (cdns3-ti, cdns3, xhci) | expand

Commit Message

Théo Lebrun July 26, 2024, 6:17 p.m. UTC
Current code uses the global `cdns_ti_auxdata` variable as auxiliary
data passed to of_platform_populate(). Use match data to store a
pointer to auxdata.

Current behavior is not changed; it allows future compatibles to provide
different auxiliary data.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
 drivers/usb/cdns3/cdns3-ti.c | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

Comments

Roger Quadros Aug. 5, 2024, 1:51 p.m. UTC | #1
On 26/07/2024 21:17, Théo Lebrun wrote:
> Current code uses the global `cdns_ti_auxdata` variable as auxiliary
> data passed to of_platform_populate(). Use match data to store a
> pointer to auxdata.
> 
> Current behavior is not changed; it allows future compatibles to provide
> different auxiliary data.
> 
> Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>

Reviewed-by: Roger Quadros <rogerq@kernel.org>
diff mbox series

Patch

diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c
index 618fba5fa2bb..159814dfc856 100644
--- a/drivers/usb/cdns3/cdns3-ti.c
+++ b/drivers/usb/cdns3/cdns3-ti.c
@@ -87,18 +87,6 @@  static inline void cdns_ti_writel(struct cdns_ti *data, u32 offset, u32 value)
 	writel(value, data->usbss + offset);
 }
 
-static struct cdns3_platform_data cdns_ti_pdata = {
-	.quirks = CDNS3_DRD_SUSPEND_RESIDENCY_ENABLE,   /* Errata i2409 */
-};
-
-static const struct of_dev_auxdata cdns_ti_auxdata[] = {
-	{
-		.compatible = "cdns,usb3",
-		.platform_data = &cdns_ti_pdata,
-	},
-	{},
-};
-
 static void cdns_ti_reset_and_init_hw(struct cdns_ti *data)
 {
 	u32 reg;
@@ -142,6 +130,7 @@  static int cdns_ti_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct device_node *node = pdev->dev.of_node;
+	const struct of_dev_auxdata *auxdata;
 	struct cdns_ti *data;
 	unsigned long rate;
 	int error, i;
@@ -203,7 +192,8 @@  static int cdns_ti_probe(struct platform_device *pdev)
 		goto err;
 	}
 
-	error = of_platform_populate(node, NULL, cdns_ti_auxdata, dev);
+	auxdata = device_get_match_data(dev);
+	error = of_platform_populate(node, NULL, auxdata, dev);
 	if (error) {
 		dev_err(dev, "failed to create children: %d\n", error);
 		goto err;
@@ -256,9 +246,21 @@  static const struct dev_pm_ops cdns_ti_pm_ops = {
 	SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
 };
 
+static struct cdns3_platform_data cdns_ti_pdata = {
+	.quirks = CDNS3_DRD_SUSPEND_RESIDENCY_ENABLE,   /* Errata i2409 */
+};
+
+static const struct of_dev_auxdata cdns_ti_auxdata[] = {
+	{
+		.compatible = "cdns,usb3",
+		.platform_data = &cdns_ti_pdata,
+	},
+	{},
+};
+
 static const struct of_device_id cdns_ti_of_match[] = {
-	{ .compatible = "ti,j721e-usb", },
-	{ .compatible = "ti,am64-usb", },
+	{ .compatible = "ti,j721e-usb", .data = cdns_ti_auxdata },
+	{ .compatible = "ti,am64-usb", .data = cdns_ti_auxdata },
 	{},
 };
 MODULE_DEVICE_TABLE(of, cdns_ti_of_match);