From: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 1/3] powerpc: Split __SYSFS_SPRSETUP macro
Date: Mon, 02 Jun 2014 14:39:43 +0530 [thread overview]
Message-ID: <538C3F57.2080300@linux.vnet.ibm.com> (raw)
In-Reply-To: <c0db1b210405db5ff579a2d7432dde2c73bd47bb.1400652868.git.sam.bobroff@au1.ibm.com>
On Wednesday 21 May 2014 12:02 PM, Sam Bobroff wrote:
> Split the __SYSFS_SPRSETUP macro into two parts so that registers requiring
> custom read and write functions can use common code for their show and store
> functions.
>
> Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
> ---
> arch/powerpc/kernel/sysfs.c | 19 +++++++++++++------
> 1 file changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
> index d90d4b7..e2a1d6f 100644
> --- a/arch/powerpc/kernel/sysfs.c
> +++ b/arch/powerpc/kernel/sysfs.c
> @@ -404,7 +404,7 @@ void ppc_enable_pmcs(void)
> }
> EXPORT_SYMBOL(ppc_enable_pmcs);
>
> -#define __SYSFS_SPRSETUP(NAME, ADDRESS, EXTRA) \
> +#define __SYSFS_SPRSETUP_READ_WRITE(NAME, ADDRESS, EXTRA) \
> static void read_##NAME(void *val) \
> { \
> *(unsigned long *)val = mfspr(ADDRESS); \
> @@ -413,7 +413,9 @@ static void write_##NAME(void *val) \
> { \
> EXTRA; \
> mtspr(ADDRESS, *(unsigned long *)val); \
> -} \
> +}
> +
> +#define __SYSFS_SPRSETUP_SHOW_STORE(NAME) \
> static ssize_t show_##NAME(struct device *dev, \
> struct device_attribute *attr, \
> char *buf) \
> @@ -436,10 +438,15 @@ static ssize_t __used \
> return count; \
> }
>
> -#define SYSFS_PMCSETUP(NAME, ADDRESS) \
> - __SYSFS_SPRSETUP(NAME, ADDRESS, ppc_enable_pmcs())
> -#define SYSFS_SPRSETUP(NAME, ADDRESS) \
> - __SYSFS_SPRSETUP(NAME, ADDRESS, )
> +#define SYSFS_PMCSETUP(NAME, ADDRESS) \
> + __SYSFS_SPRSETUP_READ_WRITE(NAME, ADDRESS, ppc_enable_pmcs()) \
> + __SYSFS_SPRSETUP_SHOW_STORE(NAME)
> +#define SYSFS_SPRSETUP(NAME, ADDRESS) \
> + __SYSFS_SPRSETUP_READ_WRITE(NAME, ADDRESS, ) \
> + __SYSFS_SPRSETUP_SHOW_STORE(NAME)
> +
> +#define SYSFS_SPRSETUP_SHOW_STORE(NAME) \
> + __SYSFS_SPRSETUP_SHOW_STORE(NAME)
>
> /* Let's define all possible registers, we'll only hook up the ones
> * that are implemented on the current processor
>
Acked-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
next prev parent reply other threads:[~2014-06-02 9:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-21 6:32 [PATCH 0/3] powerpc: fix regression of per-CPU DSCR setting Sam Bobroff
2014-05-21 6:32 ` [PATCH 1/3] powerpc: Split __SYSFS_SPRSETUP macro Sam Bobroff
2014-06-02 9:09 ` Madhavan Srinivasan [this message]
2014-05-21 6:32 ` [PATCH 2/3] powerpc: fix regression of per-CPU DSCR setting Sam Bobroff
2014-06-02 9:27 ` Madhavan Srinivasan
2014-05-21 6:32 ` [PATCH 3/3] powerpc: Document sysfs DSCR interface Sam Bobroff
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=538C3F57.2080300@linux.vnet.ibm.com \
--to=maddy@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.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).