Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965780AbbDXQZU (ORCPT ); Fri, 24 Apr 2015 12:25:20 -0400 Received: from shards.monkeyblade.net ([149.20.54.216]:51433 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755021AbbDXQZQ (ORCPT ); Fri, 24 Apr 2015 12:25:16 -0400 Date: Fri, 24 Apr 2015 12:25:14 -0400 (EDT) Message-Id: <20150424.122514.1993790707568222542.davem@davemloft.net> To: f.fainelli@gmail.com Cc: vivien.didelot@savoirfairelinux.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com Subject: Re: [PATCH] net: mdio-gpio: support access that may sleep From: David Miller In-Reply-To: <553A6D2B.20901@gmail.com> References: <553A67B2.3040400@gmail.com> <20150424.120142.515098054679955418.davem@davemloft.net> <553A6D2B.20901@gmail.com> X-Mailer: Mew version 6.6 on Emacs 24.4 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Fri, 24 Apr 2015 09:25:15 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2028 Lines: 49 From: Florian Fainelli Date: Fri, 24 Apr 2015 09:19:55 -0700 > On 24/04/15 09:01, David Miller wrote: >> From: Florian Fainelli >> Date: Fri, 24 Apr 2015 08:56:34 -0700 >> >>> On 24/04/15 08:04, David Miller wrote: >>>> From: Vivien Didelot >>>> Date: Wed, 22 Apr 2015 13:06:54 -0400 >>>> >>>>> Some systems using mdio-gpio may use gpio on message based busses, which >>>>> require sleeping (e.g. gpio from an I2C I/O expander). >>>>> >>>>> Since this driver does not use IRQ handler, it is safe to use the >>>>> _cansleep suffixed gpio accessors. >>>>> >>>>> Signed-off-by: Vivien Didelot >>>> >>>> Since this is down underneath the layer of an MII bus, you cannot >>>> universally say that these routines are always called in a sleepable >>>> context. >>>> >>>> The PHY layer, and the driver itself above that, might call these >>>> routines from timers, interruptes etc. >>> >>> The PHY library calls these routines from its state machine workqueue >>> for that reason, or from process context (when invoked via ethtool >>> ioctl). The only special case is phy_mac_interrupt() which is callable >>> from interrupt context, but schedules the state machine workqueue anyway >>> to circumvent the "in-interrupt" context. >>> >>> If we were not doing that, there would be a number of things broken, for >>> instance the per-MDIO bus mutex would not protect us from anything. >> >> Does the link state polling timer use a workqueue in this manner as >> well? > > Yes, the state machine re-schedules its own delayed workqueue at the end > of its state processing, no timer/hrtimer is used. Ok, thanks for explaining. I'm apply this patch, therefore, thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/