Skip to contentSkip to conversation

removing unused fields in the structure

PATCH RESEND New Daniel Lezcano 1 participant 13 messages Nov 17, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover removing unused fields in the structure

This patchset applies on the 'next' branch of the linux-lenb git tree.

resend : Cc'ed linux-pm mailing list also

Daniel Lezcano (6):
cpuidle : move code to prevent forward declaration cpuidle : remove unused 'governor_data' field acpi : remove 'latency_ticks' in acpi_processor_cx acpi : remove 'time' field in acpi_processor_cx acpi : remove 'usage' field in acpi_processor_cx acpi : remove 'power' field from acpi_processor_cx

 drivers/acpi/processor_idle.c |   11 ----
 drivers/cpuidle/cpuidle.c     |  116 ++++++++++++++++++++---------------------
 include/acpi/processor.h      |    4 --
 include/linux/cpuidle.h       |    1 -
 4 files changed, 57 insertions(+), 75 deletions(-)
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH RESEND 1/6 cpuidle : move code to prevent forward declaration

A mindless change by moving __cpuidle_register_device and cpuidle_register_device up in the code and hence preventing the forward declaration.

---
 drivers/cpuidle/cpuidle.c |  116 ++++++++++++++++++++++-----------------------
 1 files changed, 57 insertions(+), 59 deletions(-)
drivers/cpuidle/cpuidle.c +57 -59
index 7a57b11..e0e2a02 100644
@@ -50,8 +50,6 @@ static void cpuidle_kick_cpus(void)
 static void cpuidle_kick_cpus(void) {}
 #endif
 
-static int __cpuidle_register_device(struct cpuidle_device *dev);
-
 /**
  * cpuidle_idle_call - the main idle loop
  *
@@ -202,6 +200,63 @@ static void poll_idle_init(struct cpuidle_driver *drv) {}
 #endif /* CONFIG_ARCH_HAS_CPU_RELAX */
 
 /**
+ * __cpuidle_register_device - internal register function called before register
+ * and enable routines
+ * @dev: the cpu
+ *
+ * cpuidle_lock mutex must be held before this is called
+ */
+static int __cpuidle_register_device(struct cpuidle_device *dev)
+{
+	int ret;
+	struct sys_device *sys_dev = get_cpu_sysdev((unsigned long)dev->cpu);
+	struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver();
+
+	if (!sys_dev)
+		return -EINVAL;
+	if (!try_module_get(cpuidle_driver->owner))
+		return -EINVAL;
+
+	init_completion(&dev->kobj_unregister);
+
+	per_cpu(cpuidle_devices, dev->cpu) = dev;
+	list_add(&dev->device_list, &cpuidle_detected_devices);
+	if ((ret = cpuidle_add_sysfs(sys_dev))) {
+		module_put(cpuidle_driver->owner);
+		return ret;
+	}
+
+	dev->registered = 1;
+	return 0;
+}
+
+/**
+ * cpuidle_register_device - registers a CPU's idle PM feature
+ * @dev: the cpu
+ */
+int cpuidle_register_device(struct cpuidle_device *dev)
+{
+	int ret;
+
+	mutex_lock(&cpuidle_lock);
+
+	if ((ret = __cpuidle_register_device(dev))) {
+		mutex_unlock(&cpuidle_lock);
+		return ret;
+	}
+
+	cpuidle_enable_device(dev);
+	cpuidle_install_idle_handler();
+
+	mutex_unlock(&cpuidle_lock);
+
+	return 0;
+
+}
+
+EXPORT_SYMBOL_GPL(cpuidle_register_device);
+
+/**
  * cpuidle_enable_device - enables idle PM for a CPU
  * @dev: the CPU
  *
@@ -281,63 +336,6 @@ void cpuidle_disable_device(struct cpuidle_device *dev)
 EXPORT_SYMBOL_GPL(cpuidle_disable_device);
 
 /**
- * __cpuidle_register_device - internal register function called before register
- * and enable routines
- * @dev: the cpu
- *
- * cpuidle_lock mutex must be held before this is called
- */
-static int __cpuidle_register_device(struct cpuidle_device *dev)
-{
-	int ret;
-	struct sys_device *sys_dev = get_cpu_sysdev((unsigned long)dev->cpu);
-	struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver();
-
-	if (!sys_dev)
-		return -EINVAL;
-	if (!try_module_get(cpuidle_driver->owner))
-		return -EINVAL;
-
-	init_completion(&dev->kobj_unregister);
-
-	per_cpu(cpuidle_devices, dev->cpu) = dev;
-	list_add(&dev->device_list, &cpuidle_detected_devices);
-	if ((ret = cpuidle_add_sysfs(sys_dev))) {
-		module_put(cpuidle_driver->owner);
-		return ret;
-	}
-
-	dev->registered = 1;
-	return 0;
-}
-
-/**
- * cpuidle_register_device - registers a CPU's idle PM feature
- * @dev: the cpu
- */
-int cpuidle_register_device(struct cpuidle_device *dev)
-{
-	int ret;
-
-	mutex_lock(&cpuidle_lock);
-
-	if ((ret = __cpuidle_register_device(dev))) {
-		mutex_unlock(&cpuidle_lock);
-		return ret;
-	}
-
-	cpuidle_enable_device(dev);
-	cpuidle_install_idle_handler();
-
-	mutex_unlock(&cpuidle_lock);
-
-	return 0;
-
-}
-
-EXPORT_SYMBOL_GPL(cpuidle_register_device);
-
-/**
  * cpuidle_unregister_device - unregisters a CPU's idle PM feature
  * @dev: the cpu
  */
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH RESEND 1/6 cpuidle : move code to prevent forward declaration

