RE: [PATCH] mei: add timeout to send

From: Usyskin, Alexander
Date: Sun Nov 13 2022 - 02:05:46 EST


> > diff --git a/drivers/misc/mei/bus-fixup.c b/drivers/misc/mei/bus-fixup.c
> > index 71fbf0bc8453..3174cad8a5cc 100644
> > --- a/drivers/misc/mei/bus-fixup.c
> > +++ b/drivers/misc/mei/bus-fixup.c
> > @@ -128,7 +128,7 @@ static int mei_osver(struct mei_cl_device *cldev)
> > os_ver = (struct mei_os_ver *)fwcaps->data;
> > os_ver->os_type = OSTYPE_LINUX;
> >
> > - return __mei_cl_send(cldev->cl, buf, size, 0, mode);
> > + return __mei_cl_send(cldev->cl, buf, size, 0, mode, 0);
>
> Ick, adding another parameter to a function is not helpful here, what
> does 0 mean unless you look it up?
>
> > --- a/drivers/misc/mei/bus.c
> > +++ b/drivers/misc/mei/bus.c
> > @@ -29,11 +29,12 @@
> > * @length: buffer length
> > * @vtag: virtual tag
> > * @mode: sending mode
> > + * @timeout: send timeout for blocking writes, 0 for infinite timeout
>
> What units are these in? Jiffies? seconds? hours? Don't make us
> guess :(
>

Sure, will add mention of msec here.

> Why not write a function that is mei_cl_send_timeout() that has the new
> option? That way it's obvious that the other ones are blocking, right?
>

Yes, renaming extended __mei_cl_send with __mei_cl_send_timeout and
making __mei_cl_send as wrapper to __mei_cl_send_timeout will make code lot cleaner
and fix the not understandable 0 from the first comment.
Thanks for a good tip!

> thanks,
>
> greg k-h


--
Thanks,
Sasha