diff options
author | Jingoo Han <jg1.han@samsung.com> | 2012-07-30 17:40:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-30 20:25:15 -0400 |
commit | 62a5c075bafb91895506bc68f76db1ff1b5d1a02 (patch) | |
tree | 2ad00fec41baefb17f1d1c66a7b0c5f8943cbe96 /drivers/video/backlight | |
parent | 4405d5d9dd76740bfb715fc6a32343e087a13e1e (diff) |
backlight: l4f00242t03: export and use devm_gpio_request_one()
The devm_ functions allocate memory that is released when a driver
detaches. This patch uses devm_gpio_request_one() for these functions.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Cc: Alberto Panizzo <alberto@amarulasolutions.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/backlight')
-rw-r--r-- | drivers/video/backlight/l4f00242t03.c | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/drivers/video/backlight/l4f00242t03.c b/drivers/video/backlight/l4f00242t03.c index 40f606a86093..2d90c0648aa0 100644 --- a/drivers/video/backlight/l4f00242t03.c +++ b/drivers/video/backlight/l4f00242t03.c | |||
@@ -175,28 +175,27 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi) | |||
175 | 175 | ||
176 | priv->spi = spi; | 176 | priv->spi = spi; |
177 | 177 | ||
178 | ret = gpio_request_one(pdata->reset_gpio, GPIOF_OUT_INIT_HIGH, | 178 | ret = devm_gpio_request_one(&spi->dev, pdata->reset_gpio, |
179 | "lcd l4f00242t03 reset"); | 179 | GPIOF_OUT_INIT_HIGH, "lcd l4f00242t03 reset"); |
180 | if (ret) { | 180 | if (ret) { |
181 | dev_err(&spi->dev, | 181 | dev_err(&spi->dev, |
182 | "Unable to get the lcd l4f00242t03 reset gpio.\n"); | 182 | "Unable to get the lcd l4f00242t03 reset gpio.\n"); |
183 | return ret; | 183 | return ret; |
184 | } | 184 | } |
185 | 185 | ||
186 | ret = gpio_request_one(pdata->data_enable_gpio, GPIOF_OUT_INIT_LOW, | 186 | ret = devm_gpio_request_one(&spi->dev, pdata->data_enable_gpio, |
187 | "lcd l4f00242t03 data enable"); | 187 | GPIOF_OUT_INIT_LOW, "lcd l4f00242t03 data enable"); |
188 | if (ret) { | 188 | if (ret) { |
189 | dev_err(&spi->dev, | 189 | dev_err(&spi->dev, |
190 | "Unable to get the lcd l4f00242t03 data en gpio.\n"); | 190 | "Unable to get the lcd l4f00242t03 data en gpio.\n"); |
191 | goto err; | 191 | return ret; |
192 | } | 192 | } |
193 | 193 | ||
194 | priv->io_reg = regulator_get(&spi->dev, "vdd"); | 194 | priv->io_reg = regulator_get(&spi->dev, "vdd"); |
195 | if (IS_ERR(priv->io_reg)) { | 195 | if (IS_ERR(priv->io_reg)) { |
196 | ret = PTR_ERR(priv->io_reg); | ||
197 | dev_err(&spi->dev, "%s: Unable to get the IO regulator\n", | 196 | dev_err(&spi->dev, "%s: Unable to get the IO regulator\n", |
198 | __func__); | 197 | __func__); |
199 | goto err2; | 198 | return PTR_ERR(priv->io_reg); |
200 | } | 199 | } |
201 | 200 | ||
202 | priv->core_reg = regulator_get(&spi->dev, "vcore"); | 201 | priv->core_reg = regulator_get(&spi->dev, "vcore"); |
@@ -204,14 +203,14 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi) | |||
204 | ret = PTR_ERR(priv->core_reg); | 203 | ret = PTR_ERR(priv->core_reg); |
205 | dev_err(&spi->dev, "%s: Unable to get the core regulator\n", | 204 | dev_err(&spi->dev, "%s: Unable to get the core regulator\n", |
206 | __func__); | 205 | __func__); |
207 | goto err3; | 206 | goto err1; |
208 | } | 207 | } |
209 | 208 | ||
210 | priv->ld = lcd_device_register("l4f00242t03", | 209 | priv->ld = lcd_device_register("l4f00242t03", |
211 | &spi->dev, priv, &l4f_ops); | 210 | &spi->dev, priv, &l4f_ops); |
212 | if (IS_ERR(priv->ld)) { | 211 | if (IS_ERR(priv->ld)) { |
213 | ret = PTR_ERR(priv->ld); | 212 | ret = PTR_ERR(priv->ld); |
214 | goto err4; | 213 | goto err2; |
215 | } | 214 | } |
216 | 215 | ||
217 | /* Init the LCD */ | 216 | /* Init the LCD */ |
@@ -223,14 +222,10 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi) | |||
223 | 222 | ||
224 | return 0; | 223 | return 0; |
225 | 224 | ||
226 | err4: | 225 | err2: |
227 | regulator_put(priv->core_reg); | 226 | regulator_put(priv->core_reg); |
228 | err3: | 227 | err1: |
229 | regulator_put(priv->io_reg); | 228 | regulator_put(priv->io_reg); |
230 | err2: | ||
231 | gpio_free(pdata->data_enable_gpio); | ||
232 | err: | ||
233 | gpio_free(pdata->reset_gpio); | ||
234 | 229 | ||
235 | return ret; | 230 | return ret; |
236 | } | 231 | } |
@@ -238,16 +233,12 @@ err: | |||
238 | static int __devexit l4f00242t03_remove(struct spi_device *spi) | 233 | static int __devexit l4f00242t03_remove(struct spi_device *spi) |
239 | { | 234 | { |
240 | struct l4f00242t03_priv *priv = dev_get_drvdata(&spi->dev); | 235 | struct l4f00242t03_priv *priv = dev_get_drvdata(&spi->dev); |
241 | struct l4f00242t03_pdata *pdata = priv->spi->dev.platform_data; | ||
242 | 236 | ||
243 | l4f00242t03_lcd_power_set(priv->ld, FB_BLANK_POWERDOWN); | 237 | l4f00242t03_lcd_power_set(priv->ld, FB_BLANK_POWERDOWN); |
244 | lcd_device_unregister(priv->ld); | 238 | lcd_device_unregister(priv->ld); |
245 | 239 | ||
246 | dev_set_drvdata(&spi->dev, NULL); | 240 | dev_set_drvdata(&spi->dev, NULL); |
247 | 241 | ||
248 | gpio_free(pdata->data_enable_gpio); | ||
249 | gpio_free(pdata->reset_gpio); | ||
250 | |||
251 | regulator_put(priv->io_reg); | 242 | regulator_put(priv->io_reg); |
252 | regulator_put(priv->core_reg); | 243 | regulator_put(priv->core_reg); |
253 | 244 | ||