Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1664968

Re: [PATCH v2] HID: Replace semaphore driver_lock with mutex

From David Herrmann <dh.herrmann@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] HID: Replace semaphore driver_lock with mutex
Date 2017-06-13 17:50 +0200
Message-ID <tRWeR-1ld-5@gated-at.bofh.it> (permalink)
References <tRQj8-6bD-19@gated-at.bofh.it> <tRQCv-6hR-29@gated-at.bofh.it> <tRQMb-6li-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi

On Tue, Jun 13, 2017 at 11:56 AM, Benjamin Tissoires
<benjamin.tissoires@redhat.com> wrote:
>> > -       struct semaphore driver_lock;                                   /* protects the current driver, except during input */
>> > +       struct mutex driver_lock;                                       /* protects the current driver, except during input */
>> >         struct semaphore driver_input_lock;                             /* protects the current driver */
>
> Unless I am mistaken, this one could also be converted to a mutex (in a
> separate patch, of course).

The mutex code clearly states mutex_trylock() must not be used in
interrupt context (see kernel/locking/mutex.c), hence we used a
semaphore here. Unless the mutex code is changed to allow this, we
cannot switch away from semaphores.

Otherwise, this patch (given Benjamin's comments are addressed) looks good:

Reviewed-by: David Herrmann <dh.herrmann@gmail.com>

Thanks
David

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] HID: Replace semaphore driver_lock with mutex Binoy Jayan <binoy.jayan@linaro.org> - 2017-06-13 11:30 +0200
  Re: [PATCH v2] HID: Replace semaphore driver_lock with mutex Arnd Bergmann <arnd@arndb.de> - 2017-06-13 11:50 +0200
    Re: [PATCH v2] HID: Replace semaphore driver_lock with mutex Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2017-06-13 12:00 +0200
      Re: [PATCH v2] HID: Replace semaphore driver_lock with mutex Binoy Jayan <binoy.jayan@linaro.org> - 2017-06-13 12:10 +0200
        Re: [PATCH v2] HID: Replace semaphore driver_lock with mutex Arnd Bergmann <arnd@arndb.de> - 2017-06-13 22:10 +0200
      Re: [PATCH v2] HID: Replace semaphore driver_lock with mutex David Herrmann <dh.herrmann@gmail.com> - 2017-06-13 17:50 +0200
        Re: [PATCH v2] HID: Replace semaphore driver_lock with mutex Arnd Bergmann <arnd@arndb.de> - 2017-06-13 22:30 +0200
          Re: [PATCH v2] HID: Replace semaphore driver_lock with mutex Binoy Jayan <binoy.jayan@linaro.org> - 2017-06-14 07:30 +0200
            Re: [PATCH v2] HID: Replace semaphore driver_lock with mutex Arnd Bergmann <arnd@arndb.de> - 2017-06-14 09:30 +0200
              Re: [PATCH v2] HID: Replace semaphore driver_lock with mutex David Herrmann <dh.herrmann@gmail.com> - 2017-06-14 09:50 +0200
                Re: [PATCH v2] HID: Replace semaphore driver_lock with mutex Arnd Bergmann <arnd@arndb.de> - 2017-06-14 14:00 +0200
                Re: [PATCH v2] HID: Replace semaphore driver_lock with mutex David Herrmann <dh.herrmann@gmail.com> - 2017-06-19 12:30 +0200
    Re: [PATCH v2] HID: Replace semaphore driver_lock with mutex Binoy Jayan <binoy.jayan@linaro.org> - 2017-06-13 12:20 +0200

csiph-web