Commit 8a99aa5d authored by David S. Miller's avatar David S. Miller

Merge branch 'net-some-build-fixes-and-other-improvements'

Jakub Kicinski says:

====================
net: some build fixes and other improvements

A few unrelated improvements here, mostly trying to make random
configs build and W=1 produce a little less warnings under net/
and drivers net/.

First two patches fix set but not used warnings with W=1.

Next patch fixes 64bit division in sch_taprio.c.

Last two patches are getting rid of some (almost) unused asserts
in skbuff.h.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 0bc19985 a06eaaf7
...@@ -1235,8 +1235,6 @@ static int gmac_start_xmit(struct sk_buff *skb, struct net_device *netdev) ...@@ -1235,8 +1235,6 @@ static int gmac_start_xmit(struct sk_buff *skb, struct net_device *netdev)
int txq_num, nfrags; int txq_num, nfrags;
union dma_rwptr rw; union dma_rwptr rw;
SKB_FRAG_ASSERT(skb);
if (skb->len >= 0x10000) if (skb->len >= 0x10000)
goto out_drop_free; goto out_drop_free;
......
...@@ -316,7 +316,7 @@ static int ...@@ -316,7 +316,7 @@ static int
card_send_command(const int ioaddr[], const char* name, card_send_command(const int ioaddr[], const char* name,
const unsigned char out[], unsigned char in[]) const unsigned char out[], unsigned char in[])
{ {
int status, x; int status;
if ((status = card_wait_for_busy_clear(ioaddr, name))) if ((status = card_wait_for_busy_clear(ioaddr, name)))
return status; return status;
...@@ -345,9 +345,7 @@ card_send_command(const int ioaddr[], const char* name, ...@@ -345,9 +345,7 @@ card_send_command(const int ioaddr[], const char* name,
out[0], out[1], out[2], out[3], out[4], out[5]); out[0], out[1], out[2], out[3], out[4], out[5]);
} }
if (out[1] == 0x1b) { if (out[1] != 0x1b) {
x = (out[2] == 0x02);
} else {
if (out[0] >= 0x80 && in[0] != (out[1] | 0x80)) if (out[0] >= 0x80 && in[0] != (out[1] | 0x80))
return -EIO; return -EIO;
} }
...@@ -490,14 +488,13 @@ sb1000_check_CRC(const int ioaddr[], const char* name) ...@@ -490,14 +488,13 @@ sb1000_check_CRC(const int ioaddr[], const char* name)
static const unsigned char Command0[6] = {0x80, 0x1f, 0x00, 0x00, 0x00, 0x00}; static const unsigned char Command0[6] = {0x80, 0x1f, 0x00, 0x00, 0x00, 0x00};
unsigned char st[7]; unsigned char st[7];
int crc, status; int status;
/* check CRC */ /* check CRC */
if ((status = card_send_command(ioaddr, name, Command0, st))) if ((status = card_send_command(ioaddr, name, Command0, st)))
return status; return status;
if (st[1] != st[3] || st[2] != st[4]) if (st[1] != st[3] || st[2] != st[4])
return -EIO; return -EIO;
crc = st[1] << 8 | st[2];
return 0; return 0;
} }
......
...@@ -2100,8 +2100,6 @@ void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off, ...@@ -2100,8 +2100,6 @@ void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off,
void skb_coalesce_rx_frag(struct sk_buff *skb, int i, int size, void skb_coalesce_rx_frag(struct sk_buff *skb, int i, int size,
unsigned int truesize); unsigned int truesize);
#define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags)
#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_has_frag_list(skb))
#define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) #define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb))
#ifdef NET_SKBUFF_DATA_USES_OFFSET #ifdef NET_SKBUFF_DATA_USES_OFFSET
......
...@@ -1070,7 +1070,6 @@ static int pppol2tp_ioctl(struct socket *sock, unsigned int cmd, ...@@ -1070,7 +1070,6 @@ static int pppol2tp_ioctl(struct socket *sock, unsigned int cmd,
{ {
struct pppol2tp_ioc_stats stats; struct pppol2tp_ioc_stats stats;
struct l2tp_session *session; struct l2tp_session *session;
int val;
switch (cmd) { switch (cmd) {
case PPPIOCGMRU: case PPPIOCGMRU:
...@@ -1097,7 +1096,7 @@ static int pppol2tp_ioctl(struct socket *sock, unsigned int cmd, ...@@ -1097,7 +1096,7 @@ static int pppol2tp_ioctl(struct socket *sock, unsigned int cmd,
if (!session->session_id && !session->peer_session_id) if (!session->session_id && !session->peer_session_id)
return -ENOSYS; return -ENOSYS;
if (get_user(val, (int __user *)arg)) if (!access_ok((int __user *)arg, sizeof(int)))
return -EFAULT; return -EFAULT;
break; break;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/math64.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <net/netlink.h> #include <net/netlink.h>
...@@ -121,7 +122,14 @@ static struct sk_buff *taprio_peek(struct Qdisc *sch) ...@@ -121,7 +122,14 @@ static struct sk_buff *taprio_peek(struct Qdisc *sch)
static inline int length_to_duration(struct taprio_sched *q, int len) static inline int length_to_duration(struct taprio_sched *q, int len)
{ {
return (len * atomic64_read(&q->picos_per_byte)) / 1000; return div_u64(len * atomic64_read(&q->picos_per_byte), 1000);
}
static void taprio_set_budget(struct taprio_sched *q, struct sched_entry *entry)
{
atomic_set(&entry->budget,
div64_u64((u64)entry->interval * 1000,
atomic64_read(&q->picos_per_byte)));
} }
static struct sk_buff *taprio_dequeue(struct Qdisc *sch) static struct sk_buff *taprio_dequeue(struct Qdisc *sch)
...@@ -241,8 +249,7 @@ static enum hrtimer_restart advance_sched(struct hrtimer *timer) ...@@ -241,8 +249,7 @@ static enum hrtimer_restart advance_sched(struct hrtimer *timer)
close_time = ktime_add_ns(entry->close_time, next->interval); close_time = ktime_add_ns(entry->close_time, next->interval);
next->close_time = close_time; next->close_time = close_time;
atomic_set(&next->budget, taprio_set_budget(q, next);
(next->interval * 1000) / atomic64_read(&q->picos_per_byte));
first_run: first_run:
rcu_assign_pointer(q->current_entry, next); rcu_assign_pointer(q->current_entry, next);
...@@ -575,9 +582,7 @@ static void taprio_start_sched(struct Qdisc *sch, ktime_t start) ...@@ -575,9 +582,7 @@ static void taprio_start_sched(struct Qdisc *sch, ktime_t start)
list); list);
first->close_time = ktime_add_ns(start, first->interval); first->close_time = ktime_add_ns(start, first->interval);
atomic_set(&first->budget, taprio_set_budget(q, first);
(first->interval * 1000) /
atomic64_read(&q->picos_per_byte));
rcu_assign_pointer(q->current_entry, NULL); rcu_assign_pointer(q->current_entry, NULL);
spin_unlock_irqrestore(&q->current_entry_lock, flags); spin_unlock_irqrestore(&q->current_entry_lock, flags);
......
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