Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1218490 > unrolled thread
| Started by | Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> |
|---|---|
| First post | 2015-09-03 20:20 +0200 |
| Last post | 2015-09-07 08:00 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH v3 0/3] cpufreq-dt: add suspend frequency support Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> - 2015-09-03 20:20 +0200
[PATCH v3 1/3] PM / OPP: add dev_pm_opp_get_suspend_opp() helper Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> - 2015-09-03 20:20 +0200
Re: [PATCH v3 1/3] PM / OPP: add dev_pm_opp_get_suspend_opp() helper Viresh Kumar <viresh.kumar@linaro.org> - 2015-09-07 08:00 +0200
| From | Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> |
|---|---|
| Date | 2015-09-03 20:20 +0200 |
| Subject | [PATCH v3 0/3] cpufreq-dt: add suspend frequency support |
| Message-ID | <q4Hh8-2W4-13@gated-at.bofh.it> |
Hi, This patch series adds suspend frequency support (using opp-v2 bindings and suspend-opp functionality) to cpufreq-dt driver and then adds suspend opp for Exynos4412 based boards. This patch series fixes suspend/resume support on Exynos4412 based Trats2 board and reboot hang on Exynos4412 based Odroid U3 board. Changes since v2: - rewrited to use suspend-opp functionality Changes since v1: - removed superfluous ";" Depends on: - next-20150902 branch of linux-next kernel tree Best regards, -- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics Bartlomiej Zolnierkiewicz (3): PM / OPP: add dev_pm_opp_get_suspend_opp() helper cpufreq-dt: add suspend frequency support ARM: dts: add suspend opp to exynos4412 arch/arm/boot/dts/exynos4412.dtsi | 1 + drivers/base/power/opp.c | 28 ++++++++++++++++++++++++++++ drivers/cpufreq/cpufreq-dt.c | 32 ++++++++++++++++++++++++++++++++ include/linux/pm_opp.h | 6 ++++++ 4 files changed, 67 insertions(+) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> |
|---|---|
| Date | 2015-09-03 20:20 +0200 |
| Subject | [PATCH v3 1/3] PM / OPP: add dev_pm_opp_get_suspend_opp() helper |
| Message-ID | <q4Hh9-2W4-55@gated-at.bofh.it> |
| In reply to | #1218490 |
Add dev_pm_opp_get_suspend_opp() helper to obtain suspend opp.
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Thomas Abraham <thomas.ab@samsung.com>
Cc: Javier Martinez Canillas <javier@osg.samsung.com>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
drivers/base/power/opp.c | 28 ++++++++++++++++++++++++++++
include/linux/pm_opp.h | 6 ++++++
2 files changed, 34 insertions(+)
diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
index eb25449..eaafca7 100644
--- a/drivers/base/power/opp.c
+++ b/drivers/base/power/opp.c
@@ -341,6 +341,34 @@ unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev)
EXPORT_SYMBOL_GPL(dev_pm_opp_get_max_clock_latency);
/**
+ * dev_pm_opp_get_suspend_opp() - Get suspend opp
+ * @dev: device for which we do this operation
+ *
+ * Return: This function returns pointer to the suspend opp if it is
+ * defined, otherwise it returns NULL.
+ *
+ * Locking: This function takes rcu_read_lock().
+ */
+struct dev_pm_opp *dev_pm_opp_get_suspend_opp(struct device *dev)
+{
+ struct device_opp *dev_opp;
+ struct dev_pm_opp *suspend_opp;
+
+ rcu_read_lock();
+
+ dev_opp = _find_device_opp(dev);
+ if (IS_ERR(dev_opp))
+ suspend_opp = NULL;
+ else
+ suspend_opp = dev_opp->suspend_opp;
+
+ rcu_read_unlock();
+
+ return suspend_opp;
+}
+EXPORT_SYMBOL_GPL(dev_pm_opp_get_suspend_opp);
+
+/**
* dev_pm_opp_get_opp_count() - Get number of opps available in the opp list
* @dev: device for which we do this operation
*
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
index cab7ba5..e817722 100644
--- a/include/linux/pm_opp.h
+++ b/include/linux/pm_opp.h
@@ -34,6 +34,7 @@ bool dev_pm_opp_is_turbo(struct dev_pm_opp *opp);
int dev_pm_opp_get_opp_count(struct device *dev);
unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev);
+struct dev_pm_opp *dev_pm_opp_get_suspend_opp(struct device *dev);
struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
unsigned long freq,
@@ -80,6 +81,11 @@ static inline unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev)
return 0;
}
+static inline struct dev_pm_opp *dev_pm_opp_get_suspend_opp(struct device *dev)
+{
+ return NULL;
+}
+
static inline struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
unsigned long freq, bool available)
{
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2015-09-07 08:00 +0200 |
| Subject | Re: [PATCH v3 1/3] PM / OPP: add dev_pm_opp_get_suspend_opp() helper |
| Message-ID | <q5XDb-56n-7@gated-at.bofh.it> |
| In reply to | #1218494 |
On 03-09-15, 20:11, Bartlomiej Zolnierkiewicz wrote:
> Add dev_pm_opp_get_suspend_opp() helper to obtain suspend opp.
>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>
> Cc: Thomas Abraham <thomas.ab@samsung.com>
> Cc: Javier Martinez Canillas <javier@osg.samsung.com>
> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> Cc: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> ---
> drivers/base/power/opp.c | 28 ++++++++++++++++++++++++++++
> include/linux/pm_opp.h | 6 ++++++
> 2 files changed, 34 insertions(+)
>
> diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
> index eb25449..eaafca7 100644
> --- a/drivers/base/power/opp.c
> +++ b/drivers/base/power/opp.c
> @@ -341,6 +341,34 @@ unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev)
> EXPORT_SYMBOL_GPL(dev_pm_opp_get_max_clock_latency);
>
> /**
> + * dev_pm_opp_get_suspend_opp() - Get suspend opp
> + * @dev: device for which we do this operation
> + *
> + * Return: This function returns pointer to the suspend opp if it is
> + * defined, otherwise it returns NULL.
> + *
> + * Locking: This function takes rcu_read_lock().
> + */
> +struct dev_pm_opp *dev_pm_opp_get_suspend_opp(struct device *dev)
> +{
> + struct device_opp *dev_opp;
> + struct dev_pm_opp *suspend_opp;
> +
> + rcu_read_lock();
This is wrong. Please have a look at other exported APIs that return
an OPP. RCU protected structures must be accessed from within RCU
locks _ONLY_. But your function returns the pointer after dropping
the locks. Which essentially means that the OPP can be freed by core,
by the time you start using it. :)
So, in such cases, its upto the caller to ensure that locks are taken
properly.
You can look at dev_pm_opp_find_freq_exact() as an example.
--
viresh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web