From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751181AbdEBNTC (ORCPT ); Tue, 2 May 2017 09:19:02 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:34246 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750936AbdEBNTA (ORCPT ); Tue, 2 May 2017 09:19:00 -0400 Date: Tue, 2 May 2017 15:18:54 +0200 From: Johan Hovold To: Rob Herring Cc: Johan Hovold , Stefan Wahren , Greg Kroah-Hartman , Jiri Slaby , Sebastian Reichel , Guenter Roeck , Andy Shevchenko , Andrey Smirnov , "linux-serial@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] serdev: Restore serdev_device_write_buf for atomic context Message-ID: <20170502131854.GA17710@localhost> References: <1493380041-14710-1-git-send-email-stefan.wahren@i2se.com> <20170502090638.GB2973@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 02, 2017 at 07:41:34AM -0500, Rob Herring wrote: > On Tue, May 2, 2017 at 4:06 AM, Johan Hovold wrote: > > On Fri, Apr 28, 2017 at 01:47:21PM +0200, Stefan Wahren wrote: > >> Starting with commit 6fe729c4bdae ("serdev: Add serdev_device_write > >> subroutine") the function serdev_device_write_buf cannot be used in > >> atomic context anymore (mutex_lock is sleeping). So restore the old > >> behavior. > > > > Yeah, preventing use in atomic context seems unnecessary, although any > > clients writing must now deal with serialisation themselves (as before, > > and as they should). > > We could just remove the mutex for serdev_device_write and always make > the client responsible for serialization. That sounds reasonable. > > Calling wait_for_completion in the non-blocking case was also needlessly > > inefficient. > > It won't be called because count should be 0. That's not guaranteed; count would be nonzero whenever the tty driver does not accept the full buffer and then we'd currently end up calling wait_for_completion_timeout() with a zero-timeout instead of just returning immediately. Johan