Re: [PATCH v2] USB: serial: xr: Add TIOCGRS485 and TIOCSRS485 ioctls

From: Oliver Neukum
Date: Mon Mar 13 2023 - 07:27:28 EST




On 13.03.23 11:47, Jarkko Sonninen wrote:
    Hello,

It uses only one flag from the struct from user. Would it be better to store only that to state ?

Do I need locking at all in that case ?

The whole struct is stored just in case, if someone would implement other functionality later.

Well,

1. would you be happy if you were the one to implement additional
features and found that you'd have to reinvent locking?

2. That would mean discarding the values given for delay_rts_before_send
and delay_rts_after_send. That wouldn't be nice.

It seems to me that all our algorithmic complexity goes away
if you just turn "lock" into a mutex and just take it.

Regards
Oliver