From: Peter Zijlstra <peterz@infradead.org>
To: Sudeep Holla <sudeep.holla@arm.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Bjorn Helgaas <bhelgaas@google.com>,
x86@kernel.org, linux-acpi@vger.kernel.org,
linux-pci@vger.kernel.org
Subject: Re: [PATCH v4 01/11] cpumask: factor out show_cpumap into separate helper function
Date: Thu, 4 Sep 2014 08:20:06 +0200 [thread overview]
Message-ID: <20140904062006.GC3190@worktop.ger.corp.intel.com> (raw)
In-Reply-To: <1409763617-17074-2-git-send-email-sudeep.holla@arm.com>
On Wed, Sep 03, 2014 at 06:00:07PM +0100, Sudeep Holla wrote:
> diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
> index 2997af6d2ccd..26d8348292dd 100644
> --- a/include/linux/cpumask.h
> +++ b/include/linux/cpumask.h
> @@ -11,6 +11,8 @@
> #include <linux/bitmap.h>
> #include <linux/bug.h>
>
> +#include <asm/page.h>
> +
> typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
>
> /**
> @@ -792,6 +794,31 @@ static inline const struct cpumask *get_cpu_mask(unsigned int cpu)
> }
> #endif /* NR_CPUS > BITS_PER_LONG */
>
> +/**
> + * cpumap_copy_to_buf - copies the cpumask into the buffer either
> + * as comma-separated list of cpus or hex values of cpumask
> + * @list: indicates whether the cpumap must be list
> + * @mask: the cpumask to copy
> + * @buf: the buffer to copy into
> + *
> + * Returns the length of the (null-terminated) @buf string, zero if
> + * nothing is copied.
> + */
> +static inline ssize_t
> +cpumap_copy_to_buf(bool list, const struct cpumask *mask, char *buf)
> +{
> + ptrdiff_t len = PTR_ALIGN(buf + PAGE_SIZE - 1, PAGE_SIZE) - buf - 2;
> + int n = 0;
> +
> + if (len > 1) {
> + n = list ? cpulist_scnprintf(buf, len, mask) :
> + cpumask_scnprintf(buf, len, mask);
> + buf[n++] = '\n';
> + buf[n] = '\0';
> + }
> + return n;
> +}
> +
Does that really make sense as an inline?
next prev parent reply other threads:[~2014-09-04 6:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1409763617-17074-1-git-send-email-sudeep.holla@arm.com>
2014-09-03 17:00 ` [PATCH v4 01/11] cpumask: factor out show_cpumap into separate helper function Sudeep Holla
2014-09-03 17:05 ` Bjorn Helgaas
2014-09-03 17:09 ` Sudeep Holla
2014-09-03 21:46 ` Rafael J. Wysocki
2014-09-04 6:20 ` Peter Zijlstra [this message]
2014-09-04 9:03 ` Sudeep Holla
2014-09-04 9:21 ` Peter Zijlstra
2014-09-04 10:43 ` Sudeep Holla
2014-09-04 11:25 ` Peter Zijlstra
2014-09-04 12:27 ` Sudeep Holla
2014-09-04 15:46 ` [PATCH v4 01/11 UPDATE] " Sudeep Holla
2014-09-19 22:23 ` Stephen Boyd
2014-09-24 8:51 ` Sudeep Holla
2014-09-24 10:20 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140904062006.GC3190@worktop.ger.corp.intel.com \
--to=peterz@infradead.org \
--cc=Lorenzo.Pieralisi@arm.com \
--cc=bhelgaas@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=sudeep.holla@arm.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).