lkml.org 
[lkml]   [2012]   [Feb]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 2/2] backlight: lp855x_bl: Small cleanups
From
Date
This patch includes below cleanups:
- Make lp855x_bl_update_status() return 0 instead of bl->props.brightness.
It looks pointless to return bl->props.brightness for lp855x_bl_update_status.
Make it return 0 on success.
- Use devm_kzalloc to save a few error handling code.
- Use module_i2c_driver

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/video/backlight/lp855x_bl.c | 25 +++++--------------------
1 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
index 5ab9ec8..c337b7a 100644
--- a/drivers/video/backlight/lp855x_bl.c
+++ b/drivers/video/backlight/lp855x_bl.c
@@ -131,7 +131,7 @@ static int lp855x_bl_update_status(struct backlight_device *bl)
lp855x_write_byte(lp, BRIGHTNESS_CTRL, val);
}

- return bl->props.brightness;
+ return 0;
}

static int lp855x_bl_get_brightness(struct backlight_device *bl)
@@ -241,7 +241,7 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id)
if (!i2c_check_functionality(cl->adapter, I2C_FUNC_SMBUS_I2C_BLOCK))
return -EIO;

- lp = kzalloc(sizeof(struct lp855x), GFP_KERNEL);
+ lp = devm_kzalloc(&cl->dev, sizeof(struct lp855x), GFP_KERNEL);
if (!lp)
return -ENOMEM;

@@ -275,14 +275,11 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id)
}

backlight_update_status(lp->bl);
- return ret;
+ return 0;

-err_dev:
- kfree(lp);
- return ret;
err_sysfs:
lp855x_backlight_unregister(lp);
- kfree(lp);
+err_dev:
return ret;
}

@@ -294,7 +291,6 @@ static int __devexit lp855x_remove(struct i2c_client *cl)
backlight_update_status(lp->bl);
sysfs_remove_group(&lp->dev->kobj, &lp855x_attr_group);
lp855x_backlight_unregister(lp);
- kfree(lp);

return 0;
}
@@ -318,18 +314,7 @@ static struct i2c_driver lp855x_driver = {
.id_table = lp855x_ids,
};

-static int __init lp855x_init(void)
-{
- return i2c_add_driver(&lp855x_driver);
-}
-
-static void __exit lp855x_exit(void)
-{
- i2c_del_driver(&lp855x_driver);
-}
-
-module_init(lp855x_init);
-module_exit(lp855x_exit);
+module_i2c_driver(lp855x_driver);

MODULE_DESCRIPTION("Texas Instruments LP855x Backlight driver");
MODULE_AUTHOR("Milo Kim <milo.kim@ti.com>");
--
1.7.5.4




\
 
 \ /
  Last update: 2012-02-02 09:17    [W:0.038 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site