Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Wed, 2 Oct 2002 16:04:18 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Wed, 2 Oct 2002 16:04:18 -0400 Received: from 167.imtp.Ilyichevsk.Odessa.UA ([195.66.192.167]:12307 "EHLO Port.imtp.ilyichevsk.odessa.ua") by vger.kernel.org with ESMTP id ; Wed, 2 Oct 2002 16:04:17 -0400 Message-Id: <200210022005.g92K5Fp31816@Port.imtp.ilyichevsk.odessa.ua> Content-Type: text/plain; charset="us-ascii" From: Denis Vlasenko Reply-To: vda@port.imtp.ilyichevsk.odessa.ua To: linux-kernel@vger.kernel.org Subject: [PATCH] cli()/sti() fix for drivers/net/depca.c Date: Wed, 2 Oct 2002 22:58:50 -0200 X-Mailer: KMail [version 1.3.2] Cc: Andrew Morton , Jeff Garzik , "David S. Miller" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1605 Lines: 46 These are my first patches for network drivers. Please comment if I'm doing something wrong. Compile tested. Testers with hw wanted. -- vda diff -u --recursive linux-2.5.38orig/drivers/net/depca.c linux-2.5.38/drivers/net/depca.c --- linux-2.5.38orig/drivers/net/depca.c Sun Sep 22 04:25:10 2002 +++ linux-2.5.38/drivers/net/depca.c Wed Oct 2 01:16:57 2002 @@ -1910,6 +1910,7 @@ struct depca_ioctl *ioc = (struct depca_ioctl *) &rq->ifr_data; int i, status = 0; u_long ioaddr = dev->base_addr; + unsigned long flags; union { u8 addr[(HASH_TABLE_LEN * ETH_ALEN)]; u16 sval[(HASH_TABLE_LEN * ETH_ALEN) >> 1]; @@ -1999,18 +2000,19 @@ break; case DEPCA_GET_STATS: /* Get the driver statistics */ - cli(); + + spin_lock_irqsave(&lp->lock, flags); ioc->len = sizeof(lp->pktStats); if (copy_to_user(ioc->data, &lp->pktStats, ioc->len)) status = -EFAULT; - sti(); + spin_unlock_irqrestore(&lp->lock, flags); break; case DEPCA_CLR_STATS: /* Zero out the driver statistics */ if (!capable(CAP_NET_ADMIN)) return -EPERM; - cli(); + spin_lock_irqsave(&lp->lock, flags); memset(&lp->pktStats, 0, sizeof(lp->pktStats)); - sti(); + spin_unlock_irqrestore(&lp->lock, flags); break; case DEPCA_GET_REG: /* Get the DEPCA Registers */ - 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/