From: Frank Lee <frank@allwinnertech.com> To: robdclark@gmail.com, sean@poorly.run, airlied@linux.ie, daniel@ffwll.ch, vireshk@kernel.org, nm@ti.com, sboyd@kernel.org, rjw@rjwysocki.net, jcrouse@codeaurora.org, eric@anholt.net, tiny.windzz@gmail.com, kholk11@gmail.com, emil.velikov@collabora.com, gustavoars@kernel.org Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Yangtao Li <frank@allwinnertech.com> Subject: [PATCH 2/3] opp: Add devres wrapper for dev_pm_opp_set_prop_name Date: Mon, 12 Oct 2020 21:55:16 +0800 [thread overview] Message-ID: <20201012135517.19468-3-frank@allwinnertech.com> (raw) In-Reply-To: <20201012135517.19468-1-frank@allwinnertech.com> From: Yangtao Li <tiny.windzz@gmail.com> Add devres wrapper for dev_pm_opp_set_prop_name() to simplify driver code. Signed-off-by: Yangtao Li <tiny.windzz@gmail.com> Signed-off-by: Yangtao Li <frank@allwinnertech.com> --- drivers/opp/core.c | 39 +++++++++++++++++++++++++++++++++++++++ include/linux/pm_opp.h | 6 ++++++ 2 files changed, 45 insertions(+) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index b38852dde578..3263fa8302c9 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1721,6 +1721,45 @@ void dev_pm_opp_put_prop_name(struct opp_table *opp_table) } EXPORT_SYMBOL_GPL(dev_pm_opp_put_prop_name); +static void devm_pm_opp_put_prop_name(struct device *dev, void *res) +{ + dev_pm_opp_put_prop_name(*(struct opp_table **)res); +} + +/** + * devm_pm_opp_set_prop_name() - Set prop-extn name + * @dev: Device for which the prop-name has to be set. + * @name: name to postfix to properties. + * + * This is required only for the V2 bindings, and it enables a platform to + * specify the extn to be used for certain property names. The properties to + * which the extension will apply are opp-microvolt and opp-microamp. OPP core + * should postfix the property name with -<name> while looking for them. + * + * The opp_table structure will be freed after the device is destroyed. + */ +struct opp_table *devm_pm_opp_set_prop_name(struct device *dev, + const char *name) +{ + struct opp_table **ptr, *opp_table; + + ptr = devres_alloc(devm_pm_opp_put_prop_name, + sizeof(*ptr), GFP_KERNEL); + if (!ptr) + return ERR_PTR(-ENOMEM); + + opp_table = dev_pm_opp_set_prop_name(dev, name); + if (!IS_ERR(opp_table)) { + *ptr = opp_table; + devres_add(dev, ptr); + } else { + devres_free(ptr); + } + + return opp_table; +} +EXPORT_SYMBOL(devm_pm_opp_set_prop_name); + static int _allocate_set_opp_data(struct opp_table *opp_table) { struct dev_pm_set_opp_data *data; diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 901920e29c54..1708485200dd 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -143,6 +143,7 @@ void dev_pm_opp_put_supported_hw(struct opp_table *opp_table); struct opp_table *devm_pm_opp_set_supported_hw(struct device *dev, const u32 *versions, unsigned int count); struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char *name); void dev_pm_opp_put_prop_name(struct opp_table *opp_table); +struct opp_table *devm_pm_opp_set_prop_name(struct device *dev, const char *name); struct opp_table *dev_pm_opp_set_regulators(struct device *dev, const char * const names[], unsigned int count); void dev_pm_opp_put_regulators(struct opp_table *opp_table); struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char * name); @@ -321,6 +322,11 @@ static inline struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, con static inline void dev_pm_opp_put_prop_name(struct opp_table *opp_table) {} +static inline struct opp_table *devm_pm_opp_set_prop_name(struct device *dev, const char *name) +{ + return ERR_PTR(-ENOTSUPP); +} + static inline struct opp_table *dev_pm_opp_set_regulators(struct device *dev, const char * const names[], unsigned int count) { return ERR_PTR(-ENOTSUPP); -- 2.28.0
WARNING: multiple messages have this Message-ID (diff)
From: Frank Lee <frank@allwinnertech.com> To: robdclark@gmail.com, sean@poorly.run, airlied@linux.ie, daniel@ffwll.ch, vireshk@kernel.org, nm@ti.com, sboyd@kernel.org, rjw@rjwysocki.net, jcrouse@codeaurora.org, eric@anholt.net, tiny.windzz@gmail.com, kholk11@gmail.com, emil.velikov@collabora.com, gustavoars@kernel.org Cc: linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Yangtao Li <frank@allwinnertech.com>, freedreno@lists.freedesktop.org Subject: [PATCH 2/3] opp: Add devres wrapper for dev_pm_opp_set_prop_name Date: Mon, 12 Oct 2020 21:55:16 +0800 [thread overview] Message-ID: <20201012135517.19468-3-frank@allwinnertech.com> (raw) In-Reply-To: <20201012135517.19468-1-frank@allwinnertech.com> From: Yangtao Li <tiny.windzz@gmail.com> Add devres wrapper for dev_pm_opp_set_prop_name() to simplify driver code. Signed-off-by: Yangtao Li <tiny.windzz@gmail.com> Signed-off-by: Yangtao Li <frank@allwinnertech.com> --- drivers/opp/core.c | 39 +++++++++++++++++++++++++++++++++++++++ include/linux/pm_opp.h | 6 ++++++ 2 files changed, 45 insertions(+) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index b38852dde578..3263fa8302c9 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1721,6 +1721,45 @@ void dev_pm_opp_put_prop_name(struct opp_table *opp_table) } EXPORT_SYMBOL_GPL(dev_pm_opp_put_prop_name); +static void devm_pm_opp_put_prop_name(struct device *dev, void *res) +{ + dev_pm_opp_put_prop_name(*(struct opp_table **)res); +} + +/** + * devm_pm_opp_set_prop_name() - Set prop-extn name + * @dev: Device for which the prop-name has to be set. + * @name: name to postfix to properties. + * + * This is required only for the V2 bindings, and it enables a platform to + * specify the extn to be used for certain property names. The properties to + * which the extension will apply are opp-microvolt and opp-microamp. OPP core + * should postfix the property name with -<name> while looking for them. + * + * The opp_table structure will be freed after the device is destroyed. + */ +struct opp_table *devm_pm_opp_set_prop_name(struct device *dev, + const char *name) +{ + struct opp_table **ptr, *opp_table; + + ptr = devres_alloc(devm_pm_opp_put_prop_name, + sizeof(*ptr), GFP_KERNEL); + if (!ptr) + return ERR_PTR(-ENOMEM); + + opp_table = dev_pm_opp_set_prop_name(dev, name); + if (!IS_ERR(opp_table)) { + *ptr = opp_table; + devres_add(dev, ptr); + } else { + devres_free(ptr); + } + + return opp_table; +} +EXPORT_SYMBOL(devm_pm_opp_set_prop_name); + static int _allocate_set_opp_data(struct opp_table *opp_table) { struct dev_pm_set_opp_data *data; diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 901920e29c54..1708485200dd 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -143,6 +143,7 @@ void dev_pm_opp_put_supported_hw(struct opp_table *opp_table); struct opp_table *devm_pm_opp_set_supported_hw(struct device *dev, const u32 *versions, unsigned int count); struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char *name); void dev_pm_opp_put_prop_name(struct opp_table *opp_table); +struct opp_table *devm_pm_opp_set_prop_name(struct device *dev, const char *name); struct opp_table *dev_pm_opp_set_regulators(struct device *dev, const char * const names[], unsigned int count); void dev_pm_opp_put_regulators(struct opp_table *opp_table); struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char * name); @@ -321,6 +322,11 @@ static inline struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, con static inline void dev_pm_opp_put_prop_name(struct opp_table *opp_table) {} +static inline struct opp_table *devm_pm_opp_set_prop_name(struct device *dev, const char *name) +{ + return ERR_PTR(-ENOTSUPP); +} + static inline struct opp_table *dev_pm_opp_set_regulators(struct device *dev, const char * const names[], unsigned int count) { return ERR_PTR(-ENOTSUPP); -- 2.28.0 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2020-10-12 13:56 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-10-12 13:55 [PATCH 0/3] Introduce devm_pm_opp_set_* API Frank Lee 2020-10-12 13:55 ` Frank Lee 2020-10-12 13:55 ` [PATCH 1/3] opp: Add devres wrapper for dev_pm_opp_set_supported_hw Frank Lee 2020-10-12 13:55 ` Frank Lee 2020-10-12 13:55 ` Frank Lee [this message] 2020-10-12 13:55 ` [PATCH 2/3] opp: Add devres wrapper for dev_pm_opp_set_prop_name Frank Lee 2020-10-28 10:29 ` Viresh Kumar 2020-10-28 10:29 ` Viresh Kumar 2020-10-28 11:02 ` Frank Lee 2020-10-28 11:02 ` Frank Lee 2020-10-28 14:46 ` Viresh Kumar 2020-10-28 14:46 ` Viresh Kumar 2020-10-30 11:19 ` Frank Lee 2020-10-30 11:19 ` Frank Lee 2020-10-30 11:28 ` Viresh Kumar 2020-10-30 11:28 ` Viresh Kumar 2020-10-12 13:55 ` [PATCH 3/3] drm/msm: Convert to devm_pm_opp_set_supported_hw Frank Lee 2020-10-12 13:55 ` Frank Lee 2020-10-28 6:01 ` Viresh Kumar 2020-10-28 6:01 ` Viresh Kumar 2020-10-28 6:06 ` [PATCH 0/3] Introduce devm_pm_opp_set_* API Viresh Kumar 2020-10-28 6:06 ` Viresh Kumar 2020-10-30 11:29 ` Viresh Kumar 2020-10-30 11:29 ` Viresh Kumar
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20201012135517.19468-3-frank@allwinnertech.com \ --to=frank@allwinnertech.com \ --cc=airlied@linux.ie \ --cc=daniel@ffwll.ch \ --cc=dri-devel@lists.freedesktop.org \ --cc=emil.velikov@collabora.com \ --cc=eric@anholt.net \ --cc=freedreno@lists.freedesktop.org \ --cc=gustavoars@kernel.org \ --cc=jcrouse@codeaurora.org \ --cc=kholk11@gmail.com \ --cc=linux-arm-msm@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-pm@vger.kernel.org \ --cc=nm@ti.com \ --cc=rjw@rjwysocki.net \ --cc=robdclark@gmail.com \ --cc=sboyd@kernel.org \ --cc=sean@poorly.run \ --cc=tiny.windzz@gmail.com \ --cc=vireshk@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.