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

From: Jie Deng
Date: Sun Sep 13 2020 - 23:43:34 EST



On 2020/9/14 10:46, Jason Wang wrote:

+
+#define VIRTIO_I2C_MSG_OK    0
+#define VIRTIO_I2C_MSG_ERR    1
+
+/**
+ * struct virtio_i2c_hdr - the virtio I2C message header structure
+ * @addr: i2c_msg addr, the slave address
+ * @flags: i2c_msg flags
+ * @len: i2c_msg len
+ */
+struct virtio_i2c_hdr {
+    __le16 addr;
+    __le16 flags;
+    __le16 len;
+};


As said in v1, this should belong to uapi.

That's right. I missed this.
I will move these things to uapi. Thanks.



+
+/**
+ * struct virtio_i2c_msg - the virtio I2C message structure
+ * @hdr: the virtio I2C message header
+ * @buf: virtio I2C message data buffer
+ * @status: the processing result from the backend
+ */
+struct virtio_i2c_msg {
+    struct virtio_i2c_hdr hdr;
+    u8 *buf;
+    u8 status;
+};


I'm not quite sure this is the best layout.

E.g virtio scsi differ in buffer out of out one:

structvirtio_scsi_req_cmd{
...
u8 dataout[];
...
u8 datain[];

}

And I would like to have a look at the spec patch.

Thanks

Sure. I will send the v3 along with the spec patch.
Thanks.