mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] cli()/sti() fix for drivers/net/depca.c
@ 2002-10-03  0:58 Denis Vlasenko
  2002-10-02 20:40 ` Francois Romieu
  0 siblings, 1 reply; 7+ messages in thread
From: Denis Vlasenko @ 2002-10-03  0:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, Jeff Garzik, David S. Miller

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 */

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-10-03 16:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-03  0:58 [PATCH] cli()/sti() fix for drivers/net/depca.c Denis Vlasenko
2002-10-02 20:40 ` Francois Romieu
2002-10-03  2:26   ` Denis Vlasenko
2002-10-02 22:12     ` Francois Romieu
2002-10-03 12:37       ` Denis Vlasenko
2002-10-03 16:40         ` Francois Romieu
2002-10-03 12:55       ` Denis Vlasenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®