Re: [PATCH] i2c: virtio: Add support for zero-length requests

From: Arnd Bergmann
Date: Fri Oct 22 2021 - 03:09:14 EST


On Fri, Oct 22, 2021 at 8:58 AM Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
> On 22-10-21, 14:51, Jie Deng wrote:
> > > + if (!virtio_has_feature(vdev, VIRTIO_I2C_F_ZERO_LENGTH_REQUEST)) {
> > > + dev_err(&vdev->dev, "Zero-length request feature is mandatory\n");
> > > + return -EINVAL;
> >
> >
> > It might be better to return -EOPNOTSUPP ?
>
> Maybe that or one of these:
>
> #define EBADE 52 /* Invalid exchange */
> #define EPROTO 71 /* Protocol error */
> #define EPFNOSUPPORT 96 /* Protocol family not supported */
> #define ECONNREFUSED 111 /* Connection refused */
>
> Arnd, any suggestions ? This is about the mandatory feature not being offered by
> the device.

These are mostly used for network operations, I'd stick with either EINVAL
or ENXIO in this case.

Arnd