In reply to Daniel Lezcano

A mindless change by moving __cpuidle_register_device and cpuidle_register_device up in the code and hence preventing the forward declaration.

---
 drivers/cpuidle/cpuidle.c |  116 ++++++++++++++++++++++-----------------------
 1 files changed, 57 insertions(+), 59 deletions(-)
drivers/cpuidle/cpuidle.c +57 -59
index 7a57b11..e0e2a02 100644
@@ -50,8 +50,6 @@ static void cpuidle_kick_cpus(void)
 static void cpuidle_kick_cpus(void) {}
 #endif
 
-static int __cpuidle_register_device(struct cpuidle_device *dev);
-
 /**
  * cpuidle_idle_call - the main idle loop
  *
@@ -202,6 +200,63 @@ static void poll_idle_init(struct cpuidle_driver *drv) {}
 #endif /* CONFIG_ARCH_HAS_CPU_RELAX */
 
 /**
+ * __cpuidle_register_device - internal register function called before register
+ * and enable routines
+ * @dev: the cpu
+ *
+ * cpuidle_lock mutex must be held before this is called
+ */
+static int __cpuidle_register_device(struct cpuidle_device *dev)
+{
+	int ret;
+	struct sys_device *sys_dev = get_cpu_sysdev((unsigned long)dev->cpu);
+	struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver();
+
+	if (!sys_dev)
+		return -EINVAL;
+	if (!try_module_get(cpuidle_driver->owner))
+		return -EINVAL;
+
+	init_completion(&dev->kobj_unregister);
+
+	per_cpu(cpuidle_devices, dev->cpu) = dev;
+	list_add(&dev->device_list, &cpuidle_detected_devices);
+	if ((ret = cpuidle_add_sysfs(sys_dev))) {
+		module_put(cpuidle_driver->owner);
+		return ret;
+	}
+
+	dev->registered = 1;
+	return 0;
+}
+
+/**
+ * cpuidle_register_device - registers a CPU's idle PM feature
+ * @dev: the cpu
+ */
+int cpuidle_register_device(struct cpuidle_device *dev)
+{
+	int ret;
+
+	mutex_lock(&cpuidle_lock);
+
+	if ((ret = __cpuidle_register_device(dev))) {
+		mutex_unlock(&cpuidle_lock);
+		return ret;
+	}
+
+	cpuidle_enable_device(dev);
+	cpuidle_install_idle_handler();
+
+	mutex_unlock(&cpuidle_lock);
+
+	return 0;
+
+}
+
+EXPORT_SYMBOL_GPL(cpuidle_register_device);
+
+/**
  * cpuidle_enable_device - enables idle PM for a CPU
  * @dev: the CPU
  *
@@ -281,63 +336,6 @@ void cpuidle_disable_device(struct cpuidle_device *dev)
 EXPORT_SYMBOL_GPL(cpuidle_disable_device);
 
 /**
- * __cpuidle_register_device - internal register function called before register
- * and enable routines
- * @dev: the cpu
- *
- * cpuidle_lock mutex must be held before this is called
- */
-static int __cpuidle_register_device(struct cpuidle_device *dev)
-{
-	int ret;
-	struct sys_device *sys_dev = get_cpu_sysdev((unsigned long)dev->cpu);
-	struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver();
-
-	if (!sys_dev)
-		return -EINVAL;
-	if (!try_module_get(cpuidle_driver->owner))
-		return -EINVAL;
-
-	init_completion(&dev->kobj_unregister);
-
-	per_cpu(cpuidle_devices, dev->cpu) = dev;
-	list_add(&dev->device_list, &cpuidle_detected_devices);
-	if ((ret = cpuidle_add_sysfs(sys_dev))) {
-		module_put(cpuidle_driver->owner);
-		return ret;
-	}
-
-	dev->registered = 1;
-	return 0;
-}
-
-/**
- * cpuidle_register_device - registers a CPU's idle PM feature
- * @dev: the cpu
- */
-int cpuidle_register_device(struct cpuidle_device *dev)
-{
-	int ret;
-
-	mutex_lock(&cpuidle_lock);
-
-	if ((ret = __cpuidle_register_device(dev))) {
-		mutex_unlock(&cpuidle_lock);
-		return ret;
-	}
-
-	cpuidle_enable_device(dev);
-	cpuidle_install_idle_handler();
-
-	mutex_unlock(&cpuidle_lock);
-
-	return 0;
-
-}
-
-EXPORT_SYMBOL_GPL(cpuidle_register_device);
-
-/**
  * cpuidle_unregister_device - unregisters a CPU's idle PM feature
  * @dev: the cpu
  */
