diff mbox

[v5,1/8] usb: phy: omap-control: Get rid of platform data

Message ID 1377010577-19355-2-git-send-email-rogerq@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roger Quadros Aug. 20, 2013, 2:56 p.m. UTC
omap-control device is present from OMAP4 onwards which
support device tree boots only. So get rid of platform data.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/usb/phy/phy-omap-control.c   |   18 +++++++-----------
 include/linux/usb/omap_control_usb.h |    4 ----
 2 files changed, 7 insertions(+), 15 deletions(-)

Comments

Langer Thomas (LQDE RD ST PON SW) Aug. 20, 2013, 3:04 p.m. UTC | #1
Hello Roger,

this will not work!

Roger Quadros wrote onĀ 2013-08-20:

> -	struct omap_control_usb_platform_data *pdata =
> -			dev_get_platdata(&pdev->dev);
> +
> +	if (np) {
> +		of_property_read_u32(np, "ti,type", &control_usb->type);

here you are dereferencing control_usb

> +	} else {
> +		/* We only support DT boot */
> +		return -EINVAL;
> +	}
> 
>  	control_usb = devm_kzalloc(&pdev->dev, sizeof(*control_usb),
>  		GFP_KERNEL);

and here it is allocated!

Best Regards,
Thomas


--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Roger Quadros Aug. 21, 2013, 6:46 a.m. UTC | #2
Hi Thomas,

On 08/20/2013 06:04 PM, thomas.langer@lantiq.com wrote:
> Hello Roger,
> 
> this will not work!
> 
> Roger Quadros wrote on 2013-08-20:
> 
>> -	struct omap_control_usb_platform_data *pdata =
>> -			dev_get_platdata(&pdev->dev);
>> +
>> +	if (np) {
>> +		of_property_read_u32(np, "ti,type", &control_usb->type);
> 
> here you are dereferencing control_usb
> 
>> +	} else {
>> +		/* We only support DT boot */
>> +		return -EINVAL;
>> +	}
>>
>>  	control_usb = devm_kzalloc(&pdev->dev, sizeof(*control_usb),
>>  		GFP_KERNEL);
> 
> and here it is allocated!

Good catch :).
The problem is eliminated by other patches in this series, so tests ran fine.
But I'll fix this one.

cheers,
-roger
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/usb/phy/phy-omap-control.c b/drivers/usb/phy/phy-omap-control.c
index a4dda8e..7f446c4 100644
--- a/drivers/usb/phy/phy-omap-control.c
+++ b/drivers/usb/phy/phy-omap-control.c
@@ -197,8 +197,13 @@  static int omap_control_usb_probe(struct platform_device *pdev)
 {
 	struct resource	*res;
 	struct device_node *np = pdev->dev.of_node;
-	struct omap_control_usb_platform_data *pdata =
-			dev_get_platdata(&pdev->dev);
+
+	if (np) {
+		of_property_read_u32(np, "ti,type", &control_usb->type);
+	} else {
+		/* We only support DT boot */
+		return -EINVAL;
+	}
 
 	control_usb = devm_kzalloc(&pdev->dev, sizeof(*control_usb),
 		GFP_KERNEL);
@@ -207,15 +212,6 @@  static int omap_control_usb_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
-	if (np) {
-		of_property_read_u32(np, "ti,type", &control_usb->type);
-	} else if (pdata) {
-		control_usb->type = pdata->type;
-	} else {
-		dev_err(&pdev->dev, "no pdata present\n");
-		return -EINVAL;
-	}
-
 	control_usb->dev	= &pdev->dev;
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
diff --git a/include/linux/usb/omap_control_usb.h b/include/linux/usb/omap_control_usb.h
index 27b5b8c..e2416b4 100644
--- a/include/linux/usb/omap_control_usb.h
+++ b/include/linux/usb/omap_control_usb.h
@@ -31,10 +31,6 @@  struct omap_control_usb {
 	u32 type;
 };
 
-struct omap_control_usb_platform_data {
-	u8 type;
-};
-
 enum omap_control_usb_mode {
 	USB_MODE_UNDEFINED = 0,
 	USB_MODE_HOST,