TCPCT part 1: cookie option exchange
Subsystems (41)
v7 cover TCPCT part 1: cookie option exchange
Initiator Responder
========= =========
<SYN> ->
Cookie
<- <SYN,ACK(SYN)>
Cookie
optional dataV7:
Updated to patch cleanly with recent large commits.
Compiled and lightly tested. Awaiting performance testing results.
Revised RCU spinlocks, based on review by Eric and Joe.
Trivial savings of 2 if tests, based on review by Joe.
Cosmetic changes to comment blocks, based on review by Eric.
Processing optional SYNACK data removed until later.
V6:
The new TCP_MSS_* symbols are now in an entirely separate patch. Applied.
Updated and reorganized to split the code base into several pieces, as requested by Eric. No significant changes.
...
RFC PATCH v7 1/7 TCPCT part 1a: add request_values parameter for sending SYNACK
Add optional function parameters associated with sending SYNACK. These parameters are not needed after sending SYNACK, and are not used for retransmission. Avoids extending struct tcp_request_sock, and avoids allocating kernel memory.
Also affects DCCP as it uses common struct request_sock_ops, but this parameter is currently reserved for future use.
--- include/net/request_sock.h | 8 +++++++- include/net/tcp.h | 3 ++- net/dccp/ipv4.c | 5 +++-- net/dccp/ipv6.c | 5 +++-- net/dccp/minisocks.c | 2 +- net/ipv4/inet_connection_sock.c | 2 +- net/ipv4/tcp_ipv4.c | 19 +++++++++++-------- net/ipv4/tcp_minisocks.c | 2 +- net/ipv4/tcp_output.c | 3 ++- net/ipv6/tcp_ipv6.c | 28 +++++++++++++--------------- 10 files changed, 44 insertions(+), 33 deletions(-)
include/net/request_sock.h +7 -1
@@ -27,13 +27,19 @@ struct sk_buff;struct dst_entry ;struct proto ; +/* empty to "strongly type" an otherwise void parameter. +*/ +struct request_values { +}; +struct request_sock_ops {int family;int obj_size;struct kmem_cache *slab;char *slab_name;int (*rtx_syn_ack)(struct sock *sk, -struct request_sock *req); +struct request_sock *req, +struct request_values *rvp);void (*send_ack)(struct sock *sk,struct sk_buff *skb,struct request_sock *req); void (*send_reset)(struct sock *sk,
include/net/tcp.h +2 -1
@@ -440,7 +440,8 @@ extern int tcp_connect(struct sock *sk);extern struct sk_buff *tcp_make_synack (struct sock *sk,struct dst_entry *dst, -struct request_sock *req); +struct request_sock *req, +struct request_values *rvp);extern int tcp_disconnect (struct sock *sk,int flags);
net/dccp/ipv4.c +3 -2
@@ -477,7 +477,8 @@ static struct dst_entry* dccp_v4_route_skb(struct net *net, struct sock *sk,return &rt->u.dst; } -static int dccp_v4_send_response (struct sock *sk,struct request_sock *req) +static int dccp_v4_send_response (struct sock *sk,struct request_sock *req, +struct request_values *rv_unused) {int err =-1 ;struct sk_buff *skb;
@@ -626,7 +627,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb) dreq->dreq_iss =dccp_v4_init_sequence (skb); dreq->dreq_service = service; -if (dccp_v4_send_response (sk, req)) +if (dccp_v4_send_response (sk, req,NULL )) goto drop_and_free;inet_csk_reqsk_queue_hash_add (sk, req,DCCP_TIMEOUT_INIT );
net/dccp/ipv6.c +3 -2
@@ -241,7 +241,8 @@ out: } -static int dccp_v6_send_response (struct sock *sk,struct request_sock *req) +static int dccp_v6_send_response (struct sock *sk,struct request_sock *req, +struct request_values *rv_unused) {struct inet6_request_sock *ireq6 =inet6_rsk (req);struct ipv6_pinfo *np =inet6_sk (sk);
@@ -468,7 +469,7 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb) dreq->dreq_iss =dccp_v6_init_sequence (skb); dreq->dreq_service = service; -if (dccp_v6_send_response (sk, req)) +if (dccp_v6_send_response (sk, req,NULL )) goto drop_and_free;inet6_csk_reqsk_queue_hash_add (sk, req,DCCP_TIMEOUT_INIT );
net/dccp/minisocks.c +1 -1
@@ -184,7 +184,7 @@ struct sock *dccp_check_req(struct sock *sk, struct sk_buff *skb,* counter (backoff, monitored by dccp_response_timer). */ req->retrans++; - req->rsk_ops->rtx_syn_ack (sk, req); + req->rsk_ops->rtx_syn_ack (sk, req,NULL ); }/* Network Duplicate, discard packet */ return NULL ;
net/ipv4/inet_connection_sock.c +1 -1
@@ -531,7 +531,7 @@ void inet_csk_reqsk_queue_prune(struct sock *parent, &expire, &resend);if (!expire && (!resend || - !req->rsk_ops->rtx_syn_ack (parent, req) || + !req->rsk_ops->rtx_syn_ack (parent, req,NULL ) ||inet_rsk (req)->acked)) {unsigned long timeo;
net/ipv4/tcp_ipv4.c +11 -8
@@ -742,8 +742,9 @@ static void tcp_v4_reqsk_send_ack(struct sock *sk, struct sk_buff *skb,* This still operates on a request_sock only, not on a big * socket. */ -static int __tcp_v4_send_synack (struct sock *sk,struct request_sock *req, -struct dst_entry *dst) +static int __tcp_v4_send_synack (struct sock *sk,struct dst_entry *dst, +struct request_sock *req, +struct request_values *rvp) {const struct inet_request_sock *ireq =inet_rsk (req);int err =-1 ;
@@ -753,7 +754,7 @@ static int __tcp_v4_send_synack(struct sock *sk, struct request_sock *req,if (!dst && (dst =inet_csk_route_req (sk, req)) ==NULL )return -1 ; - skb =tcp_make_synack (sk, dst, req); + skb =tcp_make_synack (sk, dst, req, rvp);if (skb) {struct tcphdr *th =tcp_hdr (skb);
@@ -774,9 +775,10 @@ static int __tcp_v4_send_synack(struct sock *sk, struct request_sock *req,return err; } -static int tcp_v4_send_synack (struct sock *sk,struct request_sock *req) +static int tcp_v4_send_synack (struct sock *sk,struct request_sock *req, +struct request_values *rvp) { -return __tcp_v4_send_synack (sk, req,NULL ); +return __tcp_v4_send_synack (sk,NULL , req, rvp); }/*
@@ -1211,13 +1213,13 @@ static struct timewait_sock_ops tcp_timewait_sock_ops = {int tcp_v4_conn_request (struct sock *sk,struct sk_buff *skb) { -struct inet_request_sock *ireq;struct tcp_options_received tmp_opt;struct request_sock *req; +struct inet_request_sock *ireq; +struct dst_entry *dst =NULL ;__be32 saddr =ip_hdr (skb)->saddr;__be32 daddr =ip_hdr (skb)->daddr;__u32 isn =TCP_SKB_CB (skb)->when; -struct dst_entry *dst =NULL ;#ifdef CONFIG_SYN_COOKIES int want_cookie =0 ;#else
@@ -1337,7 +1339,8 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) }tcp_rsk (req)->snt_isn = isn; -if (__tcp_v4_send_synack (sk, req, dst) || want_cookie) +if (__tcp_v4_send_synack (sk, dst, req,NULL ) + || want_cookie) goto drop_and_free;inet_csk_reqsk_queue_hash_add (sk, req,TCP_TIMEOUT_INIT );
net/ipv4/tcp_minisocks.c +1 -1
@@ -537,7 +537,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,* Enforce "SYN-ACK" according to figure 8, figure 6 * of RFC793, fixed by RFC1122. */ - req->rsk_ops->rtx_syn_ack (sk, req); + req->rsk_ops->rtx_syn_ack (sk, req,NULL );return NULL ; }
net/ipv4/tcp_output.c +2 -1
@@ -2224,7 +2224,8 @@ int tcp_send_synack(struct sock *sk)/* Prepare a SYN-ACK. */ struct sk_buff *tcp_make_synack (struct sock *sk,struct dst_entry *dst, -struct request_sock *req) +struct request_sock *req, +struct request_values *rvp) {struct inet_request_sock *ireq =inet_rsk (req);struct tcp_sock *tp =tcp_sk (sk);
net/ipv6/tcp_ipv6.c +13 -15
@@ -461,7 +461,8 @@ out: } -static int tcp_v6_send_synack (struct sock *sk,struct request_sock *req) +static int tcp_v6_send_synack (struct sock *sk,struct request_sock *req, +struct request_values *rvp) {struct inet6_request_sock *treq =inet6_rsk (req);struct ipv6_pinfo *np =inet6_sk (sk);
@@ -499,7 +500,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req)if ((err =xfrm_lookup (sock_net (sk), &dst, &fl, sk,0 )) <0 ) goto done; - skb =tcp_make_synack (sk, dst, req); + skb =tcp_make_synack (sk, dst, req, rvp);if (skb) {struct tcphdr *th =tcp_hdr (skb);
@@ -1161,13 +1162,13 @@ static struct sock *tcp_v6_hnd_req(struct sock *sk,struct sk_buff *skb)*/ static int tcp_v6_conn_request (struct sock *sk,struct sk_buff *skb) { +struct tcp_options_received tmp_opt; +struct request_sock *req;struct inet6_request_sock *treq;struct ipv6_pinfo *np =inet6_sk (sk); -struct tcp_options_received tmp_opt;struct tcp_sock *tp =tcp_sk (sk); -struct request_sock *req =NULL ; -__u32 isn =TCP_SKB_CB (skb)->when;struct dst_entry *dst =__sk_dst_get (sk); +__u32 isn =TCP_SKB_CB (skb)->when;#ifdef CONFIG_SYN_COOKIES int want_cookie =0 ;#else
@@ -1239,23 +1240,20 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) isn =tcp_v6_init_sequence (skb); } -tcp_rsk (req)->snt_isn = isn;security_inet_conn_request (sk, skb, req); -if (tcp_v6_send_synack (sk, req)) - goto drop; +if (tcp_v6_send_synack (sk, req,NULL ) + || want_cookie) + goto drop_and_free; -if (!want_cookie) { -inet6_csk_reqsk_queue_hash_add (sk, req,TCP_TIMEOUT_INIT ); -return 0 ; - } +inet6_csk_reqsk_queue_hash_add (sk, req,TCP_TIMEOUT_INIT ); +return 0 ; +drop_and_free: +reqsk_free (req); drop: -if (req) -reqsk_free (req); -return 0 ;/* don't send reset */ }
Signature · 1 line
1.6.3.3
David Miller
maintainerRe: [net-next-2.6 PATCH v7 1/7 RFC] TCPCT part 1a: add request_values parameter for sending SYNACK
From: William Allen Simpson <[email protected]>
Date: Fri, 20 Nov 2009 09:12:13 -0500
net/ipv6/tcp_ipv6.c static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) · line 1249
Quoted 5 lines
net/ipv6/tcp_ipv6.c +3
-2-if (tcp_v6_send_synack (sk, req)) - goto drop; +if (tcp_v6_send_synack (sk, req,NULL ) + || want_cookie) + goto drop_and_free;
Please fix the coding style here, the "||" belongs at the end of the previous line, not at the start of the next one.
Also, since it will all fit one one line anyways, please make it that way:
if (tcp_v6_send_synack(sk, req, NULL) || want_cookie)
Some of us still use 80x25 terminals to read code :-)
I think you've been asked to fix this specific kinds of cases up before.
Thanks a lot.
RFC PATCH v7 2/7 TCPCT part 1b: generate Responder Cookie secret
In reply to William Allen SimpsonDefine (missing) hash message size for SHA1.
Define hashing size constants specific to TCP cookies.
Add new function: tcp_cookie_generator().
Maintain global secret values for tcp_cookie_generator().
This is a significantly revised implementation of earlier (15-year-old) Photuris [RFC-2522] code for the KA9Q cooperative multitasking platform.
Linux RCU technique appears to be well-suited to this application, though neither of the circular queue items are freed.
These functions will also be used in subsequent patches that implement additional features.
--- include/linux/cryptohash.h | 1 + include/net/tcp.h | 8 +++ net/ipv4/tcp.c | 140 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 149 insertions(+), 0 deletions(-)
include/linux/cryptohash.h +1 -0
@@ -2,6 +2,7 @@#define __CRYPTOHASH_H#define SHA_DIGEST_WORDS 5 +#define SHA_MESSAGE_BYTES (512 /*bits*/ / 8)#define SHA_WORKSPACE_WORDS 80void sha_init (__u32 *buf);
include/net/tcp.h +8 -0
@@ -1478,6 +1478,14 @@ struct tcp_request_sock_ops {#endif }; +/* Using SHA1 for now, define some constants. +*/ +#define COOKIE_DIGEST_WORDS (SHA_DIGEST_WORDS) +#define COOKIE_MESSAGE_WORDS (SHA_MESSAGE_BYTES / 4) +#define COOKIE_WORKSPACE_WORDS (COOKIE_DIGEST_WORDS + COOKIE_MESSAGE_WORDS) + +extern int tcp_cookie_generator (u32 *bakery); +extern void tcp_v4_init (void );extern void tcp_init (void );
net/ipv4/tcp.c +140 -0
164 lines not on this page · raw message
Signature · 1 line
1.6.3.3
David Miller
maintainerRe: [net-next-2.6 PATCH v7 2/7 RFC] TCPCT part 1b: generate Responder Cookie secret
From: William Allen Simpson <[email protected]>
Date: Fri, 20 Nov 2009 09:23:21 -0500
Quoted 1 line
+static
DEFINE_SPINLOCK(tcp_secret_locker);
So connection creation scalability will be limited now because we'll always have to go through this centralized spinlock even for independent listening sockets, right?
Just wondering...
Re: [net-next-2.6 PATCH v7 2/7 RFC] TCPCT part 1b: generate Responder Cookie secret
Quoted 8 lines · David Miller
From: William Allen Simpson <[email protected]>
Date: Fri, 20 Nov 2009 09:23:21 -0500Quoted 1 line
+static
DEFINE_SPINLOCK(tcp_secret_locker);So connection creation scalability will be limited now because we'll always have to go through this centralized spinlock even for independent listening sockets, right?
I was about to complain about the same thing in a earlier version of this patch kit, but then I noticed the spin lock aquiring is guarded by
if (unlikely(time_after_eq(jiffy, tcp_secret_generating->expires))) {
which presumably makes it rare enough?
-Andi
Signature · 1 line
[email protected] -- Speaking for myself only.
David Miller
maintainerRe: [net-next-2.6 PATCH v7 2/7 RFC] TCPCT part 1b: generate Responder Cookie secret
From: Andi Kleen <[email protected]>
Date: Fri, 20 Nov 2009 21:47:17 +0100
Quoted 11 lines
Quoted 8 lines · David Miller
From: William Allen Simpson <[email protected]>
Date: Fri, 20 Nov 2009 09:23:21 -0500Quoted 1 line
+static
DEFINE_SPINLOCK(tcp_secret_locker);So connection creation scalability will be limited now because we'll always have to go through this centralized spinlock even for independent listening sockets, right?
Quoted 7 lines
I was about to complain about the same thing in a earlier version of this patch kit, but then I noticed the spin lock aquiring is guarded by
if (
unlikely(time_after_eq(jiffy, tcp_secret_generating->expires))) {which presumably makes it rare enough?
Works for me.
Re: [net-next-2.6 PATCH v7 2/7 RFC] TCPCT part 1b: generate Responder Cookie secret
Quoted 12 lines · David Miller
From: Andi Kleen <[email protected]>
Date: Fri, 20 Nov 2009 21:47:17 +0100Quoted 9 lines
Quoted 7 lines · David Miller
From: William Allen Simpson <[email protected]>
Date: Fri, 20 Nov 2009 09:23:21 -0500Quoted 1 line
+static
DEFINE_SPINLOCK(tcp_secret_locker);So connection creation scalability will be limited now because we'll always have to go through this centralized spinlock even for independent listening sockets, right?
Quoted 9 lines
Quoted 6 lines
I was about to complain about the same thing in a earlier version of this patch kit, but then I noticed the spin lock aquiring is guarded by
if (
unlikely(time_after_eq(jiffy, tcp_secret_generating->expires))) {which presumably makes it rare enough?
Works for me.
Roughly once every 10 minutes. In the original code with rw_lock() that would have been more frequent on the read side, but the RCU technique speeds that up considerably?
Also, not every listening socket, just sockets after a cookie option arrives. That will probably be only a few selected sockets, at least for the time being.
RFC PATCH v7 3/7 TCPCT part 1c: sysctl_tcp_cookie_size, socket option TCP_COOKIE_TRANSACTIONS
In reply to William Allen SimpsonDefine sysctl (tcp_cookie_size) to turn on and off the cookie option default globally, instead of a compiled configuration option.
Define per socket option (TCP_COOKIE_TRANSACTIONS) for setting constant data values, retrieving variable cookie values, and other facilities.
Move inline tcp_clear_options() unchanged from net/tcp.h to linux/tcp.h, near its corresponding struct tcp_options_received (prior to changes).
This is a straightforward re-implementation of an earlier (year-old) patch that no longer applies cleanly, with permission of the original author (Adam Langley):
http://thread.gmane.org/gmane.linux.network/102586
These functions will also be used in subsequent patches that implement additional features.
Requires:
net: TCP_MSS_DEFAULT, TCP_MSS_DESIRED
--- Documentation/networking/ip-sysctl.txt | 8 +++++++ include/linux/tcp.h | 33 +++++++++++++++++++++++++++++++- include/net/tcp.h | 6 +---- net/ipv4/sysctl_net_ipv4.c | 8 +++++++ net/ipv4/tcp_output.c | 8 +++++++ 5 files changed, 57 insertions(+), 6 deletions(-)
Documentation/networking/ip-sysctl.txt +8 -0
@@ -164,6 +164,14 @@ tcp_congestion_control - STRING additional choices may be available based on kernel configuration. Default is set as part of kernel configuration. +tcp_cookie_size - INTEGER + Default size of TCP Cookie Transactions (TCPCT) option, that may be + overridden on a per socket basis by the TCPCT socket option. + Values greater than the maximum (16) are interpreted as the maximum. + Values greater than zero and less than the minimum (8) are interpreted + as the minimum. Odd values are interpreted as the next even value. + Default: 0 (off). + tcp_dsack - BOOLEAN Allows TCP to send "duplicate" SACKs.
include/linux/tcp.h +32 -1
@@ -102,7 +102,9 @@ enum {#define TCP_QUICKACK 12/* Block/reenable quick acks */ #define TCP_CONGESTION 13/* Congestion control algorithm */ #define TCP_MD5SIG 14/* TCP MD5 Signature (RFC2385) */ +#define TCP_COOKIE_TRANSACTIONS 15/* TCP Cookie Transactions */ +/* for TCP_INFO socket option */ #define TCPI_OPT_TIMESTAMPS 1#define TCPI_OPT_SACK 2#define TCPI_OPT_WSCALE 4
@@ -174,6 +176,30 @@ struct tcp_md5sig {__u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN ];/* key (binary) */ }; +/* for TCP_COOKIE_TRANSACTIONS (TCPCT) socket option */ +#define TCP_COOKIE_MIN 8/* 64-bits */ +#define TCP_COOKIE_MAX 16/* 128-bits */ +#define TCP_COOKIE_PAIR_SIZE (2*TCP_COOKIE_MAX) + +/* Flags for both getsockopt and setsockopt */ +#define TCP_COOKIE_IN_ALWAYS (1 << 0)/* Discard SYN without cookie */ +#define TCP_COOKIE_OUT_NEVER (1 << 1)/* Prohibit outgoing cookies, +* supercedes everything. */ + +/* Flags for getsockopt */ +#define TCP_S_DATA_IN (1 << 2)/* Was data received? */ +#define TCP_S_DATA_OUT (1 << 3)/* Was data sent? */ + +/* TCP_COOKIE_TRANSACTIONS data */ +struct tcp_cookie_transactions { +__u16 tcpct_flags;/* see above */ +__u8 __tcpct_pad1;/* zero */ +__u8 tcpct_cookie_desired;/* bytes */ +__u16 tcpct_s_data_desired;/* bytes of variable data */ +__u16 tcpct_used;/* bytes in value */ +__u8 tcpct_value[TCP_MSS_DEFAULT ]; +}; +#ifdef __KERNEL__#include <linux/skbuff.h>
@@ -227,6 +253,11 @@ struct tcp_options_received {u16 mss_clamp;/* Maximal mss, negotiated at connection setup */ }; +static inline void tcp_clear_options (struct tcp_options_received *rx_opt) +{ + rx_opt->tstamp_ok = rx_opt->sack_ok = rx_opt->wscale_ok = rx_opt->snd_wscale =0 ; +} +/* This is the max number of SACKS that we'll generate and process. It's safe * to increse this, although since: * size = TCPOLEN_SACK_BASE_ALIGNED (4) + n * TCPOLEN_SACK_PERBLOCK (8)
@@ -435,6 +466,6 @@ static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk)return (struct tcp_timewait_sock *)sk; } -#endif +#endif /* __KERNEL__ */ #endif /* _LINUX_TCP_H */
include/net/tcp.h +1 -5
@@ -234,6 +234,7 @@ extern int sysctl_tcp_base_mss;extern int sysctl_tcp_workaround_signed_windows;extern int sysctl_tcp_slow_start_after_idle;extern int sysctl_tcp_max_ssthresh; +extern int sysctl_tcp_cookie_size;extern atomic_t tcp_memory_allocated;extern struct percpu_counter tcp_sockets_allocated;
@@ -340,11 +341,6 @@ static inline void tcp_dec_quickack_mode(struct sock *sk,extern void tcp_enter_quickack_mode (struct sock *sk); -static inline void tcp_clear_options (struct tcp_options_received *rx_opt) -{ - rx_opt->tstamp_ok = rx_opt->sack_ok = rx_opt->wscale_ok = rx_opt->snd_wscale =0 ; -} -#define TCP_ECN_OK 1#define TCP_ECN_QUEUE_CWR 2#define TCP_ECN_DEMAND_CWR 4
net/ipv4/sysctl_net_ipv4.c +8 -0
@@ -714,6 +714,14 @@ static struct ctl_table ipv4_table[] = { }, { .ctl_name = CTL_UNNUMBERED, + .procname = "tcp_cookie_size", + .data = &sysctl_tcp_cookie_size, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec + }, + { + .ctl_name = CTL_UNNUMBERED, .procname = "udp_mem", .data = &sysctl_udp_mem, .maxlen = sizeof(sysctl_udp_mem),
net/ipv4/tcp_output.c +8 -0
@@ -59,6 +59,14 @@ int sysctl_tcp_base_mss __read_mostly = 512;/* By default, RFC2861 behavior. */ int sysctl_tcp_slow_start_after_idle__read_mostly =1 ; +#ifdef CONFIG_SYSCTL +/* By default, let the user enable it. */ +int sysctl_tcp_cookie_size__read_mostly =0 ; +#else +int sysctl_tcp_cookie_size__read_mostly =TCP_COOKIE_MAX ; +#endif + +/* Account for new data that has been sent to the network. */ static void tcp_event_new_data_sent (struct sock *sk,struct sk_buff *skb) {
Signature · 1 line
1.6.3.3
David Miller
maintainerRe: [net-next-2.6 PATCH v7 3/7 RFC] TCPCT part 1c: sysctl_tcp_cookie_size, socket option TCP_COOKIE_TRANSACTIONS
From: William Allen Simpson <[email protected]>
Date: Fri, 20 Nov 2009 09:33:51 -0500
net/ipv4/tcp_output.c int sysctl_tcp_base_mss __read_mostly = 512; · line 68
Quoted 11 lines
net/ipv4/tcp_output.c +7
-0@@ -59,6 +59,14 @@ int sysctl_tcp_base_mss __read_mostly = 512;/* By default, RFC2861 behavior. */ int sysctl_tcp_slow_start_after_idle__read_mostly =1 ; +#ifdef CONFIG_SYSCTL +/* By default, let the user enable it. */ +int sysctl_tcp_cookie_size__read_mostly =0 ; +#else +int sysctl_tcp_cookie_size__read_mostly =TCP_COOKIE_MAX ; +#endif +
I would prefer if the default did not depend upon whether SYSCTL is enabled or not. That's extremely non-intuitive.
Re: [net-next-2.6 PATCH v7 3/7 RFC] TCPCT part 1c: sysctl_tcp_cookie_size, socket option TCP_COOKIE_TRANSACTIONS
Quoted 7 lines · David Miller
From: William Allen Simpson <[email protected]>
Date: Fri, 20 Nov 2009 09:33:51 -0500Quoted 4 lines
net/ipv4/tcp_output.c +0
-0@@ -59,6 +59,14 @@ int sysctl_tcp_base_mss __read_mostly = 512;/* By default, RFC2861 behavior. */ int sysctl_tcp_slow_start_after_idle__read_mostly =1 ;
Quoted 12 lines
net/ipv4/tcp_output.c int sysctl_tcp_base_mss __read_mostly = 512; · line 68
Quoted 7 lines
net/ipv4/tcp_output.c +7
-0+#ifdef CONFIG_SYSCTL +/* By default, let the user enable it. */ +int sysctl_tcp_cookie_size__read_mostly =0 ; +#else +int sysctl_tcp_cookie_size__read_mostly =TCP_COOKIE_MAX ; +#endif +I would prefer if the default did not depend upon whether SYSCTL is enabled or not. That's extremely non-intuitive.
This code was based on net/ipv4/tcp_minisocks.c for syncookies. Apparently, default for syncookies has been controversial.
Would you accept always default to TCP_COOKIE_MAX?
The code already automatically reduces the size of the cookie to match available space in the TCP options (part 1f).
David Miller
maintainerRe: [net-next-2.6 PATCH v7 3/7 RFC] TCPCT part 1c: sysctl_tcp_cookie_size, socket option TCP_COOKIE_TRANSACTIONS
From: William Allen Simpson <[email protected]>
Date: Sat, 21 Nov 2009 11:51:13 -0500
Quoted 2 lines
This code was based on
net/ipv4/tcp_minisocks.cfor syncookies. Apparently, default for syncookies has been controversial.
I'll have to change that, it doesn't make any sense. Thanks for pointing it out.
Quoted 1 line
Would you accept always default to
TCP_COOKIE_MAX?
Sure, let's see what breaks.
David Miller
maintainerRe: [net-next-2.6 PATCH v7 3/7 RFC] TCPCT part 1c: sysctl_tcp_cookie_size, socket option TCP_COOKIE_TRANSACTIONS
From: David Miller <[email protected]>
Date: Sat, 21 Nov 2009 11:18:44 -0800 (PST)
Quoted 8 lines
From: William Allen Simpson <[email protected]>
Date: Sat, 21 Nov 2009 11:51:13 -0500Quoted 2 lines
This code was based on
net/ipv4/tcp_minisocks.cfor syncookies. Apparently, default for syncookies has been controversial.I'll have to change that, it doesn't make any sense. Thanks for pointing it out.
Ok, here's what I'll push out to net-next-2.6, thanks again.
tcp: Don't make syn cookies initial setting depend on CONFIG_SYSCTL
That's extremely non-intuitive, noticed by William Allen Simpson.
And let's make the default be on, it's been suggested by a lot of people so we'll give it a try.
--- net/ipv4/tcp_minisocks.c | 8 +------- 1 files changed, 1 insertions(+), 7 deletions(-)
net/ipv4/tcp_minisocks.c +1 -7
@@ -26,13 +26,7 @@#include <net/inet_common.h> #include <net/xfrm.h> -#ifdef CONFIG_SYSCTL -#define SYNC_INIT 0/* let the user enable it */ -#else -#define SYNC_INIT 1 -#endif - -int sysctl_tcp_syncookies__read_mostly =SYNC_INIT ; +int sysctl_tcp_syncookies__read_mostly =1 ;EXPORT_SYMBOL (sysctl_tcp_syncookies);int sysctl_tcp_abort_on_overflow__read_mostly ;
Signature · 1 line
1.6.5.3
Re: [net-next-2.6 PATCH v7 3/7 RFC] TCPCT part 1c: sysctl_tcp_cookie_size, socket option TCP_COOKIE_TRANSACTIONS
In reply to David MillerQuoted 9 lines · David Miller
From: William Allen Simpson <[email protected]>
Date: Sat, 21 Nov 2009 11:51:13 -0500Quoted 2 lines
This code was based on
net/ipv4/tcp_minisocks.cfor syncookies. Apparently, default for syncookies has been controversial.I'll have to change that, it doesn't make any sense. Thanks for pointing it out.
Once again, for the umpteenth time, I learn that existing code proves to be a bad example to follow....
Quoted 4 lines
Quoted 1 line
Would you accept always default to
TCP_COOKIE_MAX?Sure, let's see what breaks.
Unlikely to break anything, according to studies of the subject:
Medina, A., Allman, M., and Floyd, S., "Measuring Interactions Between Transport Protocols and Middleboxes", Proceedings 4th ACM SIGCOMM/USENIX Conference on Internet Measurement, October 2004. http://www.icsi.berkeley.edu/pubs/networking/tbit-
Aug2004.pdf
TCPCT part 2 is much more likely to break things....
RFC PATCH v7 4/7 TCPCT part 1d: define TCP cookie option, extend existing struct's
In reply to William Allen SimpsonData structures are carefully composed to require minimal additions. For example, the struct tcp_options_received cookie_plus variable fits between existing 16-bit and 8-bit variables, requiring no additional space (taking alignment into consideration). There are no additions to tcp_request_sock, and only 1 pointer in tcp_sock.
This is a significantly revised implementation of an earlier (year-old) patch that no longer applies cleanly, with permission of the original author (Adam Langley):
http://thread.gmane.org/gmane.linux.network/102586
The principle difference is using a TCP option to carry the cookie nonce, instead of a user configured offset in the data. This is more flexible and less subject to user configuration error. Such a cookie option has been suggested for many years, and is also useful without SYN data, allowing several related concepts to use the same extension option.
"Re: SYN floods (was: does history repeat itself?)", September 9, 1996.
http://www.merit.net/mail.archives/nanog/1996-09/msg00235.html
"Re: what a new TCP header might look like", May 12, 1998. ftp://ftp.isi.edu/end2end/end2end-interest-1998.mail
These functions will also be used in subsequent patches that implement additional features.
Requires:
TCPCT part 1a: add request_values parameter for sending SYNACK TCPCT part 1b: generate Responder Cookie secret
TCPCT part 1c: sysctl_tcp_cookie_size, socket option TCP_COOKIE_TRANSACTIONS
--- include/linux/tcp.h | 29 +++++++++++++--- include/net/tcp.h | 83 ++++++++++++++++++++++++++++++++++++++++++++++ net/ipv4/tcp_ipv4.c | 20 +++++++++++ net/ipv4/tcp_minisocks.c | 46 +++++++++++++++++++++---- net/ipv6/tcp_ipv6.c | 13 +++++++ 5 files changed, 177 insertions(+), 14 deletions(-)
include/linux/tcp.h +23 -6
@@ -247,31 +247,38 @@ struct tcp_options_received { sack_ok : 4, /* SACK seen on SYN packet */ snd_wscale : 4, /* Window scaling received from sender */ rcv_wscale : 4; /* Window scaling to send to receiver */ -/* SACKs data */ + u8 cookie_plus:6, /* bytes in authenticator/cookie option */ + cookie_out_never:1, + cookie_in_always:1;u8 num_sacks;/* Number of SACK blocks */ -u16 user_mss;/* mss requested by user in ioctl */ +u16 user_mss;/* mss requested by user in ioctl */ u16 mss_clamp;/* Maximal mss, negotiated at connection setup */ };static inline void tcp_clear_options (struct tcp_options_received *rx_opt) { - rx_opt->tstamp_ok = rx_opt->sack_ok = rx_opt->wscale_ok = rx_opt->snd_wscale =0 ; + rx_opt->tstamp_ok = rx_opt->sack_ok =0 ; + rx_opt->wscale_ok = rx_opt->snd_wscale =0 ; + rx_opt->cookie_plus =0 ; }/* This is the max number of SACKS that we'll generate and process. It's safe -* to increse this, although since: +* to increase this, although since: * size = TCPOLEN_SACK_BASE_ALIGNED (4) + n * TCPOLEN_SACK_PERBLOCK (8) * only four options will fit in a standard TCP header */ #define TCP_NUM_SACKS 4 +struct tcp_cookie_values ; +struct tcp_request_sock_ops ; +struct tcp_request_sock {struct inet_request_sock req;#ifdef CONFIG_TCP_MD5SIG /* Only used by TCP MD5 Signature so far. */ const struct tcp_request_sock_ops *af_specific;#endif -u32 rcv_isn; -u32 snt_isn; +u32 rcv_isn; +u32 snt_isn; };static inline struct tcp_request_sock *tcp_rsk (const struct request_sock *req)
@@ -441,6 +448,12 @@ struct tcp_sock {/* TCP MD5 Signature Option information */ struct tcp_md5sig_info *md5sig_info;#endif + +/* When the cookie options are generated and exchanged, then this +* object holds a reference to them (cookie_values->kref). Also +* contains related tcp_cookie_transactions fields. +*/ +struct tcp_cookie_values *cookie_values; };static inline struct tcp_sock *tcp_sk (const struct sock *sk)
@@ -459,6 +472,10 @@ struct tcp_timewait_sock {u16 tw_md5_keylen;u8 tw_md5_key[TCP_MD5SIG_MAXKEYLEN ];#endif +/* Few sockets in timewait have cookies; in that case, then this +* object holds a reference to them (tw_cookie_values->kref). +*/ +struct tcp_cookie_values *tw_cookie_values; };static inline struct tcp_timewait_sock *tcp_twsk (const struct sock *sk)
include/net/tcp.h +83 -0
107 lines not on this page · raw message
net/ipv4/tcp_ipv4.c +20 -0
@@ -1834,6 +1834,19 @@ static int tcp_v4_init_sock(struct sock *sk) tp->af_specific = &tcp_sock_ipv4_specific;#endif +/* TCP Cookie Transactions */ +if (sysctl_tcp_cookie_size >0 ) { +/* Default, cookies without s_data_payload. */ + tp->cookie_values = +kzalloc (sizeof (*tp->cookie_values), + sk->sk_allocation); +if (tp->cookie_values !=NULL ) +kref_init (&tp->cookie_values->kref); + } +/* Presumed zeroed, in order of appearance: +* cookie_in_always, cookie_out_never, +* s_data_constant, s_data_in, s_data_out +*/ sk->sk_sndbuf = sysctl_tcp_wmem[1 ]; sk->sk_rcvbuf = sysctl_tcp_rmem[1 ];
@@ -1887,6 +1900,13 @@ void tcp_v4_destroy_sock(struct sock *sk) sk->sk_sndmsg_page =NULL ; } +/* TCP Cookie Transactions */ +if (tp->cookie_values !=NULL ) { +kref_put (&tp->cookie_values->kref, + tcp_cookie_values_release); + tp->cookie_values =NULL ; + } +percpu_counter_dec (&tcp_sockets_allocated); }
net/ipv4/tcp_minisocks.c +38 -8
67 lines not on this page · raw message
net/ipv6/tcp_ipv6.c +13 -0
@@ -1865,6 +1865,19 @@ static int tcp_v6_init_sock(struct sock *sk) tp->af_specific = &tcp_sock_ipv6_specific;#endif +/* TCP Cookie Transactions */ +if (sysctl_tcp_cookie_size >0 ) { +/* Default, cookies without s_data_payload. */ + tp->cookie_values = +kzalloc (sizeof (*tp->cookie_values), + sk->sk_allocation); +if (tp->cookie_values !=NULL ) +kref_init (&tp->cookie_values->kref); + } +/* Presumed zeroed, in order of appearance: +* cookie_in_always, cookie_out_never, +* s_data_constant, s_data_in, s_data_out +*/ sk->sk_sndbuf = sysctl_tcp_wmem[1 ]; sk->sk_rcvbuf = sysctl_tcp_rmem[1 ];
Signature · 1 line
1.6.3.3
David Miller
maintainerRe: [net-next-2.6 PATCH v7 4/7 RFC] TCPCT part 1d: define TCP cookie option, extend existing struct's
From: William Allen Simpson <[email protected]>
Date: Fri, 20 Nov 2009 09:38:12 -0500
include/linux/tcp.h struct tcp_options_received { · line 263
Quoted 8 lines
static inline void
tcp_clear_options(struct tcp_options_received *rx_opt){include/linux/tcp.h +3
-1- rx_opt->tstamp_ok = rx_opt->sack_ok = rx_opt->wscale_ok = rx_opt->snd_wscale =0 ; + rx_opt->tstamp_ok = rx_opt->sack_ok =0 ; + rx_opt->wscale_ok = rx_opt->snd_wscale =0 ; + rx_opt->cookie_plus =0 ; }
Why not get the coding style correct wrt. long lines in patch #3 where you initially added this function, rather than fixing it here as you add the new ->cookie_plus assignment?
Re: [net-next-2.6 PATCH v7 4/7 RFC] TCPCT part 1d: define TCP cookie option, extend existing struct's
Quoted 16 lines · David Miller
From: William Allen Simpson <[email protected]>
Date: Fri, 20 Nov 2009 09:38:12 -0500include/linux/tcp.h struct tcp_options_received { · line 263
Quoted 8 lines
static inline void
tcp_clear_options(struct tcp_options_received *rx_opt){include/linux/tcp.h +3
-1- rx_opt->tstamp_ok = rx_opt->sack_ok = rx_opt->wscale_ok = rx_opt->snd_wscale =0 ; + rx_opt->tstamp_ok = rx_opt->sack_ok =0 ; + rx_opt->wscale_ok = rx_opt->snd_wscale =0 ; + rx_opt->cookie_plus =0 ; }Why not get the coding style correct wrt. long lines in patch #3 where you initially added this function, rather than fixing it here as you add the new ->cookie_plus assignment?
Documentation/SubmittingPatches at 619:
One significant exception is when moving code from one file to another -- in this case you should not modify the moved code at all in the same patch which moves it. This clearly delineates the act of moving the code and your changes. This greatly aids review of the actual differences and allows tools to better track the history of the code itself.
RFC PATCH v7 5/7 TCPCT part 1e: implement socket option TCP_COOKIE_TRANSACTIONS
In reply to William Allen SimpsonProvide per socket control of the TCP cookie option and SYN/SYNACK data.
This is a straightforward re-implementation of an earlier (year-old) patch that no longer applies cleanly, with permission of the original author (Adam Langley):
http://thread.gmane.org/gmane.linux.network/102586
The principle difference is using a TCP option to carry the cookie nonce, instead of a user configured offset in the data.
Allocations have been rearranged to avoid requiring GFP_ATOMIC.
Requires:
net: TCP_MSS_DEFAULT, TCP_MSS_DESIRED
TCPCT part 1c: sysctl_tcp_cookie_size, socket option TCP_COOKIE_TRANSACTIONS TCPCT part 1d: define TCP cookie option, extend existing struct's
--- net/ipv4/tcp.c | 133 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 131 insertions(+), 2 deletions(-)
net/ipv4/tcp.c +131 -2
@@ -2084,8 +2084,9 @@ static int do_tcp_setsockopt(struct sock *sk, int level,int val;int err =0 ; -/* This is a string value all the others are int's */ -if (optname ==TCP_CONGESTION ) { +/* These are data/string values, all the others are ints */ +switch (optname) { +case TCP_CONGESTION : {char name[TCP_CA_NAME_MAX ];if (optlen <1 )
@@ -2102,6 +2103,93 @@ static int do_tcp_setsockopt(struct sock *sk, int level,release_sock (sk);return err; } +case TCP_COOKIE_TRANSACTIONS : { +struct tcp_cookie_transactions ctd; +struct tcp_cookie_values *cvp =NULL ; + +if (sizeof (ctd) > optlen) +return -EINVAL ; +if (copy_from_user (&ctd, optval,sizeof (ctd))) +return -EFAULT ; + +if (ctd.tcpct_used >sizeof (ctd.tcpct_value) + || ctd.tcpct_s_data_desired >TCP_MSS_DESIRED ) +return -EINVAL ; + +if (ctd.tcpct_cookie_desired ==0 ) { +/* default to global value */ + }else if ((0x1 & ctd.tcpct_cookie_desired) + || ctd.tcpct_cookie_desired >TCP_COOKIE_MAX + || ctd.tcpct_cookie_desired <TCP_COOKIE_MIN ) { +return -EINVAL ; + } + +if (TCP_COOKIE_OUT_NEVER & ctd.tcpct_flags) { +/* Supercedes all other values */ +lock_sock (sk); +if (tp->cookie_values !=NULL ) { +kref_put (&tp->cookie_values->kref, + tcp_cookie_values_release); + tp->cookie_values =NULL ; + } + tp->rx_opt.cookie_in_always =0 ;/* false */ + tp->rx_opt.cookie_out_never =1 ;/* true */ +release_sock (sk); +return err; + } + +/* Allocate ancillary memory before locking. +*/ +if (ctd.tcpct_used >0 + || (tp->cookie_values ==NULL + && (sysctl_tcp_cookie_size >0 + || ctd.tcpct_cookie_desired >0 + || ctd.tcpct_s_data_desired >0 ))) { + cvp =kzalloc (sizeof (*cvp) + ctd.tcpct_used, +GFP_KERNEL ); +if (cvp ==NULL ) +return -ENOMEM ; + } +lock_sock (sk); + tp->rx_opt.cookie_in_always = + (TCP_COOKIE_IN_ALWAYS & ctd.tcpct_flags); + tp->rx_opt.cookie_out_never =0 ;/* false */ + +if (tp->cookie_values !=NULL ) { +if (cvp !=NULL ) { +/* Changed values are recorded by a changed +* pointer, ensuring the cookie will differ, +* without separately hashing each value later. +*/ +kref_put (&tp->cookie_values->kref, + tcp_cookie_values_release); +kref_init (&cvp->kref); + tp->cookie_values = cvp; + }else { + cvp = tp->cookie_values; + } + } +if (cvp !=NULL ) { + cvp->cookie_desired = ctd.tcpct_cookie_desired; + +if (ctd.tcpct_used >0 ) { +memcpy (cvp->s_data_payload, ctd.tcpct_value, + ctd.tcpct_used); + cvp->s_data_desired = ctd.tcpct_used; + cvp->s_data_constant =1 ;/* true */ + }else { +/* No constant payload data. */ + cvp->s_data_desired = ctd.tcpct_s_data_desired; + cvp->s_data_constant =0 ;/* false */ + } + } +release_sock (sk); +return err; + } +default : +/* fallthru */ +break ; + };if (optlen <sizeof (int ))return -EINVAL ;
@@ -2426,6 +2514,47 @@ static int do_tcp_getsockopt(struct sock *sk, int level,if (copy_to_user (optval, icsk->icsk_ca_ops->name, len))return -EFAULT ;return 0 ; + +case TCP_COOKIE_TRANSACTIONS : { +struct tcp_cookie_transactions ctd; +struct tcp_cookie_values *cvp = tp->cookie_values; + +if (get_user (len, optlen)) +return -EFAULT ; +if (len <sizeof (ctd)) +return -EINVAL ; + +memset (&ctd,0 ,sizeof (ctd)); + ctd.tcpct_flags = (tp->rx_opt.cookie_in_always + ?TCP_COOKIE_IN_ALWAYS :0 ) + | (tp->rx_opt.cookie_out_never + ?TCP_COOKIE_OUT_NEVER :0 ); + +if (cvp !=NULL ) { + ctd.tcpct_flags |= (cvp->s_data_in + ?TCP_S_DATA_IN :0 ) + | (cvp->s_data_out + ?TCP_S_DATA_OUT :0 ); + + ctd.tcpct_cookie_desired = cvp->cookie_desired; + ctd.tcpct_s_data_desired = cvp->s_data_desired; + +/* Cookie(s) saved, return as nonce */ +if (sizeof (ctd.tcpct_value) < cvp->cookie_pair_size) { +/* impossible? */ +return -EINVAL ; + } +memcpy (&ctd.tcpct_value[0 ], &cvp->cookie_pair[0 ], + cvp->cookie_pair_size); + ctd.tcpct_used = cvp->cookie_pair_size; + } + +if (put_user (sizeof (ctd), optlen)) +return -EFAULT ; +if (copy_to_user (optval, &ctd,sizeof (ctd))) +return -EFAULT ; +return 0 ; + }default :return -ENOPROTOOPT ; }
Signature · 1 line
1.6.3.3
David Miller
maintainerRe: [net-next-2.6 PATCH v7 5/7 RFC] TCPCT part 1e: implement socket option TCP_COOKIE_TRANSACTIONS
From: William Allen Simpson <[email protected]>
Date: Fri, 20 Nov 2009 09:48:12 -0500
net/ipv4/tcp.c static int do_tcp_setsockopt(struct sock *sk, int level, · line 2117
Quoted 3 lines
net/ipv4/tcp.c +3
-0+if (ctd.tcpct_used >sizeof (ctd.tcpct_value) + || ctd.tcpct_s_data_desired >TCP_MSS_DESIRED ) +return -EINVAL ;
Please fix this conditional coding style.
net/ipv4/tcp.c static int do_tcp_setsockopt(struct sock *sk, int level, · line 2124
Quoted 4 lines
net/ipv4/tcp.c +4
-0+ }else if ((0x1 & ctd.tcpct_cookie_desired) + || ctd.tcpct_cookie_desired >TCP_COOKIE_MAX + || ctd.tcpct_cookie_desired <TCP_COOKIE_MIN ) { +return -EINVAL ;
Same here.
net/ipv4/tcp.c static int do_tcp_setsockopt(struct sock *sk, int level, · line 2147
Quoted 5 lines
net/ipv4/tcp.c +5
-0+if (ctd.tcpct_used >0 + || (tp->cookie_values ==NULL + && (sysctl_tcp_cookie_size >0 + || ctd.tcpct_cookie_desired >0 + || ctd.tcpct_s_data_desired >0 ))) {
Please fix the conditional coding style, and the alignment of the lines, it's not right here.
net/ipv4/tcp.c static int do_tcp_getsockopt(struct sock *sk, int level, · line 2531
Quoted 4 lines
net/ipv4/tcp.c +4
-0+ ctd.tcpct_flags = (tp->rx_opt.cookie_in_always + ?TCP_COOKIE_IN_ALWAYS :0 ) + | (tp->rx_opt.cookie_out_never + ?TCP_COOKIE_OUT_NEVER :0 );
"?" should be at end of previous line not at beginning of next one, please fix this up.
Thanks.
Re: [net-next-2.6 PATCH v7 5/7 RFC] TCPCT part 1e: implement socket option TCP_COOKIE_TRANSACTIONS
Quoted 8 lines · David Miller
From: William Allen Simpson <[email protected]>
net/ipv4/tcp.c static int do_tcp_getsockopt(struct sock *sk, int level, · line 2531
Quoted 4 lines
net/ipv4/tcp.c +4
-0+ ctd.tcpct_flags = (tp->rx_opt.cookie_in_always + ?TCP_COOKIE_IN_ALWAYS :0 ) + | (tp->rx_opt.cookie_out_never + ?TCP_COOKIE_OUT_NEVER :0 );"?" should be at end of previous line not at beginning of next one, please fix this up.
Perhaps the ? position is taster's choice.
(false positives exist)
$ grep -rP --include=*.[ch] "^\s*\?" * | wc -l 884
$ grep -rP --include=*.[ch] -h "\?\s*$" * | \ grep -vP "^\s*\*" | grep -vP "(//|/\*)" | wc -l 2968
Re: [net-next-2.6 PATCH v7 5/7 RFC] TCPCT part 1e: implement socket option TCP_COOKIE_TRANSACTIONS
In reply to David MillerQuoted 11 lines · David Miller
From: William Allen Simpson <[email protected]>
Date: Fri, 20 Nov 2009 09:48:12 -0500net/ipv4/tcp.c static int do_tcp_setsockopt(struct sock *sk, int level, · line 2147
Quoted 5 lines
net/ipv4/tcp.c +5
-0+if (ctd.tcpct_used >0 + || (tp->cookie_values ==NULL + && (sysctl_tcp_cookie_size >0 + || ctd.tcpct_cookie_desired >0 + || ctd.tcpct_s_data_desired >0 ))) {Please fix the conditional coding style, and the alignment of the lines, it's not right here.
Eliding the repeated assertions, and focusing on this example. This is not addressed (nor forbidden) in CodingStyle.
As Joe noted earlier with '?' and ':', there are ample examples throughout the code base of this style, including here and there among the tcp*.c files. Obviously, this is very easy to read!
Coding style is all about readability and maintainability using commonly available tools.
However, grep shows that the "||" or "&&" is elsewhere most often indented 4 for each level (although there is some inconsistency). Either 1, 2, or 4 distinguishes <condition> indentation from <statements> indented by tab (8).
In my experience, I've found 1 best, as that lines up variables and parentheses levels, and it's easy to type. But it certainly would be easy enough to indent by 2 or 4 instead.
BTW, the 'indent' program turns this into incomprehensible and unmaintainable garbage. Of course, there are ample examples of garbage in these tcp*.c files, too.... :-(
Therefore, David, would indentation of 2 or 4 be preferable here?
Re: [net-next-2.6 PATCH v7 5/7 RFC] TCPCT part 1e: implement socket option TCP_COOKIE_TRANSACTIONS
Quoted 11 lines · William Allen Simpson
Quoted 9 lines · David Miller
From: William Allen Simpson <[email protected]>
Date: Fri, 20 Nov 2009 09:48:12 -0500net/ipv4/tcp.c static int do_tcp_setsockopt(struct sock *sk, int level, · line 2147
Quoted 5 lines
net/ipv4/tcp.c +5
-0+if (ctd.tcpct_used >0 + || (tp->cookie_values ==NULL + && (sysctl_tcp_cookie_size >0 + || ctd.tcpct_cookie_desired >0 + || ctd.tcpct_s_data_desired >0 ))) {Please fix the conditional coding style, and the alignment of the lines, it's not right here.
David, would indentation of 2 or 4 be preferable here?
Hi William.
I think the rather significantly majority style, especially for net/... is to use || and && at the end of the line rather than the start and it should be used.
Treewide:
$ grep -rP --include=*.[ch] "(\|\||\&\&)\s*$" * | wc -l 34180
$ grep -rP --include=*.[ch] "^\s*(\|\||\&\&)" * | wc -l 7855
net: 3859 to 382 (more than 10:1, so it's the one to follow) drivers/net: 4610 to 666
Besides, it's the one David wants...
cheers, Joe
Re: [net-next-2.6 PATCH v7 5/7 RFC] TCPCT part 1e: implement socket option TCP_COOKIE_TRANSACTIONS
Quoted 18 lines · Joe Perches
Quoted 10 lines · William Allen Simpson
Quoted 9 lines · David Miller
From: William Allen Simpson <[email protected]>
Date: Fri, 20 Nov 2009 09:48:12 -0500net/ipv4/tcp.c static int do_tcp_setsockopt(struct sock *sk, int level, · line 2147
Quoted 5 lines
net/ipv4/tcp.c +5
-0+if (ctd.tcpct_used >0 + || (tp->cookie_values ==NULL + && (sysctl_tcp_cookie_size >0 + || ctd.tcpct_cookie_desired >0 + || ctd.tcpct_s_data_desired >0 ))) {Please fix the conditional coding style, and the alignment of the lines, it's not right here.
I think the rather significantly majority style, especially for
net/... is to use || and && at the end of the line rather than the start and it should be used.Treewide:
Quoted 9 lines
$ grep -rP --include=*.[ch] "(\|\||\&\&)\s*$" * | wc -l 34180$ grep -rP --include=*.[ch] "^\s*(\|\||\&\&)" * | wc -l 7855net: 3859 to 382 (more than 10:1, so it's the one to follow)
drivers/net: 4610 to 666
Thanks for measuring.
I'll note that during the previous review back at the v4 round, you (Joe) passed along a formerly private message from Linus expressing his preference for variable lvalues:
http://www.spinics.net/lists/netdev/msg111212.html
But my example code in that thread also had both leading && and || -- and neither David nor Eric nor Ilpo nor you mentioned that as an issue in that entire thread:
http://www.spinics.net/lists/netdev/msg111172.html
In the previous plaint about lvalues, there were merely 500+ examples using the same constant lvalue form as my code -- in arch, drivers, net, and sound. For this example, many *thousands* are found everywhere!
Therefore, it's plain as can be that this is just more jumping through arbitrary and capricious hoops that others are not required to follow.
Quoted 2 lines
Besides, it's the one David wants...
At *thousands* of examples, including in the tcp*.c files themselves, it really becomes obvious that that may be a personal preference of David, but is *not* a tree-wide or even a net-wide coding style.
However, a private message to me nearly 2 months ago expressed:
"As unpalatable as it may be, all the more reason to genuflect as required to get the changes into the net-next-2.6 tree so they will flow down to future distros."
I followed that advice for a month. That last patch submitted for inclusion was v4 on Oct 27th. Then, as some have noticed, I quit using the net-next tree for actual development. I've only sent weekly RFC versions to solicit more widespread comments from subject matter experts, and keep the patch offsets in sync with the rapidly changing tree.
As a more recent private comment asked:
"So your frustration is nothing but normal. And guess what ? Few people accept the challenge, so keep trying !"
So, I'll try again now, with the assurance that this is the final hoop.
Re: [net-next-2.6 PATCH v7 5/7 RFC] TCPCT part 1e: implement socket option TCP_COOKIE_TRANSACTIONS
Quoted 5 lines · William Allen Simpson
Therefore, it's plain as can be that this is just more jumping through arbitrary and capricious hoops that others are not required to follow. At *thousands* of examples, including in the tcp*.c files themselves, it really becomes obvious that that may be a personal preference of David, but is *not* a tree-wide or even a net-wide coding style.
It seems similar kernel source uses are mostly historic.
Relatively little new code is added with leading || or &&. There is some in staging/, but it normally gets removed.
Quoted 1 line
So, I'll try again now, with the assurance that this is the final hoop.
Once more into the breach or men of few words are the best men? I'll stop typing now...
David Miller
maintainerRe: [net-next-2.6 PATCH v7 5/7 RFC] TCPCT part 1e: implement socket option TCP_COOKIE_TRANSACTIONS
In reply to William Allen SimpsonFrom: William Allen Simpson <[email protected]>
Date: Mon, 23 Nov 2009 06:16:03 -0500
Quoted 2 lines
Therefore, it's plain as can be that this is just more jumping through arbitrary and capricious hoops that others are not required to follow.
Others, like Eric and Ilpo, don't have to jump through these hoops because when they submit patches their code doesn't have coding style issues like your's does.
Trust me, it's not about you, and you're not being picked out specifically. These things would be enforced upon anyone. The only unique aspect about you is that you seem to respond to these requirements in the most sour manner possible rather than pleasantly complying and thus getting your changes added to the tree.
David Miller
maintainerRe: [net-next-2.6 PATCH v7 5/7 RFC] TCPCT part 1e: implement socket option TCP_COOKIE_TRANSACTIONS
In reply to William Allen SimpsonFrom: William Allen Simpson <[email protected]>
Date: Sun, 22 Nov 2009 01:25:43 -0500
Quoted 1 line
Therefore, David, would indentation of 2 or 4 be preferable here?
It should be of the form:
if (x && y)
or:
if (x && y)
Fix patches, rather than complaints, for existing cases where things do not follow this pattern are cetainly welcome.
PATCH 1/1 net/ipv4: Move && and || to end of previous line
Quoted 9 lines · David Miller
It should be of the form:
if (x && y)or:
if (x && y)Fix patches, rather than complaints, for existing cases where things do not follow this pattern are certainly welcome.
Also collapsed some multiple tabs to single space.
Compiled tested only:
net/ipv4/inet_lro.c | 36 ++++++++++++++++++------------------ net/ipv4/ip_output.c | 6 ++++-- net/ipv4/ipconfig.c | 13 ++++++------- net/ipv4/route.c | 19 ++++++++++--------- net/ipv4/tcp_htcp.c | 10 +++++----- net/ipv4/tcp_input.c | 4 ++-- net/ipv4/tcp_lp.c | 4 ++-- net/ipv4/tcp_output.c | 4 ++-- net/ipv4/tcp_probe.c | 4 ++-- net/ipv4/tcp_veno.c | 5 ++--- net/ipv4/tcp_yeah.c | 4 ++-- net/ipv4/udp.c | 36 ++++++++++++++++++------------------ 12 files changed, 73 insertions(+), 72 deletions(-)
net/ipv4/inet_lro.c +18 -18
@@ -64,15 +64,15 @@ static int lro_tcp_ip_check(struct iphdr *iph, struct tcphdr *tcph,if (iph->ihl !=IPH_LEN_WO_OPTIONS )return -1 ; -if (tcph->cwr || tcph->ece || tcph->urg || !tcph->ack - || tcph->rst || tcph->syn || tcph->fin) +if (tcph->cwr || tcph->ece || tcph->urg || !tcph->ack || + tcph->rst || tcph->syn || tcph->fin)return -1 ;if (INET_ECN_is_ce (ipv4_get_dsfield (iph)))return -1 ; -if (tcph->doff !=TCPH_LEN_WO_OPTIONS - && tcph->doff !=TCPH_LEN_W_TIMESTAMP ) +if (tcph->doff !=TCPH_LEN_WO_OPTIONS && + tcph->doff !=TCPH_LEN_W_TIMESTAMP )return -1 ;/* check tcp options (only timestamp allowed) */
@@ -262,10 +262,10 @@ static int lro_check_tcp_conn(struct net_lro_desc *lro_desc, struct iphdr *iph, struct tcphdr *tcph) { -if ((lro_desc->iph->saddr != iph->saddr) - || (lro_desc->iph->daddr != iph->daddr) - || (lro_desc->tcph->source != tcph->source) - || (lro_desc->tcph->dest != tcph->dest)) +if ((lro_desc->iph->saddr != iph->saddr) || + (lro_desc->iph->daddr != iph->daddr) || + (lro_desc->tcph->source != tcph->source) || + (lro_desc->tcph->dest != tcph->dest))return -1 ;return 0 ; }
@@ -339,9 +339,9 @@ static int __lro_proc_skb(struct net_lro_mgr *lro_mgr, struct sk_buff *skb,u64 flags;int vlan_hdr_len =0 ; -if (!lro_mgr->get_skb_header - || lro_mgr->get_skb_header (skb, (void *)&iph, (void *)&tcph, - &flags, priv)) +if (!lro_mgr->get_skb_header || + lro_mgr->get_skb_header (skb, (void *)&iph, (void *)&tcph, + &flags, priv)) goto out;if (!(flags &LRO_IPV4 ) || !(flags &LRO_TCP ))
@@ -351,8 +351,8 @@ static int __lro_proc_skb(struct net_lro_mgr *lro_mgr, struct sk_buff *skb,if (!lro_desc) goto out; -if ((skb->protocol ==htons (ETH_P_8021Q )) - && !(lro_mgr->features &LRO_F_EXTRACT_VLAN_ID )) +if ((skb->protocol ==htons (ETH_P_8021Q )) && + !(lro_mgr->features &LRO_F_EXTRACT_VLAN_ID )) vlan_hdr_len =VLAN_HLEN ;if (!lro_desc->active) {/* start new lro session */
@@ -446,9 +446,9 @@ static struct sk_buff *__lro_proc_segment(struct net_lro_mgr *lro_mgr,int hdr_len =LRO_MAX_PG_HLEN ;int vlan_hdr_len =0 ; -if (!lro_mgr->get_frag_header - || lro_mgr->get_frag_header (frags, (void *)&mac_hdr, (void *)&iph, - (void *)&tcph, &flags, priv)) { +if (!lro_mgr->get_frag_header || + lro_mgr->get_frag_header (frags, (void *)&mac_hdr, (void *)&iph, + (void *)&tcph, &flags, priv)) { mac_hdr =page_address (frags->page) + frags->page_offset; goto out1; }
@@ -472,8 +472,8 @@ static struct sk_buff *__lro_proc_segment(struct net_lro_mgr *lro_mgr,if (!skb) goto out; -if ((skb->protocol ==htons (ETH_P_8021Q )) - && !(lro_mgr->features &LRO_F_EXTRACT_VLAN_ID )) +if ((skb->protocol ==htons (ETH_P_8021Q )) && + !(lro_mgr->features &LRO_F_EXTRACT_VLAN_ID )) vlan_hdr_len =VLAN_HLEN ; iph = (void *)(skb->data + vlan_hdr_len);
net/ipv4/ip_output.c +4 -2
@@ -264,9 +264,11 @@ int ip_mc_output(struct sk_buff *skb)This check is duplicated in ip_mr_input at the moment. */ - && ((rt->rt_flags&RTCF_LOCAL) || !(IPCB(skb)->flags&IPSKB_FORWARDED)) + && + ((rt->rt_flags & RTCF_LOCAL) || + !(IPCB(skb)->flags & IPSKB_FORWARDED)) #endif - ) { + ) {struct sk_buff *newskb =skb_clone (skb,GFP_ATOMIC );if (newskb) NF_HOOK(PF_INET, NF_INET_POST_ROUTING, newskb,
net/ipv4/ipconfig.c +6 -7
@@ -1172,10 +1172,9 @@ static int __init ic_dynamic(void)schedule_timeout_uninterruptible (1 );#ifdef IPCONFIG_DHCP /* DHCP isn't done until we get a DHCPACK. */ -if ((ic_got_reply &IC_BOOTP ) - && (ic_proto_enabled &IC_USE_DHCP ) - && ic_dhcp_msgtype !=DHCPACK ) - { +if ((ic_got_reply &IC_BOOTP ) && + (ic_proto_enabled &IC_USE_DHCP ) && + ic_dhcp_msgtype !=DHCPACK ) { ic_got_reply =0 ;printk ("," );continue ;
@@ -1344,9 +1343,9 @@ static int __init ip_auto_config(void)*/ if (ic_myaddr ==NONE || #ifdef CONFIG_ROOT_NFS - (root_server_addr ==NONE - && ic_servaddr ==NONE - &&ROOT_DEV == Root_NFS) || + (root_server_addr ==NONE && + ic_servaddr ==NONE && +ROOT_DEV == Root_NFS) || #endif ic_first_dev->next) {#ifdef IPCONFIG_DYNAMIC
net/ipv4/route.c +10 -9
@@ -1346,9 +1346,9 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw,return ; net =dev_net (dev); -if (new_gw == old_gw || !IN_DEV_RX_REDIRECTS (in_dev) - ||ipv4_is_multicast (new_gw) ||ipv4_is_lbcast (new_gw) - ||ipv4_is_zeronet (new_gw)) +if (new_gw == old_gw || !IN_DEV_RX_REDIRECTS (in_dev) || +ipv4_is_multicast (new_gw) ||ipv4_is_lbcast (new_gw) || +ipv4_is_zeronet (new_gw)) goto reject_redirect;if (!rt_caching (net))
@@ -2311,10 +2311,11 @@ skip_cache: ip_hdr(skb)->protocol);if (our #ifdef CONFIG_IP_MROUTE - || (!ipv4_is_local_multicast (daddr) && -IN_DEV_MFORWARD (in_dev)) + || + (!ipv4_is_local_multicast (daddr) && +IN_DEV_MFORWARD (in_dev)) #endif - ) { + ) {rcu_read_unlock ();return ip_route_input_mc (skb, daddr, saddr, tos, dev, our);
@@ -2511,9 +2512,9 @@ static int ip_route_output_slow(struct net *net, struct rtable **rp,of another iface. --ANK */ -if (oldflp->oif ==0 - && (ipv4_is_multicast (oldflp->fl4_dst) || - oldflp->fl4_dst ==htonl (0xFFFFFFFF ))) { +if (oldflp->oif ==0 && + (ipv4_is_multicast (oldflp->fl4_dst) || + oldflp->fl4_dst ==htonl (0xFFFFFFFF ))) {/* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */ dev_out =ip_dev_find (net, oldflp->fl4_src);if (dev_out ==NULL )
net/ipv4/tcp_htcp.c +5 -5
@@ -92,8 +92,8 @@ static inline void measure_rtt(struct sock *sk, u32 srtt)if (icsk->icsk_ca_state == TCP_CA_Open) {if (ca->maxRTT < ca->minRTT) ca->maxRTT = ca->minRTT; -if (ca->maxRTT < srtt - && srtt <= ca->maxRTT +msecs_to_jiffies (20 )) +if (ca->maxRTT < srtt && + srtt <= ca->maxRTT +msecs_to_jiffies (20 )) ca->maxRTT = srtt; } }
@@ -123,9 +123,9 @@ static void measure_achieved_throughput(struct sock *sk, u32 pkts_acked, s32 rtt ca->packetcount += pkts_acked; -if (ca->packetcount >= tp->snd_cwnd - (ca->alpha >>7 ? :1 ) - && now - ca->lasttime >= ca->minRTT - && ca->minRTT >0 ) { +if (ca->packetcount >= tp->snd_cwnd - (ca->alpha >>7 ? :1 ) && + now - ca->lasttime >= ca->minRTT && + ca->minRTT >0 ) {__u32 cur_Bi = ca->packetcount *HZ / (now - ca->lasttime);if (htcp_ccount (ca) <=3 ) {
net/ipv4/tcp_input.c +2 -2
@@ -4852,11 +4852,11 @@ static void __tcp_ack_snd_check(struct sock *sk, int ofo_possible)struct tcp_sock *tp =tcp_sk (sk);/* More than one full frame received... */ - if (((tp->rcv_nxt - tp->rcv_wup) > inet_csk(sk)->icsk_ack.rcv_mss + if (((tp->rcv_nxt - tp->rcv_wup) > inet_csk(sk)->icsk_ack.rcv_mss && /* ... and right edge of window advances far enough. * (tcp_recvmsg() will send ACK otherwise). Or... */ - && __tcp_select_window(sk) >= tp->rcv_wnd) || + __tcp_select_window(sk) >= tp->rcv_wnd) || /* We ACK each frame or... */ tcp_in_quickack_mode(sk) ||/* We have out of order data. */
net/ipv4/tcp_lp.c +2 -2
@@ -143,8 +143,8 @@ static u32 tcp_lp_remote_hz_estimator(struct sock *sk) goto out;/* we can't calc remote HZ with no different!! */ -if (tp->rx_opt.rcv_tsval == lp->remote_ref_time - || tp->rx_opt.rcv_tsecr == lp->local_ref_time) +if (tp->rx_opt.rcv_tsval == lp->remote_ref_time || + tp->rx_opt.rcv_tsecr == lp->local_ref_time) goto out; m = HZ * (tp->rx_opt.rcv_tsval -
net/ipv4/tcp_output.c +2 -2
@@ -1923,8 +1923,8 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)* case, when window is shrunk to zero. In this case * our retransmit serves as a zero window probe. */ -if (!before (TCP_SKB_CB (skb)->seq,tcp_wnd_end (tp)) - &&TCP_SKB_CB (skb)->seq != tp->snd_una) +if (!before (TCP_SKB_CB (skb)->seq,tcp_wnd_end (tp)) && +TCP_SKB_CB (skb)->seq != tp->snd_una)return -EAGAIN ;if (skb->len > cur_mss) {
net/ipv4/tcp_probe.c +2 -2
@@ -95,8 +95,8 @@ static int jtcp_rcv_established(struct sock *sk, struct sk_buff *skb,/* Only update if port matches */ if ((port ==0 ||ntohs (inet->inet_dport) == port || -ntohs (inet->inet_sport) == port) - && (full || tp->snd_cwnd != tcp_probe.lastcwnd)) { +ntohs (inet->inet_sport) == port) && + (full || tp->snd_cwnd != tcp_probe.lastcwnd)) {spin_lock (&tcp_probe.lock);/* If log fills, just silently drop */
net/ipv4/tcp_veno.c +2 -3
@@ -165,9 +165,8 @@ static void tcp_veno_cong_avoid(struct sock *sk, u32 ack, u32 in_flight)* every other rtt. */ if (tp->snd_cwnd_cnt >= tp->snd_cwnd) { -if (veno->inc - && tp->snd_cwnd < - tp->snd_cwnd_clamp) { +if (veno->inc && + tp->snd_cwnd < tp->snd_cwnd_clamp) { tp->snd_cwnd++; veno->inc =0 ; }else
net/ipv4/tcp_yeah.c +2 -2
@@ -157,8 +157,8 @@ static void tcp_yeah_cong_avoid(struct sock *sk, u32 ack, u32 in_flight)if (queue >TCP_YEAH_ALPHA || rtt - yeah->vegas.baseRTT > (yeah->vegas.baseRTT /TCP_YEAH_PHY )) { -if (queue >TCP_YEAH_ALPHA - && tp->snd_cwnd > yeah->reno_count) { +if (queue >TCP_YEAH_ALPHA && + tp->snd_cwnd > yeah->reno_count) {u32 reduction =min (queue /TCP_YEAH_GAMMA , tp->snd_cwnd >>TCP_YEAH_EPSILON );
net/ipv4/udp.c +18 -18
@@ -136,12 +136,12 @@ static int udp_lib_lport_inuse(struct net *net, __u16 num,struct hlist_nulls_node *node;sk_nulls_for_each (sk2, node, &hslot->head) -if (net_eq (sock_net (sk2), net) && - sk2 != sk && +if (net_eq (sock_net (sk2), net) && + sk2 != sk && (bitmap ||udp_sk (sk2)->udp_port_hash == num) && - (!sk2->sk_reuse || !sk->sk_reuse) && - (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if - || sk2->sk_bound_dev_if == sk->sk_bound_dev_if) && + (!sk2->sk_reuse || !sk->sk_reuse) && + (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if || + sk2->sk_bound_dev_if == sk->sk_bound_dev_if) && (*saddr_comp)(sk, sk2)) {if (bitmap) __set_bit(udp_sk(sk2)->udp_port_hash >> log,
@@ -168,12 +168,12 @@ static int udp_lib_lport_inuse2(struct net *net, __u16 num,spin_lock (&hslot2->lock);udp_portaddr_for_each_entry (sk2, node, &hslot2->head) -if (net_eq (sock_net (sk2), net) && - sk2 != sk && - (udp_sk (sk2)->udp_port_hash == num) && - (!sk2->sk_reuse || !sk->sk_reuse) && - (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if - || sk2->sk_bound_dev_if == sk->sk_bound_dev_if) && +if (net_eq (sock_net (sk2), net) && + sk2 != sk && + (udp_sk (sk2)->udp_port_hash == num) && + (!sk2->sk_reuse || !sk->sk_reuse) && + (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if || + sk2->sk_bound_dev_if == sk->sk_bound_dev_if) && (*saddr_comp)(sk, sk2)) { res =1 ;break ;
@@ -545,13 +545,13 @@ static inline struct sock *udp_v4_mcast_next(struct net *net, struct sock *sk,sk_nulls_for_each_from (s, node) {struct inet_sock *inet =inet_sk (s); -if (!net_eq (sock_net (s), net) || -udp_sk (s)->udp_port_hash != hnum || - (inet->inet_daddr && inet->inet_daddr != rmt_addr) || - (inet->inet_dport != rmt_port && inet->inet_dport) || - (inet->inet_rcv_saddr && - inet->inet_rcv_saddr != loc_addr) || -ipv6_only_sock (s) || +if (!net_eq (sock_net (s), net) || +udp_sk (s)->udp_port_hash != hnum || + (inet->inet_daddr && inet->inet_daddr != rmt_addr) || + (inet->inet_dport != rmt_port && inet->inet_dport) || + (inet->inet_rcv_saddr && + inet->inet_rcv_saddr != loc_addr) || +ipv6_only_sock (s) || (s->sk_bound_dev_if && s->sk_bound_dev_if != dif))continue ;if (!ip_mc_sf_allow (s, loc_addr, rmt_addr, dif))
David Miller
maintainerRe: [net-next-2.6 PATCH] net/ipv4: Move && and || to end of previous line
From: Joe Perches <[email protected]>
Date: Mon, 23 Nov 2009 10:28:15 -0800
Quoted 8 lines · David Miller
Quoted 7 lines
It should be of the form:
if (x && y)or:
if (x && y)
Quoted 6 lines
Quoted 2 lines
Fix patches, rather than complaints, for existing cases where things do not follow this pattern are certainly welcome.
Also collapsed some multiple tabs to single space.
Compiled tested only:
Joe, please provide a signoff so I can apply this.
Thanks.
Re: [net-next-2.6 PATCH] net/ipv4: Move && and || to end of previous line
Quoted 3 lines · David Miller
From: Joe Perches <[email protected]>
Quoted 1 line
Compiled tested only:
Joe, please provide a signoff so I can apply this.
Sorry, forgot.
Re: [net-next-2.6 PATCH] net/ipv4: Move && and || to end of previous line
From: Joe Perches <[email protected]>
Date: Mon, 23 Nov 2009 10:38:24 -0800
Quoted 8 lines · David Miller
Quoted 3 lines
From: Joe Perches <[email protected]>
Quoted 1 line
Compiled tested only:
Joe, please provide a signoff so I can apply this.
Sorry, forgot.
Signed-off-by Joe Perches <[email protected]>
Applied, thanks Joe.
PATCH 1/1 net: Move && and || to end of previous line
Not including net/atm/
Compiled tested x86 allyesconfig only
Added a > 80 column line or two, which I ignored. Existing checkpatch plaints willfully, cheerfully ignored.
net/9p/trans_fd.c | 4 ++-- net/bluetooth/l2cap.c | 20 ++++++++++---------- net/bridge/br_fdb.c | 4 ++-- net/bridge/br_sysfs_br.c | 6 +++--- net/bridge/netfilter/ebt_stp.c | 4 ++-- net/can/af_can.c | 8 ++++---- net/core/dev.c | 7 ++++--- net/core/pktgen.c | 5 ++--- net/dcb/dcbnl.c | 4 ++-- net/decnet/dn_table.c | 5 +++-- net/ipv4/igmp.c | 5 +++-- net/ipv4/netfilter.c | 8 ++++---- net/irda/irnet/irnet_irda.c | 4 ++-- net/mac80211/agg-rx.c | 6 +++--- net/mac80211/main.c | 4 ++-- net/mac80211/mesh.c | 4 ++-- net/mac80211/mesh_hwmp.c | 15 +++++++-------- net/mac80211/rx.c | 4 ++-- net/mac80211/tx.c | 9 +++++---- net/netfilter/nf_conntrack_expect.c | 6 +++--- net/netfilter/nf_conntrack_ftp.c | 8 ++++---- net/packet/af_packet.c | 7 ++++--- net/phonet/pep.c | 4 ++-- net/phonet/socket.c | 4 ++-- net/rds/af_rds.c | 8 ++++---- net/rds/connection.c | 6 ++---- net/rds/ib_cm.c | 4 ++-- net/rds/ib_rdma.c | 4 ++-- net/rds/ib_recv.c | 12 ++++++------ net/rds/ib_send.c | 4 ++-- net/rds/iw_rdma.c | 4 ++-- net/rds/iw_recv.c | 12 ++++++------ net/rds/iw_send.c | 7 +++---- net/rds/message.c | 3 +-- net/rds/rdma.c | 12 ++++++------ net/rds/recv.c | 11 +++++------ net/rds/send.c | 27 +++++++++++++-------------- net/rds/threads.c | 4 ++-- net/rose/rose_route.c | 10 ++++++---- net/sched/cls_rsvp.h | 28 +++++++++++++++------------- net/sched/sch_htb.c | 4 ++-- net/sched/sch_netem.c | 12 ++++++------ net/sched/sch_teql.c | 11 +++++++---- net/sctp/outqueue.c | 4 ++-- net/sctp/socket.c | 4 ++-- net/sunrpc/auth.c | 6 +++--- net/sunrpc/auth_gss/gss_krb5_seqnum.c | 4 ++-- net/sunrpc/auth_gss/svcauth_gss.c | 4 ++-- net/sunrpc/cache.c | 5 ++--- net/sunrpc/svc.c | 5 +++-- net/sunrpc/svc_xprt.c | 8 ++++---- net/sunrpc/svcauth.c | 4 ++-- net/sunrpc/svcauth_unix.c | 4 ++-- net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 7 +++---- net/sunrpc/xprtrdma/verbs.c | 4 ++-- net/tipc/cluster.c | 16 ++++++++-------- net/tipc/link.c | 12 ++++++------ net/tipc/socket.c | 12 +++++------- net/tipc/subscr.c | 6 +++--- net/unix/af_unix.c | 8 ++++---- net/wimax/op-rfkill.c | 8 ++++---- net/wireless/scan.c | 4 ++-- net/wireless/wext-core.c | 5 +++-- 63 files changed, 235 insertions(+), 233 deletions(-)
net/9p/trans_fd.c +2 -2
@@ -633,8 +633,8 @@ static void p9_poll_mux(struct p9_conn *m)if (n &POLLOUT ) {set_bit (Wpending, &m->wsched);P9_DPRINTK (P9_DEBUG_TRANS ,"mux %p can write\n" , m); -if ((m->wsize || !list_empty (&m->unsent_req_list)) - && !test_and_set_bit (Wworksched, &m->wsched)) { +if ((m->wsize || !list_empty (&m->unsent_req_list)) && + !test_and_set_bit (Wworksched, &m->wsched)) {P9_DPRINTK (P9_DEBUG_TRANS ,"sched write work %p\n" , m);queue_work (p9_mux_wq, &m->wq); }
net/bluetooth/l2cap.c +10 -10
@@ -1362,8 +1362,8 @@ static int l2cap_ertm_send(struct sock *sk)if (pi->conn_state &L2CAP_CONN_WAIT_F )return 0 ; -while ((skb = sk->sk_send_head) && (!l2cap_tx_window_full (sk)) - && !(pi->conn_state &L2CAP_CONN_REMOTE_BUSY )) { +while ((skb = sk->sk_send_head) && (!l2cap_tx_window_full (sk)) && + !(pi->conn_state &L2CAP_CONN_REMOTE_BUSY )) { tx_skb =skb_clone (skb,GFP_ATOMIC ); if (pi->remote_max_tx &&
@@ -1604,8 +1604,8 @@ static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msreturn -EOPNOTSUPP ;/* Check outgoing MTU */ -if (sk->sk_type ==SOCK_SEQPACKET && pi->mode ==L2CAP_MODE_BASIC - && len > pi->omtu) +if (sk->sk_type ==SOCK_SEQPACKET && pi->mode ==L2CAP_MODE_BASIC && + len > pi->omtu)return -EINVAL ;lock_sock (sk);
@@ -2756,8 +2756,8 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr goto unlock;if (l2cap_pi (sk)->conf_state &L2CAP_CONF_INPUT_DONE ) { -if (!(l2cap_pi (sk)->conf_state &L2CAP_CONF_NO_FCS_RECV ) - ||l2cap_pi (sk)->fcs !=L2CAP_FCS_NONE ) +if (!(l2cap_pi (sk)->conf_state &L2CAP_CONF_NO_FCS_RECV ) || +l2cap_pi (sk)->fcs !=L2CAP_FCS_NONE )l2cap_pi (sk)->fcs =L2CAP_FCS_CRC16 ; sk->sk_state =BT_CONNECTED ;
@@ -2845,8 +2845,8 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdrl2cap_pi (sk)->conf_state |=L2CAP_CONF_INPUT_DONE ;if (l2cap_pi (sk)->conf_state &L2CAP_CONF_OUTPUT_DONE ) { -if (!(l2cap_pi (sk)->conf_state &L2CAP_CONF_NO_FCS_RECV ) - ||l2cap_pi (sk)->fcs !=L2CAP_FCS_NONE ) +if (!(l2cap_pi (sk)->conf_state &L2CAP_CONF_NO_FCS_RECV ) || +l2cap_pi (sk)->fcs !=L2CAP_FCS_NONE )l2cap_pi (sk)->fcs =L2CAP_FCS_CRC16 ; sk->sk_state =BT_CONNECTED ;
@@ -3388,8 +3388,8 @@ static inline int l2cap_data_channel_sframe(struct sock *sk, u16 rx_control, str pi->expected_ack_seq = tx_seq;l2cap_drop_acked_frames (sk); -if ((pi->conn_state &L2CAP_CONN_REMOTE_BUSY ) - && (pi->unacked_frames >0 )) +if ((pi->conn_state &L2CAP_CONN_REMOTE_BUSY ) && + (pi->unacked_frames >0 ))__mod_retrans_timer ();l2cap_ertm_send (sk);
net/bridge/br_fdb.c +2 -2
@@ -60,8 +60,8 @@ static inline unsigned long hold_time(const struct net_bridge *br)static inline int has_expired (const struct net_bridge *br,const struct net_bridge_fdb_entry *fdb) { -return !fdb->is_static - &&time_before_eq (fdb->ageing_timer +hold_time (br), jiffies); +return !fdb->is_static && +time_before_eq (fdb->ageing_timer +hold_time (br), jiffies); }static inline int br_mac_hash (const unsigned char *mac)
net/bridge/br_sysfs_br.c +3 -3
@@ -316,9 +316,9 @@ static ssize_t store_group_addr(struct device *d,if (new_addr[5 ] & ~0xf )return -EINVAL ; -if (new_addr[5 ] ==1 /* 802.3x Pause address */ - || new_addr[5 ] ==2 /* 802.3ad Slow protocols */ - || new_addr[5 ] ==3 )/* 802.1X PAE address */ +if (new_addr[5 ] ==1 ||/* 802.3x Pause address */ + new_addr[5 ] ==2 ||/* 802.3ad Slow protocols */ + new_addr[5 ] ==3 )/* 802.1X PAE address */ return -EINVAL ;spin_lock_bh (&br->lock);
net/bridge/netfilter/ebt_stp.c +2 -2
@@ -135,8 +135,8 @@ ebt_stp_mt(const struct sk_buff *skb, const struct xt_match_param *par)if (memcmp (sp, header,sizeof (header)))return false; -if (info->bitmask &EBT_STP_TYPE - &&FWINV (info->type != sp->type,EBT_STP_TYPE )) +if (info->bitmask &EBT_STP_TYPE && +FWINV (info->type != sp->type,EBT_STP_TYPE ))return false; if (sp->type == BPDU_TYPE_CONFIG &&
net/can/af_can.c +4 -4
@@ -375,8 +375,8 @@ static struct hlist_head *find_rcv_list(canid_t *can_id, canid_t *mask,return &d->rx[RX_ALL ];/* extra filterlists for the subscription of a single non-RTR can_id */ -if (((*mask &CAN_EFF_RTR_FLAGS ) ==CAN_EFF_RTR_FLAGS ) - && !(*can_id &CAN_RTR_FLAG )) { +if (((*mask &CAN_EFF_RTR_FLAGS ) ==CAN_EFF_RTR_FLAGS ) && + !(*can_id &CAN_RTR_FLAG )) {if (*can_id &CAN_EFF_FLAG ) {if (*mask == (CAN_EFF_MASK |CAN_EFF_RTR_FLAGS )) {
@@ -525,8 +525,8 @@ void can_rx_unregister(struct net_device *dev, canid_t can_id, canid_t mask,*/ hlist_for_each_entry_rcu (r, next, rl, list) { -if (r->can_id == can_id && r->mask == mask - && r->func == func && r->data == data) +if (r->can_id == can_id && r->mask == mask && + r->func == func && r->data == data)break ; }
net/core/dev.c +4 -3
@@ -2677,9 +2677,10 @@ __napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)return GRO_NORMAL ;for (p = napi->gro_list; p; p = p->next) { -NAPI_GRO_CB (p)->same_flow = (p->dev == skb->dev) - && !compare_ether_header (skb_mac_header (p), -skb_gro_mac_header (skb)); +NAPI_GRO_CB (p)->same_flow = + (p->dev == skb->dev) && + !compare_ether_header (skb_mac_header (p), +skb_gro_mac_header (skb));NAPI_GRO_CB (p)->flush =0 ; }
net/core/pktgen.c +2 -3
@@ -2052,9 +2052,8 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)read_lock_bh (&idev->lock);for (ifp = idev->addr_list; ifp; ifp = ifp->if_next) { -if (ifp->scope ==IFA_LINK - && !(ifp-> - flags &IFA_F_TENTATIVE )) { +if (ifp->scope ==IFA_LINK && + !(ifp->flags &IFA_F_TENTATIVE )) {ipv6_addr_copy (&pkt_dev-> cur_in6_saddr, &ifp->addr);
net/dcb/dcbnl.c +2 -2
@@ -1085,8 +1085,8 @@ static int dcbnl_bcn_setcfg(struct net_device *netdev, struct nlattr **tb,u8 value_byte;u32 value_int; -if (!tb[DCB_ATTR_BCN ] || !netdev->dcbnl_ops->setbcncfg - || !netdev->dcbnl_ops->setbcnrp) +if (!tb[DCB_ATTR_BCN ] || !netdev->dcbnl_ops->setbcncfg || + !netdev->dcbnl_ops->setbcnrp)return ret; ret = nla_parse_nested(data, DCB_BCN_ATTR_MAX,
net/decnet/dn_table.c +3 -2
@@ -581,8 +581,9 @@ static int dn_fib_table_insert(struct dn_fib_table *tb, struct rtmsg *r, struct DN_FIB_SCAN_KEY(f, fp, key) {if (fi->fib_priority !=DN_FIB_INFO (f)->fib_priority)break ; -if (f->fn_type == type && f->fn_scope == r->rtm_scope - &&DN_FIB_INFO (f) == fi) +if (f->fn_type == type && + f->fn_scope == r->rtm_scope && +DN_FIB_INFO (f) == fi) goto out; }
net/ipv4/igmp.c +3 -2
@@ -1899,8 +1899,9 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct err = -EADDRNOTAVAIL ;for (pmc=inet->mc_list; pmc; pmc=pmc->next) { -if (pmc->multi.imr_multiaddr.s_addr == imr.imr_multiaddr.s_addr - && pmc->multi.imr_ifindex == imr.imr_ifindex) +if ((pmc->multi.imr_multiaddr.s_addr == + imr.imr_multiaddr.s_addr) && + (pmc->multi.imr_ifindex == imr.imr_ifindex))break ; }if (!pmc) {/* must have a prior join */
net/ipv4/netfilter.c +4 -4
@@ -155,10 +155,10 @@ static int nf_ip_reroute(struct sk_buff *skb,if (entry->hook ==NF_INET_LOCAL_OUT ) {const struct iphdr *iph =ip_hdr (skb); -if (!(iph->tos == rt_info->tos - && skb->mark == rt_info->mark - && iph->daddr == rt_info->daddr - && iph->saddr == rt_info->saddr)) +if (!(iph->tos == rt_info->tos && + skb->mark == rt_info->mark && + iph->daddr == rt_info->daddr && + iph->saddr == rt_info->saddr))return ip_route_me_harder (skb,RTN_UNSPEC ); }return 0 ;
net/irda/irnet/irnet_irda.c +2 -2
@@ -1403,8 +1403,8 @@ irnet_connect_indication(void * instance,/* Socket already connecting ? On primary ? */ if (0 #ifdef ALLOW_SIMULT_CONNECT - || ((irttp_is_primary (server->tsap) ==1 )/* primary */ - && (test_and_clear_bit (0 , &new->ttp_connect))) + || ((irttp_is_primary (server->tsap) ==1 ) &&/* primary */ + (test_and_clear_bit (0 , &new->ttp_connect))) #endif /* ALLOW_SIMULT_CONNECT */ ) {
net/mac80211/agg-rx.c +3 -3
@@ -211,9 +211,9 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,* check if configuration can support the BA policy * and if buffer size does not exceeds max value */ /* XXX: check own ht delayed BA capability?? */ -if (((ba_policy !=1 ) - && (!(sta->sta.ht_cap.cap &IEEE80211_HT_CAP_DELAY_BA ))) - || (buf_size >IEEE80211_MAX_AMPDU_BUF )) { +if (((ba_policy !=1 ) && + (!(sta->sta.ht_cap.cap &IEEE80211_HT_CAP_DELAY_BA ))) || + (buf_size >IEEE80211_MAX_AMPDU_BUF )) { status =WLAN_STATUS_INVALID_QOS_PARAM ;#ifdef CONFIG_MAC80211_HT_DEBUG if (net_ratelimit ())
net/mac80211/main.c +2 -2
@@ -631,8 +631,8 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)sta_info_stop (local);rate_control_deinitialize (local); -if (skb_queue_len (&local->skb_queue) - ||skb_queue_len (&local->skb_queue_unreliable)) +if (skb_queue_len (&local->skb_queue) || +skb_queue_len (&local->skb_queue_unreliable))printk (KERN_WARNING "%s: skb_queue not empty\n" ,wiphy_name (local->hw.wiphy));skb_queue_purge (&local->skb_queue);
net/mac80211/mesh.c +2 -2
@@ -195,8 +195,8 @@ int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr,list_del (&p->list);kmem_cache_free (rm_cache, p); --entries; - }else if ((seqnum == p->seqnum) - && (memcmp (sa, p->sa,ETH_ALEN ) ==0 )) + }else if ((seqnum == p->seqnum) && + (memcmp (sa, p->sa,ETH_ALEN ) ==0 ))return -1 ; }
net/mac80211/mesh_hwmp.c +7 -8
@@ -936,17 +936,16 @@ int mesh_nexthop_lookup(struct sk_buff *skb, }if (mpath->flags &MESH_PATH_ACTIVE ) { -if (time_after (jiffies, mpath->exp_time + -msecs_to_jiffies (sdata->u.mesh.mshcfg.path_refresh_time)) - && !memcmp (sdata->dev->dev_addr, hdr->addr4, -ETH_ALEN ) - && !(mpath->flags &MESH_PATH_RESOLVING ) - && !(mpath->flags &MESH_PATH_FIXED )) { +if (time_after (jiffies, + mpath->exp_time + +msecs_to_jiffies (sdata->u.mesh.mshcfg.path_refresh_time)) && + !memcmp (sdata->dev->dev_addr, hdr->addr4,ETH_ALEN ) && + !(mpath->flags &MESH_PATH_RESOLVING ) && + !(mpath->flags &MESH_PATH_FIXED )) {mesh_queue_preq (mpath,PREQ_Q_F_START |PREQ_Q_F_REFRESH ); } -memcpy (hdr->addr1, mpath->next_hop->sta.addr, -ETH_ALEN ); +memcpy (hdr->addr1, mpath->next_hop->sta.addr,ETH_ALEN ); }else {struct ieee80211_tx_info *info =IEEE80211_SKB_CB (skb);if (!(mpath->flags &MESH_PATH_RESOLVING )) {
net/mac80211/rx.c +2 -2
@@ -1168,8 +1168,8 @@ ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx, __le16 fc) rx->key))return -EACCES ;/* BIP does not use Protected field, so need to check MMIE */ -if (unlikely (ieee80211_is_multicast_robust_mgmt_frame (rx->skb) - &&ieee80211_get_mmie_keyidx (rx->skb) <0 && +if (unlikely (ieee80211_is_multicast_robust_mgmt_frame (rx->skb) && +ieee80211_get_mmie_keyidx (rx->skb) <0 && rx->key))return -EACCES ;/*
net/mac80211/tx.c +5 -4
@@ -366,10 +366,11 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;u32 staflags; -if (unlikely (!sta ||ieee80211_is_probe_resp (hdr->frame_control) - ||ieee80211_is_auth (hdr->frame_control) - ||ieee80211_is_assoc_resp (hdr->frame_control) - ||ieee80211_is_reassoc_resp (hdr->frame_control))) +if (unlikely (!sta || +ieee80211_is_probe_resp (hdr->frame_control) || +ieee80211_is_auth (hdr->frame_control) || +ieee80211_is_assoc_resp (hdr->frame_control) || +ieee80211_is_reassoc_resp (hdr->frame_control)))return TX_CONTINUE ; staflags =get_sta_flags (sta);
net/netfilter/nf_conntrack_expect.c +3 -3
@@ -202,9 +202,9 @@ static inline int expect_clash(const struct nf_conntrack_expect *a,static inline int expect_matches (const struct nf_conntrack_expect *a,const struct nf_conntrack_expect *b) { -return a->master == b->master && a->class == b->class - &&nf_ct_tuple_equal (&a->tuple, &b->tuple) - &&nf_ct_tuple_mask_equal (&a->mask, &b->mask); +return a->master == b->master && a->class == b->class && +nf_ct_tuple_equal (&a->tuple, &b->tuple) && +nf_ct_tuple_mask_equal (&a->mask, &b->mask); }/* Generally a bad idea to call this: could have matched already. */
net/netfilter/nf_conntrack_ftp.c +4 -4
@@ -243,8 +243,8 @@ static int try_epsv_response(const char *data, size_t dlen,/* Three delimiters. */ if (dlen <=3 )return 0 ; delim = data[0 ]; -if (isdigit (delim) || delim <33 || delim >126 - || data[1 ] != delim || data[2 ] != delim) +if (isdigit (delim) || delim <33 || delim >126 || + data[1 ] != delim || data[2 ] != delim)return 0 ;return get_port (data,3 , dlen, delim, &cmd->u.tcp.port);
@@ -366,8 +366,8 @@ static int help(struct sk_buff *skb,typeof (nf_nat_ftp_hook) nf_nat_ftp;/* Until there's been traffic both ways, don't look in packets. */ -if (ctinfo !=IP_CT_ESTABLISHED - && ctinfo !=IP_CT_ESTABLISHED +IP_CT_IS_REPLY ) { +if (ctinfo !=IP_CT_ESTABLISHED && + ctinfo !=IP_CT_ESTABLISHED +IP_CT_IS_REPLY ) {pr_debug ("ftp: Conntrackinfo = %u\n" , ctinfo);return NF_ACCEPT ; }
net/packet/af_packet.c +4 -3
@@ -1034,9 +1034,10 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) goto out_xmit;packet_increment_head (&po->tx_ring); len_sum += tp_len; - }while (likely ((ph !=NULL ) || ((!(msg->msg_flags &MSG_DONTWAIT )) - && (atomic_read (&po->tx_ring.pending)))) - ); + }while (likely ((ph !=NULL ) || + ((!(msg->msg_flags &MSG_DONTWAIT )) && + (atomic_read (&po->tx_ring.pending)))) + ); err = len_sum; goto out_put;
net/phonet/pep.c +2 -2
@@ -714,8 +714,8 @@ static int pep_ioctl(struct sock *sk, int cmd, unsigned long arg)return -EINVAL ;lock_sock (sk); -if (sock_flag (sk,SOCK_URGINLINE ) - && !skb_queue_empty (&pn->ctrlreq_queue)) +if (sock_flag (sk,SOCK_URGINLINE ) && + !skb_queue_empty (&pn->ctrlreq_queue)) answ =skb_peek (&pn->ctrlreq_queue)->len;else if (!skb_queue_empty (&sk->sk_receive_queue)) answ =skb_peek (&sk->sk_receive_queue)->len;
net/phonet/socket.c +2 -2
@@ -98,8 +98,8 @@ struct sock *pn_find_sock_by_sa(struct net *net, const struct sockaddr_pn *spn)if (pn->resource != res)continue ; } -if (pn_addr (pn->sobject) - &&pn_addr (pn->sobject) !=pn_addr (obj)) +if (pn_addr (pn->sobject) && +pn_addr (pn->sobject) !=pn_addr (obj))continue ; rval = sknode;
net/rds/af_rds.c +4 -4
@@ -174,8 +174,8 @@ static unsigned int rds_poll(struct file *file, struct socket *sock, mask |= (POLLIN |POLLRDNORM );spin_unlock (&rs->rs_lock); } -if (!list_empty (&rs->rs_recv_queue) - || !list_empty (&rs->rs_notify_queue)) +if (!list_empty (&rs->rs_recv_queue) || + !list_empty (&rs->rs_notify_queue)) mask |= (POLLIN |POLLRDNORM );if (rs->rs_snd_bytes <rds_sk_sndbuf (rs)) mask |= (POLLOUT |POLLWRNORM );
@@ -308,8 +308,8 @@ static int rds_getsockopt(struct socket *sock, int level, int optname,if (len <sizeof (int )) ret = -EINVAL ;else -if (put_user (rs->rs_recverr, (int __user *) optval) - ||put_user (sizeof (int ), optlen)) +if (put_user (rs->rs_recverr, (int __user *) optval) || +put_user (sizeof (int ), optlen)) ret = -EFAULT ;else ret =0 ;
net/rds/connection.c +2 -4
@@ -133,10 +133,8 @@ static struct rds_connection *__rds_conn_create(__be32 laddr, __be32 faddr,spin_lock_irqsave (&rds_conn_lock, flags); conn =rds_conn_lookup (head, laddr, faddr, trans); -if (conn - && conn->c_loopback - && conn->c_trans != &rds_loop_transport - && !is_outgoing) { +if (conn && conn->c_loopback && conn->c_trans != &rds_loop_transport && + !is_outgoing) {/* This is a looped back IB connection, and we're * called by the code handling the incoming connect. * We need a second connection object into which we
net/rds/ib_cm.c +2 -2
@@ -377,8 +377,8 @@ static u32 rds_ib_protocol_compatible(struct rdma_cm_event *event) }/* Even if len is crap *now* I still want to check it. -ASG */ -if (event->param.conn.private_data_len <sizeof (*dp) - || dp->dp_protocol_major ==0 ) +if (event->param.conn.private_data_len <sizeof (*dp) || + dp->dp_protocol_major ==0 )return RDS_PROTOCOL_3_0 ; common =be16_to_cpu (dp->dp_protocol_minor_mask) &RDS_IB_SUPPORTED_PROTOCOLS ;
net/rds/ib_rdma.c +2 -2
@@ -570,8 +570,8 @@ void rds_ib_free_mr(void *trans_private, int invalidate)spin_unlock_irqrestore (&pool->list_lock, flags);/* If we've pinned too many pages, request a flush */ -if (atomic_read (&pool->free_pinned) >= pool->max_free_pinned - ||atomic_read (&pool->dirty_count) >= pool->max_items /10 ) +if (atomic_read (&pool->free_pinned) >= pool->max_free_pinned || +atomic_read (&pool->dirty_count) >= pool->max_items /10 )queue_work (rds_wq, &pool->flush_worker);if (invalidate) {
net/rds/ib_recv.c +6 -6
@@ -230,8 +230,8 @@ int rds_ib_recv_refill(struct rds_connection *conn, gfp_t kptr_gfp,int ret =0 ;u32 pos; -while ((prefill ||rds_conn_up (conn)) - &&rds_ib_ring_alloc (&ic->i_recv_ring,1 , &pos)) { +while ((prefill ||rds_conn_up (conn)) && +rds_ib_ring_alloc (&ic->i_recv_ring,1 , &pos)) {if (pos >= ic->i_recv_ring.w_nr) {printk (KERN_NOTICE "Argh - ring alloc returned pos=%u\n" , pos);
@@ -771,10 +771,10 @@ static void rds_ib_process_recv(struct rds_connection *conn, hdr = &ibinc->ii_inc.i_hdr;/* We can't just use memcmp here; fragments of a * single message may carry different ACKs */ -if (hdr->h_sequence != ihdr->h_sequence - || hdr->h_len != ihdr->h_len - || hdr->h_sport != ihdr->h_sport - || hdr->h_dport != ihdr->h_dport) { +if (hdr->h_sequence != ihdr->h_sequence || + hdr->h_len != ihdr->h_len || + hdr->h_sport != ihdr->h_sport || + hdr->h_dport != ihdr->h_dport) {rds_ib_conn_error (conn,"fragment header mismatch; forcing reconnect\n" );return ;
net/rds/ib_send.c +2 -2
@@ -252,8 +252,8 @@ void rds_ib_send_cq_comp_handler(struct ib_cq *cq, void *context)rds_ib_ring_free (&ic->i_send_ring, completed); -if (test_and_clear_bit (RDS_LL_SEND_FULL , &conn->c_flags) - ||test_bit (0 , &conn->c_map_queued)) +if (test_and_clear_bit (RDS_LL_SEND_FULL , &conn->c_flags) || +test_bit (0 , &conn->c_map_queued))queue_delayed_work (rds_wq, &conn->c_send_w,0 );/* We expect errors as the qp is drained during shutdown */
net/rds/iw_rdma.c +2 -2
@@ -573,8 +573,8 @@ void rds_iw_free_mr(void *trans_private, int invalidate)rds_iw_free_fastreg (pool, ibmr);/* If we've pinned too many pages, request a flush */ -if (atomic_read (&pool->free_pinned) >= pool->max_free_pinned - ||atomic_read (&pool->dirty_count) >= pool->max_items /10 ) +if (atomic_read (&pool->free_pinned) >= pool->max_free_pinned || +atomic_read (&pool->dirty_count) >= pool->max_items /10 )queue_work (rds_wq, &pool->flush_worker);if (invalidate) {
net/rds/iw_recv.c +6 -6
@@ -230,8 +230,8 @@ int rds_iw_recv_refill(struct rds_connection *conn, gfp_t kptr_gfp,int ret =0 ;u32 pos; -while ((prefill ||rds_conn_up (conn)) - &&rds_iw_ring_alloc (&ic->i_recv_ring,1 , &pos)) { +while ((prefill ||rds_conn_up (conn)) && +rds_iw_ring_alloc (&ic->i_recv_ring,1 , &pos)) {if (pos >= ic->i_recv_ring.w_nr) {printk (KERN_NOTICE "Argh - ring alloc returned pos=%u\n" , pos);
@@ -730,10 +730,10 @@ static void rds_iw_process_recv(struct rds_connection *conn, hdr = &iwinc->ii_inc.i_hdr;/* We can't just use memcmp here; fragments of a * single message may carry different ACKs */ -if (hdr->h_sequence != ihdr->h_sequence - || hdr->h_len != ihdr->h_len - || hdr->h_sport != ihdr->h_sport - || hdr->h_dport != ihdr->h_dport) { +if (hdr->h_sequence != ihdr->h_sequence || + hdr->h_len != ihdr->h_len || + hdr->h_sport != ihdr->h_sport || + hdr->h_dport != ihdr->h_dport) {rds_iw_conn_error (conn,"fragment header mismatch; forcing reconnect\n" );return ;
net/rds/iw_send.c +3 -4
@@ -288,8 +288,8 @@ void rds_iw_send_cq_comp_handler(struct ib_cq *cq, void *context)rds_iw_ring_free (&ic->i_send_ring, completed); -if (test_and_clear_bit (RDS_LL_SEND_FULL , &conn->c_flags) - ||test_bit (0 , &conn->c_map_queued)) +if (test_and_clear_bit (RDS_LL_SEND_FULL , &conn->c_flags) || +test_bit (0 , &conn->c_map_queued))queue_delayed_work (rds_wq, &conn->c_send_w,0 );/* We expect errors as the qp is drained during shutdown */
@@ -519,8 +519,7 @@ int rds_iw_xmit(struct rds_connection *conn, struct rds_message *rm,BUG_ON (hdr_off !=0 && hdr_off !=sizeof (struct rds_header ));/* Fastreg support */ -if (rds_rdma_cookie_key (rm->m_rdma_cookie) - && !ic->i_fastreg_posted) { +if (rds_rdma_cookie_key (rm->m_rdma_cookie) && !ic->i_fastreg_posted) { ret = -EAGAIN ; goto out; }
net/rds/message.c +1 -2
@@ -122,8 +122,7 @@ int rds_message_add_extension(struct rds_header *hdr,if (hdr->h_exthdr[0 ] !=RDS_EXTHDR_NONE )return 0 ; -if (type >= __RDS_EXTHDR_MAX - || len != rds_exthdr_size[type]) +if (type >= __RDS_EXTHDR_MAX || len != rds_exthdr_size[type])return 0 ;if (ext_len >=RDS_HEADER_EXT_SPACE )
net/rds/rdma.c +6 -6
@@ -631,8 +631,8 @@ int rds_cmsg_rdma_args(struct rds_sock *rs, struct rds_message *rm, {struct rds_rdma_op *op; -if (cmsg->cmsg_len <CMSG_LEN (sizeof (struct rds_rdma_args )) - || rm->m_rdma_op !=NULL ) +if (cmsg->cmsg_len <CMSG_LEN (sizeof (struct rds_rdma_args )) || + rm->m_rdma_op !=NULL )return -EINVAL ; op =rds_rdma_prepare (rs,CMSG_DATA (cmsg));
@@ -655,8 +655,8 @@ int rds_cmsg_rdma_dest(struct rds_sock *rs, struct rds_message *rm,u32 r_key;int err =0 ; -if (cmsg->cmsg_len <CMSG_LEN (sizeof (rds_rdma_cookie_t)) - || rm->m_rdma_cookie !=0 ) +if (cmsg->cmsg_len <CMSG_LEN (sizeof (rds_rdma_cookie_t)) || + rm->m_rdma_cookie !=0 )return -EINVAL ;memcpy (&rm->m_rdma_cookie,CMSG_DATA (cmsg),sizeof (rm->m_rdma_cookie));
@@ -692,8 +692,8 @@ int rds_cmsg_rdma_dest(struct rds_sock *rs, struct rds_message *rm,int rds_cmsg_rdma_map (struct rds_sock *rs,struct rds_message *rm,struct cmsghdr *cmsg) { -if (cmsg->cmsg_len <CMSG_LEN (sizeof (struct rds_get_mr_args )) - || rm->m_rdma_cookie !=0 ) +if (cmsg->cmsg_len <CMSG_LEN (sizeof (struct rds_get_mr_args )) || + rm->m_rdma_cookie !=0 )return -EINVAL ;return __rds_rdma_map (rs,CMSG_DATA (cmsg), &rm->m_rdma_cookie, &rm->m_rdma_mr);
net/rds/recv.c +5 -6
@@ -195,8 +195,8 @@ void rds_recv_incoming(struct rds_connection *conn, __be32 saddr, __be32 daddr,* XXX we could spend more on the wire to get more robust failure * detection, arguably worth it to avoid data corruption. */ -if (be64_to_cpu (inc->i_hdr.h_sequence) < conn->c_next_rx_seq - && (inc->i_hdr.h_flags &RDS_FLAG_RETRANSMITTED )) { +if (be64_to_cpu (inc->i_hdr.h_sequence) < conn->c_next_rx_seq && + (inc->i_hdr.h_flags &RDS_FLAG_RETRANSMITTED )) {rds_stats_inc (s_recv_drop_old_seq); goto out; }
@@ -432,10 +432,9 @@ int rds_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, } timeo =wait_event_interruptible_timeout (*sk->sk_sleep, - (!list_empty (&rs->rs_notify_queue) - || rs->rs_cong_notify - ||rds_next_incoming (rs, &inc)), - timeo); + (!list_empty (&rs->rs_notify_queue) || + rs->rs_cong_notify || +rds_next_incoming (rs, &inc)), timeo);rdsdebug ("recvmsg woke inc %p timeo %ld\n" , inc, timeo);if (timeo >0 || timeo ==MAX_SCHEDULE_TIMEOUT )
net/rds/send.c +13 -14
@@ -235,8 +235,8 @@ int rds_send_xmit(struct rds_connection *conn)* connection. * Therefore, we never retransmit messages with RDMA ops. */ -if (rm->m_rdma_op - &&test_bit (RDS_MSG_RETRANSMITTED , &rm->m_flags)) { +if (rm->m_rdma_op && +test_bit (RDS_MSG_RETRANSMITTED , &rm->m_flags)) {spin_lock_irqsave (&conn->c_lock, flags);if (test_and_clear_bit (RDS_MSG_ON_CONN , &rm->m_flags))list_move (&rm->m_conn_item, &to_be_dropped);
@@ -247,8 +247,8 @@ int rds_send_xmit(struct rds_connection *conn)/* Require an ACK every once in a while */ len =ntohl (rm->m_inc.i_hdr.h_len); -if (conn->c_unacked_packets ==0 - || conn->c_unacked_bytes < len) { +if (conn->c_unacked_packets ==0 || + conn->c_unacked_bytes < len) {__set_bit (RDS_MSG_ACK_REQUIRED , &rm->m_flags); conn->c_unacked_packets = rds_sysctl_max_unacked_packets;
@@ -418,8 +418,8 @@ void rds_rdma_send_complete(struct rds_message *rm, int status)spin_lock (&rm->m_rs_lock); ro = rm->m_rdma_op; -if (test_bit (RDS_MSG_ON_SOCK , &rm->m_flags) - && ro && ro->r_notify && ro->r_notifier) { +if (test_bit (RDS_MSG_ON_SOCK , &rm->m_flags) && + ro && ro->r_notify && ro->r_notifier) { notifier = ro->r_notifier; rs = rm->m_rs;sock_hold (rds_rs_to_sk (rs));
@@ -549,8 +549,7 @@ void rds_send_remove_from_sock(struct list_head *messages, int status)list_del_init (&rm->m_sock_item);rds_send_sndbuf_remove (rs, rm); -if (ro && ro->r_notifier - && (status || ro->r_notify)) { +if (ro && ro->r_notifier && (status || ro->r_notify)) { notifier = ro->r_notifier;list_add_tail (¬ifier->n_list, &rs->rs_notify_queue);
@@ -877,8 +876,8 @@ int rds_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,if (ret) goto out; -if ((rm->m_rdma_cookie || rm->m_rdma_op) - && conn->c_trans->xmit_rdma ==NULL ) { +if ((rm->m_rdma_cookie || rm->m_rdma_op) && + conn->c_trans->xmit_rdma ==NULL ) {if (printk_ratelimit ())printk (KERN_NOTICE "rdma_op %p conn xmit_rdma %p\n" , rm->m_rdma_op, conn->c_trans->xmit_rdma);
@@ -890,8 +889,8 @@ int rds_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,* have scheduled a delayed reconnect however - in this case * we should not interfere. */ -if (rds_conn_state (conn) ==RDS_CONN_DOWN - && !test_and_set_bit (RDS_RECONNECT_PENDING , &conn->c_flags)) +if (rds_conn_state (conn) ==RDS_CONN_DOWN && + !test_and_set_bit (RDS_RECONNECT_PENDING , &conn->c_flags))queue_delayed_work (rds_wq, &conn->c_conn_w,0 ); ret =rds_cong_wait (conn->c_fcong, dport, nonblock, rs);
@@ -973,8 +972,8 @@ rds_send_pong(struct rds_connection *conn, __be16 dport)* have scheduled a delayed reconnect however - in this case * we should not interfere. */ -if (rds_conn_state (conn) ==RDS_CONN_DOWN - && !test_and_set_bit (RDS_RECONNECT_PENDING , &conn->c_flags)) +if (rds_conn_state (conn) ==RDS_CONN_DOWN && + !test_and_set_bit (RDS_RECONNECT_PENDING , &conn->c_flags))queue_delayed_work (rds_wq, &conn->c_conn_w,0 ); ret =rds_cong_wait (conn->c_fcong, dport,1 ,NULL );
net/rds/threads.c +2 -2
@@ -170,8 +170,8 @@ void rds_shutdown_worker(struct work_struct *work)* handler is supposed to check for state DISCONNECTING */ mutex_lock (&conn->c_cm_lock); -if (!rds_conn_transition (conn,RDS_CONN_UP ,RDS_CONN_DISCONNECTING ) - && !rds_conn_transition (conn,RDS_CONN_ERROR ,RDS_CONN_DISCONNECTING )) { +if (!rds_conn_transition (conn,RDS_CONN_UP ,RDS_CONN_DISCONNECTING ) && + !rds_conn_transition (conn,RDS_CONN_ERROR ,RDS_CONN_DISCONNECTING )) {rds_conn_error (conn,"shutdown called in state %d\n" ,atomic_read (&conn->c_state));mutex_unlock (&conn->c_cm_lock);
net/rose/rose_route.c +6 -4
@@ -77,8 +77,9 @@ static int __must_check rose_add_node(struct rose_route_struct *rose_route, rose_neigh = rose_neigh_list;while (rose_neigh !=NULL ) { -if (ax25cmp (&rose_route->neighbour, &rose_neigh->callsign) ==0 - && rose_neigh->dev == dev) +if (ax25cmp (&rose_route->neighbour, + &rose_neigh->callsign) ==0 && + rose_neigh->dev == dev)break ; rose_neigh = rose_neigh->next; }
@@ -311,8 +312,9 @@ static int rose_del_node(struct rose_route_struct *rose_route, rose_neigh = rose_neigh_list;while (rose_neigh !=NULL ) { -if (ax25cmp (&rose_route->neighbour, &rose_neigh->callsign) ==0 - && rose_neigh->dev == dev) +if (ax25cmp (&rose_route->neighbour, + &rose_neigh->callsign) ==0 && + rose_neigh->dev == dev)break ; rose_neigh = rose_neigh->next; }
net/sched/cls_rsvp.h +15 -13
@@ -170,21 +170,23 @@ restart:for (s = sht[h1]; s; s = s->next) {if (dst[RSVP_DST_LEN -1 ] == s->dst[RSVP_DST_LEN -1 ] && protocol == s->protocol && - !(s->dpi.mask & (*(u32 *)(xprt+s->dpi.offset)^s->dpi.key)) + !(s->dpi.mask & + (*(u32 *)(xprt+s->dpi.offset)^s->dpi.key)) && #if RSVP_DST_LEN == 4 - && dst[0 ] == s->dst[0 ] - && dst[1 ] == s->dst[1 ] - && dst[2 ] == s->dst[2 ] + dst[0 ] == s->dst[0 ] && + dst[1 ] == s->dst[1 ] && + dst[2 ] == s->dst[2 ] && #endif - && tunnelid == s->tunnelid) { + tunnelid == s->tunnelid) {for (f = s->ht[h2]; f; f = f->next) {if (src[RSVP_DST_LEN -1 ] == f->src[RSVP_DST_LEN -1 ] && !(f->spi.mask & (*(u32 *)(xprt+f->spi.offset)^f->spi.key)) #if RSVP_DST_LEN == 4 - && src[0 ] == f->src[0 ] - && src[1 ] == f->src[1 ] - && src[2 ] == f->src[2 ] + && + src[0 ] == f->src[0 ] && + src[1 ] == f->src[1 ] && + src[2 ] == f->src[2 ] #endif ) { *res = f->res;
@@ -493,13 +495,13 @@ static int rsvp_change(struct tcf_proto *tp, unsigned long base,for (sp = &data->ht[h1]; (s=*sp) !=NULL ; sp = &s->next) {if (dst[RSVP_DST_LEN -1 ] == s->dst[RSVP_DST_LEN -1 ] && pinfo && pinfo->protocol == s->protocol && -memcmp (&pinfo->dpi, &s->dpi,sizeof (s->dpi)) ==0 +memcmp (&pinfo->dpi, &s->dpi,sizeof (s->dpi)) ==0 && #if RSVP_DST_LEN == 4 - && dst[0 ] == s->dst[0 ] - && dst[1 ] == s->dst[1 ] - && dst[2 ] == s->dst[2 ] + dst[0 ] == s->dst[0 ] && + dst[1 ] == s->dst[1 ] && + dst[2 ] == s->dst[2 ] && #endif - && pinfo->tunnelid == s->tunnelid) { + pinfo->tunnelid == s->tunnelid) { insert:/* OK, we found appropriate session */
net/sched/sch_htb.c +2 -2
@@ -1344,8 +1344,8 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, };/* check for valid classid */ -if (!classid ||TC_H_MAJ (classid ^ sch->handle) - ||htb_find (classid, sch)) +if (!classid ||TC_H_MAJ (classid ^ sch->handle) || +htb_find (classid, sch)) goto failure;/* check maximal depth */
net/sched/sch_netem.c +6 -6
@@ -199,9 +199,9 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)* do it now in software before we mangle it. */ if (q->corrupt && q->corrupt >=get_crandom (&q->corrupt_cor)) { -if (!(skb =skb_unshare (skb,GFP_ATOMIC )) - || (skb->ip_summed ==CHECKSUM_PARTIAL - &&skb_checksum_help (skb))) { +if (!(skb =skb_unshare (skb,GFP_ATOMIC )) || + (skb->ip_summed ==CHECKSUM_PARTIAL && +skb_checksum_help (skb))) { sch->qstats.drops++;return NET_XMIT_DROP ; }
@@ -210,9 +210,9 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) } cb =netem_skb_cb (skb); -if (q->gap ==0 /* not doing reordering */ - || q->counter < q->gap/* inside last reordering gap */ - || q->reorder <get_crandom (&q->reorder_cor)) { +if (q->gap ==0 ||/* not doing reordering */ + q->counter < q->gap ||/* inside last reordering gap */ + q->reorder <get_crandom (&q->reorder_cor)) {psched_time_t now;psched_tdiff_t delay;
net/sched/sch_teql.c +7 -4
@@ -190,10 +190,13 @@ static int teql_qdisc_init(struct Qdisc *sch, struct nlattr *opt)if (m->slaves) {if (m->dev->flags &IFF_UP ) { -if ((m->dev->flags&IFF_POINTOPOINT && !(dev->flags&IFF_POINTOPOINT )) - || (m->dev->flags&IFF_BROADCAST && !(dev->flags&IFF_BROADCAST )) - || (m->dev->flags&IFF_MULTICAST && !(dev->flags&IFF_MULTICAST )) - || dev->mtu < m->dev->mtu) +if ((m->dev->flags &IFF_POINTOPOINT && + !(dev->flags &IFF_POINTOPOINT )) || + (m->dev->flags &IFF_BROADCAST && + !(dev->flags &IFF_BROADCAST )) || + (m->dev->flags &IFF_MULTICAST && + !(dev->flags &IFF_MULTICAST )) || + dev->mtu < m->dev->mtu)return -EINVAL ; }else {if (!(dev->flags&IFF_POINTOPOINT ))
net/sctp/outqueue.c +2 -2
@@ -191,8 +191,8 @@ static inline int sctp_cacc_skip(struct sctp_transport *primary, __u32 tsn) {if (primary->cacc.changeover_active && - (sctp_cacc_skip_3_1 (primary, transport, count_of_newacks) - ||sctp_cacc_skip_3_2 (primary, tsn))) + (sctp_cacc_skip_3_1 (primary, transport, count_of_newacks) || +sctp_cacc_skip_3_2 (primary, tsn)))return 1 ;return 0 ; }
net/sctp/socket.c +2 -2
@@ -2356,8 +2356,8 @@ static int sctp_setsockopt_peer_addr_params(struct sock *sk, pmtud_change ==SPP_PMTUD || sackdelay_change ==SPP_SACKDELAY || params.spp_sackdelay >500 || - (params.spp_pathmtu - && params.spp_pathmtu < SCTP_DEFAULT_MINSEGMENT)) + (params.spp_pathmtu && + params.spp_pathmtu < SCTP_DEFAULT_MINSEGMENT)) return -EINVAL;/* If an address other than INADDR_ANY is specified, and
net/sunrpc/auth.c +3 -3
@@ -332,9 +332,9 @@ rpcauth_lookup_credcache(struct rpc_auth *auth, struct auth_cred * acred,list_add_tail (&new->cr_lru, &free);spin_unlock (&cache->lock); found: -if (test_bit (RPCAUTH_CRED_NEW , &cred->cr_flags) - && cred->cr_ops->cr_init !=NULL - && !(flags &RPCAUTH_LOOKUP_NEW )) { +if (test_bit (RPCAUTH_CRED_NEW , &cred->cr_flags) && + cred->cr_ops->cr_init !=NULL && + !(flags &RPCAUTH_LOOKUP_NEW )) {int res = cred->cr_ops->cr_init (auth, cred);if (res <0 ) {put_rpccred (cred);
net/sunrpc/auth_gss/gss_krb5_seqnum.c +2 -2
@@ -75,8 +75,8 @@ krb5_get_seq_num(struct crypto_blkcipher *key,if ((code =krb5_decrypt (key, cksum, buf, plain,8 )))return code; -if ((plain[4 ] != plain[5 ]) || (plain[4 ] != plain[6 ]) - || (plain[4 ] != plain[7 ])) +if ((plain[4 ] != plain[5 ]) || (plain[4 ] != plain[6 ]) || + (plain[4 ] != plain[7 ]))return (s32 )KG_BAD_SEQ ; *direction = plain[4 ];
net/sunrpc/auth_gss/svcauth_gss.c +2 -2
@@ -105,8 +105,8 @@ static int rsi_match(struct cache_head *a, struct cache_head *b) { struct rsi *item = container_of(a, struct rsi, h); struct rsi *tmp = container_of(b, struct rsi, h); -return netobj_equal (&item->in_handle, &tmp->in_handle) - &&netobj_equal (&item->in_token, &tmp->in_token); +return netobj_equal (&item->in_handle, &tmp->in_handle) && +netobj_equal (&item->in_token, &tmp->in_token); }static int dup_to_netobj (struct xdr_netobj *dst,char *src,int len)
net/sunrpc/cache.c +2 -3
@@ -401,9 +401,8 @@ static int cache_clean(void)for (; ch; cp= & ch->next, ch= *cp) {if (current_detail->nextcheck > ch->expiry_time) current_detail->nextcheck = ch->expiry_time+1 ; -if (ch->expiry_time >=get_seconds () - && ch->last_refresh >= current_detail->flush_time - ) +if (ch->expiry_time >=get_seconds () && + ch->last_refresh >= current_detail->flush_time)continue ;if (test_and_clear_bit (CACHE_PENDING , &ch->flags))cache_dequeue (current_detail, ch);
net/sunrpc/svc.c +3 -2
@@ -1103,8 +1103,9 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv) procp->pc_release (rqstp,NULL , rqstp->rq_resp); goto dropit; } -if (*statp == rpc_success && (xdr = procp->pc_encode) - && !xdr (rqstp, resv->iov_base+resv->iov_len, rqstp->rq_resp)) { +if (*statp == rpc_success && + (xdr = procp->pc_encode) && + !xdr (rqstp, resv->iov_base+resv->iov_len, rqstp->rq_resp)) {dprintk ("svc: failed to encode reply\n" );/* serv->sv_stats->rpcsystemerr++; */ *statp = rpc_system_err;
net/sunrpc/svc_xprt.c +4 -4
@@ -129,8 +129,8 @@ static void svc_xprt_free(struct kref *kref)struct svc_xprt *xprt = container_of(kref, struct svc_xprt, xpt_ref);struct module *owner = xprt->xpt_class->xcl_owner; -if (test_bit (XPT_CACHE_AUTH , &xprt->xpt_flags) - && xprt->xpt_auth_cache !=NULL ) +if (test_bit (XPT_CACHE_AUTH , &xprt->xpt_flags) && + xprt->xpt_auth_cache !=NULL )svcauth_unix_info_release (xprt->xpt_auth_cache); xprt->xpt_ops->xpo_free (xprt);module_put (owner);
@@ -846,8 +846,8 @@ static void svc_age_temp_xprts(unsigned long closure)* through, close it. */ if (!test_and_set_bit (XPT_OLD , &xprt->xpt_flags))continue ; -if (atomic_read (&xprt->xpt_ref.refcount) >1 - ||test_bit (XPT_BUSY , &xprt->xpt_flags)) +if (atomic_read (&xprt->xpt_ref.refcount) >1 || +test_bit (XPT_BUSY , &xprt->xpt_flags))continue ;svc_xprt_get (xprt);list_move (le, &to_be_aged);
net/sunrpc/svcauth.c +2 -2
@@ -46,8 +46,8 @@ svc_authenticate(struct svc_rqst *rqstp, __be32 *authp)dprintk ("svc: svc_authenticate (%d)\n" , flavor);spin_lock (&authtab_lock); -if (flavor >=RPC_AUTH_MAXFLAVOR || !(aops = authtab[flavor]) - || !try_module_get (aops->owner)) { +if (flavor >=RPC_AUTH_MAXFLAVOR || !(aops = authtab[flavor]) || + !try_module_get (aops->owner)) {spin_unlock (&authtab_lock); *authp = rpc_autherr_badcred;return SVC_DENIED ;
net/sunrpc/svcauth_unix.c +2 -2
@@ -125,8 +125,8 @@ static int ip_map_match(struct cache_head *corig, struct cache_head *cnew) { struct ip_map *orig = container_of(corig, struct ip_map, h); struct ip_map *new = container_of(cnew, struct ip_map, h); -return strcmp (orig->m_class, new->m_class) ==0 - &&ipv6_addr_equal (&orig->m_addr, &new->m_addr); +return strcmp (orig->m_class, new->m_class) ==0 && +ipv6_addr_equal (&orig->m_addr, &new->m_addr); }static void ip_map_init (struct cache_head *cnew,struct cache_head *citem) {
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +3 -4
@@ -337,10 +337,9 @@ static int rdma_set_ctxt_sge(struct svcxprt_rdma *xprt,static int rdma_read_max_sge (struct svcxprt_rdma *xprt,int sge_count) { -if ((RDMA_TRANSPORT_IWARP == -rdma_node_get_transport (xprt->sc_cm_id-> - device->node_type)) - && sge_count >1 ) +if ((rdma_node_get_transport (xprt->sc_cm_id->device->node_type) == +RDMA_TRANSPORT_IWARP ) && + sge_count >1 )return 1 ;else return min_t (int, sge_count, xprt->sc_max_sge);
net/sunrpc/xprtrdma/verbs.c +2 -2
@@ -878,8 +878,8 @@ if (strnicmp(ia->ri_id->device->dma_device->bus->name, "pci", 3) == 0) {* others indicate a transport condition which has already * undergone a best-effort. */ -if (ep->rep_connected == -ECONNREFUSED - && ++retry_count <=RDMA_CONNECT_RETRY_MAX ) { +if (ep->rep_connected == -ECONNREFUSED && + ++retry_count <=RDMA_CONNECT_RETRY_MAX ) {dprintk ("RPC: %s: non-peer_reject, retry\n" , __func__); goto retry; }
net/tipc/cluster.c +8 -8
@@ -437,11 +437,11 @@ void tipc_cltr_recv_routing_table(struct sk_buff *buf)break ;case ROUTE_ADDITION :if (!is_slave (tipc_own_addr)) { -assert (!in_own_cluster (c_ptr->addr) - ||is_slave (rem_node)); +assert (!in_own_cluster (c_ptr->addr) || +is_slave (rem_node)); }else { -assert (in_own_cluster (c_ptr->addr) - && !is_slave (rem_node)); +assert (in_own_cluster (c_ptr->addr) && + !is_slave (rem_node)); } n_ptr = c_ptr->nodes[tipc_node (rem_node)];if (!n_ptr)
@@ -451,11 +451,11 @@ void tipc_cltr_recv_routing_table(struct sk_buff *buf)break ;case ROUTE_REMOVAL :if (!is_slave (tipc_own_addr)) { -assert (!in_own_cluster (c_ptr->addr) - ||is_slave (rem_node)); +assert (!in_own_cluster (c_ptr->addr) || +is_slave (rem_node)); }else { -assert (in_own_cluster (c_ptr->addr) - && !is_slave (rem_node)); +assert (in_own_cluster (c_ptr->addr) && + !is_slave (rem_node)); } n_ptr = c_ptr->nodes[tipc_node (rem_node)];if (n_ptr)
net/tipc/link.c +6 -6
@@ -378,8 +378,8 @@ static void link_timeout(struct link *l_ptr)struct tipc_msg *msg =buf_msg (l_ptr->first_out);u32 length =msg_size (msg); -if ((msg_user (msg) ==MSG_FRAGMENTER ) - && (msg_type (msg) ==FIRST_FRAGMENT )) { +if ((msg_user (msg) ==MSG_FRAGMENTER ) && + (msg_type (msg) ==FIRST_FRAGMENT )) { length =msg_size (msg_get_wrapped (msg)); }if (length) {
@@ -2788,8 +2788,8 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,/* Is there an incomplete message waiting for this fragment? */ -while (pbuf && ((msg_seqno (buf_msg (pbuf)) != long_msg_seq_no) - || (msg_orignode (fragm) !=msg_orignode (buf_msg (pbuf))))) { +while (pbuf && ((msg_seqno (buf_msg (pbuf)) != long_msg_seq_no) || + (msg_orignode (fragm) !=msg_orignode (buf_msg (pbuf))))) { prev = pbuf; pbuf = pbuf->next; }
@@ -3325,8 +3325,8 @@ static void link_print(struct link *l_ptr, struct print_buf *buf, (l_ptr->last_out)), l_ptr->out_queue_size);if ((mod (msg_seqno (buf_msg (l_ptr->last_out)) -msg_seqno (buf_msg (l_ptr->first_out))) - != (l_ptr->out_queue_size -1 )) - || (l_ptr->last_out->next !=NULL )) { + != (l_ptr->out_queue_size -1 )) || + (l_ptr->last_out->next !=NULL )) {tipc_printf (buf,"\nSend queue inconsistency\n" );tipc_printf (buf,"first_out= %x " , l_ptr->first_out);tipc_printf (buf,"next_out= %x " , l_ptr->next_out);
net/tipc/socket.c +5 -7
@@ -1136,13 +1136,11 @@ restart:/* Loop around if more data is required */ -if ((sz_copied < buf_len)/* didn't get all requested data */ - && (!skb_queue_empty (&sk->sk_receive_queue) || - (flags &MSG_WAITALL )) -/* ... and more is ready or required */ - && (!(flags &MSG_PEEK ))/* ... and aren't just peeking at data */ - && (!err)/* ... and haven't reached a FIN */ - ) +if ((sz_copied < buf_len) &&/* didn't get all requested data */ + (!skb_queue_empty (&sk->sk_receive_queue) || + (flags &MSG_WAITALL )) &&/* and more is ready or required */ + (!(flags &MSG_PEEK )) &&/* and aren't just peeking at data */ + (!err))/* and haven't reached a FIN */ goto restart; exit:
net/tipc/subscr.c +3 -3
@@ -364,9 +364,9 @@ static struct subscription *subscr_subscribe(struct tipc_subscr *s, sub->seq.upper =htohl (s->seq.upper, swap); sub->timeout =htohl (s->timeout, swap); sub->filter =htohl (s->filter, swap); -if ((!(sub->filter &TIPC_SUB_PORTS ) - == !(sub->filter &TIPC_SUB_SERVICE )) - || (sub->seq.lower > sub->seq.upper)) { +if ((!(sub->filter &TIPC_SUB_PORTS ) == + !(sub->filter &TIPC_SUB_SERVICE )) || + (sub->seq.lower > sub->seq.upper)) {warn ("Subscription rejected, illegal request\n" );kfree (sub);subscr_terminate (subscriber);
net/unix/af_unix.c +4 -4
@@ -1033,8 +1033,8 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr, goto out; addr_len = err; -if (test_bit (SOCK_PASSCRED , &sock->flags) - && !u->addr && (err =unix_autobind (sock)) !=0 ) +if (test_bit (SOCK_PASSCRED , &sock->flags) && !u->addr && + (err =unix_autobind (sock)) !=0 ) goto out; timeo =sock_sndtimeo (sk, flags &O_NONBLOCK );
@@ -1378,8 +1378,8 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock, goto out; } -if (test_bit (SOCK_PASSCRED , &sock->flags) - && !u->addr && (err =unix_autobind (sock)) !=0 ) +if (test_bit (SOCK_PASSCRED , &sock->flags) && !u->addr + && (err =unix_autobind (sock)) !=0 ) goto out; err = -EMSGSIZE ;
net/wimax/op-rfkill.c +4 -4
@@ -107,8 +107,8 @@ void wimax_report_rfkill_hw(struct wimax_dev *wimax_dev,if (state != wimax_dev->rf_hw) { wimax_dev->rf_hw = state; -if (wimax_dev->rf_hw ==WIMAX_RF_ON - && wimax_dev->rf_sw ==WIMAX_RF_ON ) +if (wimax_dev->rf_hw ==WIMAX_RF_ON && + wimax_dev->rf_sw ==WIMAX_RF_ON ) wimax_state =WIMAX_ST_READY ;else wimax_state =WIMAX_ST_RADIO_OFF ;
@@ -163,8 +163,8 @@ void wimax_report_rfkill_sw(struct wimax_dev *wimax_dev,if (state != wimax_dev->rf_sw) { wimax_dev->rf_sw = state; -if (wimax_dev->rf_hw ==WIMAX_RF_ON - && wimax_dev->rf_sw ==WIMAX_RF_ON ) +if (wimax_dev->rf_hw ==WIMAX_RF_ON && + wimax_dev->rf_sw ==WIMAX_RF_ON ) wimax_state =WIMAX_ST_READY ;else wimax_state =WIMAX_ST_RADIO_OFF ;
net/wireless/scan.c +2 -2
@@ -937,8 +937,8 @@ ieee80211_bss(struct wiphy *wiphy, struct iw_request_info *info, ie += ie[1 ] +2 ; } -if (bss->pub.capability & (WLAN_CAPABILITY_ESS |WLAN_CAPABILITY_IBSS ) - || ismesh) { +if (bss->pub.capability & (WLAN_CAPABILITY_ESS |WLAN_CAPABILITY_IBSS ) || + ismesh) {memset (&iwe,0 ,sizeof (iwe)); iwe.cmd =SIOCGIWMODE ;if (ismesh)
net/wireless/wext-core.c +3 -2
@@ -911,8 +911,9 @@ static int wireless_process_ioctl(struct net *net, struct ifreq *ifr,*/ static int wext_permission_check (unsigned int cmd) { -if ((IW_IS_SET (cmd) || cmd ==SIOCGIWENCODE || cmd ==SIOCGIWENCODEEXT ) - && !capable (CAP_NET_ADMIN )) +if ((IW_IS_SET (cmd) || cmd ==SIOCGIWENCODE || + cmd ==SIOCGIWENCODEEXT ) && + !capable (CAP_NET_ADMIN ))return -EPERM ;return 0 ;
Re: [PATCH net-next-2.6 PATCH] net: Move && and || to end of previous line
From: Joe Perches <[email protected]>
Date: Sun, 29 Nov 2009 13:00:49 -0800
Quoted 7 lines
Not including
net/atm/Compiled tested x86 allyesconfig only
Added a > 80 column line or two, which I ignored. Existing checkpatch plaints willfully, cheerfully ignored.Signed-off-by Joe Perches <[email protected]>
Applied, thanks a lot Joe.
Re: [PATCH net-next-2.6 PATCH] net: Move && and || to end of previous line
Quoted 9 lines · On Sun, 29 Nov 2009 16:55:57 -0800 (PST) David Miller <[email protected]>…
From: Joe Perches <[email protected]>
Date: Sun, 29 Nov 2009 13:00:49 -0800Quoted 6 lines
Not including
net/atm/Compiled tested x86 allyesconfig only
Added a > 80 column line or two, which I ignored. Existing checkpatch plaints willfully, cheerfully ignored.
Quoted 7 lines
Quoted 1 line
Signed-off-by Joe Perches <[email protected]>Applied, thanks a lot Joe.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Rather than playing with the dangling operator format which seems to be a coding style that only David cares about. Why not go through and fix the really ugly old drivers that need it. For a good horror experience, go look at the floppy driver.
Re: [PATCH net-next-2.6 PATCH] net: Move && and || to end of previous line
Quoted 3 lines · Stephen Hemminger
Rather than playing with the dangling operator format which seems to be a coding style that only David cares about. Why not go through and fix the really ugly old drivers that need it.
net/... had the lower percentage of leading uses
and a maintainer that cared to standardize.
drivers/... has many odd uses of coding styles and no single maintainer that cares much about style.
Quoted 1 line
For a good horror experience, go look at the floppy driver.
I've no desire to be floppy maintainer. Do you?
$ ./scripts/get_maintainer --nogit -f driver/block/floppy.c [email protected]
David Miller
maintainerRe: [PATCH net-next-2.6 PATCH] net: Move && and || to end of previous line
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Mon, 30 Nov 2009 09:28:37 -0800
Quoted 2 lines
Rather than playing with the dangling operator format which seems to be a coding style that only David cares about.
I think Joe's work is useful and valuable.
Please don't discourage him.
PATCH 1/1 drivers/block/floppy.c: stylistic cleanups
In reply to Stephen HemmingerQuoted 3 lines · Stephen Hemminger
Rather than playing with the dangling operator format which seems to be a coding style that only David cares about. Why not go through and fix the really ugly old drivers that need it. For a good horror experience, go look at the floppy driver.
Just for you Stephen, here's a cleaned up version. Now to see if it gets applied, which I rather doubt.
Changes:
Removed macro definitions and uses of
IN, OUT, LAST_OUT, CLEARSTRUCT, and CHECK_RESET
Used C99 initializers
Removed assigns from if statements
Converted printks without KERN_ levels to pr_info and pr_cont Removed unnecessary braces
Used print_hex_dump
Moved leading logical tests to end of previous line Surrounded still ugly CALL and ECALL macro with do {} while (0)
Checkpatch complaints before:
total: 393 errors, 132 warnings, 4647 lines checked
after:
total: 1 errors, 11 warnings, 5352 lines checked
Compile tested only, x86 allyesconfig
drivers/block/floppy.c | 1853 +++++++++++++++++++++++++++++++++--------------- 1 files changed, 1279 insertions(+), 574 deletions(-)
drivers/block/floppy.c +1279 -574
@@ -150,7 +150,7 @@#define REALLY_SLOW_IO #define DEBUGT 2 -#define DCL_DEBUG /* debug disk change line */ +#define DCL_DEBUG /* debug disk change line */ /* do print messages for unexpected interrupts */ static int print_unex =1 ;
@@ -180,6 +180,8 @@ static int print_unex = 1;#include <linux/mod_devicetable.h> #include <linux/buffer_head.h> /* for invalidate_buffers() */ #include <linux/mutex.h> +#include <linux/io.h> +#include <linux/uaccess.h> /* * PS/2 floppies have much slower step rates than regular floppies.
@@ -191,8 +193,6 @@ static int slow_floppy;#include <asm/dma.h> #include <asm/irq.h> #include <asm/system.h> -#include <asm/io.h> -#include <asm/uaccess.h> static int FLOPPY_IRQ =6 ;static int FLOPPY_DMA =2 ;
@@ -250,7 +250,7 @@ static int irqdma_allocated;static struct request *current_req;static struct request_queue *floppy_queue; -static void do_fd_request (struct request_queue * q); +static void do_fd_request (struct request_queue *q);#ifndef fd_get_dma_residue#define fd_get_dma_residue () get_dma_residue(FLOPPY_DMA)
@@ -263,7 +263,7 @@ static void do_fd_request(struct request_queue * q);#endif #ifndef fd_dma_mem_alloc -#define fd_dma_mem_alloc (size) __get_dma_pages(GFP_KERNEL,get_order(size)) +#define fd_dma_mem_alloc (size) __get_dma_pages(GFP_KERNEL, get_order(size))#endif static inline void fallback_on_nodma_alloc (char **addr,size_t l)
@@ -273,7 +273,7 @@ static inline void fallback_on_nodma_alloc(char **addr, size_t l)return ;/* we have the memory */ if (can_use_virtual_dma !=2 )return ;/* no fallback allowed */ -printk ("DMA memory shortage. Temporarily falling back on virtual DMA\n" ); +pr_info ("DMA memory shortage. Temporarily falling back on virtual DMA\n" ); *addr = (char *)nodma_mem_alloc (l);#else return ;
@@ -285,57 +285,57 @@ static inline void fallback_on_nodma_alloc(char **addr, size_t l)static unsigned long fake_change;static int initialising =1 ; -#define ITYPE (x) (((x)>>2) & 0x1f) +#define ITYPE (x) (((x) >> 2) & 0x1f)#define TOMINOR (x) ((x & 3) | ((x & 4) << 5))#define UNIT (x) ((x) & 0x03)/* drive on fdc */ #define FDC (x) (((x) & 0x04) >> 2)/* fdc of drive */ /* reverse mapping from unit and fdc to drive */ #define REVDRIVE (fdc, unit) ((unit) + ((fdc) << 2)) -#define DP (&drive_params[current_drive]) -#define DRS (&drive_state[current_drive]) -#define DRWE (&write_errors[current_drive]) -#define FDCS (&fdc_state[fdc]) -#define CLEARF (x) clear_bit(x##_BIT, &DRS->flags) -#define SETF (x) set_bit(x##_BIT, &DRS->flags) -#define TESTF (x) test_bit(x##_BIT, &DRS->flags) - -#define UDP (&drive_params[drive]) -#define UDRS (&drive_state[drive]) -#define UDRWE (&write_errors[drive]) -#define UFDCS (&fdc_state[FDC(drive)]) -#define UCLEARF (x) clear_bit(x##_BIT, &UDRS->flags) -#define USETF (x) set_bit(x##_BIT, &UDRS->flags) -#define UTESTF (x) test_bit(x##_BIT, &UDRS->flags) - -#define DPRINT(format, args...) printk(DEVICE_NAME "%d: " format, current_drive , ## args) - -#define PH_HEAD (floppy,head) (((((floppy)->stretch & 2) >>1) ^ head) << 2) -#define STRETCH (floppy) ((floppy)->stretch & FD_STRETCH) -#define CLEARSTRUCT (x) memset((x), 0, sizeof(*(x))) +#define DP (&drive_params[current_drive]) +#define DRS (&drive_state[current_drive]) +#define DRWE (&write_errors[current_drive]) +#define FDCS (&fdc_state[fdc]) +#define CLEARF (x) clear_bit(x##_BIT, &DRS->flags) +#define SETF (x) set_bit(x##_BIT, &DRS->flags) +#define TESTF (x) test_bit(x##_BIT, &DRS->flags) + +#define UDP (&drive_params[drive]) +#define UDRS (&drive_state[drive]) +#define UDRWE (&write_errors[drive]) +#define UFDCS (&fdc_state[FDC(drive)]) +#define UCLEARF (x) clear_bit(x##_BIT, &UDRS->flags) +#define USETF (x) set_bit(x##_BIT, &UDRS->flags) +#define UTESTF (x) test_bit(x##_BIT, &UDRS->flags) + +#define DPRINT(format, args...) \ + pr_info(DEVICE_NAME "%d: " format, current_drive, ##args) + +#define PH_HEAD (floppy, head) (((((floppy)->stretch & 2) >> 1) ^ head) << 2) +#define STRETCH (floppy) ((floppy)->stretch & FD_STRETCH)/* read/write */ -#define COMMAND raw_cmd->cmd[0] -#define DR_SELECT raw_cmd->cmd[1] -#define TRACK raw_cmd->cmd[2] -#define HEAD raw_cmd->cmd[3] -#define SECTOR raw_cmd->cmd[4] -#define SIZECODE raw_cmd->cmd[5] -#define SECT_PER_TRACK raw_cmd->cmd[6] -#define GAP raw_cmd->cmd[7] -#define SIZECODE2 raw_cmd->cmd[8] +#define COMMAND (raw_cmd->cmd[0]) +#define DR_SELECT (raw_cmd->cmd[1]) +#define TRACK (raw_cmd->cmd[2]) +#define HEAD (raw_cmd->cmd[3]) +#define SECTOR (raw_cmd->cmd[4]) +#define SIZECODE (raw_cmd->cmd[5]) +#define SECT_PER_TRACK (raw_cmd->cmd[6]) +#define GAP (raw_cmd->cmd[7]) +#define SIZECODE2 (raw_cmd->cmd[8])#define NR_RW 9/* format */ -#define F_SIZECODE raw_cmd->cmd[2] -#define F_SECT_PER_TRACK raw_cmd->cmd[3] -#define F_GAP raw_cmd->cmd[4] -#define F_FILL raw_cmd->cmd[5] +#define F_SIZECODE (raw_cmd->cmd[2]) +#define F_SECT_PER_TRACK (raw_cmd->cmd[3]) +#define F_GAP (raw_cmd->cmd[4]) +#define F_FILL (raw_cmd->cmd[5])#define NR_F 6/* -* Maximum disk size (in kilobytes). This default is used whenever the -* current disk size is unknown. +* Maximum disk size (in kilobytes). +* This default is used whenever the current disk size is unknown. * [Now it is rather a minimum] */ #define MAX_DISK_SIZE 4/* 3984 */
@@ -345,63 +345,244 @@ static int initialising = 1;*/ #define MAX_REPLIES 16static unsigned char reply_buffer[MAX_REPLIES ]; -static int inr;/* size of reply buffer, when called from interrupt */ -#define ST0 (reply_buffer[0]) -#define ST1 (reply_buffer[1]) -#define ST2 (reply_buffer[2]) -#define ST3 (reply_buffer[0])/* result of GETSTATUS */ -#define R_TRACK (reply_buffer[3]) -#define R_HEAD (reply_buffer[4]) -#define R_SECTOR (reply_buffer[5]) -#define R_SIZECODE (reply_buffer[6]) -#define SEL_DLY (2*HZ/100) +static int inr;/* size of reply buffer, when called from interrupt */ + +#define ST0 (reply_buffer[0]) +#define ST1 (reply_buffer[1]) +#define ST2 (reply_buffer[2]) +#define ST3 (reply_buffer[0])/* result of GETSTATUS */ +#define R_TRACK (reply_buffer[3]) +#define R_HEAD (reply_buffer[4]) +#define R_SECTOR (reply_buffer[5]) +#define R_SIZECODE (reply_buffer[6]) +#define SEL_DLY (2 * HZ / 100)/* * this struct defines the different floppy drive types. */ -static struct { +struct drive_params {struct floppy_drive_params params;const char *name;/* name printed while booting */ -} default_drive_params[] = { -/* NOTE: the time values in jiffies should be in msec! -CMOS drive type -| Maximum data rate supported by drive type -| | Head load time, msec -| | | Head unload time, msec (not used) -| | | | Step rate interval, usec -| | | | | Time needed for spinup time (jiffies) -| | | | | | Timeout for spinning down (jiffies) -| | | | | | | Spindown offset (where disk stops) -| | | | | | | | Select delay -| | | | | | | | | RPS -| | | | | | | | | | Max number of tracks -| | | | | | | | | | | Interrupt timeout -| | | | | | | | | | | | Max nonintlv. sectors -| | | | | | | | | | | | | -Max Errors- flags */ -{{0 ,500 ,16 ,16 ,8000 ,1 *HZ ,3 *HZ ,0 ,SEL_DLY ,5 ,80 ,3 *HZ ,20 , {3 ,1 ,2 ,0 ,2 },0 , -0 , {7 ,4 ,8 ,2 ,1 ,5 ,3 ,10 },3 *HZ /2 ,0 },"unknown" }, - -{{1 ,300 ,16 ,16 ,8000 ,1 *HZ ,3 *HZ ,0 ,SEL_DLY ,5 ,40 ,3 *HZ ,17 , {3 ,1 ,2 ,0 ,2 },0 , -0 , {1 ,0 ,0 ,0 ,0 ,0 ,0 ,0 },3 *HZ /2 ,1 },"360K PC" },/*5 1/4 360 KB PC*/ - -{{2 ,500 ,16 ,16 ,6000 ,4 *HZ /10 ,3 *HZ ,14 ,SEL_DLY ,6 ,83 ,3 *HZ ,17 , {3 ,1 ,2 ,0 ,2 },0 , -0 , {2 ,5 ,6 ,23 ,10 ,20 ,12 ,0 },3 *HZ /2 ,2 },"1.2M" },/*5 1/4 HD AT*/ - -{{3 ,250 ,16 ,16 ,3000 ,1 *HZ ,3 *HZ ,0 ,SEL_DLY ,5 ,83 ,3 *HZ ,20 , {3 ,1 ,2 ,0 ,2 },0 , -0 , {4 ,22 ,21 ,30 ,3 ,0 ,0 ,0 },3 *HZ /2 ,4 },"720k" },/*3 1/2 DD*/ - -{{4 ,500 ,16 ,16 ,4000 ,4 *HZ /10 ,3 *HZ ,10 ,SEL_DLY ,5 ,83 ,3 *HZ ,20 , {3 ,1 ,2 ,0 ,2 },0 , -0 , {7 ,4 ,25 ,22 ,31 ,21 ,29 ,11 },3 *HZ /2 ,7 },"1.44M" },/*3 1/2 HD*/ - -{{5 ,1000 ,15 ,8 ,3000 ,4 *HZ /10 ,3 *HZ ,10 ,SEL_DLY ,5 ,83 ,3 *HZ ,40 , {3 ,1 ,2 ,0 ,2 },0 , -0 , {7 ,8 ,4 ,25 ,28 ,22 ,31 ,21 },3 *HZ /2 ,8 },"2.88M AMI BIOS" },/*3 1/2 ED*/ - -{{6 ,1000 ,15 ,8 ,3000 ,4 *HZ /10 ,3 *HZ ,10 ,SEL_DLY ,5 ,83 ,3 *HZ ,40 , {3 ,1 ,2 ,0 ,2 },0 , -0 , {7 ,8 ,4 ,25 ,28 ,22 ,31 ,21 },3 *HZ /2 ,8 },"2.88M" }/*3 1/2 ED*/ -/* | --autodetected formats--- | | | -* read_track | | Name printed when booting -* | Native format -* Frequency of disk change checks */ +}; + +static struct drive_params default_drive_params[] = { +/* NOTE: the time values in jiffies should be in msec! */ + { + .params = { + .cmos =0 , + .max_dtr =500 , + .hlt =16 , + .hut =16 , + .srt =8000 , + .spinup =1 *HZ , + .spindown =3 *HZ , + .spindown_offset =0 , + .select_delay =SEL_DLY , + .rps =5 , + .tracks =80 , + .timeout =3 *HZ , + .interleave_sect =20 , + .max_errors = { + .abort =3 , + .read_track =1 , + .reset =2 , + .recal =0 , + .reporting =2 + }, + .flags =0 , + .read_track =0 , + .autodetect = {7 ,4 ,8 ,2 ,1 ,5 ,3 ,10 }, + .checkfreq =3 *HZ /2 , + .native_format =0 + }, + .name ="unknown" + }, + + {/*5 1/4 360 KB PC */ + .params = { + .cmos =1 , + .max_dtr =300 , + .hlt =16 , + .hut =16 , + .srt =8000 , + .spinup =1 *HZ , + .spindown =3 *HZ , + .spindown_offset =0 , + .select_delay =SEL_DLY , + .rps =5 , + .tracks =40 , + .timeout =3 *HZ , + .interleave_sect =17 , + .max_errors = { + .abort =3 , + .read_track =1 , + .reset =2 , + .recal =0 , + .reporting =2 + }, + .flags =0 , + .read_track =0 , + .autodetect = {1 ,0 ,0 ,0 ,0 ,0 ,0 ,0 }, + .checkfreq =3 *HZ /2 , + .native_format =1 + }, + .name ="360K PC" + }, + + {/*5 1/4 HD AT */ + .params = { + .cmos =2 , + .max_dtr =500 , + .hlt =16 , + .hut =16 , + .srt =6000 , + .spinup =4 *HZ /10 , + .spindown =3 *HZ , + .spindown_offset =14 , + .select_delay =SEL_DLY , + .rps =6 , + .tracks =83 , + .timeout =3 *HZ , + .interleave_sect =17 , + .max_errors = { + .abort =3 , + .read_track =1 , + .reset =2 , + .recal =0 , + .reporting =2 + }, + .flags =0 , + .read_track =0 , + .autodetect = {2 ,5 ,6 ,23 ,10 ,20 ,12 ,0 }, + .checkfreq =3 *HZ /2 , + .native_format =2 + }, + .name ="1.2M" + }, + + {/*3 1/2 DD */ + .params = { + .cmos =3 , + .max_dtr =250 , + .hlt =16 , + .hut =16 , + .srt =3000 , + .spinup =1 *HZ , + .spindown =3 *HZ , + .spindown_offset =0 , + .select_delay =SEL_DLY , + .rps =5 , + .tracks =83 , + .timeout =3 *HZ , + .interleave_sect =20 , + .max_errors = { + .abort =3 , + .read_track =1 , + .reset =2 , + .recal =0 , + .reporting =2 + }, + .flags =0 , + .read_track =0 , + .autodetect = {4 ,22 ,21 ,30 ,3 ,0 ,0 ,0 }, + .checkfreq =3 *HZ /2 , + .native_format =4 + }, + .name ="720k" + }, + + {/*3 1/2 HD */ + .params = { + .cmos =4 , + .max_dtr =500 , + .hlt =16 , + .hut =16 , + .srt =4000 , + .spinup =4 *HZ /10 , + .spindown =3 *HZ , + .spindown_offset =10 , + .select_delay =SEL_DLY , + .rps =5 , + .tracks =83 , + .timeout =3 *HZ , + .interleave_sect =20 , + .max_errors = { + .abort =3 , + .read_track =1 , + .reset =2 , + .recal =0 , + .reporting =2 + }, + .flags =0 , + .read_track =0 , + .autodetect = {7 ,4 ,25 ,22 ,31 ,21 ,29 ,11 }, + .checkfreq =3 *HZ /2 , + .native_format =7 + }, + .name ="1.44M" + }, + + {/*3 1/2 ED */ + .params = { + .cmos =5 , + .max_dtr =1000 , + .hlt =15 , + .hut =8 , + .srt =3000 , + .spinup =4 *HZ /10 , + .spindown =3 *HZ , + .spindown_offset =10 , + .select_delay =SEL_DLY , + .rps =5 , + .tracks =83 , + .timeout =3 *HZ , + .interleave_sect =40 , + .max_errors = { + .abort =3 , + .read_track =1 , + .reset =2 , + .recal =0 , + .reporting =2 + }, + .flags =0 , + .read_track =0 , + .autodetect = {7 ,8 ,4 ,25 ,28 ,22 ,31 ,21 }, + .checkfreq =3 *HZ /2 , + .native_format =8 + }, + .name ="2.88M AMI BIOS" + }, + + {/*3 1/2 ED */ + .params = { + .cmos =6 , + .max_dtr =1000 , + .hlt =15 , + .hut =8 , + .srt =3000 , + .spinup =4 *HZ /10 , + .spindown =3 *HZ , + .spindown_offset =10 , + .select_delay =SEL_DLY , + .rps =5 , + .tracks =83 , + .timeout =3 *HZ , + .interleave_sect =40 , + .max_errors = { + .abort =3 , + .read_track =1 , + .reset =2 , + .recal =0 , + .reporting =2 + }, + .flags =0 , + .read_track =0 , + .autodetect = {7 ,8 ,4 ,25 ,28 ,22 ,31 ,21 }, + .checkfreq =3 *HZ /2 , + .native_format =8 + }, + .name ="2.88M" + } };static struct floppy_drive_params drive_params[N_DRIVE ];
@@ -434,52 +615,391 @@ static struct floppy_raw_cmd *raw_cmd, default_raw_cmd;* * Other parameters should be self-explanatory (see also setfdprm(8)). */ -/* -Size -| Sectors per track -| | Head -| | | Tracks -| | | | Stretch -| | | | | Gap 1 size -| | | | | | Data rate, | 0x40 for perp -| | | | | | | Spec1 (stepping rate, head unload -| | | | | | | | /fmt gap (gap2) */ -static struct floppy_struct floppy_type[32 ] = { - {0 ,0 ,0 ,0 ,0 ,0x00 ,0x00 ,0x00 ,0x00 ,NULL },/* 0 no testing */ - {720 ,9 ,2 ,40 ,0 ,0x2A ,0x02 ,0xDF ,0x50 ,"d360" },/* 1 360KB PC */ - {2400 ,15 ,2 ,80 ,0 ,0x1B ,0x00 ,0xDF ,0x54 ,"h1200" },/* 2 1.2MB AT */ - {720 ,9 ,1 ,80 ,0 ,0x2A ,0x02 ,0xDF ,0x50 ,"D360" },/* 3 360KB SS 3.5" */ - {1440 ,9 ,2 ,80 ,0 ,0x2A ,0x02 ,0xDF ,0x50 ,"D720" },/* 4 720KB 3.5" */ - {720 ,9 ,2 ,40 ,1 ,0x23 ,0x01 ,0xDF ,0x50 ,"h360" },/* 5 360KB AT */ - {1440 ,9 ,2 ,80 ,0 ,0x23 ,0x01 ,0xDF ,0x50 ,"h720" },/* 6 720KB AT */ - {2880 ,18 ,2 ,80 ,0 ,0x1B ,0x00 ,0xCF ,0x6C ,"H1440" },/* 7 1.44MB 3.5" */ - {5760 ,36 ,2 ,80 ,0 ,0x1B ,0x43 ,0xAF ,0x54 ,"E2880" },/* 8 2.88MB 3.5" */ - {6240 ,39 ,2 ,80 ,0 ,0x1B ,0x43 ,0xAF ,0x28 ,"E3120" },/* 9 3.12MB 3.5" */ - - {2880 ,18 ,2 ,80 ,0 ,0x25 ,0x00 ,0xDF ,0x02 ,"h1440" },/* 10 1.44MB 5.25" */ - {3360 ,21 ,2 ,80 ,0 ,0x1C ,0x00 ,0xCF ,0x0C ,"H1680" },/* 11 1.68MB 3.5" */ - {820 ,10 ,2 ,41 ,1 ,0x25 ,0x01 ,0xDF ,0x2E ,"h410" },/* 12 410KB 5.25" */ - {1640 ,10 ,2 ,82 ,0 ,0x25 ,0x02 ,0xDF ,0x2E ,"H820" },/* 13 820KB 3.5" */ - {2952 ,18 ,2 ,82 ,0 ,0x25 ,0x00 ,0xDF ,0x02 ,"h1476" },/* 14 1.48MB 5.25" */ - {3444 ,21 ,2 ,82 ,0 ,0x25 ,0x00 ,0xDF ,0x0C ,"H1722" },/* 15 1.72MB 3.5" */ - {840 ,10 ,2 ,42 ,1 ,0x25 ,0x01 ,0xDF ,0x2E ,"h420" },/* 16 420KB 5.25" */ - {1660 ,10 ,2 ,83 ,0 ,0x25 ,0x02 ,0xDF ,0x2E ,"H830" },/* 17 830KB 3.5" */ - {2988 ,18 ,2 ,83 ,0 ,0x25 ,0x00 ,0xDF ,0x02 ,"h1494" },/* 18 1.49MB 5.25" */ - {3486 ,21 ,2 ,83 ,0 ,0x25 ,0x00 ,0xDF ,0x0C ,"H1743" },/* 19 1.74 MB 3.5" */ - - {1760 ,11 ,2 ,80 ,0 ,0x1C ,0x09 ,0xCF ,0x00 ,"h880" },/* 20 880KB 5.25" */ - {2080 ,13 ,2 ,80 ,0 ,0x1C ,0x01 ,0xCF ,0x00 ,"D1040" },/* 21 1.04MB 3.5" */ - {2240 ,14 ,2 ,80 ,0 ,0x1C ,0x19 ,0xCF ,0x00 ,"D1120" },/* 22 1.12MB 3.5" */ - {3200 ,20 ,2 ,80 ,0 ,0x1C ,0x20 ,0xCF ,0x2C ,"h1600" },/* 23 1.6MB 5.25" */ - {3520 ,22 ,2 ,80 ,0 ,0x1C ,0x08 ,0xCF ,0x2e ,"H1760" },/* 24 1.76MB 3.5" */ - {3840 ,24 ,2 ,80 ,0 ,0x1C ,0x20 ,0xCF ,0x00 ,"H1920" },/* 25 1.92MB 3.5" */ - {6400 ,40 ,2 ,80 ,0 ,0x25 ,0x5B ,0xCF ,0x00 ,"E3200" },/* 26 3.20MB 3.5" */ - {7040 ,44 ,2 ,80 ,0 ,0x25 ,0x5B ,0xCF ,0x00 ,"E3520" },/* 27 3.52MB 3.5" */ - {7680 ,48 ,2 ,80 ,0 ,0x25 ,0x63 ,0xCF ,0x00 ,"E3840" },/* 28 3.84MB 3.5" */ - {3680 ,23 ,2 ,80 ,0 ,0x1C ,0x10 ,0xCF ,0x00 ,"H1840" },/* 29 1.84MB 3.5" */ - - {1600 ,10 ,2 ,80 ,0 ,0x25 ,0x02 ,0xDF ,0x2E ,"D800" },/* 30 800KB 3.5" */ - {3200 ,20 ,2 ,80 ,0 ,0x1C ,0x00 ,0xCF ,0x2C ,"H1600" },/* 31 1.6MB 3.5" */ +static struct floppy_struct floppy_type[32 ] = { + { + .size =0 , + .sect =0 , + .head =0 , + .track =0 , + .stretch =0 , + .gap =0x00 , + .rate =0x00 , + .spec1 =0x00 , + .fmt_gap =0x00 , + .name =NULL + },/* 0 no testing */ + { + .size =720 , + .sect =9 , + .head =2 , + .track =40 , + .stretch =0 , + .gap =0x2A , + .rate =0x02 , + .spec1 =0xDF , + .fmt_gap =0x50 , + .name ="d360" + },/* 1 360KB PC */ + { + .size =2400 , + .sect =15 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x1B , + .rate =0x00 , + .spec1 =0xDF , + .fmt_gap =0x54 , + .name ="h1200" + },/* 2 1.2MB AT */ + { + .size =720 , + .sect =9 , + .head =1 , + .track =80 , + .stretch =0 , + .gap =0x2A , + .rate =0x02 , + .spec1 =0xDF , + .fmt_gap =0x50 , + .name ="D360" + },/* 3 360KB SS 3.5" */ + { + .size =1440 , + .sect =9 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x2A , + .rate =0x02 , + .spec1 =0xDF , + .fmt_gap =0x50 , + .name ="D720" + },/* 4 720KB 3.5" */ + { + .size =720 , + .sect =9 , + .head =2 , + .track =40 , + .stretch =1 , + .gap =0x23 , + .rate =0x01 , + .spec1 =0xDF , + .fmt_gap =0x50 , + .name ="h360" + },/* 5 360KB AT */ + { + .size =1440 , + .sect =9 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x23 , + .rate =0x01 , + .spec1 =0xDF , + .fmt_gap =0x50 , + .name ="h720" + },/* 6 720KB AT */ + { + .size =2880 , + .sect =18 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x1B , + .rate =0x00 , + .spec1 =0xCF , + .fmt_gap =0x6C , + .name ="H1440" + },/* 7 1.44MB 3.5" */ + { + .size =5760 , + .sect =36 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x1B , + .rate =0x43 , + .spec1 =0xAF , + .fmt_gap =0x54 , + .name ="E2880" + },/* 8 2.88MB 3.5" */ + { + .size =6240 , + .sect =39 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x1B , + .rate =0x43 , + .spec1 =0xAF , + .fmt_gap =0x28 , + .name ="E3120" + },/* 9 3.12MB 3.5" */ + { + .size =2880 , + .sect =18 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x25 , + .rate =0x00 , + .spec1 =0xDF , + .fmt_gap =0x02 , + .name ="h1440" + },/* 10 1.44MB 5.25" */ + { + .size =3360 , + .sect =21 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x1C , + .rate =0x00 , + .spec1 =0xCF , + .fmt_gap =0x0C , + .name ="H1680" + },/* 11 1.68MB 3.5" */ + { + .size =820 , + .sect =10 , + .head =2 , + .track =41 , + .stretch =1 , + .gap =0x25 , + .rate =0x01 , + .spec1 =0xDF , + .fmt_gap =0x2E , + .name ="h410" + },/* 12 410KB 5.25" */ + { + .size =1640 , + .sect =10 , + .head =2 , + .track =82 , + .stretch =0 , + .gap =0x25 , + .rate =0x02 , + .spec1 =0xDF , + .fmt_gap =0x2E , + .name ="H820" + },/* 13 820KB 3.5" */ + { + .size =2952 , + .sect =18 , + .head =2 , + .track =82 , + .stretch =0 , + .gap =0x25 , + .rate =0x00 , + .spec1 =0xDF , + .fmt_gap =0x02 , + .name ="h1476" + },/* 14 1.48MB 5.25" */ + { + .size =3444 , + .sect =21 , + .head =2 , + .track =82 , + .stretch =0 , + .gap =0x25 , + .rate =0x00 , + .spec1 =0xDF , + .fmt_gap =0x0C , + .name ="H1722" + },/* 15 1.72MB 3.5" */ + { + .size =840 , + .sect =10 , + .head =2 , + .track =42 , + .stretch =1 , + .gap =0x25 , + .rate =0x01 , + .spec1 =0xDF , + .fmt_gap =0x2E , + .name ="h420" + },/* 16 420KB 5.25" */ + { + .size =1660 , + .sect =10 , + .head =2 , + .track =83 , + .stretch =0 , + .gap =0x25 , + .rate =0x02 , + .spec1 =0xDF , + .fmt_gap =0x2E , + .name ="H830" + },/* 17 830KB 3.5" */ + { + .size =2988 , + .sect =18 , + .head =2 , + .track =83 , + .stretch =0 , + .gap =0x25 , + .rate =0x00 , + .spec1 =0xDF , + .fmt_gap =0x02 , + .name ="h1494" + },/* 18 1.49MB 5.25" */ + { + .size =3486 , + .sect =21 , + .head =2 , + .track =83 , + .stretch =0 , + .gap =0x25 , + .rate =0x00 , + .spec1 =0xDF , + .fmt_gap =0x0C , + .name ="H1743" + },/* 19 1.74 MB 3.5" */ + { + .size =1760 , + .sect =11 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x1C , + .rate =0x09 , + .spec1 =0xCF , + .fmt_gap =0x00 , + .name ="h880" + },/* 20 880KB 5.25" */ + { + .size =2080 , + .sect =13 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x1C , + .rate =0x01 , + .spec1 =0xCF , + .fmt_gap =0x00 , + .name ="D1040" + },/* 21 1.04MB 3.5" */ + { + .size =2240 , + .sect =14 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x1C , + .rate =0x19 , + .spec1 =0xCF , + .fmt_gap =0x00 , + .name ="D1120" + },/* 22 1.12MB 3.5" */ + { + .size =3200 , + .sect =20 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x1C , + .rate =0x20 , + .spec1 =0xCF , + .fmt_gap =0x2C , + .name ="h1600" + },/* 23 1.6MB 5.25" */ + { + .size =3520 , + .sect =22 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x1C , + .rate =0x08 , + .spec1 =0xCF , + .fmt_gap =0x2e , + .name ="H1760" + },/* 24 1.76MB 3.5" */ + { + .size =3840 , + .sect =24 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x1C , + .rate =0x20 , + .spec1 =0xCF , + .fmt_gap =0x00 , + .name ="H1920" + },/* 25 1.92MB 3.5" */ + { + .size =6400 , + .sect =40 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x25 , + .rate =0x5B , + .spec1 =0xCF , + .fmt_gap =0x00 , + .name ="E3200" + },/* 26 3.20MB 3.5" */ + { + .size =7040 , + .sect =44 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x25 , + .rate =0x5B , + .spec1 =0xCF , + .fmt_gap =0x00 , + .name ="E3520" + },/* 27 3.52MB 3.5" */ + { + .size =7680 , + .sect =48 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x25 , + .rate =0x63 , + .spec1 =0xCF , + .fmt_gap =0x00 , + .name ="E3840" + },/* 28 3.84MB 3.5" */ + { + .size =3680 , + .sect =23 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x1C , + .rate =0x10 , + .spec1 =0xCF , + .fmt_gap =0x00 , + .name ="H1840" + },/* 29 1.84MB 3.5" */ + { + .size =1600 , + .sect =10 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x25 , + .rate =0x02 , + .spec1 =0xDF , + .fmt_gap =0x2E , + .name ="D800" + },/* 30 800KB 3.5" */ + { + .size =3200 , + .sect =20 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x1C , + .rate =0x00 , + .spec1 =0xCF , + .fmt_gap =0x2C , + .name ="H1600" + },/* 31 1.6MB 3.5" */ };#define SECTSIZE (_FD_SECTSIZE(*floppy))
@@ -505,9 +1025,9 @@ static char floppy_device_name[] = "floppy";static int probing;/* Synchronization of FDC access. */ -#define FD_COMMAND_NONE -1 -#define FD_COMMAND_ERROR 2 -#define FD_COMMAND_OKAY 3 +#define FD_COMMAND_NONE -1 +#define FD_COMMAND_ERROR 2 +#define FD_COMMAND_OKAY 3static volatile int command_status =FD_COMMAND_NONE ;static unsigned long fdc_busy;
@@ -515,11 +1035,12 @@ static DECLARE_WAIT_QUEUE_HEAD(fdc_wait);static DECLARE_WAIT_QUEUE_HEAD (command_done);#define NO_SIGNAL (!interruptible || !signal_pending(current)) -#define CALL (x) if ((x) == -EINTR) return -EINTR -#define ECALL (x) if ((ret = (x))) return ret; -#define _WAIT (x,i) CALL(ret=wait_til_done((x),i)) -#define WAIT (x) _WAIT((x),interruptible) -#define IWAIT (x) _WAIT((x),1) + +#define CALL (x) do { if ((x) == -EINTR) return -EINTR; } while (0) +#define ECALL (x) do { if ((ret = (x))) return ret; } while (0) +#define _WAIT (x, i) CALL(ret = wait_til_done((x), i)) +#define WAIT (x) _WAIT((x), interruptible) +#define IWAIT (x) _WAIT((x), 1)/* Errors during formatting are counted here. */ static int format_errors;
@@ -545,8 +1066,9 @@ static int max_buffer_sectors;static int *errors;typedef void (*done_f )(int ); static struct cont_t { - void (*interrupt)(void); /* this is called after the interrupt of the - * main command */ + void (*interrupt)(void); + /* this is called after the interrupt of the + * main command */ void (*redo)(void); /* this is called to retry the operation */ void (*error)(void); /* this is called to tally an error */ done_f done; /* this is called to say if the operation has
@@ -571,7 +1093,6 @@ static void floppy_release_irq_and_dma(void);* reset doesn't need to be tested before sending commands, because * output_byte is automatically disabled when reset is set. */ -#define CHECK_RESET { if (FDCS->reset){ reset_fdc(); return; } }static void reset_fdc (void );/*
@@ -624,14 +1145,19 @@ static inline void set_debugt(void)static inline void debugt (const char *message) {if (DP ->flags &DEBUGT ) -printk ("%s dtime=%lu\n" , message, jiffies - debugtimer); +pr_info ("%s dtime=%lu\n" , message, jiffies - debugtimer); }#else -static inline void set_debugt (void ) { } -static inline void debugt (const char *message) { } +static inline void set_debugt (void ) +{ +} + +static inline void debugt (const char *message) +{ +}#endif /* DEBUGT */ -typedef void (*timeout_fn ) (unsigned long ); +typedef void (*timeout_fn )(unsigned long ); static DEFINE_TIMER(fd_timeout, floppy_shutdown, 0, 0);static const char *timeout_message;
@@ -647,13 +1173,13 @@ static void is_alive(const char *message) }#endif -static void (*do_floppy) (void ) =NULL ; +static void (*do_floppy)(void ) =NULL ;#ifdef FLOPPY_SANITY_CHECK #define OLOGSIZE 20 -static void (*lasthandler) (void ); +static void (*lasthandler)(void );static unsigned long interruptjiffies;static unsigned long resultjiffies;static int resultsize;
@@ -683,9 +1209,7 @@ static void __reschedule_timeout(int drive, const char *message, int marg) fd_timeout.expires = jiffies +UDP ->timeout;add_timer (&fd_timeout);if (UDP ->flags &FD_DEBUG ) { -DPRINT ("reschedule timeout " ); -printk (message, marg); -printk ("\n" ); +DPRINT ("reschedule timeout %s %d\n" , message, marg); } timeout_message = message; }
@@ -699,8 +1223,8 @@ static void reschedule_timeout(int drive, const char *message, int marg)spin_unlock_irqrestore (&floppy_lock, flags); } -#define INFBOUND (a,b) (a)=max_t(int, a, b) -#define SUPBOUND (a,b) (a)=min_t(int, a, b) +#define INFBOUND (a, b) (a) = max_t(int, a, b) +#define SUPBOUND (a, b) (a) = min_t(int, a, b)/* * Bottom half floppy driver.
@@ -807,9 +1331,8 @@ static int set_dor(int fdc, char mask, char data)if (is_selected (olddor, unit) && !is_selected (newdor, unit)) { drive =REVDRIVE (fdc, unit);#ifdef DCL_DEBUG -if (UDP ->flags &FD_DEBUG ) { +if (UDP ->flags &FD_DEBUG )DPRINT ("calling disk change from set_dor\n" ); - }#endif disk_change (drive); }
@@ -857,7 +1380,7 @@ static void set_fdc(int drive) current_drive = drive; }if (fdc !=1 && fdc !=0 ) { -printk ("bad fdc value\n" ); +pr_info ("bad fdc value\n" );return ; }set_dor (fdc, ~0 ,8 );
@@ -874,8 +1397,7 @@ static void set_fdc(int drive)static int _lock_fdc (int drive,int interruptible,int line) {if (!usage_count) { -printk (KERN_ERR -"Trying to lock fdc while usage count=0 at line %d\n" , +pr_err ("Trying to lock fdc while usage count=0 at line %d\n" , line);return -1 ; }
@@ -909,10 +1431,12 @@ static int _lock_fdc(int drive, int interruptible, int line)return 0 ; } -#define lock_fdc (drive,interruptible) _lock_fdc(drive,interruptible, __LINE__) +#define lock_fdc (drive, interruptible) \ + _lock_fdc(drive, interruptible, __LINE__) -#define LOCK_FDC (drive,interruptible) \ -if (lock_fdc(drive,interruptible)) return -EINTR; +#define LOCK_FDC (drive, interruptible) \ + if (lock_fdc(drive, interruptible)) \ + return -EINTR;/* unlocks the driver */ static inline void unlock_fdc (void )
@@ -1003,7 +1527,7 @@ static void empty(void) static DECLARE_WORK(floppy_work, NULL); -static void schedule_bh (void (*handler) (void )) +static void schedule_bh (void (*handler)(void )) {PREPARE_WORK (&floppy_work, (work_func_t )handler);schedule_work (&floppy_work);
@@ -1027,9 +1551,8 @@ static void cancel_activity(void)static void fd_watchdog (void ) {#ifdef DCL_DEBUG -if (DP ->flags &FD_DEBUG ) { +if (DP ->flags &FD_DEBUG )DPRINT ("calling disk change from watchdog\n" ); - }#endif if (disk_change (current_drive)) {
@@ -1039,7 +1562,7 @@ static void fd_watchdog(void)reset_fdc (); }else {del_timer (&fd_timer); - fd_timer.function = (timeout_fn ) fd_watchdog; + fd_timer.function = (timeout_fn )fd_watchdog; fd_timer.expires = jiffies +HZ /10 ;add_timer (&fd_timer); }
@@ -1109,16 +1632,16 @@ static void setup_DMA(void)if (raw_cmd->length ==0 ) {int i; -printk ("zero dma transfer size:" ); +pr_info ("zero dma transfer size:" );for (i =0 ; i < raw_cmd->cmd_count; i++) -printk ("%x," , raw_cmd->cmd[i]); -printk ("\n" ); +pr_cont ("%x," , raw_cmd->cmd[i]); +pr_cont ("\n" ); cont->done (0 );FDCS ->reset =1 ;return ; }if (((unsigned long )raw_cmd->kernel_data) %512 ) { -printk ("non aligned address: %p\n" , raw_cmd->kernel_data); +pr_info ("non aligned address: %p\n" , raw_cmd->kernel_data); cont->done (0 );FDCS ->reset =1 ;return ;
@@ -1176,10 +1699,11 @@ static int wait_til_ready(void)/* sends a command byte to the fdc */ static int output_byte (char byte) { -int status; +int status =wait_til_ready (); -if ((status =wait_til_ready ()) <0 ) +if (status <0 )return -1 ; +if ((status & (STATUS_READY |STATUS_DIR |STATUS_DMA )) ==STATUS_READY ) {fd_outb (byte,FD_DATA );#ifdef FLOPPY_SANITY_CHECK
@@ -1199,16 +1723,15 @@ static int output_byte(char byte)return -1 ; } -#define LAST_OUT (x) if (output_byte(x)<0){ reset_fdc();return;} -/* gets the response from the fdc */ static int result (void ) {int i; -int status =0 ; +int status;for (i =0 ; i <MAX_REPLIES ; i++) { -if ((status =wait_til_ready ()) <0 ) + status =wait_til_ready (); +if (status <0 )break ; status &=STATUS_DIR |STATUS_READY |STATUS_BUSY |STATUS_DMA ;if ((status & ~STATUS_BUSY ) ==STATUS_READY ) {
@@ -1234,12 +1757,13 @@ static int result(void) }#define MORE_OUTPUT -2 +/* does the fdc need more output? */ static int need_more_output (void ) { -int status; +int status =wait_til_ready (); -if ((status =wait_til_ready ()) <0 ) +if (status <0 )return -1 ;if ((status & (STATUS_READY |STATUS_DIR |STATUS_DMA )) ==STATUS_READY )return MORE_OUTPUT ;
@@ -1264,9 +1788,12 @@ static inline void perpendicular_mode(void)default :DPRINT ("Invalid data rate for perpendicular mode!\n" ); cont->done (0 ); -FDCS ->reset =1 ;/* convenient way to return to -* redo without to much hassle (deep -* stack et al. */ +FDCS ->reset =1 ; +/* +* convenient way to return to +* redo without too much hassle +* (deep stack et al.) +*/ return ; } }else
@@ -1366,9 +1893,9 @@ static void fdc_specify(void)/* Convert step rate from microseconds to milliseconds and 4 bits */ srt =16 -DIV_ROUND_UP (DP ->srt * scale_dtr /1000 ,NOMINAL_DTR ); -if (slow_floppy) { +if (slow_floppy) srt = srt /4 ; - } +SUPBOUND (srt,0xf );INFBOUND (srt,0 );
@@ -1415,20 +1942,50 @@ static int fdc_dtr(void)* Pause 5 msec to avoid trouble. (Needs to be 2 jiffies) */ FDCS ->dtr = raw_cmd->rate &3 ; -return (fd_wait_for_completion (jiffies +2UL *HZ /100 , - (timeout_fn ) floppy_ready)); +return fd_wait_for_completion (jiffies +2UL *HZ /100 , + (timeout_fn )floppy_ready); }/* fdc_dtr */ static void tell_sector (void ) { -printk (": track %d, head %d, sector %d, size %d" , -R_TRACK ,R_HEAD ,R_SECTOR ,R_SIZECODE ); +pr_cont (": track %d, head %d, sector %d, size %d" , +R_TRACK ,R_HEAD ,R_SECTOR ,R_SIZECODE ); }/* tell_sector */ +static void print_errors (void ) +{ +DPRINT ("" ); +if (ST0 &ST0_ECE ) { +pr_cont ("Recalibrate failed!" ); + }else if (ST2 &ST2_CRC ) { +pr_cont ("data CRC error" ); +tell_sector (); + }else if (ST1 &ST1_CRC ) { +pr_cont ("CRC error" ); +tell_sector (); + }else if ((ST1 & (ST1_MAM |ST1_ND )) || + (ST2 &ST2_MAM )) { +if (!probing) { +pr_cont ("sector not found" ); +tell_sector (); + }else +pr_cont ("probe failed..." ); + }else if (ST2 &ST2_WC ) {/* seek error */ +pr_cont ("wrong cylinder" ); + }else if (ST2 &ST2_BC ) {/* cylinder marked as bad */ +pr_cont ("bad cylinder" ); + }else { +pr_cont ("unknown error. ST[0..2] are: 0x%x 0x%x 0x%x" , +ST0 ,ST1 ,ST2 ); +tell_sector (); + } +pr_cont ("\n" ); +} +/* * OK, this error interpreting routine is called after a -* DMA read/write has succeeded -* or failed, so we check the results, and copy any buffers. +* DMA read/write has succeeded or failed, so we check the results, +* and copy any buffers. * hhb: Added better error reporting. * ak: Made this into a separate routine. */
@@ -1460,33 +2017,7 @@ static int interpret_errors(void)DPRINT ("Over/Underrun - retrying\n" ); bad =0 ; }else if (*errors >=DP ->max_errors.reporting) { -DPRINT ("" ); -if (ST0 &ST0_ECE ) { -printk ("Recalibrate failed!" ); - }else if (ST2 &ST2_CRC ) { -printk ("data CRC error" ); -tell_sector (); - }else if (ST1 &ST1_CRC ) { -printk ("CRC error" ); -tell_sector (); - }else if ((ST1 & (ST1_MAM |ST1_ND )) - || (ST2 &ST2_MAM )) { -if (!probing) { -printk ("sector not found" ); -tell_sector (); - }else -printk ("probe failed..." ); - }else if (ST2 &ST2_WC ) {/* seek error */ -printk ("wrong cylinder" ); - }else if (ST2 &ST2_BC ) {/* cylinder marked as bad */ -printk ("bad cylinder" ); - }else { -printk - ("unknown error. ST[0..2] are: 0x%x 0x%x 0x%x" , -ST0 ,ST1 ,ST2 ); -tell_sector (); - } -printk ("\n" ); +print_errors (); }if (ST2 &ST2_WC ||ST2 &ST2_BC )/* wrong cylinder => recal */
@@ -1531,9 +2062,9 @@ static void setup_rw_floppy(void)*/ if (time_after (ready_date, jiffies +DP ->select_delay)) { ready_date -=DP ->select_delay; - function = (timeout_fn ) floppy_start; + function = (timeout_fn )floppy_start; }else - function = (timeout_fn ) setup_rw_floppy; + function = (timeout_fn )setup_rw_floppy;/* wait until the floppy is spinning fast enough */ if (fd_wait_for_completion (ready_date, function))
@@ -1585,8 +2116,7 @@ static void seek_interrupt(void)if (DRS ->track >=0 &&DRS ->track !=ST1 && !blind_seek) {#ifdef DCL_DEBUG if (DP ->flags &FD_DEBUG ) { -DPRINT - ("clearing NEWCHANGE flag because of effective seek\n" ); +DPRINT ("clearing NEWCHANGE flag because of effective seek\n" );DPRINT ("jiffies=%lu\n" , jiffies); }#endif
@@ -1629,9 +2159,8 @@ static void seek_floppy(void) blind_seek =0 ;#ifdef DCL_DEBUG -if (DP ->flags &FD_DEBUG ) { +if (DP ->flags &FD_DEBUG )DPRINT ("calling disk change from seek\n" ); - }#endif if (!TESTF(FD_DISK_NEWCHANGE) &&
@@ -1677,7 +2206,10 @@ static void seek_floppy(void) do_floppy = seek_interrupt;output_byte (FD_SEEK );output_byte (UNIT (current_drive)); -LAST_OUT (track); +if (output_byte (track) <0 ) { +reset_fdc (); +return ; + }debugt ("seek command:" ); }
@@ -1706,10 +2238,8 @@ static void recal_interrupt(void)* be already at track 0.) Clear the * new change flag */ #ifdef DCL_DEBUG -if (DP ->flags &FD_DEBUG ) { -DPRINT - ("clearing NEWCHANGE flag because of second recalibrate\n" ); - } +if (DP ->flags &FD_DEBUG ) +DPRINT ("clearing NEWCHANGE flag because of second recalibrate\n" );#endif CLEARF (FD_DISK_NEWCHANGE );
@@ -1738,8 +2268,8 @@ static void print_result(char *message, int inr)DPRINT ("%s " , message);if (inr >=0 )for (i =0 ; i < inr; i++) -printk ("repl[%d]=%x " , i, reply_buffer[i]); -printk ("\n" ); +pr_cont ("repl[%d]=%x " , i, reply_buffer[i]); +pr_cont ("\n" ); }/* interrupt handler. Note that this can be called externally on the Sparc */
@@ -1760,9 +2290,9 @@ irqreturn_t floppy_interrupt(int irq, void *dev_id) do_floppy =NULL ;if (fdc >=N_FDC ||FDCS ->address ==-1 ) {/* we don't even know which FDC is the culprit */ -printk ("DOR0=%x\n" , fdc_state[0 ].dor); -printk ("floppy interrupt on bizarre fdc %d\n" , fdc); -printk ("handler=%p\n" , handler); +pr_info ("DOR0=%x\n" , fdc_state[0 ].dor); +pr_info ("floppy interrupt on bizarre fdc %d\n" , fdc); +pr_info ("handler=%p\n" , handler);is_alive ("bizarre fdc" );return IRQ_NONE ; }
@@ -1809,7 +2339,10 @@ static void recalibrate_floppy(void)debugt ("recalibrate floppy:" ); do_floppy = recal_interrupt;output_byte (FD_RECALIBRATE ); -LAST_OUT (UNIT (current_drive)); +if (UNIT (current_drive) <0 ) { +reset_fdc (); +return ; + } }/*
@@ -1820,7 +2353,7 @@ static void reset_interrupt(void)debugt ("reset interrupt:" );result ();/* get the status ready for set_fdc */ if (FDCS ->reset) { -printk ("reset set in interrupt, calling %p\n" , cont->error); +pr_info ("reset set in interrupt, calling %p\n" , cont->error); cont->error ();/* a reset just after a reset. BAD! */ } cont->redo ();
@@ -1858,46 +2391,44 @@ static void show_floppy(void) {int i; -printk ("\n" ); -printk ("floppy driver state\n" ); -printk ("-------------------\n" ); -printk ("now=%lu last interrupt=%lu diff=%lu last called handler=%p\n" , - jiffies, interruptjiffies, jiffies - interruptjiffies, - lasthandler); +pr_info ("\n" ); +pr_info ("floppy driver state\n" ); +pr_info ("-------------------\n" ); +pr_info ("now=%lu last interrupt=%lu diff=%lu last called handler=%p\n" , + jiffies, interruptjiffies, jiffies - interruptjiffies, + lasthandler);#ifdef FLOPPY_SANITY_CHECK -printk ("timeout_message=%s\n" , timeout_message); -printk ("last output bytes:\n" ); +pr_info ("timeout_message=%s\n" , timeout_message); +pr_info ("last output bytes:\n" );for (i =0 ; i <OLOGSIZE ; i++) -printk ("%2x %2x %lu\n" , - output_log[(i + output_log_pos) %OLOGSIZE ].data, - output_log[(i + output_log_pos) %OLOGSIZE ].status, - output_log[(i + output_log_pos) %OLOGSIZE ].jiffies); -printk ("last result at %lu\n" , resultjiffies); -printk ("last redo_fd_request at %lu\n" , lastredo); -for (i =0 ; i < resultsize; i++) { -printk ("%2x " , reply_buffer[i]); - } -printk ("\n" ); +pr_info ("%2x %2x %lu\n" , + output_log[(i + output_log_pos) %OLOGSIZE ].data, + output_log[(i + output_log_pos) %OLOGSIZE ].status, + output_log[(i + output_log_pos) %OLOGSIZE ].jiffies); +pr_info ("last result at %lu\n" , resultjiffies); +pr_info ("last redo_fd_request at %lu\n" , lastredo); +print_hex_dump (KERN_INFO ,"" ,DUMP_PREFIX_NONE ,16 ,1 , + reply_buffer, resultsize, true);#endif -printk ("status=%x\n" ,fd_inb (FD_STATUS )); -printk ("fdc_busy=%lu\n" , fdc_busy); +pr_info ("status=%x\n" ,fd_inb (FD_STATUS )); +pr_info ("fdc_busy=%lu\n" , fdc_busy);if (do_floppy) -printk ("do_floppy=%p\n" , do_floppy); +pr_info ("do_floppy=%p\n" , do_floppy);if (work_pending (&floppy_work)) -printk ("floppy_work.func=%p\n" , floppy_work.func); +pr_info ("floppy_work.func=%p\n" , floppy_work.func);if (timer_pending (&fd_timer)) -printk ("fd_timer.function=%p\n" , fd_timer.function); +pr_info ("fd_timer.function=%p\n" , fd_timer.function);if (timer_pending (&fd_timeout)) { -printk ("timer_function=%p\n" , fd_timeout.function); -printk ("expires=%lu\n" , fd_timeout.expires - jiffies); -printk ("now=%lu\n" , jiffies); - } -printk ("cont=%p\n" , cont); -printk ("current_req=%p\n" , current_req); -printk ("command_status=%d\n" , command_status); -printk ("\n" ); +pr_info ("timer_function=%p\n" , fd_timeout.function); +pr_info ("expires=%lu\n" , fd_timeout.expires - jiffies); +pr_info ("now=%lu\n" , jiffies); + } +pr_info ("cont=%p\n" , cont); +pr_info ("current_req=%p\n" , current_req); +pr_info ("command_status=%d\n" , command_status); +pr_info ("\n" ); }static void floppy_shutdown (unsigned long data)
@@ -1923,7 +2454,7 @@ static void floppy_shutdown(unsigned long data) cont->done (0 ); cont->redo ();/* this will recall reset when needed */ }else { -printk ("no cont in shutdown!\n" ); +pr_info ("no cont in shutdown!\n" );process_fd_request (); }is_alive ("floppy shutdown" );
@@ -1954,27 +2485,29 @@ static int start_motor(void (*function)(void))set_dor (fdc, mask, data);/* wait_for_completion also schedules reset if needed. */ -return (fd_wait_for_completion (DRS ->select_date +DP ->select_delay, - (timeout_fn ) function)); +return fd_wait_for_completion (DRS ->select_date +DP ->select_delay, + (timeout_fn )function); }static void floppy_ready (void ) { -CHECK_RESET ; +if (FDCS ->reset) { +reset_fdc (); +return ; + }if (start_motor (floppy_ready))return ;if (fdc_dtr ())return ;#ifdef DCL_DEBUG -if (DP ->flags &FD_DEBUG ) { +if (DP ->flags &FD_DEBUG )DPRINT ("calling disk change from floppy_ready\n" ); - }#endif if (!(raw_cmd->flags &FD_RAW_NO_MOTOR ) &&disk_change (current_drive) && !DP ->select_delay) -twaddle ();/* this clears the dcl on certain drive/controller -* combinations */ +twaddle ();/* this clears the dcl on certain +* drive/controller combinations */ #ifdef fd_chose_dma_modeif ((raw_cmd->flags &FD_RAW_READ ) || (raw_cmd->flags &FD_RAW_WRITE )) {
@@ -2002,9 +2535,8 @@ static void floppy_start(void)scandrives ();#ifdef DCL_DEBUG -if (DP ->flags &FD_DEBUG ) { +if (DP ->flags &FD_DEBUG )DPRINT ("setting NEWCHANGE in floppy_start\n" ); - }#endif SETF (FD_DISK_NEWCHANGE );floppy_ready ();
@@ -2181,8 +2713,9 @@ static void format_interrupt(void) }#define CODE2SIZE (ssize = ((1 << SIZECODE) + 3) >> 2) -#define FM_MODE (x,y) ((y) & ~(((x)->rate & 0x80) >>1)) +#define FM_MODE (x, y) ((y) & ~(((x)->rate & 0x80) >> 1))#define CT (x) ((x) | 0xc0) +static void setup_format_params (int track) {int n;
@@ -2197,8 +2730,8 @@ static void setup_format_params(int track) raw_cmd = &default_raw_cmd; raw_cmd->track = track; - raw_cmd->flags =FD_RAW_WRITE |FD_RAW_INTR |FD_RAW_SPIN | -FD_RAW_NEED_DISK |FD_RAW_NEED_SEEK ; + raw_cmd->flags = (FD_RAW_WRITE |FD_RAW_INTR |FD_RAW_SPIN | +FD_RAW_NEED_DISK |FD_RAW_NEED_SEEK ); raw_cmd->rate = _floppy->rate &0x43 ; raw_cmd->cmd_count =NR_F ;COMMAND =FM_MODE (_floppy,FD_FORMAT );
@@ -2325,7 +2858,7 @@ static void request_done(int uptodate)reschedule_timeout (MAXTIMEOUT ,"request done %d" , uptodate);if (!req) { -printk ("floppy.c: no request in request_done\n" ); +pr_info ("floppy.c: no request in request_done\n" );return ; }
@@ -2398,13 +2931,13 @@ static void rw_interrupt(void) DIV_ROUND_UP(in_sector_offset + current_count_sectors, ssize)) {DPRINT ("long rw: %x instead of %lx\n" , nr_sectors, current_count_sectors); -printk ("rs=%d s=%d\n" ,R_SECTOR ,SECTOR ); -printk ("rh=%d h=%d\n" ,R_HEAD ,HEAD ); -printk ("rt=%d t=%d\n" ,R_TRACK ,TRACK ); -printk ("heads=%d eoc=%d\n" , heads, eoc); -printk ("spt=%d st=%d ss=%d\n" ,SECT_PER_TRACK , - fsector_t, ssize); -printk ("in_sector_offset=%d\n" , in_sector_offset); +pr_info ("rs=%d s=%d\n" ,R_SECTOR ,SECTOR ); +pr_info ("rh=%d h=%d\n" ,R_HEAD ,HEAD ); +pr_info ("rt=%d t=%d\n" ,R_TRACK ,TRACK ); +pr_info ("heads=%d eoc=%d\n" , heads, eoc); +pr_info ("spt=%d st=%d ss=%d\n" , +SECT_PER_TRACK , fsector_t, ssize); +pr_info ("in_sector_offset=%d\n" , in_sector_offset); }#endif
@@ -2514,14 +3047,14 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2)#ifdef FLOPPY_SANITY_CHECK if (remaining >blk_rq_bytes (current_req) &&CT (COMMAND ) ==FD_WRITE ) {DPRINT ("in copy buffer\n" ); -printk ("current_count_sectors=%ld\n" , current_count_sectors); -printk ("remaining=%d\n" , remaining >>9 ); -printk ("current_req->nr_sectors=%u\n" , -blk_rq_sectors (current_req)); -printk ("current_req->current_nr_sectors=%u\n" , -blk_rq_cur_sectors (current_req)); -printk ("max_sector=%d\n" , max_sector); -printk ("ssize=%d\n" , ssize); +pr_info ("current_count_sectors=%ld\n" , current_count_sectors); +pr_info ("remaining=%d\n" , remaining >>9 ); +pr_info ("current_req->nr_sectors=%u\n" , +blk_rq_sectors (current_req)); +pr_info ("current_req->current_nr_sectors=%u\n" , +blk_rq_cur_sectors (current_req)); +pr_info ("max_sector=%d\n" , max_sector); +pr_info ("ssize=%d\n" , ssize); }#endif
@@ -2544,16 +3077,15 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2) floppy_track_buffer + (max_buffer_sectors << 10) || dma_buffer < floppy_track_buffer) {DPRINT ("buffer overrun in copy buffer %d\n" , - (int )((floppy_track_buffer - - dma_buffer) >>9 )); -printk ("fsector_t=%d buffer_min=%d\n" , - fsector_t, buffer_min); -printk ("current_count_sectors=%ld\n" , - current_count_sectors); + (int )((floppy_track_buffer - dma_buffer) >>9 )); +pr_info ("fsector_t=%d buffer_min=%d\n" , + fsector_t, buffer_min); +pr_info ("current_count_sectors=%ld\n" , + current_count_sectors);if (CT (COMMAND ) ==FD_READ ) -printk ("read\n" ); +pr_info ("read\n" );if (CT (COMMAND ) ==FD_WRITE ) -printk ("write\n" ); +pr_info ("write\n" );break ; }if (((unsigned long )buffer) %512 )
@@ -2595,13 +3127,14 @@ static void virtualdmabug_workaround(void) end_sector =SECTOR + hard_sectors -1 ;#ifdef FLOPPY_SANITY_CHECK if (end_sector >SECT_PER_TRACK ) { -printk ("too many sectors %d > %d\n" , - end_sector,SECT_PER_TRACK ); +pr_info ("too many sectors %d > %d\n" , + end_sector,SECT_PER_TRACK );return ; }#endif -SECT_PER_TRACK = end_sector;/* make sure SECT_PER_TRACK points -* to end of transfer */ +SECT_PER_TRACK = end_sector; +/* make sure SECT_PER_TRACK +* points to end of transfer */ } }
@@ -2624,7 +3157,7 @@ static int make_raw_rw_request(void)int ssize;if (max_buffer_sectors ==0 ) { -printk ("VFS: Block I/O scheduled on unopened device\n" ); +pr_info ("VFS: Block I/O scheduled on unopened device\n" );return 0 ; }
@@ -2731,7 +3264,8 @@ static int make_raw_rw_request(void) }else if (in_sector_offset ||blk_rq_sectors (current_req) < ssize) {if (CT (COMMAND ) ==FD_WRITE ) {if (fsector_t +blk_rq_sectors (current_req) > ssize && - fsector_t +blk_rq_sectors (current_req) < ssize + ssize) + fsector_t +blk_rq_sectors (current_req) < + ssize + ssize) max_size = ssize + ssize;else max_size = ssize;
@@ -2755,9 +3289,8 @@ static int make_raw_rw_request(void) dma_limit = (MAX_DMA_ADDRESS - ((unsigned long )current_req->buffer)) >>9 ; -if ((unsigned long )max_size > dma_limit) { +if ((unsigned long )max_size > dma_limit) max_size = dma_limit; - }/* 64 kb boundaries */ if (CROSS_64KB (current_req->buffer, max_size <<9 )) max_size = (K_64 -
@@ -2773,15 +3306,15 @@ static int make_raw_rw_request(void)*/ if (!direct || (indirect *2 > direct *3 && - *errors <DP ->max_errors.read_track && ((!probing - || (DP ->read_track & (1 <<DRS ->probed_format)))))) { + *errors <DP ->max_errors.read_track && + ((!probing || + (DP ->read_track & (1 <<DRS ->probed_format)))))) { max_size =blk_rq_sectors (current_req); }else { raw_cmd->kernel_data = current_req->buffer; raw_cmd->length = current_count_sectors <<9 ;if (raw_cmd->length ==0 ) { -DPRINT - ("zero dma transfer attempted from make_raw_request\n" ); +DPRINT ("zero dma transfer attempted from make_raw_request\n" );DPRINT ("indirect=%d direct=%d fsector_t=%d" , indirect, direct, fsector_t);return 0 ;
@@ -2802,15 +3335,14 @@ static int make_raw_rw_request(void) ((CT(COMMAND) == FD_READ || (!in_sector_offset && blk_rq_sectors(current_req) >= ssize)) && max_sector > 2 * max_buffer_sectors + buffer_min && - max_size + fsector_t >2 * max_buffer_sectors + buffer_min) -/* not enough space */ - ) { + max_size + fsector_t > 2 * max_buffer_sectors + buffer_min)) { +/* not enough space */ buffer_track =-1 ; buffer_drive = current_drive; buffer_max = buffer_min = aligned_sector_t; } raw_cmd->kernel_data = floppy_track_buffer + - ((aligned_sector_t - buffer_min) <<9 ); + ((aligned_sector_t - buffer_min) <<9 );if (CT (COMMAND ) ==FD_WRITE ) {/* copy write buffer to track buffer.
@@ -2845,19 +3377,19 @@ static int make_raw_rw_request(void)DPRINT ("fractionary current count b=%lx s=%lx\n" , raw_cmd->length, current_count_sectors);if (raw_cmd->kernel_data != current_req->buffer) -printk ("addr=%d, length=%ld\n" , - (int )((raw_cmd->kernel_data - - floppy_track_buffer) >>9 ), - current_count_sectors); -printk ("st=%d ast=%d mse=%d msi=%d\n" , - fsector_t, aligned_sector_t, max_sector, max_size); -printk ("ssize=%x SIZECODE=%d\n" , ssize,SIZECODE ); -printk ("command=%x SECTOR=%d HEAD=%d, TRACK=%d\n" , -COMMAND ,SECTOR ,HEAD ,TRACK ); -printk ("buffer drive=%d\n" , buffer_drive); -printk ("buffer track=%d\n" , buffer_track); -printk ("buffer_min=%d\n" , buffer_min); -printk ("buffer_max=%d\n" , buffer_max); +pr_info ("addr=%d, length=%ld\n" , + (int )((raw_cmd->kernel_data - + floppy_track_buffer) >>9 ), + current_count_sectors); +pr_info ("st=%d ast=%d mse=%d msi=%d\n" , + fsector_t, aligned_sector_t, max_sector, max_size); +pr_info ("ssize=%x SIZECODE=%d\n" , ssize,SIZECODE ); +pr_info ("command=%x SECTOR=%d HEAD=%d, TRACK=%d\n" , +COMMAND ,SECTOR ,HEAD ,TRACK ); +pr_info ("buffer drive=%d\n" , buffer_drive); +pr_info ("buffer track=%d\n" , buffer_track); +pr_info ("buffer_min=%d\n" , buffer_min); +pr_info ("buffer_max=%d\n" , buffer_max);return 0 ; }
@@ -2868,14 +3400,14 @@ static int make_raw_rw_request(void) raw_cmd->kernel_data + raw_cmd->length > floppy_track_buffer + (max_buffer_sectors << 10)) {DPRINT ("buffer overrun in schedule dma\n" ); -printk ("fsector_t=%d buffer_min=%d current_count=%ld\n" , - fsector_t, buffer_min, raw_cmd->length >>9 ); -printk ("current_count_sectors=%ld\n" , - current_count_sectors); +pr_info ("fsector_t=%d buffer_min=%d current_count=%ld\n" , + fsector_t, buffer_min, raw_cmd->length >>9 ); +pr_info ("current_count_sectors=%ld\n" , + current_count_sectors);if (CT (COMMAND ) ==FD_READ ) -printk ("read\n" ); +pr_info ("read\n" );if (CT (COMMAND ) ==FD_WRITE ) -printk ("write\n" ); +pr_info ("write\n" );return 0 ; } } else if (raw_cmd->length > blk_rq_bytes(current_req) ||
@@ -2884,8 +3416,8 @@ static int make_raw_rw_request(void)return 0 ; }else if (raw_cmd->length < current_count_sectors <<9 ) {DPRINT ("more sectors than bytes\n" ); -printk ("bytes=%ld\n" , raw_cmd->length >>9 ); -printk ("sectors=%ld\n" , current_count_sectors); +pr_info ("bytes=%ld\n" , raw_cmd->length >>9 ); +pr_info ("sectors=%ld\n" , current_count_sectors); }if (raw_cmd->length ==0 ) {DPRINT ("zero dma transfer attempted from make_raw_request\n" );
@@ -2979,19 +3511,19 @@ static void process_fd_request(void)schedule_bh (redo_fd_request); } -static void do_fd_request (struct request_queue * q) +static void do_fd_request (struct request_queue *q) {if (max_buffer_sectors ==0 ) { -printk ("VFS: do_fd_request called on non-open device\n" ); +pr_info ("VFS: do_fd_request called on non-open device\n" );return ; }if (usage_count ==0 ) { -printk ("warning: usage count=0, current_req=%p exiting\n" , - current_req); -printk ("sect=%ld type=%x flags=%x\n" , - (long )blk_rq_pos (current_req), current_req->cmd_type, - current_req->cmd_flags); +pr_info ("warning: usage count=0, current_req=%p exiting\n" , + current_req); +pr_info ("sect=%ld type=%x flags=%x\n" , + (long )blk_rq_pos (current_req), current_req->cmd_type, + current_req->cmd_flags);return ; }if (test_bit (0 , &fdc_busy)) {
@@ -3023,9 +3555,8 @@ static int poll_drive(int interruptible, int flag) raw_cmd->cmd_count =0 ; cont = &poll_cont;#ifdef DCL_DEBUG -if (DP ->flags &FD_DEBUG ) { +if (DP ->flags &FD_DEBUG )DPRINT ("setting NEWCHANGE in poll_drive\n" ); - }#endif SETF (FD_DISK_NEWCHANGE );WAIT (floppy_ready);
@@ -3039,7 +3570,7 @@ static int poll_drive(int interruptible, int flag)static void reset_intr (void ) { -printk ("weird, reset interrupt called\n" ); +pr_info ("weird, reset interrupt called\n" ); }static struct cont_t reset_cont = {
@@ -3075,16 +3606,19 @@ static inline int fd_copyout(void __user *param, const void *address,return copy_to_user (param, address, size) ? -EFAULT :0 ; } -static inline int fd_copyin (void __user *param,void *address,unsigned long size) +static inline int fd_copyin (void __user *param,void *address, +unsigned long size) {return copy_from_user (address, param, size) ? -EFAULT :0 ; } -#define _COPYOUT (x) (copy_to_user((void __user *)param, &(x), sizeof(x)) ? -EFAULT : 0) -#define _COPYIN (x) (copy_from_user(&(x), (void __user *)param, sizeof(x)) ? -EFAULT : 0) +#define _COPYOUT (x) (copy_to_user((void __user *)param, &(x), sizeof(x)) \ + ? -EFAULT : 0) +#define _COPYIN (x) (copy_from_user(&(x), (void __user *)param, sizeof(x)) \ + ? -EFAULT : 0) -#define COPYOUT (x) ECALL(_COPYOUT(x)) -#define COPYIN (x) ECALL(_COPYIN(x)) +#define COPYOUT (x) ECALL(_COPYOUT(x)) +#define COPYIN (x) ECALL(_COPYIN(x))static inline const char *drive_name (int type,int drive) {
@@ -3165,11 +3699,12 @@ static inline int raw_cmd_copyout(int cmd, char __user *param,COPYOUT (*ptr); param +=sizeof (struct floppy_raw_cmd );if ((ptr->flags &FD_RAW_READ ) && ptr->buffer_length) { -if (ptr->length >=0 - && ptr->length <= ptr->buffer_length) -ECALL (fd_copyout - (ptr->data, ptr->kernel_data, - ptr->buffer_length - ptr->length)); +if (ptr->length >=0 && + ptr->length <= ptr->buffer_length) { +long length = ptr->buffer_length - ptr->length; +ECALL (fd_copyout (ptr->data, ptr->kernel_data, + length)); + } } ptr = ptr->next; }
@@ -3204,8 +3739,7 @@ static inline int raw_cmd_copyin(int cmd, char __user *param, *rcmd =NULL ;while (1 ) { - ptr = (struct floppy_raw_cmd *) -kmalloc (sizeof (struct floppy_raw_cmd ),GFP_USER ); + ptr =kmalloc (sizeof (struct floppy_raw_cmd ),GFP_USER );if (!ptr)return -ENOMEM ; *rcmd = ptr;
@@ -3285,9 +3819,8 @@ static int raw_cmd_ioctl(int cmd, void __user *param) cont = &raw_cmd_cont; ret =wait_til_done (floppy_start,1 );#ifdef DCL_DEBUG -if (DP ->flags &FD_DEBUG ) { +if (DP ->flags &FD_DEBUG )DPRINT ("calling disk change from raw_cmd ioctl\n" ); - }#endif if (ret != -EINTR &&FDCS ->reset)
@@ -3415,7 +3948,7 @@ static inline int normalize_ioctl(int *cmd, int *size) *size =_IOC_SIZE (*cmd); *cmd = ioctl_table[i];if (*size >_IOC_SIZE (*cmd)) { -printk ("ioctl not yet supported\n" ); +pr_info ("ioctl not yet supported\n" );return -EFAULT ; }return 0 ;
@@ -3459,9 +3992,7 @@ static int fd_getgeo(struct block_device *bdev, struct hd_geometry *geo)static int fd_ioctl (struct block_device *bdev,fmode_t mode,unsigned int cmd,unsigned long param) { -#define FD_IOCTL_ALLOWED (mode & (FMODE_WRITE|FMODE_WRITE_IOCTL)) -#define OUT (c,x) case c: outparam = (const char *) (x); break -#define IN (c,x,tag) case c: *(x) = inparam. tag ; return 0 +#define FD_IOCTL_ALLOWED (mode & (FMODE_WRITE | FMODE_WRITE_IOCTL))int drive = (long )bdev->bd_disk->private_data;int type =ITYPE (UDRS ->fd_device);
@@ -3479,143 +4010,163 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,/* convert compatibility eject ioctls into floppy eject ioctl. * We do this in order to provide a means to eject floppy disks before * installing the new fdutils package */ -if (cmd ==CDROMEJECT ||/* CD-ROM eject */ - cmd ==0x6470 /* SunOS floppy eject */ ) { +if (cmd ==CDROMEJECT || cmd ==0x6470 ) {DPRINT ("obsolete eject ioctl\n" );DPRINT ("please use floppycontrol --eject\n" ); cmd =FDEJECT ; } -/* convert the old style command into a new style command */ -if ((cmd &0xff00 ) ==0x0200 ) { -ECALL (normalize_ioctl (&cmd, &size)); - }else +if ((cmd &0xff00 ) !=0x0200 )return -EINVAL ; +/* convert the old style command into a new style command */ +ECALL (normalize_ioctl (&cmd, &size)); +/* permission checks */ if (((cmd &0x40 ) && !FD_IOCTL_ALLOWED ) || ((cmd &0x80 ) && !capable (CAP_SYS_ADMIN )))return -EPERM ;/* copyin */ -CLEARSTRUCT (&inparam); +memset (&inparam,0 ,sizeof (inparam));if (_IOC_DIR (cmd) & _IOC_WRITE) - ECALL(fd_copyin((void __user *)param, &inparam, size)) +ECALL (fd_copyin ((void __user *)param, &inparam, size)); -switch (cmd) { -case FDEJECT : -if (UDRS ->fd_ref !=1 ) -/* somebody else has this drive open */ -return -EBUSY ; -LOCK_FDC (drive,1 ); +switch (cmd) { +case FDEJECT : +if (UDRS ->fd_ref !=1 ) +/* somebody else has this drive open */ +return -EBUSY ; +LOCK_FDC (drive,1 ); -/* do the actual eject. Fails on -* non-Sparc architectures */ - ret =fd_eject (UNIT (drive)); +/* do the actual eject. Fails on +* non-Sparc architectures */ + ret =fd_eject (UNIT (drive)); -USETF (FD_DISK_CHANGED ); -USETF (FD_VERIFY ); -process_fd_request (); -return ret; -case FDCLRPRM : -LOCK_FDC (drive,1 ); - current_type[drive] =NULL ; - floppy_sizes[drive] =MAX_DISK_SIZE <<1 ; -UDRS ->keep_data =0 ; -return invalidate_drive (bdev); -case FDSETPRM : -case FDDEFPRM : -return set_geometry (cmd, &inparam.g, - drive, type, bdev); -case FDGETPRM : -ECALL (get_floppy_geometry (drive, type, - (struct floppy_struct **) - &outparam)); -break ; +USETF (FD_DISK_CHANGED ); +USETF (FD_VERIFY ); +process_fd_request (); +return ret; -case FDMSGON : -UDP ->flags |=FTD_MSG ; -return 0 ; -case FDMSGOFF : -UDP ->flags &= ~FTD_MSG ; -return 0 ; +case FDCLRPRM : +LOCK_FDC (drive,1 ); + current_type[drive] =NULL ; + floppy_sizes[drive] =MAX_DISK_SIZE <<1 ; +UDRS ->keep_data =0 ; +return invalidate_drive (bdev); + +case FDSETPRM : +case FDDEFPRM : +return set_geometry (cmd, &inparam.g, drive, type, bdev); + +case FDGETPRM : +ECALL (get_floppy_geometry (drive, type, + (struct floppy_struct **) + &outparam)); +break ; -case FDFMTBEG : -LOCK_FDC (drive,1 ); -CALL (poll_drive (1 ,FD_RAW_NEED_DISK )); - ret =UDRS ->flags; -process_fd_request (); -if (ret &FD_VERIFY ) -return -ENODEV ; -if (!(ret &FD_DISK_WRITABLE )) -return -EROFS ; -return 0 ; -case FDFMTTRK : -if (UDRS ->fd_ref !=1 ) -return -EBUSY ; -return do_format (drive, &inparam.f); -case FDFMTEND : -case FDFLUSH : -LOCK_FDC (drive,1 ); -return invalidate_drive (bdev); - -case FDSETEMSGTRESH : -UDP ->max_errors.reporting = - (unsigned short )(param &0x0f ); -return 0 ; -OUT (FDGETMAXERRS , &UDP ->max_errors); -IN (FDSETMAXERRS , &UDP ->max_errors, max_errors); +case FDMSGON : +UDP ->flags |=FTD_MSG ; +return 0 ; -case FDGETDRVTYP : - outparam =drive_name (type, drive); -SUPBOUND (size,strlen (outparam) +1 ); -break ; +case FDMSGOFF : +UDP ->flags &= ~FTD_MSG ; +return 0 ; -IN (FDSETDRVPRM ,UDP , dp); -OUT (FDGETDRVPRM ,UDP ); +case FDFMTBEG : +LOCK_FDC (drive,1 ); +CALL (poll_drive (1 ,FD_RAW_NEED_DISK )); + ret =UDRS ->flags; +process_fd_request (); +if (ret &FD_VERIFY ) +return -ENODEV ; +if (!(ret &FD_DISK_WRITABLE )) +return -EROFS ; +return 0 ; -case FDPOLLDRVSTAT : -LOCK_FDC (drive,1 ); -CALL (poll_drive (1 ,FD_RAW_NEED_DISK )); -process_fd_request (); -/* fall through */ -OUT (FDGETDRVSTAT ,UDRS ); +case FDFMTTRK : +if (UDRS ->fd_ref !=1 ) +return -EBUSY ; +return do_format (drive, &inparam.f); -case FDRESET : -return user_reset_fdc (drive, (int )param,1 ); +case FDFMTEND : +case FDFLUSH : +LOCK_FDC (drive,1 ); +return invalidate_drive (bdev); -OUT (FDGETFDCSTAT ,UFDCS ); +case FDSETEMSGTRESH : +UDP ->max_errors.reporting = (unsigned short )(param &0x0f ); +return 0 ; -case FDWERRORCLR : -CLEARSTRUCT (UDRWE ); -return 0 ; -OUT (FDWERRORGET ,UDRWE ); +case FDGETMAXERRS : + outparam = (const char *)&UDP ->max_errors; +break ; -case FDRAWCMD : -if (type) -return -EINVAL ; -LOCK_FDC (drive,1 ); -set_floppy (drive); -CALL (i =raw_cmd_ioctl (cmd, (void __user *)param)); -process_fd_request (); -return i; +case FDSETMAXERRS : +UDP ->max_errors = inparam.max_errors; +return 0 ; -case FDTWADDLE : -LOCK_FDC (drive,1 ); -twaddle (); -process_fd_request (); -return 0 ; +case FDGETDRVTYP : + outparam =drive_name (type, drive); +SUPBOUND (size,strlen (outparam) +1 ); +break ; -default : +case FDSETDRVPRM : + *UDP = inparam.dp; +return 0 ; + +case FDGETDRVPRM : + outparam = (const char *)UDP ; +break ; + +case FDPOLLDRVSTAT : +LOCK_FDC (drive,1 ); +CALL (poll_drive (1 ,FD_RAW_NEED_DISK )); +process_fd_request (); +/* fall through */ + +case FDGETDRVSTAT : + outparam = (const char *)UDRS ; +break ; + +case FDRESET : +return user_reset_fdc (drive, (int )param,1 ); + +case FDGETFDCSTAT : + outparam = (const char *)UFDCS ; +break ; + +case FDWERRORCLR : +memset (UDRWE ,0 ,sizeof (*UDRWE )); +return 0 ; + +case FDWERRORGET : + outparam = (const char *)UDRWE ; +break ; + +case FDRAWCMD : +if (type)return -EINVAL ; - } +LOCK_FDC (drive,1 ); +set_floppy (drive); +CALL (i =raw_cmd_ioctl (cmd, (void __user *)param)); +process_fd_request (); +return i; + +case FDTWADDLE : +LOCK_FDC (drive,1 ); +twaddle (); +process_fd_request (); +return 0 ; + +default : +return -EINVAL ; + }if (_IOC_DIR (cmd) & _IOC_READ)return fd_copyout ((void __user *)param, outparam, size);else return 0 ; -#undef OUT -#undef IN }static void __init config_types (void )
@@ -3654,15 +4205,16 @@ static void __init config_types(void)if (name) {const char *prepend ="," ;if (first) { - prepend =KERN_INFO "Floppy drive(s):" ; +pr_info ("Floppy drive(s):" ); + prepend ="" ; first =0 ; } -printk ("%s fd%d is %s" , prepend, drive, name); +pr_cont ("%s fd%d is %s" , prepend, drive, name); } *UDP = *params; }if (!first) -printk ("\n" ); +pr_cont ("\n" ); }static int floppy_release (struct gendisk *disk,fmode_t mode)
@@ -3732,9 +4284,8 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)INFBOUND (try,16 ); tmp = (char *)fd_dma_mem_alloc (1024 * try); } -if (!tmp && !floppy_track_buffer) { +if (!tmp && !floppy_track_buffer)fallback_on_nodma_alloc (&tmp,2048 * try); - }if (!tmp && !floppy_track_buffer) {DPRINT ("Unable to allocate DMA memory\n" ); goto out;
@@ -3761,7 +4312,7 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)UFDCS ->rawcmd =2 ;if (!(mode &FMODE_NDELAY )) { -if (mode & (FMODE_READ |FMODE_WRITE )) { +if (mode & (FMODE_READ |FMODE_WRITE )) {UDRS ->last_checked =0 ;check_disk_change (bdev);if (UTESTF (FD_DISK_CHANGED ))
@@ -3815,8 +4366,7 @@ static int check_floppy_change(struct gendisk *disk)* a disk in the drive, and whether that disk is writable. */ -static void floppy_rb0_complete (struct bio *bio, -int err) +static void floppy_rb0_complete (struct bio *bio,int err) {complete ((struct completion *)bio->bi_private); }
@@ -3877,13 +4427,14 @@ static int floppy_revalidate(struct gendisk *disk)if (UTESTF (FD_DISK_CHANGED ) ||UTESTF (FD_VERIFY ) ||test_bit (drive, &fake_change) ||NO_GEOM ) {if (usage_count ==0 ) { -printk ("VFS: revalidate called on non-open device.\n" ); +pr_info ("VFS: revalidate called on non-open device.\n" );return -EFAULT ; }lock_fdc (drive,0 ); cf =UTESTF (FD_DISK_CHANGED ) ||UTESTF (FD_VERIFY );if (!(cf ||test_bit (drive, &fake_change) ||NO_GEOM )) { -process_fd_request ();/*already done by another thread */ +process_fd_request (); +/*already done by another thread */ return 0 ; }UDRS ->maxblock =0 ;
@@ -3908,13 +4459,13 @@ static int floppy_revalidate(struct gendisk *disk) }static const struct block_device_operations floppy_fops = { - .owner =THIS_MODULE , - .open = floppy_open, - .release = floppy_release, - .locked_ioctl = fd_ioctl, - .getgeo = fd_getgeo, - .media_changed = check_floppy_change, - .revalidate_disk = floppy_revalidate, + .owner =THIS_MODULE , + .open = floppy_open, + .release = floppy_release, + .locked_ioctl = fd_ioctl, + .getgeo = fd_getgeo, + .media_changed = check_floppy_change, + .revalidate_disk = floppy_revalidate, };/*
@@ -3931,21 +4482,21 @@ static char __init get_fdc_version(void)output_byte (FD_DUMPREGS );/* 82072 and better know DUMPREGS */ if (FDCS ->reset)return FDC_NONE ; -if ((r =result ()) <=0x00 ) + r =result (); +if (r <=0x00 )return FDC_NONE ;/* No FDC present ??? */ if ((r ==1 ) && (reply_buffer[0 ] ==0x80 )) { -printk (KERN_INFO "FDC %d is an 8272A\n" , fdc); +pr_info ("FDC %d is an 8272A\n" , fdc);return FDC_8272A ;/* 8272a/765 don't know DUMPREGS */ }if (r !=10 ) { -printk - ("FDC %d init: DUMPREGS: unexpected return of %d bytes.\n" , - fdc, r); +pr_info ("FDC %d init: DUMPREGS: unexpected return of %d bytes.\n" , + fdc, r);return FDC_UNKNOWN ; }if (!fdc_configure ()) { -printk (KERN_INFO "FDC %d is an 82072\n" , fdc); +pr_info ("FDC %d is an 82072\n" , fdc);return FDC_82072 ;/* 82072 doesn't know CONFIGURE */ }
@@ -3953,52 +4504,51 @@ static char __init get_fdc_version(void)if (need_more_output () ==MORE_OUTPUT ) {output_byte (0 ); }else { -printk (KERN_INFO "FDC %d is an 82072A\n" , fdc); +pr_info ("FDC %d is an 82072A\n" , fdc);return FDC_82072A ;/* 82072A as found on Sparcs. */ }output_byte (FD_UNLOCK ); r =result ();if ((r ==1 ) && (reply_buffer[0 ] ==0x80 )) { -printk (KERN_INFO "FDC %d is a pre-1991 82077\n" , fdc); -return FDC_82077_ORIG ;/* Pre-1991 82077, doesn't know -* LOCK/UNLOCK */ +pr_info ("FDC %d is a pre-1991 82077\n" , fdc); +return FDC_82077_ORIG ;/* Pre-1991 82077, +doesn't know LOCK/UNLOCK */ }if ((r !=1 ) || (reply_buffer[0 ] !=0x00 )) { -printk ("FDC %d init: UNLOCK: unexpected return of %d bytes.\n" , - fdc, r); +pr_info ("FDC %d init: UNLOCK: unexpected return of %d bytes.\n" , + fdc, r);return FDC_UNKNOWN ; }output_byte (FD_PARTID ); r =result ();if (r !=1 ) { -printk ("FDC %d init: PARTID: unexpected return of %d bytes.\n" , - fdc, r); +pr_info ("FDC %d init: PARTID: unexpected return of %d bytes.\n" , + fdc, r);return FDC_UNKNOWN ; }if (reply_buffer[0 ] ==0x80 ) { -printk (KERN_INFO "FDC %d is a post-1991 82077\n" , fdc); -return FDC_82077 ;/* Revised 82077AA passes all the tests */ +pr_info ("FDC %d is a post-1991 82077\n" , fdc); +return FDC_82077 ; +/* Revised 82077AA passes all the tests */ }switch (reply_buffer[0 ] >>5 ) {case 0x0 :/* Either a 82078-1 or a 82078SL running at 5Volt */ -printk (KERN_INFO "FDC %d is an 82078.\n" , fdc); +pr_info ("FDC %d is an 82078.\n" , fdc);return FDC_82078 ;case 0x1 : -printk (KERN_INFO "FDC %d is a 44pin 82078\n" , fdc); +pr_info ("FDC %d is a 44pin 82078\n" , fdc);return FDC_82078 ;case 0x2 : -printk (KERN_INFO "FDC %d is a S82078B\n" , fdc); +pr_info ("FDC %d is a S82078B\n" , fdc);return FDC_S82078B ;case 0x3 : -printk (KERN_INFO "FDC %d is a National Semiconductor PC87306\n" , - fdc); +pr_info ("FDC %d is a National Semiconductor PC87306\n" , fdc);return FDC_87306 ;default : -printk (KERN_INFO -"FDC %d init: 82078 variant with unknown PARTID=%d.\n" , - fdc, reply_buffer[0 ] >>5 ); +pr_info ("FDC %d init: 82078 variant with unknown PARTID=%d.\n" , + fdc, reply_buffer[0 ] >>5 );return FDC_82078_UNKN ; } }/* get_fdc_version */
@@ -4060,37 +4610,181 @@ static void __init set_cmos(int *ints, int dummy, int dummy2)static struct param_table {const char *name; -void (*fn) (int *ints,int param,int param2); +void (*fn)(int *ints,int param,int param2);int *var;int def_param;int param2; } config_params[]__initdata = { - {"allowed_drive_mask" ,NULL , &allowed_drive_mask,0xff ,0 },/* obsolete */ - {"all_drives" ,NULL , &allowed_drive_mask,0xff ,0 },/* obsolete */ - {"asus_pci" ,NULL , &allowed_drive_mask,0x33 ,0 }, - {"irq" ,NULL , &FLOPPY_IRQ ,6 ,0 }, - {"dma" ,NULL , &FLOPPY_DMA ,2 ,0 }, - {"daring" , daring,NULL ,1 ,0 }, + { + .name ="allowed_drive_mask" , + .fn =NULL , + .var = &allowed_drive_mask, + .def_param =0xff , + .param2 =0 , + },/* obsolete */ + { + .name ="all_drives" , + .fn =NULL , + .var = &allowed_drive_mask, + .def_param =0xff , + .param2 =0 , + },/* obsolete */ + { + .name ="asus_pci" , + .fn =NULL , + .var = &allowed_drive_mask, + .def_param =0x33 , + .param2 =0 , + }, + { + .name ="irq" , + .fn =NULL , + .var = &FLOPPY_IRQ , + .def_param =6 , + .param2 =0 , + }, + { + .name ="dma" , + .fn =NULL , + .var = &FLOPPY_DMA , + .def_param =2 , + .param2 =0 , + }, + { + .name ="daring" , + .fn = daring, + .var =NULL , + .def_param =1 , + .param2 =0 , + }, #if N_FDC > 1 - {"two_fdc" ,NULL , &FDC2 ,0x370 ,0 }, - {"one_fdc" ,NULL , &FDC2 ,0 ,0 }, + { + .name ="two_fdc" , + .fn =NULL , + .var = &FDC2 , + .def_param =0x370 , + .param2 =0 , + }, + { + .name ="one_fdc" , + .fn =NULL , + .var = &FDC2 , + .def_param =0 , + .param2 =0 , + }, #endif - {"thinkpad" , floppy_set_flags,NULL ,1 ,FD_INVERTED_DCL }, - {"broken_dcl" , floppy_set_flags,NULL ,1 ,FD_BROKEN_DCL }, - {"messages" , floppy_set_flags,NULL ,1 ,FTD_MSG }, - {"silent_dcl_clear" , floppy_set_flags,NULL ,1 ,FD_SILENT_DCL_CLEAR }, - {"debug" , floppy_set_flags,NULL ,1 ,FD_DEBUG }, - {"nodma" ,NULL , &can_use_virtual_dma,1 ,0 }, - {"omnibook" ,NULL , &can_use_virtual_dma,1 ,0 }, - {"yesdma" ,NULL , &can_use_virtual_dma,0 ,0 }, - {"fifo_depth" ,NULL , &fifo_depth,0xa ,0 }, - {"nofifo" ,NULL , &no_fifo,0x20 ,0 }, - {"usefifo" ,NULL , &no_fifo,0 ,0 }, - {"cmos" , set_cmos,NULL ,0 ,0 }, - {"slow" ,NULL , &slow_floppy,1 ,0 }, - {"unexpected_interrupts" ,NULL , &print_unex,1 ,0 }, - {"no_unexpected_interrupts" ,NULL , &print_unex,0 ,0 }, - {"L40SX" ,NULL , &print_unex,0 ,0 } + { + .name ="thinkpad" , + .fn = floppy_set_flags, + .var =NULL , + .def_param =1 , + .param2 =FD_INVERTED_DCL + }, + { + .name ="broken_dcl" , + .fn = floppy_set_flags, + .var =NULL , + .def_param =1 , + .param2 =FD_BROKEN_DCL + }, + { + .name ="messages" , + .fn = floppy_set_flags, + .var =NULL , + .def_param =1 , + .param2 =FTD_MSG + }, + { + .name ="silent_dcl_clear" , + .fn = floppy_set_flags, + .var =NULL , + .def_param =1 , + .param2 =FD_SILENT_DCL_CLEAR + }, + { + .name ="debug" , + .fn = floppy_set_flags, + .var =NULL , + .def_param =1 , + .param2 =FD_DEBUG + }, + { + .name ="nodma" , + .fn =NULL , + .var = &can_use_virtual_dma, + .def_param =1 , + .param2 =0 , + }, + { + .name ="omnibook" , + .fn =NULL , + .var = &can_use_virtual_dma, + .def_param =1 , + .param2 =0 , + }, + { + .name ="yesdma" , + .fn =NULL , + .var = &can_use_virtual_dma, + .def_param =0 , + .param2 =0 , + }, + { + .name ="fifo_depth" , + .fn =NULL , + .var = &fifo_depth, + .def_param =0xa , + .param2 =0 , + }, + { + .name ="nofifo" , + .fn =NULL , + .var = &no_fifo, + .def_param =0x20 , + .param2 =0 , + }, + { + .name ="usefifo" , + .fn =NULL , + .var = &no_fifo, + .def_param =0 , + .param2 =0 , + }, + { + .name ="cmos" , + .fn = set_cmos, + .var =NULL , + .def_param =0 , + .param2 =0 , + }, + { + .name ="slow" , + .fn =NULL , + .var = &slow_floppy, + .def_param =1 , + .param2 =0 , + }, + { + .name ="unexpected_interrupts" , + .fn =NULL , + .var = &print_unex, + .def_param =1 , + .param2 =0 , + }, + { + .name ="no_unexpected_interrupts" , + .fn =NULL , + .var = &print_unex, + .def_param =0 , + .param2 =0 , + }, + { + .name ="L40SX" , + .fn =NULL , + .var = &print_unex, + .def_param =0 , + .param2 =0 , + } EXTRA_FLOPPY_PARAMS };
@@ -4110,9 +4804,9 @@ static int __init floppy_setup(char *str)else param = config_params[i].def_param;if (config_params[i].fn) - config_params[i]. -fn (ints, param, - config_params[i].param2); + config_params[i].fn (ints, param, + config_params[i]. + param2);if (config_params[i].var) {DPRINT ("%s=%d\n" , str, param); *config_params[i].var = param;
@@ -4126,8 +4820,8 @@ static int __init floppy_setup(char *str)DPRINT ("allowed options are:" );for (i =0 ; i <ARRAY_SIZE (config_params); i++) -printk (" %s" , config_params[i].name); -printk ("\n" ); +pr_cont (" %s" , config_params[i].name); +pr_cont ("\n" ); }else DPRINT ("botched floppy option\n" );DPRINT ("Read Documentation/blockdev/floppy.txt\n" );
@@ -4145,7 +4839,8 @@ static ssize_t floppy_cmos_show(struct device *dev, drive = p->id;return sprintf (buf,"%X\n" ,UDP ->cmos); } -DEVICE_ATTR (cmos,S_IRUGO ,floppy_cmos_show,NULL ); + +DEVICE_ATTR (cmos,S_IRUGO , floppy_cmos_show,NULL );static void floppy_device_release (struct device *dev) {
@@ -4169,9 +4864,9 @@ static struct dev_pm_ops floppy_pm_ops = {static struct platform_driver floppy_driver = { .driver = { - .name ="floppy" , - .pm = &floppy_pm_ops, - }, + .name ="floppy" , + .pm = &floppy_pm_ops, + }, };static struct platform_device floppy_device[N_DRIVE ];
@@ -4247,11 +4942,11 @@ static int __init floppy_init(void)for (i =0 ; i <N_FDC ; i++) { fdc = i; -CLEARSTRUCT (FDCS ); +memset (FDCS ,0 ,sizeof (*FDCS ));FDCS ->dtr =-1 ;FDCS ->dor =0x4 ;#if defined(__sparc__) || defined(__mc68000__) -/*sparcs/sun3x don't have a DOR reset which we can fall back on to */ +/*sparcs/sun3x don't have a DOR reset which we can fall back on to */ #ifdef __mc68000__ if (MACH_IS_SUN3X)#endif
@@ -4280,8 +4975,8 @@ static int __init floppy_init(void)/* initialise drive state */ for (drive =0 ; drive <N_DRIVE ; drive++) { -CLEARSTRUCT (UDRS ); -CLEARSTRUCT (UDRWE ); +memset (UDRS ,0 ,sizeof (*UDRS )); +memset (UDRWE ,0 ,sizeof (*UDRWE ));USETF (FD_DISK_NEWCHANGE );USETF (FD_DISK_CHANGED );USETF (FD_VERIFY );
@@ -4353,7 +5048,9 @@ static int __init floppy_init(void)if (err) goto out_flush_work; - err =device_create_file (&floppy_device[drive].dev,&dev_attr_cmos); + err = +device_create_file (&floppy_device[drive].dev, + &dev_attr_cmos);if (err) goto out_unreg_platform_dev;
@@ -4394,12 +5091,12 @@ static const struct io_region {int offset;int size; } io_regions[] = { - { 2, 1 }, - /* address + 3 is sometimes reserved by pnp bios for motherboard */ - { 4, 2 }, - /* address + 6 is reserved, and may be taken by IDE. - * Unfortunately, Adaptec doesn't know this :-(, */ - { 7, 1 }, + { .offset = 2, .size = 1}, + /* address + 3 is sometimes reserved by pnp bios for motherboard */ + { .offset = 4, .size = 2}, + /* address + 6 is reserved, and may be taken by IDE. + * Unfortunately, Adaptec doesn't know this :-(, */ + { .offset = 7, .size = 1}, }; static void floppy_release_allocated_regions(int fdc, const struct io_region *p)
@@ -4417,8 +5114,10 @@ static int floppy_request_regions(int fdc)const struct io_region *p;for (p = io_regions; p <ARRAY_END (io_regions); p++) { -if (!request_region (FDCS ->address + p->offset, p->size,"floppy" )) { -DPRINT ("Floppy io-port 0x%04lx in use\n" ,FDCS ->address + p->offset); +if (!request_region + (FDCS ->address + p->offset, p->size,"floppy" )) { +DPRINT ("Floppy io-port 0x%04lx in use\n" , +FDCS ->address + p->offset);floppy_release_allocated_regions (fdc, p);return -EBUSY ; }
@@ -4548,15 +5247,15 @@ static void floppy_release_irq_and_dma(void)#ifndef __sparc__for (drive =0 ; drive <N_FDC *4 ; drive++)if (timer_pending (motor_off_timer + drive)) -printk ("motor off timer %d still active\n" , drive); +pr_info ("motor off timer %d still active\n" , drive);#endif if (timer_pending (&fd_timeout)) -printk ("floppy timer still active:%s\n" , timeout_message); +pr_info ("floppy timer still active:%s\n" , timeout_message);if (timer_pending (&fd_timer)) -printk ("auxiliary floppy timer still active\n" ); +pr_info ("auxiliary floppy timer still active\n" );if (work_pending (&floppy_work)) -printk ("work still pending\n" ); +pr_info ("work still pending\n" );#endif old_fdc = fdc;for (fdc =0 ; fdc <N_FDC ; fdc++)
@@ -4574,7 +5273,9 @@ static void __init parse_floppy_cfg_string(char *cfg)char *ptr;while (*cfg) { -for (ptr = cfg; *cfg && *cfg !=' ' && *cfg !='\t' ; cfg++) ; + ptr = cfg; +while (*cfg && *cfg !=' ' && *cfg !='\t' ) + cfg++;if (*cfg) { *cfg ='\0' ; cfg++;
@@ -4590,6 +5291,7 @@ static int __init floppy_module_init(void)parse_floppy_cfg_string (floppy);return floppy_init (); } +module_init (floppy_module_init); static void __exit floppy_module_exit(void)
@@ -4606,7 +5308,8 @@ static void __exit floppy_module_exit(void)if ((allowed_drive_mask & (1 << drive)) && fdc_state[FDC (drive)].version !=FDC_NONE ) {del_gendisk (disks[drive]); -device_remove_file (&floppy_device[drive].dev, &dev_attr_cmos); +device_remove_file (&floppy_device[drive].dev, + &dev_attr_cmos);platform_device_unregister (&floppy_device[drive]); }put_disk (disks[drive]);
@@ -4622,6 +5325,7 @@ static void __exit floppy_module_exit(void)/* eject disk, if any */ fd_eject (0 ); } +module_exit (floppy_module_exit);module_param (floppy, charp,0 );
@@ -4633,9 +5337,10 @@ MODULE_LICENSE("GPL");/* This doesn't actually get used other than for module information */ static const struct pnp_device_id floppy_pnpids[] = { - {"PNP0700" ,0 }, - { } + {"PNP0700" ,0 }, + {} }; +MODULE_DEVICE_TABLE (pnp, floppy_pnpids);#else
Re: [PATCH] drivers/block/floppy.c: stylistic cleanups
Quoted 23 lines · On Mon, 30 Nov 2009 20:13:40 -0800 Joe Perches <[email protected]> wrote:
Quoted 3 lines · Stephen Hemminger
Rather than playing with the dangling operator format which seems to be a coding style that only David cares about. Why not go through and fix the really ugly old drivers that need it. For a good horror experience, go look at the floppy driver.
Just for you Stephen, here's a cleaned up version. Now to see if it gets applied, which I rather doubt.
Changes:
Removed macro definitions and uses of
IN, OUT,LAST_OUT, CLEARSTRUCT, andCHECK_RESET
Used C99 initializers
Removed assigns from if statements
Converted printks withoutKERN_levels topr_infoandpr_contRemoved unnecessary braces
Usedprint_hex_dump
Moved leading logical tests to end of previous line Surrounded still ugly CALL and ECALL macro with do {} while (0)Checkpatch complaints before:
total: 393 errors, 132 warnings, 4647 lines checked
Quoted 6 lines
after:
total: 1 errors, 11 warnings, 5352 lines checkedCompile tested only, x86 allyesconfig
Signed-off-by Joe Perches <[email protected]>
I have a fix (to get rid of Buffer I/O error when testing for drive present), so I'll put your cleanup in first.
Re: [PATCH] drivers/block/floppy.c: stylistic cleanups
Quoted 29 lines · Stephen Hemminger
Quoted 26 lines · On Mon, 30 Nov 2009 20:13:40 -0800 Joe Perches <[email protected]> wrote:
Quoted 3 lines · Stephen Hemminger
Rather than playing with the dangling operator format which seems to be a coding style that only David cares about. Why not go through and fix the really ugly old drivers that need it. For a good horror experience, go look at the floppy driver.
Just for you Stephen, here's a cleaned up version. Now to see if it gets applied, which I rather doubt.
Changes:
Removed macro definitions and uses of
IN, OUT,LAST_OUT, CLEARSTRUCT, andCHECK_RESET
Used C99 initializers
Removed assigns from if statements
Converted printks withoutKERN_levels topr_infoandpr_contRemoved unnecessary braces
Usedprint_hex_dump
Moved leading logical tests to end of previous line Surrounded still ugly CALL and ECALL macro with do {} while (0)Checkpatch complaints before:
total: 393 errors, 132 warnings, 4647 lines checkedafter:
total: 1 errors, 11 warnings, 5352 lines checked
Quoted 6 lines
Quoted 3 lines
Compile tested only, x86 allyesconfig
Signed-off-by Joe Perches <[email protected]>I have a fix (to get rid of Buffer I/O error when testing for drive present), so I'll put your cleanup in first.
Could you please tell us how are we going to back-port your fix to -stable after such amount of changes:
drivers/block/floppy.c | 1853 +++++++++++++++++++++++++++++++++--------------- 1 files changed, 1279 insertions(+), 574 deletions(-)
gets applied first?
--
Bartlomiej Zolnierkiewicz
Re: [PATCH] drivers/block/floppy.c: stylistic cleanups
In reply to Joe PerchesQuoted 34 lines · Joe Perches
Quoted 3 lines · Stephen Hemminger
Rather than playing with the dangling operator format which seems to be a coding style that only David cares about. Why not go through and fix the really ugly old drivers that need it. For a good horror experience, go look at the floppy driver.
Just for you Stephen, here's a cleaned up version. Now to see if it gets applied, which I rather doubt.
Changes:
Removed macro definitions and uses of
IN, OUT,LAST_OUT, CLEARSTRUCT, andCHECK_RESET
Used C99 initializers
Removed assigns from if statements
Converted printks withoutKERN_levels topr_infoandpr_contRemoved unnecessary braces
Usedprint_hex_dump
Moved leading logical tests to end of previous line Surrounded still ugly CALL and ECALL macro with do {} while (0)Checkpatch complaints before:
total: 393 errors, 132 warnings, 4647 lines checkedafter:
total: 1 errors, 11 warnings, 5352 lines checkedCompile tested only, x86 allyesconfig
Signed-off-by Joe Perches <[email protected]>drivers/block/floppy.c | 1853 +++++++++++++++++++++++++++++++++--------------- 1 files changed, 1279 insertions(+), 574 deletions(-)
...
Quoted 5 lines
drivers/block/floppy.c +0
-1@@ -515,11 +1035,12 @@ static DECLARE_WAIT_QUEUE_HEAD(fdc_wait);static DECLARE_WAIT_QUEUE_HEAD (command_done);#define NO_SIGNAL (!interruptible || !signal_pending(current)) -#define CALL (x) if ((x) == -EINTR) return -EINTR
drivers/block/floppy.c static DECLARE_WAIT_QUEUE_HEAD(fdc_wait); · line 1043
Quoted 10 lines
drivers/block/floppy.c +6
-4-#define ECALL (x) if ((ret = (x))) return ret; -#define _WAIT (x,i) CALL(ret=wait_til_done((x),i)) -#define WAIT (x) _WAIT((x),interruptible) -#define IWAIT (x) _WAIT((x),1) + +#define CALL (x) do { if ((x) == -EINTR) return -EINTR; } while (0) +#define ECALL (x) do { if ((ret = (x))) return ret; } while (0) +#define _WAIT (x, i) CALL(ret = wait_til_done((x), i)) +#define WAIT (x) _WAIT((x), interruptible) +#define IWAIT (x) _WAIT((x), 1)
why not remove these macros too? (probably in a seperate patch) macros which hide "return" are very annoying...
...
drivers/block/floppy.c static int _lock_fdc(int drive, int interruptible, int line) · line 1439
Quoted 13 lines
drivers/block/floppy.c +5
-3@@ -909,10 +1431,12 @@ static int _lock_fdc(int drive, int interruptible, int line)return 0 ; } -#define lock_fdc (drive,interruptible) _lock_fdc(drive,interruptible, __LINE__) +#define lock_fdc (drive, interruptible) \ + _lock_fdc(drive, interruptible, __LINE__) -#define LOCK_FDC (drive,interruptible) \ -if (lock_fdc(drive,interruptible)) return -EINTR; +#define LOCK_FDC (drive, interruptible) \ + if (lock_fdc(drive, interruptible)) \ + return -EINTR;
another annoying macro
Quoted 2 lines
drivers/block/floppy.c +0
-0/* unlocks the driver */ static inline void unlock_fdc (void )
...
drivers/block/floppy.c static void recalibrate_floppy(void) · line 2346
Quoted 10 lines
drivers/block/floppy.c +4
-1@@ -1809,7 +2339,10 @@ static void recalibrate_floppy(void)debugt ("recalibrate floppy:" ); do_floppy = recal_interrupt;output_byte (FD_RECALIBRATE ); -LAST_OUT (UNIT (current_drive)); +if (UNIT (current_drive) <0 ) { +reset_fdc (); +return ; + } }
unneeded return
Quoted 2 lines
(quoted diff) +0
-0/*
...
drivers/block/floppy.c static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, · line 4013
Quoted 7 lines
drivers/block/floppy.c +1
-2@@ -3479,143 +4010,163 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,/* convert compatibility eject ioctls into floppy eject ioctl. * We do this in order to provide a means to eject floppy disks before * installing the new fdutils package */ -if (cmd ==CDROMEJECT ||/* CD-ROM eject */ - cmd ==0x6470 /* SunOS floppy eject */ ) { +if (cmd ==CDROMEJECT || cmd ==0x6470 ) {
please add descriptive constant
Quoted 4 lines
drivers/block/floppy.c +0
-0DPRINT ("obsolete eject ioctl\n" );DPRINT ("please use floppycontrol --eject\n" ); cmd =FDEJECT ; }
Re: [PATCH] drivers/block/floppy.c: stylistic cleanups
Quoted 9 lines · Marcin Slusarz
drivers/block/floppy.c static DECLARE_WAIT_QUEUE_HEAD(fdc_wait); · line 1043
Quoted 5 lines · Joe Perches
drivers/block/floppy.c +5
-0+#define CALL (x) do { if ((x) == -EINTR) return -EINTR; } while (0) +#define ECALL (x) do { if ((ret = (x))) return ret; } while (0) +#define _WAIT (x, i) CALL(ret = wait_til_done((x), i)) +#define WAIT (x) _WAIT((x), interruptible) +#define IWAIT (x) _WAIT((x), 1)why not remove these macros too? (probably in a seperate patch) macros which hide "return" are very annoying...
Hence the "still ugly". I agree these aren't good.
Quoted 5 lines
drivers/block/floppy.c static int _lock_fdc(int drive, int interruptible, int line) · line 1439
Quoted 3 lines
drivers/block/floppy.c +3
-0+#define LOCK_FDC (drive, interruptible) \ + if (lock_fdc(drive, interruptible)) \ + return -EINTR;another annoying macro
True.
Quoted 8 lines
drivers/block/floppy.c static void recalibrate_floppy(void) · line 2346
Quoted 5 lines
drivers/block/floppy.c +4
-0+if (UNIT (current_drive) <0 ) { +reset_fdc (); +return ; + } }unneeded return
Quoted 6 lines
drivers/block/floppy.c static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, · line 4013
Quoted 4 lines
drivers/block/floppy.c +1
-2* installing the new fdutils package */ -if (cmd ==CDROMEJECT ||/* CD-ROM eject */ - cmd ==0x6470 /* SunOS floppy eject */ ) { +if (cmd ==CDROMEJECT || cmd ==0x6470 ) {please add descriptive constant
Patches are apparently welcomed by Stephen.
Don't wait for me, I'll catch up.
cheers, Joe
Re: [PATCH] drivers/block/floppy.c: stylistic cleanups
In reply to Joe PerchesQuoted 11 lines · Joe Perches
Quoted 3 lines · Stephen Hemminger
Rather than playing with the dangling operator format which seems to be a coding style that only David cares about. Why not go through and fix the really ugly old drivers that need it. For a good horror experience, go look at the floppy driver.
Just for you Stephen, here's a cleaned up version. Now to see if it gets applied, which I rather doubt.
drivers/block/floppy.c | 1853 +++++++++++++++++++++++++++++++++--------------- 1 files changed, 1279 insertions(+), 574 deletions(-)
+700 LOC for cleanup patch is a bit excessive, I like macro removals and other improvements from your patch but the following change is an insanity:
Quoted 696 lines
/*
* this struct defines the different floppy drive types. */drivers/block/floppy.c +597
-87-static struct { +struct drive_params {struct floppy_drive_params params;const char *name;/* name printed while booting */ -} default_drive_params[] = { -/* NOTE: the time values in jiffies should be in msec! -CMOS drive type -| Maximum data rate supported by drive type -| | Head load time, msec -| | | Head unload time, msec (not used) -| | | | Step rate interval, usec -| | | | | Time needed for spinup time (jiffies) -| | | | | | Timeout for spinning down (jiffies) -| | | | | | | Spindown offset (where disk stops) -| | | | | | | | Select delay -| | | | | | | | | RPS -| | | | | | | | | | Max number of tracks -| | | | | | | | | | | Interrupt timeout -| | | | | | | | | | | | Max nonintlv. sectors -| | | | | | | | | | | | | -Max Errors- flags */ -{{0 ,500 ,16 ,16 ,8000 ,1 *HZ ,3 *HZ ,0 ,SEL_DLY ,5 ,80 ,3 *HZ ,20 , {3 ,1 ,2 ,0 ,2 },0 , -0 , {7 ,4 ,8 ,2 ,1 ,5 ,3 ,10 },3 *HZ /2 ,0 },"unknown" }, - -{{1 ,300 ,16 ,16 ,8000 ,1 *HZ ,3 *HZ ,0 ,SEL_DLY ,5 ,40 ,3 *HZ ,17 , {3 ,1 ,2 ,0 ,2 },0 , -0 , {1 ,0 ,0 ,0 ,0 ,0 ,0 ,0 },3 *HZ /2 ,1 },"360K PC" },/*5 1/4 360 KB PC*/ - -{{2 ,500 ,16 ,16 ,6000 ,4 *HZ /10 ,3 *HZ ,14 ,SEL_DLY ,6 ,83 ,3 *HZ ,17 , {3 ,1 ,2 ,0 ,2 },0 , -0 , {2 ,5 ,6 ,23 ,10 ,20 ,12 ,0 },3 *HZ /2 ,2 },"1.2M" },/*5 1/4 HD AT*/ - -{{3 ,250 ,16 ,16 ,3000 ,1 *HZ ,3 *HZ ,0 ,SEL_DLY ,5 ,83 ,3 *HZ ,20 , {3 ,1 ,2 ,0 ,2 },0 , -0 , {4 ,22 ,21 ,30 ,3 ,0 ,0 ,0 },3 *HZ /2 ,4 },"720k" },/*3 1/2 DD*/ - -{{4 ,500 ,16 ,16 ,4000 ,4 *HZ /10 ,3 *HZ ,10 ,SEL_DLY ,5 ,83 ,3 *HZ ,20 , {3 ,1 ,2 ,0 ,2 },0 , -0 , {7 ,4 ,25 ,22 ,31 ,21 ,29 ,11 },3 *HZ /2 ,7 },"1.44M" },/*3 1/2 HD*/ - -{{5 ,1000 ,15 ,8 ,3000 ,4 *HZ /10 ,3 *HZ ,10 ,SEL_DLY ,5 ,83 ,3 *HZ ,40 , {3 ,1 ,2 ,0 ,2 },0 , -0 , {7 ,8 ,4 ,25 ,28 ,22 ,31 ,21 },3 *HZ /2 ,8 },"2.88M AMI BIOS" },/*3 1/2 ED*/ - -{{6 ,1000 ,15 ,8 ,3000 ,4 *HZ /10 ,3 *HZ ,10 ,SEL_DLY ,5 ,83 ,3 *HZ ,40 , {3 ,1 ,2 ,0 ,2 },0 , -0 , {7 ,8 ,4 ,25 ,28 ,22 ,31 ,21 },3 *HZ /2 ,8 },"2.88M" }/*3 1/2 ED*/ -/* | --autodetected formats--- | | | -* read_track | | Name printed when booting -* | Native format -* Frequency of disk change checks */ +}; + +static struct drive_params default_drive_params[] = { +/* NOTE: the time values in jiffies should be in msec! */ + { + .params = { + .cmos =0 , + .max_dtr =500 , + .hlt =16 , + .hut =16 , + .srt =8000 , + .spinup =1 *HZ , + .spindown =3 *HZ , + .spindown_offset =0 , + .select_delay =SEL_DLY , + .rps =5 , + .tracks =80 , + .timeout =3 *HZ , + .interleave_sect =20 , + .max_errors = { + .abort =3 , + .read_track =1 , + .reset =2 , + .recal =0 , + .reporting =2 + }, + .flags =0 , + .read_track =0 , + .autodetect = {7 ,4 ,8 ,2 ,1 ,5 ,3 ,10 }, + .checkfreq =3 *HZ /2 , + .native_format =0 + }, + .name ="unknown" + }, + + {/*5 1/4 360 KB PC */ + .params = { + .cmos =1 , + .max_dtr =300 , + .hlt =16 , + .hut =16 , + .srt =8000 , + .spinup =1 *HZ , + .spindown =3 *HZ , + .spindown_offset =0 , + .select_delay =SEL_DLY , + .rps =5 , + .tracks =40 , + .timeout =3 *HZ , + .interleave_sect =17 , + .max_errors = { + .abort =3 , + .read_track =1 , + .reset =2 , + .recal =0 , + .reporting =2 + }, + .flags =0 , + .read_track =0 , + .autodetect = {1 ,0 ,0 ,0 ,0 ,0 ,0 ,0 }, + .checkfreq =3 *HZ /2 , + .native_format =1 + }, + .name ="360K PC" + }, + + {/*5 1/4 HD AT */ + .params = { + .cmos =2 , + .max_dtr =500 , + .hlt =16 , + .hut =16 , + .srt =6000 , + .spinup =4 *HZ /10 , + .spindown =3 *HZ , + .spindown_offset =14 , + .select_delay =SEL_DLY , + .rps =6 , + .tracks =83 , + .timeout =3 *HZ , + .interleave_sect =17 , + .max_errors = { + .abort =3 , + .read_track =1 , + .reset =2 , + .recal =0 , + .reporting =2 + }, + .flags =0 , + .read_track =0 , + .autodetect = {2 ,5 ,6 ,23 ,10 ,20 ,12 ,0 }, + .checkfreq =3 *HZ /2 , + .native_format =2 + }, + .name ="1.2M" + }, + + {/*3 1/2 DD */ + .params = { + .cmos =3 , + .max_dtr =250 , + .hlt =16 , + .hut =16 , + .srt =3000 , + .spinup =1 *HZ , + .spindown =3 *HZ , + .spindown_offset =0 , + .select_delay =SEL_DLY , + .rps =5 , + .tracks =83 , + .timeout =3 *HZ , + .interleave_sect =20 , + .max_errors = { + .abort =3 , + .read_track =1 , + .reset =2 , + .recal =0 , + .reporting =2 + }, + .flags =0 , + .read_track =0 , + .autodetect = {4 ,22 ,21 ,30 ,3 ,0 ,0 ,0 }, + .checkfreq =3 *HZ /2 , + .native_format =4 + }, + .name ="720k" + }, + + {/*3 1/2 HD */ + .params = { + .cmos =4 , + .max_dtr =500 , + .hlt =16 , + .hut =16 , + .srt =4000 , + .spinup =4 *HZ /10 , + .spindown =3 *HZ , + .spindown_offset =10 , + .select_delay =SEL_DLY , + .rps =5 , + .tracks =83 , + .timeout =3 *HZ , + .interleave_sect =20 , + .max_errors = { + .abort =3 , + .read_track =1 , + .reset =2 , + .recal =0 , + .reporting =2 + }, + .flags =0 , + .read_track =0 , + .autodetect = {7 ,4 ,25 ,22 ,31 ,21 ,29 ,11 }, + .checkfreq =3 *HZ /2 , + .native_format =7 + }, + .name ="1.44M" + }, + + {/*3 1/2 ED */ + .params = { + .cmos =5 , + .max_dtr =1000 , + .hlt =15 , + .hut =8 , + .srt =3000 , + .spinup =4 *HZ /10 , + .spindown =3 *HZ , + .spindown_offset =10 , + .select_delay =SEL_DLY , + .rps =5 , + .tracks =83 , + .timeout =3 *HZ , + .interleave_sect =40 , + .max_errors = { + .abort =3 , + .read_track =1 , + .reset =2 , + .recal =0 , + .reporting =2 + }, + .flags =0 , + .read_track =0 , + .autodetect = {7 ,8 ,4 ,25 ,28 ,22 ,31 ,21 }, + .checkfreq =3 *HZ /2 , + .native_format =8 + }, + .name ="2.88M AMI BIOS" + }, + + {/*3 1/2 ED */ + .params = { + .cmos =6 , + .max_dtr =1000 , + .hlt =15 , + .hut =8 , + .srt =3000 , + .spinup =4 *HZ /10 , + .spindown =3 *HZ , + .spindown_offset =10 , + .select_delay =SEL_DLY , + .rps =5 , + .tracks =83 , + .timeout =3 *HZ , + .interleave_sect =40 , + .max_errors = { + .abort =3 , + .read_track =1 , + .reset =2 , + .recal =0 , + .reporting =2 + }, + .flags =0 , + .read_track =0 , + .autodetect = {7 ,8 ,4 ,25 ,28 ,22 ,31 ,21 }, + .checkfreq =3 *HZ /2 , + .native_format =8 + }, + .name ="2.88M" + } };static struct floppy_drive_params drive_params[N_DRIVE ];@@ -434,52 +615,391 @@ static struct floppy_raw_cmd *raw_cmd, default_raw_cmd;* * Other parameters should be self-explanatory (see also setfdprm(8)). */ -/* -Size -| Sectors per track -| | Head -| | | Tracks -| | | | Stretch -| | | | | Gap 1 size -| | | | | | Data rate, | 0x40 for perp -| | | | | | | Spec1 (stepping rate, head unload -| | | | | | | | /fmt gap (gap2) */ -static struct floppy_struct floppy_type[32 ] = { - {0 ,0 ,0 ,0 ,0 ,0x00 ,0x00 ,0x00 ,0x00 ,NULL },/* 0 no testing */ - {720 ,9 ,2 ,40 ,0 ,0x2A ,0x02 ,0xDF ,0x50 ,"d360" },/* 1 360KB PC */ - {2400 ,15 ,2 ,80 ,0 ,0x1B ,0x00 ,0xDF ,0x54 ,"h1200" },/* 2 1.2MB AT */ - {720 ,9 ,1 ,80 ,0 ,0x2A ,0x02 ,0xDF ,0x50 ,"D360" },/* 3 360KB SS 3.5" */ - {1440 ,9 ,2 ,80 ,0 ,0x2A ,0x02 ,0xDF ,0x50 ,"D720" },/* 4 720KB 3.5" */ - {720 ,9 ,2 ,40 ,1 ,0x23 ,0x01 ,0xDF ,0x50 ,"h360" },/* 5 360KB AT */ - {1440 ,9 ,2 ,80 ,0 ,0x23 ,0x01 ,0xDF ,0x50 ,"h720" },/* 6 720KB AT */ - {2880 ,18 ,2 ,80 ,0 ,0x1B ,0x00 ,0xCF ,0x6C ,"H1440" },/* 7 1.44MB 3.5" */ - {5760 ,36 ,2 ,80 ,0 ,0x1B ,0x43 ,0xAF ,0x54 ,"E2880" },/* 8 2.88MB 3.5" */ - {6240 ,39 ,2 ,80 ,0 ,0x1B ,0x43 ,0xAF ,0x28 ,"E3120" },/* 9 3.12MB 3.5" */ - - {2880 ,18 ,2 ,80 ,0 ,0x25 ,0x00 ,0xDF ,0x02 ,"h1440" },/* 10 1.44MB 5.25" */ - {3360 ,21 ,2 ,80 ,0 ,0x1C ,0x00 ,0xCF ,0x0C ,"H1680" },/* 11 1.68MB 3.5" */ - {820 ,10 ,2 ,41 ,1 ,0x25 ,0x01 ,0xDF ,0x2E ,"h410" },/* 12 410KB 5.25" */ - {1640 ,10 ,2 ,82 ,0 ,0x25 ,0x02 ,0xDF ,0x2E ,"H820" },/* 13 820KB 3.5" */ - {2952 ,18 ,2 ,82 ,0 ,0x25 ,0x00 ,0xDF ,0x02 ,"h1476" },/* 14 1.48MB 5.25" */ - {3444 ,21 ,2 ,82 ,0 ,0x25 ,0x00 ,0xDF ,0x0C ,"H1722" },/* 15 1.72MB 3.5" */ - {840 ,10 ,2 ,42 ,1 ,0x25 ,0x01 ,0xDF ,0x2E ,"h420" },/* 16 420KB 5.25" */ - {1660 ,10 ,2 ,83 ,0 ,0x25 ,0x02 ,0xDF ,0x2E ,"H830" },/* 17 830KB 3.5" */ - {2988 ,18 ,2 ,83 ,0 ,0x25 ,0x00 ,0xDF ,0x02 ,"h1494" },/* 18 1.49MB 5.25" */ - {3486 ,21 ,2 ,83 ,0 ,0x25 ,0x00 ,0xDF ,0x0C ,"H1743" },/* 19 1.74 MB 3.5" */ - - {1760 ,11 ,2 ,80 ,0 ,0x1C ,0x09 ,0xCF ,0x00 ,"h880" },/* 20 880KB 5.25" */ - {2080 ,13 ,2 ,80 ,0 ,0x1C ,0x01 ,0xCF ,0x00 ,"D1040" },/* 21 1.04MB 3.5" */ - {2240 ,14 ,2 ,80 ,0 ,0x1C ,0x19 ,0xCF ,0x00 ,"D1120" },/* 22 1.12MB 3.5" */ - {3200 ,20 ,2 ,80 ,0 ,0x1C ,0x20 ,0xCF ,0x2C ,"h1600" },/* 23 1.6MB 5.25" */ - {3520 ,22 ,2 ,80 ,0 ,0x1C ,0x08 ,0xCF ,0x2e ,"H1760" },/* 24 1.76MB 3.5" */ - {3840 ,24 ,2 ,80 ,0 ,0x1C ,0x20 ,0xCF ,0x00 ,"H1920" },/* 25 1.92MB 3.5" */ - {6400 ,40 ,2 ,80 ,0 ,0x25 ,0x5B ,0xCF ,0x00 ,"E3200" },/* 26 3.20MB 3.5" */ - {7040 ,44 ,2 ,80 ,0 ,0x25 ,0x5B ,0xCF ,0x00 ,"E3520" },/* 27 3.52MB 3.5" */ - {7680 ,48 ,2 ,80 ,0 ,0x25 ,0x63 ,0xCF ,0x00 ,"E3840" },/* 28 3.84MB 3.5" */ - {3680 ,23 ,2 ,80 ,0 ,0x1C ,0x10 ,0xCF ,0x00 ,"H1840" },/* 29 1.84MB 3.5" */ - - {1600 ,10 ,2 ,80 ,0 ,0x25 ,0x02 ,0xDF ,0x2E ,"D800" },/* 30 800KB 3.5" */ - {3200 ,20 ,2 ,80 ,0 ,0x1C ,0x00 ,0xCF ,0x2C ,"H1600" },/* 31 1.6MB 3.5" */ +static struct floppy_struct floppy_type[32 ] = { + { + .size =0 , + .sect =0 , + .head =0 , + .track =0 , + .stretch =0 , + .gap =0x00 , + .rate =0x00 , + .spec1 =0x00 , + .fmt_gap =0x00 , + .name =NULL + },/* 0 no testing */ + { + .size =720 , + .sect =9 , + .head =2 , + .track =40 , + .stretch =0 , + .gap =0x2A , + .rate =0x02 , + .spec1 =0xDF , + .fmt_gap =0x50 , + .name ="d360" + },/* 1 360KB PC */ + { + .size =2400 , + .sect =15 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x1B , + .rate =0x00 , + .spec1 =0xDF , + .fmt_gap =0x54 , + .name ="h1200" + },/* 2 1.2MB AT */ + { + .size =720 , + .sect =9 , + .head =1 , + .track =80 , + .stretch =0 , + .gap =0x2A , + .rate =0x02 , + .spec1 =0xDF , + .fmt_gap =0x50 , + .name ="D360" + },/* 3 360KB SS 3.5" */ + { + .size =1440 , + .sect =9 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x2A , + .rate =0x02 , + .spec1 =0xDF , + .fmt_gap =0x50 , + .name ="D720" + },/* 4 720KB 3.5" */ + { + .size =720 , + .sect =9 , + .head =2 , + .track =40 , + .stretch =1 , + .gap =0x23 , + .rate =0x01 , + .spec1 =0xDF , + .fmt_gap =0x50 , + .name ="h360" + },/* 5 360KB AT */ + { + .size =1440 , + .sect =9 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x23 , + .rate =0x01 , + .spec1 =0xDF , + .fmt_gap =0x50 , + .name ="h720" + },/* 6 720KB AT */ + { + .size =2880 , + .sect =18 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x1B , + .rate =0x00 , + .spec1 =0xCF , + .fmt_gap =0x6C , + .name ="H1440" + },/* 7 1.44MB 3.5" */ + { + .size =5760 , + .sect =36 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x1B , + .rate =0x43 , + .spec1 =0xAF , + .fmt_gap =0x54 , + .name ="E2880" + },/* 8 2.88MB 3.5" */ + { + .size =6240 , + .sect =39 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x1B , + .rate =0x43 , + .spec1 =0xAF , + .fmt_gap =0x28 , + .name ="E3120" + },/* 9 3.12MB 3.5" */ + { + .size =2880 , + .sect =18 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x25 , + .rate =0x00 , + .spec1 =0xDF , + .fmt_gap =0x02 , + .name ="h1440" + },/* 10 1.44MB 5.25" */ + { + .size =3360 , + .sect =21 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x1C , + .rate =0x00 , + .spec1 =0xCF , + .fmt_gap =0x0C , + .name ="H1680" + },/* 11 1.68MB 3.5" */ + { + .size =820 , + .sect =10 , + .head =2 , + .track =41 , + .stretch =1 , + .gap =0x25 , + .rate =0x01 , + .spec1 =0xDF , + .fmt_gap =0x2E , + .name ="h410" + },/* 12 410KB 5.25" */ + { + .size =1640 , + .sect =10 , + .head =2 , + .track =82 , + .stretch =0 , + .gap =0x25 , + .rate =0x02 , + .spec1 =0xDF , + .fmt_gap =0x2E , + .name ="H820" + },/* 13 820KB 3.5" */ + { + .size =2952 , + .sect =18 , + .head =2 , + .track =82 , + .stretch =0 , + .gap =0x25 , + .rate =0x00 , + .spec1 =0xDF , + .fmt_gap =0x02 , + .name ="h1476" + },/* 14 1.48MB 5.25" */ + { + .size =3444 , + .sect =21 , + .head =2 , + .track =82 , + .stretch =0 , + .gap =0x25 , + .rate =0x00 , + .spec1 =0xDF , + .fmt_gap =0x0C , + .name ="H1722" + },/* 15 1.72MB 3.5" */ + { + .size =840 , + .sect =10 , + .head =2 , + .track =42 , + .stretch =1 , + .gap =0x25 , + .rate =0x01 , + .spec1 =0xDF , + .fmt_gap =0x2E , + .name ="h420" + },/* 16 420KB 5.25" */ + { + .size =1660 , + .sect =10 , + .head =2 , + .track =83 , + .stretch =0 , + .gap =0x25 , + .rate =0x02 , + .spec1 =0xDF , + .fmt_gap =0x2E , + .name ="H830" + },/* 17 830KB 3.5" */ + { + .size =2988 , + .sect =18 , + .head =2 , + .track =83 , + .stretch =0 , + .gap =0x25 , + .rate =0x00 , + .spec1 =0xDF , + .fmt_gap =0x02 , + .name ="h1494" + },/* 18 1.49MB 5.25" */ + { + .size =3486 , + .sect =21 , + .head =2 , + .track =83 , + .stretch =0 , + .gap =0x25 , + .rate =0x00 , + .spec1 =0xDF , + .fmt_gap =0x0C , + .name ="H1743" + },/* 19 1.74 MB 3.5" */ + { + .size =1760 , + .sect =11 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x1C , + .rate =0x09 , + .spec1 =0xCF , + .fmt_gap =0x00 , + .name ="h880" + },/* 20 880KB 5.25" */ + { + .size =2080 , + .sect =13 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x1C , + .rate =0x01 , + .spec1 =0xCF , + .fmt_gap =0x00 , + .name ="D1040" + },/* 21 1.04MB 3.5" */ + { + .size =2240 , + .sect =14 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x1C , + .rate =0x19 , + .spec1 =0xCF , + .fmt_gap =0x00 , + .name ="D1120" + },/* 22 1.12MB 3.5" */ + { + .size =3200 , + .sect =20 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x1C , + .rate =0x20 , + .spec1 =0xCF , + .fmt_gap =0x2C , + .name ="h1600" + },/* 23 1.6MB 5.25" */ + { + .size =3520 , + .sect =22 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x1C , + .rate =0x08 , + .spec1 =0xCF , + .fmt_gap =0x2e , + .name ="H1760" + },/* 24 1.76MB 3.5" */ + { + .size =3840 , + .sect =24 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x1C , + .rate =0x20 , + .spec1 =0xCF , + .fmt_gap =0x00 , + .name ="H1920" + },/* 25 1.92MB 3.5" */ + { + .size =6400 , + .sect =40 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x25 , + .rate =0x5B , + .spec1 =0xCF , + .fmt_gap =0x00 , + .name ="E3200" + },/* 26 3.20MB 3.5" */ + { + .size =7040 , + .sect =44 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x25 , + .rate =0x5B , + .spec1 =0xCF , + .fmt_gap =0x00 , + .name ="E3520" + },/* 27 3.52MB 3.5" */ + { + .size =7680 , + .sect =48 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x25 , + .rate =0x63 , + .spec1 =0xCF , + .fmt_gap =0x00 , + .name ="E3840" + },/* 28 3.84MB 3.5" */ + { + .size =3680 , + .sect =23 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x1C , + .rate =0x10 , + .spec1 =0xCF , + .fmt_gap =0x00 , + .name ="H1840" + },/* 29 1.84MB 3.5" */ + { + .size =1600 , + .sect =10 , + .head =2 , + .track =80 , + .stretch =0 , + .gap =0x25 , + .rate =0x02 , + .spec1 =0xDF , + .fmt_gap =0x2E , + .name ="D800" + },/* 30 800KB 3.5" */ + { + .size =3200 , + .sect =20 ,
drivers/block/floppy.c static struct floppy_raw_cmd *raw_cmd, default_raw_cmd; · line 1003
Quoted 10 lines
drivers/block/floppy.c +9
-0+ .head = 2, + .track = 80, + .stretch = 0, + .gap = 0x1C, + .rate = 0x00, + .spec1 = 0xCF, + .fmt_gap = 0x2C, + .name ="H1600" + }, /* 31 1.6MB 3.5" */ };
The code was far more readable before the conversion and the usage of C99 initializers is not mandatory. Please drop it.
--
Bartlomiej Zolnierkiewicz
PATCH 1/1 drivers/net: Move && and || to end of previous line
In reply to David MillerOnly files where David Miller is the primary git-signer. wireless, wimax, ixgbe, etc are not modified.
Compile tested x86 allyesconfig only
Not all files compiled (not x86 compatible)
Added a few > 80 column lines, which I ignored. Existing checkpatch complaints ignored.
--- drivers/net/3c501.c | 8 ++-- drivers/net/3c503.c | 15 +++--- drivers/net/3c507.c | 4 +- drivers/net/3c509.c | 10 ++-- drivers/net/3c515.c | 13 +++-- drivers/net/3c527.c | 4 +- drivers/net/3c59x.c | 4 +- drivers/net/8139cp.c | 4 +- drivers/net/8139too.c | 12 ++-- drivers/net/appletalk/ipddp.c | 12 ++-- drivers/net/arcnet/arc-rimi.c | 6 +- drivers/net/arcnet/arcnet.c | 14 +++--- drivers/net/at1700.c | 16 +++--- drivers/net/atarilance.c | 4 +- drivers/net/atlx/atl1.c | 8 ++-- drivers/net/atp.c | 4 +- drivers/net/benet/be_main.c | 4 +- drivers/net/bfin_mac.c | 12 ++-- drivers/net/bmac.c | 4 +- drivers/net/bnx2x_link.c | 4 +- drivers/net/bonding/bond_3ad.c | 24 ++++---- drivers/net/bonding/bond_main.c | 4 +- drivers/net/bonding/bonding.h | 4 +- drivers/net/can/usb/ems_usb.c | 8 ++-- drivers/net/cxgb3/cxgb3_main.c | 26 +++++----- drivers/net/dl2k.c | 4 +- drivers/net/dm9000.c | 4 +- drivers/net/e1000/e1000_main.c | 4 +- drivers/net/e1000e/netdev.c | 8 ++-- drivers/net/e2100.c | 6 +- drivers/net/ehea/ehea_main.c | 20 ++++---- drivers/net/ehea/ehea_qmr.c | 4 +- drivers/net/epic100.c | 8 ++-- drivers/net/fealnx.c | 12 ++-- drivers/net/gianfar_sysfs.c | 4 +- drivers/net/hamachi.c | 10 ++-- drivers/net/hamradio/bpqether.c | 5 +-- drivers/net/hamradio/dmascc.c | 8 ++-- drivers/net/hp-plus.c | 4 +- drivers/net/hp100.c | 4 +- drivers/net/ibm_newemac/core.c | 24 ++++---- drivers/net/igb/igb_main.c | 5 +- drivers/net/igbvf/netdev.c | 4 +- drivers/net/irda/irda-usb.c | 8 ++-- drivers/net/irda/stir4200.c | 12 ++-- drivers/net/irda/via-ircc.c | 16 +++--- drivers/net/irda/vlsi_ir.c | 16 +++--- drivers/net/isa-skeleton.c | 6 +- drivers/net/iseries_veth.c | 42 ++++++++-------- drivers/net/jazzsonic.c | 4 +- drivers/net/jme.c | 12 ++-- drivers/net/lance.c | 12 ++-- drivers/net/lib8390.c | 12 ++-- drivers/net/ll_temac_main.c | 4 +- drivers/net/mac89x0.c | 4 +- drivers/net/mace.c | 4 +- drivers/net/myri10ge/myri10ge.c | 16 +++--- drivers/net/natsemi.c | 28 +++++----- drivers/net/netxen/netxen_nic_ethtool.c | 32 ++++++------ drivers/net/netxen/netxen_nic_hw.c | 16 +++--- drivers/net/ni52.c | 4 +- drivers/net/ns83820.c | 24 ++++---- drivers/net/pci-skeleton.c | 12 ++-- drivers/net/pcmcia/axnet_cs.c | 4 +- drivers/net/pcmcia/fmvj18x_cs.c | 20 ++++---- drivers/net/pcmcia/pcnet_cs.c | 4 +- drivers/net/pcmcia/smc91c92_cs.c | 8 ++-- drivers/net/pcmcia/xirc2ps_cs.c | 16 +++--- drivers/net/pcnet32.c | 20 ++++---- drivers/net/phy/phy.c | 18 +++--- drivers/net/plip.c | 13 ++--- drivers/net/ppp_async.c | 12 ++-- drivers/net/ppp_deflate.c | 44 ++++++++-------- drivers/net/ppp_generic.c | 66 ++++++++++++------------ drivers/net/ppp_mppe.c | 8 ++-- drivers/net/ppp_synctty.c | 4 +- drivers/net/pppoe.c | 4 +- drivers/net/qla3xxx.c | 8 ++-- drivers/net/qlge/qlge_main.c | 4 +- drivers/net/r6040.c | 3 +- drivers/net/r8169.c | 4 +- drivers/net/s6gmac.c | 6 +- drivers/net/sc92031.c | 14 +++--- drivers/net/skge.c | 23 ++++---- drivers/net/sky2.c | 32 ++++++------ drivers/net/slip.c | 8 ++-- drivers/net/smc-mca.c | 6 +- drivers/net/smc91x.h | 10 ++-- drivers/net/smsc911x.c | 4 +- drivers/net/starfire.c | 8 ++-- drivers/net/stmmac/stmmac_main.c | 3 +- drivers/net/sundance.c | 16 +++--- drivers/net/sungem.h | 4 +- drivers/net/sunhme.c | 6 +- drivers/net/tehuti.c | 14 +++--- drivers/net/tg3.c | 13 ++--- drivers/net/tlan.c | 4 +- drivers/net/tokenring/lanstreamer.c | 8 ++-- drivers/net/tokenring/smctr.c | 86 +++++++++++++++---------------- drivers/net/tokenring/tms380tr.c | 24 ++++---- drivers/net/tulip/21142.c | 8 ++-- drivers/net/tulip/de2104x.c | 6 +- drivers/net/tulip/eeprom.c | 8 ++-- drivers/net/tulip/interrupt.c | 16 +++--- drivers/net/tulip/media.c | 4 +- drivers/net/tulip/pnic2.c | 6 +- drivers/net/tulip/tulip_core.c | 22 ++++---- drivers/net/tulip/winbond-840.c | 8 ++-- drivers/net/typhoon.c | 4 +- drivers/net/ucc_geth.c | 24 ++++---- drivers/net/usb/asix.c | 12 ++-- drivers/net/usb/catc.c | 4 +- drivers/net/usb/cdc-phonet.c | 8 ++-- drivers/net/usb/cdc_eem.c | 4 +- drivers/net/usb/cdc_ether.c | 32 ++++++------ drivers/net/usb/hso.c | 34 ++++++------ drivers/net/usb/mcs7830.c | 4 +- drivers/net/usb/rndis_host.c | 10 ++-- drivers/net/usb/usbnet.c | 48 +++++++++--------- drivers/net/usb/zaurus.c | 4 +- drivers/net/via-rhine.c | 10 ++-- drivers/net/via-velocity.c | 16 +++--- drivers/net/virtio_net.c | 10 ++-- drivers/net/vmxnet3/vmxnet3_drv.c | 4 +- drivers/net/vxge/vxge-main.c | 6 +- drivers/net/vxge/vxge-traffic.c | 20 ++++---- drivers/net/wan/farsync.c | 12 ++-- drivers/net/wan/pc300_drv.c | 17 +++--- drivers/net/wan/sbni.c | 28 +++++----- drivers/net/wan/x25_asy.c | 4 +- drivers/net/yellowfin.c | 8 ++-- drivers/net/znet.c | 4 +- 132 files changed, 799 insertions(+), 805 deletions(-)
drivers/net/3c501.c +4 -4
@@ -249,11 +249,11 @@ static int __init el1_probe1(struct net_device *dev, int ioaddr)* for the Sager NP943 prefix. */ -if (station_addr[0 ] ==0x02 && station_addr[1 ] ==0x60 - && station_addr[2 ] ==0x8c ) +if (station_addr[0 ] ==0x02 && station_addr[1 ] ==0x60 && + station_addr[2 ] ==0x8c ) mname ="3c501" ; -else if (station_addr[0 ] ==0x00 && station_addr[1 ] ==0x80 - && station_addr[2 ] ==0xC8 ) +else if (station_addr[0 ] ==0x00 && station_addr[1 ] ==0x80 && + station_addr[2 ] ==0xC8 ) mname ="NP943" ;else {release_region (ioaddr,EL1_IO_EXTENT );
drivers/net/3c503.c +8 -7
@@ -214,8 +214,8 @@ el2_probe1(struct net_device *dev, int ioaddr) iobase_reg =inb (ioaddr+0x403 ); membase_reg =inb (ioaddr+0x404 );/* ASIC location registers should be 0 or have only a single bit set. */ -if ( (iobase_reg & (iobase_reg -1 )) - || (membase_reg & (membase_reg -1 ))) { +if ((iobase_reg & (iobase_reg -1 )) || + (membase_reg & (membase_reg -1 ))) { retval = -ENODEV ; goto out1; }
@@ -291,8 +291,8 @@ el2_probe1(struct net_device *dev, int ioaddr)writel (0xba5eba5e , mem_base);for (i =sizeof (test_val); i <EL2_MEMSIZE ; i+=sizeof (test_val)) {writel (test_val, mem_base + i); -if (readl (mem_base) !=0xba5eba5e - ||readl (mem_base + i) != test_val) { +if (readl (mem_base) !=0xba5eba5e || +readl (mem_base + i) != test_val) {pr_warning ("3c503: memory failure or memory address conflict.\n" ); dev->mem_start =0 ; ei_status.name ="3c503-PIO" ;
@@ -397,9 +397,10 @@ el2_open(struct net_device *dev)unsigned long cookie =probe_irq_on ();outb_p (0x04 << ((*irqp ==9 ) ?2 : *irqp),E33G_IDCFR );outb_p (0x00 ,E33G_IDCFR ); -if (*irqp ==probe_irq_off (cookie)/* It's a good IRQ line! */ - && ((retval =request_irq (dev->irq = *irqp, - eip_interrupt,0 , dev->name, dev)) ==0 )) +if (*irqp ==probe_irq_off (cookie) &&/* It's a good IRQ line! */ + ((retval =request_irq (dev->irq = *irqp, + eip_interrupt,0 , + dev->name, dev)) ==0 ))break ; }else {if (retval != -EBUSY )
drivers/net/3c507.c +2 -2
@@ -836,8 +836,8 @@ static void el16_rx(struct net_device *dev)void __iomem *data_frame = lp->base + data_buffer_addr;ushort pkt_len =readw (data_frame); -if (rfd_cmd !=0 || data_buffer_addr != rx_head +22 - || (pkt_len &0xC000 ) !=0xC000 ) { +if (rfd_cmd !=0 || data_buffer_addr != rx_head +22 || + (pkt_len &0xC000 ) !=0xC000 ) { pr_err("%s: Rx frame at %#x corrupted, " "status %04x cmd %04x next %04x " "data-buf @%04x %04x.\n",
drivers/net/3c509.c +5 -5
@@ -253,9 +253,9 @@ static int el3_isa_id_sequence(__be16 *phys_addr)This check is needed in order not to register them twice. */ for (i =0 ; i < el3_cards; i++) {struct el3_private *lp =netdev_priv (el3_devs[i]); -if (lp->type ==EL3_PNP - && !memcmp (phys_addr, el3_devs[i]->dev_addr, -ETH_ALEN )) { +if (lp->type ==EL3_PNP && + !memcmp (phys_addr, el3_devs[i]->dev_addr, +ETH_ALEN )) {if (el3_debug >3 ) pr_debug("3c509 with address %02x %02x %02x %02x %02x %02x was found by ISAPnP\n", phys_addr[0] & 0xff, phys_addr[0] >> 8,
@@ -835,8 +835,8 @@ el3_start_xmit(struct sk_buff *skb, struct net_device *dev)#ifndef final_version {/* Error-checking code, delete someday. */ ushort status =inw (ioaddr +EL3_STATUS ); -if (status &0x0001 /* IRQ line active, missed one. */ - &&inw (ioaddr +EL3_STATUS ) &1 ) {/* Make sure. */ +if (status &0x0001 &&/* IRQ line active, missed one. */ +inw (ioaddr +EL3_STATUS ) &1 ) {/* Make sure. */ pr_debug("%s: Missed interrupt, status then %04x now %04x" " Tx %2.2x Rx %4.4x.\n", dev->name, status, inw(ioaddr + EL3_STATUS), inb(ioaddr + TX_STATUS),
drivers/net/3c515.c +7 -6
@@ -764,10 +764,11 @@ static int corkscrew_open(struct net_device *dev)/* Use the now-standard shared IRQ implementation. */ if (vp->capabilities ==0x11c7 ) {/* Corkscrew: Cannot share ISA resources. */ -if (dev->irq ==0 - || dev->dma ==0 - ||request_irq (dev->irq, corkscrew_interrupt,0 , - vp->product_name, dev))return -EAGAIN ; +if (dev->irq ==0 || + dev->dma ==0 || +request_irq (dev->irq, corkscrew_interrupt,0 , + vp->product_name, dev)) +return -EAGAIN ;enable_dma (dev->dma);set_dma_mode (dev->dma,DMA_MODE_CASCADE ); } else if (request_irq(dev->irq, corkscrew_interrupt, IRQF_SHARED,
@@ -1368,8 +1369,8 @@ static int boomerang_rx(struct net_device *dev)/* Check if the packet is long enough to just accept without copying to a properly sized skbuff. */ -if (pkt_len < rx_copybreak - && (skb =dev_alloc_skb (pkt_len +4 )) !=NULL ) { +if (pkt_len < rx_copybreak && + (skb =dev_alloc_skb (pkt_len +4 )) !=NULL ) {skb_reserve (skb,2 );/* Align IP on 16 byte boundaries */ /* 'skb_put()' points to the start of sk_buff data area. */ memcpy(skb_put(skb, pkt_len),
drivers/net/3c527.c +2 -2
@@ -1168,8 +1168,8 @@ static void mc32_rx_ring(struct net_device *dev)/* Try to save time by avoiding a copy on big frames */ -if ((length >RX_COPYBREAK ) - && ((newskb=dev_alloc_skb (1532 )) !=NULL )) +if ((length >RX_COPYBREAK ) && + ((newskb=dev_alloc_skb (1532 )) !=NULL )) { skb=lp->rx_ring[rx_ring_tail].skb;skb_put (skb, length);
drivers/net/3c59x.c +2 -2
@@ -1942,8 +1942,8 @@ vortex_error(struct net_device *dev, int status)if (status & TxComplete) {/* Really "TxError" for us. */ tx_status =ioread8 (ioaddr + TxStatus);/* Presumably a tx-timeout. We must merely re-enable. */ -if (vortex_debug >2 - || (tx_status !=0x88 && vortex_debug >0 )) { +if (vortex_debug >2 || + (tx_status !=0x88 && vortex_debug >0 )) {pr_err ("%s: Transmit error, Tx status register %2.2x.\n" , dev->name, tx_status);if (tx_status ==0x82 ) {
drivers/net/8139cp.c +2 -2
@@ -909,8 +909,8 @@ static void __cp_set_rx_mode (struct net_device *dev) AcceptBroadcast | AcceptMulticast | AcceptMyPhys | AcceptAllPhys; mc_filter[1 ] = mc_filter[0 ] =0xffffffff ; - }else if ((dev->mc_count > multicast_filter_limit) - || (dev->flags &IFF_ALLMULTI )) { + }else if ((dev->mc_count > multicast_filter_limit) || + (dev->flags &IFF_ALLMULTI )) {/* Too many to filter perfectly -- accept all multicasts. */ rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys; mc_filter[1 ] = mc_filter[0 ] =0xffffffff ;
drivers/net/8139too.c +6 -6
@@ -1549,8 +1549,8 @@ static inline void rtl8139_thread_iter (struct net_device *dev, mii_lpa =mdio_read (dev, tp->phys[0 ],MII_LPA );if (!tp->mii.force_media && mii_lpa !=0xffff ) { -int duplex = (mii_lpa &LPA_100FULL ) - || (mii_lpa &0x01C0 ) ==0x0040 ; +int duplex = ((mii_lpa &LPA_100FULL ) || + (mii_lpa &0x01C0 ) ==0x0040 );if (tp->mii.full_duplex != duplex) { tp->mii.full_duplex = duplex;
@@ -1936,8 +1936,8 @@ static int rtl8139_rx(struct net_device *dev, struct rtl8139_private *tp,RTL_R16 (RxBufAddr), RTL_R16 (RxBufPtr), RTL_R8 (ChipCmd)); -while (netif_running (dev) && received < budget - && (RTL_R8 (ChipCmd) & RxBufEmpty) ==0 ) { +while (netif_running (dev) && received < budget && + (RTL_R8 (ChipCmd) & RxBufEmpty) ==0 ) {u32 ring_offset = cur_rx %RX_BUF_LEN ;u32 rx_status;unsigned int pkt_size;
@@ -2521,8 +2521,8 @@ static void __set_rx_mode (struct net_device *dev) AcceptBroadcast | AcceptMulticast | AcceptMyPhys | AcceptAllPhys; mc_filter[1 ] = mc_filter[0 ] =0xffffffff ; - }else if ((dev->mc_count > multicast_filter_limit) - || (dev->flags &IFF_ALLMULTI )) { + }else if ((dev->mc_count > multicast_filter_limit) || + (dev->flags &IFF_ALLMULTI )) {/* Too many to filter perfectly -- accept all multicasts. */ rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys; mc_filter[1 ] = mc_filter[0 ] =0xffffffff ;
drivers/net/appletalk/ipddp.c +6 -6
@@ -230,9 +230,9 @@ static int ipddp_delete(struct ipddp_route *rt)spin_lock_bh (&ipddp_route_lock);while ((tmp = *r) !=NULL ) { -if (tmp->ip == rt->ip - && tmp->at.s_net == rt->at.s_net - && tmp->at.s_node == rt->at.s_node) +if (tmp->ip == rt->ip && + tmp->at.s_net == rt->at.s_net && + tmp->at.s_node == rt->at.s_node) { *r = tmp->next;spin_unlock_bh (&ipddp_route_lock);
@@ -255,9 +255,9 @@ static struct ipddp_route* __ipddp_find_route(struct ipddp_route *rt)for (f = ipddp_route_list; f !=NULL ; f = f->next) { -if (f->ip == rt->ip - && f->at.s_net == rt->at.s_net - && f->at.s_node == rt->at.s_node) +if (f->ip == rt->ip && + f->at.s_net == rt->at.s_net && + f->at.s_node == rt->at.s_node)return (f); }
drivers/net/arcnet/arc-rimi.c +3 -3
@@ -174,9 +174,9 @@ static int __init arcrimi_found(struct net_device *dev)* 2k (or there are no mirrors at all) but on some, it's 4k. */ mirror_size =MIRROR_SIZE ; -if (readb (p) == TESTvalue - &&check_mirror (shmem -MIRROR_SIZE ,MIRROR_SIZE ) ==0 - &&check_mirror (shmem -2 *MIRROR_SIZE ,MIRROR_SIZE ) ==1 ) +if (readb (p) == TESTvalue && +check_mirror (shmem -MIRROR_SIZE ,MIRROR_SIZE ) ==0 && +check_mirror (shmem -2 *MIRROR_SIZE ,MIRROR_SIZE ) ==1 ) mirror_size =2 *MIRROR_SIZE ; first_mirror = shmem - mirror_size;
drivers/net/arcnet/arcnet.c +7 -7
@@ -301,8 +301,8 @@ static int choose_mtu(void)/* choose the smallest MTU of all available encaps */ for (count =0 ; count <256 ; count++) { -if (arc_proto_map[count] != &arc_proto_null - && arc_proto_map[count]->mtu < mtu) { +if (arc_proto_map[count] != &arc_proto_null && + arc_proto_map[count]->mtu < mtu) { mtu = arc_proto_map[count]->mtu; } }
@@ -953,13 +953,13 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)* > RECON_THRESHOLD/min; * then print a warning message. */ -if (!lp->network_down - && (lp->last_recon - lp->first_recon) <=HZ *60 - && lp->num_recons >=RECON_THRESHOLD ) { +if (!lp->network_down && + (lp->last_recon - lp->first_recon) <=HZ *60 && + lp->num_recons >=RECON_THRESHOLD ) { lp->network_down =1 ;BUGMSG (D_NORMAL ,"many reconfigurations detected: cabling problem?\n" ); - }else if (!lp->network_down - && lp->last_recon - lp->first_recon >HZ *60 ) { + }else if (!lp->network_down && + lp->last_recon - lp->first_recon >HZ *60 ) {/* reset counters if we've gone for over a minute. */ lp->first_recon = lp->last_recon; lp->num_recons =1 ;
drivers/net/at1700.c +8 -8
@@ -350,13 +350,13 @@ static int __init at1700_probe1(struct net_device *dev, int ioaddr) slot =-1 ;/* We must check for the EEPROM-config boards first, else accessing IOCONFIG0 will move the board! */ -if (at1700_probe_list[inb (ioaddr +IOCONFIG1 ) &0x07 ] == ioaddr - &&read_eeprom (ioaddr,4 ) ==0x0000 - && (read_eeprom (ioaddr,5 ) &0xff00 ) ==0xF400 ) +if (at1700_probe_list[inb (ioaddr +IOCONFIG1 ) &0x07 ] == ioaddr && +read_eeprom (ioaddr,4 ) ==0x0000 && + (read_eeprom (ioaddr,5 ) &0xff00 ) ==0xF400 ) is_at1700 =1 ; -else if (inb (ioaddr +SAPROM ) ==0x00 - &&inb (ioaddr +SAPROM +1 ) ==0x00 - &&inb (ioaddr +SAPROM +2 ) ==0x0e ) +else if (inb (ioaddr +SAPROM ) ==0x00 && +inb (ioaddr +SAPROM +1 ) ==0x00 && +inb (ioaddr +SAPROM +2 ) ==0x0e ) is_fmv18x =1 ;else { goto err_out;
@@ -839,8 +839,8 @@ set_rx_mode(struct net_device *dev)if (dev->flags &IFF_PROMISC ) {memset (mc_filter,0xff ,sizeof (mc_filter));outb (3 , ioaddr +RX_MODE );/* Enable promiscuous mode */ - }else if (dev->mc_count >MC_FILTERBREAK - || (dev->flags &IFF_ALLMULTI )) { + }else if (dev->mc_count >MC_FILTERBREAK || + (dev->flags &IFF_ALLMULTI )) {/* Too many to filter perfectly -- accept all multicasts. */ memset (mc_filter,0xff ,sizeof (mc_filter));outb (2 , ioaddr +RX_MODE );/* Use normal mode. */
drivers/net/atarilance.c +2 -2
@@ -930,8 +930,8 @@ static irqreturn_t lance_interrupt( int irq, void *dev_id ) }#endif -if (lp->tx_full && (netif_queue_stopped (dev)) - && dirty_tx > lp->cur_tx -TX_RING_SIZE +2 ) { +if (lp->tx_full && (netif_queue_stopped (dev)) && + dirty_tx > lp->cur_tx -TX_RING_SIZE +2 ) {/* The ring is no longer full, clear tbusy. */ lp->tx_full =0 ;netif_wake_queue (dev);
drivers/net/atlx/atl1.c +4 -4
@@ -1344,8 +1344,8 @@ static u32 atl1_check_link(struct atl1_adapter *adapter)/* link result is our setting */ if (!reconfig) { -if (adapter->link_speed != speed - || adapter->link_duplex != duplex) { +if (adapter->link_speed != speed || + adapter->link_duplex != duplex) { adapter->link_speed = speed; adapter->link_duplex = duplex;atl1_setup_mac_ctrl (adapter);
@@ -2087,8 +2087,8 @@ static void atl1_intr_tx(struct atl1_adapter *adapter) }atomic_set (&tpd_ring->next_to_clean, sw_tpd_next_to_clean); -if (netif_queue_stopped (adapter->netdev) - &&netif_carrier_ok (adapter->netdev)) +if (netif_queue_stopped (adapter->netdev) && +netif_carrier_ok (adapter->netdev))netif_wake_queue (adapter->netdev); }
drivers/net/atp.c +2 -2
@@ -673,8 +673,8 @@ static irqreturn_t atp_interrupt(int irq, void *dev_instance)netif_wake_queue (dev);/* Inform upper layers. */ } num_tx_since_rx++; - }else if (num_tx_since_rx >8 - &&time_after (jiffies, dev->last_rx +HZ )) { + }else if (num_tx_since_rx >8 && +time_after (jiffies, dev->last_rx +HZ )) {if (net_debug >2 ) printk(KERN_DEBUG "%s: Missed packet? No Rx after %d Tx and " "%ld jiffies status %02x CMR1 %02x.\n", dev->name,
drivers/net/benet/be_main.c +2 -2
@@ -2338,8 +2338,8 @@ static struct pci_driver be_driver = {static int __init be_init_module (void ) { -if (rx_frag_size !=8192 && rx_frag_size !=4096 - && rx_frag_size !=2048 ) { +if (rx_frag_size !=8192 && rx_frag_size !=4096 && + rx_frag_size !=2048 ) { printk(KERN_WARNING DRV_NAME" : Module param rx_frag_size must be 2048/4096/8192." " Using 2048\n");
drivers/net/bfin_mac.c +6 -6
@@ -554,8 +554,8 @@ static void adjust_tx_list(void) {int timeout_cnt =MAX_TIMEOUT_CNT ; -if (tx_list_head->status.status_word !=0 - && current_tx_ptr != tx_list_head) { +if (tx_list_head->status.status_word !=0 && + current_tx_ptr != tx_list_head) { goto adjust_head;/* released something, just return; */ }
@@ -567,8 +567,8 @@ static void adjust_tx_list(void)if (current_tx_ptr->next->next == tx_list_head) {while (tx_list_head->status.status_word ==0 ) {udelay (10 ); -if (tx_list_head->status.status_word !=0 - || !(bfin_read_DMA2_IRQ_STATUS () &DMA_RUN )) { +if (tx_list_head->status.status_word !=0 || + !(bfin_read_DMA2_IRQ_STATUS () &DMA_RUN )) { goto adjust_head; }if (timeout_cnt-- <0 ) {
@@ -596,8 +596,8 @@ adjust_head: ": no sk_buff in a transmitted frame!\n"); } tx_list_head = tx_list_head->next; - }while (tx_list_head->status.status_word !=0 - && current_tx_ptr != tx_list_head); + }while (tx_list_head->status.status_word !=0 && + current_tx_ptr != tx_list_head);return ; }
drivers/net/bmac.c +2 -2
@@ -438,8 +438,8 @@ bmac_init_phy(struct net_device *dev) ctrl =bmac_mif_read (dev,0 ); capable = ((bmac_mif_read (dev,1 ) &0xf800 ) >>6 ) |1 ; -if (bmac_mif_read (dev,4 ) != capable - || (ctrl &0x1000 ) ==0 ) { +if (bmac_mif_read (dev,4 ) != capable || + (ctrl &0x1000 ) ==0 ) {bmac_mif_write (dev,4 , capable);bmac_mif_write (dev,0 ,0x1200 ); }else
drivers/net/bnx2x_link.c +2 -2
@@ -4717,8 +4717,8 @@ static u8 bnx2x_ext_phy_is_link_up(struct link_params *params, 0xc809, &val1);DP (NETIF_MSG_LINK ,"8705 1.c809 val=0x%x\n" , val1); - ext_phy_link_up = ((rx_sd &0x1 ) && (val1 & (1 <<9 )) - && ((val1 & (1 <<8 )) ==0 )); + ext_phy_link_up = ((rx_sd &0x1 ) && (val1 & (1 <<9 )) && + ((val1 & (1 <<8 )) ==0 ));if (ext_phy_link_up) vars->line_speed =SPEED_10000 ;break ;
drivers/net/bonding/bond_3ad.c +12 -12
@@ -561,12 +561,12 @@ static void __update_selected(struct lacpdu *lacpdu, struct port *port)const struct port_params *partner = &port->partner_oper;// check if any parameter is different -if (ntohs (lacpdu->actor_port) != partner->port_number - ||ntohs (lacpdu->actor_port_priority) != partner->port_priority - ||MAC_ADDRESS_COMPARE (&lacpdu->actor_system, &partner->system) - ||ntohs (lacpdu->actor_system_priority) != partner->system_priority - ||ntohs (lacpdu->actor_key) != partner->key - || (lacpdu->actor_state &AD_STATE_AGGREGATION ) != (partner->port_state &AD_STATE_AGGREGATION )) { +if (ntohs (lacpdu->actor_port) != partner->port_number || +ntohs (lacpdu->actor_port_priority) != partner->port_priority || +MAC_ADDRESS_COMPARE (&lacpdu->actor_system, &partner->system) || +ntohs (lacpdu->actor_system_priority) != partner->system_priority || +ntohs (lacpdu->actor_key) != partner->key || + (lacpdu->actor_state &AD_STATE_AGGREGATION ) != (partner->port_state &AD_STATE_AGGREGATION )) {// update the state machine Selected variable port->sm_vars &= ~AD_PORT_SELECTED ; }
@@ -592,12 +592,12 @@ static void __update_default_selected(struct port *port)const struct port_params *oper = &port->partner_oper;// check if any parameter is different -if (admin->port_number != oper->port_number - || admin->port_priority != oper->port_priority - ||MAC_ADDRESS_COMPARE (&admin->system, &oper->system) - || admin->system_priority != oper->system_priority - || admin->key != oper->key - || (admin->port_state &AD_STATE_AGGREGATION ) +if (admin->port_number != oper->port_number || + admin->port_priority != oper->port_priority || +MAC_ADDRESS_COMPARE (&admin->system, &oper->system) || + admin->system_priority != oper->system_priority || + admin->key != oper->key || + (admin->port_state &AD_STATE_AGGREGATION ) != (oper->port_state &AD_STATE_AGGREGATION )) {// update the state machine Selected variable port->sm_vars &= ~AD_PORT_SELECTED ;
drivers/net/bonding/bond_main.c +2 -2
@@ -1852,8 +1852,8 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) }if (!bond->params.fail_over_mac) { -if (!compare_ether_addr (bond_dev->dev_addr, slave->perm_hwaddr) - && bond->slave_cnt >1 ) +if (!compare_ether_addr (bond_dev->dev_addr, slave->perm_hwaddr) && + bond->slave_cnt >1 )pr_warning (DRV_NAME ": %s: Warning: the permanent HWaddr of %s - " "%pM - is still in use by %s. "
drivers/net/bonding/bonding.h +2 -2
@@ -254,8 +254,8 @@ static inline struct bonding *bond_get_bond_by_slave(struct slave *slave)static inline bool bond_is_lb (const struct bonding *bond) { -return bond->params.mode ==BOND_MODE_TLB - || bond->params.mode ==BOND_MODE_ALB ; +return (bond->params.mode ==BOND_MODE_TLB || + bond->params.mode ==BOND_MODE_ALB ); }#define BOND_PRI_RESELECT_ALWAYS 0
drivers/net/can/usb/ems_usb.c +4 -4
@@ -318,12 +318,12 @@ static void ems_usb_rx_can_msg(struct ems_usb *dev, struct ems_cpc_msg *msg) cf->can_id =le32_to_cpu (msg->msg.can_msg.id); cf->can_dlc =min_t (u8, msg->msg.can_msg.length,8 ); -if (msg->type ==CPC_MSG_TYPE_EXT_CAN_FRAME - || msg->type ==CPC_MSG_TYPE_EXT_RTR_FRAME ) +if (msg->type ==CPC_MSG_TYPE_EXT_CAN_FRAME || + msg->type ==CPC_MSG_TYPE_EXT_RTR_FRAME ) cf->can_id |=CAN_EFF_FLAG ; -if (msg->type ==CPC_MSG_TYPE_RTR_FRAME - || msg->type ==CPC_MSG_TYPE_EXT_RTR_FRAME ) { +if (msg->type ==CPC_MSG_TYPE_RTR_FRAME || + msg->type ==CPC_MSG_TYPE_EXT_RTR_FRAME ) { cf->can_id |=CAN_RTR_FLAG ; }else {for (i =0 ; i < cf->can_dlc; i++)
drivers/net/cxgb3/cxgb3_main.c +13 -13
@@ -2117,19 +2117,19 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)if (t.qset_idx >=SGE_QSETS )return -EINVAL ;if (!in_range (t.intr_lat,0 ,M_NEWTIMER ) || - !in_range (t.cong_thres,0 ,255 ) || - !in_range (t.txq_size[0 ],MIN_TXQ_ENTRIES , -MAX_TXQ_ENTRIES ) || - !in_range (t.txq_size[1 ],MIN_TXQ_ENTRIES , -MAX_TXQ_ENTRIES ) || - !in_range (t.txq_size[2 ],MIN_CTRL_TXQ_ENTRIES , -MAX_CTRL_TXQ_ENTRIES ) || - !in_range (t.fl_size[0 ],MIN_FL_ENTRIES , -MAX_RX_BUFFERS ) - || !in_range (t.fl_size[1 ],MIN_FL_ENTRIES , -MAX_RX_JUMBO_BUFFERS ) - || !in_range (t.rspq_size,MIN_RSPQ_ENTRIES , -MAX_RSPQ_ENTRIES )) + !in_range (t.cong_thres,0 ,255 ) || + !in_range (t.txq_size[0 ],MIN_TXQ_ENTRIES , +MAX_TXQ_ENTRIES ) || + !in_range (t.txq_size[1 ],MIN_TXQ_ENTRIES , +MAX_TXQ_ENTRIES ) || + !in_range (t.txq_size[2 ],MIN_CTRL_TXQ_ENTRIES , +MAX_CTRL_TXQ_ENTRIES ) || + !in_range (t.fl_size[0 ],MIN_FL_ENTRIES , +MAX_RX_BUFFERS ) || + !in_range (t.fl_size[1 ],MIN_FL_ENTRIES , +MAX_RX_JUMBO_BUFFERS ) || + !in_range (t.rspq_size,MIN_RSPQ_ENTRIES , +MAX_RSPQ_ENTRIES ))return -EINVAL ;if ((adapter->flags &FULL_INIT_DONE ) && t.lro >0 )
drivers/net/dl2k.c +2 -2
@@ -163,8 +163,8 @@ rio_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent) strcmp (media[card_idx], "4") == 0) { np->speed =100 ; np->full_duplex =1 ; - } else if (strcmp (media[card_idx], "100mbps_hd") == 0 - || strcmp (media[card_idx], "3") == 0) { + } else if (strcmp (media[card_idx], "100mbps_hd") == 0 || + strcmp (media[card_idx], "3") == 0) { np->speed = 100; np->full_duplex = 0; } else if (strcmp (media[card_idx], "10mbps_fd") == 0 ||
drivers/net/dm9000.c +2 -2
@@ -1024,8 +1024,8 @@ dm9000_rx(struct net_device *dev) }/* Move data from DM9000 */ -if (GoodPacket - && ((skb =dev_alloc_skb (RxLen +4 )) !=NULL )) { +if (GoodPacket && + ((skb =dev_alloc_skb (RxLen +4 )) !=NULL )) {skb_reserve (skb,2 ); rdptr = (u8 *)skb_put (skb, RxLen -4 );
drivers/net/e1000/e1000_main.c +2 -2
@@ -3507,8 +3507,8 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter, adapter->detect_tx_hung = false;if (tx_ring->buffer_info[eop].time_stamp &&time_after (jiffies, tx_ring->buffer_info[eop].time_stamp + - (adapter->tx_timeout_factor *HZ )) - && !(er32 (STATUS ) &E1000_STATUS_TXOFF )) { + (adapter->tx_timeout_factor *HZ )) && + !(er32 (STATUS ) &E1000_STATUS_TXOFF )) {/* detected Tx unit hang */ DPRINTK(DRV, ERR, "Detected Tx Unit Hang\n"
drivers/net/e1000e/netdev.c +4 -4
@@ -679,8 +679,8 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter) adapter->detect_tx_hung =0 ;if (tx_ring->buffer_info[i].time_stamp &&time_after (jiffies, tx_ring->buffer_info[i].time_stamp - + (adapter->tx_timeout_factor *HZ )) - && !(er32 (STATUS ) &E1000_STATUS_TXOFF )) { + + (adapter->tx_timeout_factor *HZ )) && + !(er32 (STATUS ) &E1000_STATUS_TXOFF )) {schedule_work (&adapter->print_hang_task);netif_stop_queue (netdev); }
@@ -4046,8 +4046,8 @@ static int e1000_transfer_dhcp_info(struct e1000_adapter *adapter,u16 length, offset;if (vlan_tx_tag_present (skb)) { -if (!((vlan_tx_tag_get (skb) == adapter->hw.mng_cookie.vlan_id) - && (adapter->hw.mng_cookie.status & +if (!((vlan_tx_tag_get (skb) == adapter->hw.mng_cookie.vlan_id) && + (adapter->hw.mng_cookie.status &E1000_MNG_DHCP_COOKIE_STATUS_VLAN )))return 0 ; }
drivers/net/e2100.c +3 -3
@@ -186,9 +186,9 @@ static int __init e21_probe1(struct net_device *dev, int ioaddr)return -EBUSY ;/* First check the station address for the Ctron prefix. */ -if (inb (ioaddr +E21_SAPROM +0 ) !=0x00 - ||inb (ioaddr +E21_SAPROM +1 ) !=0x00 - ||inb (ioaddr +E21_SAPROM +2 ) !=0x1d ) { +if (inb (ioaddr +E21_SAPROM +0 ) !=0x00 || +inb (ioaddr +E21_SAPROM +1 ) !=0x00 || +inb (ioaddr +E21_SAPROM +2 ) !=0x1d ) { retval = -ENODEV ; goto out; }
drivers/net/ehea/ehea_main.c +10 -10
@@ -189,8 +189,8 @@ static void ehea_update_firmware_handles(void)for (k =0 ; k <EHEA_MAX_PORTS ; k++) {struct ehea_port *port = adapter->port[k]; -if (!port || (port->state !=EHEA_PORT_UP ) - || (num_ports ==0 )) +if (!port || (port->state !=EHEA_PORT_UP ) || + (num_ports ==0 ))continue ; for (l = 0;
@@ -657,8 +657,8 @@ static int get_skb_hdr(struct sk_buff *skb, void **iphdr,static void ehea_proc_skb (struct ehea_port_res *pr,struct ehea_cqe *cqe,struct sk_buff *skb) { -int vlan_extracted = (cqe->status &EHEA_CQE_VLAN_TAG_XTRACT ) - && pr->port->vgrp; +int vlan_extracted = ((cqe->status &EHEA_CQE_VLAN_TAG_XTRACT ) && + pr->port->vgrp);if (use_lro) {if (vlan_extracted)
@@ -1389,8 +1389,8 @@ out:int ehea_rem_smrs (struct ehea_port_res *pr) { -if ((ehea_rem_mr (&pr->send_mr)) - || (ehea_rem_mr (&pr->recv_mr))) +if ((ehea_rem_mr (&pr->send_mr)) || + (ehea_rem_mr (&pr->recv_mr)))return -EIO ;else return 0 ;
@@ -2031,8 +2031,8 @@ static void ehea_xmit2(struct sk_buff *skb, struct net_device *dev,write_ip_start_end (swqe, skb);if (iph->protocol ==IPPROTO_UDP ) { -if ((iph->frag_off &IP_MF ) - || (iph->frag_off &IP_OFFSET )) +if ((iph->frag_off &IP_MF ) || + (iph->frag_off &IP_OFFSET ))/* IP fragment, so don't change cs */ swqe->tx_control &= ~EHEA_SWQE_TCP_CHECKSUM ;else
@@ -2077,8 +2077,8 @@ static void ehea_xmit3(struct sk_buff *skb, struct net_device *dev,write_tcp_offset_end (swqe, skb); }else if (iph->protocol ==IPPROTO_UDP ) { -if ((iph->frag_off &IP_MF ) - || (iph->frag_off &IP_OFFSET )) +if ((iph->frag_off &IP_MF ) || + (iph->frag_off &IP_OFFSET ))/* IP fragment, so don't change cs */ swqe->tx_control |=EHEA_SWQE_CRC |EHEA_SWQE_IMM_DATA_PRESENT ;
drivers/net/ehea/ehea_qmr.c +2 -2
@@ -837,8 +837,8 @@ static u64 ehea_reg_mr_section(int top, int dir, int idx, u64 *pt, hret =ehea_h_register_rpage_mr (adapter->handle, mr->handle,0 ,0 , pt_abs,EHEA_MAX_RPAGE ); -if ((hret !=H_SUCCESS ) - && (hret !=H_PAGE_REGISTERED )) { +if ((hret !=H_SUCCESS ) && + (hret !=H_PAGE_REGISTERED )) {ehea_h_free_resource (adapter->handle, mr->handle,FORCE_FREE );ehea_error ("register_rpage_mr failed" );
drivers/net/epic100.c +4 -4
@@ -630,8 +630,8 @@ static int mdio_read(struct net_device *dev, int phy_id, int location)barrier ();if ((inl (ioaddr + MIICtrl) &MII_READOP ) ==0 ) {/* Work around read failure bug. */ -if (phy_id ==1 && location <6 - &&inw (ioaddr + MIIData) ==0xffff ) { +if (phy_id ==1 && location <6 && +inw (ioaddr + MIIData) ==0xffff ) {outl (read_cmd, ioaddr + MIICtrl);continue ; }
@@ -1205,8 +1205,8 @@ static int epic_rx(struct net_device *dev, int budget) }/* Check if the packet is long enough to accept without copying to a minimally-sized skbuff. */ -if (pkt_len < rx_copybreak - && (skb =dev_alloc_skb (pkt_len +2 )) !=NULL ) { +if (pkt_len < rx_copybreak && + (skb =dev_alloc_skb (pkt_len +2 )) !=NULL ) {skb_reserve (skb,2 );/* 16 byte align the IP header */ pci_dma_sync_single_for_cpu(ep->pci_dev, ep->rx_ring[entry].bufaddr,
drivers/net/fealnx.c +6 -6
@@ -1629,8 +1629,8 @@ static int netdev_rx(struct net_device *dev)if (debug)printk (KERN_DEBUG " netdev_rx() status was %8.8x.\n" , rx_status); -if ((!((rx_status &RXFSD ) && (rx_status &RXLSD ))) - || (rx_status & ErrorSummary)) { +if ((!((rx_status &RXFSD ) && (rx_status &RXLSD ))) || + (rx_status & ErrorSummary)) {if (rx_status & ErrorSummary) {/* there was a fatal error */ if (debug) printk(KERN_DEBUG
@@ -1655,8 +1655,8 @@ static int netdev_rx(struct net_device *dev) cur = np->cur_rx;while (desno <= np->really_rx_count) { ++desno; -if ((!(cur->status &RXOWN )) - && (cur->status &RXLSD )) +if ((!(cur->status &RXOWN )) && + (cur->status &RXLSD ))break ;/* goto next rx descriptor */ cur = cur->next_desc_logical;
@@ -1786,8 +1786,8 @@ static void __set_rx_mode(struct net_device *dev)if (dev->flags &IFF_PROMISC ) {/* Set promiscuous. */ memset (mc_filter,0xff ,sizeof (mc_filter)); rx_mode =CR_W_PROM |CR_W_AB |CR_W_AM ; - }else if ((dev->mc_count > multicast_filter_limit) - || (dev->flags &IFF_ALLMULTI )) { + }else if ((dev->mc_count > multicast_filter_limit) || + (dev->flags &IFF_ALLMULTI )) {/* Too many to match, or accept all multicasts. */ memset (mc_filter,0xff ,sizeof (mc_filter)); rx_mode =CR_W_AB |CR_W_AM ;
drivers/net/gianfar_sysfs.c +2 -2
@@ -62,8 +62,8 @@ static ssize_t gfar_set_bd_stash(struct device *dev,/* Find out the new setting */ if (!strncmp ("on" , buf, count -1 ) || !strncmp ("1" , buf, count -1 )) new_setting =1 ; -else if (!strncmp ("off" , buf, count -1 ) - || !strncmp ("0" , buf, count -1 )) +else if (!strncmp ("off" , buf, count -1 ) || + !strncmp ("0" , buf, count -1 )) new_setting =0 ;else return count;
drivers/net/hamachi.c +5 -5
@@ -1566,8 +1566,8 @@ static int hamachi_rx(struct net_device *dev)#endif /* Check if the packet is long enough to accept without copying to a minimally-sized skbuff. */ -if (pkt_len < rx_copybreak - && (skb =dev_alloc_skb (pkt_len +2 )) !=NULL ) { +if (pkt_len < rx_copybreak && + (skb =dev_alloc_skb (pkt_len +2 )) !=NULL ) {#ifdef RX_CHECKSUM printk (KERN_ERR "%s: rx_copybreak non-zero " "not good with RX_CHECKSUM\n" , dev->name);
@@ -1722,10 +1722,10 @@ static void hamachi_error(struct net_device *dev, int intr_status)readl (ioaddr +0x370 );readl (ioaddr +0x3F0 ); } -if ((intr_status & ~(LinkChange|StatsMax|NegotiationChange|IntrRxDone|IntrTxDone)) - && hamachi_debug) +if ((intr_status & ~(LinkChange|StatsMax|NegotiationChange|IntrRxDone|IntrTxDone)) && + hamachi_debug)printk (KERN_ERR "%s: Something Wicked happened! %4.4x.\n" , - dev->name, intr_status); + dev->name, intr_status);/* Hmmmmm, it's not clear how to recover from PCI faults. */ if (intr_status & (IntrTxPCIErr | IntrTxPCIFault)) hmp->stats.tx_fifo_errors++;
drivers/net/hamradio/bpqether.c +1 -4
@@ -167,10 +167,7 @@ static inline struct net_device *bpq_get_ax25_dev(struct net_device *dev)static inline int dev_is_ethdev (struct net_device *dev) { -return ( - dev->type ==ARPHRD_ETHER - &&strncmp (dev->name,"dummy" ,5 ) - ); +return (dev->type ==ARPHRD_ETHER &&strncmp (dev->name,"dummy" ,5 )); }/* ------------------------------------------------------------------------ */
drivers/net/hamradio/dmascc.c +4 -4
@@ -331,8 +331,8 @@ static int __init dmascc_init(void)for (i =0 ; i <MAX_NUM_DEVS && io[i]; i++) { j = (io[i] - hw[h].io_region) / hw[h].io_delta; -if (j >=0 && j < hw[h].num_devs - && hw[h].io_region + +if (j >=0 && j < hw[h].num_devs && + hw[h].io_region + j * hw[h].io_delta == io[i]) { base[j] = io[i]; }
@@ -396,8 +396,8 @@ static int __init dmascc_init(void) t_val =inb (t1[i]) + (inb (t1[i]) <<8 );/* Also check whether counter did wrap */ -if (t_val ==0 - || t_val >TMR_0_HZ /HZ *10 ) +if (t_val ==0 || + t_val >TMR_0_HZ /HZ *10 ) counting[i] =0 ; delay[i] = jiffies - start[i]; }
drivers/net/hp-plus.c +2 -2
@@ -187,8 +187,8 @@ static int __init hpp_probe1(struct net_device *dev, int ioaddr)return -EBUSY ;/* Check for the HP+ signature, 50 48 0x 53. */ -if (inw (ioaddr +HP_ID ) !=0x4850 - || (inw (ioaddr +HP_PAGING ) &0xfff0 ) !=0x5300 ) { +if (inw (ioaddr +HP_ID ) !=0x4850 || + (inw (ioaddr +HP_PAGING ) &0xfff0 ) !=0x5300 ) { retval = -ENODEV ; goto out; }
drivers/net/hp100.c +2 -2
@@ -993,8 +993,8 @@ static void hp100_mmuinit(struct net_device *dev)if (lp->mode ==1 ) {/* only needed for Busmaster */ int xmit_stop, recv_stop; -if ((lp->chip ==HP100_CHIPID_RAINIER ) - || (lp->chip ==HP100_CHIPID_SHASTA )) { +if ((lp->chip ==HP100_CHIPID_RAINIER ) || + (lp->chip ==HP100_CHIPID_SHASTA )) {int pdl_stop;/*
drivers/net/ibm_newemac/core.c +12 -12
@@ -1976,27 +1976,27 @@ static int emac_ethtool_set_settings(struct net_device *ndev,if (cmd->autoneg ==AUTONEG_DISABLE ) {switch (cmd->speed) {case SPEED_10 : -if (cmd->duplex ==DUPLEX_HALF - && !(f & SUPPORTED_10baseT_Half)) +if (cmd->duplex ==DUPLEX_HALF && + !(f & SUPPORTED_10baseT_Half))return -EINVAL ; -if (cmd->duplex ==DUPLEX_FULL - && !(f & SUPPORTED_10baseT_Full)) +if (cmd->duplex ==DUPLEX_FULL && + !(f & SUPPORTED_10baseT_Full))return -EINVAL ;break ;case SPEED_100 : -if (cmd->duplex ==DUPLEX_HALF - && !(f & SUPPORTED_100baseT_Half)) +if (cmd->duplex ==DUPLEX_HALF && + !(f & SUPPORTED_100baseT_Half))return -EINVAL ; -if (cmd->duplex ==DUPLEX_FULL - && !(f & SUPPORTED_100baseT_Full)) +if (cmd->duplex ==DUPLEX_FULL && + !(f & SUPPORTED_100baseT_Full))return -EINVAL ;break ;case SPEED_1000 : -if (cmd->duplex ==DUPLEX_HALF - && !(f & SUPPORTED_1000baseT_Half)) +if (cmd->duplex ==DUPLEX_HALF && + !(f & SUPPORTED_1000baseT_Half))return -EINVAL ; -if (cmd->duplex ==DUPLEX_FULL - && !(f & SUPPORTED_1000baseT_Full)) +if (cmd->duplex ==DUPLEX_FULL && + !(f & SUPPORTED_1000baseT_Full))return -EINVAL ;break ;default :
drivers/net/igb/igb_main.c +2 -3
@@ -4974,9 +4974,8 @@ static bool igb_clean_tx_irq(struct igb_q_vector *q_vector) tx_ring->detect_tx_hung = false;if (tx_ring->buffer_info[i].time_stamp &&time_after (jiffies, tx_ring->buffer_info[i].time_stamp + - (adapter->tx_timeout_factor *HZ )) - && !(rd32 (E1000_STATUS ) & -E1000_STATUS_TXOFF )) { + (adapter->tx_timeout_factor *HZ )) && + !(rd32 (E1000_STATUS ) &E1000_STATUS_TXOFF )) {/* detected Tx unit hang */ dev_err(&tx_ring->pdev->dev,
drivers/net/igbvf/netdev.c +2 -2
@@ -827,8 +827,8 @@ static bool igbvf_clean_tx_irq(struct igbvf_ring *tx_ring) adapter->detect_tx_hung = false;if (tx_ring->buffer_info[i].time_stamp &&time_after (jiffies, tx_ring->buffer_info[i].time_stamp + - (adapter->tx_timeout_factor *HZ )) - && !(er32 (STATUS ) &E1000_STATUS_TXOFF )) { + (adapter->tx_timeout_factor *HZ )) && + !(er32 (STATUS ) &E1000_STATUS_TXOFF )) { tx_desc =IGBVF_TX_DESC_ADV (*tx_ring, i);/* detected Tx unit hang */
drivers/net/irda/irda-usb.c +4 -4
@@ -1124,11 +1124,11 @@ static int stir421x_patch_device(struct irda_usb_cb *self)* The actual image starts after the "STMP" keyword * so forward to the firmware header tag */ -for (i =0 ; (fw->data[i] !=STIR421X_PATCH_END_OF_HDR_TAG ) - && (i < fw->size); i++) ; +for (i =0 ; (fw->data[i] !=STIR421X_PATCH_END_OF_HDR_TAG ) && + (i < fw->size); i++) ;/* here we check for the out of buffer case */ -if ((STIR421X_PATCH_END_OF_HDR_TAG == fw->data[i]) - && (i <STIR421X_PATCH_CODE_OFFSET )) { +if ((STIR421X_PATCH_END_OF_HDR_TAG == fw->data[i]) && + (i <STIR421X_PATCH_CODE_OFFSET )) {if (!memcmp (fw->data + i +1 ,STIR421X_PATCH_STMP_TAG ,sizeof (STIR421X_PATCH_STMP_TAG ) -1 )) {
drivers/net/irda/stir4200.c +6 -6
@@ -612,16 +612,16 @@ static int fifo_txwait(struct stir_cb *stir, int space)pr_debug ("fifo status 0x%lx count %lu\n" , status, count);/* is fifo receiving already, or empty */ -if (!(status &FIFOCTL_DIR ) - || (status &FIFOCTL_EMPTY )) +if (!(status &FIFOCTL_DIR ) || + (status &FIFOCTL_EMPTY ))return 0 ;if (signal_pending (current))return -EINTR ;/* shutting down? */ -if (!netif_running (stir->netdev) - || !netif_device_present (stir->netdev)) +if (!netif_running (stir->netdev) || + !netif_device_present (stir->netdev))return -ESHUTDOWN ;/* only waiting for some space */
@@ -776,8 +776,8 @@ static int stir_transmit_thread(void *arg) }/* nothing to send? start receiving */ -if (!stir->receiving - &&irda_device_txqueue_empty (dev)) { +if (!stir->receiving && +irda_device_txqueue_empty (dev)) {/* Wait otherwise chip gets confused. */ if (fifo_txwait (stir,-1 ))break ;
drivers/net/irda/via-ircc.c +8 -8
@@ -1185,8 +1185,8 @@ F01_E */* if frame size,data ptr,or skb ptr are wrong ,the get next * entry. */ -if ((skb ==NULL ) || (skb->data ==NULL ) - || (self->rx_buff.data ==NULL ) || (len <6 )) { +if ((skb ==NULL ) || (skb->data ==NULL ) || + (self->rx_buff.data ==NULL ) || (len <6 )) { self->netdev->stats.rx_dropped++;return TRUE; }
@@ -1284,8 +1284,8 @@ static int RxTimerHandler(struct via_ircc_cb *self, int iobase) self->RetryCount++;if ((self->RetryCount >=1 ) || - ((st_fifo->pending_bytes +2048 ) > self->rx_buff.truesize) - || (st_fifo->len >= (MAX_RX_WINDOW ))) { + ((st_fifo->pending_bytes +2048 ) > self->rx_buff.truesize) || + (st_fifo->len >= (MAX_RX_WINDOW ))) {while (st_fifo->len >0 ) {//upload frame // Put this entry back in fifo if (st_fifo->head >MAX_RX_WINDOW )
@@ -1300,8 +1300,8 @@ static int RxTimerHandler(struct via_ircc_cb *self, int iobase)* if frame size, data ptr, or skb ptr are wrong, * then get next entry. */ -if ((skb ==NULL ) || (skb->data ==NULL ) - || (self->rx_buff.data ==NULL ) || (len <6 )) { +if ((skb ==NULL ) || (skb->data ==NULL ) || + (self->rx_buff.data ==NULL ) || (len <6 )) { self->netdev->stats.rx_dropped++;continue ; }
@@ -1332,8 +1332,8 @@ static int RxTimerHandler(struct via_ircc_cb *self, int iobase)* if frame is receive complete at this routine ,then upload * frame. */ -if ((GetRXStatus (iobase) &0x10 ) - && (RxCurCount (iobase, self) != self->RxLastCount)) { +if ((GetRXStatus (iobase) &0x10 ) && + (RxCurCount (iobase, self) != self->RxLastCount)) {upload_rxdata (self, iobase);if (irda_device_txqueue_empty (self->netdev))via_ircc_dma_receive (self);
drivers/net/irda/vlsi_ir.c +8 -8
@@ -431,8 +431,8 @@ static struct vlsi_ring *vlsi_alloc_ring(struct pci_dev *pdev, struct ring_descrmemset (rd,0 ,sizeof (*rd)); rd->hw = hwmap + i; rd->buf =kmalloc (len,GFP_KERNEL |GFP_DMA ); -if (rd->buf ==NULL - || !(busaddr =pci_map_single (pdev, rd->buf, len, dir))) { +if (rd->buf ==NULL || + !(busaddr =pci_map_single (pdev, rd->buf, len, dir))) {if (rd->buf) {IRDA_ERROR ("%s: failed to create PCI-MAP for %p" , __func__, rd->buf);
@@ -955,8 +955,8 @@ static netdev_tx_t vlsi_hard_start_xmit(struct sk_buff *skb, }for (;;) {do_gettimeofday (&now); -if (now.tv_sec > ready.tv_sec - || (now.tv_sec==ready.tv_sec && now.tv_usec>=ready.tv_usec)) +if (now.tv_sec > ready.tv_sec || + (now.tv_sec==ready.tv_sec && now.tv_usec>=ready.tv_usec))break ;udelay (100 );/* must not sleep here - called under netif_tx_lock! */
@@ -1594,8 +1594,8 @@ static int vlsi_irda_init(struct net_device *ndev)* see include file for details why we need these 2 masks, in this order! */ -if (pci_set_dma_mask (pdev,DMA_MASK_USED_BY_HW ) - ||pci_set_dma_mask (pdev,DMA_MASK_MSTRPAGE )) { +if (pci_set_dma_mask (pdev,DMA_MASK_USED_BY_HW ) || +pci_set_dma_mask (pdev,DMA_MASK_MSTRPAGE )) {IRDA_ERROR ("%s: aborting due to PCI BM-DMA address limitations\n" , __func__);return -1 ; }
@@ -1641,8 +1641,8 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id)IRDA_MESSAGE ("%s: IrDA PCI controller %s detected\n" , drivername,pci_name (pdev)); -if ( !pci_resource_start (pdev,0 ) - || !(pci_resource_flags (pdev,0 ) &IORESOURCE_IO ) ) { +if ( !pci_resource_start (pdev,0 ) || + !(pci_resource_flags (pdev,0 ) &IORESOURCE_IO ) ) {IRDA_ERROR ("%s: bar 0 invalid" , __func__); goto out_disable; }
drivers/net/isa-skeleton.c +3 -3
@@ -214,9 +214,9 @@ static int __init netcard_probe1(struct net_device *dev, int ioaddr)* contains the manufacturer's unique code. That might be a good probe * method. Ideally you would add additional checks. */ -if (inb (ioaddr +0 ) !=SA_ADDR0 - ||inb (ioaddr +1 ) !=SA_ADDR1 - ||inb (ioaddr +2 ) !=SA_ADDR2 ) +if (inb (ioaddr +0 ) !=SA_ADDR0 || +inb (ioaddr +1 ) !=SA_ADDR1 || +inb (ioaddr +2 ) !=SA_ADDR2 ) goto out;if (net_debug && version_printed++ ==0 )
drivers/net/iseries_veth.c +21 -21
96 lines not on this page · raw message
drivers/net/jazzsonic.c +2 -2
@@ -130,8 +130,8 @@ static int __devinit sonic_probe1(struct net_device *dev)printk ("SONIC Silicon Revision = 0x%04x\n" ,silicon_revision); i =0 ; -while (known_revisions[i] !=0xffff - && known_revisions[i] != silicon_revision) +while (known_revisions[i] !=0xffff && + known_revisions[i] != silicon_revision) i++;if (known_revisions[i] ==0xffff ) {
drivers/net/jme.c +6 -6
@@ -1050,8 +1050,8 @@ jme_dynamic_pcc(struct jme_adapter *jme)if ((NET_STAT (jme).rx_bytes - dpi->last_bytes) >PCC_P3_THRESHOLD )jme_attempt_pcc (dpi,PCC_P3 ); -else if ((NET_STAT (jme).rx_packets - dpi->last_pkts) >PCC_P2_THRESHOLD - || dpi->intr_cnt >PCC_INTR_THRESHOLD ) +else if ((NET_STAT (jme).rx_packets - dpi->last_pkts) >PCC_P2_THRESHOLD || + dpi->intr_cnt >PCC_INTR_THRESHOLD )jme_attempt_pcc (dpi,PCC_P2 );else jme_attempt_pcc (dpi,PCC_P1 );
@@ -2199,8 +2199,8 @@ jme_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *ecmd)if (netif_running (netdev))return -EBUSY ; -if (ecmd->use_adaptive_rx_coalesce - &&test_bit (JME_FLAG_POLL , &jme->flags)) { +if (ecmd->use_adaptive_rx_coalesce && +test_bit (JME_FLAG_POLL , &jme->flags)) {clear_bit (JME_FLAG_POLL , &jme->flags); jme->jme_rx = netif_rx; jme->jme_vlan_rx = vlan_hwaccel_rx;
@@ -2209,8 +2209,8 @@ jme_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *ecmd) dpi->cnt =0 ;jme_set_rx_pcc (jme,PCC_P1 );jme_interrupt_mode (jme); - }else if (!(ecmd->use_adaptive_rx_coalesce) - && !(test_bit (JME_FLAG_POLL , &jme->flags))) { + }else if (!(ecmd->use_adaptive_rx_coalesce) && + !(test_bit (JME_FLAG_POLL , &jme->flags))) {set_bit (JME_FLAG_POLL , &jme->flags); jme->jme_rx = netif_receive_skb; jme->jme_vlan_rx = vlan_hwaccel_receive_skb;
drivers/net/lance.c +6 -6
@@ -493,14 +493,14 @@ static int __init lance_probe1(struct net_device *dev, int ioaddr, int irq, intstatic const short ioaddr_table[] = {0x300 ,0x320 ,0x340 ,0x360 };int hp_port = (readl (bios +1 ) &1 ) ?0x499 :0x99 ;/* We can have boards other than the built-in! Verify this is on-board. */ -if ((inb (hp_port) &0xc0 ) ==0x80 - && ioaddr_table[inb (hp_port) &3 ] == ioaddr) +if ((inb (hp_port) &0xc0 ) ==0x80 && + ioaddr_table[inb (hp_port) &3 ] == ioaddr) hp_builtin = hp_port; }iounmap (bios);/* We also recognize the HP Vectra on-board here, but check below. */ - hpJ2405A = (inb (ioaddr) ==0x08 &&inb (ioaddr+1 ) ==0x00 - &&inb (ioaddr+2 ) ==0x09 ); + hpJ2405A = (inb (ioaddr) ==0x08 &&inb (ioaddr+1 ) ==0x00 && +inb (ioaddr+2 ) ==0x09 );/* Reset the LANCE. */ reset_val =inw (ioaddr+LANCE_RESET );/* Reset the LANCE */
@@ -1035,8 +1035,8 @@ static irqreturn_t lance_interrupt(int irq, void *dev_id)spin_lock (&lp->devlock);outw (0x00 , dev->base_addr +LANCE_ADDR ); -while ((csr0 =inw (dev->base_addr +LANCE_DATA )) &0x8600 - && --boguscnt >=0 ) { +while ((csr0 =inw (dev->base_addr +LANCE_DATA )) &0x8600 && + --boguscnt >=0 ) {/* Acknowledge all of the current interrupt sources ASAP. */ outw (csr0 & ~0x004f , dev->base_addr +LANCE_DATA );
drivers/net/lib8390.c +6 -6
@@ -464,8 +464,8 @@ static irqreturn_t __ei_interrupt(int irq, void *dev_id) ei_inb_p(e8390_base + EN0_ISR));/* !!Assumption!! -- we stay in page 0. Don't break this. */ -while ((interrupts =ei_inb_p (e8390_base +EN0_ISR )) !=0 - && ++nr_serviced <MAX_SERVICE ) +while ((interrupts =ei_inb_p (e8390_base +EN0_ISR )) !=0 && + ++nr_serviced <MAX_SERVICE ) {if (!netif_running (dev)) {printk (KERN_WARNING "%s: interrupt from stopped card\n" , dev->name);
@@ -721,10 +721,10 @@ static void ei_receive(struct net_device *dev)/* Check for bogosity warned by 3c503 book: the status byte is never written. This happened a lot during testing! This code should be cleaned up someday. */ -if (rx_frame.next != next_frame - && rx_frame.next != next_frame +1 - && rx_frame.next != next_frame - num_rx_pages - && rx_frame.next != next_frame +1 - num_rx_pages) { +if (rx_frame.next != next_frame && + rx_frame.next != next_frame +1 && + rx_frame.next != next_frame - num_rx_pages && + rx_frame.next != next_frame +1 - num_rx_pages) { ei_local->current_page = rxing_page;ei_outb (ei_local->current_page-1 , e8390_base+EN0_BOUNDARY ); dev->stats.rx_errors++;
drivers/net/ll_temac_main.c +2 -2
@@ -231,8 +231,8 @@ static void temac_set_multicast_list(struct net_device *ndev)int i;mutex_lock (&lp->indirect_mutex); -if (ndev->flags & (IFF_ALLMULTI |IFF_PROMISC ) - || ndev->mc_count >MULTICAST_CAM_TABLE_NUM ) { +if (ndev->flags & (IFF_ALLMULTI |IFF_PROMISC ) || + ndev->mc_count >MULTICAST_CAM_TABLE_NUM ) {/* * We must make the kernel realise we had to move * into promisc mode or we start all out war on
drivers/net/mac89x0.c +2 -2
@@ -222,8 +222,8 @@ struct net_device * __init mac89x0_probe(int unit)int card_present;local_irq_save (flags); - card_present =hwreg_present ((void *) ioaddr+4 ) - &&hwreg_present ((void *) ioaddr +DATA_PORT ); + card_present = (hwreg_present ((void *) ioaddr+4 ) && +hwreg_present ((void *) ioaddr +DATA_PORT ));local_irq_restore (flags);if (!card_present)
drivers/net/mace.c +2 -2
@@ -897,8 +897,8 @@ static irqreturn_t mace_rxdma_intr(int irq, void *dev_id)if (next >=N_RX_RING ) next =0 ; np = mp->rx_cmds + next; -if (next != mp->rx_fill - && (ld_le16 (&np->xfer_status) &ACTIVE ) !=0 ) { +if (next != mp->rx_fill && + (ld_le16 (&np->xfer_status) &ACTIVE ) !=0 ) {printk (KERN_DEBUG "mace: lost a status word\n" ); ++mace_lost_status; }else
drivers/net/myri10ge/myri10ge.c +8 -8
@@ -410,8 +410,8 @@ myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd,* and try to get the completion quickly * (1ms will be enough for those commands) */ for (sleep_total =0 ; - sleep_total <1000 - && response->result ==htonl (MYRI10GE_NO_RESPONSE_RESULT ); + sleep_total <1000 && + response->result ==htonl (MYRI10GE_NO_RESPONSE_RESULT ); sleep_total +=10 ) {udelay (10 );mb ();
@@ -419,8 +419,8 @@ myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd, }else {/* use msleep for most command */ for (sleep_total =0 ; - sleep_total <15 - && response->result ==htonl (MYRI10GE_NO_RESPONSE_RESULT ); + sleep_total <15 && + response->result ==htonl (MYRI10GE_NO_RESPONSE_RESULT ); sleep_total++)msleep (1 ); }
@@ -557,8 +557,8 @@ myri10ge_validate_firmware(struct myri10ge_priv *mgp,sscanf (mgp->fw_version,"%d.%d.%d" , &mgp->fw_ver_major, &mgp->fw_ver_minor, &mgp->fw_ver_tiny); -if (!(mgp->fw_ver_major ==MXGEFW_VERSION_MAJOR - && mgp->fw_ver_minor ==MXGEFW_VERSION_MINOR )) { +if (!(mgp->fw_ver_major ==MXGEFW_VERSION_MAJOR && + mgp->fw_ver_minor ==MXGEFW_VERSION_MINOR )) {dev_err (dev,"Found firmware version %s\n" , mgp->fw_version);dev_err (dev,"Driver needs %d.%d\n" ,MXGEFW_VERSION_MAJOR ,MXGEFW_VERSION_MINOR );
@@ -1412,8 +1412,8 @@ myri10ge_tx_done(struct myri10ge_slice_state *ss, int mcp_index) }/* start the queue if we've stopped it */ -if (netif_tx_queue_stopped (dev_queue) - && tx->req - tx->done < (tx->mask >>1 )) { +if (netif_tx_queue_stopped (dev_queue) && + tx->req - tx->done < (tx->mask >>1 )) { tx->wake_queue++;netif_tx_wake_queue (dev_queue); }
drivers/net/natsemi.c +14 -14
@@ -683,8 +683,8 @@ static ssize_t natsemi_set_dspcfg_workaround(struct device *dev,/* Find out the new setting */ if (!strncmp ("on" , buf, count -1 ) || !strncmp ("1" , buf, count -1 )) new_setting =1 ; -else if (!strncmp ("off" , buf, count -1 ) - || !strncmp ("0" , buf, count -1 )) +else if (!strncmp ("off" , buf, count -1 ) || + !strncmp ("0" , buf, count -1 )) new_setting =0 ;else return count;
@@ -757,8 +757,8 @@ static void __devinit natsemi_init_media (struct net_device *dev) np->autoneg = (tmp &BMCR_ANENABLE )?AUTONEG_ENABLE :AUTONEG_DISABLE ; np->advertising=mdio_read (dev,MII_ADVERTISE ); -if ((np->advertising &ADVERTISE_ALL ) !=ADVERTISE_ALL - &&netif_msg_probe (np)) { +if ((np->advertising &ADVERTISE_ALL ) !=ADVERTISE_ALL && +netif_msg_probe (np)) { printk(KERN_INFO "natsemi %s: Transceiver default autonegotiation %s " "10%s %s duplex.\n", pci_name(np->pci_dev),
@@ -1153,8 +1153,8 @@ static void init_phy_fixup(struct net_device *dev) tmp =mdio_read (dev,MII_BMCR );if (np->autoneg ==AUTONEG_ENABLE ) {/* renegotiate if something changed */ -if ((tmp &BMCR_ANENABLE ) ==0 - || np->advertising !=mdio_read (dev,MII_ADVERTISE )) +if ((tmp &BMCR_ANENABLE ) ==0 || + np->advertising !=mdio_read (dev,MII_ADVERTISE )) {/* turn on autonegotiation and force negotiation */ tmp |= (BMCR_ANENABLE |BMCR_ANRESTART );
@@ -2164,8 +2164,8 @@ static void netdev_tx_done(struct net_device *dev)dev_kfree_skb_irq (np->tx_skbuff[entry]); np->tx_skbuff[entry] =NULL ; } -if (netif_queue_stopped (dev) - && np->cur_tx - np->dirty_tx <TX_QUEUE_LEN -4 ) { +if (netif_queue_stopped (dev) && + np->cur_tx - np->dirty_tx <TX_QUEUE_LEN -4 ) {/* The ring is no longer full, wake queue. */ netif_wake_queue (dev); }
@@ -2343,8 +2343,8 @@ static void netdev_rx(struct net_device *dev, int *work_done, int work_to_do)/* Omit CRC size. */ /* Check if the packet is long enough to accept * without copying to a minimally-sized skbuff. */ -if (pkt_len < rx_copybreak - && (skb =dev_alloc_skb (pkt_len +RX_OFFSET )) !=NULL ) { +if (pkt_len < rx_copybreak && + (skb =dev_alloc_skb (pkt_len +RX_OFFSET )) !=NULL ) {/* 16 byte align the IP header */ skb_reserve (skb,RX_OFFSET ); pci_dma_sync_single_for_cpu(np->pci_dev,
@@ -2390,8 +2390,8 @@ static void netdev_error(struct net_device *dev, int intr_status)spin_lock (&np->lock);if (intr_status & LinkChange) {u16 lpa =mdio_read (dev,MII_LPA ); -if (mdio_read (dev,MII_BMCR ) &BMCR_ANENABLE - &&netif_msg_link (np)) { +if (mdio_read (dev,MII_BMCR ) &BMCR_ANENABLE && +netif_msg_link (np)) { printk(KERN_INFO "%s: Autonegotiation advertising" " %#04x partner %#04x.\n", dev->name,
@@ -2488,8 +2488,8 @@ static void __set_rx_mode(struct net_device *dev)if (dev->flags &IFF_PROMISC ) {/* Set promiscuous. */ rx_mode = RxFilterEnable | AcceptBroadcast | AcceptAllMulticast | AcceptAllPhys | AcceptMyPhys; - }else if ((dev->mc_count > multicast_filter_limit) - || (dev->flags &IFF_ALLMULTI )) { + }else if ((dev->mc_count > multicast_filter_limit) || + (dev->flags &IFF_ALLMULTI )) { rx_mode = RxFilterEnable | AcceptBroadcast | AcceptAllMulticast | AcceptMyPhys; }else {
drivers/net/netxen/netxen_nic_ethtool.c +16 -16
@@ -257,18 +257,18 @@ netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)/* read which mode */ if (adapter->ahw.port_type ==NETXEN_NIC_GBE ) {/* autonegotiation */ -if (adapter->phy_write - && adapter->phy_write (adapter, -NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG , - ecmd->autoneg) !=0 ) +if (adapter->phy_write && + adapter->phy_write (adapter, +NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG , + ecmd->autoneg) !=0 )return -EIO ;else adapter->link_autoneg = ecmd->autoneg; -if (adapter->phy_read - && adapter->phy_read (adapter, -NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS , - &status) !=0 ) +if (adapter->phy_read && + adapter->phy_read (adapter, +NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS , + &status) !=0 )return -EIO ;/* speed */
@@ -288,10 +288,10 @@ netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)netxen_clear_phy_duplex (status);if (ecmd->duplex ==DUPLEX_FULL )netxen_set_phy_duplex (status); -if (adapter->phy_write - && adapter->phy_write (adapter, -NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS , - *((int *)&status)) !=0 ) +if (adapter->phy_write && + adapter->phy_write (adapter, +NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS , + *((int *)&status)) !=0 )return -EIO ;else { adapter->link_speed = ecmd->speed;
@@ -442,10 +442,10 @@ static u32 netxen_nic_test_link(struct net_device *dev)/* read which mode */ if (adapter->ahw.port_type ==NETXEN_NIC_GBE ) { -if (adapter->phy_read - && adapter->phy_read (adapter, -NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS , - &status) !=0 ) +if (adapter->phy_read && + adapter->phy_read (adapter, +NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS , + &status) !=0 )return -EIO ;else { val =netxen_get_phy_link (status);
drivers/net/netxen/netxen_nic_hw.c +8 -8
@@ -1936,10 +1936,10 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter)return ; } -if (adapter->phy_read - && adapter->phy_read (adapter, -NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS , - &status) ==0 ) { +if (adapter->phy_read && + adapter->phy_read (adapter, +NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS , + &status) ==0 ) {if (netxen_get_phy_link (status)) {switch (netxen_get_phy_speed (status)) {case 0 :
@@ -1966,10 +1966,10 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter) adapter->link_duplex =-1 ;break ; } -if (adapter->phy_read - && adapter->phy_read (adapter, -NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG , - &autoneg) !=0 ) +if (adapter->phy_read && + adapter->phy_read (adapter, +NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG , + &autoneg) !=0 ) adapter->link_autoneg = autoneg; }else goto link_down;
drivers/net/ni52.c +2 -2
@@ -477,8 +477,8 @@ static int __init ni52_probe1(struct net_device *dev, int ioaddr)for (i =0 ; i <ETH_ALEN ; i++) dev->dev_addr[i] =inb (dev->base_addr+i); -if (dev->dev_addr[0 ] !=NI52_ADDR0 || dev->dev_addr[1 ] !=NI52_ADDR1 - || dev->dev_addr[2 ] !=NI52_ADDR2 ) { +if (dev->dev_addr[0 ] !=NI52_ADDR0 || dev->dev_addr[1 ] !=NI52_ADDR1 || + dev->dev_addr[2 ] !=NI52_ADDR2 ) { retval = -ENODEV ; goto out; }
drivers/net/ns83820.c +12 -12
@@ -648,8 +648,8 @@ static void phy_intr(struct net_device *ndev)dprintk ("phy_intr: tbisr=%08x, tanar=%08x, tanlpar=%08x\n" , tbisr, tanar, tanlpar); -if ( (fullduplex = (tanlpar &TANAR_FULL_DUP ) - && (tanar &TANAR_FULL_DUP )) ) { +if ( (fullduplex = (tanlpar &TANAR_FULL_DUP ) && + (tanar &TANAR_FULL_DUP )) ) {/* both of us are full duplex */ writel(readl(dev->base + TXCFG)
@@ -661,12 +661,12 @@ static void phy_intr(struct net_device *ndev)writel (readl (dev->base +GPIOR ) |GPIOR_GP1_OUT , dev->base +GPIOR ); - }else if (((tanlpar &TANAR_HALF_DUP ) - && (tanar &TANAR_HALF_DUP )) - || ((tanlpar &TANAR_FULL_DUP ) - && (tanar &TANAR_HALF_DUP )) - || ((tanlpar &TANAR_HALF_DUP ) - && (tanar &TANAR_FULL_DUP ))) { + }else if (((tanlpar &TANAR_HALF_DUP ) && + (tanar &TANAR_HALF_DUP )) || + ((tanlpar &TANAR_FULL_DUP ) && + (tanar &TANAR_HALF_DUP )) || + ((tanlpar &TANAR_HALF_DUP ) && + (tanar &TANAR_FULL_DUP ))) {/* one or both of us are half duplex */ writel((readl(dev->base + TXCFG)
@@ -720,16 +720,16 @@ static void phy_intr(struct net_device *ndev) newlinkstate = (cfg &CFG_LNKSTS ) ?LINK_UP :LINK_DOWN ; -if (newlinkstate &LINK_UP - && dev->linkstate != newlinkstate) { +if (newlinkstate &LINK_UP && + dev->linkstate != newlinkstate) {netif_start_queue (ndev);netif_wake_queue (ndev);printk (KERN_INFO "%s: link now %s mbps, %s duplex and up.\n" , ndev->name, speeds[speed], fullduplex ?"full" :"half" ); - }else if (newlinkstate &LINK_DOWN - && dev->linkstate != newlinkstate) { + }else if (newlinkstate &LINK_DOWN && + dev->linkstate != newlinkstate) {netif_stop_queue (ndev);printk (KERN_INFO "%s: link now down.\n" , ndev->name); }
drivers/net/pci-skeleton.c +6 -6
@@ -1225,8 +1225,8 @@ static void netdrv_timer (unsigned long data) mii_lpa =mdio_read (dev, tp->phys[0 ],MII_LPA );if (!tp->duplex_lock && mii_lpa !=0xffff ) { -int duplex = (mii_lpa &LPA_100FULL ) - || (mii_lpa &0x01C0 ) ==0x0040 ; +int duplex = ((mii_lpa &LPA_100FULL ) || + (mii_lpa &0x01C0 ) ==0x0040 );if (tp->full_duplex != duplex) { tp->full_duplex = duplex; printk (KERN_INFO
@@ -1612,8 +1612,8 @@ static void netdrv_weird_interrupt (struct net_device *dev, (tp->drv_flags & HAS_LNK_CHNG)) {/* Really link-change on new chips. */ int lpar =NETDRV_R16 (NWayLPAR); -int duplex = (lpar &0x0100 ) || (lpar &0x01C0 ) ==0x0040 - || tp->duplex_lock; +int duplex = ((lpar &0x0100 ) || (lpar &0x01C0 ) ==0x0040 || + tp->duplex_lock);if (tp->full_duplex != duplex) { tp->full_duplex = duplex;NETDRV_W8 (Cfg9346, Cfg9346_Unlock);
@@ -1820,8 +1820,8 @@ static void netdrv_set_rx_mode (struct net_device *dev) AcceptBroadcast | AcceptMulticast | AcceptMyPhys | AcceptAllPhys; mc_filter[1 ] = mc_filter[0 ] =0xffffffff ; - }else if ((dev->mc_count > multicast_filter_limit) - || (dev->flags &IFF_ALLMULTI )) { + }else if ((dev->mc_count > multicast_filter_limit) || + (dev->flags &IFF_ALLMULTI )) {/* Too many to filter perfectly -- accept all multicasts. */ rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys; mc_filter[1 ] = mc_filter[0 ] =0xffffffff ;
drivers/net/pcmcia/axnet_cs.c +2 -2
@@ -1232,8 +1232,8 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id) ei_local->irqlock =1 ;/* !!Assumption!! -- we stay in page 0. Don't break this. */ -while ((interrupts =inb_p (e8390_base +EN0_ISR )) !=0 - && ++nr_serviced <MAX_SERVICE ) +while ((interrupts =inb_p (e8390_base +EN0_ISR )) !=0 && + ++nr_serviced <MAX_SERVICE ) {if (!netif_running (dev) || (interrupts ==0xff )) {if (ei_debug >1 )
drivers/net/pcmcia/fmvj18x_cs.c +10 -10
@@ -371,9 +371,9 @@ static int fmvj18x_config(struct pcmcia_device *link)switch (link->manf_id) {case MANFID_TDK : cardtype =TDK ; -if (link->card_id ==PRODID_TDK_GN3410 - || link->card_id ==PRODID_TDK_NP9610 - || link->card_id ==PRODID_TDK_MN3200 ) { +if (link->card_id ==PRODID_TDK_GN3410 || + link->card_id ==PRODID_TDK_NP9610 || + link->card_id ==PRODID_TDK_MN3200 ) {/* MultiFunction Card */ link->conf.ConfigBase =0x800 ; link->conf.ConfigIndex =0x47 ;
@@ -590,11 +590,11 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id)*/ for (i =0 ; i <0x200 ; i++) {if (readb (base+i*2 ) ==0x22 ) { -if (readb (base+(i-1 )*2 ) ==0xff - &&readb (base+(i+5 )*2 ) ==0x04 - &&readb (base+(i+6 )*2 ) ==0x06 - &&readb (base+(i+13 )*2 ) ==0xff ) -break ; +if (readb (base+(i-1 )*2 ) ==0xff && +readb (base+(i+5 )*2 ) ==0x04 && +readb (base+(i+6 )*2 ) ==0x06 && +readb (base+(i+13 )*2 ) ==0xff ) +break ; } }
@@ -1219,8 +1219,8 @@ static void set_rx_mode(struct net_device *dev)if (dev->flags &IFF_PROMISC ) {memset (mc_filter,0xff ,sizeof (mc_filter));outb (3 , ioaddr +RX_MODE );/* Enable promiscuous mode */ - }else if (dev->mc_count >MC_FILTERBREAK - || (dev->flags &IFF_ALLMULTI )) { + }else if (dev->mc_count >MC_FILTERBREAK || + (dev->flags &IFF_ALLMULTI )) {/* Too many to filter perfectly -- accept all multicasts. */ memset (mc_filter,0xff ,sizeof (mc_filter));outb (2 , ioaddr +RX_MODE );/* Use normal mode. */
drivers/net/pcmcia/pcnet_cs.c +2 -2
@@ -601,8 +601,8 @@ static int pcnet_config(struct pcmcia_device *link) dev->if_port =0 ; } -if ((link->conf.ConfigBase ==0x03c0 ) - && (link->manf_id ==0x149 ) && (link->card_id ==0xc1ab )) { +if ((link->conf.ConfigBase ==0x03c0 ) && + (link->manf_id ==0x149 ) && (link->card_id ==0xc1ab )) {printk (KERN_INFO "pcnet_cs: this is an AX88190 card!\n" );printk (KERN_INFO "pcnet_cs: use axnet_cs instead.\n" ); goto failed;
drivers/net/pcmcia/smc91c92_cs.c +4 -4
@@ -526,10 +526,10 @@ static int mhz_mfc_config(struct pcmcia_device *link) mem.CardOffset = link->conf.ConfigBase; i =pcmcia_map_mem_page (link->win, &mem); -if ((i ==0 ) - && (smc->manfid ==MANFID_MEGAHERTZ ) - && (smc->cardid ==PRODID_MEGAHERTZ_EM3288 )) -mhz_3288_power (link); +if ((i ==0 ) && + (smc->manfid ==MANFID_MEGAHERTZ ) && + (smc->cardid ==PRODID_MEGAHERTZ_EM3288 )) +mhz_3288_power (link); free_cfg_mem:kfree (cfg_mem);
drivers/net/pcmcia/xirc2ps_cs.c +8 -8
@@ -421,9 +421,9 @@ PrintRegisters(struct net_device *dev)printk ("\n" ); }for (page=0x40 ; page <=0x5f ; page++) { -if (page ==0x43 || (page >=0x46 && page <=0x4f ) - || (page >=0x51 && page <=0x5e )) -continue ; +if (page ==0x43 || (page >=0x46 && page <=0x4f ) || + (page >=0x51 && page <=0x5e )) +continue ;printk (KDBG_XIRC "Register page %2x: " , page);SelectPage (page);for (i =8 ; i <16 ; i++)
@@ -834,9 +834,9 @@ xirc2ps_config(struct pcmcia_device * link)/* Once I saw two CISTPL_FUNCE_LAN_NODE_ID entries: * the first one with a length of zero the second correct - * so I skip all entries with length 0 */ -if (parse.funce.type ==CISTPL_FUNCE_LAN_NODE_ID - && ((cistpl_lan_node_id_t *)parse.funce.data)->nb) -break ; +if (parse.funce.type ==CISTPL_FUNCE_LAN_NODE_ID && + ((cistpl_lan_node_id_t *)parse.funce.data)->nb) +break ; }if (err) {/* not found: try to get the node-id from tuple 0x89 */ tuple.DesiredTuple =0x89 ;/* data layout looks like tuple 0x22 */
@@ -852,8 +852,8 @@ xirc2ps_config(struct pcmcia_device * link) tuple.DesiredTuple =CISTPL_FUNCE ;for (err =first_tuple (link, &tuple, &parse); !err; err =next_tuple (link, &tuple, &parse)) { -if (parse.funce.type ==0x02 && parse.funce.data[0 ] ==1 - && parse.funce.data[1 ] ==6 && tuple.TupleDataLen ==13 ) { +if (parse.funce.type ==0x02 && parse.funce.data[0 ] ==1 && + parse.funce.data[1 ] ==6 && tuple.TupleDataLen ==13 ) { buf[1 ] =4 ;memcpy (&parse, buf+1 ,8 );break ;
drivers/net/pcnet32.c +10 -10
@@ -1515,8 +1515,8 @@ static void __devinit pcnet32_probe_vlbus(unsigned int *pcnet32_portlist)if (request_region (ioaddr,PCNET32_TOTAL_SIZE ,"pcnet32_probe_vlbus" )) {/* check if there is really a pcnet chip on that ioaddr */ -if ((inb (ioaddr +14 ) ==0x57 ) - && (inb (ioaddr +15 ) ==0x57 )) { +if ((inb (ioaddr +14 ) ==0x57 ) && + (inb (ioaddr +15 ) ==0x57 )) {pcnet32_probe1 (ioaddr,0 ,NULL ); }else {release_region (ioaddr,PCNET32_TOTAL_SIZE );
@@ -1610,8 +1610,8 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) a = &pcnet32_wio; }else {pcnet32_dwio_reset (ioaddr); -if (pcnet32_dwio_read_csr (ioaddr,0 ) ==4 - &&pcnet32_dwio_check (ioaddr)) { +if (pcnet32_dwio_read_csr (ioaddr,0 ) ==4 && +pcnet32_dwio_check (ioaddr)) { a = &pcnet32_dwio; }else {if (pcnet32_debug &NETIF_MSG_PROBE )
@@ -1750,8 +1750,8 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)for (i =0 ; i <6 ; i++) promaddr[i] =inb (ioaddr + i); -if (memcmp (promaddr, dev->dev_addr,6 ) - || !is_valid_ether_addr (dev->dev_addr)) { +if (memcmp (promaddr, dev->dev_addr,6 ) || + !is_valid_ether_addr (dev->dev_addr)) {if (is_valid_ether_addr (promaddr)) {if (pcnet32_debug &NETIF_MSG_PROBE ) {printk (" warning: CSR address invalid,\n" );
@@ -1840,8 +1840,8 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) lp->mii = mii; lp->chip_version = chip_version; lp->msg_enable = pcnet32_debug; -if ((cards_found >=MAX_UNITS ) - || (options[cards_found] >=sizeof (options_mapping))) +if ((cards_found >=MAX_UNITS ) || + (options[cards_found] >=sizeof (options_mapping))) lp->options =PCNET32_PORT_ASEL ;else lp->options = options_mapping[options[cards_found]];
@@ -1866,8 +1866,8 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) goto err_free_ring; }/* detect special T1/E1 WAN card by checking for MAC address */ -if (dev->dev_addr[0 ] ==0x00 && dev->dev_addr[1 ] ==0xe0 - && dev->dev_addr[2 ] ==0x75 ) +if (dev->dev_addr[0 ] ==0x00 && dev->dev_addr[1 ] ==0xe0 && + dev->dev_addr[2 ] ==0x75 ) lp->options =PCNET32_PORT_FD |PCNET32_PORT_GPSI ; lp->init_block->mode =cpu_to_le16 (0x0003 );/* Disable Rx and Tx. */
drivers/net/phy/phy.c +9 -9
@@ -254,12 +254,12 @@ int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd)if (cmd->autoneg ==AUTONEG_ENABLE && cmd->advertising ==0 )return -EINVAL ; -if (cmd->autoneg ==AUTONEG_DISABLE - && ((cmd->speed !=SPEED_1000 - && cmd->speed !=SPEED_100 - && cmd->speed !=SPEED_10 ) - || (cmd->duplex !=DUPLEX_HALF - && cmd->duplex !=DUPLEX_FULL ))) +if (cmd->autoneg ==AUTONEG_DISABLE && + ((cmd->speed !=SPEED_1000 && + cmd->speed !=SPEED_100 && + cmd->speed !=SPEED_10 ) || + (cmd->duplex !=DUPLEX_HALF && + cmd->duplex !=DUPLEX_FULL )))return -EINVAL ; phydev->autoneg = cmd->autoneg;
@@ -353,9 +353,9 @@ int phy_mii_ioctl(struct phy_device *phydev,phy_write (phydev, mii_data->reg_num, val); -if (mii_data->reg_num ==MII_BMCR - && val &BMCR_RESET - && phydev->drv->config_init) { +if (mii_data->reg_num ==MII_BMCR && + val &BMCR_RESET && + phydev->drv->config_init) {phy_scan_fixups (phydev); phydev->drv->config_init (phydev); }
drivers/net/plip.c +6 -7
@@ -372,8 +372,8 @@ plip_bh(struct work_struct *work) nl->is_deferred =0 ; f = connection_state_table[nl->connection]; -if ((r = (*f)(nl->dev, nl, snd, rcv)) !=OK - && (r =plip_bh_timeout_error (nl->dev, nl, snd, rcv, r)) !=OK ) { +if ((r = (*f)(nl->dev, nl, snd, rcv)) !=OK && + (r =plip_bh_timeout_error (nl->dev, nl, snd, rcv, r)) !=OK ) { nl->is_deferred =1 ;schedule_delayed_work (&nl->deferred,1 ); }
@@ -416,9 +416,8 @@ plip_bh_timeout_error(struct net_device *dev, struct net_local *nl,if (error !=ERROR ) {/* Timeout */ nl->timeout_count++; -if ((error ==HS_TIMEOUT - && nl->timeout_count <=10 ) - || nl->timeout_count <=3 ) { +if ((error ==HS_TIMEOUT && nl->timeout_count <=10 ) || + nl->timeout_count <=3 ) {spin_unlock_irq (&nl->lock);/* Try again later */ return TIMEOUT ;
@@ -624,8 +623,8 @@ plip_receive_packet(struct net_device *dev, struct net_local *nl,if (plip_receive (nibble_timeout, dev, &rcv->nibble, &rcv->length.b.msb))return TIMEOUT ; -if (rcv->length.h > dev->mtu + dev->hard_header_len - || rcv->length.h <8 ) { +if (rcv->length.h > dev->mtu + dev->hard_header_len || + rcv->length.h <8 ) {printk (KERN_WARNING "%s: bogus packet size %d.\n" , dev->name, rcv->length.h);return ERROR ; }
drivers/net/ppp_async.c +6 -6
@@ -558,8 +558,8 @@ ppp_async_encode(struct asyncppp *ap)* Start of a new packet - insert the leading FLAG * character if necessary. */ -if (islcp || flag_time ==0 - ||time_after_eq (jiffies, ap->last_xmit + flag_time)) +if (islcp || flag_time ==0 || +time_after_eq (jiffies, ap->last_xmit + flag_time)) *buf++ =PPP_FLAG ; ap->last_xmit = jiffies; fcs =PPP_INITFCS ;
@@ -696,8 +696,8 @@ ppp_async_push(struct asyncppp *ap)*/ clear_bit (XMIT_BUSY , &ap->xmit_flags);/* any more work to do? if not, exit the loop */ -if (!(test_bit (XMIT_WAKEUP , &ap->xmit_flags) - || (!tty_stuffed && ap->tpkt))) +if (!(test_bit (XMIT_WAKEUP , &ap->xmit_flags) || + (!tty_stuffed && ap->tpkt)))break ;/* more work to do, see if we can do it now */ if (test_and_set_bit (XMIT_BUSY , &ap->xmit_flags))
@@ -754,8 +754,8 @@ scan_ordinary(struct asyncppp *ap, const unsigned char *buf, int count)for (i =0 ; i < count; ++i) { c = buf[i]; -if (c ==PPP_ESCAPE || c ==PPP_FLAG - || (c <0x20 && (ap->raccm & (1 << c)) !=0 )) +if (c ==PPP_ESCAPE || c ==PPP_FLAG || + (c <0x20 && (ap->raccm & (1 << c)) !=0 ))break ; }return i;
drivers/net/ppp_deflate.c +22 -22
68 lines not on this page · raw message
drivers/net/ppp_generic.c +33 -33
146 lines not on this page · raw message
drivers/net/ppp_mppe.c +4 -4
@@ -195,8 +195,8 @@ static void *mppe_alloc(unsigned char *options, int optlen)struct ppp_mppe_state *state;unsigned int digestsize; -if (optlen !=CILEN_MPPE +sizeof (state->master_key) - || options[0 ] !=CI_MPPE || options[1 ] !=CILEN_MPPE ) +if (optlen !=CILEN_MPPE +sizeof (state->master_key) || + options[0 ] !=CI_MPPE || options[1 ] !=CILEN_MPPE ) goto out; state =kzalloc (sizeof (*state),GFP_KERNEL );
@@ -276,8 +276,8 @@ mppe_init(void *arg, unsigned char *options, int optlen, int unit, int debug,struct ppp_mppe_state *state = (struct ppp_mppe_state *) arg;unsigned char mppe_opts; -if (optlen !=CILEN_MPPE - || options[0 ] !=CI_MPPE || options[1 ] !=CILEN_MPPE ) +if (optlen !=CILEN_MPPE || + options[0 ] !=CI_MPPE || options[1 ] !=CILEN_MPPE )return 0 ;MPPE_CI_TO_OPTS (&options[2 ], mppe_opts);
drivers/net/ppp_synctty.c +2 -2
@@ -662,8 +662,8 @@ ppp_sync_push(struct syncppp *ap) }/* haven't made any progress */ spin_unlock_bh (&ap->xmit_lock); -if (!(test_bit (XMIT_WAKEUP , &ap->xmit_flags) - || (!tty_stuffed && ap->tpkt))) +if (!(test_bit (XMIT_WAKEUP , &ap->xmit_flags) || + (!tty_stuffed && ap->tpkt)))break ;if (!spin_trylock_bh (&ap->xmit_lock))break ;
drivers/net/pppoe.c +2 -2
@@ -323,8 +323,8 @@ static void pppoe_flush_dev(struct net_device *dev)write_unlock_bh (&pn->hash_lock);lock_sock (sk); -if (po->pppoe_dev == dev - && sk->sk_state & (PPPOX_CONNECTED |PPPOX_BOUND )) { +if (po->pppoe_dev == dev && + sk->sk_state & (PPPOX_CONNECTED |PPPOX_BOUND )) {pppox_unbind_sock (sk); sk->sk_state =PPPOX_ZOMBIE ; sk->sk_state_change (sk);
drivers/net/qla3xxx.c +4 -4
@@ -1969,8 +1969,8 @@ static void ql_update_lrg_bufq_prod_index(struct ql3_adapter *qdev)struct ql_rcv_buf_cb *lrg_buf_cb;struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers; -if ((qdev->lrg_buf_free_count >=8 ) - && (qdev->lrg_buf_release_cnt >=16 )) { +if ((qdev->lrg_buf_free_count >=8 ) && + (qdev->lrg_buf_release_cnt >=16 )) {if (qdev->lrg_buf_skb_check)if (!ql_populate_free_queue (qdev))
@@ -1978,8 +1978,8 @@ static void ql_update_lrg_bufq_prod_index(struct ql3_adapter *qdev) lrg_buf_q_ele = qdev->lrg_buf_next_free; -while ((qdev->lrg_buf_release_cnt >=16 ) - && (qdev->lrg_buf_free_count >=8 )) { +while ((qdev->lrg_buf_release_cnt >=16 ) && + (qdev->lrg_buf_free_count >=8 )) {for (i =0 ; i <8 ; i++) { lrg_buf_cb =
drivers/net/qlge/qlge_main.c +2 -2
@@ -2347,8 +2347,8 @@ static int ql_alloc_tx_resources(struct ql_adapter *qdev,pci_alloc_consistent (qdev->pdev, tx_ring->wq_size, &tx_ring->wq_base_dma); -if ((tx_ring->wq_base ==NULL ) - || tx_ring->wq_base_dma &WQ_ADDR_ALIGN ) { +if ((tx_ring->wq_base ==NULL ) || + tx_ring->wq_base_dma &WQ_ADDR_ALIGN ) {QPRINTK (qdev,IFUP ,ERR ,"tx_ring alloc failed.\n" );return -ENOMEM ; }
drivers/net/r6040.c +1 -2
@@ -958,8 +958,7 @@ static void r6040_multicast_list(struct net_device *dev) }/* Too many multicast addresses * accept all traffic */ -else if ((dev->mc_count >MCAST_MAX ) - || (dev->flags &IFF_ALLMULTI )) +else if ((dev->mc_count >MCAST_MAX ) || (dev->flags &IFF_ALLMULTI )) reg |=0x0020 ;iowrite16 (reg, ioaddr);
drivers/net/r8169.c +2 -2
@@ -4763,8 +4763,8 @@ static void rtl_set_rx_mode(struct net_device *dev) AcceptBroadcast | AcceptMulticast | AcceptMyPhys | AcceptAllPhys; mc_filter[1 ] = mc_filter[0 ] =0xffffffff ; - }else if ((dev->mc_count > multicast_filter_limit) - || (dev->flags &IFF_ALLMULTI )) { + }else if ((dev->mc_count > multicast_filter_limit) || + (dev->flags &IFF_ALLMULTI )) {/* Too many to filter perfectly -- accept all multicasts. */ rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys; mc_filter[1 ] = mc_filter[0 ] =0xffffffff ;
drivers/net/s6gmac.c +3 -3
@@ -373,9 +373,9 @@ struct s6gmac {static void s6gmac_rx_fillfifo (struct s6gmac *pd) {struct sk_buff *skb; -while ((((u8)(pd->rx_skb_i - pd->rx_skb_o)) <S6_NUM_RX_SKB ) - && (!s6dmac_fifo_full (pd->rx_dma, pd->rx_chan)) - && (skb =dev_alloc_skb (S6_MAX_FRLEN +2 ))) { +while ((((u8)(pd->rx_skb_i - pd->rx_skb_o)) <S6_NUM_RX_SKB ) && + (!s6dmac_fifo_full (pd->rx_dma, pd->rx_chan)) && + (skb =dev_alloc_skb (S6_MAX_FRLEN +2 ))) { pd->rx_skb[(pd->rx_skb_i++) %S6_NUM_RX_SKB ] = skb;s6dmac_put_fifo_cache (pd->rx_dma, pd->rx_chan, pd->io, (u32 )skb->data,S6_MAX_FRLEN );
drivers/net/sc92031.c +7 -7
@@ -428,9 +428,9 @@ static void _sc92031_set_mar(struct net_device *dev)void __iomem *port_base = priv->port_base;u32 mar0 =0 , mar1 =0 ; -if ((dev->flags &IFF_PROMISC ) - || dev->mc_count > multicast_filter_limit - || (dev->flags &IFF_ALLMULTI )) +if ((dev->flags &IFF_PROMISC ) || + dev->mc_count > multicast_filter_limit || + (dev->flags &IFF_ALLMULTI )) mar0 = mar1 =0xffffffff ;else if (dev->flags &IFF_MULTICAST ) {struct dev_mc_list *mc_list;
@@ -777,10 +777,10 @@ static void _sc92031_rx_tasklet(struct net_device *dev) rx_ring_offset = (rx_ring_offset +4 ) %RX_BUF_LEN ; -if (unlikely (rx_status ==0 - || rx_size > (MAX_ETH_FRAME_SIZE +4 ) - || rx_size <16 - || !(rx_status & RxStatesOK))) { +if (unlikely (rx_status ==0 || + rx_size > (MAX_ETH_FRAME_SIZE +4 ) || + rx_size <16 || + !(rx_status & RxStatesOK))) {_sc92031_rx_tasklet_error (dev, rx_status, rx_size);break ; }
drivers/net/skge.c +12 -11
@@ -238,8 +238,8 @@ static int skge_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)struct skge_port *skge =netdev_priv (dev);struct skge_hw *hw = skge->hw; -if ((wol->wolopts & ~wol_supported (hw)) - || !device_can_wakeup (&hw->pdev->dev)) +if ((wol->wolopts & ~wol_supported (hw)) || + !device_can_wakeup (&hw->pdev->dev))return -EOPNOTSUPP ; skge->wol = wol->wolopts;
@@ -576,9 +576,10 @@ static void skge_get_pauseparam(struct net_device *dev, {struct skge_port *skge =netdev_priv (dev); - ecmd->rx_pause = (skge->flow_control ==FLOW_MODE_SYMMETRIC ) - || (skge->flow_control ==FLOW_MODE_SYM_OR_REM ); - ecmd->tx_pause = ecmd->rx_pause || (skge->flow_control ==FLOW_MODE_LOC_SEND ); + ecmd->rx_pause = ((skge->flow_control ==FLOW_MODE_SYMMETRIC ) || + (skge->flow_control ==FLOW_MODE_SYM_OR_REM )); + ecmd->tx_pause = (ecmd->rx_pause || + (skge->flow_control ==FLOW_MODE_LOC_SEND )); ecmd->autoneg = ecmd->rx_pause || ecmd->tx_pause; }
@@ -2779,8 +2780,8 @@ static netdev_tx_t skge_xmit_frame(struct sk_buff *skb,/* This seems backwards, but it is what the sk98lin * does. Looks like hardware is wrong? */ -if (ipip_hdr (skb)->protocol ==IPPROTO_UDP - && hw->chip_rev ==0 && hw->chip_id ==CHIP_ID_YUKON ) +if (ipip_hdr (skb)->protocol ==IPPROTO_UDP && + hw->chip_rev ==0 && hw->chip_id ==CHIP_ID_YUKON ) control =BMU_TCP_CHECK ;else control =BMU_UDP_CHECK ;
@@ -2948,8 +2949,8 @@ static void genesis_set_multicast(struct net_device *dev)else {memset (filter,0 ,sizeof (filter)); -if (skge->flow_status ==FLOW_STAT_REM_SEND - || skge->flow_status ==FLOW_STAT_SYMMETRIC ) +if (skge->flow_status ==FLOW_STAT_REM_SEND || + skge->flow_status ==FLOW_STAT_SYMMETRIC )genesis_add_filter (filter, pause_mc_addr);for (i =0 ; list && i < count; i++, list = list->next)
@@ -2972,8 +2973,8 @@ static void yukon_set_multicast(struct net_device *dev)struct skge_hw *hw = skge->hw;int port = skge->port;struct dev_mc_list *list = dev->mc_list; -int rx_pause = (skge->flow_status ==FLOW_STAT_REM_SEND - || skge->flow_status ==FLOW_STAT_SYMMETRIC ); +int rx_pause = (skge->flow_status ==FLOW_STAT_REM_SEND || + skge->flow_status ==FLOW_STAT_SYMMETRIC );u16 reg;u8 filter[8 ];
drivers/net/sky2.c +16 -16
@@ -374,8 +374,8 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port) ctrl |=PHY_M_PC_MDI_XMODE (PHY_M_PC_ENA_AUTO );/* downshift on PHY 88E1112 and 88E1149 is changed */ -if ( (sky2->flags &SKY2_FLAG_AUTO_SPEED ) - && (hw->flags &SKY2_HW_NEWER_PHY )) { +if ( (sky2->flags &SKY2_FLAG_AUTO_SPEED ) && + (hw->flags &SKY2_HW_NEWER_PHY )) {/* set downshift counter to 3x and enable downshift */ ctrl &= ~PHY_M_PC_DSC_MSK ; ctrl |=PHY_M_PC_DSC (2 ) |PHY_M_PC_DOWN_S_ENA ;
@@ -619,8 +619,8 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)/* no effect on Yukon-XL */ gm_phy_write (hw, port,PHY_MARV_LED_CTRL , ledctrl); -if ( !(sky2->flags &SKY2_FLAG_AUTO_SPEED ) - || sky2->speed ==SPEED_100 ) { +if (!(sky2->flags &SKY2_FLAG_AUTO_SPEED ) || + sky2->speed ==SPEED_100 ) {/* turn on 100 Mbps LED (LED_LINK100) */ ledover |=PHY_M_LED_MO_100 (MO_LED_ON ); }
@@ -937,8 +937,8 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)/* On chips without ram buffer, pause is controled by MAC level */ if (!(hw->flags &SKY2_HW_RAM_BUFFER )) {/* Pause threshold is scaled by 8 in bytes */ -if (hw->chip_id ==CHIP_ID_YUKON_FE_P - && hw->chip_rev ==CHIP_REV_YU_FE2_A0 ) +if (hw->chip_id ==CHIP_ID_YUKON_FE_P && + hw->chip_rev ==CHIP_REV_YU_FE2_A0 ) reg =1568 /8 ;else reg =1024 /8 ;
@@ -1353,8 +1353,8 @@ static int sky2_rx_start(struct sky2_port *sky2)/* These chips have no ram buffer? * MAC Rx RAM Read is controlled by hardware */ if (hw->chip_id ==CHIP_ID_YUKON_EC_U && - (hw->chip_rev ==CHIP_REV_YU_EC_U_A1 - || hw->chip_rev ==CHIP_REV_YU_EC_U_B0 )) + (hw->chip_rev ==CHIP_REV_YU_EC_U_A1 || + hw->chip_rev ==CHIP_REV_YU_EC_U_B0 ))sky2_write32 (hw,Q_ADDR (rxq,Q_TEST ),F_M_RX_RAM_DIS );sky2_prefetch_init (hw, rxq, sky2->rx_le_map,RX_LE_SIZE -1 );
@@ -1560,8 +1560,8 @@ static int sky2_up(struct net_device *dev)sky2_write32 (hw,Q_ADDR (txqaddr[port],Q_TEST ),F_TX_CHK_AUTO_OFF );/* Set almost empty threshold */ -if (hw->chip_id ==CHIP_ID_YUKON_EC_U - && hw->chip_rev ==CHIP_REV_YU_EC_U_A0 ) +if (hw->chip_id ==CHIP_ID_YUKON_EC_U && + hw->chip_rev ==CHIP_REV_YU_EC_U_A0 )sky2_write16 (hw,Q_ADDR (txqaddr[port],Q_AL ),ECU_TXFF_LEV ); sky2_prefetch_init(hw, txqaddr[port], sky2->tx_le_map,
@@ -1907,8 +1907,8 @@ static int sky2_down(struct net_device *dev)sky2_write8 (hw,SK_REG (port,GPHY_CTRL ),GPC_RST_SET );/* Workaround shared GMAC reset */ -if (!(hw->chip_id ==CHIP_ID_YUKON_XL && hw->chip_rev ==0 - && port ==0 && hw->dev[1 ] &&netif_running (hw->dev[1 ]))) +if (!(hw->chip_id ==CHIP_ID_YUKON_XL && hw->chip_rev ==0 && + port ==0 && hw->dev[1 ] &&netif_running (hw->dev[1 ])))sky2_write8 (hw,SK_REG (port,GMAC_CTRL ),GMC_RST_SET );sky2_write8 (hw,SK_REG (port,RX_GMF_CTRL_T ),GMF_RST_SET );
@@ -2085,8 +2085,8 @@ static int sky2_autoneg_done(struct sky2_port *sky2, u16 aux) sky2->flow_status =FC_TX ; } -if (sky2->duplex ==DUPLEX_HALF && sky2->speed <SPEED_1000 - && !(hw->chip_id ==CHIP_ID_YUKON_EC_U || hw->chip_id ==CHIP_ID_YUKON_EX )) +if (sky2->duplex ==DUPLEX_HALF && sky2->speed <SPEED_1000 && + !(hw->chip_id ==CHIP_ID_YUKON_EC_U || hw->chip_id ==CHIP_ID_YUKON_EX )) sky2->flow_status =FC_NONE ;if (sky2->flow_status &FC_TX )
@@ -3244,8 +3244,8 @@ static int sky2_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)struct sky2_port *sky2 =netdev_priv (dev);struct sky2_hw *hw = sky2->hw; -if ((wol->wolopts & ~sky2_wol_supported (sky2->hw)) - || !device_can_wakeup (&hw->pdev->dev)) +if ((wol->wolopts & ~sky2_wol_supported (sky2->hw)) || + !device_can_wakeup (&hw->pdev->dev))return -EOPNOTSUPP ; sky2->wol = wol->wolopts;
drivers/net/slip.c +4 -4
@@ -956,8 +956,8 @@ static void slip_unesc(struct slip *sl, unsigned char s)clear_bit (SLF_KEEPTEST , &sl->flags);#endif -if (!test_and_clear_bit (SLF_ERROR , &sl->flags) - && (sl->rcount >2 )) +if (!test_and_clear_bit (SLF_ERROR , &sl->flags) && + (sl->rcount >2 ))sl_bump (sl);clear_bit (SLF_ESCAPE , &sl->flags); sl->rcount =0 ;
@@ -1039,8 +1039,8 @@ static void slip_unesc6(struct slip *sl, unsigned char s)clear_bit (SLF_KEEPTEST , &sl->flags);#endif -if (!test_and_clear_bit (SLF_ERROR , &sl->flags) - && (sl->rcount >2 )) +if (!test_and_clear_bit (SLF_ERROR , &sl->flags) && + (sl->rcount >2 ))sl_bump (sl); sl->rcount =0 ; sl->xbits =0 ;
drivers/net/smc-mca.c +3 -3
@@ -268,9 +268,9 @@ static int __init ultramca_probe(struct device *gen_dev) } } -if (!tirq || !tbase - || (irq && irq != tirq) - || (base_addr && tbase != base_addr)) +if (!tirq || !tbase || + (irq && irq != tirq) || + (base_addr && tbase != base_addr))/* FIXME: we're trying to force the ordering of the * devices here, there should be a way of getting this * to happen */
drivers/net/smc91x.h +5 -5
@@ -158,8 +158,8 @@ static inline void SMC_outw(u16 val, void __iomem *ioaddr, int reg)#define SMC_outsb (a, r, p, l) writesb((a) + (r), p, (l))#define SMC_IRQ_FLAGS (-1)/* from resource */ -#elif defined(CONFIG_MACH_LOGICPD_PXA270 ) \ - || defined(CONFIG_MACH_NOMADIK_8815NHK ) +#elif defined(CONFIG_MACH_LOGICPD_PXA270 ) || \ + defined(CONFIG_MACH_NOMADIK_8815NHK )#define SMC_CAN_USE_8BIT 0#define SMC_CAN_USE_16BIT 1
@@ -258,9 +258,9 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg)#define RPC_LSA_DEFAULT RPC_LED_TX_RX#define RPC_LSB_DEFAULT RPC_LED_100_10 -#elif defined(CONFIG_MACH_LPD79520 ) \ - || defined(CONFIG_MACH_LPD7A400 ) \ - || defined(CONFIG_MACH_LPD7A404 ) +#elif defined(CONFIG_MACH_LPD79520 ) || \ + defined(CONFIG_MACH_LPD7A400 ) || \ + defined(CONFIG_MACH_LPD7A404 )/* The LPD7X_IOBARRIER is necessary to overcome a mismatch between the * way that the CPU handles chip selects and the way that the SMC chip
drivers/net/smsc911x.c +2 -2
@@ -748,8 +748,8 @@ static void smsc911x_phy_adjust_link(struct net_device *dev)* usage is 10/100 indicator */ pdata->gpio_setting =smsc911x_reg_read (pdata,GPIO_CFG ); -if ((pdata->gpio_setting &GPIO_CFG_LED1_EN_ ) - && (!pdata->using_extphy)) { +if ((pdata->gpio_setting &GPIO_CFG_LED1_EN_ ) && + (!pdata->using_extphy)) {/* Force 10/100 LED off, after saving * orginal GPIO configuration */ pdata->gpio_orig_setting = pdata->gpio_setting;
drivers/net/starfire.c +4 -4
@@ -1482,8 +1482,8 @@ static int __netdev_rx(struct net_device *dev, int *quota)printk (KERN_DEBUG " netdev_rx() normal Rx pkt length %d, quota %d.\n" , pkt_len, *quota);/* Check if the packet is long enough to accept without copying to a minimally-sized skbuff. */ -if (pkt_len < rx_copybreak - && (skb =dev_alloc_skb (pkt_len +2 )) !=NULL ) { +if (pkt_len < rx_copybreak && + (skb =dev_alloc_skb (pkt_len +2 )) !=NULL ) {skb_reserve (skb,2 );/* 16 byte align the IP header */ pci_dma_sync_single_for_cpu(np->pci_dev, np->rx_info[entry].mapping,
@@ -1793,8 +1793,8 @@ static void set_rx_mode(struct net_device *dev)if (dev->flags &IFF_PROMISC ) {/* Set promiscuous. */ rx_mode |= AcceptAll; - }else if ((dev->mc_count > multicast_filter_limit) - || (dev->flags &IFF_ALLMULTI )) { + }else if ((dev->mc_count > multicast_filter_limit) || + (dev->flags &IFF_ALLMULTI )) {/* Too many to match, or accept all multicasts. */ rx_mode |= AcceptBroadcast|AcceptAllMulticast|PerfectFilter; }else if (dev->mc_count <=14 ) {
drivers/net/stmmac/stmmac_main.c +1 -2
@@ -922,8 +922,7 @@ static void stmmac_dma_interrupt(struct net_device *dev)DBG (intr,INFO ,"CSR5[15] DMA ABNORMAL IRQ: " );if (unlikely (intr_status &DMA_STATUS_UNF )) {DBG (intr,INFO ,"transmit underflow\n" ); -if (unlikely (tc !=SF_DMA_MODE ) - && (tc <=256 )) { +if (unlikely (tc !=SF_DMA_MODE ) && (tc <=256 )) {/* Try to bump up the threshold */ tc +=64 ; priv->mac_type->ops->dma_mode(ioaddr, tc,
drivers/net/sundance.c +8 -8
@@ -603,8 +603,8 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev, strcmp (media[card_idx], "4") == 0) { np->speed =100 ; np->mii_if.full_duplex =1 ; - } else if (strcmp (media[card_idx], "100mbps_hd") == 0 - || strcmp (media[card_idx], "3") == 0) { + } else if (strcmp (media[card_idx], "100mbps_hd") == 0 || + strcmp (media[card_idx], "3") == 0) { np->speed = 100; np->mii_if.full_duplex = 0; } else if (strcmp (media[card_idx], "10mbps_fd") == 0 ||
@@ -1079,8 +1079,8 @@ start_tx (struct sk_buff *skb, struct net_device *dev)tasklet_schedule (&np->tx_tasklet);/* On some architectures: explicitly flush cache lines here. */ -if (np->cur_tx - np->dirty_tx <TX_QUEUE_LEN -1 - && !netif_queue_stopped (dev)) { +if (np->cur_tx - np->dirty_tx <TX_QUEUE_LEN -1 && + !netif_queue_stopped (dev)) {/* do nothing */ }else {netif_stop_queue (dev);
@@ -1336,8 +1336,8 @@ static void rx_poll(unsigned long data)#endif /* Check if the packet is long enough to accept without copying to a minimally-sized skbuff. */ -if (pkt_len < rx_copybreak - && (skb =dev_alloc_skb (pkt_len +2 )) !=NULL ) { +if (pkt_len < rx_copybreak && + (skb =dev_alloc_skb (pkt_len +2 )) !=NULL ) {skb_reserve (skb,2 );/* 16 byte align the IP header */ pci_dma_sync_single_for_cpu(np->pci_dev, le32_to_cpu(desc->frag[0].addr),
@@ -1517,8 +1517,8 @@ static void set_rx_mode(struct net_device *dev)if (dev->flags &IFF_PROMISC ) {/* Set promiscuous. */ memset (mc_filter,0xff ,sizeof (mc_filter)); rx_mode = AcceptBroadcast | AcceptMulticast | AcceptAll | AcceptMyPhys; - }else if ((dev->mc_count > multicast_filter_limit) - || (dev->flags &IFF_ALLMULTI )) { + }else if ((dev->mc_count > multicast_filter_limit) || + (dev->flags &IFF_ALLMULTI )) {/* Too many to match, or accept all multicasts. */ memset (mc_filter,0xff ,sizeof (mc_filter)); rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys;
drivers/net/sungem.h +2 -2
@@ -1031,8 +1031,8 @@ struct gem {#endif }; -#define found_mii_phy (gp) ((gp->phy_type == phy_mii_mdio0 || gp->phy_type == phy_mii_mdio1) \ - && gp->phy_mii.def && gp->phy_mii.def->ops) +#define found_mii_phy (gp) ((gp->phy_type == phy_mii_mdio0 || gp->phy_type == phy_mii_mdio1) && \ + gp->phy_mii.def && gp->phy_mii.def->ops)#define ALIGNED_RX_SKB_ADDR (addr) \ ((((unsigned long)(addr) + (64UL - 1UL)) & ~(64UL - 1UL)) - (unsigned long)(addr))
drivers/net/sunhme.c +3 -3
@@ -3056,9 +3056,9 @@ static int __devinit happy_meal_pci_probe(struct pci_dev *pdev,int len;if (qfe_slot !=-1 && - (addr =of_get_property (dp, -"local-mac-address" , &len)) !=NULL - && len ==6 ) { + (addr =of_get_property (dp,"local-mac-address" , &len)) + !=NULL && + len ==6 ) {memcpy (dev->dev_addr, addr,6 ); }else {memcpy (dev->dev_addr, idprom->id_ethaddr,6 );
drivers/net/tehuti.c +7 -7
@@ -1784,9 +1784,9 @@ static void bdx_tx_cleanup(struct bdx_priv *priv) }#endif -if (unlikely (netif_queue_stopped (priv->ndev) - &&netif_carrier_ok (priv->ndev) - && (priv->tx_level >=BDX_MIN_TX_LEVEL ))) { +if (unlikely (netif_queue_stopped (priv->ndev) && +netif_carrier_ok (priv->ndev) && + (priv->tx_level >=BDX_MIN_TX_LEVEL ))) {DBG ("%s: %s: TX Q WAKE level %d\n" ,BDX_DRV_NAME , priv->ndev->name, priv->tx_level);netif_wake_queue (priv->ndev);
@@ -2273,8 +2273,8 @@ bdx_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *ecoal) (((tx_max_coal *BDX_TXF_DESC_SZ ) +PCK_TH_MULT -1 ) /PCK_TH_MULT ); -if ((rx_coal >0x7FFF ) || (tx_coal >0x7FFF ) - || (rx_max_coal >0xF ) || (tx_max_coal >0xF )) +if ((rx_coal >0x7FFF ) || (tx_coal >0x7FFF ) || + (rx_max_coal >0xF ) || (tx_max_coal >0xF ))return -EINVAL ; rdintcm = INT_REG_VAL(rx_coal, GET_INT_COAL_RC(priv->rdintcm),
@@ -2347,8 +2347,8 @@ bdx_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring) tx_size =3 ;/*Is there anything to do? */ -if ((rx_size == priv->rxf_size) - && (tx_size == priv->txd_size)) +if ((rx_size == priv->rxf_size) && + (tx_size == priv->txd_size))return 0 ; priv->rxf_size = rx_size;
drivers/net/tg3.c +6 -7
@@ -4621,13 +4621,12 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) len = ((desc->idx_len &RXD_LEN_MASK ) >>RXD_LEN_SHIFT ) -ETH_FCS_LEN ; -if (len >RX_COPY_THRESHOLD - && tp->rx_offset ==NET_IP_ALIGN -/* rx_offset will likely not equal NET_IP_ALIGN -* if this is a 5701 card running in PCI-X mode -* [see tg3_get_invariants()] -*/ - ) { +if (len >RX_COPY_THRESHOLD && + tp->rx_offset ==NET_IP_ALIGN ) { +/* rx_offset will likely not equal NET_IP_ALIGN +* if this is a 5701 card running in PCI-X mode +* [see tg3_get_invariants()] +*/ int skb_size; skb_size = tg3_alloc_rx_skb(tp, tpr, opaque_key,
drivers/net/tlan.c +2 -2
@@ -1755,8 +1755,8 @@ static u32 TLan_HandleStatusCheck( struct net_device *dev, u16 host_int ) ! ( tlphy_ctl & TLAN_TC_SWAPOL ) ) { tlphy_ctl |=TLAN_TC_SWAPOL ;TLan_MiiWriteReg ( dev, phy,TLAN_TLPHY_CTL , tlphy_ctl); - } else if ( ( tlphy_sts & TLAN_TS_POLOK ) - && ( tlphy_ctl & TLAN_TC_SWAPOL ) ) { + } else if ( ( tlphy_sts & TLAN_TS_POLOK ) && + ( tlphy_ctl & TLAN_TC_SWAPOL ) ) { tlphy_ctl &= ~TLAN_TC_SWAPOL ;TLan_MiiWriteReg ( dev, phy,TLAN_TLPHY_CTL , tlphy_ctl); }
drivers/net/tokenring/lanstreamer.c +4 -4
@@ -712,8 +712,8 @@ static int streamer_open(struct net_device *dev)strcat (open_error," - " );strcat (open_error, open_min_error[(error_code &0x0f )]); -if (!streamer_priv->streamer_ring_speed - && ((error_code &0x0f ) ==0x0d )) +if (!streamer_priv->streamer_ring_speed && + ((error_code &0x0f ) ==0x0d )) {printk (KERN_WARNING "%s: Tried to autosense ring speed with no monitors present\n" , dev->name);printk (KERN_WARNING "%s: Please try again with a specified ring speed \n" , dev->name);
@@ -1032,8 +1032,8 @@ static irqreturn_t streamer_interrupt(int irq, void *dev_id) sisr =readw (streamer_mmio +SISR );while ((sisr & (SISR_MI |SISR_SRB_REPLY |SISR_ADAPTER_CHECK |SISR_ASB_FREE | -SISR_ARB_CMD |SISR_TRB_REPLY |SISR_PAR_ERR |SISR_SERR_ERR )) - && (max_intr >0 )) { +SISR_ARB_CMD |SISR_TRB_REPLY |SISR_PAR_ERR |SISR_SERR_ERR )) && + (max_intr >0 )) {if (sisr &SISR_PAR_ERR ) {writew (~SISR_PAR_ERR , streamer_mmio +SISR_RUM );
drivers/net/tokenring/smctr.c +42 -44
194 lines not on this page · raw message
drivers/net/tokenring/tms380tr.c +12 -12
@@ -729,8 +729,8 @@ static void tms380tr_timer_chk(unsigned long data)return ;tms380tr_chk_outstanding_cmds (dev); -if (time_before (tp->LastSendTime +SEND_TIMEOUT , jiffies) - && (tp->TplFree != tp->TplBusy)) +if (time_before (tp->LastSendTime +SEND_TIMEOUT , jiffies) && + (tp->TplFree != tp->TplBusy)) {/* Anything to send, but stalled too long */ tp->LastSendTime = jiffies;
@@ -830,8 +830,8 @@ irqreturn_t tms380tr_interrupt(int irq, void *dev_id) }/* Reset system interrupt if not already done. */ -if (irq_type !=STS_IRQ_TRANSMIT_STATUS - && irq_type !=STS_IRQ_RECEIVE_STATUS ) { +if (irq_type !=STS_IRQ_TRANSMIT_STATUS && + irq_type !=STS_IRQ_RECEIVE_STATUS ) {tms380tr_reset_interrupt (dev); }
@@ -895,10 +895,10 @@ static unsigned char tms380tr_chk_ssb(struct net_local *tp, unsigned short IrqTy/* Check if this interrupt does use the SSB. */ -if (IrqType !=STS_IRQ_TRANSMIT_STATUS - && IrqType !=STS_IRQ_RECEIVE_STATUS - && IrqType !=STS_IRQ_COMMAND_STATUS - && IrqType !=STS_IRQ_RING_STATUS ) +if (IrqType !=STS_IRQ_TRANSMIT_STATUS && + IrqType !=STS_IRQ_RECEIVE_STATUS && + IrqType !=STS_IRQ_COMMAND_STATUS && + IrqType !=STS_IRQ_RING_STATUS ) {return (1 );/* SSB not involved. */ }
@@ -1485,8 +1485,8 @@ static int tms380tr_init_adapter(struct net_device *dev)/* Mask interesting status bits */ Status =SIFREADW (SIFSTS ); Status &=STS_MASK ; - }while (((Status &(STS_INITIALIZE |STS_ERROR |STS_TEST )) !=0 ) - && ((Status &STS_ERROR ) ==0 ) && (loop_cnt !=0 )); + }while (((Status &(STS_INITIALIZE |STS_ERROR |STS_TEST )) !=0 ) && + ((Status &STS_ERROR ) ==0 ) && (loop_cnt !=0 ));if ((Status & (STS_INITIALIZE |STS_ERROR |STS_TEST )) ==0 ) {
@@ -2183,8 +2183,8 @@ static void tms380tr_rcv_status_irq(struct net_device *dev) } } -if (skb && (rpl->SkbStat ==SKB_DATA_COPY - || rpl->SkbStat ==SKB_DMA_DIRECT )) +if (skb && (rpl->SkbStat ==SKB_DATA_COPY || + rpl->SkbStat ==SKB_DMA_DIRECT )) {if (rpl->SkbStat ==SKB_DATA_COPY ) skb_copy_to_linear_data(skb, ReceiveDataPtr,
drivers/net/tulip/21142.c +4 -4
@@ -209,10 +209,10 @@ void t21142_lnk_change(struct net_device *dev, int csr5)printk (KERN_DEBUG "%s: Setting CSR6 %8.8x/%x CSR12 %8.8x.\n" , dev->name, tp->csr6,ioread32 (ioaddr +CSR6 ),ioread32 (ioaddr +CSR12 )); - }else if ((tp->nwayset && (csr5 &0x08000000 ) - && (dev->if_port ==3 || dev->if_port ==5 ) - && (csr12 &2 ) ==2 ) || - (tp->nway && (csr5 & (TPLnkFail)))) { + }else if ((tp->nwayset && (csr5 &0x08000000 ) && + (dev->if_port ==3 || dev->if_port ==5 ) && + (csr12 &2 ) ==2 ) || + (tp->nway && (csr5 & (TPLnkFail)))) {/* Link blew? Maybe restart NWay. */ del_timer_sync (&tp->timer);t21142_start_nway (dev);
drivers/net/tulip/de2104x.c +3 -3
@@ -62,9 +62,9 @@ module_param (debug, int, 0);MODULE_PARM_DESC (debug,"de2104x bitmapped message enable number" );/* Set the copy breakpoint for the copy-only-tiny-buffer Rx structure. */ -#if defined(__alpha__) || defined(__arm__) || defined(__hppa__) \ - || defined(CONFIG_SPARC ) || defined(__ia64__) \ - || defined(__sh__) || defined(__mips__) +#if defined(__alpha__) || defined(__arm__) || defined(__hppa__) || \ + defined(CONFIG_SPARC ) || defined(__ia64__) || \ + defined(__sh__) || defined(__mips__)static int rx_copybreak =1518 ;#else static int rx_copybreak =100 ;
drivers/net/tulip/eeprom.c +4 -4
@@ -174,10 +174,10 @@ void __devinit tulip_parse_eeprom(struct net_device *dev) }/* Do a fix-up based on the vendor half of the station address prefix. */ for (i =0 ; eeprom_fixups[i].name; i++) { -if (dev->dev_addr[0 ] == eeprom_fixups[i].addr0 - && dev->dev_addr[1 ] == eeprom_fixups[i].addr1 - && dev->dev_addr[2 ] == eeprom_fixups[i].addr2) { -if (dev->dev_addr[2 ] ==0xE8 && ee_data[0x1a ] ==0x55 ) +if (dev->dev_addr[0 ] == eeprom_fixups[i].addr0 && + dev->dev_addr[1 ] == eeprom_fixups[i].addr1 && + dev->dev_addr[2 ] == eeprom_fixups[i].addr2) { +if (dev->dev_addr[2 ] ==0xE8 && ee_data[0x1a ] ==0x55 ) i++;/* An Accton EN1207, not an outlaw Maxtech. */ memcpy (ee_data +26 , eeprom_fixups[i].newtable,sizeof (eeprom_fixups[i].newtable));
drivers/net/tulip/interrupt.c +8 -8
@@ -170,8 +170,8 @@ int tulip_poll(struct napi_struct *napi, int budget) RxDescCollisionSeen | RxDescRunt | RxDescDescErr | - RxWholePkt)) != RxWholePkt - || pkt_len > 1518) { + RxWholePkt)) != RxWholePkt || + pkt_len > 1518) { if ((status & (RxLengthOver2047 | RxWholePkt)) != RxWholePkt) {/* Ingore earlier buffers. */
@@ -201,8 +201,8 @@ int tulip_poll(struct napi_struct *napi, int budget)/* Check if the packet is long enough to accept without copying to a minimally-sized skbuff. */ -if (pkt_len < tulip_rx_copybreak - && (skb =dev_alloc_skb (pkt_len +2 )) !=NULL ) { +if (pkt_len < tulip_rx_copybreak && + (skb =dev_alloc_skb (pkt_len +2 )) !=NULL ) {skb_reserve (skb,2 );/* 16 byte align the IP header */ pci_dma_sync_single_for_cpu(tp->pdev, tp->rx_buffers[entry].mapping,
@@ -395,8 +395,8 @@ static int tulip_rx(struct net_device *dev) RxDescCollisionSeen | RxDescRunt | RxDescDescErr | - RxWholePkt)) != RxWholePkt - || pkt_len > 1518) { + RxWholePkt)) != RxWholePkt || + pkt_len > 1518) { if ((status & (RxLengthOver2047 | RxWholePkt)) != RxWholePkt) {/* Ingore earlier buffers. */
@@ -425,8 +425,8 @@ static int tulip_rx(struct net_device *dev)/* Check if the packet is long enough to accept without copying to a minimally-sized skbuff. */ -if (pkt_len < tulip_rx_copybreak - && (skb =dev_alloc_skb (pkt_len +2 )) !=NULL ) { +if (pkt_len < tulip_rx_copybreak && + (skb =dev_alloc_skb (pkt_len +2 )) !=NULL ) {skb_reserve (skb,2 );/* 16 byte align the IP header */ pci_dma_sync_single_for_cpu(tp->pdev, tp->rx_buffers[entry].mapping,
drivers/net/tulip/media.c +2 -2
@@ -468,8 +468,8 @@ void __devinit tulip_find_mii (struct net_device *dev, int board_idx)int phy = phyn &0x1f ;int mii_status =tulip_mdio_read (dev, phy,MII_BMSR );if ((mii_status &0x8301 ) ==0x8001 || - ((mii_status &BMSR_100BASE4 ) ==0 - && (mii_status &0x7800 ) !=0 )) { + ((mii_status &BMSR_100BASE4 ) ==0 && + (mii_status &0x7800 ) !=0 )) {/* preserve Becker logic, gain indentation level */ }else {continue ;
drivers/net/tulip/pnic2.c +3 -3
@@ -316,9 +316,9 @@ void pnic2_lnk_change(struct net_device *dev, int csr5) } } -if ((tp->nwayset && (csr5 &0x08000000 ) - && (dev->if_port ==3 || dev->if_port ==5 ) - && (csr12 &2 ) ==2 ) || (tp->nway && (csr5 & (TPLnkFail)))) { +if ((tp->nwayset && (csr5 &0x08000000 ) && + (dev->if_port ==3 || dev->if_port ==5 ) && + (csr12 &2 ) ==2 ) || (tp->nway && (csr5 & (TPLnkFail)))) {/* Link blew? Maybe restart NWay. */
drivers/net/tulip/tulip_core.c +12 -10
@@ -64,9 +64,9 @@ const char * const medianame[32] = { };/* Set the copy breakpoint for the copy-only-tiny-buffer Rx structure. */ -#if defined(__alpha__) || defined(__arm__) || defined(__hppa__) \ - || defined(CONFIG_SPARC ) || defined(__ia64__) \ - || defined(__sh__) || defined(__mips__) +#if defined(__alpha__) || defined(__arm__) || defined(__hppa__) || \ + defined(CONFIG_SPARC ) || defined(__ia64__) || \ + defined(__sh__) || defined(__mips__)static int rx_copybreak =1518 ;#else static int rx_copybreak =100 ;
@@ -449,8 +449,8 @@ media_picked:iowrite32 (0x0201B078 , ioaddr +0xB8 ); next_tick =1 *HZ ; } - }else if ((tp->chip_id ==MX98713 || tp->chip_id ==COMPEX9881 ) - && ! tp->medialock) { + }else if ((tp->chip_id ==MX98713 || tp->chip_id ==COMPEX9881 ) && + ! tp->medialock) { dev->if_port =0 ; tp->csr6 =0x01880000 | (tp->full_duplex ?0x0200 :0 );iowrite32 (0x0f370000 |ioread16 (ioaddr +0x80 ), ioaddr +0x80 );
@@ -535,9 +535,9 @@ static void tulip_tx_timeout(struct net_device *dev)if (tulip_debug >1 )printk (KERN_WARNING "%s: Transmit timeout using MII device.\n" , dev->name); - }else if (tp->chip_id ==DC21140 || tp->chip_id ==DC21142 - || tp->chip_id ==MX98713 || tp->chip_id ==COMPEX9881 - || tp->chip_id ==DM910X ) { + }else if (tp->chip_id ==DC21140 || tp->chip_id ==DC21142 || + tp->chip_id ==MX98713 || tp->chip_id ==COMPEX9881 || + tp->chip_id ==DM910X ) { printk(KERN_WARNING "%s: 21140 transmit timed out, status %8.8x, " "SIA %8.8x %8.8x %8.8x %8.8x, resetting...\n", dev->name, ioread32(ioaddr + CSR5), ioread32(ioaddr + CSR12),
@@ -1538,8 +1538,10 @@ static int __devinit tulip_init_one (struct pci_dev *pdev, } }/* Lite-On boards have the address byte-swapped. */ -if ((dev->dev_addr[0 ] ==0xA0 || dev->dev_addr[0 ] ==0xC0 || dev->dev_addr[0 ] ==0x02 ) - && dev->dev_addr[1 ] ==0x00 ) +if ((dev->dev_addr[0 ] ==0xA0 || + dev->dev_addr[0 ] ==0xC0 || + dev->dev_addr[0 ] ==0x02 ) && + dev->dev_addr[1 ] ==0x00 )for (i =0 ; i <6 ; i+=2 ) {char tmp = dev->dev_addr[i]; dev->dev_addr[i] = dev->dev_addr[i+1 ];
drivers/net/tulip/winbond-840.c +4 -4
@@ -1230,8 +1230,8 @@ static int netdev_rx(struct net_device *dev)#endif /* Check if the packet is long enough to accept without copying to a minimally-sized skbuff. */ -if (pkt_len < rx_copybreak - && (skb =dev_alloc_skb (pkt_len +2 )) !=NULL ) { +if (pkt_len < rx_copybreak && + (skb =dev_alloc_skb (pkt_len +2 )) !=NULL ) {skb_reserve (skb,2 );/* 16 byte align the IP header */ pci_dma_sync_single_for_cpu(np->pci_dev,np->rx_addr[entry], np->rx_skbuff[entry]->len,
@@ -1357,8 +1357,8 @@ static u32 __set_rx_mode(struct net_device *dev)memset (mc_filter,0xff ,sizeof (mc_filter)); rx_mode = RxAcceptBroadcast | AcceptMulticast | RxAcceptAllPhys | AcceptMyPhys; - }else if ((dev->mc_count > multicast_filter_limit) - || (dev->flags &IFF_ALLMULTI )) { + }else if ((dev->mc_count > multicast_filter_limit) || + (dev->flags &IFF_ALLMULTI )) {/* Too many to match, or accept all multicasts. */ memset (mc_filter,0xff ,sizeof (mc_filter)); rx_mode = RxAcceptBroadcast | AcceptMulticast | AcceptMyPhys;
drivers/net/typhoon.c +2 -2
@@ -1769,8 +1769,8 @@ typhoon_rx(struct typhoon *tp, struct basic_ring *rxRing, volatile __le32 * read csum_bits = rx->rxStatus & (TYPHOON_RX_IP_CHK_GOOD |TYPHOON_RX_UDP_CHK_GOOD |TYPHOON_RX_TCP_CHK_GOOD );if (csum_bits == - (TYPHOON_RX_IP_CHK_GOOD |TYPHOON_RX_TCP_CHK_GOOD ) - || csum_bits == + (TYPHOON_RX_IP_CHK_GOOD |TYPHOON_RX_TCP_CHK_GOOD ) || + csum_bits == (TYPHOON_RX_IP_CHK_GOOD |TYPHOON_RX_UDP_CHK_GOOD )) { new_skb->ip_summed =CHECKSUM_UNNECESSARY ; }else
drivers/net/ucc_geth.c +12 -12
@@ -1306,8 +1306,8 @@ static int init_max_rx_buff_len(u16 max_rx_buf_len, u16 __iomem *mrblr_register) {/* max_rx_buf_len value must be a multiple of 128 */ -if ((max_rx_buf_len ==0 ) - || (max_rx_buf_len %UCC_GETH_MRBLR_ALIGNMENT )) +if ((max_rx_buf_len ==0 ) || + (max_rx_buf_len %UCC_GETH_MRBLR_ALIGNMENT ))return -EINVAL ;out_be16 (mrblr_register, max_rx_buf_len);
@@ -2159,8 +2159,8 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) }if ((ug_info->numStationAddresses != -UCC_GETH_NUM_OF_STATION_ADDRESSES_1 ) - && ug_info->rxExtendedFiltering) { +UCC_GETH_NUM_OF_STATION_ADDRESSES_1 ) && + ug_info->rxExtendedFiltering) {if (netif_msg_probe (ugeth)) ugeth_err("%s: Number of station addresses greater than 1 " "not allowed in extended parsing mode.",
@@ -2284,9 +2284,9 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) UCC_GETH_NUM_OF_STATION_ADDRESSES_1); ugeth->rx_extended_features = ugeth->rx_non_dynamic_extended_features || - (ug_info->vlanOperationTagged !=UCC_GETH_VLAN_OPERATION_TAGGED_NOP ) - || (ug_info->vlanOperationNonTagged != -UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP ); + (ug_info->vlanOperationTagged !=UCC_GETH_VLAN_OPERATION_TAGGED_NOP ) || + (ug_info->vlanOperationNonTagged != +UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP );init_default_reg_vals (&uf_regs->upsmr, &ug_regs->maccfg1, &ug_regs->maccfg2);
@@ -2987,11 +2987,11 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ugeth->p_init_enet_param_shadow->rgftgfrxglobal |= ugeth->rx_glbl_pram_offset | ug_info->riscRx;if ((ug_info->largestexternallookupkeysize != -QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_NONE ) - && (ug_info->largestexternallookupkeysize != -QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_8_BYTES ) - && (ug_info->largestexternallookupkeysize != -QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_16_BYTES )) { +QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_NONE ) && + (ug_info->largestexternallookupkeysize != +QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_8_BYTES ) && + (ug_info->largestexternallookupkeysize != +QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_16_BYTES )) {if (netif_msg_ifup (ugeth))ugeth_err ("%s: Invalid largest External Lookup Key Size." , __func__);
drivers/net/usb/asix.c +6 -6
@@ -365,8 +365,8 @@ static struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb, padlen = ((skb->len +4 ) %512 ) ?0 :4 ; -if ((!skb_cloned (skb)) - && ((headroom + tailroom) >= (4 + padlen))) { +if ((!skb_cloned (skb)) && + ((headroom + tailroom) >= (4 + padlen))) {if ((headroom <4 ) || (tailroom < padlen)) { skb->data =memmove (skb->head +4 , skb->data, skb->len);skb_set_tail_pointer (skb, skb->len);
@@ -541,8 +541,8 @@ static void asix_set_multicast(struct net_device *net)if (net->flags &IFF_PROMISC ) { rx_ctl |=AX_RX_CTL_PRO ; - }else if (net->flags &IFF_ALLMULTI - || net->mc_count >AX_MAX_MCAST ) { + }else if (net->flags &IFF_ALLMULTI || + net->mc_count >AX_MAX_MCAST ) { rx_ctl |=AX_RX_CTL_AMALL ; }else if (net->mc_count ==0 ) {/* just broadcast and directed */
@@ -753,8 +753,8 @@ static void ax88172_set_multicast(struct net_device *net)if (net->flags &IFF_PROMISC ) { rx_ctl |=0x01 ; - }else if (net->flags &IFF_ALLMULTI - || net->mc_count >AX_MAX_MCAST ) { + }else if (net->flags &IFF_ALLMULTI || + net->mc_count >AX_MAX_MCAST ) { rx_ctl |=0x02 ; }else if (net->mc_count ==0 ) {/* just broadcast and directed */
drivers/net/usb/catc.c +2 -2
@@ -436,8 +436,8 @@ static netdev_tx_t catc_start_xmit(struct sk_buff *skb,clear_bit (TX_RUNNING , &catc->flags); } -if ((catc->is_f5u011 && catc->tx_ptr) - || (catc->tx_ptr >= ((TX_MAX_BURST -1 ) * (PKT_SZ +2 )))) +if ((catc->is_f5u011 && catc->tx_ptr) || + (catc->tx_ptr >= ((TX_MAX_BURST -1 ) * (PKT_SZ +2 ))))netif_stop_queue (netdev);spin_unlock_irqrestore (&catc->tx_lock, flags);
drivers/net/usb/cdc-phonet.c +4 -4
@@ -372,12 +372,12 @@ int usbpn_probe(struct usb_interface *intf, const struct usb_device_id *id)/* Data interface has one inactive and one active setting */ if (data_intf->num_altsetting !=2 )return -EINVAL ; -if (data_intf->altsetting[0 ].desc.bNumEndpoints ==0 - && data_intf->altsetting[1 ].desc.bNumEndpoints ==2 ) +if (data_intf->altsetting[0 ].desc.bNumEndpoints ==0 && + data_intf->altsetting[1 ].desc.bNumEndpoints ==2 ) data_desc = data_intf->altsetting +1 ;else -if (data_intf->altsetting[0 ].desc.bNumEndpoints ==2 - && data_intf->altsetting[1 ].desc.bNumEndpoints ==0 ) +if (data_intf->altsetting[0 ].desc.bNumEndpoints ==2 && + data_intf->altsetting[1 ].desc.bNumEndpoints ==0 ) data_desc = data_intf->altsetting;else return -EINVAL ;
drivers/net/usb/cdc_eem.c +2 -2
@@ -121,8 +121,8 @@ static struct sk_buff *eem_tx_fixup(struct usbnet *dev, struct sk_buff *skb,int headroom =skb_headroom (skb);int tailroom =skb_tailroom (skb); -if ((tailroom >=ETH_FCS_LEN + padlen) - && (headroom >=EEM_HEAD )) +if ((tailroom >=ETH_FCS_LEN + padlen) && + (headroom >=EEM_HEAD )) goto done; if ((headroom + tailroom)
drivers/net/usb/cdc_ether.c +16 -16
@@ -37,23 +37,23 @@static int is_rndis (struct usb_interface_descriptor *desc) { -return desc->bInterfaceClass ==USB_CLASS_COMM - && desc->bInterfaceSubClass ==2 - && desc->bInterfaceProtocol ==0xff ; +return (desc->bInterfaceClass ==USB_CLASS_COMM && + desc->bInterfaceSubClass ==2 && + desc->bInterfaceProtocol ==0xff ); }static int is_activesync (struct usb_interface_descriptor *desc) { -return desc->bInterfaceClass ==USB_CLASS_MISC - && desc->bInterfaceSubClass ==1 - && desc->bInterfaceProtocol ==1 ; +return (desc->bInterfaceClass ==USB_CLASS_MISC && + desc->bInterfaceSubClass ==1 && + desc->bInterfaceProtocol ==1 ); }static int is_wireless_rndis (struct usb_interface_descriptor *desc) { -return desc->bInterfaceClass ==USB_CLASS_WIRELESS_CONTROLLER - && desc->bInterfaceSubClass ==1 - && desc->bInterfaceProtocol ==3 ; +return (desc->bInterfaceClass ==USB_CLASS_WIRELESS_CONTROLLER && + desc->bInterfaceSubClass ==1 && + desc->bInterfaceProtocol ==3 ); }#else
@@ -116,9 +116,9 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)/* this assumes that if there's a non-RNDIS vendor variant * of cdc-acm, it'll fail RNDIS requests cleanly. */ - rndis =is_rndis (&intf->cur_altsetting->desc) - ||is_activesync (&intf->cur_altsetting->desc) - ||is_wireless_rndis (&intf->cur_altsetting->desc); + rndis = (is_rndis (&intf->cur_altsetting->desc) || +is_activesync (&intf->cur_altsetting->desc) || +is_wireless_rndis (&intf->cur_altsetting->desc));memset (info,0 ,sizeof *info); info->control = intf;
@@ -279,10 +279,10 @@ next_desc: dev->status = &info->control->cur_altsetting->endpoint [0 ]; desc = &dev->status->desc; -if (!usb_endpoint_is_int_in (desc) - || (le16_to_cpu (desc->wMaxPacketSize) - <sizeof (struct usb_cdc_notification )) - || !desc->bInterval) { +if (!usb_endpoint_is_int_in (desc) || + (le16_to_cpu (desc->wMaxPacketSize) + <sizeof (struct usb_cdc_notification )) || + !desc->bInterval) {dev_dbg (&intf->dev,"bad notification endpoint\n" ); dev->status =NULL ; }
drivers/net/usb/hso.c +17 -17
@@ -602,9 +602,9 @@ static struct hso_serial *get_serial_by_shared_int_and_type( port =hso_mux_to_port (mux);for (i =0 ; i <HSO_SERIAL_TTY_MINORS ; i++) { -if (serial_table[i] - && (dev2ser (serial_table[i])->shared_int == shared_int) - && ((serial_table[i]->port_spec &HSO_PORT_MASK ) == port)) { +if (serial_table[i] && + (dev2ser (serial_table[i])->shared_int == shared_int) && + ((serial_table[i]->port_spec &HSO_PORT_MASK ) == port)) {return dev2ser (serial_table[i]); } }
@@ -846,8 +846,8 @@ static void hso_net_tx_timeout(struct net_device *net)dev_warn (&net->dev,"Tx timed out.\n" );/* Tear the waiting frame off the list */ -if (odev->mux_bulk_tx_urb - && (odev->mux_bulk_tx_urb->status == -EINPROGRESS )) +if (odev->mux_bulk_tx_urb && + (odev->mux_bulk_tx_urb->status == -EINPROGRESS ))usb_unlink_urb (odev->mux_bulk_tx_urb);/* Update statistics */
@@ -1020,9 +1020,9 @@ static void read_bulk_callback(struct urb *urb)u32 rest;u8 crc_check[4 ] = {0xDE ,0xAD ,0xBE ,0xEF }; rest = urb->actual_length % odev->in_endp->wMaxPacketSize; -if (((rest ==5 ) || (rest ==6 )) - && !memcmp (((u8 *) urb->transfer_buffer) + - urb->actual_length -4 , crc_check,4 )) { +if (((rest ==5 ) || (rest ==6 )) && + !memcmp (((u8 *) urb->transfer_buffer) + + urb->actual_length -4 , crc_check,4 )) { urb->actual_length -=4 ;
Lines of this file are not shown. View the raw message.
drivers/net/usb/usbnet.c +24 -24
48 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Re: [PATCH net-next-2.6] drivers/net: Move && and || to end of previous line
From: Joe Perches <[email protected]>
Date: Thu, 03 Dec 2009 09:58:21 -0800
Quoted 10 lines
Only files where David Miller is the primary git-signer. wireless, wimax, ixgbe, etc are not modified.
Compile tested x86 allyesconfig only
Not all files compiled (not x86 compatible)Added a few > 80 column lines, which I ignored. Existing checkpatch complaints ignored.
Signed-off-by Joe Perches <[email protected]>
Applied.
Re: [PATCH net-next-2.6] drivers/net: Move && and || to end of previous line
In reply to Joe PerchesQuoted 3 lines · Joe Perches
Only files where David Miller is the primary git-signer. wireless, wimax, ixgbe, etc are not modified.
What's the point? Having them at the beginning of the next line is easier to read from my point of view.
Brice
Re: [PATCH net-next-2.6] drivers/net: Move && and || to end of previous line
Quoted 5 lines · Brice Goglin
Quoted 2 lines · Joe Perches
Only files where David Miller is the primary git-signer. wireless, wimax, ixgbe, etc are not modified.
What's the point? Having them at the beginning of the next line is easier to read from my point of view.
It's just a stupid consistency thing.
Re: [PATCH net-next-2.6] drivers/net: Move && and || to end of previous line
Quoted 9 lines · Joe Perches
Quoted 5 lines · Brice Goglin
Quoted 2 lines · Joe Perches
Only files where David Miller is the primary git-signer. wireless, wimax, ixgbe, etc are not modified.
What's the point? Having them at the beginning of the next line is easier to read from my point of view.
It's just a stupid consistency thing.
Brice, I've made my objection known on the LKML. Joe *agrees* that having them on the beginning of the line is preferred. Thousands of contributors throughout the tree agree.
This is entirely a Miller thing.
My main objection to these sweeping patches is that it makes it much more difficult to maintain and apply patches across different versions of the tree. We have already seen conflicts with other git maintained trees.
These patches should not be accepted to the main Linus tree.
Re: [PATCH net-next-2.6] drivers/net: Move && and || to end of previous line
Quoted 10 lines · William Allen Simpson
Quoted 7 lines · Joe Perches
Quoted 5 lines · Brice Goglin
Quoted 2 lines · Joe Perches
Only files where David Miller is the primary git-signer. wireless, wimax, ixgbe, etc are not modified.
What's the point? Having them at the beginning of the next line is easier to read from my point of view.
It's just a stupid consistency thing.
Joe *agrees* that
having them on the beginning of the line is preferred.
This is not true.
I prefer code that I write for myself to use leading continuation tests.
For the Linux code, as should be obvious from the patches I submit, I prefer to have adherence to one predominant majority style. I don't much care what form that style actually takes.
Quoted 3 lines
Thousands of
contributors throughout the tree agree.
This is entirely a Miller thing.
Nope. There have been many efforts to help standardize on single form styles.
Quoted 3 lines
My main objection to these sweeping patches is that it makes it much more difficult to maintain and apply patches across different versions of the tree.
I think you underestimate the value of standardization and overestimate the quantity of work to sort it out for the -stable versions.
cheers, Joe
Re: [PATCH net-next-2.6] drivers/net: Move && and || to end of previous line
Joe Perches wrote, On 12/05/2009 06:50 PM:
Quoted 30 lines · William Allen Simpson
Quoted 10 lines
Quoted 7 lines · Joe Perches
Quoted 5 lines · Brice Goglin
Quoted 2 lines · Joe Perches
Only files where David Miller is the primary git-signer. wireless, wimax, ixgbe, etc are not modified.
What's the point? Having them at the beginning of the next line is easier to read from my point of view.
It's just a stupid consistency thing.
Joe *agrees* that
having them on the beginning of the line is preferred.This is not true.
I prefer code that I write for myself to use leading continuation tests.
For the Linux code, as should be obvious from the patches I submit, I prefer to have adherence to one predominant majority style. I don't much care what form that style actually takes.
Quoted 3 lines
Thousands of
contributors throughout the tree agree.
This is entirely a Miller thing.Nope. There have been many efforts to help standardize on single form styles.
Quoted 8 lines
Quoted 3 lines
My main objection to these sweeping patches is that it makes it much more difficult to maintain and apply patches across different versions of the tree.
I think you underestimate the value of standardization and overestimate the quantity of work to sort it out for the -stable versions.
Actually, technically, legally etc. (except practically) William is right:
if it's not in the CodingStyle, and not obviously wrong, it shouldn't be forced.
Jarek P.
Re: [PATCH net-next-2.6] drivers/net: Move && and || to end of previous line
In reply to Joe PerchesQuoted 10 lines · Joe Perches
Quoted 3 lines · William Allen Simpson
My main objection to these sweeping patches is that it makes it much more difficult to maintain and apply patches across different versions of the tree.
I think you underestimate the value of
standardization and overestimate the
quantity of work to sort it out for
the -stable versions.
As I mentioned to somebody in private email (having kept rough track), it took around 9 hours this week for my 8 patch series, spread over 3 days because of the tedium. Fix rejects, visually check patch against previous version, compile, test -- at least 1/2 to 1 hour for each numbered patch. Plus time to resubmit the patch series to the list again.
Of course, that was only for the initial patches already posted to the list. I've many more -- awaiting approval for the previous set....
Eventually, I have to do the same for each supported -stable version.
Multiply by thousands of contributors.
Hopefully, you did the same, carefully checking your regexp generated patches visually line by line, and compiling, and testing every driver in this large patch individually.
I'm not a big believer in making trivial formatting changes and assuming they work. Or that I didn't fumble fingers somehow. I've made many such stupid mistakes over the years.
David Miller
maintainerRe: [PATCH net-next-2.6] drivers/net: Move && and || to end of previous line
In reply to William Allen SimpsonFrom: William Allen Simpson <[email protected]>
Date: Sat, 05 Dec 2009 07:43:41 -0500
Quoted 1 line
These patches should not be accepted to the main Linus tree.
You come out of nowhere as a new contributor. You have to constantly ask about policy and other formalities wrt. kernel development.
Yet here you are telling us what should or should not go into the tree.
You don't even know what the "merge window" is yet you seem so confident to elicit firm declarations about code policy.
That's nothing but blind arrogance.
Nobody can take you seriously William, really.
And if you think just omitting Joe's patch is going to make your backporting work any easier, you're mistaken.
Every release we make tons and tons of cleanups and refactorizations all over the networking and sometimes heavily in TCP. So you're going to run into such problems no matter whether Joe's patch goes in or not.
And like Joe, I think you overstate how much effort is involved in such work. Especially for the size of your patch.
And consider, how in the world do you think it is for me to have to handle hundreds of patches per day from random people. If anyone should get the brunt of the pain, it's me.
Yet I'm ok with it, and you should be too.
Re: [PATCH net-next-2.6] drivers/net: Move && and || to end of previous line
Quoted 8 lines · David Miller
From: William Allen Simpson <[email protected]>
Date: Sat, 05 Dec 2009 07:43:41 -0500Quoted 1 line
These patches should not be accepted to the main Linus tree.
You come out of nowhere as a new contributor. You have to constantly ask about policy and other formalities wrt. kernel development.
Because they are not documented. Oh, and a reminder -- you've not answered my most recent questions....
Quoted 4 lines
Yet here you are telling us what should or should not go into the tree.
You don't even know what the "merge window" is yet you seem so
That would be one of the questions (which git clone to patch against now) that you haven't answered. Silly of me to ask practical questions.
Quoted 2 lines
confident to elicit firm declarations about code policy.
That would be because I've ample experience coding for multiple open source platforms. Apparently such experience isn't valued (by you).
But the fact that about 19% of the Linux code base has managed to function for circa 18 years without this particular coding policy might be a clue!
Quoted 4 lines
That's nothing but blind arrogance.
Nobody can take you seriously William, really.
Always _such_ a delight interacting with you, and your personal attacks.
Something that *is* in Documentation/ManagementStyle at 147:
There's just a few simple rules here:
(1) don't call people d*ckheads (at least not in public)
(2) learn how to apologize when you forgot rule (1)
Jonathan Corbet
maintainerRe: [PATCH net-next-2.6] drivers/net: Move && and || to end of previous line
Quoted 5 lines · On Sat, 05 Dec 2009 22:00:41 -0500 William Allen Simpson…
Quoted 3 lines
You come out of nowhere as a new contributor. You have to constantly ask about policy and other formalities wrt. kernel development.
Because they are not documented. Oh, and a reminder -- you've not answered my most recent questions....
Might I suggest a look at Documentation/HOWTO and Documentation/development-process/? You might find that more of this stuff is better documented than you think. If there are gaps, please let us know where they are, and we'll endeavor to fill them in.
jon
David Miller
maintainerRe: [PATCH net-next-2.6] drivers/net: Move && and || to end of previous line
In reply to Brice GoglinFrom: Brice Goglin <[email protected]>
Date: Fri, 04 Dec 2009 14:10:01 +0100
Quoted 7 lines
Quoted 3 lines · Joe Perches
Only files where David Miller is the primary git-signer. wireless, wimax, ixgbe, etc are not modified.
What's the point? Having them at the beginning of the next line is easier to read from my point of view.
Consistent coding style has no value to you? :-)
Re: [net-next-2.6 PATCH] net/ipv4: Move && and || to end of previous line
In reply to Joe PerchesQuoted 121 lines · Joe Perches
Quoted 9 lines · David Miller
It should be of the form:
if (x && y)or:
if (x && y)Fix patches, rather than complaints, for existing cases where things do not follow this pattern are certainly welcome.
Also collapsed some multiple tabs to single space.
Compiled tested only:
net/ipv4/inet_lro.c | 36 ++++++++++++++++++------------------ net/ipv4/ip_output.c | 6 ++++-- net/ipv4/ipconfig.c | 13 ++++++------- net/ipv4/route.c | 19 ++++++++++--------- net/ipv4/tcp_htcp.c | 10 +++++----- net/ipv4/tcp_input.c | 4 ++-- net/ipv4/tcp_lp.c | 4 ++-- net/ipv4/tcp_output.c | 4 ++-- net/ipv4/tcp_probe.c | 4 ++-- net/ipv4/tcp_veno.c | 5 ++--- net/ipv4/tcp_yeah.c | 4 ++-- net/ipv4/udp.c | 36 ++++++++++++++++++------------------ 12 files changed, 73 insertions(+), 72 deletions(-)net/ipv4/inet_lro.c +18
-18@@ -64,15 +64,15 @@ static int lro_tcp_ip_check(struct iphdr *iph, struct tcphdr *tcph,if (iph->ihl !=IPH_LEN_WO_OPTIONS )return -1 ; -if (tcph->cwr || tcph->ece || tcph->urg || !tcph->ack - || tcph->rst || tcph->syn || tcph->fin) +if (tcph->cwr || tcph->ece || tcph->urg || !tcph->ack || + tcph->rst || tcph->syn || tcph->fin)return -1 ;if (INET_ECN_is_ce (ipv4_get_dsfield (iph)))return -1 ; -if (tcph->doff !=TCPH_LEN_WO_OPTIONS - && tcph->doff !=TCPH_LEN_W_TIMESTAMP ) +if (tcph->doff !=TCPH_LEN_WO_OPTIONS && + tcph->doff !=TCPH_LEN_W_TIMESTAMP )return -1 ;/* check tcp options (only timestamp allowed) */ @@ -262,10 +262,10 @@ static int lro_check_tcp_conn(struct net_lro_desc *lro_desc, struct iphdr *iph, struct tcphdr *tcph) { -if ((lro_desc->iph->saddr != iph->saddr) - || (lro_desc->iph->daddr != iph->daddr) - || (lro_desc->tcph->source != tcph->source) - || (lro_desc->tcph->dest != tcph->dest)) +if ((lro_desc->iph->saddr != iph->saddr) || + (lro_desc->iph->daddr != iph->daddr) || + (lro_desc->tcph->source != tcph->source) || + (lro_desc->tcph->dest != tcph->dest))return -1 ;return 0 ; }@@ -339,9 +339,9 @@ static int __lro_proc_skb(struct net_lro_mgr *lro_mgr, struct sk_buff *skb,u64 flags;int vlan_hdr_len =0 ; -if (!lro_mgr->get_skb_header - || lro_mgr->get_skb_header (skb, (void *)&iph, (void *)&tcph, - &flags, priv)) +if (!lro_mgr->get_skb_header || + lro_mgr->get_skb_header (skb, (void *)&iph, (void *)&tcph, + &flags, priv)) goto out;if (!(flags &LRO_IPV4 ) || !(flags &LRO_TCP ))@@ -351,8 +351,8 @@ static int __lro_proc_skb(struct net_lro_mgr *lro_mgr, struct sk_buff *skb,if (!lro_desc) goto out; -if ((skb->protocol ==htons (ETH_P_8021Q )) - && !(lro_mgr->features &LRO_F_EXTRACT_VLAN_ID )) +if ((skb->protocol ==htons (ETH_P_8021Q )) && + !(lro_mgr->features &LRO_F_EXTRACT_VLAN_ID )) vlan_hdr_len =VLAN_HLEN ;if (!lro_desc->active) {/* start new lro session */ @@ -446,9 +446,9 @@ static struct sk_buff *__lro_proc_segment(struct net_lro_mgr *lro_mgr,int hdr_len =LRO_MAX_PG_HLEN ;int vlan_hdr_len =0 ; -if (!lro_mgr->get_frag_header - || lro_mgr->get_frag_header (frags, (void *)&mac_hdr, (void *)&iph, - (void *)&tcph, &flags, priv)) { +if (!lro_mgr->get_frag_header || + lro_mgr->get_frag_header (frags, (void *)&mac_hdr, (void *)&iph, + (void *)&tcph, &flags, priv)) { mac_hdr =page_address (frags->page) + frags->page_offset; goto out1; }@@ -472,8 +472,8 @@ static struct sk_buff *__lro_proc_segment(struct net_lro_mgr *lro_mgr,if (!skb) goto out; -if ((skb->protocol ==htons (ETH_P_8021Q )) - && !(lro_mgr->features &LRO_F_EXTRACT_VLAN_ID )) +if ((skb->protocol ==htons (ETH_P_8021Q )) && + !(lro_mgr->features &LRO_F_EXTRACT_VLAN_ID )) vlan_hdr_len =VLAN_HLEN ; iph = (void *)(skb->data + vlan_hdr_len);net/ipv4/ip_output.c +0
-0
net/ipv4/ip_output.c int ip_mc_output(struct sk_buff *skb) · line 271
Quoted 10 lines
net/ipv4/ip_output.c +4
-2@@ -264,9 +264,11 @@ int ip_mc_output(struct sk_buff *skb)This check is duplicated in ip_mr_input at the moment. */ - && ((rt->rt_flags&RTCF_LOCAL) || !(IPCB(skb)->flags&IPSKB_FORWARDED)) + && + ((rt->rt_flags & RTCF_LOCAL) || + !(IPCB(skb)->flags & IPSKB_FORWARDED)) #endif - ) { + ) {
Certainly better in general already but there is still some work to be done here as now you have an && only line. I guess it mostly has to do with comments but #if... blahblahs could be another type of failure (in automation like this).
Signature · 1 line
i.
Re: [net-next-2.6 PATCH] net/ipv4: Move && and || to end of previous line
Quoted 4 lines · Ilpo Järvinen
Certainly better in general already but there is still some work to be done here as now you have an && only line. I guess it mostly has to do with comments but #if... blahblahs could be another type of failure (in automation like this).
The current form is
if (foo
#ifdef BAR && bar #endif )
Another option could be:
#ifdef BAR if (foo && bar)
#else
if (foo)
#endif
In any case, it won't be pretty.
Re: [net-next-2.6 PATCH] net/ipv4: Move && and || to end of previous line
Quoted 16 lines · Joe Perches
Quoted 4 lines · Ilpo Järvinen
Certainly better in general already but there is still some work to be done here as now you have an && only line. I guess it mostly has to do with comments but #if... blahblahs could be another type of failure (in automation like this).
The current form is
if (foo
#ifdef BAR && bar #endif )Another option could be:
Quoted 7 lines
#ifdef BAR if (foo && bar)#else
if (foo)
#endifIn any case, it won't be pretty.
But wouldn't your automation produce:
#ifdef BAR
if (foo
#endif && bar
? Like it did for the case where there was a comment between.
As I didn't go through the whole patch I don't know if there were in fact any #if things that got made into that kind of construct or not (just mentioned it that such places might also be affected incorrectly by your automation). I only noticed one of such after comment (ie., && on otherwise empty line) and hit reply.
Signature · 1 line
i.
PATCH 1/1 net/ipv6: Move && and || to end of previous line
In reply to David MillerQuoted 9 lines · David Miller
It should be of the form:
if (x && y)or:
if (x && y)Fix patches, rather than complaints, for existing cases where things do not follow this pattern are certainly welcome.
Compile tested only.
net/ipv6/ip6_flowlabel.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
net/ipv6/ip6_flowlabel.c +4 -4
@@ -377,8 +377,8 @@ fl_create(struct net *net, struct in6_flowlabel_req *freq, char __user *optval, goto done; fl->share = freq->flr_share; addr_type =ipv6_addr_type (&freq->flr_dst); -if ((addr_type&IPV6_ADDR_MAPPED ) - || addr_type ==IPV6_ADDR_ANY ) { +if ((addr_type &IPV6_ADDR_MAPPED ) || + addr_type ==IPV6_ADDR_ANY ) { err = -EINVAL ; goto done; }
@@ -421,8 +421,8 @@ static int mem_check(struct sock *sk)if (room <=0 || ((count >=FL_MAX_PER_SOCK || - (count >0 && room <FL_MAX_SIZE /2 ) || room <FL_MAX_SIZE /4 ) - && !capable (CAP_NET_ADMIN ))) + (count >0 && room <FL_MAX_SIZE /2 ) || room <FL_MAX_SIZE /4 ) && + !capable (CAP_NET_ADMIN )))return -ENOBUFS ;return 0 ;
Re: [net-next-2.6 PATCH] net/ipv6: Move && and || to end of previous line
From: Joe Perches <[email protected]>
Date: Mon, 23 Nov 2009 10:58:44 -0800
Quoted 1 line
Signed-off-by Joe Perches <[email protected]>
Applied, thanks Joe.
PATCH 1/1 net/ipv[46]/netfilter: Move && and || to end of previous line
In reply to David MillerQuoted 9 lines · David Miller
It should be of the form:
if (x && y)or:
if (x && y)Fix patches, rather than complaints, for existing cases where things do not follow this pattern are certainly welcome.
Compile tested only.
net/ipv4/netfilter/arp_tables.c | 22 ++++++------ net/ipv4/netfilter/ip_tables.c | 46 ++++++++++++------------ net/ipv4/netfilter/ipt_CLUSTERIP.c | 20 +++++----- net/ipv4/netfilter/ipt_ECN.c | 8 ++-- net/ipv4/netfilter/ipt_LOG.c | 22 ++++++------ net/ipv4/netfilter/ipt_MASQUERADE.c | 4 +- net/ipv4/netfilter/ipt_REJECT.c | 4 +- net/ipv4/netfilter/ipt_ULOG.c | 6 ++-- net/ipv4/netfilter/ipt_ecn.c | 4 +- net/ipv4/netfilter/iptable_mangle.c | 4 +- net/ipv4/netfilter/iptable_security.c | 4 +- net/ipv4/netfilter/nf_conntrack_proto_icmp.c | 28 +++++++------- net/ipv4/netfilter/nf_nat_standalone.c | 10 +++--- net/ipv6/netfilter/ip6_tables.c | 42 +++++++++++----------- net/ipv6/netfilter/ip6t_LOG.c | 4 +- net/ipv6/netfilter/ip6t_REJECT.c | 4 +- net/ipv6/netfilter/ip6t_ah.c | 19 ++++------ net/ipv6/netfilter/ip6t_frag.c | 47 +++++++++++------------- net/ipv6/netfilter/ip6t_rt.c | 9 ++--- net/ipv6/netfilter/ip6table_filter.c | 4 +- net/ipv6/netfilter/ip6table_mangle.c | 14 ++++---- net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | 12 +++--- 22 files changed, 163 insertions(+), 174 deletions(-)
net/ipv4/netfilter/arp_tables.c +11 -11
@@ -384,11 +384,11 @@ static int mark_source_chains(struct xt_table_info *newinfo, |= ((1 << hook) | (1 << NF_ARP_NUMHOOKS));/* Unconditional return/END. */ -if ((e->target_offset ==sizeof (struct arpt_entry ) - && (strcmp (t->target.u.user.name, -ARPT_STANDARD_TARGET ) ==0 ) - && t->verdict <0 - &&unconditional (&e->arp)) || visited) { +if ((e->target_offset ==sizeof (struct arpt_entry ) && + (strcmp (t->target.u.user.name, +ARPT_STANDARD_TARGET ) ==0 ) && + t->verdict <0 &&unconditional (&e->arp)) || + visited) {unsigned int oldpos, size; if ((strcmp(t->target.u.user.name,
@@ -427,8 +427,8 @@ static int mark_source_chains(struct xt_table_info *newinfo,int newpos = t->verdict;if (strcmp (t->target.u.user.name, -ARPT_STANDARD_TARGET ) ==0 - && newpos >=0 ) { +ARPT_STANDARD_TARGET ) ==0 && + newpos >=0 ) {if (newpos > newinfo->size -sizeof (struct arpt_entry )) { duprintf("mark_source_chains: "
@@ -559,8 +559,8 @@ static inline int check_entry_size_and_hooks(struct arpt_entry *e, {unsigned int h; -if ((unsigned long )e % __alignof__(struct arpt_entry ) !=0 - || (unsigned char *)e +sizeof (struct arpt_entry ) >= limit) { +if ((unsigned long )e % __alignof__(struct arpt_entry ) !=0 || + (unsigned char *)e +sizeof (struct arpt_entry ) >= limit) {duprintf ("Bad offset %p\n" , e);return -EINVAL ; }
@@ -1251,8 +1251,8 @@ check_compat_entry_size_and_hooks(struct compat_arpt_entry *e,int ret, off, h;duprintf ("check_compat_entry_size_and_hooks %p\n" , e); -if ((unsigned long )e % __alignof__(struct compat_arpt_entry ) !=0 - || (unsigned char *)e +sizeof (struct compat_arpt_entry ) >= limit) { +if ((unsigned long )e % __alignof__(struct compat_arpt_entry ) !=0 || + (unsigned char *)e +sizeof (struct compat_arpt_entry ) >= limit) {duprintf ("Bad offset %p, limit = %p\n" , e, limit);return -EINVAL ; }
net/ipv4/netfilter/ip_tables.c +23 -23
94 lines not on this page · raw message
net/ipv4/netfilter/ipt_CLUSTERIP.c +10 -10
@@ -303,9 +303,9 @@ clusterip_tg(struct sk_buff *skb, const struct xt_target_param *par)/* special case: ICMP error handling. conntrack distinguishes between * error messages (RELATED) and information requests (see below) */ -if (ip_hdr (skb)->protocol ==IPPROTO_ICMP - && (ctinfo ==IP_CT_RELATED - || ctinfo ==IP_CT_RELATED +IP_CT_IS_REPLY )) +if (ip_hdr (skb)->protocol ==IPPROTO_ICMP && + (ctinfo ==IP_CT_RELATED || + ctinfo ==IP_CT_RELATED +IP_CT_IS_REPLY ))return XT_CONTINUE ;/* ip_conntrack_icmp guarantees us that we only have ICMP_ECHO,
@@ -362,8 +362,8 @@ static bool clusterip_tg_check(const struct xt_tgchk_param *par)return false; } -if (e->ip.dmsk.s_addr !=htonl (0xffffffff ) - || e->ip.dst.s_addr ==0 ) { +if (e->ip.dmsk.s_addr !=htonl (0xffffffff ) || + e->ip.dst.s_addr ==0 ) {printk (KERN_ERR "CLUSTERIP: Please specify destination IP\n" );return false; }
@@ -495,14 +495,14 @@ arp_mangle(unsigned int hook,struct clusterip_config *c;/* we don't care about non-ethernet and non-ipv4 ARP */ -if (arp->ar_hrd !=htons (ARPHRD_ETHER ) - || arp->ar_pro !=htons (ETH_P_IP ) - || arp->ar_pln !=4 || arp->ar_hln !=ETH_ALEN ) +if (arp->ar_hrd !=htons (ARPHRD_ETHER ) || + arp->ar_pro !=htons (ETH_P_IP ) || + arp->ar_pln !=4 || arp->ar_hln !=ETH_ALEN )return NF_ACCEPT ;/* we only want to mangle arp requests and replies */ -if (arp->ar_op !=htons (ARPOP_REPLY ) - && arp->ar_op !=htons (ARPOP_REQUEST )) +if (arp->ar_op !=htons (ARPOP_REPLY ) && + arp->ar_op !=htons (ARPOP_REQUEST ))return NF_ACCEPT ; payload = (void *)(arp+1 );
net/ipv4/netfilter/ipt_ECN.c +4 -4
@@ -85,8 +85,8 @@ ecn_tg(struct sk_buff *skb, const struct xt_target_param *par)if (!set_ect_ip (skb, einfo))return NF_DROP ; -if (einfo->operation & (IPT_ECN_OP_SET_ECE |IPT_ECN_OP_SET_CWR ) - &&ip_hdr (skb)->protocol ==IPPROTO_TCP ) +if (einfo->operation & (IPT_ECN_OP_SET_ECE |IPT_ECN_OP_SET_CWR ) && +ip_hdr (skb)->protocol ==IPPROTO_TCP )if (!set_ect_tcp (skb, einfo))return NF_DROP ;
@@ -108,8 +108,8 @@ static bool ecn_tg_check(const struct xt_tgchk_param *par) einfo->ip_ect);return false; } -if ((einfo->operation & (IPT_ECN_OP_SET_ECE |IPT_ECN_OP_SET_CWR )) - && (e->ip.proto !=IPPROTO_TCP || (e->ip.invflags &XT_INV_PROTO ))) { +if ((einfo->operation & (IPT_ECN_OP_SET_ECE |IPT_ECN_OP_SET_CWR )) && + (e->ip.proto !=IPPROTO_TCP || (e->ip.invflags &XT_INV_PROTO ))) {printk (KERN_WARNING "ECN: cannot use TCP operations on a " "non-tcp rule\n" );return false;
net/ipv4/netfilter/ipt_LOG.c +11 -11
@@ -74,8 +74,8 @@ static void dump_packet(const struct nf_loginfo *info,if (ntohs (ih->frag_off) &IP_OFFSET )printk ("FRAG:%u " ,ntohs (ih->frag_off) &IP_OFFSET ); -if ((logflags &IPT_LOG_IPOPT ) - && ih->ihl *4 >sizeof (struct iphdr )) { +if ((logflags &IPT_LOG_IPOPT ) && + ih->ihl *4 >sizeof (struct iphdr )) {const unsigned char *op;unsigned char _opt[4 *15 -sizeof (struct iphdr )];unsigned int i, optsize;
@@ -146,8 +146,8 @@ static void dump_packet(const struct nf_loginfo *info,/* Max length: 11 "URGP=65535 " */ printk ("URGP=%u " ,ntohs (th->urg_ptr)); -if ((logflags &IPT_LOG_TCPOPT ) - && th->doff *4 >sizeof (struct tcphdr )) { +if ((logflags &IPT_LOG_TCPOPT ) && + th->doff *4 >sizeof (struct tcphdr )) {unsigned char _opt[4 *15 -sizeof (struct tcphdr )];const unsigned char *op;unsigned int i, optsize;
@@ -238,9 +238,9 @@ static void dump_packet(const struct nf_loginfo *info,printk ("TYPE=%u CODE=%u " , ich->type, ich->code);/* Max length: 25 "INCOMPLETE [65535 bytes] " */ -if (ich->type <=NR_ICMP_TYPES - && required_len[ich->type] - && skb->len-iphoff-ih->ihl*4 < required_len[ich->type]) { +if (ich->type <=NR_ICMP_TYPES && + required_len[ich->type] && + skb->len-iphoff-ih->ihl*4 < required_len[ich->type]) {printk ("INCOMPLETE [%u bytes] " , skb->len - iphoff - ih->ihl*4 );break ;
@@ -276,8 +276,8 @@ static void dump_packet(const struct nf_loginfo *info, }/* Max length: 10 "MTU=65535 " */ -if (ich->type ==ICMP_DEST_UNREACH - && ich->code ==ICMP_FRAG_NEEDED ) +if (ich->type ==ICMP_DEST_UNREACH && + ich->code ==ICMP_FRAG_NEEDED )printk ("MTU=%u " ,ntohs (ich->un.frag.mtu)); }break ;
@@ -407,8 +407,8 @@ ipt_log_packet(u_int8_t pf,if (in && !out) {/* MAC logging for input chain only. */ printk ("MAC=" ); -if (skb->dev && skb->dev->hard_header_len - && skb->mac_header != skb->network_header) { +if (skb->dev && skb->dev->hard_header_len && + skb->mac_header != skb->network_header) {int i;const unsigned char *p =skb_mac_header (skb);for (i =0 ; i < skb->dev->hard_header_len; i++,p++)
net/ipv4/netfilter/ipt_MASQUERADE.c +2 -2
@@ -59,8 +59,8 @@ masquerade_tg(struct sk_buff *skb, const struct xt_target_param *par) ct =nf_ct_get (skb, &ctinfo); nat =nfct_nat (ct); -NF_CT_ASSERT (ct && (ctinfo ==IP_CT_NEW || ctinfo ==IP_CT_RELATED - || ctinfo ==IP_CT_RELATED +IP_CT_IS_REPLY )); +NF_CT_ASSERT (ct && (ctinfo ==IP_CT_NEW || ctinfo ==IP_CT_RELATED || + ctinfo ==IP_CT_RELATED +IP_CT_IS_REPLY ));/* Source address is 0.0.0.0 - locally generated packet that is * probably not supposed to be masqueraded.
net/ipv4/netfilter/ipt_REJECT.c +2 -2
@@ -184,8 +184,8 @@ static bool reject_tg_check(const struct xt_tgchk_param *par)return false; }else if (rejinfo->with ==IPT_TCP_RESET ) {/* Must specify that it's a TCP packet */ -if (e->ip.proto !=IPPROTO_TCP - || (e->ip.invflags &XT_INV_PROTO )) { +if (e->ip.proto !=IPPROTO_TCP || + (e->ip.invflags &XT_INV_PROTO )) {printk ("ipt_REJECT: TCP_RESET invalid for non-tcp\n" );return false; }
net/ipv4/netfilter/ipt_ULOG.c +3 -3
@@ -226,9 +226,9 @@ static void ipt_ulog_packet(unsigned int hooknum,else *(pm->prefix) ='\0' ; -if (in && in->hard_header_len >0 - && skb->mac_header != skb->network_header - && in->hard_header_len <=ULOG_MAC_LEN ) { +if (in && in->hard_header_len >0 && + skb->mac_header != skb->network_header && + in->hard_header_len <=ULOG_MAC_LEN ) {memcpy (pm->mac,skb_mac_header (skb), in->hard_header_len); pm->mac_len = in->hard_header_len; }else
net/ipv4/netfilter/ipt_ecn.c +2 -2
@@ -96,8 +96,8 @@ static bool ecn_mt_check(const struct xt_mtchk_param *par)if (info->invert &IPT_ECN_OP_MATCH_MASK )return false; -if (info->operation & (IPT_ECN_OP_MATCH_ECE |IPT_ECN_OP_MATCH_CWR ) - && ip->proto !=IPPROTO_TCP ) { +if (info->operation & (IPT_ECN_OP_MATCH_ECE |IPT_ECN_OP_MATCH_CWR ) && + ip->proto !=IPPROTO_TCP ) {printk (KERN_WARNING "ipt_ecn: can't match TCP bits in rule for" " non-tcp packets\n" );return false;
net/ipv4/netfilter/iptable_mangle.c +2 -2
@@ -130,8 +130,8 @@ ipt_local_hook(unsigned int hook,u_int32_t mark;/* root is playing with raw sockets. */ -if (skb->len <sizeof (struct iphdr ) - ||ip_hdrlen (skb) <sizeof (struct iphdr )) +if (skb->len <sizeof (struct iphdr ) || +ip_hdrlen (skb) <sizeof (struct iphdr ))return NF_ACCEPT ;/* Save things which could affect route */
net/ipv4/netfilter/iptable_security.c +2 -2
@@ -94,8 +94,8 @@ ipt_local_out_hook(unsigned int hook, int (*okfn)(struct sk_buff *)) {/* Somebody is playing with raw sockets. */ -if (skb->len <sizeof (struct iphdr ) - ||ip_hdrlen (skb) <sizeof (struct iphdr )) +if (skb->len <sizeof (struct iphdr ) || +ip_hdrlen (skb) <sizeof (struct iphdr ))return NF_ACCEPT ;return ipt_do_table (skb, hook, in, out,dev_net (out)->ipv4.iptable_security);
net/ipv4/netfilter/nf_conntrack_proto_icmp.c +14 -14
@@ -54,8 +54,8 @@ static const u_int8_t invmap[] = {static bool icmp_invert_tuple (struct nf_conntrack_tuple *tuple,const struct nf_conntrack_tuple *orig) { -if (orig->dst.u.icmp.type >=sizeof (invmap) - || !invmap[orig->dst.u.icmp.type]) +if (orig->dst.u.icmp.type >=sizeof (invmap) || + !invmap[orig->dst.u.icmp.type])return false; tuple->src.u.icmp.id = orig->src.u.icmp.id;
@@ -101,8 +101,8 @@ static bool icmp_new(struct nf_conn *ct, const struct sk_buff *skb, [ICMP_ADDRESS] = 1 }; -if (ct->tuplehash[0 ].tuple.dst.u.icmp.type >=sizeof (valid_new) - || !valid_new[ct->tuplehash[0 ].tuple.dst.u.icmp.type]) { +if (ct->tuplehash[0 ].tuple.dst.u.icmp.type >=sizeof (valid_new) || + !valid_new[ct->tuplehash[0 ].tuple.dst.u.icmp.type]) {/* Can't create a new ICMP `conn' with this. */ pr_debug ("icmp: can't create new conn with type %u\n" , ct->tuplehash[0 ].tuple.dst.u.icmp.type);
@@ -201,11 +201,11 @@ icmp_error(struct net *net, struct sk_buff *skb, unsigned int dataoff, }/* Need to track icmp error message? */ -if (icmph->type !=ICMP_DEST_UNREACH - && icmph->type !=ICMP_SOURCE_QUENCH - && icmph->type !=ICMP_TIME_EXCEEDED - && icmph->type !=ICMP_PARAMETERPROB - && icmph->type !=ICMP_REDIRECT ) +if (icmph->type !=ICMP_DEST_UNREACH && + icmph->type !=ICMP_SOURCE_QUENCH && + icmph->type !=ICMP_TIME_EXCEEDED && + icmph->type !=ICMP_PARAMETERPROB && + icmph->type !=ICMP_REDIRECT )return NF_ACCEPT ;return icmp_error_message (net, skb, ctinfo, hooknum);
@@ -238,17 +238,17 @@ static const struct nla_policy icmp_nla_policy[CTA_PROTO_MAX+1] = {static int icmp_nlattr_to_tuple (struct nlattr *tb[],struct nf_conntrack_tuple *tuple) { -if (!tb[CTA_PROTO_ICMP_TYPE ] - || !tb[CTA_PROTO_ICMP_CODE ] - || !tb[CTA_PROTO_ICMP_ID ]) +if (!tb[CTA_PROTO_ICMP_TYPE ] || + !tb[CTA_PROTO_ICMP_CODE ] || + !tb[CTA_PROTO_ICMP_ID ])return -EINVAL ; tuple->dst.u.icmp.type =nla_get_u8 (tb[CTA_PROTO_ICMP_TYPE ]); tuple->dst.u.icmp.code =nla_get_u8 (tb[CTA_PROTO_ICMP_CODE ]); tuple->src.u.icmp.id =nla_get_be16 (tb[CTA_PROTO_ICMP_ID ]); -if (tuple->dst.u.icmp.type >=sizeof (invmap) - || !invmap[tuple->dst.u.icmp.type]) +if (tuple->dst.u.icmp.type >=sizeof (invmap) || + !invmap[tuple->dst.u.icmp.type])return -EINVAL ;return 0 ;
net/ipv4/netfilter/nf_nat_standalone.c +5 -5
@@ -197,11 +197,11 @@ nf_nat_out(unsigned int hooknum, (ct = nf_ct_get(skb, &ctinfo)) != NULL) {enum ip_conntrack_dir dir =CTINFO2DIR (ctinfo); -if (ct->tuplehash[dir].tuple.src.u3.ip != - ct->tuplehash[!dir].tuple.dst.u3.ip - || ct->tuplehash[dir].tuple.src.u.all != - ct->tuplehash[!dir].tuple.dst.u.all - ) +if ((ct->tuplehash[dir].tuple.src.u3.ip != + ct->tuplehash[!dir].tuple.dst.u3.ip) || + (ct->tuplehash[dir].tuple.src.u.all != + ct->tuplehash[!dir].tuple.dst.u.all) + )return ip_xfrm_me_harder (skb) ==0 ? ret :NF_DROP ; }#endif
net/ipv6/netfilter/ip6_tables.c +21 -21
84 lines not on this page · raw message
net/ipv6/netfilter/ip6t_LOG.c +2 -2
@@ -249,8 +249,8 @@ static void dump_packet(const struct nf_loginfo *info,/* Max length: 11 "URGP=65535 " */ printk ("URGP=%u " ,ntohs (th->urg_ptr)); -if ((logflags &IP6T_LOG_TCPOPT ) - && th->doff *4 >sizeof (struct tcphdr )) { +if ((logflags &IP6T_LOG_TCPOPT ) && + th->doff *4 >sizeof (struct tcphdr )) {u_int8_t _opt[60 -sizeof (struct tcphdr )];const u_int8_t *op;unsigned int i;
net/ipv6/netfilter/ip6t_REJECT.c +2 -2
@@ -223,8 +223,8 @@ static bool reject_tg6_check(const struct xt_tgchk_param *par)return false; }else if (rejinfo->with ==IP6T_TCP_RESET ) {/* Must specify that it's a TCP packet */ -if (e->ipv6.proto !=IPPROTO_TCP - || (e->ipv6.invflags &XT_INV_PROTO )) { +if (e->ipv6.proto !=IPPROTO_TCP || + (e->ipv6.invflags &XT_INV_PROTO )) {printk ("ip6t_REJECT: TCP_RESET illegal for non-tcp\n" );return false; }
net/ipv6/netfilter/ip6t_ah.c +8 -11
@@ -77,17 +77,14 @@ static bool ah_mt6(const struct sk_buff *skb, const struct xt_match_param *par) ahinfo->hdrres, ah->reserved, !(ahinfo->hdrres && ah->reserved)); -return (ah !=NULL ) - && -spi_match (ahinfo->spis[0 ], ahinfo->spis[1 ], -ntohl (ah->spi), - !!(ahinfo->invflags &IP6T_AH_INV_SPI )) - && - (!ahinfo->hdrlen || - (ahinfo->hdrlen == hdrlen) ^ - !!(ahinfo->invflags &IP6T_AH_INV_LEN )) - && - !(ahinfo->hdrres && ah->reserved); +return (ah !=NULL ) && +spi_match (ahinfo->spis[0 ], ahinfo->spis[1 ], +ntohl (ah->spi), + !!(ahinfo->invflags &IP6T_AH_INV_SPI )) && + (!ahinfo->hdrlen || + (ahinfo->hdrlen == hdrlen) ^ + !!(ahinfo->invflags &IP6T_AH_INV_LEN )) && + !(ahinfo->hdrres && ah->reserved); }static bool ah_mt6_check (const struct xt_mtchk_param *par)
net/ipv6/netfilter/ip6t_frag.c +21 -26
62 lines not on this page · raw message
net/ipv6/netfilter/ip6t_rt.c +3 -6
@@ -92,16 +92,13 @@ static bool rt_mt6(const struct sk_buff *skb, const struct xt_match_param *par) !((rtinfo->flags &IP6T_RT_RES ) && (((const struct rt0_hdr *)rh)->reserved))); - ret = (rh !=NULL ) - && + ret = (rh !=NULL ) && (segsleft_match (rtinfo->segsleft[0 ], rtinfo->segsleft[1 ], rh->segments_left, - !!(rtinfo->invflags &IP6T_RT_INV_SGS ))) - && + !!(rtinfo->invflags &IP6T_RT_INV_SGS ))) && (!(rtinfo->flags &IP6T_RT_LEN ) || ((rtinfo->hdrlen == hdrlen) ^ - !!(rtinfo->invflags &IP6T_RT_INV_LEN ))) - && + !!(rtinfo->invflags &IP6T_RT_INV_LEN ))) && (!(rtinfo->flags &IP6T_RT_TYP ) || ((rtinfo->rt_type == rh->type) ^ !!(rtinfo->invflags &IP6T_RT_INV_TYP )));
net/ipv6/netfilter/ip6table_filter.c +2 -2
@@ -79,8 +79,8 @@ ip6t_local_out_hook(unsigned int hook, {#if 0 /* root is playing with raw sockets. */ -if (skb->len <sizeof (struct iphdr ) - ||ip_hdrlen (skb) <sizeof (struct iphdr )) { +if (skb->len <sizeof (struct iphdr ) || +ip_hdrlen (skb) <sizeof (struct iphdr )) {if (net_ratelimit ())printk ("ip6t_hook: happy cracking.\n" );return NF_ACCEPT ;
net/ipv6/netfilter/ip6table_mangle.c +7 -7
@@ -102,8 +102,8 @@ ip6t_local_out_hook(unsigned int hook,#if 0 /* root is playing with raw sockets. */ -if (skb->len <sizeof (struct iphdr ) - ||ip_hdrlen (skb) <sizeof (struct iphdr )) { +if (skb->len <sizeof (struct iphdr ) || +ip_hdrlen (skb) <sizeof (struct iphdr )) {if (net_ratelimit ())printk ("ip6t_hook: happy cracking.\n" );return NF_ACCEPT ;
@@ -122,11 +122,11 @@ ip6t_local_out_hook(unsigned int hook, ret =ip6t_do_table (skb, hook, in, out,dev_net (out)->ipv6.ip6table_mangle); -if (ret !=NF_DROP && ret !=NF_STOLEN - && (memcmp (&ipv6_hdr (skb)->saddr, &saddr,sizeof (saddr)) - ||memcmp (&ipv6_hdr (skb)->daddr, &daddr,sizeof (daddr)) - || skb->mark != mark - ||ipv6_hdr (skb)->hop_limit != hop_limit)) +if (ret !=NF_DROP && ret !=NF_STOLEN && + (memcmp (&ipv6_hdr (skb)->saddr, &saddr,sizeof (saddr)) || +memcmp (&ipv6_hdr (skb)->daddr, &daddr,sizeof (daddr)) || + skb->mark != mark || +ipv6_hdr (skb)->hop_limit != hop_limit))return ip6_route_me_harder (skb) ==0 ? ret :NF_DROP ;return ret;
net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +6 -6
@@ -244,18 +244,18 @@ static const struct nla_policy icmpv6_nla_policy[CTA_PROTO_MAX+1] = {static int icmpv6_nlattr_to_tuple (struct nlattr *tb[],struct nf_conntrack_tuple *tuple) { -if (!tb[CTA_PROTO_ICMPV6_TYPE ] - || !tb[CTA_PROTO_ICMPV6_CODE ] - || !tb[CTA_PROTO_ICMPV6_ID ]) +if (!tb[CTA_PROTO_ICMPV6_TYPE ] || + !tb[CTA_PROTO_ICMPV6_CODE ] || + !tb[CTA_PROTO_ICMPV6_ID ])return -EINVAL ; tuple->dst.u.icmp.type =nla_get_u8 (tb[CTA_PROTO_ICMPV6_TYPE ]); tuple->dst.u.icmp.code =nla_get_u8 (tb[CTA_PROTO_ICMPV6_CODE ]); tuple->src.u.icmp.id =nla_get_be16 (tb[CTA_PROTO_ICMPV6_ID ]); -if (tuple->dst.u.icmp.type <128 - || tuple->dst.u.icmp.type -128 >=sizeof (invmap) - || !invmap[tuple->dst.u.icmp.type -128 ]) +if (tuple->dst.u.icmp.type <128 || + tuple->dst.u.icmp.type -128 >=sizeof (invmap) || + !invmap[tuple->dst.u.icmp.type -128 ])return -EINVAL ;return 0 ;
Patrick McHardy
AppliedRe: [net-next-2.6 PATCH] net/ipv[46]/netfilter: Move && and || to end of previous line
Quoted 6 lines · Joe Perches
Quoted 4 lines · David Miller
It should be of the form:
if (x && y)
Quoted 9 lines
Quoted 6 lines
or:
if (x && y)Fix patches, rather than complaints, for existing cases where things do not follow this pattern are certainly welcome.
Compile tested only.
Applied, thanks for cleaning this up.
RFC PATCH v7 6/7 TCPCT part 1f: Initiator Cookie => Responder
In reply to William Allen SimpsonCalculate and format <SYN> TCP_COOKIE option.
This is a significantly revised implementation of an earlier (year-old) patch that no longer applies cleanly, with permission of the original author (Adam Langley):
http://thread.gmane.org/gmane.linux.network/102586
Requires:
TCPCT part 1c: sysctl_tcp_cookie_size, socket option TCP_COOKIE_TRANSACTIONS TCPCT part 1d: define TCP cookie option, extend existing struct's
--- net/ipv4/tcp_output.c | 182 ++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 158 insertions(+), 24 deletions(-)
net/ipv4/tcp_output.c +158 -24
@@ -370,15 +370,45 @@ static inline int tcp_urg_mode(const struct tcp_sock *tp)#define OPTION_TS (1 << 1)#define OPTION_MD5 (1 << 2)#define OPTION_WSCALE (1 << 3) +#define OPTION_COOKIE_EXTENSION (1 << 4)struct tcp_out_options {u8 options;/* bit field of OPTION_* */ u8 ws;/* window scale, 0 to disable */ u8 num_sack_blocks;/* number of SACK blocks to include */ +u8 hash_size;/* bytes in hash_location */ u16 mss;/* 0 to disable */ __u32 tsval, tsecr;/* need to include OPTION_TS */ +__u8 *hash_location;/* temporary pointer, overloaded */ }; +/* The sysctl int routines are generic, so check consistency here. +*/ +static u8 tcp_cookie_size_check (u8 desired) +{ +if (desired >0 ) { +/* previously specified */ +return desired; + } +if (sysctl_tcp_cookie_size <=0 ) { +/* no default specified */ +return 0 ; + } +if (sysctl_tcp_cookie_size <=TCP_COOKIE_MIN ) { +/* value too small, specify minimum */ +return TCP_COOKIE_MIN ; + } +if (sysctl_tcp_cookie_size >=TCP_COOKIE_MAX ) { +/* value too large, specify maximum */ +return TCP_COOKIE_MAX ; + } +if (0x1 & sysctl_tcp_cookie_size) { +/* 8-bit multiple, illegal, fix it */ +return (u8)(sysctl_tcp_cookie_size +0x1 ); + } +return (u8 )sysctl_tcp_cookie_size; +} +/* Write previously computed TCP options to the packet. * * Beware: Something in the Internet is very sensitive to the ordering of
@@ -393,17 +423,34 @@ struct tcp_out_options {* (but it may well be that other scenarios fail similarly). */ static void tcp_options_write (__be32 *ptr,struct tcp_sock *tp, -const struct tcp_out_options *opts, -__u8 **md5_hash) { -if (unlikely (OPTION_MD5 & opts->options)) { - *ptr++ =htonl ((TCPOPT_NOP <<24 ) | - (TCPOPT_NOP <<16 ) | - (TCPOPT_MD5SIG <<8 ) | -TCPOLEN_MD5SIG ); - *md5_hash = (__u8 *)ptr; +struct tcp_out_options *opts) +{ +u8 options = opts->options;/* mungable copy */ + +/* Having both authentication and cookies for security is redundant, +* and there's certainly not enough room. Instead, the cookie-less +* extension variant is proposed. +* +* Consider the pessimal case with authentication. The options +* could look like: +* COOKIE|MD5(20) + MSS(4) + SACK|TS(12) + WSCALE(4) == 40 +*/ +if (unlikely (OPTION_MD5 & options)) { +if (unlikely (OPTION_COOKIE_EXTENSION & options)) { + *ptr++ =htonl ((TCPOPT_COOKIE <<24 ) | + (TCPOLEN_COOKIE_BASE <<16 ) | + (TCPOPT_MD5SIG <<8 ) | +TCPOLEN_MD5SIG ); + }else { + *ptr++ =htonl ((TCPOPT_NOP <<24 ) | + (TCPOPT_NOP <<16 ) | + (TCPOPT_MD5SIG <<8 ) | +TCPOLEN_MD5SIG ); + } + options &= ~OPTION_COOKIE_EXTENSION ; +/* overload cookie hash location */ + opts->hash_location = (__u8 *)ptr; ptr +=4 ; - }else { - *md5_hash =NULL ; }if (unlikely (opts->mss)) {
@@ -412,12 +459,13 @@ static void tcp_options_write(__be32 *ptr, struct tcp_sock *tp, opts->mss); } -if (likely (OPTION_TS & opts->options)) { -if (unlikely (OPTION_SACK_ADVERTISE & opts->options)) { +if (likely (OPTION_TS & options)) { +if (unlikely (OPTION_SACK_ADVERTISE & options)) { *ptr++ =htonl ((TCPOPT_SACK_PERM <<24 ) | (TCPOLEN_SACK_PERM <<16 ) | (TCPOPT_TIMESTAMP <<8 ) |TCPOLEN_TIMESTAMP ); + options &= ~OPTION_SACK_ADVERTISE ; }else { *ptr++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
@@ -428,15 +476,52 @@ static void tcp_options_write(__be32 *ptr, struct tcp_sock *tp, *ptr++ =htonl (opts->tsecr); } -if (unlikely (OPTION_SACK_ADVERTISE & opts->options && - !(OPTION_TS & opts->options))) { +/* Specification requires after timestamp, so do it now. +* +* Consider the pessimal case without authentication. The options +* could look like: +* MSS(4) + SACK|TS(12) + COOKIE(20) + WSCALE(4) == 40 +*/ +if (unlikely (OPTION_COOKIE_EXTENSION & options)) { +__u8 *cookie_copy = opts->hash_location; +u8 cookie_size = opts->hash_size; + +/* 8-bit multiple handled in tcp_cookie_size_check() above, +* and elsewhere. +*/ +if (0x2 & cookie_size) { +__u8 *p = (__u8 *)ptr; + +/* 16-bit multiple */ + *p++ =TCPOPT_COOKIE ; + *p++ =TCPOLEN_COOKIE_BASE + cookie_size; + *p++ = *cookie_copy++; + *p++ = *cookie_copy++; + ptr++; + cookie_size -=2 ; + }else { +/* 32-bit multiple */ + *ptr++ =htonl (((TCPOPT_NOP <<24 ) | + (TCPOPT_NOP <<16 ) | + (TCPOPT_COOKIE <<8 ) | +TCPOLEN_COOKIE_BASE ) + + cookie_size); + } + +if (cookie_size >0 ) { +memcpy (ptr, cookie_copy, cookie_size); + ptr += (cookie_size /4 ); + } + } + +if (unlikely (OPTION_SACK_ADVERTISE & options)) { *ptr++ =htonl ((TCPOPT_NOP <<24 ) | (TCPOPT_NOP <<16 ) | (TCPOPT_SACK_PERM <<8 ) |TCPOLEN_SACK_PERM ); } -if (unlikely (OPTION_WSCALE & opts->options)) { +if (unlikely (OPTION_WSCALE & options)) { *ptr++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_WINDOW << 16) | (TCPOLEN_WINDOW << 8) |
@@ -471,8 +556,12 @@ static unsigned tcp_syn_options(struct sock *sk, struct sk_buff *skb,struct tcp_out_options *opts, struct tcp_md5sig_key **md5) { struct tcp_sock *tp = tcp_sk(sk); -unsigned size =0 ; +struct tcp_cookie_values *cvp = tp->cookie_values;struct dst_entry *dst =__sk_dst_get (sk); +unsigned size =0 ; +u8 cookie_size = (!tp->rx_opt.cookie_out_never && cvp !=NULL ) + ?tcp_cookie_size_check (cvp->cookie_desired) + :0 ;#ifdef CONFIG_TCP_MD5SIG *md5 = tp->af_specific->md5_lookup (sk, sk);
@@ -517,6 +606,53 @@ static unsigned tcp_syn_options(struct sock *sk, struct sk_buff *skb, size +=TCPOLEN_SACKPERM_ALIGNED ; } +/* Note that timestamps are required by the specification. +* +* Odd numbers of bytes are prohibited by the specification, ensuring +* that the cookie is 16-bit aligned, and the resulting cookie pair is +* 32-bit aligned. +*/ +if (*md5 ==NULL + && (OPTION_TS & opts->options) + && cookie_size >0 ) { +int need =TCPOLEN_COOKIE_BASE + cookie_size; +int remaining =MAX_TCP_OPTION_SPACE - size; + +if (0x2 & need) { +/* 32-bit multiple */ + need +=2 ;/* NOPs */ + +if (need > remaining) { +/* try shrinking cookie to fit */ + cookie_size -=2 ; + need -=4 ; + } + } +while (need > remaining &&TCP_COOKIE_MIN <= cookie_size) { + cookie_size -=4 ; + need -=4 ; + } +if (TCP_COOKIE_MIN <= cookie_size) { + opts->options |=OPTION_COOKIE_EXTENSION ; + opts->hash_location = (__u8 *)&cvp->cookie_pair[0 ]; + opts->hash_size = cookie_size; + +/* Remember for future incarnations. */ + cvp->cookie_desired = cookie_size; + +if (cvp->cookie_desired != cvp->cookie_pair_size) { +/* Currently use random bytes as a nonce, +* assuming these are completely unpredictable +* by hostile users of the same system. +*/ +get_random_bytes (&cvp->cookie_pair[0 ], + cookie_size); + cvp->cookie_pair_size = cookie_size; + } + + size += need; + } + }return size; }
@@ -632,7 +768,6 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,struct tcp_out_options opts;unsigned tcp_options_size, tcp_header_size;struct tcp_md5sig_key *md5; -__u8 *md5_hash_location;struct tcphdr *th;int err;
@@ -703,7 +838,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, } } -tcp_options_write ((__be32 *)(th +1 ), tp, &opts, &md5_hash_location); +tcp_options_write ((__be32 *)(th +1 ), tp, &opts);if (likely ((tcb->flags &TCPCB_FLAG_SYN ) ==0 ))TCP_ECN_send (sk, skb, tcp_header_size);
@@ -711,7 +846,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,/* Calculate the MD5 hash, as we have all we need now */ if (md5) { sk->sk_route_caps &= ~NETIF_F_GSO_MASK ; - tp->af_specific->calc_md5_hash (md5_hash_location, + tp->af_specific->calc_md5_hash (opts.hash_location, md5, sk,NULL , skb); }#endif
@@ -2235,14 +2370,13 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst,struct request_sock *req, struct request_values *rvp) { + struct tcp_out_options opts;struct inet_request_sock *ireq =inet_rsk (req);struct tcp_sock *tp =tcp_sk (sk);struct tcphdr *th; -int tcp_header_size; -struct tcp_out_options opts;struct sk_buff *skb;struct tcp_md5sig_key *md5; -__u8 *md5_hash_location; +int tcp_header_size;int mss; skb =sock_wmalloc (sk,MAX_TCP_HEADER +15 ,1 ,GFP_ATOMIC );
@@ -2303,14 +2437,14 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst,/* RFC1323: The window in SYN & SYN/ACK segments is never scaled. */ th->window =htons (min (req->rcv_wnd,65535U )); -tcp_options_write ((__be32 *)(th +1 ), tp, &opts, &md5_hash_location); +tcp_options_write ((__be32 *)(th +1 ), tp, &opts); th->doff = (tcp_header_size >>2 );TCP_INC_STATS (sock_net (sk),TCP_MIB_OUTSEGS );#ifdef CONFIG_TCP_MD5SIG /* Okay, we have all we need - do the md5 hash if needed */ if (md5) { -tcp_rsk (req)->af_specific->calc_md5_hash (md5_hash_location, +tcp_rsk (req)->af_specific->calc_md5_hash (opts.hash_location, md5,NULL , req, skb); }#endif
Signature · 1 line
1.6.3.3
David Miller
maintainerRe: [net-next-2.6 PATCH v7 6/7 RFC] TCPCT part 1f: Initiator Cookie => Responder
From: William Allen Simpson <[email protected]>
Date: Fri, 20 Nov 2009 09:55:45 -0500
net/ipv4/tcp_output.c static unsigned tcp_syn_options(struct sock *sk, struct sk_buff *skb, · line 564
Quoted 3 lines
net/ipv4/tcp_output.c +3
-0+u8 cookie_size = (!tp->rx_opt.cookie_out_never && cvp !=NULL ) + ?tcp_cookie_size_check (cvp->cookie_desired) + :0 ;
Please put the "?" and ":" and the end of the previous line not at the beginning of the next one.
net/ipv4/tcp_output.c static unsigned tcp_syn_options(struct sock *sk, struct sk_buff *skb, · line 617
Quoted 4 lines
net/ipv4/tcp_output.c +3
-0+if (*md5 ==NULL + && (OPTION_TS & opts->options) + && cookie_size >0 ) {
Please fix up the coding style of this conditional. The '&&' belongs at the end of the previous line and the indentation is not correct here.
Thanks.
RFC PATCH v7 7/7 TCPCT part 1g: Responder Cookie => Initiator
In reply to William Allen SimpsonParse incoming TCP_COOKIE option(s).
Calculate <SYN,ACK> TCP_COOKIE option.
Send optional <SYN,ACK> data.
This is a significantly revised implementation of an earlier (year-old) patch that no longer applies cleanly, with permission of the original author (Adam Langley):
http://thread.gmane.org/gmane.linux.network/102586
Requires:
TCPCT part 1a: add request_values parameter for sending SYNACK TCPCT part 1b: generate Responder Cookie secret
TCPCT part 1c: sysctl_tcp_cookie_size, socket option TCP_COOKIE_TRANSACTIONS TCPCT part 1d: define TCP cookie option, extend existing struct's TCPCT part 1e: implement socket option TCP_COOKIE_TRANSACTIONS TCPCT part 1f: Initiator Cookie => Responder
--- include/net/tcp.h | 1 + net/ipv4/syncookies.c | 5 ++- net/ipv4/tcp_input.c | 77 +++++++++++++++++++++++++++++++++++++++------ net/ipv4/tcp_ipv4.c | 46 +++++++++++++++++++++++++-- net/ipv4/tcp_minisocks.c | 14 +++++--- net/ipv4/tcp_output.c | 76 +++++++++++++++++++++++++++++++++++++++++++-- net/ipv6/syncookies.c | 5 ++- net/ipv6/tcp_ipv6.c | 51 +++++++++++++++++++++++++++++- 8 files changed, 244 insertions(+), 31 deletions(-)
include/net/tcp.h +1 -0
@@ -407,6 +407,7 @@ extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk,extern void tcp_parse_options (struct sk_buff *skb,struct tcp_options_received *opt_rx, +u8 **hvpp,int estab,struct dst_entry *dst);
net/ipv4/syncookies.c +3 -2
@@ -253,6 +253,8 @@ EXPORT_SYMBOL(cookie_check_timestamp);struct sock *cookie_v4_check (struct sock *sk,struct sk_buff *skb,struct ip_options *opt) { +struct tcp_options_received tcp_opt; +u8 *hash_location;struct inet_request_sock *ireq;struct tcp_request_sock *treq;struct tcp_sock *tp =tcp_sk (sk);
@@ -263,7 +265,6 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,int mss;struct rtable *rt;__u8 rcv_wscale; -struct tcp_options_received tcp_opt;if (!sysctl_tcp_syncookies || !th->ack) goto out;
@@ -341,7 +342,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,/* check for timestamp cookie support */ memset (&tcp_opt,0 ,sizeof (tcp_opt)); -tcp_parse_options (skb, &tcp_opt,0 , &rt->u.dst); +tcp_parse_options (skb, &tcp_opt, &hash_location,0 , &rt->u.dst);if (tcp_opt.saw_tstamp)cookie_check_timestamp (&tcp_opt);
net/ipv4/tcp_input.c +66 -11
126 lines not on this page · raw message
net/ipv4/tcp_ipv4.c +42 -4
73 lines not on this page · raw message
net/ipv4/tcp_minisocks.c +8 -6
@@ -96,13 +96,14 @@ enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *tw, struct sk_buff *skb, const struct tcphdr *th) { - struct tcp_timewait_sock *tcptw = tcp_twsk((struct sock *)tw); struct tcp_options_received tmp_opt; +u8 *hash_location; +struct tcp_timewait_sock *tcptw =tcp_twsk ((struct sock *)tw);int paws_reject =0 ;if (th->doff > (sizeof (*th) >>2 ) && tcptw->tw_ts_recent_stamp) { tmp_opt.tstamp_ok =1 ; -tcp_parse_options (skb, &tmp_opt,1 ,NULL ); +tcp_parse_options (skb, &tmp_opt, &hash_location,1 ,NULL );if (tmp_opt.saw_tstamp) { tmp_opt.ts_recent = tcptw->tw_ts_recent;
@@ -524,15 +525,16 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,struct request_sock *req, struct request_sock **prev) { + struct tcp_options_received tmp_opt; +u8 *hash_location; +struct sock *child;const struct tcphdr *th =tcp_hdr (skb);__be32 flg =tcp_flag_word (th) & (TCP_FLAG_RST |TCP_FLAG_SYN |TCP_FLAG_ACK );int paws_reject =0 ; -struct tcp_options_received tmp_opt; -struct sock *child; -if ((th->doff > (sizeof (struct tcphdr )>>2 )) && (req->ts_recent)) { +if ((th->doff > (sizeof (*th) >>2 )) && (req->ts_recent)) { tmp_opt.tstamp_ok =1 ; -tcp_parse_options (skb, &tmp_opt,1 ,NULL ); +tcp_parse_options (skb, &tmp_opt, &hash_location,1 ,NULL );if (tmp_opt.saw_tstamp) { tmp_opt.ts_recent = req->ts_recent;
net/ipv4/tcp_output.c +72 -4
107 lines not on this page · raw message
net/ipv6/syncookies.c +3 -2
@@ -159,6 +159,8 @@ static inline int cookie_check(struct sk_buff *skb, __u32 cookie)struct sock *cookie_v6_check (struct sock *sk,struct sk_buff *skb) { +struct tcp_options_received tcp_opt; +u8 *hash_location;struct inet_request_sock *ireq;struct inet6_request_sock *ireq6;struct tcp_request_sock *treq;
@@ -171,7 +173,6 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)int mss;struct dst_entry *dst;__u8 rcv_wscale; -struct tcp_options_received tcp_opt;if (!sysctl_tcp_syncookies || !th->ack) goto out;
@@ -254,7 +255,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)/* check for timestamp cookie support */ memset (&tcp_opt,0 ,sizeof (tcp_opt)); -tcp_parse_options (skb, &tcp_opt,0 , dst); +tcp_parse_options (skb, &tcp_opt, &hash_location,0 , dst);if (tcp_opt.saw_tstamp)cookie_check_timestamp (&tcp_opt);
net/ipv6/tcp_ipv6.c +49 -2
71 lines not on this page · raw message
Signature · 1 line
1.6.3.3
David Miller
maintainerRe: [net-next-2.6 PATCH v7 7/7 RFC] TCPCT part 1g: Responder Cookie => Initiator
From: William Allen Simpson <[email protected]>
Date: Fri, 20 Nov 2009 10:06:40 -0500
net/ipv4/tcp_input.c out: · line 5112
Quoted 6 lines
net/ipv4/tcp_input.c +3
-2/* RFC1323: H1. Apply PAWS check first. */ -if (tcp_fast_parse_options (skb, th, tp) && tp->rx_opt.saw_tstamp && -tcp_paws_discard (sk, skb)) { +if (tcp_fast_parse_options (skb, th, tp, &hash_location) + && tp->rx_opt.saw_tstamp + &&tcp_paws_discard (sk, skb)) {
Please fix this conditional's coding style. The '&&' belongs at the end of the previous line not at the beginning of the next one. Also the indentation is not correct.
net/ipv4/tcp_input.c static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, · line 5506
Quoted 4 lines
net/ipv4/tcp_input.c +4
-0+ +if (cvp !=NULL + && cvp->cookie_pair_size >0 + && tp->rx_opt.cookie_plus >0 ) {
Likewise.
net/ipv4/tcp_ipv4.c int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) · line 1285
Quoted 6 lines
net/ipv4/tcp_ipv4.c +6
-0+if (tmp_opt.cookie_plus >0 + && tmp_opt.saw_tstamp + && !tp->rx_opt.cookie_out_never + && (sysctl_tcp_cookie_size >0 + || (tp->cookie_values !=NULL + && tp->cookie_values->cookie_desired >0 ))) {
Likewise.
net/ipv4/tcp_output.c static unsigned tcp_synack_options(struct sock *sk, · line 715
Quoted 6 lines
net/ipv4/tcp_output.c +6
-0+/* Similar rationale to tcp_syn_options() applies here, too. +* If the <SYN> options fit, the same options should fit now! +*/ +if (*md5 ==NULL + && doing_ts + && cookie_plus >TCPOLEN_COOKIE_BASE ) {
Likewise.
net/ipv4/tcp_output.c struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst, · line 2470
Quoted 3 lines
net/ipv4/tcp_output.c +3
-0+if (cvp !=NULL + && cvp->s_data_constant + && cvp->s_data_desired >0 ) {
Likewise.
net/ipv4/tcp_ipv4.c int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) · line 1285
Quoted 6 lines
net/ipv4/tcp_ipv4.c +6
-0+if (tmp_opt.cookie_plus >0 + && tmp_opt.saw_tstamp + && !tp->rx_opt.cookie_out_never + && (sysctl_tcp_cookie_size >0 + || (tp->cookie_values !=NULL + && tp->cookie_values->cookie_desired >0 ))) {
Likewise.
Thanks.