Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56bd194b authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds
Browse files

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: default avatarJeff Dike <jdike@linux.intel.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b47d2deb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@ static int winch_tramp(int fd, struct tty_struct *tty, int *fd_out)
	 */
	err = run_helper_thread(winch_thread, &data, CLONE_FILES, &stack, 0);
	if(err < 0){
		printk("fork of winch_thread failed - errno = %d\n", errno);
		printk("fork of winch_thread failed - errno = %d\n", err);
		goto out_close;
	}

+7 −18
Original line number Diff line number Diff line
@@ -39,11 +39,11 @@ static struct sockaddr_un *new_addr(void *name, int len)
	sun = um_kmalloc(sizeof(struct sockaddr_un));
	if(sun == NULL){
		printk("new_addr: allocation of sockaddr_un failed\n");
		return(NULL);
		return NULL;
	}
	sun->sun_family = AF_UNIX;
	memcpy(sun->sun_path, name, len);
	return(sun);
	return sun;
}

static int connect_to_switch(struct daemon_data *pri)
@@ -112,7 +112,7 @@ static int connect_to_switch(struct daemon_data *pri)
	}

	pri->data_addr = sun;
	return(fd);
	return fd;

 out_free:
	kfree(sun);
@@ -120,7 +120,7 @@ static int connect_to_switch(struct daemon_data *pri)
	os_close_file(fd);
 out:
	os_close_file(pri->control);
	return(err);
	return err;
}

static void daemon_user_init(void *data, void *dev)
@@ -152,7 +152,7 @@ static void daemon_user_init(void *data, void *dev)
static int daemon_open(void *data)
{
	struct daemon_data *pri = data;
	return(pri->fd);
	return pri->fd;
}

static void daemon_remove(void *data)
@@ -176,12 +176,12 @@ int daemon_user_write(int fd, void *buf, int len, struct daemon_data *pri)
{
	struct sockaddr_un *data_addr = pri->data_addr;

	return(net_sendto(fd, buf, len, data_addr, sizeof(*data_addr)));
	return net_sendto(fd, buf, len, data_addr, sizeof(*data_addr));
}

static int daemon_set_mtu(int mtu, void *data)
{
	return(mtu);
	return mtu;
}

const struct net_user_info daemon_user_info = {
@@ -194,14 +194,3 @@ const struct net_user_info daemon_user_info = {
	.delete_address = NULL,
	.max_packet	= MAX_PACKET - ETH_HEADER_OTHER
};

/*
 * Overrides for Emacs so that we follow Linus's tabbing style.
 * Emacs will notice this stuff at the end of the file and automatically
 * adjust the settings for this buffer only.  This must remain at the end
 * of the file.
 * ---------------------------------------------------------------------------
 * Local variables:
 * c-file-style: "linux"
 * End:
 */
+6 −6
Original line number Diff line number Diff line
@@ -34,12 +34,12 @@ static struct sockaddr_in *new_addr(char *addr, unsigned short port)
	sin = um_kmalloc(sizeof(struct sockaddr_in));
	if(sin == NULL){
		printk("new_addr: allocation of sockaddr_in failed\n");
		return(NULL);
		return NULL;
	}
	sin->sin_family = AF_INET;
	sin->sin_addr.s_addr = in_aton(addr);
	sin->sin_port = htons(port);
	return(sin);
	return sin;
}

static void mcast_user_init(void *data, void *dev)
@@ -153,12 +153,12 @@ int mcast_user_write(int fd, void *buf, int len, struct mcast_data *pri)
{
	struct sockaddr_in *data_addr = pri->mcast_addr;

	return(net_sendto(fd, buf, len, data_addr, sizeof(*data_addr)));
	return net_sendto(fd, buf, len, data_addr, sizeof(*data_addr));
}

static int mcast_set_mtu(int mtu, void *data)
{
	return(mtu);
	return mtu;
}

const struct net_user_info mcast_user_info = {
+11 −22
Original line number Diff line number Diff line
@@ -42,19 +42,19 @@ static int pcap_open(void *data)
	int err;

	if(pri->pcap == NULL)
		return(-ENODEV);
		return -ENODEV;

	if(pri->filter != NULL){
		err = dev_netmask(pri->dev, &netmask);
		if(err < 0){
			printk("pcap_open : dev_netmask failed\n");
			return(-EIO);
			return -EIO;
		}

		pri->compiled = um_kmalloc(sizeof(struct bpf_program));
		if(pri->compiled == NULL){
			printk("pcap_open : kmalloc failed\n");
			return(-ENOMEM);
			return -ENOMEM;
		}

		err = pcap_compile(pri->pcap, 
@@ -63,18 +63,18 @@ static int pcap_open(void *data)
		if(err < 0){
			printk("pcap_open : pcap_compile failed - '%s'\n", 
			       pcap_geterr(pri->pcap));
			return(-EIO);
			return -EIO;
		}

		err = pcap_setfilter(pri->pcap, pri->compiled);
		if(err < 0){
			printk("pcap_open : pcap_setfilter failed - '%s'\n", 
			       pcap_geterr(pri->pcap));
			return(-EIO);
			return -EIO;
		}
	}

	return(PCAP_FD(pri->pcap));
	return PCAP_FD(pri->pcap);
}

static void pcap_remove(void *data)
@@ -114,11 +114,11 @@ int pcap_user_read(int fd, void *buffer, int len, struct pcap_data *pri)
	n = pcap_dispatch(pri->pcap, 1, handler, (u_char *) &hdata);
	if(n < 0){
		printk("pcap_dispatch failed - %s\n", pcap_geterr(pri->pcap));
		return(-EIO);
		return -EIO;
	}
	else if(n == 0) 
		return(0);
	return(hdata.len);
		return 0;
	return hdata.len;
}

const struct net_user_info pcap_user_info = {
@@ -131,14 +131,3 @@ const struct net_user_info pcap_user_info = {
	.delete_address = NULL,
	.max_packet	= MAX_PACKET - ETH_HEADER_OTHER
};

/*
 * Overrides for Emacs so that we follow Linus's tabbing style.
 * Emacs will notice this stuff at the end of the file and automatically
 * adjust the settings for this buffer only.  This must remain at the end
 * of the file.
 * ---------------------------------------------------------------------------
 * Local variables:
 * c-file-style: "linux"
 * End:
 */
+2 −13
Original line number Diff line number Diff line
@@ -47,8 +47,8 @@ int start_io_thread(unsigned long sp, int *fd_out)
	pid = clone(io_thread, (void *) sp, CLONE_FILES | CLONE_VM | SIGCHLD,
		    NULL);
	if(pid < 0){
		printk("start_io_thread - clone failed : errno = %d\n", errno);
		err = -errno;
		printk("start_io_thread - clone failed : errno = %d\n", errno);
		goto out_close;
	}

@@ -60,16 +60,5 @@ int start_io_thread(unsigned long sp, int *fd_out)
	kernel_fd = -1;
	*fd_out = -1;
 out:
	return(err);
	return err;
}

/*
 * Overrides for Emacs so that we follow Linus's tabbing style.
 * Emacs will notice this stuff at the end of the file and automatically
 * adjust the settings for this buffer only.  This must remain at the end
 * of the file.
 * ---------------------------------------------------------------------------
 * Local variables:
 * c-file-style: "linux"
 * End:
 */
Loading