Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 39a360ef authored by Sam bobroff's avatar Sam bobroff Committed by Benjamin Herrenschmidt
Browse files

powerpc: Split __SYSFS_SPRSETUP macro



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: default avatarSam Bobroff <sam.bobroff@au1.ibm.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent b717d985
Loading
Loading
Loading
Loading
+13 −6
Original line number Original line Diff line number Diff line
@@ -404,7 +404,7 @@ void ppc_enable_pmcs(void)
}
}
EXPORT_SYMBOL(ppc_enable_pmcs);
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) \
static void read_##NAME(void *val) \
{ \
{ \
	*(unsigned long *)val = mfspr(ADDRESS);	\
	*(unsigned long *)val = mfspr(ADDRESS);	\
@@ -413,7 +413,9 @@ static void write_##NAME(void *val) \
{ \
{ \
	EXTRA; \
	EXTRA; \
	mtspr(ADDRESS, *(unsigned long *)val);	\
	mtspr(ADDRESS, *(unsigned long *)val);	\
} \
}

#define __SYSFS_SPRSETUP_SHOW_STORE(NAME) \
static ssize_t show_##NAME(struct device *dev, \
static ssize_t show_##NAME(struct device *dev, \
			struct device_attribute *attr, \
			struct device_attribute *attr, \
			char *buf) \
			char *buf) \
@@ -437,9 +439,14 @@ static ssize_t __used \
}
}


#define SYSFS_PMCSETUP(NAME, ADDRESS) \
#define SYSFS_PMCSETUP(NAME, ADDRESS) \
	__SYSFS_SPRSETUP(NAME, ADDRESS, ppc_enable_pmcs())
	__SYSFS_SPRSETUP_READ_WRITE(NAME, ADDRESS, ppc_enable_pmcs()) \
	__SYSFS_SPRSETUP_SHOW_STORE(NAME)
#define SYSFS_SPRSETUP(NAME, ADDRESS) \
#define SYSFS_SPRSETUP(NAME, ADDRESS) \
	__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
/* Let's define all possible registers, we'll only hook up the ones
 * that are implemented on the current processor
 * that are implemented on the current processor