Blame view
drivers/dio/dio-sysfs.c
2.2 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
/* * File Attributes for DIO Devices * * Copyright (C) 2004 Jochen Friedrich * * Loosely based on drivers/pci/pci-sysfs.c and drivers/zorro/zorro-sysfs.c * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive * for more details. */ #include <linux/kernel.h> #include <linux/dio.h> #include <linux/stat.h> /* show configuration fields */ |
74880c063 [PATCH] Driver Co... |
19 |
static ssize_t dio_show_id(struct device *dev, struct device_attribute *attr, char *buf) |
1da177e4c Linux-2.6.12-rc2 |
20 21 22 23 24 25 26 27 |
{ struct dio_dev *d; d = to_dio_dev(dev); return sprintf(buf, "0x%02x ", (d->id & 0xff)); } static DEVICE_ATTR(id, S_IRUGO, dio_show_id, NULL); |
74880c063 [PATCH] Driver Co... |
28 |
static ssize_t dio_show_ipl(struct device *dev, struct device_attribute *attr, char *buf) |
1da177e4c Linux-2.6.12-rc2 |
29 30 31 32 33 34 35 36 |
{ struct dio_dev *d; d = to_dio_dev(dev); return sprintf(buf, "0x%02x ", d->ipl); } static DEVICE_ATTR(ipl, S_IRUGO, dio_show_ipl, NULL); |
74880c063 [PATCH] Driver Co... |
37 |
static ssize_t dio_show_secid(struct device *dev, struct device_attribute *attr, char *buf) |
1da177e4c Linux-2.6.12-rc2 |
38 39 40 41 42 43 44 45 |
{ struct dio_dev *d; d = to_dio_dev(dev); return sprintf(buf, "0x%02x ", ((d->id >> 8)& 0xff)); } static DEVICE_ATTR(secid, S_IRUGO, dio_show_secid, NULL); |
74880c063 [PATCH] Driver Co... |
46 |
static ssize_t dio_show_name(struct device *dev, struct device_attribute *attr, char *buf) |
1da177e4c Linux-2.6.12-rc2 |
47 48 49 50 51 52 53 54 |
{ struct dio_dev *d; d = to_dio_dev(dev); return sprintf(buf, "%s ", d->name); } static DEVICE_ATTR(name, S_IRUGO, dio_show_name, NULL); |
74880c063 [PATCH] Driver Co... |
55 |
static ssize_t dio_show_resource(struct device *dev, struct device_attribute *attr, char *buf) |
1da177e4c Linux-2.6.12-rc2 |
56 57 58 59 60 |
{ struct dio_dev *d = to_dio_dev(dev); return sprintf(buf, "0x%08lx 0x%08lx 0x%08lx ", |
fae3306ac m68k: dio - Kill ... |
61 62 |
(unsigned long)dio_resource_start(d), (unsigned long)dio_resource_end(d), |
1da177e4c Linux-2.6.12-rc2 |
63 64 65 |
dio_resource_flags(d)); } static DEVICE_ATTR(resource, S_IRUGO, dio_show_resource, NULL); |
2e4c77bea m68k: dio - Kill ... |
66 |
int dio_create_sysfs_dev_files(struct dio_dev *d) |
1da177e4c Linux-2.6.12-rc2 |
67 68 |
{ struct device *dev = &d->dev; |
2e4c77bea m68k: dio - Kill ... |
69 |
int error; |
1da177e4c Linux-2.6.12-rc2 |
70 71 |
/* current configuration's attributes */ |
2e4c77bea m68k: dio - Kill ... |
72 73 74 75 76 77 78 79 |
if ((error = device_create_file(dev, &dev_attr_id)) || (error = device_create_file(dev, &dev_attr_ipl)) || (error = device_create_file(dev, &dev_attr_secid)) || (error = device_create_file(dev, &dev_attr_name)) || (error = device_create_file(dev, &dev_attr_resource))) return error; return 0; |
1da177e4c Linux-2.6.12-rc2 |
80 |
} |