From patchwork Tue Nov 9 21:54:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 70579 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id BACF3B711E for ; Wed, 10 Nov 2010 08:55:54 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755558Ab0KIVzX (ORCPT ); Tue, 9 Nov 2010 16:55:23 -0500 Received: from ogre.sisk.pl ([217.79.144.158]:35928 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754237Ab0KIVzV (ORCPT ); Tue, 9 Nov 2010 16:55:21 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by ogre.sisk.pl (Postfix) with ESMTP id 48A0219C307; Tue, 9 Nov 2010 22:44:20 +0100 (CET) Received: from ogre.sisk.pl ([127.0.0.1]) by localhost (ogre.sisk.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 28072-05; Tue, 9 Nov 2010 22:43:59 +0100 (CET) Received: from ferrari.rjw.lan (220-bem-13.acn.waw.pl [82.210.184.220]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ogre.sisk.pl (Postfix) with ESMTP id 1EE9819C012; Tue, 9 Nov 2010 22:43:59 +0100 (CET) From: "Rafael J. Wysocki" To: Daniel J Blueman , "David S. Miller" Subject: [PATCH] gianfar: Do not call device_set_wakeup_enable() under a spinlock Date: Tue, 9 Nov 2010 22:54:19 +0100 User-Agent: KMail/1.13.5 (Linux/2.6.36-rjw+; KDE/4.4.4; x86_64; ; ) Cc: Francois Romieu , Linux Kernel , netdev@vger.kernel.org References: <201011090030.42693.rjw@sisk.pl> In-Reply-To: <201011090030.42693.rjw@sisk.pl> MIME-Version: 1.0 Message-Id: <201011092254.19550.rjw@sisk.pl> X-Virus-Scanned: amavisd-new at ogre.sisk.pl using MkS_Vir for Linux Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tuesday, November 09, 2010, Rafael J. Wysocki wrote: > On Tuesday, November 02, 2010, Daniel J Blueman wrote: > > Since device_set_wakeup_enable now sleeps, it should not be called > > from a critical section. Since wol_en is not updated elsewhere, we can > > omit the locking entirely. > > > > Signed-off-by: Daniel J Blueman > > Acked-by: Rafael J. Wysocki Having reconsidered that I think it may be better to do something like in the patch below. This is a regression fix, so please apply if there are no objections. Thanks, Rafael --- From: Rafael J. Wysocki Subject: gianfar: Do not call device_set_wakeup_enable() under a spinlock The gianfar driver calls device_set_wakeup_enable() under a spinlock, which causes a problem to happen after the recent core power management changes, because this function can sleep now. Fix this by moving the device_set_wakeup_enable() call out of the spinlock-protected area. Signed-off-by: Rafael J. Wysocki --- drivers/net/gianfar_ethtool.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux-2.6/drivers/net/gianfar_ethtool.c =================================================================== --- linux-2.6.orig/drivers/net/gianfar_ethtool.c +++ linux-2.6/drivers/net/gianfar_ethtool.c @@ -635,9 +635,10 @@ static int gfar_set_wol(struct net_devic if (wol->wolopts & ~WAKE_MAGIC) return -EINVAL; + device_set_wakeup_enable(&dev->dev, wol->wolopts & WAKE_MAGIC); + spin_lock_irqsave(&priv->bflock, flags); - priv->wol_en = wol->wolopts & WAKE_MAGIC ? 1 : 0; - device_set_wakeup_enable(&dev->dev, priv->wol_en); + priv->wol_en = !!device_may_wakeup(&dev->dev); spin_unlock_irqrestore(&priv->bflock, flags); return 0;