Commit 6eb714c6 authored by Mike Travis's avatar Mike Travis

cpufreq: use work_on_cpu in acpi-cpufreq.c for drv_read and drv_write

Impact: use new work_on_cpu function to reduce stack usage

Replace the saving of current->cpus_allowed and set_cpus_allowed_ptr() with
a work_on_cpu function for drv_read() and drv_write().

Basically converts do_drv_{read,write} into "work_on_cpu" functions that
are now called by drv_read and drv_write.

Note: This patch basically reverts 50c668d6 which reverted 7503bfba, now
that the work_on_cpu() function is more stable.
Signed-off-by: default avatarMike Travis <travis@sgi.com>
Acked-by: default avatarRusty Russell <rusty@rustcorp.com.au>
Tested-by: default avatarDieter Ries <clip2@gmx.de>
Tested-by: default avatarMaciej Rutecki <maciej.rutecki@gmail.com>
Cc: Dave Jones <davej@redhat.com>
Cc: <cpufreq@vger.kernel.org>
parent e1d9ec62
...@@ -150,8 +150,9 @@ struct drv_cmd { ...@@ -150,8 +150,9 @@ struct drv_cmd {
u32 val; u32 val;
}; };
static void do_drv_read(struct drv_cmd *cmd) static long do_drv_read(void *_cmd)
{ {
struct drv_cmd *cmd = _cmd;
u32 h; u32 h;
switch (cmd->type) { switch (cmd->type) {
...@@ -166,10 +167,12 @@ static void do_drv_read(struct drv_cmd *cmd) ...@@ -166,10 +167,12 @@ static void do_drv_read(struct drv_cmd *cmd)
default: default:
break; break;
} }
return 0;
} }
static void do_drv_write(struct drv_cmd *cmd) static long do_drv_write(void *_cmd)
{ {
struct drv_cmd *cmd = _cmd;
u32 lo, hi; u32 lo, hi;
switch (cmd->type) { switch (cmd->type) {
...@@ -186,30 +189,23 @@ static void do_drv_write(struct drv_cmd *cmd) ...@@ -186,30 +189,23 @@ static void do_drv_write(struct drv_cmd *cmd)
default: default:
break; break;
} }
return 0;
} }
static void drv_read(struct drv_cmd *cmd) static void drv_read(struct drv_cmd *cmd)
{ {
cpumask_t saved_mask = current->cpus_allowed;
cmd->val = 0; cmd->val = 0;
set_cpus_allowed_ptr(current, cmd->mask); work_on_cpu(cpumask_any(cmd->mask), do_drv_read, cmd);
do_drv_read(cmd);
set_cpus_allowed_ptr(current, &saved_mask);
} }
static void drv_write(struct drv_cmd *cmd) static void drv_write(struct drv_cmd *cmd)
{ {
cpumask_t saved_mask = current->cpus_allowed;
unsigned int i; unsigned int i;
for_each_cpu(i, cmd->mask) { for_each_cpu(i, cmd->mask) {
set_cpus_allowed_ptr(current, cpumask_of(i)); work_on_cpu(i, do_drv_write, cmd);
do_drv_write(cmd);
} }
set_cpus_allowed_ptr(current, &saved_mask);
return;
} }
static u32 get_cur_val(const struct cpumask *mask) static u32 get_cur_val(const struct cpumask *mask)
...@@ -367,7 +363,7 @@ static unsigned int get_cur_freq_on_cpu(unsigned int cpu) ...@@ -367,7 +363,7 @@ static unsigned int get_cur_freq_on_cpu(unsigned int cpu)
return freq; return freq;
} }
static unsigned int check_freqs(const cpumask_t *mask, unsigned int freq, static unsigned int check_freqs(const struct cpumask *mask, unsigned int freq,
struct acpi_cpufreq_data *data) struct acpi_cpufreq_data *data)
{ {
unsigned int cur_freq; unsigned int cur_freq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment