Skip to contentSkip to conversation

usb: at91: fix clk_get error handling

PATCH New Jean-Christophe PLAGNIOL-VILLARD 2 participants 3 messages Dec 8, 2011 – Dec 9, 2011

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 usb: at91: fix clk_get error handling

Cc Nicolas Ferre <[email protected]>
Cc linux-usb at vger.kernel.org

---
Hi,

can we apply via at91 as it's depend on patch already on arm-soc

Best Regarfds,
J.

 drivers/usb/host/ohci-at91.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
drivers/usb/host/ohci-at91.c +18 -0
index 5df0b0e..dc33517 100644
@@ -139,8 +139,23 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver,
 	}
 
 	iclk = clk_get(&pdev->dev, "ohci_clk");
+	if (IS_ERR(iclk)) {
+		dev_err(&pdev->dev, "failed to get ohci_clk\n");
+		retval = PTR_ERR(iclk);
+		goto err3;
+	}
 	fclk = clk_get(&pdev->dev, "uhpck");
+	if (IS_ERR(fclk)) {
+		dev_err(&pdev->dev, "failed to get uhpck\n");
+		retval = PTR_ERR(fclk);
+		goto err4;
+	}
 	hclk = clk_get(&pdev->dev, "hclk");
+	if (IS_ERR(hclk)) {
+		dev_err(&pdev->dev, "failed to get hclk\n");
+		retval = PTR_ERR(hclk);
+		goto err5;
+	}
 
 	at91_start_hc(pdev);
 	ohci_hcd_init(hcd_to_ohci(hcd));
@@ -153,9 +168,12 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver,
 	at91_stop_hc(pdev);
 
 	clk_put(hclk);
+ err5:
 	clk_put(fclk);
+ err4:
 	clk_put(iclk);
 
+ err3:
 	iounmap(hcd->regs);
 
  err2:
Signature · 1 line
1.7.7
#1 lore raw

PATCH 2/2 ARM: at91: usb ohci rename vbus_pin_inverted to vbus_pin_active_low

as everywhere else and allow to configure independently each vbus_pin

Cc Nicolas Ferre <[email protected]>
Cc linux-usb at vger.kernel.org

---
Hi,

can we apply via at91 as it's depend on patch already on arm-soc

Best Regarfds,
J.

 arch/arm/mach-at91/include/mach/board.h |    2 +-
 drivers/usb/host/ohci-at91.c            |    6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
arch/arm/mach-at91/include/mach/board.h +1 -1
index d0b377b..3b33f07 100644
@@ -88,7 +88,7 @@ extern void __init at91_add_device_eth(struct macb_platform_data *data);
 struct at91_usbh_data {
 	u8		ports;		/* number of ports on root hub */
 	int		vbus_pin[2];	/* port power-control pin */
-	u8              vbus_pin_inverted;
+	u8              vbus_pin_active_low[2];
 	u8              overcurrent_supported;
 	int             overcurrent_pin[2];
 	u8              overcurrent_status[2];
drivers/usb/host/ohci-at91.c +4 -2
index dc33517..77afabc 100644
@@ -244,7 +244,8 @@ static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int
 	if (!gpio_is_valid(pdata->vbus_pin[port]))
 		return;
 
-	gpio_set_value(pdata->vbus_pin[port], !pdata->vbus_pin_inverted ^ enable);
+	gpio_set_value(pdata->vbus_pin[port],
+		       !pdata->vbus_pin_active_low[port] ^ enable);
 }
 
 static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port)
@@ -255,7 +256,8 @@ static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port)
 	if (!gpio_is_valid(pdata->vbus_pin[port]))
 		return -EINVAL;
 
-	return gpio_get_value(pdata->vbus_pin[port]) ^ !pdata->vbus_pin_inverted;
+	return gpio_get_value(pdata->vbus_pin[port]) ^
+		!pdata->vbus_pin_active_low[port];
 }
 
 /*
Signature · 1 line
1.7.7
#2 lore raw

PATCH 1/2 usb: at91: fix clk_get error handling

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD
Cc Nicolas Ferre <[email protected]>
Cc linux-usb at vger.kernel.org

---
Hi,

can we apply via at91 as it's depend on patch already on arm-soc

That's fine with me, feel free to add:

to both of these patches and take them through the arm-soc tree.

greg k-h