Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 600c395b authored by Julia Lawall's avatar Julia Lawall Committed by Rafael J. Wysocki
Browse files

powercap: constify powercap_zone_ops and powercap_zone_constraint_ops structures



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: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 74bf8efb
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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,
+9 −9
Original line number Diff line number Diff line
@@ -294,7 +294,7 @@ static int seed_constraint_attributes(void)

static int create_constraints(struct powercap_zone *power_zone,
			int nr_constraints,
				struct powercap_zone_constraint_ops *const_ops)
			const struct powercap_zone_constraint_ops *const_ops)
{
	int i;
	int ret = 0;
@@ -498,7 +498,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)
{
	int result;
	int nr_attrs;
+2 −2
Original line number Diff line number Diff line
@@ -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