static int hsi_driver_suspend(struct device *dev, pm_message_t mesg) { struct hsi_device_driver *drv = to_hsi_device_driver(dev->driver); if (!dev->driver) return 0; drv = to_hsi_device_driver(dev->driver); if (!drv->suspend) return 0; return drv->suspend(to_hsi_device(dev), mesg); }
static int hsi_driver_probe(struct device *dev) { struct hsi_device_driver *drv = to_hsi_device_driver(dev->driver); if (!drv->probe) return -ENODEV; return drv->probe(to_hsi_device(dev)); }
static int hsi_bus_resume(struct device *dev) { struct hsi_device_driver *drv; if (!dev->driver) return 0; drv = to_hsi_device_driver(dev->driver); if (!drv->resume) return 0; return drv->resume(to_hsi_device(dev)); }
static int hsi_bus_match(struct device *device, struct device_driver *driver) { struct hsi_device *dev = to_hsi_device(device); struct hsi_device_driver *drv = to_hsi_device_driver(driver); if (!test_bit(dev->n_ctrl, &drv->ctrl_mask)) return 0; if (!test_bit(dev->n_ch, &drv->ch_mask[dev->n_p])) return 0; return 1; }
static int hsi_driver_remove(struct device *dev) { struct hsi_device_driver *drv; int ret; if (!dev->driver) return 0; drv = to_hsi_device_driver(dev->driver); if (drv->remove) { ret = drv->remove(to_hsi_device(dev)); } else { dev->driver = NULL; ret = 0; } return ret; }
static int hsi_bus_probe(struct device *dev) { struct hsi_device_driver *drv; int rc; pr_debug("HSI DRIVER BUS : hsi_bus_probe\n"); if (!dev->driver) return 0; drv = to_hsi_device_driver(dev->driver); if (!drv->probe) return -ENODEV; rc = drv->probe(to_hsi_device(dev)); return rc; }
static int hsi_bus_remove(struct device *dev) { struct hsi_device_driver *drv; int ret; pr_debug("HSI DRIVER BUS : hsi_bus_remove\n"); if (!dev->driver) return 0; drv = to_hsi_device_driver(dev->driver); if (drv->remove) { ret = drv->remove(to_hsi_device(dev)); } else { dev->driver = NULL; ret = 0; } return ret; }
static int hsi_bus_match(struct device *device, struct device_driver *driver) { struct hsi_device *dev = to_hsi_device(device); struct hsi_device_driver *drv = to_hsi_device_driver(driver); pr_debug("HSI DRIVER BUS : hsi_bus_match for ctrl:%d, port:%d, ch%d\n", dev->n_ctrl, dev->n_p + 1, dev->n_ch); if (!test_bit(dev->n_ctrl, &drv->ctrl_mask)) return 0; if (!test_bit(dev->n_ch, &drv->ch_mask[dev->n_p])) return 0; pr_info( "HSI DRIVER BUS : hsi_bus_match SUCCESS : ctrl:%d (mask:%x), port:%d, ch:%d (mask:%x)\n", dev->n_ctrl, (u32) drv->ctrl_mask, dev->n_p + 1, dev->n_ch, (u32) drv->ch_mask[dev->n_p]); return 1; }