Input: yealink - simplify locking in sysfs attribute handling
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 10 Jul 2024 23:48:54 +0000 (16:48 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 13 Jul 2024 00:15:45 +0000 (17:15 -0700)
commitf3efefb6fdcce604413135bd8d4c5568e53a1f13
tree666d25a51d3e5b38ce651cb15dd8e280914b6059
parent295b89a631fe2935d268a95a9dea284992a7a27d
Input: yealink - simplify locking in sysfs attribute handling

The locking rules in the driver came from era when sysfs attributes
could live past the point of time when device would be unbound from
the driver, and so used module-global semaphore (potentially shared
between multiple yealink devices). Thankfully these times are long
gone and attributes will not be accessible once they are removed.

Simplify the logic by moving to per-device mutex, stop checking if
there is driver data instance attached to the interface, and use
guard notation to acquire the mutex.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20240710234855.311366-2-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/misc/yealink.c