@@ -436,7 +436,7 @@ static int spufs_cntl_open(struct inode *inode, struct file *file)
ctx->cntl = inode->i_mapping;
mutex_unlock(&ctx->mapping_lock);
return simple_attr_open(inode, file, spufs_cntl_get,
- spufs_cntl_set, "0x%08lx");
+ spufs_cntl_set, "0x%08llx");
}
static int
@@ -792,6 +792,7 @@ struct simple_attr {
/* simple_attr_open is called by an actual attribute open file operation
* to set the attribute specific access operations. */
+#undef simple_attr_open
int simple_attr_open(struct inode *inode, struct file *file,
int (*get)(void *, u64 *), int (*set)(void *, u64),
const char *fmt)
@@ -42,7 +42,6 @@ extern struct dentry *arch_debugfs_dir;
#define DEFINE_DEBUGFS_ATTRIBUTE(__fops, __get, __set, __fmt) \
static int __fops ## _open(struct inode *inode, struct file *file) \
{ \
- __simple_attr_check_format(__fmt, 0ull); \
return simple_attr_open(inode, file, __get, __set, __fmt); \
} \
static const struct file_operations __fops = { \
@@ -3387,7 +3387,6 @@ void simple_transaction_set(struct file *file, size_t n);
#define DEFINE_SIMPLE_ATTRIBUTE(__fops, __get, __set, __fmt) \
static int __fops ## _open(struct inode *inode, struct file *file) \
{ \
- __simple_attr_check_format(__fmt, 0ull); \
return simple_attr_open(inode, file, __get, __set, __fmt); \
} \
static const struct file_operations __fops = { \
@@ -3408,6 +3407,11 @@ void __simple_attr_check_format(const char *fmt, ...)
int simple_attr_open(struct inode *inode, struct file *file,
int (*get)(void *, u64 *), int (*set)(void *, u64),
const char *fmt);
+#define simple_attr_open(inode, file, get, set, fmt) ({ \
+ if (0) \
+ __simple_attr_check_format(fmt, 0ull); \
+ simple_attr_open(inode, file, get, set, fmt); \
+ })
int simple_attr_release(struct inode *inode, struct file *file);
ssize_t simple_attr_read(struct file *file, char __user *buf,
size_t len, loff_t *ppos);
Almost all uses of simple_attr_open() happen via macros that do a __simple_attr_check_format(__fmt, 0ull). One of the few exceptions actually does not pass a fmt matching an unsigned long long. So move the check into the call of simple_attr_open() by wrapping it in a macro of the same name, and fix the powerpc case while at it. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> --- arch/powerpc/platforms/cell/spufs/file.c | 2 +- fs/libfs.c | 1 + include/linux/debugfs.h | 1 - include/linux/fs.h | 6 +++++- 4 files changed, 7 insertions(+), 3 deletions(-)