Skip to content

Commit

Permalink
regulator: Hoist struct regulator_dev out of core to fix notifiers
Browse files Browse the repository at this point in the history
Commit 872ed3fe176833f7d43748eb88010da4bbd2f983 caused regulator drivers
to take the struct regulator_dev lock themselves which requires that the
struct be visible to them. Band aid this by making the struct visible.

Signed-off-by: Mark Brown <[email protected]>
Signed-off-by: Liam Girdwood <[email protected]>
  • Loading branch information
broonie authored and Liam Girdwood committed Mar 31, 2009
1 parent fefdae4 commit 1fa9ad5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 27 deletions.
27 changes: 0 additions & 27 deletions drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,6 @@ static DEFINE_MUTEX(regulator_list_mutex);
static LIST_HEAD(regulator_list);
static LIST_HEAD(regulator_map_list);

/*
* struct regulator_dev
*
* Voltage / Current regulator class device. One for each regulator.
*/
struct regulator_dev {
struct regulator_desc *desc;
int use_count;

/* lists we belong to */
struct list_head list; /* list of all regulators */
struct list_head slist; /* list of supplied regulators */

/* lists we own */
struct list_head consumer_list; /* consumers we supply */
struct list_head supply_list; /* regulators we supply */

struct blocking_notifier_head notifier;
struct mutex mutex; /* consumer lock */
struct module *owner;
struct device dev;
struct regulation_constraints *constraints;
struct regulator_dev *supply; /* for tree */

void *reg_data; /* regulator_dev data */
};

/*
* struct regulator_map
*
Expand Down
32 changes: 32 additions & 0 deletions include/linux/regulator/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,38 @@ struct regulator_desc {
struct module *owner;
};

/*
* struct regulator_dev
*
* Voltage / Current regulator class device. One for each
* regulator.
*
* This should *not* be used directly by anything except the regulator
* core and notification injection (which should take the mutex and do
* no other direct access).
*/
struct regulator_dev {
struct regulator_desc *desc;
int use_count;

/* lists we belong to */
struct list_head list; /* list of all regulators */
struct list_head slist; /* list of supplied regulators */

/* lists we own */
struct list_head consumer_list; /* consumers we supply */
struct list_head supply_list; /* regulators we supply */

struct blocking_notifier_head notifier;
struct mutex mutex; /* consumer lock */
struct module *owner;
struct device dev;
struct regulation_constraints *constraints;
struct regulator_dev *supply; /* for tree */

void *reg_data; /* regulator_dev data */
};

struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
struct device *dev, struct regulator_init_data *init_data,
void *driver_data);
Expand Down

0 comments on commit 1fa9ad5

Please sign in to comment.