[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <05cc9484-f97b-0533-64fe-ff917c6b87ee@intel.com>
Date: Wed, 30 Jun 2021 14:45:55 +0800
From: Jie Deng <jie.deng@...el.com>
To: Wolfram Sang <wsa@...nel.org>, linux-i2c@...r.kernel.org,
virtualization@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org, mst@...hat.com, jasowang@...hat.com,
andriy.shevchenko@...ux.intel.com, conghui.chen@...el.com,
arnd@...db.de, kblaiech@...lanox.com,
jarkko.nikula@...ux.intel.com, Sergey.Semin@...kalelectronics.ru,
rppt@...nel.org, loic.poulain@...aro.org, tali.perry1@...il.com,
u.kleine-koenig@...gutronix.de, bjorn.andersson@...aro.org,
yu1.wang@...el.com, shuo.a.liu@...el.com, viresh.kumar@...aro.org,
stefanha@...hat.com, pbonzini@...hat.com
Subject: Re: [PATCH v10] i2c: virtio: add a virtio i2c frontend driver
On 2021/6/29 18:07, Wolfram Sang wrote:
> Hi,
>
> so some minor comments left:
>
>> + if (!msgs[i].len)
>> + break;
> I hope this can extended in the future to allow zero-length messages. If
> this is impossible we need to set an adapter quirk instead.
Yes, we can support it by removing this check and call it zero-length
request.
It don't think it will break anything.
>
>> + err = virtqueue_add_sgs(vq, sgs, outcnt, incnt, &reqs[i], GFP_KERNEL);
>> + if (err < 0) {
>> + pr_err("failed to add msg[%d] to virtqueue.\n", i);
> Is it really helpful for the user to know that msg5 failed? We don't
> even say which transfer.
OK. I will remove this print.
>> +static u32 virtio_i2c_func(struct i2c_adapter *adap)
>> +{
>> + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
> You are not emulating I2C_FUNC_SMBUS_QUICK, so you need to mask it out.
I will remove the check of zero-length message.
>
>> + snprintf(vi->adap.name, sizeof(vi->adap.name), "Virtio I2C Adapter");
> Is there something to add so you can distinguish multiple instances?
> Most people want that.
I find the I2C core will set a device name "i2c-%d" for this purpose, right?
I think this name can be used to distinguish the adapter types while
"i2c-%d" can be used to
distinguish instances. Does it make sense ?
>> + vi->adap.class = I2C_CLASS_DEPRECATED;
>> + vi->adap.algo = &virtio_algorithm;
>> + vi->adap.dev.parent = &vdev->dev;
>> + vi->adap.timeout = HZ / 10;
> Why so short? HZ is the kinda default value.
Ah... I didn't know the I2C core had already set a default value.
I will remove this line to use the default one.
>
>> + i2c_set_adapdata(&vi->adap, vi);
>> +
>> + /* Setup ACPI node for controlled devices which will be probed through ACPI */
>> + ACPI_COMPANION_SET(&vi->adap.dev, ACPI_COMPANION(pdev));
>> +
>> + ret = i2c_add_adapter(&vi->adap);
>> + if (ret) {
>> + virtio_i2c_del_vqs(vdev);
>> + dev_err(&vdev->dev, "failed to add virtio-i2c adapter.\n");
> Won't the driver core print that for us?
Yes. It seems unnecessary. Will remove it.
>
>> + }
>> +
>> + return ret;
>> +}
>> +
>> +/* The bit 0 of the @virtio_i2c_out_hdr.@...gs, used to group the requests */
>> +#define VIRTIO_I2C_FLAGS_FAIL_NEXT 0x00000001
> BIT(0)?
That's better. Thank you.
>
> Happy hacking,
>
> Wolfram
>
Powered by blists - more mailing lists