semaphore driver_input_lock and device removal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Jiri, hello Benjamin,

I'm working on making struct bus_type::remove return void (instead of
int), see for example commit 0d519e0d52ee7c532d4018b90cd0b042d374c06d
for the idea and motivation.

Looking at the function hid_device_remove() there is an error path that
makes the function return -EINTR if taking the semaphore
&hdev->driver_input_lock is interrupted.

If this exit path is taken the hid remove callback isn't called but the
driver core considers the device unbound and frees resources which might
then run into problems because the driver might continue to use these
resources.

I tried to understand how this semaphore is to be used, but I'm unsure
if if missed something. Can this semaphore just be converted to a mutex?
Or is using down() here instead the right thing to do even though down()
is deprecated according to the comment before its implementation?

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux