diff -urN wt8-4m/drivers/net/ppp_generic.c wt8/drivers/net/ppp_generic.c --- wt8-4m/drivers/net/ppp_generic.c Sat Feb 16 15:10:13 2002 +++ wt8/drivers/net/ppp_generic.c Sat Feb 16 18:13:45 2002 @@ -166,11 +166,11 @@ */ /* - * all_ppp_sem protects the all_ppp_units. + * all_ppp_lock protects the all_ppp_units. * It also ensures that finding a ppp unit in the all_ppp_units list * and updating its file.refcnt field is atomic. */ -static DECLARE_MUTEX(all_ppp_sem); +static spinlock_t all_ppp_lock = SPIN_LOCK_UNLOCKED; static LIST_HEAD(all_ppp_units); /* @@ -706,11 +706,11 @@ /* Attach to an existing ppp unit */ if (get_user(unit, (int *) arg)) break; - down(&all_ppp_sem); + spin_lock(&all_ppp_lock); ppp = ppp_find_unit(unit); if (ppp != 0) atomic_inc(&ppp->file.refcnt); - up(&all_ppp_sem); + spin_unlock(&all_ppp_lock); err = -ENXIO; if (ppp == 0) break; @@ -1528,7 +1528,6 @@ error indication. */ if (len == DECOMP_FATALERROR) ppp->rstate |= SC_DC_FERROR; - kfree_skb(ns); goto err; } @@ -2200,7 +2199,7 @@ int ret = -EEXIST; int i; - down(&all_ppp_sem); + spin_lock(&all_ppp_lock); list = &all_ppp_units; while ((list = list->next) != &all_ppp_units) { ppp = list_entry(list, struct ppp, file.list); @@ -2216,11 +2215,11 @@ /* Create a new ppp structure and link it before `list'. */ ret = -ENOMEM; - ppp = kmalloc(sizeof(struct ppp), GFP_KERNEL); + ppp = kmalloc(sizeof(struct ppp), GFP_ATOMIC); if (ppp == 0) goto out; memset(ppp, 0, sizeof(struct ppp)); - dev = kmalloc(sizeof(struct net_device), GFP_KERNEL); + dev = kmalloc(sizeof(struct net_device), GFP_ATOMIC); if (dev == 0) { kfree(ppp); goto out; @@ -2259,7 +2258,7 @@ list_add(&ppp->file.list, list->prev); out: - up(&all_ppp_sem); + spin_unlock(&all_ppp_lock); *retp = ret; if (ret != 0) ppp = 0; @@ -2287,7 +2286,7 @@ struct net_device *dev; int n_channels ; - down(&all_ppp_sem); + spin_lock(&all_ppp_lock); list_del(&ppp->file.list); /* Last fd open to this ppp unit is being closed or detached: @@ -2327,19 +2326,19 @@ /* * We can't acquire any new channels (since we have the - * all_ppp_sem) so if n_channels is 0, we can free the + * all_ppp_lock) so if n_channels is 0, we can free the * ppp structure. Otherwise we leave it around until the * last channel disconnects from it. */ if (n_channels == 0) kfree(ppp); - up(&all_ppp_sem); + spin_unlock(&all_ppp_lock); } /* * Locate an existing ppp unit. - * The caller must have locked the all_ppp_sem. + * The caller should have locked the all_ppp_lock. */ static struct ppp * ppp_find_unit(int unit) @@ -2385,7 +2384,7 @@ int ret = -ENXIO; int hdrlen; - down(&all_ppp_sem); + spin_lock(&all_ppp_lock); ppp = ppp_find_unit(unit); if (ppp == 0) goto out; @@ -2414,7 +2413,7 @@ outwl: write_unlock_bh(&pch->upl); out: - up(&all_ppp_sem); + spin_unlock(&all_ppp_lock); return ret; }