static void superhyway_device_release(struct device *dev) { struct superhyway_device *sdev = to_superhyway_device(dev); kfree(sdev->resource); kfree(sdev); }
static int superhyway_device_remove(struct device *dev) { struct superhyway_device *shyway_dev = to_superhyway_device(dev); struct superhyway_driver *shyway_drv = to_superhyway_driver(dev->driver); if (shyway_drv && shyway_drv->remove) { shyway_drv->remove(shyway_dev); return 0; } return -ENODEV; }
static int superhyway_bus_match(struct device *dev, struct device_driver *drv) { struct superhyway_device *shyway_dev = to_superhyway_device(dev); struct superhyway_driver *shyway_drv = to_superhyway_driver(drv); const struct superhyway_device_id *ids = shyway_drv->id_table; if (!ids) return -EINVAL; if (superhyway_match_id(ids, shyway_dev)) return 1; return -ENODEV; }
static int superhyway_device_probe(struct device *dev) { struct superhyway_device *shyway_dev = to_superhyway_device(dev); struct superhyway_driver *shyway_drv = to_superhyway_driver(dev->driver); if (shyway_drv && shyway_drv->probe) { const struct superhyway_device_id *id; id = superhyway_match_id(shyway_drv->id_table, shyway_dev); if (id) return shyway_drv->probe(shyway_dev, id); } return -ENODEV; }
static void superhyway_device_release(struct device *dev) { kfree(to_superhyway_device(dev)); }