diff options
Diffstat (limited to 'drivers/video/backlight/l4f00242t03.c')
-rw-r--r-- | drivers/video/backlight/l4f00242t03.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/video/backlight/l4f00242t03.c b/drivers/video/backlight/l4f00242t03.c index 6022b67285ec..40f606a86093 100644 --- a/drivers/video/backlight/l4f00242t03.c +++ b/drivers/video/backlight/l4f00242t03.c | |||
@@ -11,6 +11,8 @@ | |||
11 | * published by the Free Software Foundation. | 11 | * published by the Free Software Foundation. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
15 | |||
14 | #include <linux/device.h> | 16 | #include <linux/device.h> |
15 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
16 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
@@ -159,7 +161,8 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi) | |||
159 | return -EINVAL; | 161 | return -EINVAL; |
160 | } | 162 | } |
161 | 163 | ||
162 | priv = kzalloc(sizeof(struct l4f00242t03_priv), GFP_KERNEL); | 164 | priv = devm_kzalloc(&spi->dev, sizeof(struct l4f00242t03_priv), |
165 | GFP_KERNEL); | ||
163 | 166 | ||
164 | if (priv == NULL) { | 167 | if (priv == NULL) { |
165 | dev_err(&spi->dev, "No memory for this device.\n"); | 168 | dev_err(&spi->dev, "No memory for this device.\n"); |
@@ -177,7 +180,7 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi) | |||
177 | if (ret) { | 180 | if (ret) { |
178 | dev_err(&spi->dev, | 181 | dev_err(&spi->dev, |
179 | "Unable to get the lcd l4f00242t03 reset gpio.\n"); | 182 | "Unable to get the lcd l4f00242t03 reset gpio.\n"); |
180 | goto err; | 183 | return ret; |
181 | } | 184 | } |
182 | 185 | ||
183 | ret = gpio_request_one(pdata->data_enable_gpio, GPIOF_OUT_INIT_LOW, | 186 | ret = gpio_request_one(pdata->data_enable_gpio, GPIOF_OUT_INIT_LOW, |
@@ -185,7 +188,7 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi) | |||
185 | if (ret) { | 188 | if (ret) { |
186 | dev_err(&spi->dev, | 189 | dev_err(&spi->dev, |
187 | "Unable to get the lcd l4f00242t03 data en gpio.\n"); | 190 | "Unable to get the lcd l4f00242t03 data en gpio.\n"); |
188 | goto err2; | 191 | goto err; |
189 | } | 192 | } |
190 | 193 | ||
191 | priv->io_reg = regulator_get(&spi->dev, "vdd"); | 194 | priv->io_reg = regulator_get(&spi->dev, "vdd"); |
@@ -193,7 +196,7 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi) | |||
193 | ret = PTR_ERR(priv->io_reg); | 196 | ret = PTR_ERR(priv->io_reg); |
194 | dev_err(&spi->dev, "%s: Unable to get the IO regulator\n", | 197 | dev_err(&spi->dev, "%s: Unable to get the IO regulator\n", |
195 | __func__); | 198 | __func__); |
196 | goto err3; | 199 | goto err2; |
197 | } | 200 | } |
198 | 201 | ||
199 | priv->core_reg = regulator_get(&spi->dev, "vcore"); | 202 | priv->core_reg = regulator_get(&spi->dev, "vcore"); |
@@ -201,14 +204,14 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi) | |||
201 | ret = PTR_ERR(priv->core_reg); | 204 | ret = PTR_ERR(priv->core_reg); |
202 | dev_err(&spi->dev, "%s: Unable to get the core regulator\n", | 205 | dev_err(&spi->dev, "%s: Unable to get the core regulator\n", |
203 | __func__); | 206 | __func__); |
204 | goto err4; | 207 | goto err3; |
205 | } | 208 | } |
206 | 209 | ||
207 | priv->ld = lcd_device_register("l4f00242t03", | 210 | priv->ld = lcd_device_register("l4f00242t03", |
208 | &spi->dev, priv, &l4f_ops); | 211 | &spi->dev, priv, &l4f_ops); |
209 | if (IS_ERR(priv->ld)) { | 212 | if (IS_ERR(priv->ld)) { |
210 | ret = PTR_ERR(priv->ld); | 213 | ret = PTR_ERR(priv->ld); |
211 | goto err5; | 214 | goto err4; |
212 | } | 215 | } |
213 | 216 | ||
214 | /* Init the LCD */ | 217 | /* Init the LCD */ |
@@ -220,16 +223,14 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi) | |||
220 | 223 | ||
221 | return 0; | 224 | return 0; |
222 | 225 | ||
223 | err5: | ||
224 | regulator_put(priv->core_reg); | ||
225 | err4: | 226 | err4: |
226 | regulator_put(priv->io_reg); | 227 | regulator_put(priv->core_reg); |
227 | err3: | 228 | err3: |
228 | gpio_free(pdata->data_enable_gpio); | 229 | regulator_put(priv->io_reg); |
229 | err2: | 230 | err2: |
230 | gpio_free(pdata->reset_gpio); | 231 | gpio_free(pdata->data_enable_gpio); |
231 | err: | 232 | err: |
232 | kfree(priv); | 233 | gpio_free(pdata->reset_gpio); |
233 | 234 | ||
234 | return ret; | 235 | return ret; |
235 | } | 236 | } |
@@ -250,8 +251,6 @@ static int __devexit l4f00242t03_remove(struct spi_device *spi) | |||
250 | regulator_put(priv->io_reg); | 251 | regulator_put(priv->io_reg); |
251 | regulator_put(priv->core_reg); | 252 | regulator_put(priv->core_reg); |
252 | 253 | ||
253 | kfree(priv); | ||
254 | |||
255 | return 0; | 254 | return 0; |
256 | } | 255 | } |
257 | 256 | ||