Signature · 1 line
1.7.4.1
#3 lore raw

PATCH RESEND 2/6 cpuidle : remove unused 'governor_data' field

In reply to Daniel Lezcano

As far as I can see, this field is never used in the code.

---
 include/linux/cpuidle.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
include/linux/cpuidle.h +0 -1
index c904188..4c8fd37 100644
@@ -95,7 +95,6 @@ struct cpuidle_device {
 	struct list_head 	device_list;
 	struct kobject		kobj;
 	struct completion	kobj_unregister;
-	void			*governor_data;
 };
 
 DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
Signature · 1 line
1.7.4.1
#4 lore raw

PATCH RESEND 2/6 cpuidle : remove unused 'governor_data' field

In reply to Daniel Lezcano

As far as I can see, this field is never used in the code.

---
 include/linux/cpuidle.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
include/linux/cpuidle.h +0 -1
index c904188..4c8fd37 100644
@@ -95,7 +95,6 @@ struct cpuidle_device {
 	struct list_head 	device_list;
 	struct kobject		kobj;
 	struct completion	kobj_unregister;
-	void			*governor_data;
 };
 
 DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
Signature · 1 line
1.7.4.1
#5 lore raw

PATCH RESEND 3/6 acpi : remove 'latency_ticks' in acpi_processor_cx

In reply to Daniel Lezcano

The latency_ticks field is used to store a value but it is never used. It is safe to remove it.

---
 drivers/acpi/processor_idle.c |    2 --
 include/acpi/processor.h      |    1 -
 2 files changed, 0 insertions(+), 3 deletions(-)
drivers/acpi/processor_idle.c +0 -2
index 24fe3af..dd87355 100644
@@ -595,7 +595,6 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
 	 */
 	cx->valid = 1;
 
-	cx->latency_ticks = cx->latency;
 	/*
 	 * On older chipsets, BM_RLD needs to be set
 	 * in order for Bus Master activity to wake the
@@ -628,7 +627,6 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
 			if (!cx->address)
 				break;
 			cx->valid = 1; 
-			cx->latency_ticks = cx->latency; /* Normalize latency */
 			break;
 
 		case ACPI_STATE_C3:
