/* We need to take a lock in atomic context */
spinlock_t lock;
- struct list_head list;
- struct list_head list_op_async;
wait_queue_head_t wq;
};
struct kfifo kfifo_lat;
struct mutex mutex;
struct task_struct *task;
- struct list_head entry;
struct device *dev;
wait_queue_head_t wq;
wait_queue_head_t wq_completion;
.release = single_release,
};
-static int gb_loopback_bus_id_compare(void *priv, struct list_head *lha,
- struct list_head *lhb)
-{
- struct gb_loopback *a = list_entry(lha, struct gb_loopback, entry);
- struct gb_loopback *b = list_entry(lhb, struct gb_loopback, entry);
- struct gb_connection *ca = a->connection;
- struct gb_connection *cb = b->connection;
-
- if (ca->bundle->intf->interface_id < cb->bundle->intf->interface_id)
- return -1;
- if (cb->bundle->intf->interface_id < ca->bundle->intf->interface_id)
- return 1;
- if (ca->bundle->id < cb->bundle->id)
- return -1;
- if (cb->bundle->id < ca->bundle->id)
- return 1;
- if (ca->intf_cport_id < cb->intf_cport_id)
- return -1;
- else if (cb->intf_cport_id < ca->intf_cport_id)
- return 1;
-
- return 0;
-}
-
-static void gb_loopback_insert_id(struct gb_loopback *gb)
-{
- /* perform an insertion sort */
- list_add_tail(&gb->entry, &gb_dev.list);
- list_sort(NULL, &gb_dev.list, gb_loopback_bus_id_compare);
-}
-
#define DEBUGFS_NAMELEN 32
static int gb_loopback_probe(struct gb_bundle *bundle,
}
spin_lock_irqsave(&gb_dev.lock, flags);
- gb_loopback_insert_id(gb);
gb_dev.count++;
spin_unlock_irqrestore(&gb_dev.lock, flags);
spin_lock_irqsave(&gb_dev.lock, flags);
gb_dev.count--;
- list_del(&gb->entry);
spin_unlock_irqrestore(&gb_dev.lock, flags);
device_unregister(gb->dev);
{
int retval;
- INIT_LIST_HEAD(&gb_dev.list);
- INIT_LIST_HEAD(&gb_dev.list_op_async);
spin_lock_init(&gb_dev.lock);
gb_dev.root = debugfs_create_dir("gb_loopback", NULL);