Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752420AbdFMPn4 (ORCPT ); Tue, 13 Jun 2017 11:43:56 -0400 Received: from mail-ua0-f180.google.com ([209.85.217.180]:34736 "EHLO mail-ua0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750899AbdFMPny (ORCPT ); Tue, 13 Jun 2017 11:43:54 -0400 MIME-Version: 1.0 In-Reply-To: <20170613095618.GB29589@mail.corp.redhat.com> References: <1497345926-3262-1-git-send-email-binoy.jayan@linaro.org> <20170613095618.GB29589@mail.corp.redhat.com> From: David Herrmann Date: Tue, 13 Jun 2017 17:43:52 +0200 Message-ID: Subject: Re: [PATCH v2] HID: Replace semaphore driver_lock with mutex To: Benjamin Tissoires Cc: Arnd Bergmann , Binoy Jayan , "open list:HID CORE LAYER" , Linux Kernel Mailing List , Rajendra , Mark Brown , Jiri Kosina , David Herrmann , Andrew de los Reyes Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 955 Lines: 22 Hi On Tue, Jun 13, 2017 at 11:56 AM, Benjamin Tissoires 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 Thanks David