diff options
author | Sudeep Holla <sudeep.holla@arm.com> | 2014-09-30 09:48:22 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-11-07 14:45:00 -0500 |
commit | 5aaba36318e5995e8c95d077a46d9a4d00fcc1cd (patch) | |
tree | edf9eb1ea758b82f1f04963a0fc54fab8bc8bc50 /drivers/acpi/acpi_pad.c | |
parent | 0372ffb35d00288802265586a29c117911d02fb8 (diff) |
cpumask: factor out show_cpumap into separate helper function
Many sysfs *_show function use cpu{list,mask}_scnprintf to copy cpumap
to the buffer aligned to PAGE_SIZE, append '\n' and '\0' to return null
terminated buffer with newline.
This patch creates a new helper function cpumap_print_to_pagebuf in
cpumask.h using newly added bitmap_print_to_pagebuf and consolidates
most of those sysfs functions using the new helper function.
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
Tested-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: x86@kernel.org
Cc: linux-acpi@vger.kernel.org
Cc: linux-pci@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/acpi/acpi_pad.c')
-rw-r--r-- | drivers/acpi/acpi_pad.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index f148a0580e04..c7b105c0e1d3 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c | |||
@@ -350,12 +350,10 @@ static ssize_t acpi_pad_idlecpus_store(struct device *dev, | |||
350 | static ssize_t acpi_pad_idlecpus_show(struct device *dev, | 350 | static ssize_t acpi_pad_idlecpus_show(struct device *dev, |
351 | struct device_attribute *attr, char *buf) | 351 | struct device_attribute *attr, char *buf) |
352 | { | 352 | { |
353 | int n = 0; | 353 | return cpumap_print_to_pagebuf(false, buf, |
354 | n = cpumask_scnprintf(buf, PAGE_SIZE-2, to_cpumask(pad_busy_cpus_bits)); | 354 | to_cpumask(pad_busy_cpus_bits)); |
355 | buf[n++] = '\n'; | ||
356 | buf[n] = '\0'; | ||
357 | return n; | ||
358 | } | 355 | } |
356 | |||
359 | static DEVICE_ATTR(idlecpus, S_IRUGO|S_IWUSR, | 357 | static DEVICE_ATTR(idlecpus, S_IRUGO|S_IWUSR, |
360 | acpi_pad_idlecpus_show, | 358 | acpi_pad_idlecpus_show, |
361 | acpi_pad_idlecpus_store); | 359 | acpi_pad_idlecpus_store); |