Re: [PATCH v9] i2c: virtio: add a virtio i2c frontend driver

2021-03-22 Thread Jie Deng
On 2021/3/22 16:19, Michael S. Tsirkin wrote: On Mon, Mar 22, 2021 at 09:35:59PM +0800, Jie Deng wrote: diff --git a/include/uapi/linux/virtio_ids.h b/include/uapi/linux/virtio_ids.h index bc1c062..6ae32db 100644 --- a/include/uapi/linux/virtio_ids.h +++ b/include/uapi/linux/virtio_ids.h @@

Re: [PATCH v9] i2c: virtio: add a virtio i2c frontend driver

2021-03-22 Thread Michael S. Tsirkin
On Mon, Mar 22, 2021 at 09:35:59PM +0800, Jie Deng wrote: > diff --git a/include/uapi/linux/virtio_ids.h b/include/uapi/linux/virtio_ids.h > index bc1c062..6ae32db 100644 > --- a/include/uapi/linux/virtio_ids.h > +++ b/include/uapi/linux/virtio_ids.h > @@ -54,5 +54,6 @@ > #define VIRTIO_ID_FS

Re: [PATCH v9] i2c: virtio: add a virtio i2c frontend driver

2021-03-22 Thread Viresh Kumar
On 22-03-21, 15:53, Jie Deng wrote: > I think your optimization has problems... > > > > bool err_found = timeout; While at it, see if you want to rename this variable as well to something smaller, like "failed". I didn't touch it as it is a matter of personal choice, so leaving it to you..

Re: [PATCH v9] i2c: virtio: add a virtio i2c frontend driver

2021-03-22 Thread Viresh Kumar
On 22-03-21, 15:53, Jie Deng wrote: > On 2021/3/22 14:41, Viresh Kumar wrote: > I think your optimization has problems... > > > > bool err_found = timeout; > > > > for (i = 0; i < nr; i++) { > > /* Detach the ith request from the vq */ > > req =

Re: [PATCH v9] i2c: virtio: add a virtio i2c frontend driver

2021-03-22 Thread Jie Deng
On 2021/3/22 14:41, Viresh Kumar wrote: +/** + * struct virtio_i2c - virtio I2C data + * @vdev: virtio device for this controller + * @completion: completion of virtio I2C message + * @adap: I2C adapter for this controller + * @i2c_lock: lock for virtqueue processing Name mismatch here.

Re: [PATCH v9] i2c: virtio: add a virtio i2c frontend driver

2021-03-22 Thread Viresh Kumar
On 22-03-21, 21:35, Jie Deng wrote: > diff --git a/drivers/i2c/busses/i2c-virtio.c b/drivers/i2c/busses/i2c-virtio.c > new file mode 100644 > index 000..316986e > --- /dev/null > +++ b/drivers/i2c/busses/i2c-virtio.c > @@ -0,0 +1,286 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > +/* > +

[PATCH v9] i2c: virtio: add a virtio i2c frontend driver

2021-03-21 Thread Jie Deng
Add an I2C bus driver for virtio para-virtualization. The controller can be emulated by the backend driver in any device model software by following the virtio protocol. The device specification can be found on https://lists.oasis-open.org/archives/virtio-comment/202101/msg8.html. By