struct rx {
struct delayed_work dwork;
struct list_head list;
- struct mutex list_mutex;
bool int_disabled;
unsigned int delay;
} rx;
if (!dev->polling_mode)
disable_irq(dev->client->irq);
cancel_delayed_work_sync(&dev->rx.dwork);
- mutex_lock(&dev->rx.list_mutex);
list_add_tail(&mbo->list, &dev->rx.list);
- mutex_unlock(&dev->rx.list_mutex);
if (dev->rx.int_disabled || dev->polling_mode)
pending_rx_work(&dev->rx.dwork.work);
if (!dev->polling_mode)
free_irq(dev->client->irq, dev);
cancel_delayed_work_sync(&dev->rx.dwork);
- mutex_lock(&dev->rx.list_mutex);
while (!list_empty(&dev->rx.list)) {
mbo = list_first_mbo(&dev->rx.list);
list_del(&mbo->list);
- mutex_unlock(&dev->rx.list_mutex);
mbo->processed_length = 0;
mbo->status = MBO_E_CLOSE;
mbo->complete(mbo);
-
- mutex_lock(&dev->rx.list_mutex);
}
- mutex_unlock(&dev->rx.list_mutex);
}
return 0;
return;
}
- mutex_lock(&dev->rx.list_mutex);
mbo = list_first_mbo(&dev->rx.list);
list_del(&mbo->list);
- mutex_unlock(&dev->rx.list_mutex);
mbo->processed_length = min(data_size, mbo->buffer_length);
memcpy(mbo->virt_address, msg, mbo->processed_length);
static void pending_rx_work(struct work_struct *work)
{
struct hdm_i2c *dev = container_of(work, struct hdm_i2c, rx.dwork.work);
- bool empty;
- mutex_lock(&dev->rx.list_mutex);
- empty = list_empty(&dev->rx.list);
- mutex_unlock(&dev->rx.list_mutex);
- if (empty)
+ if (list_empty(&dev->rx.list))
return;
do_rx_work(dev);
dev->most_iface.poison_channel = poison_channel;
INIT_LIST_HEAD(&dev->rx.list);
- mutex_init(&dev->rx.list_mutex);
INIT_DELAYED_WORK(&dev->rx.dwork, pending_rx_work);