search for: reinit_complet

Displaying 20 results from an estimated 29 matches for "reinit_complet".

2020 Aug 11
0
[PATCH v2] virtio-rng: return available data with O_NONBLOCK
...gt; And moreover, if it was reused it would be always the beginning. > > Ok. > >> >>>> + if (len) >>>> + return len; >>>> + } >>>> + >>>> if (!vi->busy) { >>>> vi->busy = true; >>>> reinit_completion(&vi->have_data); >>>> >> >> Why don't you modify only the wait case? >> >> Something like: >> >> if (!wait && !completion_done(&vi->have_data)) { >> return 0; >> } >> >> then at the end y...
2020 Sep 14
2
[PATCH v2] i2c: virtio: add a virtio i2c frontend driver
...0-09-11 151 > 0a54ec77196674 Jie Deng 2020-09-11 152 kfree(vmsg->buf); > 0a54ec77196674 Jie Deng 2020-09-11 153 vmsg->buf = NULL; > 0a54ec77196674 Jie Deng 2020-09-11 154 } > 0a54ec77196674 Jie Deng 2020-09-11 155 > 0a54ec77196674 Jie Deng 2020-09-11 156 reinit_completion(&vi->completion); > 0a54ec77196674 Jie Deng 2020-09-11 157 } > 0a54ec77196674 Jie Deng 2020-09-11 158 > 0a54ec77196674 Jie Deng 2020-09-11 159 mutex_unlock(&vi->i2c_lock); > 0a54ec77196674 Jie Deng 2020-09-11 @160 kfree(vmsg->buf); >...
2020 Sep 14
2
[PATCH v2] i2c: virtio: add a virtio i2c frontend driver
...0-09-11 151 > 0a54ec77196674 Jie Deng 2020-09-11 152 kfree(vmsg->buf); > 0a54ec77196674 Jie Deng 2020-09-11 153 vmsg->buf = NULL; > 0a54ec77196674 Jie Deng 2020-09-11 154 } > 0a54ec77196674 Jie Deng 2020-09-11 155 > 0a54ec77196674 Jie Deng 2020-09-11 156 reinit_completion(&vi->completion); > 0a54ec77196674 Jie Deng 2020-09-11 157 } > 0a54ec77196674 Jie Deng 2020-09-11 158 > 0a54ec77196674 Jie Deng 2020-09-11 159 mutex_unlock(&vi->i2c_lock); > 0a54ec77196674 Jie Deng 2020-09-11 @160 kfree(vmsg->buf); >...
2019 Oct 30
0
[PATCH 3/3] virtiofs: Use completions while waiting for queue to be drained
...while (1) { - spin_lock(&fsvq->lock); - if (!fsvq->in_flight) { - spin_unlock(&fsvq->lock); - break; - } + spin_lock(&fsvq->lock); + if (fsvq->in_flight) { + /* We are holding virtio_fs_mutex. There should not be any + * waiters waiting for completion. + */ + reinit_completion(&fsvq->in_flight_zero); + spin_unlock(&fsvq->lock); + wait_for_completion(&fsvq->in_flight_zero); + } else { spin_unlock(&fsvq->lock); - /* TODO use completion instead of timeout */ - usleep_range(1000, 2000); } flush_work(&fsvq->done_work); flus...
2020 Sep 03
0
[PATCH] i2c: virtio: add a virtio i2c frontend driver
...> + ret = i; > + goto err_unlock_free; > + } > + if ((vmsg_i->hdr.flags & I2C_M_RD) && vmsg_i->hdr.len) > + memcpy(msgs[i].buf, vmsg_i->buf, vmsg_i->hdr.len); > + > + kfree(vmsg_i->buf); > + vmsg_i->buf = NULL; > + } > + reinit_completion(&vi->completion); > + } > + if (i == num) > + ret = num; And this conditional seems a dup of the for-loop successfully iterating over entire queue. > +err_unlock_free: Redundant. > + mutex_unlock(&vi->i2c_lock); > + kfree(vmsg_o->buf); > + kfree(vmsg_o...
2020 Sep 11
6
[PATCH v2] i2c: virtio: add a virtio i2c frontend driver
..."msg[%d]: addr=0x%x error=%d.\n", + i, le16_to_cpu(vmsg->hdr.addr), vmsg->status); + break; + } + if ((msgs[i].flags & I2C_M_RD) && msgs[i].len) + memcpy(msgs[i].buf, vmsg->buf, msgs[i].len); + + kfree(vmsg->buf); + vmsg->buf = NULL; + } + + reinit_completion(&vi->completion); + } + + mutex_unlock(&vi->i2c_lock); + kfree(vmsg->buf); + return ((ret < 0) ? ret : i); +} + +static void virtio_i2c_del_vqs(struct virtio_device *vdev) +{ + vdev->config->reset(vdev); + vdev->config->del_vqs(vdev); +} + +static int virtio_i2c_s...
2020 Sep 11
6
[PATCH v2] i2c: virtio: add a virtio i2c frontend driver
..."msg[%d]: addr=0x%x error=%d.\n", + i, le16_to_cpu(vmsg->hdr.addr), vmsg->status); + break; + } + if ((msgs[i].flags & I2C_M_RD) && msgs[i].len) + memcpy(msgs[i].buf, vmsg->buf, msgs[i].len); + + kfree(vmsg->buf); + vmsg->buf = NULL; + } + + reinit_completion(&vi->completion); + } + + mutex_unlock(&vi->i2c_lock); + kfree(vmsg->buf); + return ((ret < 0) ? ret : i); +} + +static void virtio_i2c_del_vqs(struct virtio_device *vdev) +{ + vdev->config->reset(vdev); + vdev->config->del_vqs(vdev); +} + +static int virtio_i2c_s...
2020 Sep 03
9
[PATCH] i2c: virtio: add a virtio i2c frontend driver
...+ i, vmsg_i->hdr.addr, vmsg_i->status); + ret = i; + goto err_unlock_free; + } + if ((vmsg_i->hdr.flags & I2C_M_RD) && vmsg_i->hdr.len) + memcpy(msgs[i].buf, vmsg_i->buf, vmsg_i->hdr.len); + + kfree(vmsg_i->buf); + vmsg_i->buf = NULL; + } + reinit_completion(&vi->completion); + } + if (i == num) + ret = num; + +err_unlock_free: + mutex_unlock(&vi->i2c_lock); + kfree(vmsg_o->buf); + kfree(vmsg_o); + return ret; +} + +static void virtio_i2c_del_vqs(struct virtio_device *vdev) +{ + vdev->config->reset(vdev); + vdev->config-&g...
2020 Sep 03
9
[PATCH] i2c: virtio: add a virtio i2c frontend driver
...+ i, vmsg_i->hdr.addr, vmsg_i->status); + ret = i; + goto err_unlock_free; + } + if ((vmsg_i->hdr.flags & I2C_M_RD) && vmsg_i->hdr.len) + memcpy(msgs[i].buf, vmsg_i->buf, vmsg_i->hdr.len); + + kfree(vmsg_i->buf); + vmsg_i->buf = NULL; + } + reinit_completion(&vi->completion); + } + if (i == num) + ret = num; + +err_unlock_free: + mutex_unlock(&vi->i2c_lock); + kfree(vmsg_o->buf); + kfree(vmsg_o); + return ret; +} + +static void virtio_i2c_del_vqs(struct virtio_device *vdev) +{ + vdev->config->reset(vdev); + vdev->config-&g...
2020 Aug 11
2
[PATCH v2] virtio-rng: return available data with O_NONBLOCK
...>>> >>> Ok. >>> >>>>>> + if (len) >>>>>> + return len; >>>>>> + } >>>>>> + >>>>>> if (!vi->busy) { >>>>>> vi->busy = true; >>>>>> reinit_completion(&vi->have_data); >>>>>> >>>> >>>> Why don't you modify only the wait case? >>>> >>>> Something like: >>>> >>>> if (!wait && !completion_done(&vi->have_data)) { >>>>...
2020 Aug 11
2
[PATCH v2] virtio-rng: return available data with O_NONBLOCK
...>>> >>> Ok. >>> >>>>>> + if (len) >>>>>> + return len; >>>>>> + } >>>>>> + >>>>>> if (!vi->busy) { >>>>>> vi->busy = true; >>>>>> reinit_completion(&vi->have_data); >>>>>> >>>> >>>> Why don't you modify only the wait case? >>>> >>>> Something like: >>>> >>>> if (!wait && !completion_done(&vi->have_data)) { >>>>...
2020 Aug 11
0
[PATCH v2] virtio-rng: return available data with O_NONBLOCK
...;data_avail -= len; I wonder what purpose does this line serve: busy is false which basically means data_avail is invalid, right? A following non blocking call will not enter here. > + if (len) > + return len; > + } > + > if (!vi->busy) { > vi->busy = true; > reinit_completion(&vi->have_data); > -- > 2.26.2
2020 Sep 14
0
[PATCH v2] i2c: virtio: add a virtio i2c frontend driver
...54ec77196674 Jie Deng 2020-09-11 151 0a54ec77196674 Jie Deng 2020-09-11 152 kfree(vmsg->buf); 0a54ec77196674 Jie Deng 2020-09-11 153 vmsg->buf = NULL; 0a54ec77196674 Jie Deng 2020-09-11 154 } 0a54ec77196674 Jie Deng 2020-09-11 155 0a54ec77196674 Jie Deng 2020-09-11 156 reinit_completion(&vi->completion); 0a54ec77196674 Jie Deng 2020-09-11 157 } 0a54ec77196674 Jie Deng 2020-09-11 158 0a54ec77196674 Jie Deng 2020-09-11 159 mutex_unlock(&vi->i2c_lock); 0a54ec77196674 Jie Deng 2020-09-11 @160 kfree(vmsg->buf);...
2020 Aug 11
0
[PATCH v2] virtio-rng: return available data with O_NONBLOCK
...o false, the buffer will be reused. and it is always overwritten by virtqueue_get_buf(). And moreover, if it was reused it would be always the beginning. >> + if (len) >> + return len; >> + } >> + >> if (!vi->busy) { >> vi->busy = true; >> reinit_completion(&vi->have_data); >> > Why don't you modify only the wait case? Something like: if (!wait && !completion_done(&vi->have_data)) { return 0; } then at the end you can do "return min(size, vi->data_avail);". Thanks, Laurent
2020 Sep 14
0
[PATCH v2] i2c: virtio: add a virtio i2c frontend driver
...0a54ec77196674 Jie Deng 2020-09-11 152 kfree(vmsg->buf); > > 0a54ec77196674 Jie Deng 2020-09-11 153 vmsg->buf = NULL; > > 0a54ec77196674 Jie Deng 2020-09-11 154 } > > 0a54ec77196674 Jie Deng 2020-09-11 155 > > 0a54ec77196674 Jie Deng 2020-09-11 156 reinit_completion(&vi->completion); > > 0a54ec77196674 Jie Deng 2020-09-11 157 } > > 0a54ec77196674 Jie Deng 2020-09-11 158 > > 0a54ec77196674 Jie Deng 2020-09-11 159 mutex_unlock(&vi->i2c_lock); > > 0a54ec77196674 Jie Deng 2020-09-11 @160 kfree(vmsg->buf); >...
2020 Sep 22
3
[PATCH v3] i2c: virtio: add a virtio i2c frontend driver
...dev_err(&adap->dev, "msg[%d]: addr=0x%x error=%d.\n", + i, msgs[i].addr, vmsg->status); + break; + } + + if ((msgs[i].flags & I2C_M_RD) && msgs[i].len) + memcpy(msgs[i].buf, vmsg->buf, msgs[i].len); + + kfree(vmsg->buf); + vmsg->buf = NULL; + + reinit_completion(&vi->completion); + } + + mutex_unlock(&vi->i2c_lock); + kfree(vi->vmsg.buf); + vi->vmsg.buf = NULL; + return ((ret < 0) ? ret : i); +} + +static void virtio_i2c_del_vqs(struct virtio_device *vdev) +{ + vdev->config->reset(vdev); + vdev->config->del_vqs(vdev);...
2020 Sep 22
3
[PATCH v3] i2c: virtio: add a virtio i2c frontend driver
...dev_err(&adap->dev, "msg[%d]: addr=0x%x error=%d.\n", + i, msgs[i].addr, vmsg->status); + break; + } + + if ((msgs[i].flags & I2C_M_RD) && msgs[i].len) + memcpy(msgs[i].buf, vmsg->buf, msgs[i].len); + + kfree(vmsg->buf); + vmsg->buf = NULL; + + reinit_completion(&vi->completion); + } + + mutex_unlock(&vi->i2c_lock); + kfree(vi->vmsg.buf); + vi->vmsg.buf = NULL; + return ((ret < 0) ? ret : i); +} + +static void virtio_i2c_del_vqs(struct virtio_device *vdev) +{ + vdev->config->reset(vdev); + vdev->config->del_vqs(vdev);...
2023 Jan 20
0
[PATCH 1/2] virtio-rng: implement entropy leak feature
...vi->data_idx = 0; > > complete(&vi->have_data); > + > +unlock: > + spin_unlock_irqrestore(&vi->lock, flags); > } > > static void request_entropy(struct virtrng_info *vi) > { > struct scatterlist sg; > + unsigned long flags; > > reinit_completion(&vi->have_data); > vi->data_avail = 0; > @@ -57,10 +197,12 @@ static void request_entropy(struct virtrng_info *vi) > > sg_init_one(&sg, vi->data, sizeof(vi->data)); > > + spin_lock_irqsave(&vi->lock, flags); > /* There should always be ro...
2020 Sep 03
0
[PATCH] i2c: virtio: add a virtio i2c frontend driver
...> + ret = i; > + goto err_unlock_free; > + } > + if ((vmsg_i->hdr.flags & I2C_M_RD) && vmsg_i->hdr.len) > + memcpy(msgs[i].buf, vmsg_i->buf, vmsg_i->hdr.len); > + > + kfree(vmsg_i->buf); > + vmsg_i->buf = NULL; > + } > + reinit_completion(&vi->completion); > + } > + if (i == num) > + ret = num; > + > +err_unlock_free: > + mutex_unlock(&vi->i2c_lock); > + kfree(vmsg_o->buf); > + kfree(vmsg_o); > + return ret; > +} > + > +static void virtio_i2c_del_vqs(struct virtio_device *vdev...
2020 Sep 03
0
[PATCH] i2c: virtio: add a virtio i2c frontend driver
...> + ret = i; > + goto err_unlock_free; > + } > + if ((vmsg_i->hdr.flags & I2C_M_RD) && vmsg_i->hdr.len) > + memcpy(msgs[i].buf, vmsg_i->buf, vmsg_i->hdr.len); > + > + kfree(vmsg_i->buf); > + vmsg_i->buf = NULL; > + } > + reinit_completion(&vi->completion); > + } > + if (i == num) > + ret = num; > + > +err_unlock_free: > + mutex_unlock(&vi->i2c_lock); > + kfree(vmsg_o->buf); > + kfree(vmsg_o); > + return ret; > +} > + > +static void virtio_i2c_del_vqs(struct virtio_device *vdev...