@@ -361,7 +361,7 @@ static const struct powercap_zone_ops zone_ops = {
* @dtpm: The dtpm struct pointer to be initialized
* @ops: The dtpm device specific ops, NULL for a virtual node
*/
-void dtpm_init(struct dtpm *dtpm, struct dtpm_ops *ops)
+void dtpm_init(struct dtpm *dtpm, const struct dtpm_ops *ops)
{
if (dtpm) {
INIT_LIST_HEAD(&dtpm->children);
@@ -157,7 +157,7 @@ static void pd_release(struct dtpm *dtpm)
kfree(dtpm_cpu);
}
-static struct dtpm_ops dtpm_ops = {
+static const struct dtpm_ops dtpm_ops = {
.set_power_uw = set_pd_power_limit,
.get_power_uw = get_pd_power_uw,
.update_power_uw = update_pd_power_uw,
@@ -17,7 +17,7 @@ struct dtpm {
struct dtpm *parent;
struct list_head sibling;
struct list_head children;
- struct dtpm_ops *ops;
+ const struct dtpm_ops *ops;
unsigned long flags;
u64 power_limit;
u64 power_max;
@@ -64,7 +64,7 @@ int dtpm_update_power(struct dtpm *dtpm);
int dtpm_release_zone(struct powercap_zone *pcz);
-void dtpm_init(struct dtpm *dtpm, struct dtpm_ops *ops);
+void dtpm_init(struct dtpm *dtpm, const struct dtpm_ops *ops);
void dtpm_unregister(struct dtpm *dtpm);
dtpm_ops is never modified, so update functions and structs to reflect that, and constify the one static instance to allow the compiler to put it in read-only memory. Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> --- drivers/powercap/dtpm.c | 2 +- drivers/powercap/dtpm_cpu.c | 2 +- include/linux/dtpm.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)