include/acpi/processor.h +0 -1
index 610f6fb..1b6e65c 100644
@@ -59,7 +59,6 @@ struct acpi_processor_cx {
 	u8 entry_method;
 	u8 index;
 	u32 latency;
-	u32 latency_ticks;
 	u32 power;
 	u32 usage;
 	u64 time;
Signature · 1 line
1.7.4.1
#6 lore raw

PATCH RESEND 3/6 acpi : remove 'latency_ticks' in acpi_processor_cx

In reply to Daniel Lezcano

The latency_ticks field is used to store a value but it is never used. It is safe to remove it.

---
 drivers/acpi/processor_idle.c |    2 --
 include/acpi/processor.h      |    1 -
 2 files changed, 0 insertions(+), 3 deletions(-)
drivers/acpi/processor_idle.c +0 -2
index 24fe3af..dd87355 100644
@@ -595,7 +595,6 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
 	 */
 	cx->valid = 1;
 
-	cx->latency_ticks = cx->latency;
 	/*
 	 * On older chipsets, BM_RLD needs to be set
 	 * in order for Bus Master activity to wake the
@@ -628,7 +627,6 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
 			if (!cx->address)
 				break;
 			cx->valid = 1; 
-			cx->latency_ticks = cx->latency; /* Normalize latency */
 			break;
 
 		case ACPI_STATE_C3:
include/acpi/processor.h +0 -1
index 610f6fb..1b6e65c 100644
@@ -59,7 +59,6 @@ struct acpi_processor_cx {
 	u8 entry_method;
 	u8 index;
 	u32 latency;
-	u32 latency_ticks;
 	u32 power;
 	u32 usage;
 	u64 time;
Signature · 1 line
1.7.4.1
#7 lore raw

PATCH RESEND 4/6 acpi : remove 'time' field in acpi_processor_cx

In reply to Daniel Lezcano

The 'time' field is used to sum the idle time but it is never used.

---
 drivers/acpi/processor_idle.c |    2 --
 include/acpi/processor.h      |    1 -
 2 files changed, 0 insertions(+), 3 deletions(-)
drivers/acpi/processor_idle.c +0 -2
index dd87355..142af72 100644
@@ -861,7 +861,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
 	cx->usage++;
 
 	lapic_timer_state_broadcast(pr, cx, 0);
-	cx->time += idle_time;
 	return index;
 }
 
@@ -987,7 +986,6 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
 	cx->usage++;
 
 	lapic_timer_state_broadcast(pr, cx, 0);
-	cx->time += idle_time;
 	return index;
 }
 
include/acpi/processor.h +0 -1
index 1b6e65c..46bcf79 100644
@@ -61,7 +61,6 @@ struct acpi_processor_cx {
 	u32 latency;
 	u32 power;
 	u32 usage;
-	u64 time;
 	u8 bm_sts_skip;
 	char desc[ACPI_CX_DESC_LEN];
 };
Signature · 1 line
1.7.4.1
#8 lore raw

PATCH RESEND 4/6 acpi : remove 'time' field in acpi_processor_cx

In reply to Daniel Lezcano

The 'time' field is used to sum the idle time but it is never used.

---
 drivers/acpi/processor_idle.c |    2 --
 include/acpi/processor.h      |    1 -
 2 files changed, 0 insertions(+), 3 deletions(-)
drivers/acpi/processor_idle.c +0 -2
index dd87355..142af72 100644
@@ -861,7 +861,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
 	cx->usage++;
 
 	lapic_timer_state_broadcast(pr, cx, 0);
-	cx->time += idle_time;
 	return index;
 }
 
@@ -987,7 +986,6 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
 	cx->usage++;
 
 	lapic_timer_state_broadcast(pr, cx, 0);
-	cx->time += idle_time;
 	return index;
 }
 
include/acpi/processor.h +0 -1
index 1b6e65c..46bcf79 100644
@@ -61,7 +61,6 @@ struct acpi_processor_cx {
 	u32 latency;
 	u32 power;
 	u32 usage;
-	u64 time;
 	u8 bm_sts_skip;
 	char desc[ACPI_CX_DESC_LEN];
 };
Signature · 1 line
1.7.4.1
#9 lore raw

PATCH RESEND 5/6 acpi : remove 'usage' field in acpi_processor_cx

In reply to Daniel Lezcano

The usage field is incremented but the resulting value is never used in the code.

---
 drivers/acpi/processor_idle.c |    5 -----
 include/acpi/processor.h      |    1 -
 2 files changed, 0 insertions(+), 6 deletions(-)
drivers/acpi/processor_idle.c +0 -5
index 142af72..4b9ebd5 100644
@@ -778,7 +778,6 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
 	dev->last_residency = (int)idle_time;
 
 	local_irq_enable();
-	cx->usage++;
 	lapic_timer_state_broadcast(pr, cx, 0);
 
 	return index;
@@ -858,8 +857,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
 	if (cx->entry_method != ACPI_CSTATE_FFH)
 		current_thread_info()->status |= TS_POLLING;
 
-	cx->usage++;
-
 	lapic_timer_state_broadcast(pr, cx, 0);
 	return index;
 }
@@ -983,8 +980,6 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
 	if (cx->entry_method != ACPI_CSTATE_FFH)
 		current_thread_info()->status |= TS_POLLING;
 
