From patchwork Wed Feb 10 09:38:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Kagstrom X-Patchwork-Id: 44997 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 385C1B7CEF for ; Wed, 10 Feb 2010 20:38:20 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753911Ab0BJJiP (ORCPT ); Wed, 10 Feb 2010 04:38:15 -0500 Received: from ernst.netinsight.se ([194.16.221.21]:20040 "HELO ernst.netinsight.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1753739Ab0BJJiO (ORCPT ); Wed, 10 Feb 2010 04:38:14 -0500 Received: from marrow.netinsight.se (unverified [10.100.3.78]) by ernst.netinsight.se (EMWAC SMTPRS 0.83) with SMTP id ; Wed, 10 Feb 2010 10:38:09 +0100 Date: Wed, 10 Feb 2010 10:38:07 +0100 From: Simon Kagstrom To: David Miller , netdev@vger.kernel.org Cc: davej@redhat.com, ben@decadent.org.uk Subject: [PATCH v2 2/3] via-velocity: Take spinlock on set coalesce Message-ID: <20100210103807.79de5c9a@marrow.netinsight.se> In-Reply-To: <20100210103358.41a45851@marrow.netinsight.se> References: <20100205165253.3f316b98@marrow.netinsight.se> <20100209.163133.38216503.davem@davemloft.net> <20100210103358.41a45851@marrow.netinsight.se> X-Mailer: Claws Mail 3.7.4 (GTK+ 2.16.1; i486-pc-linux-gnu) Mime-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org velocity_set_coalesce touches ISR and some other sensitive registers not covered by the rtnl lock, so take the velocity spinlock. Signed-off-by: Simon Kagstrom --- drivers/net/via-velocity.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index 5c73673..5e213f7 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c @@ -3341,6 +3341,7 @@ static int velocity_set_coalesce(struct net_device *dev, { struct velocity_info *vptr = netdev_priv(dev); int max_us = 0x3f * 64; + unsigned long flags; /* 6 bits of */ if (ecmd->tx_coalesce_usecs > max_us) @@ -3362,6 +3363,7 @@ static int velocity_set_coalesce(struct net_device *dev, ecmd->tx_coalesce_usecs); /* Setup the interrupt suppression and queue timers */ + spin_lock_irqsave(&vptr->lock, flags); mac_disable_int(vptr->mac_regs); setup_adaptive_interrupts(vptr); setup_queue_timers(vptr); @@ -3369,6 +3371,7 @@ static int velocity_set_coalesce(struct net_device *dev, mac_write_int_mask(vptr->int_mask, vptr->mac_regs); mac_clear_isr(vptr->mac_regs); mac_enable_int(vptr->mac_regs); + spin_unlock_irqrestore(&vptr->lock, flags); return 0; }