ar71xx: fix an unused variable warning
[openwrt.git] / target / linux / omap24xx / patches-2.6.38 / 596-cbus-tahvo-usb-clk.patch
1 --- a/drivers/cbus/tahvo-usb.c
2 +++ b/drivers/cbus/tahvo-usb.c
3 @@ -98,6 +98,7 @@ struct tahvo_usb {
4 #ifdef CONFIG_USB_OTG
5 int tahvo_mode;
6 #endif
7 + struct clk *ick;
8 };
9 static struct tahvo_usb *tahvo_usb_device;
10
11 @@ -673,6 +674,14 @@ static int __init tahvo_usb_probe(struct
12 INIT_WORK(&tu->irq_work, tahvo_usb_irq_work);
13 mutex_init(&tu->serialize);
14
15 + tu->ick = clk_get(NULL, "usb_l4_ick");
16 + if (IS_ERR(tu->ick)) {
17 + dev_err(dev, "Failed to get usb_l4_ick\n");
18 + ret = PTR_ERR(tu->ick);
19 + goto err_free_tu;
20 + }
21 + clk_enable(tu->ick);
22 +
23 /* Set initial state, so that we generate kevents only on
24 * state changes */
25 tu->vbus_state = tahvo_read_reg(TAHVO_REG_IDSR) & 0x01;
26 @@ -681,10 +690,8 @@ static int __init tahvo_usb_probe(struct
27 ret = tahvo_request_irq(TAHVO_INT_VBUSON, tahvo_usb_vbus_interrupt,
28 (unsigned long) tu, "vbus_interrupt");
29 if (ret != 0) {
30 - kfree(tu);
31 - tahvo_usb_device = NULL;
32 printk(KERN_ERR "Could not register Tahvo interrupt for VBUS\n");
33 - return ret;
34 + goto err_release_clk;
35 }
36
37 /* Attributes */
38 @@ -709,10 +716,7 @@ static int __init tahvo_usb_probe(struct
39 ret = otg_set_transceiver(&tu->otg);
40 if (ret < 0) {
41 printk(KERN_ERR "Cannot register USB transceiver\n");
42 - tahvo_usb_device = NULL;
43 - kfree(tu);
44 - tahvo_free_irq(TAHVO_INT_VBUSON);
45 - return ret;
46 + goto err_free_irq;
47 }
48
49 dev_set_drvdata(dev, tu);
50 @@ -721,6 +725,17 @@ static int __init tahvo_usb_probe(struct
51 * may not be generated in addition to this. */
52 schedule_work(&tu->irq_work);
53 return 0;
54 +
55 +err_free_irq:
56 + tahvo_free_irq(TAHVO_INT_VBUSON);
57 +err_release_clk:
58 + clk_disable(tu->ick);
59 + clk_put(tu->ick);
60 +err_free_tu:
61 + kfree(tu);
62 + tahvo_usb_device = NULL;
63 +
64 + return ret;
65 }
66
67 static int __exit tahvo_usb_remove(struct platform_device *pdev)
68 @@ -736,6 +751,8 @@ static int __exit tahvo_usb_remove(struc
69 #ifdef CONFIG_USB_OTG
70 device_remove_file(&pdev->dev, &dev_attr_otg_mode);
71 #endif
72 + clk_disable(tu->ick);
73 + clk_put(tu->ick);
74
75 kfree(tu);
76 tahvo_usb_device = NULL;
This page took 0.050796 seconds and 5 git commands to generate.