> From: Steve Longerbeam <[EMAIL PROTECTED]>
> Date: Mon, 07 May 2001 10:39:15 -0700

> --- drivers/usb/usb-ohci.h.orig       Mon May  7 10:12:42 2001
> +++ drivers/usb/usb-ohci.h    Mon May  7 10:23:24 2001
> @@ -480,15 +480,22 @@
>                                     td_dma);
>  }
>  
> +static spinlock_t usb_hash_lock = SPIN_LOCK_UNLOCKED;
> +
>  /* Add a hash entry for a TD/ED; return true on success */
>  static inline int
>  hash_add_ed_td(struct hash_list_t * entry, void * virt, dma_addr_t dma)
>  {
>       struct hash_t * scan;
> +        unsigned long flags;
> +
> +        spin_lock_irqsave (&usb_hash_lock, flags);
>       
>       scan = (struct hash_t *)kmalloc(sizeof(struct hash_t), ALLOC_FLAGS);
> -     if (!scan)
> +     if (!scan) {
> +                spin_unlock_irqrestore (&usb_hash_lock, flags);
>               return 0;
> +     }
>       
>       if (!entry->tail) {
>               entry->head = entry->tail = scan;
> @@ -500,6 +507,7 @@
>       scan->virt = virt;
>       scan->dma = dma;
>       scan->next = NULL;
> +        spin_unlock_irqrestore (&usb_hash_lock, flags);
>       return 1;
>  }
>  

When I saw it, two thoughts crossed my mind
1. No need to cover malloc
2. Time to de-inline that function

-- Pete

_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
http://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to