aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/extcon
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-06-15 23:56:24 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-18 19:40:18 -0400
commit01eaf2458773b276e219a48df69351d230c63d0b (patch)
treead72da22732b5844b8cc564d8a30fa2e62b5f70e /drivers/extcon
parentb945f3fa829a7315488f4d39a866dfbb29e8a49a (diff)
extcon: Convert extcon_gpio to devm_gpio_request_one
Also remove unneeded devm_kfree calls. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/extcon')
-rw-r--r--drivers/extcon/extcon_gpio.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/extcon/extcon_gpio.c b/drivers/extcon/extcon_gpio.c
index 8a0dcc11c7c7..fe3db45fa83c 100644
--- a/drivers/extcon/extcon_gpio.c
+++ b/drivers/extcon/extcon_gpio.c
@@ -105,25 +105,25 @@ static int __devinit gpio_extcon_probe(struct platform_device *pdev)
105 105
106 ret = extcon_dev_register(&extcon_data->edev, &pdev->dev); 106 ret = extcon_dev_register(&extcon_data->edev, &pdev->dev);
107 if (ret < 0) 107 if (ret < 0)
108 goto err_extcon_dev_register; 108 return ret;
109 109
110 ret = gpio_request_one(extcon_data->gpio, GPIOF_DIR_IN, pdev->name); 110 ret = gpio_request_one(extcon_data->gpio, GPIOF_DIR_IN, pdev->name);
111 if (ret < 0) 111 if (ret < 0)
112 goto err_request_gpio; 112 goto err;
113 113
114 INIT_DELAYED_WORK(&extcon_data->work, gpio_extcon_work); 114 INIT_DELAYED_WORK(&extcon_data->work, gpio_extcon_work);
115 115
116 extcon_data->irq = gpio_to_irq(extcon_data->gpio); 116 extcon_data->irq = gpio_to_irq(extcon_data->gpio);
117 if (extcon_data->irq < 0) { 117 if (extcon_data->irq < 0) {
118 ret = extcon_data->irq; 118 ret = extcon_data->irq;
119 goto err_detect_irq_num_failed; 119 goto err;
120 } 120 }
121 121
122 ret = request_any_context_irq(extcon_data->irq, gpio_irq_handler, 122 ret = request_any_context_irq(extcon_data->irq, gpio_irq_handler,
123 pdata->irq_flags, pdev->name, 123 pdata->irq_flags, pdev->name,
124 extcon_data); 124 extcon_data);
125 if (ret < 0) 125 if (ret < 0)
126 goto err_request_irq; 126 goto err;
127 127
128 platform_set_drvdata(pdev, extcon_data); 128 platform_set_drvdata(pdev, extcon_data);
129 /* Perform initial detection */ 129 /* Perform initial detection */
@@ -131,13 +131,8 @@ static int __devinit gpio_extcon_probe(struct platform_device *pdev)
131 131
132 return 0; 132 return 0;
133 133
134err_request_irq: 134err:
135err_detect_irq_num_failed:
136 gpio_free(extcon_data->gpio);
137err_request_gpio:
138 extcon_dev_unregister(&extcon_data->edev); 135 extcon_dev_unregister(&extcon_data->edev);
139err_extcon_dev_register:
140 devm_kfree(&pdev->dev, extcon_data);
141 136
142 return ret; 137 return ret;
143} 138}
@@ -148,9 +143,7 @@ static int __devexit gpio_extcon_remove(struct platform_device *pdev)
148 143
149 cancel_delayed_work_sync(&extcon_data->work); 144 cancel_delayed_work_sync(&extcon_data->work);
150 free_irq(extcon_data->irq, extcon_data); 145 free_irq(extcon_data->irq, extcon_data);
151 gpio_free(extcon_data->gpio);
152 extcon_dev_unregister(&extcon_data->edev); 146 extcon_dev_unregister(&extcon_data->edev);
153 devm_kfree(&pdev->dev, extcon_data);
154 147
155 return 0; 148 return 0;
156} 149}