Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * drivers/sh/superhyway/superhyway-sysfs.c
0003  *
0004  * SuperHyway Bus sysfs interface
0005  *
0006  * Copyright (C) 2004, 2005  Paul Mundt <lethal@linux-sh.org>
0007  *
0008  * This file is subject to the terms and conditions of the GNU General Public
0009  * License.  See the file "COPYING" in the main directory of this archive
0010  * for more details.
0011  */
0012 #include <linux/kernel.h>
0013 #include <linux/device.h>
0014 #include <linux/types.h>
0015 #include <linux/superhyway.h>
0016 
0017 #define superhyway_ro_attr(name, fmt, field)                \
0018 static ssize_t name##_show(struct device *dev, struct device_attribute *attr, char *buf)        \
0019 {                                   \
0020     struct superhyway_device *s = to_superhyway_device(dev);    \
0021     return sprintf(buf, fmt, s->field);             \
0022 }                                   \
0023 static DEVICE_ATTR_RO(name);
0024 
0025 /* VCR flags */
0026 superhyway_ro_attr(perr_flags, "0x%02x\n", vcr.perr_flags);
0027 superhyway_ro_attr(merr_flags, "0x%02x\n", vcr.merr_flags);
0028 superhyway_ro_attr(mod_vers, "0x%04x\n", vcr.mod_vers);
0029 superhyway_ro_attr(mod_id, "0x%04x\n", vcr.mod_id);
0030 superhyway_ro_attr(bot_mb, "0x%02x\n", vcr.bot_mb);
0031 superhyway_ro_attr(top_mb, "0x%02x\n", vcr.top_mb);
0032 
0033 /* Misc */
0034 superhyway_ro_attr(resource, "0x%08lx\n", resource[0].start);
0035 
0036 static struct attribute *superhyway_dev_attrs[] = {
0037     &dev_attr_perr_flags.attr,
0038     &dev_attr_merr_flags.attr,
0039     &dev_attr_mod_vers.attr,
0040     &dev_attr_mod_id.attr,
0041     &dev_attr_bot_mb.attr,
0042     &dev_attr_top_mb.attr,
0043     &dev_attr_resource.attr,
0044     NULL,
0045 };
0046 
0047 static const struct attribute_group superhyway_dev_group = {
0048     .attrs = superhyway_dev_attrs,
0049 };
0050 
0051 const struct attribute_group *superhyway_dev_groups[] = {
0052     &superhyway_dev_group,
0053     NULL,
0054 };