From patchwork Wed Dec 23 21:59:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 7914771 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3794CBEEE5 for ; Wed, 23 Dec 2015 22:12:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5E1B8205E9 for ; Wed, 23 Dec 2015 22:12:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0DE91205FE for ; Wed, 23 Dec 2015 22:12:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754982AbbLWWM2 (ORCPT ); Wed, 23 Dec 2015 17:12:28 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:50652 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753536AbbLWWM2 (ORCPT ); Wed, 23 Dec 2015 17:12:28 -0500 X-IronPort-AV: E=Sophos;i="5.20,470,1444687200"; d="scan'208";a="193860315" Received: from palace.rsr.lip6.fr (HELO localhost.localdomain) ([132.227.105.202]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/AES128-SHA256; 23 Dec 2015 23:12:26 +0100 From: Julia Lawall To: "Rafael J. Wysocki" Cc: kernel-janitors@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] PowerCap: constify powercap_zone_ops and powercap_zone_constraint_ops structures Date: Wed, 23 Dec 2015 22:59:55 +0100 Message-Id: <1450907995-825-1-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.9.1 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The powercap_zone_ops and powercap_zone_constraint_ops structures are never modified, so declare them as const. Most of the actual changes adjust indentation to accomodate the const keyword. Done with the help of Coccinelle. Signed-off-by: Julia Lawall --- drivers/powercap/intel_rapl.c | 4 ++-- drivers/powercap/powercap_sys.c | 18 +++++++++--------- include/linux/powercap.h | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c index 4099159..6c592dc 100644 --- a/drivers/powercap/intel_rapl.c +++ b/drivers/powercap/intel_rapl.c @@ -388,7 +388,7 @@ static int get_domain_enable(struct powercap_zone *power_zone, bool *mode) } /* per RAPL domain ops, in the order of rapl_domain_type */ -static struct powercap_zone_ops zone_ops[] = { +static const struct powercap_zone_ops zone_ops[] = { /* RAPL_DOMAIN_PACKAGE */ { .get_energy_uj = get_energy_counter, @@ -584,7 +584,7 @@ static int get_max_power(struct powercap_zone *power_zone, int id, return ret; } -static struct powercap_zone_constraint_ops constraint_ops = { +static const struct powercap_zone_constraint_ops constraint_ops = { .set_power_limit_uw = set_power_limit, .get_power_limit_uw = get_current_power_limit, .set_time_window_us = set_time_window, diff --git a/drivers/powercap/powercap_sys.c b/drivers/powercap/powercap_sys.c index 84419af..14bde0d 100644 --- a/drivers/powercap/powercap_sys.c +++ b/drivers/powercap/powercap_sys.c @@ -293,8 +293,8 @@ err_alloc: } static int create_constraints(struct powercap_zone *power_zone, - int nr_constraints, - struct powercap_zone_constraint_ops *const_ops) + int nr_constraints, + const struct powercap_zone_constraint_ops *const_ops) { int i; int ret = 0; @@ -492,13 +492,13 @@ static struct class powercap_class = { }; struct powercap_zone *powercap_register_zone( - struct powercap_zone *power_zone, - struct powercap_control_type *control_type, - const char *name, - struct powercap_zone *parent, - const struct powercap_zone_ops *ops, - int nr_constraints, - struct powercap_zone_constraint_ops *const_ops) + struct powercap_zone *power_zone, + struct powercap_control_type *control_type, + const char *name, + struct powercap_zone *parent, + const struct powercap_zone_ops *ops, + int nr_constraints, + const struct powercap_zone_constraint_ops *const_ops) { int result; int nr_attrs; diff --git a/include/linux/powercap.h b/include/linux/powercap.h index 4e25041..f0a4e62 100644 --- a/include/linux/powercap.h +++ b/include/linux/powercap.h @@ -208,7 +208,7 @@ struct powercap_zone_constraint_ops { struct powercap_zone_constraint { int id; struct powercap_zone *power_zone; - struct powercap_zone_constraint_ops *ops; + const struct powercap_zone_constraint_ops *ops; }; @@ -309,7 +309,7 @@ struct powercap_zone *powercap_register_zone( struct powercap_zone *parent, const struct powercap_zone_ops *ops, int nr_constraints, - struct powercap_zone_constraint_ops *const_ops); + const struct powercap_zone_constraint_ops *const_ops); /** * powercap_unregister_zone() - Unregister a zone device