| .. | .. |
|---|
| 3 | 3 | #include <linux/stat.h> |
|---|
| 4 | 4 | #include <asm/macio.h> |
|---|
| 5 | 5 | |
|---|
| 6 | | - |
|---|
| 7 | | -#define macio_config_of_attr(field, format_string) \ |
|---|
| 8 | | -static ssize_t \ |
|---|
| 9 | | -field##_show (struct device *dev, struct device_attribute *attr, \ |
|---|
| 10 | | - char *buf) \ |
|---|
| 11 | | -{ \ |
|---|
| 12 | | - struct macio_dev *mdev = to_macio_device (dev); \ |
|---|
| 13 | | - return sprintf (buf, format_string, mdev->ofdev.dev.of_node->field); \ |
|---|
| 14 | | -} \ |
|---|
| 15 | | -static DEVICE_ATTR_RO(field); |
|---|
| 16 | | - |
|---|
| 17 | 6 | static ssize_t |
|---|
| 18 | 7 | compatible_show (struct device *dev, struct device_attribute *attr, char *buf) |
|---|
| 19 | 8 | { |
|---|
| .. | .. |
|---|
| 58 | 47 | static DEVICE_ATTR_RO(modalias); |
|---|
| 59 | 48 | static DEVICE_ATTR_RO(devspec); |
|---|
| 60 | 49 | |
|---|
| 61 | | -macio_config_of_attr (name, "%s\n"); |
|---|
| 62 | | -macio_config_of_attr (type, "%s\n"); |
|---|
| 50 | +static ssize_t name_show(struct device *dev, |
|---|
| 51 | + struct device_attribute *attr, char *buf) |
|---|
| 52 | +{ |
|---|
| 53 | + return sprintf(buf, "%pOFn\n", dev->of_node); |
|---|
| 54 | +} |
|---|
| 55 | +static DEVICE_ATTR_RO(name); |
|---|
| 56 | + |
|---|
| 57 | +static ssize_t type_show(struct device *dev, |
|---|
| 58 | + struct device_attribute *attr, char *buf) |
|---|
| 59 | +{ |
|---|
| 60 | + return sprintf(buf, "%s\n", of_node_get_device_type(dev->of_node)); |
|---|
| 61 | +} |
|---|
| 62 | +static DEVICE_ATTR_RO(type); |
|---|
| 63 | 63 | |
|---|
| 64 | 64 | static struct attribute *macio_dev_attrs[] = { |
|---|
| 65 | 65 | &dev_attr_name.attr, |
|---|