===================================================================
@@ -70,7 +70,32 @@
#define PM_TIMER_TICKS_TO_US(p) (((p) * 1000)/(PM_TIMER_FREQUENCY/1000))
static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER;
-module_param(max_cstate, uint, 0000);
+
+static int param_set_max_cstate(const char *val, struct kernel_param *kp)
+{
+ unsigned long cstate = 0;
+ int ret = 0;
+
+ if (!val)
+ return -EINVAL;
+
+ ret = strict_strtoul(val, 10, &cstate);
+ if (ret == -EINVAL || (unsigned int)cstate != cstate)
+ return -EINVAL;
+ /*
+ * if the value is equal to or less than zero, it will be ingored.
+ * Of course it will also be ignored if it is bigger than the
+ * threshold of ACPI_PROCESSOR_MAX_POWER.
+ */
+ if (cstate <= 0 || cstate > ACPI_PROCESSOR_MAX_POWER)
+ return -EINVAL;
+
+ max_cstate = cstate;
+
+ return 0;
+}
+module_param_call(max_cstate, param_set_max_cstate, NULL,
+ &max_cstate, 0000);
static unsigned int nocst __read_mostly;
module_param(nocst, uint, 0000);