From 8b88b0998e35d239e74446cc30f354bdab86df89 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Fri, 8 Feb 2008 04:20:26 -0800 Subject: libfs: allow error return from simple attributes Sometimes simple attributes might need to return an error, e.g. for acquiring a mutex interruptibly. In fact we have that situation in spufs already which is the original user of the simple attributes. This patch merged the temporarily forked attributes in spufs back into the main ones and allows to return errors. [akpm@linux-foundation.org: build fix] Signed-off-by: Christoph Hellwig Cc: Cc: Arnd Bergmann Cc: Greg KH Cc: Al Viro Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/avr32/kernel/ocd.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'arch/avr32') diff --git a/arch/avr32/kernel/ocd.c b/arch/avr32/kernel/ocd.c index c4f023294d7..1b0245d4e0c 100644 --- a/arch/avr32/kernel/ocd.c +++ b/arch/avr32/kernel/ocd.c @@ -90,25 +90,29 @@ static struct dentry *ocd_debugfs_DC; static struct dentry *ocd_debugfs_DS; static struct dentry *ocd_debugfs_count; -static u64 ocd_DC_get(void *data) +static int ocd_DC_get(void *data, u64 *val) { - return ocd_read(DC); + *val = ocd_read(DC); + return 0; } -static void ocd_DC_set(void *data, u64 val) +static int ocd_DC_set(void *data, u64 val) { ocd_write(DC, val); + return 0; } DEFINE_SIMPLE_ATTRIBUTE(fops_DC, ocd_DC_get, ocd_DC_set, "0x%08llx\n"); -static u64 ocd_DS_get(void *data) +static int ocd_DS_get(void *data, u64 *val) { - return ocd_read(DS); + *val = ocd_read(DS); + return 0; } DEFINE_SIMPLE_ATTRIBUTE(fops_DS, ocd_DS_get, NULL, "0x%08llx\n"); -static u64 ocd_count_get(void *data) +static int ocd_count_get(void *data, u64 *val) { - return ocd_count; + *val = ocd_count; + return 0; } DEFINE_SIMPLE_ATTRIBUTE(fops_count, ocd_count_get, NULL, "%lld\n"); -- cgit v1.2.3