aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/drivers
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-05-06 17:51:02 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 15:13:00 -0400
commit56bd194bb200ef0c49517de67a7d7f4b043b11b1 (patch)
tree2c180ee0e18e0e18b997a8a14d84505f0388f1c7 /arch/um/drivers
parentb47d2debf229469c78af4145ee7ad35a0f21b67f (diff)
uml: driver formatting fixes
Fix a bunch of formatting violations in the drivers: return(n) -> return n whitespace fixes emacs formatting comment removal breaking if(foo) return(n) into two lines There are also a couple of errno use bugs: using errno in a printk when the failure put errno into a local variable saving errno after a printk, which can change it Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um/drivers')
-rw-r--r--arch/um/drivers/chan_user.c2
-rw-r--r--arch/um/drivers/daemon_user.c25
-rw-r--r--arch/um/drivers/mcast_user.c12
-rw-r--r--arch/um/drivers/pcap_user.c33
-rw-r--r--arch/um/drivers/ubd_user.c15
5 files changed, 27 insertions, 60 deletions
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c
index 0cad3546cb89..77d3fdb0c21a 100644
--- a/arch/um/drivers/chan_user.c
+++ b/arch/um/drivers/chan_user.c
@@ -158,7 +158,7 @@ static int winch_tramp(int fd, struct tty_struct *tty, int *fd_out)
158 */ 158 */
159 err = run_helper_thread(winch_thread, &data, CLONE_FILES, &stack, 0); 159 err = run_helper_thread(winch_thread, &data, CLONE_FILES, &stack, 0);
160 if(err < 0){ 160 if(err < 0){
161 printk("fork of winch_thread failed - errno = %d\n", errno); 161 printk("fork of winch_thread failed - errno = %d\n", err);
162 goto out_close; 162 goto out_close;
163 } 163 }
164 164
diff --git a/arch/um/drivers/daemon_user.c b/arch/um/drivers/daemon_user.c
index 021b82c7a759..09d1de90297c 100644
--- a/arch/um/drivers/daemon_user.c
+++ b/arch/um/drivers/daemon_user.c
@@ -39,11 +39,11 @@ static struct sockaddr_un *new_addr(void *name, int len)
39 sun = um_kmalloc(sizeof(struct sockaddr_un)); 39 sun = um_kmalloc(sizeof(struct sockaddr_un));
40 if(sun == NULL){ 40 if(sun == NULL){
41 printk("new_addr: allocation of sockaddr_un failed\n"); 41 printk("new_addr: allocation of sockaddr_un failed\n");
42 return(NULL); 42 return NULL;
43 } 43 }
44 sun->sun_family = AF_UNIX; 44 sun->sun_family = AF_UNIX;
45 memcpy(sun->sun_path, name, len); 45 memcpy(sun->sun_path, name, len);
46 return(sun); 46 return sun;
47} 47}
48 48
49static int connect_to_switch(struct daemon_data *pri) 49static int connect_to_switch(struct daemon_data *pri)
@@ -112,7 +112,7 @@ static int connect_to_switch(struct daemon_data *pri)
112 } 112 }
113 113
114 pri->data_addr = sun; 114 pri->data_addr = sun;
115 return(fd); 115 return fd;
116 116
117 out_free: 117 out_free:
118 kfree(sun); 118 kfree(sun);
@@ -120,7 +120,7 @@ static int connect_to_switch(struct daemon_data *pri)
120 os_close_file(fd); 120 os_close_file(fd);
121 out: 121 out:
122 os_close_file(pri->control); 122 os_close_file(pri->control);
123 return(err); 123 return err;
124} 124}
125 125
126static void daemon_user_init(void *data, void *dev) 126static void daemon_user_init(void *data, void *dev)
@@ -152,7 +152,7 @@ static void daemon_user_init(void *data, void *dev)
152static int daemon_open(void *data) 152static int daemon_open(void *data)
153{ 153{
154 struct daemon_data *pri = data; 154 struct daemon_data *pri = data;
155 return(pri->fd); 155 return pri->fd;
156} 156}
157 157
158static void daemon_remove(void *data) 158static void daemon_remove(void *data)
@@ -176,12 +176,12 @@ int daemon_user_write(int fd, void *buf, int len, struct daemon_data *pri)
176{ 176{
177 struct sockaddr_un *data_addr = pri->data_addr; 177 struct sockaddr_un *data_addr = pri->data_addr;
178 178
179 return(net_sendto(fd, buf, len, data_addr, sizeof(*data_addr))); 179 return net_sendto(fd, buf, len, data_addr, sizeof(*data_addr));
180} 180}
181 181
182static int daemon_set_mtu(int mtu, void *data) 182static int daemon_set_mtu(int mtu, void *data)
183{ 183{
184 return(mtu); 184 return mtu;
185} 185}
186 186
187const struct net_user_info daemon_user_info = { 187const struct net_user_info daemon_user_info = {
@@ -194,14 +194,3 @@ const struct net_user_info daemon_user_info = {
194 .delete_address = NULL, 194 .delete_address = NULL,
195 .max_packet = MAX_PACKET - ETH_HEADER_OTHER 195 .max_packet = MAX_PACKET - ETH_HEADER_OTHER
196}; 196};
197
198/*
199 * Overrides for Emacs so that we follow Linus's tabbing style.
200 * Emacs will notice this stuff at the end of the file and automatically
201 * adjust the settings for this buffer only. This must remain at the end
202 * of the file.
203 * ---------------------------------------------------------------------------
204 * Local variables:
205 * c-file-style: "linux"
206 * End:
207 */
diff --git a/arch/um/drivers/mcast_user.c b/arch/um/drivers/mcast_user.c
index b827e82884c9..cfaa2cc43139 100644
--- a/arch/um/drivers/mcast_user.c
+++ b/arch/um/drivers/mcast_user.c
@@ -34,12 +34,12 @@ static struct sockaddr_in *new_addr(char *addr, unsigned short port)
34 sin = um_kmalloc(sizeof(struct sockaddr_in)); 34 sin = um_kmalloc(sizeof(struct sockaddr_in));
35 if(sin == NULL){ 35 if(sin == NULL){
36 printk("new_addr: allocation of sockaddr_in failed\n"); 36 printk("new_addr: allocation of sockaddr_in failed\n");
37 return(NULL); 37 return NULL;
38 } 38 }
39 sin->sin_family = AF_INET; 39 sin->sin_family = AF_INET;
40 sin->sin_addr.s_addr = in_aton(addr); 40 sin->sin_addr.s_addr = in_aton(addr);
41 sin->sin_port = htons(port); 41 sin->sin_port = htons(port);
42 return(sin); 42 return sin;
43} 43}
44 44
45static void mcast_user_init(void *data, void *dev) 45static void mcast_user_init(void *data, void *dev)
@@ -107,8 +107,8 @@ static int mcast_open(void *data)
107 err = -errno; 107 err = -errno;
108 printk("mcast_open : data bind failed, errno = %d\n", errno); 108 printk("mcast_open : data bind failed, errno = %d\n", errno);
109 goto out_close; 109 goto out_close;
110 } 110 }
111 111
112 /* subscribe to the multicast group */ 112 /* subscribe to the multicast group */
113 mreq.imr_multiaddr.s_addr = sin->sin_addr.s_addr; 113 mreq.imr_multiaddr.s_addr = sin->sin_addr.s_addr;
114 mreq.imr_interface.s_addr = 0; 114 mreq.imr_interface.s_addr = 0;
@@ -153,12 +153,12 @@ int mcast_user_write(int fd, void *buf, int len, struct mcast_data *pri)
153{ 153{
154 struct sockaddr_in *data_addr = pri->mcast_addr; 154 struct sockaddr_in *data_addr = pri->mcast_addr;
155 155
156 return(net_sendto(fd, buf, len, data_addr, sizeof(*data_addr))); 156 return net_sendto(fd, buf, len, data_addr, sizeof(*data_addr));
157} 157}
158 158
159static int mcast_set_mtu(int mtu, void *data) 159static int mcast_set_mtu(int mtu, void *data)
160{ 160{
161 return(mtu); 161 return mtu;
162} 162}
163 163
164const struct net_user_info mcast_user_info = { 164const struct net_user_info mcast_user_info = {
diff --git a/arch/um/drivers/pcap_user.c b/arch/um/drivers/pcap_user.c
index 11921a7baa7b..a1747dc0ff6f 100644
--- a/arch/um/drivers/pcap_user.c
+++ b/arch/um/drivers/pcap_user.c
@@ -42,39 +42,39 @@ static int pcap_open(void *data)
42 int err; 42 int err;
43 43
44 if(pri->pcap == NULL) 44 if(pri->pcap == NULL)
45 return(-ENODEV); 45 return -ENODEV;
46 46
47 if(pri->filter != NULL){ 47 if(pri->filter != NULL){
48 err = dev_netmask(pri->dev, &netmask); 48 err = dev_netmask(pri->dev, &netmask);
49 if(err < 0){ 49 if(err < 0){
50 printk("pcap_open : dev_netmask failed\n"); 50 printk("pcap_open : dev_netmask failed\n");
51 return(-EIO); 51 return -EIO;
52 } 52 }
53 53
54 pri->compiled = um_kmalloc(sizeof(struct bpf_program)); 54 pri->compiled = um_kmalloc(sizeof(struct bpf_program));
55 if(pri->compiled == NULL){ 55 if(pri->compiled == NULL){
56 printk("pcap_open : kmalloc failed\n"); 56 printk("pcap_open : kmalloc failed\n");
57 return(-ENOMEM); 57 return -ENOMEM;
58 } 58 }
59 59
60 err = pcap_compile(pri->pcap, 60 err = pcap_compile(pri->pcap,
61 (struct bpf_program *) pri->compiled, 61 (struct bpf_program *) pri->compiled,
62 pri->filter, pri->optimize, netmask); 62 pri->filter, pri->optimize, netmask);
63 if(err < 0){ 63 if(err < 0){
64 printk("pcap_open : pcap_compile failed - '%s'\n", 64 printk("pcap_open : pcap_compile failed - '%s'\n",
65 pcap_geterr(pri->pcap)); 65 pcap_geterr(pri->pcap));
66 return(-EIO); 66 return -EIO;
67 } 67 }
68 68
69 err = pcap_setfilter(pri->pcap, pri->compiled); 69 err = pcap_setfilter(pri->pcap, pri->compiled);
70 if(err < 0){ 70 if(err < 0){
71 printk("pcap_open : pcap_setfilter failed - '%s'\n", 71 printk("pcap_open : pcap_setfilter failed - '%s'\n",
72 pcap_geterr(pri->pcap)); 72 pcap_geterr(pri->pcap));
73 return(-EIO); 73 return -EIO;
74 } 74 }
75 } 75 }
76 76
77 return(PCAP_FD(pri->pcap)); 77 return PCAP_FD(pri->pcap);
78} 78}
79 79
80static void pcap_remove(void *data) 80static void pcap_remove(void *data)
@@ -114,11 +114,11 @@ int pcap_user_read(int fd, void *buffer, int len, struct pcap_data *pri)
114 n = pcap_dispatch(pri->pcap, 1, handler, (u_char *) &hdata); 114 n = pcap_dispatch(pri->pcap, 1, handler, (u_char *) &hdata);
115 if(n < 0){ 115 if(n < 0){
116 printk("pcap_dispatch failed - %s\n", pcap_geterr(pri->pcap)); 116 printk("pcap_dispatch failed - %s\n", pcap_geterr(pri->pcap));
117 return(-EIO); 117 return -EIO;
118 } 118 }
119 else if(n == 0) 119 else if(n == 0)
120 return(0); 120 return 0;
121 return(hdata.len); 121 return hdata.len;
122} 122}
123 123
124const struct net_user_info pcap_user_info = { 124const struct net_user_info pcap_user_info = {
@@ -131,14 +131,3 @@ const struct net_user_info pcap_user_info = {
131 .delete_address = NULL, 131 .delete_address = NULL,
132 .max_packet = MAX_PACKET - ETH_HEADER_OTHER 132 .max_packet = MAX_PACKET - ETH_HEADER_OTHER
133}; 133};
134
135/*
136 * Overrides for Emacs so that we follow Linus's tabbing style.
137 * Emacs will notice this stuff at the end of the file and automatically
138 * adjust the settings for this buffer only. This must remain at the end
139 * of the file.
140 * ---------------------------------------------------------------------------
141 * Local variables:
142 * c-file-style: "linux"
143 * End:
144 */
diff --git a/arch/um/drivers/ubd_user.c b/arch/um/drivers/ubd_user.c
index b94d2bc4fe06..039572cbedfe 100644
--- a/arch/um/drivers/ubd_user.c
+++ b/arch/um/drivers/ubd_user.c
@@ -47,8 +47,8 @@ int start_io_thread(unsigned long sp, int *fd_out)
47 pid = clone(io_thread, (void *) sp, CLONE_FILES | CLONE_VM | SIGCHLD, 47 pid = clone(io_thread, (void *) sp, CLONE_FILES | CLONE_VM | SIGCHLD,
48 NULL); 48 NULL);
49 if(pid < 0){ 49 if(pid < 0){
50 printk("start_io_thread - clone failed : errno = %d\n", errno);
51 err = -errno; 50 err = -errno;
51 printk("start_io_thread - clone failed : errno = %d\n", errno);
52 goto out_close; 52 goto out_close;
53 } 53 }
54 54
@@ -60,16 +60,5 @@ int start_io_thread(unsigned long sp, int *fd_out)
60 kernel_fd = -1; 60 kernel_fd = -1;
61 *fd_out = -1; 61 *fd_out = -1;
62 out: 62 out:
63 return(err); 63 return err;
64} 64}
65
66/*
67 * Overrides for Emacs so that we follow Linus's tabbing style.
68 * Emacs will notice this stuff at the end of the file and automatically
69 * adjust the settings for this buffer only. This must remain at the end
70 * of the file.
71 * ---------------------------------------------------------------------------
72 * Local variables:
73 * c-file-style: "linux"
74 * End:
75 */