0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
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
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
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 };