Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 358596
b: refs/heads/master
c: 6a0c9a4
h: refs/heads/master
v: v3
  • Loading branch information
Milo(Woogyom) Kim authored and Bryan Wu committed Feb 6, 2013
1 parent 4bd938c commit e4f8ca0
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 945c700746cbfa3375bf88123c2cf6c210f4cc2c
refs/heads/master: 6a0c9a47963cc72c68713923ead60d1e72e7136c
36 changes: 22 additions & 14 deletions trunk/drivers/leds/leds-lp5521.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
#include <linux/leds-lp5521.h>
#include <linux/workqueue.h>
#include <linux/slab.h>
#include <linux/platform_data/leds-lp55xx.h>

#include "leds-lp55xx-common.h"

#define LP5521_PROGRAM_LENGTH 32 /* in bytes */

Expand Down Expand Up @@ -872,27 +875,32 @@ static void lp5521_unregister_leds(struct lp5521_chip *chip)
static int lp5521_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct lp5521_chip *old_chip;
struct lp5521_platform_data *old_pdata;
struct lp5521_chip *old_chip = NULL;
int ret;
struct lp55xx_chip *chip;
struct lp55xx_led *led;
struct lp55xx_platform_data *pdata = client->dev.platform_data;

old_chip = devm_kzalloc(&client->dev, sizeof(*old_chip), GFP_KERNEL);
if (!old_chip)
return -ENOMEM;

i2c_set_clientdata(client, old_chip);
old_chip->client = client;

old_pdata = client->dev.platform_data;

if (!old_pdata) {
if (!pdata) {
dev_err(&client->dev, "no platform data\n");
return -EINVAL;
}

mutex_init(&old_chip->lock);
chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
if (!chip)
return -ENOMEM;

led = devm_kzalloc(&client->dev,
sizeof(*led) * pdata->num_channels, GFP_KERNEL);
if (!led)
return -ENOMEM;

chip->cl = client;
chip->pdata = pdata;

mutex_init(&chip->lock);

old_chip->pdata = old_pdata;
i2c_set_clientdata(client, led);

ret = lp5521_init_device(old_chip);
if (ret)
Expand Down
36 changes: 22 additions & 14 deletions trunk/drivers/leds/leds-lp5523.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
#include <linux/leds-lp5523.h>
#include <linux/workqueue.h>
#include <linux/slab.h>
#include <linux/platform_data/leds-lp55xx.h>

#include "leds-lp55xx-common.h"

#define LP5523_REG_ENABLE 0x00
#define LP5523_REG_OP_MODE 0x01
Expand Down Expand Up @@ -1010,27 +1013,32 @@ static void lp5523_deinit_device(struct lp5523_chip *chip)
static int lp5523_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct lp5523_chip *old_chip;
struct lp5523_platform_data *old_pdata;
struct lp5523_chip *old_chip = NULL;
int ret, i;
struct lp55xx_chip *chip;
struct lp55xx_led *led;
struct lp55xx_platform_data *pdata = client->dev.platform_data;

old_chip = devm_kzalloc(&client->dev, sizeof(*old_chip), GFP_KERNEL);
if (!old_chip)
return -ENOMEM;

i2c_set_clientdata(client, old_chip);
old_chip->client = client;

old_pdata = client->dev.platform_data;

if (!old_pdata) {
if (!pdata) {
dev_err(&client->dev, "no platform data\n");
return -EINVAL;
}

mutex_init(&old_chip->lock);
chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
if (!chip)
return -ENOMEM;

led = devm_kzalloc(&client->dev,
sizeof(*led) * pdata->num_channels, GFP_KERNEL);
if (!led)
return -ENOMEM;

chip->cl = client;
chip->pdata = pdata;

mutex_init(&chip->lock);

old_chip->pdata = old_pdata;
i2c_set_clientdata(client, led);

ret = lp5523_init_device(old_chip);
if (ret)
Expand Down

0 comments on commit e4f8ca0

Please sign in to comment.