Commit 04e961fb authored by Jingoo Han's avatar Jingoo Han Committed by Linus Torvalds
Browse files

backlight: lms283gf05: use devm_gpio_request()

The devm_ functions allocate memory that is released when a driver
detaches.  This patch uses devm_gpio_request() for these functions.
Signed-off-by: default avatarJingoo Han <>
Acked-by: default avatarMarek Vasut <>
Cc: Richard Purdie <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent f5b71941
......@@ -158,29 +158,27 @@ static int __devinit lms283gf05_probe(struct spi_device *spi)
int ret = 0;
if (pdata != NULL) {
ret = gpio_request(pdata->reset_gpio, "LMS285GF05 RESET");
ret = devm_gpio_request(&spi->dev, pdata->reset_gpio,
"LMS285GF05 RESET");
if (ret)
return ret;
ret = gpio_direction_output(pdata->reset_gpio,
if (ret)
goto err;
return ret;
st = devm_kzalloc(&spi->dev, sizeof(struct lms283gf05_state),
if (st == NULL) {
dev_err(&spi->dev, "No memory for device state\n");
ret = -ENOMEM;
goto err;
return -ENOMEM;
ld = lcd_device_register("lms283gf05", &spi->dev, st, &lms_ops);
if (IS_ERR(ld)) {
ret = PTR_ERR(ld);
goto err;
if (IS_ERR(ld))
return PTR_ERR(ld);
st->spi = spi;
st->ld = ld;
......@@ -193,24 +191,14 @@ static int __devinit lms283gf05_probe(struct spi_device *spi)
lms283gf05_toggle(spi, disp_initseq, ARRAY_SIZE(disp_initseq));
return 0;
if (pdata != NULL)
return ret;
static int __devexit lms283gf05_remove(struct spi_device *spi)
struct lms283gf05_state *st = dev_get_drvdata(&spi->dev);
struct lms283gf05_pdata *pdata = st->spi->dev.platform_data;
if (pdata != NULL)
return 0;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment