diff mbox series

[v4,5/9] usb: cdns3-ti: pass auxdata from match data to of_platform_populate()

Message ID 20240307-j7200-usb-suspend-v4-5-5ec7615431f3@bootlin.com (mailing list archive)
State New, archived
Headers show
Series usb: cdns: fix suspend on J7200 by assuming reset-on-resume | expand

Commit Message

Théo Lebrun March 7, 2024, 9:55 a.m. UTC
Allow compatible to pick auxdata given to child platform devices.

No compatible exploits this functionality, just yet.

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

Comments

Roger Quadros March 7, 2024, 12:38 p.m. UTC | #1
On 07/03/2024 11:55, Théo Lebrun wrote:
> Allow compatible to pick auxdata given to child platform devices.
> 
> No compatible exploits this functionality, just yet.
> 

This patch could be merged with Patch 7 so we know exactly how auxdata
is used?

> Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
> ---
>  drivers/usb/cdns3/cdns3-ti.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c
> index f76327566798..29fb24c811b3 100644
> --- a/drivers/usb/cdns3/cdns3-ti.c
> +++ b/drivers/usb/cdns3/cdns3-ti.c
> @@ -62,7 +62,8 @@ struct cdns_ti {
>  };
>  
>  struct cdns_ti_match_data {
> -	bool reset_on_resume;
> +	bool				reset_on_resume;
> +	const struct of_dev_auxdata	*auxdata;
>  };
>  
>  static const int cdns_ti_rate_table[] = {	/* in KHZ */
> @@ -95,6 +96,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 = NULL;
>  	struct cdns_ti *data;
>  	unsigned long rate;
>  	int error, i;
> @@ -149,7 +151,9 @@ static int cdns_ti_probe(struct platform_device *pdev)
>  		goto err;
>  	}
>  
> -	error = of_platform_populate(node, NULL, NULL, dev);
> +	if (data->match_data)
> +		auxdata = data->match_data->auxdata;
> +	error = of_platform_populate(node, NULL, auxdata, dev);
>  	if (error) {
>  		dev_err(dev, "failed to create children: %d\n", error);
>  		goto err;
>
Théo Lebrun March 7, 2024, 2:47 p.m. UTC | #2
Hello,

On Thu Mar 7, 2024 at 1:38 PM CET, Roger Quadros wrote:
>
>
> On 07/03/2024 11:55, Théo Lebrun wrote:
> > Allow compatible to pick auxdata given to child platform devices.
> > 
> > No compatible exploits this functionality, just yet.
> > 
>
> This patch could be merged with Patch 7 so we know exactly how auxdata
> is used?

Indeed. I liked splitting. Previous revision had it as a single patch.
I can revert.

Regards,

--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
diff mbox series

Patch

diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c
index f76327566798..29fb24c811b3 100644
--- a/drivers/usb/cdns3/cdns3-ti.c
+++ b/drivers/usb/cdns3/cdns3-ti.c
@@ -62,7 +62,8 @@  struct cdns_ti {
 };
 
 struct cdns_ti_match_data {
-	bool reset_on_resume;
+	bool				reset_on_resume;
+	const struct of_dev_auxdata	*auxdata;
 };
 
 static const int cdns_ti_rate_table[] = {	/* in KHZ */
@@ -95,6 +96,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 = NULL;
 	struct cdns_ti *data;
 	unsigned long rate;
 	int error, i;
@@ -149,7 +151,9 @@  static int cdns_ti_probe(struct platform_device *pdev)
 		goto err;
 	}
 
-	error = of_platform_populate(node, NULL, NULL, dev);
+	if (data->match_data)
+		auxdata = data->match_data->auxdata;
+	error = of_platform_populate(node, NULL, auxdata, dev);
 	if (error) {
 		dev_err(dev, "failed to create children: %d\n", error);
 		goto err;