goto err_unlock;
}
- ret = gb_hd_cport_allocate(hd, hd_cport_id);
+ ret = gb_hd_cport_allocate(hd, hd_cport_id, flags);
if (ret < 0) {
dev_err(&hd->dev, "failed to allocate cport: %d\n", ret);
goto err_unlock;
EXPORT_SYMBOL_GPL(gb_hd_cport_reserve);
/* Locking: Caller guarantees serialisation */
-int gb_hd_cport_allocate(struct gb_host_device *hd, int cport_id)
+int gb_hd_cport_allocate(struct gb_host_device *hd, int cport_id,
+ unsigned long flags)
{
struct ida *id_map = &hd->cport_id_map;
int ida_start, ida_end;
+ if (hd->driver->cport_allocate)
+ return hd->driver->cport_allocate(hd, cport_id, flags);
+
if (cport_id < 0) {
ida_start = 0;
ida_end = hd->num_cports;
/* Locking: Caller guarantees serialisation */
void gb_hd_cport_release(struct gb_host_device *hd, u16 cport_id)
{
+ if (hd->driver->cport_release) {
+ hd->driver->cport_release(hd, cport_id);
+ return;
+ }
+
ida_simple_remove(&hd->cport_id_map, cport_id);
}
struct gb_hd_driver {
size_t hd_priv_size;
+ int (*cport_allocate)(struct gb_host_device *hd, int cport_id,
+ unsigned long flags);
+ void (*cport_release)(struct gb_host_device *hd, u16 cport_id);
int (*cport_enable)(struct gb_host_device *hd, u16 cport_id);
int (*cport_disable)(struct gb_host_device *hd, u16 cport_id);
int (*message_send)(struct gb_host_device *hd, u16 dest_cport_id,
#define to_gb_host_device(d) container_of(d, struct gb_host_device, dev)
int gb_hd_cport_reserve(struct gb_host_device *hd, u16 cport_id);
-int gb_hd_cport_allocate(struct gb_host_device *hd, int cport_id);
+int gb_hd_cport_allocate(struct gb_host_device *hd, int cport_id,
+ unsigned long flags);
void gb_hd_cport_release(struct gb_host_device *hd, u16 cport_id);
struct gb_host_device *gb_hd_create(struct gb_hd_driver *driver,