projects
/
powerpc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Pull bugzilla-5737 into release branch
[powerpc.git]
/
drivers
/
net
/
ppp_generic.c
diff --git
a/drivers/net/ppp_generic.c
b/drivers/net/ppp_generic.c
index
f608c12
..
d643a09
100644
(file)
--- a/
drivers/net/ppp_generic.c
+++ b/
drivers/net/ppp_generic.c
@@
-46,6
+46,7
@@
#include <linux/rwsem.h>
#include <linux/stddef.h>
#include <linux/device.h>
#include <linux/rwsem.h>
#include <linux/stddef.h>
#include <linux/device.h>
+#include <linux/mutex.h>
#include <net/slhc_vj.h>
#include <asm/atomic.h>
#include <net/slhc_vj.h>
#include <asm/atomic.h>
@@
-198,11
+199,11
@@
static unsigned int cardmap_find_first_free(struct cardmap *map);
static void cardmap_destroy(struct cardmap **map);
/*
static void cardmap_destroy(struct cardmap **map);
/*
- * all_ppp_
sem
protects the all_ppp_units mapping.
+ * all_ppp_
mutex
protects the all_ppp_units mapping.
* It also ensures that finding a ppp unit in the all_ppp_units map
* and updating its file.refcnt field is atomic.
*/
* It also ensures that finding a ppp unit in the all_ppp_units map
* and updating its file.refcnt field is atomic.
*/
-static DE
CLARE_MUTEX(all_ppp_sem
);
+static DE
FINE_MUTEX(all_ppp_mutex
);
static struct cardmap *all_ppp_units;
static atomic_t ppp_unit_count = ATOMIC_INIT(0);
static struct cardmap *all_ppp_units;
static atomic_t ppp_unit_count = ATOMIC_INIT(0);
@@
-804,7
+805,7
@@
static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file,
/* Attach to an existing ppp unit */
if (get_user(unit, p))
break;
/* Attach to an existing ppp unit */
if (get_user(unit, p))
break;
-
down(&all_ppp_sem
);
+
mutex_lock(&all_ppp_mutex
);
err = -ENXIO;
ppp = ppp_find_unit(unit);
if (ppp != 0) {
err = -ENXIO;
ppp = ppp_find_unit(unit);
if (ppp != 0) {
@@
-812,7
+813,7
@@
static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file,
file->private_data = &ppp->file;
err = 0;
}
file->private_data = &ppp->file;
err = 0;
}
-
up(&all_ppp_sem
);
+
mutex_unlock(&all_ppp_mutex
);
break;
case PPPIOCATTCHAN:
break;
case PPPIOCATTCHAN:
@@
-1608,8
+1609,6
@@
ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb)
kfree_skb(skb);
skb = ns;
}
kfree_skb(skb);
skb = ns;
}
- else if (!pskb_may_pull(skb, skb->len))
- goto err;
else
skb->ip_summed = CHECKSUM_NONE;
else
skb->ip_summed = CHECKSUM_NONE;
@@
-2446,7
+2445,7
@@
ppp_create_interface(int unit, int *retp)
dev->do_ioctl = ppp_net_ioctl;
ret = -EEXIST;
dev->do_ioctl = ppp_net_ioctl;
ret = -EEXIST;
-
down(&all_ppp_sem
);
+
mutex_lock(&all_ppp_mutex
);
if (unit < 0)
unit = cardmap_find_first_free(all_ppp_units);
else if (cardmap_get(all_ppp_units, unit) != NULL)
if (unit < 0)
unit = cardmap_find_first_free(all_ppp_units);
else if (cardmap_get(all_ppp_units, unit) != NULL)
@@
-2465,12
+2464,12
@@
ppp_create_interface(int unit, int *retp)
atomic_inc(&ppp_unit_count);
cardmap_set(&all_ppp_units, unit, ppp);
atomic_inc(&ppp_unit_count);
cardmap_set(&all_ppp_units, unit, ppp);
-
up(&all_ppp_sem
);
+
mutex_unlock(&all_ppp_mutex
);
*retp = 0;
return ppp;
out2:
*retp = 0;
return ppp;
out2:
-
up(&all_ppp_sem
);
+
mutex_unlock(&all_ppp_mutex
);
free_netdev(dev);
out1:
kfree(ppp);
free_netdev(dev);
out1:
kfree(ppp);
@@
-2500,7
+2499,7
@@
static void ppp_shutdown_interface(struct ppp *ppp)
{
struct net_device *dev;
{
struct net_device *dev;
-
down(&all_ppp_sem
);
+
mutex_lock(&all_ppp_mutex
);
ppp_lock(ppp);
dev = ppp->dev;
ppp->dev = NULL;
ppp_lock(ppp);
dev = ppp->dev;
ppp->dev = NULL;
@@
-2514,7
+2513,7
@@
static void ppp_shutdown_interface(struct ppp *ppp)
ppp->file.dead = 1;
ppp->owner = NULL;
wake_up_interruptible(&ppp->file.rwait);
ppp->file.dead = 1;
ppp->owner = NULL;
wake_up_interruptible(&ppp->file.rwait);
-
up(&all_ppp_sem
);
+
mutex_unlock(&all_ppp_mutex
);
}
/*
}
/*
@@
-2556,7
+2555,7
@@
static void ppp_destroy_interface(struct ppp *ppp)
/*
* Locate an existing ppp unit.
/*
* Locate an existing ppp unit.
- * The caller should have locked the all_ppp_
sem
.
+ * The caller should have locked the all_ppp_
mutex
.
*/
static struct ppp *
ppp_find_unit(int unit)
*/
static struct ppp *
ppp_find_unit(int unit)
@@
-2579,8
+2578,7
@@
ppp_find_channel(int unit)
list_for_each_entry(pch, &new_channels, list) {
if (pch->file.index == unit) {
list_for_each_entry(pch, &new_channels, list) {
if (pch->file.index == unit) {
- list_del(&pch->list);
- list_add(&pch->list, &all_channels);
+ list_move(&pch->list, &all_channels);
return pch;
}
}
return pch;
}
}
@@
-2601,7
+2599,7
@@
ppp_connect_channel(struct channel *pch, int unit)
int ret = -ENXIO;
int hdrlen;
int ret = -ENXIO;
int hdrlen;
-
down(&all_ppp_sem
);
+
mutex_lock(&all_ppp_mutex
);
ppp = ppp_find_unit(unit);
if (ppp == 0)
goto out;
ppp = ppp_find_unit(unit);
if (ppp == 0)
goto out;
@@
-2626,7
+2624,7
@@
ppp_connect_channel(struct channel *pch, int unit)
outl:
write_unlock_bh(&pch->upl);
out:
outl:
write_unlock_bh(&pch->upl);
out:
-
up(&all_ppp_sem
);
+
mutex_unlock(&all_ppp_mutex
);
return ret;
}
return ret;
}