* [PATCH] regulator: Hoist struct regulator_dev out of core to fix notifiers
@ 2009-01-21 14:08 Mark Brown
2009-01-21 14:24 ` Jonathan Cameron
2009-01-21 14:57 ` Liam Girdwood
0 siblings, 2 replies; 4+ messages in thread
From: Mark Brown @ 2009-01-21 14:08 UTC (permalink / raw)
To: Liam Girdwood; +Cc: linux-next, linux-kernel, Jonathan Cameron, Mark Brown
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 <broonie@opensource.wolfsonmicro.com>
---
drivers/regulator/core.c | 27 ---------------------------
include/linux/regulator/driver.h | 32 ++++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+), 27 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index f17362a..0ed13c2 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -30,33 +30,6 @@ 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
*
* Used to provide symbolic supply names to devices.
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 2254ad9..c263e36 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -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);
--
1.5.6.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] regulator: Hoist struct regulator_dev out of core to fix notifiers
2009-01-21 14:08 [PATCH] regulator: Hoist struct regulator_dev out of core to fix notifiers Mark Brown
@ 2009-01-21 14:24 ` Jonathan Cameron
2009-01-21 14:57 ` Liam Girdwood
1 sibling, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2009-01-21 14:24 UTC (permalink / raw)
To: Mark Brown; +Cc: Liam Girdwood, linux-next, linux-kernel
Mark Brown wrote:
> 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.
Sorry all for introducing the problem in the first place.
Other option for a fix would be to move the lock into the
regulator_notifier_call_chain function. Probably not ideal as would lead
to possibility of releasing then immediately retaking the lock that we
were trying to avoid by pushing the locks out in the first place.
Guess it's a case of how much we want to put people off directly accessing
elements of regulator_dev.
Thanks for posting the fix Mark (just beat me to it ;)
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
>
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
> drivers/regulator/core.c | 27 ---------------------------
> include/linux/regulator/driver.h | 32 ++++++++++++++++++++++++++++++++
> 2 files changed, 32 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index f17362a..0ed13c2 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -30,33 +30,6 @@ 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
> *
> * Used to provide symbolic supply names to devices.
> diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
> index 2254ad9..c263e36 100644
> --- a/include/linux/regulator/driver.h
> +++ b/include/linux/regulator/driver.h
> @@ -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);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] regulator: Hoist struct regulator_dev out of core to fix notifiers
2009-01-21 14:08 [PATCH] regulator: Hoist struct regulator_dev out of core to fix notifiers Mark Brown
2009-01-21 14:24 ` Jonathan Cameron
@ 2009-01-21 14:57 ` Liam Girdwood
2009-01-21 21:52 ` Stephen Rothwell
1 sibling, 1 reply; 4+ messages in thread
From: Liam Girdwood @ 2009-01-21 14:57 UTC (permalink / raw)
To: Mark Brown, Stephen Rothwell; +Cc: linux-next, linux-kernel, Jonathan Cameron
On Wed, 2009-01-21 at 14:08 +0000, Mark Brown wrote:
> 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 <broonie@opensource.wolfsonmicro.com>
> ---
> drivers/regulator/core.c | 27 ---------------------------
> include/linux/regulator/driver.h | 32 ++++++++++++++++++++++++++++++++
> 2 files changed, 32 insertions(+), 27 deletions(-)
Applied and fixed.
Thanks
Liam
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] regulator: Hoist struct regulator_dev out of core to fix notifiers
2009-01-21 14:57 ` Liam Girdwood
@ 2009-01-21 21:52 ` Stephen Rothwell
0 siblings, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2009-01-21 21:52 UTC (permalink / raw)
To: Liam Girdwood; +Cc: Mark Brown, linux-next, linux-kernel, Jonathan Cameron
[-- Attachment #1: Type: text/plain, Size: 810 bytes --]
On Wed, 21 Jan 2009 14:57:43 +0000 Liam Girdwood <lrg@slimlogic.co.uk> wrote:
>
> On Wed, 2009-01-21 at 14:08 +0000, Mark Brown wrote:
> > 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 <broonie@opensource.wolfsonmicro.com>
> > ---
> > drivers/regulator/core.c | 27 ---------------------------
> > include/linux/regulator/driver.h | 32 ++++++++++++++++++++++++++++++++
> > 2 files changed, 32 insertions(+), 27 deletions(-)
>
> Applied and fixed.
Thanks.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-01-21 21:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-21 14:08 [PATCH] regulator: Hoist struct regulator_dev out of core to fix notifiers Mark Brown
2009-01-21 14:24 ` Jonathan Cameron
2009-01-21 14:57 ` Liam Girdwood
2009-01-21 21:52 ` Stephen Rothwell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox