cli_sti in drivers_net_hamradio_bpqether.c

cli_sti in drivers_net_hamradio_bpqether.c

Post by Rusty Trivial Russel » Wed, 15 Jan 2003 05:10:12



[ Guys, this has been sitting in my Trivial queue for a while, with
  several others.  The patch *looks* ok: apply it and wait for someone
  to whine, or discard it?

  If someonw with this card wants to test this and verify it works on
  an SMP kernel, even if not an SMP box, I'd be happier.

  I guess it depends on when we are going to rip out save_flags et al
  entirely.  Linus? ]


  As part of the Linux Kernel Janitors project, I would like to submit my
  patch for bpqether.c.

  The document Documentation/cli-sti-removal.txt says that cli() should no
  longer be used to disable interrupts. This patch removes all references to
  cli() and {save,restore}_flags.

  - added a static spinlock to protect bpq_devices
  - changed cli/sti and {save,restore}_flags to taking the spinlock and
    disabling interrupts with spin_lock_irqsave
  - included my previous patch for proc_net_create, but as a separate hunk,
    so if you've already applied then just ignore the rejected hunk.

  I have verified that the patched driver compiles without warnings, but
  since I don't have the hardware I can't test it. Please treat with
  caution.

  Perhaps there is another mailing list which I should send this to, in
  order to try and find kind souls to test it?

  Cheers, Chris.
  --
  _ ___ __     _
   / __/ / ,__(_)_  | Chris Wilson <0000 at qwirx.com> - Cambs UK |
  / (_/ ,/ _/ /_  | Security/C/C++/Java/Perl/SQL/HTML Developer |
   _/_/_/_//_/___/ | We are GNU-free your mind-and your software |

--- trivial-2.5.57/drivers/net/hamradio/bpqether.c.orig 2003-01-14 12:12:03.000000000 +1100

        );
 }

+static spinlock_t bpq_lock = SPIN_LOCK_UNLOCKED;
+
 /*
  *     Sanity check: remove all devices that ceased to exists and

        int result = 0;
        unsigned long flags;

-       save_flags(flags);
-       cli();
+       spin_lock_irqsave(&bpq_lock, flags);

        bpq_prev = NULL;

                        bpq_prev = bpq;
        }

-       restore_flags(flags);
+       spin_unlock_irqrestore(&bpq_lock, flags);

        return result;

        int len     = 0;
        off_t pos   = 0;
        off_t begin = 0;
+       unsigned long flags;

-       cli();
+       spin_lock_irqsave(&bpq_lock, flags);

        len += sprintf(buffer, "dev   ether      destination        accept from\n");

                        break;
        }

-       sti();
+       spin_unlock_irqrestore(&bpq_lock, flags);

        *start = buffer + (offset - begin);

 {
        int k;
        struct bpqdev *bpq, *bpq2;
+       unsigned long flags;

        if ((bpq = kmalloc(sizeof(struct bpqdev), GFP_KERNEL)) == NULL)

        dev->mtu             = AX25_DEF_PACLEN;
        dev->addr_len        = AX25_ADDR_LEN;

-       cli();
+       spin_lock_irqsave(&bpq_lock, flags);

        if (bpq_devices == NULL) {

                bpq2->next = bpq;
        }

-       sti();
+       spin_unlock_irqrestore(&bpq_lock, flags);

        return 0;

        printk(banner);

-       proc_net_create("bpqether", 0, bpq_get_info);
+       if (!proc_net_create("bpqether", 0, bpq_get_info)) {
+               printk(KERN_ERR
+                       "bpq: cannot create /proc/net/bpqether entry.\n");
+               unregister_netdevice_notifier(&bpq_dev_notifier);
+               dev_remove_pack(&bpq_packet_type);
+               return -ENOENT;
+       }

        read_lock_bh(&dev_base_lock);
        for (dev = dev_base; dev != NULL; dev = dev->next) {
--
  Don't blame me: the Monkey is driving

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

1. llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll

On Mon, 23 Sep 2002 05:03:56 +0100, Osama Bin Laden assert()ed:

We finally have something in common.  I wish you were dead too.

--
General Protection Fault

 10:40am  up 12 days, 16:10,  2 users,  load average: 0.01, 0.03, 0.00
Linux nitrogen.ertw.com 2.4.9-34 #1 Sat Jun 1 06:32:14 EDT 2002 i586 unknown

2. Debian: installing device drivers

3. P L, PPCQAU7HGUTGG..........................VCCCCCCCCCCCCC AAAAAAAAAAAAAAAAAAAAANNNNNNNNNNNNNNNNNN777777777777777RRRRRRRRRRRRRRRRRBBBBBBBBBBBBBBBBBBBBBBB

4. Problem with GDB, queerly seg.violations and register allocation

5. TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT

6. find files between date x and date y

7. netscape-i686-pc-linux-gnu-installer.tar.gz for Netscape 6.1 ppc?

8. license manager for Visual AGe C 5??

9. Firwall/forward/redierct/ipchains question

10. New HOWTO....HOWTO-Hose-RedHat-Installation (help!)

11. +++GET YOUR FREE PENTIUM CELERON-300+++____________________________________________________________________________________________w09 wpiypw pwioierio

12. Police Forensic & Evidence Elimination programs jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjujjjjjjjjjjjjjjjjjjjjjjjjjjjjj 643 [1/2]

13. ################################################################################################