-	cx->usage++;
-
 	lapic_timer_state_broadcast(pr, cx, 0);
 	return index;
 }
include/acpi/processor.h +0 -1
index 46bcf79..bc3449a 100644
@@ -60,7 +60,6 @@ struct acpi_processor_cx {
 	u8 index;
 	u32 latency;
 	u32 power;
-	u32 usage;
 	u8 bm_sts_skip;
 	char desc[ACPI_CX_DESC_LEN];
 };
Signature · 1 line
1.7.4.1
#10 lore raw

PATCH RESEND 5/6 acpi : remove 'usage' field in acpi_processor_cx

In reply to Daniel Lezcano

The usage field is incremented but the resulting value is never used in the code.

---
 drivers/acpi/processor_idle.c |    5 -----
 include/acpi/processor.h      |    1 -
 2 files changed, 0 insertions(+), 6 deletions(-)
drivers/acpi/processor_idle.c +0 -5
index 142af72..4b9ebd5 100644
@@ -778,7 +778,6 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
 	dev->last_residency = (int)idle_time;
 
 	local_irq_enable();
-	cx->usage++;
 	lapic_timer_state_broadcast(pr, cx, 0);
 
 	return index;
@@ -858,8 +857,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
 	if (cx->entry_method != ACPI_CSTATE_FFH)
 		current_thread_info()->status |= TS_POLLING;
 
-	cx->usage++;
-
 	lapic_timer_state_broadcast(pr, cx, 0);
 	return index;
 }
@@ -983,8 +980,6 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
 	if (cx->entry_method != ACPI_CSTATE_FFH)
 		current_thread_info()->status |= TS_POLLING;
 
-	cx->usage++;
-
 	lapic_timer_state_broadcast(pr, cx, 0);
 	return index;
 }
include/acpi/processor.h +0 -1
index 46bcf79..bc3449a 100644
@@ -60,7 +60,6 @@ struct acpi_processor_cx {
 	u8 index;
 	u32 latency;
 	u32 power;
-	u32 usage;
 	u8 bm_sts_skip;
 	char desc[ACPI_CX_DESC_LEN];
 };
Signature · 1 line
1.7.4.1
#11 lore raw

PATCH RESEND 6/6 acpi : remove 'power' field from acpi_processor_cx

In reply to Daniel Lezcano

The power field is filled but never used in the code.

---
 drivers/acpi/processor_idle.c |    2 --
 include/acpi/processor.h      |    1 -
 2 files changed, 0 insertions(+), 3 deletions(-)
drivers/acpi/processor_idle.c +0 -2
index 4b9ebd5..e2b67e2 100644
@@ -495,8 +495,6 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
 		if (obj->type != ACPI_TYPE_INTEGER)
 			continue;
 
-		cx.power = obj->integer.value;
-
 		current_count++;
 		memcpy(&(pr->power.states[current_count]), &cx, sizeof(cx));
 
include/acpi/processor.h +0 -1
index bc3449a..bed1093 100644
@@ -59,7 +59,6 @@ struct acpi_processor_cx {
 	u8 entry_method;
 	u8 index;
 	u32 latency;
-	u32 power;
 	u8 bm_sts_skip;
 	char desc[ACPI_CX_DESC_LEN];
 };
Signature · 1 line
1.7.4.1
#12 lore raw

PATCH RESEND 6/6 acpi : remove 'power' field from acpi_processor_cx

In reply to Daniel Lezcano

The power field is filled but never used in the code.

---
 drivers/acpi/processor_idle.c |    2 --
 include/acpi/processor.h      |    1 -
 2 files changed, 0 insertions(+), 3 deletions(-)
drivers/acpi/processor_idle.c +0 -2
index 4b9ebd5..e2b67e2 100644
@@ -495,8 +495,6 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
 		if (obj->type != ACPI_TYPE_INTEGER)
 			continue;
 
-		cx.power = obj->integer.value;
-
 		current_count++;
 		memcpy(&(pr->power.states[current_count]), &cx, sizeof(cx));
 
include/acpi/processor.h +0 -1
index bc3449a..bed1093 100644
@@ -59,7 +59,6 @@ struct acpi_processor_cx {
 	u8 entry_method;
 	u8 index;
 	u32 latency;
-	u32 power;
 	u8 bm_sts_skip;
 	char desc[ACPI_CX_DESC_LEN];
 };
Signature · 1 line
1.7.4.1