Commit 8b5b4671 authored by Ralf Baechle's avatar Ralf Baechle Committed by Jeff Garzik

Replace local random function with random32()

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 22747d6b
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include <linux/hdlcdrv.h> #include <linux/hdlcdrv.h>
#include <linux/baycom.h> #include <linux/baycom.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/random.h>
#include <net/ax25.h> #include <net/ax25.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -433,16 +434,6 @@ static void encode_hdlc(struct baycom_state *bc) ...@@ -433,16 +434,6 @@ static void encode_hdlc(struct baycom_state *bc)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static unsigned short random_seed;
static inline unsigned short random_num(void)
{
random_seed = 28629 * random_seed + 157;
return random_seed;
}
/* ---------------------------------------------------------------------- */
static int transmit(struct baycom_state *bc, int cnt, unsigned char stat) static int transmit(struct baycom_state *bc, int cnt, unsigned char stat)
{ {
struct parport *pp = bc->pdev->port; struct parport *pp = bc->pdev->port;
...@@ -464,7 +455,7 @@ static int transmit(struct baycom_state *bc, int cnt, unsigned char stat) ...@@ -464,7 +455,7 @@ static int transmit(struct baycom_state *bc, int cnt, unsigned char stat)
if ((--bc->hdlctx.slotcnt) > 0) if ((--bc->hdlctx.slotcnt) > 0)
return 0; return 0;
bc->hdlctx.slotcnt = bc->ch_params.slottime; bc->hdlctx.slotcnt = bc->ch_params.slottime;
if ((random_num() % 256) > bc->ch_params.ppersist) if ((random32() % 256) > bc->ch_params.ppersist)
return 0; return 0;
} }
} }
......
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
#include <linux/if_arp.h> #include <linux/if_arp.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/hdlcdrv.h> #include <linux/hdlcdrv.h>
#include <linux/random.h>
#include <net/ax25.h> #include <net/ax25.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -371,16 +372,6 @@ static void start_tx(struct net_device *dev, struct hdlcdrv_state *s) ...@@ -371,16 +372,6 @@ static void start_tx(struct net_device *dev, struct hdlcdrv_state *s)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static unsigned short random_seed;
static inline unsigned short random_num(void)
{
random_seed = 28629 * random_seed + 157;
return random_seed;
}
/* ---------------------------------------------------------------------- */
void hdlcdrv_arbitrate(struct net_device *dev, struct hdlcdrv_state *s) void hdlcdrv_arbitrate(struct net_device *dev, struct hdlcdrv_state *s)
{ {
if (!s || s->magic != HDLCDRV_MAGIC || s->hdlctx.ptt || !s->skb) if (!s || s->magic != HDLCDRV_MAGIC || s->hdlctx.ptt || !s->skb)
...@@ -396,7 +387,7 @@ void hdlcdrv_arbitrate(struct net_device *dev, struct hdlcdrv_state *s) ...@@ -396,7 +387,7 @@ void hdlcdrv_arbitrate(struct net_device *dev, struct hdlcdrv_state *s)
if ((--s->hdlctx.slotcnt) > 0) if ((--s->hdlctx.slotcnt) > 0)
return; return;
s->hdlctx.slotcnt = s->ch_params.slottime; s->hdlctx.slotcnt = s->ch_params.slottime;
if ((random_num() % 256) > s->ch_params.ppersist) if ((random32() % 256) > s->ch_params.ppersist)
return; return;
start_tx(dev, s); start_tx(dev, s);
} }
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/random.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/system.h> #include <asm/system.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
...@@ -566,14 +567,6 @@ static void yam_start_tx(struct net_device *dev, struct yam_port *yp) ...@@ -566,14 +567,6 @@ static void yam_start_tx(struct net_device *dev, struct yam_port *yp)
ptt_on(dev); ptt_on(dev);
} }
static unsigned short random_seed;
static inline unsigned short random_num(void)
{
random_seed = 28629 * random_seed + 157;
return random_seed;
}
static void yam_arbitrate(struct net_device *dev) static void yam_arbitrate(struct net_device *dev)
{ {
struct yam_port *yp = netdev_priv(dev); struct yam_port *yp = netdev_priv(dev);
...@@ -600,7 +593,7 @@ static void yam_arbitrate(struct net_device *dev) ...@@ -600,7 +593,7 @@ static void yam_arbitrate(struct net_device *dev)
yp->slotcnt = yp->slot / 10; yp->slotcnt = yp->slot / 10;
/* is random > persist ? */ /* is random > persist ? */
if ((random_num() % 256) > yp->pers) if ((random32() % 256) > yp->pers)
return; return;
yam_start_tx(dev, yp); yam_start_tx(dev, yp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment