Skip to content

Commit

Permalink
mfd: Save device node parsed platform data for tps65910 sub devices
Browse files Browse the repository at this point in the history
Save the allocated memory to store the parsed device node information
to the global device structure so that sub devices can directly use this
pointer.
In this way, the sub devices does not require to re-allocate the
memory for storing the sub-devices specific device node information.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
  • Loading branch information
Laxman Dewangan authored and Samuel Ortiz committed May 22, 2012
1 parent 730a3d0 commit cb8d865
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/mfd/tps65910.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,17 @@ static __devinit int tps65910_i2c_probe(struct i2c_client *i2c,
{
struct tps65910 *tps65910;
struct tps65910_board *pmic_plat_data;
struct tps65910_board *of_pmic_plat_data = NULL;
struct tps65910_platform_data *init_data;
int ret = 0;
int chip_id = id->driver_data;

pmic_plat_data = dev_get_platdata(&i2c->dev);

if (!pmic_plat_data && i2c->dev.of_node)
if (!pmic_plat_data && i2c->dev.of_node) {
pmic_plat_data = tps65910_parse_dt(i2c, &chip_id);
of_pmic_plat_data = pmic_plat_data;
}

if (!pmic_plat_data)
return -EINVAL;
Expand All @@ -229,6 +232,7 @@ static __devinit int tps65910_i2c_probe(struct i2c_client *i2c,
if (tps65910 == NULL)
return -ENOMEM;

tps65910->of_plat_data = of_pmic_plat_data;
i2c_set_clientdata(i2c, tps65910);
tps65910->dev = &i2c->dev;
tps65910->i2c_client = i2c;
Expand Down
3 changes: 3 additions & 0 deletions include/linux/mfd/tps65910.h
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,9 @@ struct tps65910 {
struct tps65910_rtc *rtc;
struct tps65910_power *power;

/* Device node parsed board data */
struct tps65910_board *of_plat_data;

/* IRQ Handling */
struct mutex irq_lock;
int chip_irq;
Expand Down

0 comments on commit cb8d865

Please sign in to comment.