static ssize_t dio_show_name(struct device *dev, struct device_attribute *attr, char *buf) { struct dio_dev *d; d = to_dio_dev(dev); return sprintf(buf, "%s\n", d->name); }
static ssize_t dio_show_secid(struct device *dev, struct device_attribute *attr, char *buf) { struct dio_dev *d; d = to_dio_dev(dev); return sprintf(buf, "0x%02x\n", ((d->id >> 8)& 0xff)); }
static ssize_t dio_show_ipl(struct device *dev, struct device_attribute *attr, char *buf) { struct dio_dev *d; d = to_dio_dev(dev); return sprintf(buf, "0x%02x\n", d->ipl); }
static ssize_t dio_show_resource(struct device *dev, struct device_attribute *attr, char *buf) { struct dio_dev *d = to_dio_dev(dev); return sprintf(buf, "0x%08lx 0x%08lx 0x%08lx\n", (unsigned long)dio_resource_start(d), (unsigned long)dio_resource_end(d), dio_resource_flags(d)); }
static int dio_bus_match(struct device *dev, struct device_driver *drv) { struct dio_dev *d = to_dio_dev(dev); struct dio_driver *dio_drv = to_dio_driver(drv); const struct dio_device_id *ids = dio_drv->id_table; if (!ids) return 0; return dio_match_device(ids, d) ? 1 : 0; }
static int dio_device_probe(struct device *dev) { int error = 0; struct dio_driver *drv = to_dio_driver(dev->driver); struct dio_dev *d = to_dio_dev(dev); if (!d->driver && drv->probe) { const struct dio_device_id *id; id = dio_match_device(drv->id_table, d); if (id) error = drv->probe(d, id); if (error >= 0) { d->driver = drv; error = 0; } } return error; }
static int dio_bus_match(struct device *dev, struct device_driver *drv) { struct dio_dev *d = to_dio_dev(dev); struct dio_driver *dio_drv = to_dio_driver(drv); const struct dio_device_id *ids = dio_drv->id_table; if (!ids) return 0; while (ids->id) { if (ids->id == DIO_WILDCARD) return 1; if (DIO_NEEDSSECID(ids->id & 0xff)) { if (ids->id == d->id) return 1; } else { if ((ids->id & 0xff) == (d->id & 0xff)) return 1; } ids++; } return 0; }