net: fix ethtool coding style errors and warnings
Fix coding style errors and warnings output while running checkpatch.pl on the files net/core/ethtool.c and include/linux/ethtool.h Signed-off-by: chavey <chavey@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
					parent
					
						
							
								8dd4bd002a
							
						
					
				
			
			
				commit
				
					
						97f8aefbbf
					
				
			
		
					 2 changed files with 136 additions and 120 deletions
				
			
		|  | @ -532,14 +532,20 @@ struct ethtool_ops { | ||||||
| 	int	(*nway_reset)(struct net_device *); | 	int	(*nway_reset)(struct net_device *); | ||||||
| 	u32	(*get_link)(struct net_device *); | 	u32	(*get_link)(struct net_device *); | ||||||
| 	int	(*get_eeprom_len)(struct net_device *); | 	int	(*get_eeprom_len)(struct net_device *); | ||||||
| 	int	(*get_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); | 	int	(*get_eeprom)(struct net_device *, | ||||||
| 	int	(*set_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); | 			      struct ethtool_eeprom *, u8 *); | ||||||
|  | 	int	(*set_eeprom)(struct net_device *, | ||||||
|  | 			      struct ethtool_eeprom *, u8 *); | ||||||
| 	int	(*get_coalesce)(struct net_device *, struct ethtool_coalesce *); | 	int	(*get_coalesce)(struct net_device *, struct ethtool_coalesce *); | ||||||
| 	int	(*set_coalesce)(struct net_device *, struct ethtool_coalesce *); | 	int	(*set_coalesce)(struct net_device *, struct ethtool_coalesce *); | ||||||
| 	void	(*get_ringparam)(struct net_device *, struct ethtool_ringparam *); | 	void	(*get_ringparam)(struct net_device *, | ||||||
| 	int	(*set_ringparam)(struct net_device *, struct ethtool_ringparam *); | 				 struct ethtool_ringparam *); | ||||||
| 	void	(*get_pauseparam)(struct net_device *, struct ethtool_pauseparam*); | 	int	(*set_ringparam)(struct net_device *, | ||||||
| 	int	(*set_pauseparam)(struct net_device *, struct ethtool_pauseparam*); | 				 struct ethtool_ringparam *); | ||||||
|  | 	void	(*get_pauseparam)(struct net_device *, | ||||||
|  | 				  struct ethtool_pauseparam*); | ||||||
|  | 	int	(*set_pauseparam)(struct net_device *, | ||||||
|  | 				  struct ethtool_pauseparam*); | ||||||
| 	u32	(*get_rx_csum)(struct net_device *); | 	u32	(*get_rx_csum)(struct net_device *); | ||||||
| 	int	(*set_rx_csum)(struct net_device *, u32); | 	int	(*set_rx_csum)(struct net_device *, u32); | ||||||
| 	u32	(*get_tx_csum)(struct net_device *); | 	u32	(*get_tx_csum)(struct net_device *); | ||||||
|  | @ -551,7 +557,8 @@ struct ethtool_ops { | ||||||
| 	void	(*self_test)(struct net_device *, struct ethtool_test *, u64 *); | 	void	(*self_test)(struct net_device *, struct ethtool_test *, u64 *); | ||||||
| 	void	(*get_strings)(struct net_device *, u32 stringset, u8 *); | 	void	(*get_strings)(struct net_device *, u32 stringset, u8 *); | ||||||
| 	int	(*phys_id)(struct net_device *, u32); | 	int	(*phys_id)(struct net_device *, u32); | ||||||
| 	void	(*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *); | 	void	(*get_ethtool_stats)(struct net_device *, | ||||||
|  | 				     struct ethtool_stats *, u64 *); | ||||||
| 	int	(*begin)(struct net_device *); | 	int	(*begin)(struct net_device *); | ||||||
| 	void	(*complete)(struct net_device *); | 	void	(*complete)(struct net_device *); | ||||||
| 	u32	(*get_ufo)(struct net_device *); | 	u32	(*get_ufo)(struct net_device *); | ||||||
|  | @ -561,11 +568,13 @@ struct ethtool_ops { | ||||||
| 	u32	(*get_priv_flags)(struct net_device *); | 	u32	(*get_priv_flags)(struct net_device *); | ||||||
| 	int	(*set_priv_flags)(struct net_device *, u32); | 	int	(*set_priv_flags)(struct net_device *, u32); | ||||||
| 	int	(*get_sset_count)(struct net_device *, int); | 	int	(*get_sset_count)(struct net_device *, int); | ||||||
| 	int	(*get_rxnfc)(struct net_device *, struct ethtool_rxnfc *, void *); | 	int	(*get_rxnfc)(struct net_device *, | ||||||
|  | 			     struct ethtool_rxnfc *, void *); | ||||||
| 	int	(*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *); | 	int	(*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *); | ||||||
| 	int	(*flash_device)(struct net_device *, struct ethtool_flash *); | 	int	(*flash_device)(struct net_device *, struct ethtool_flash *); | ||||||
| 	int	(*reset)(struct net_device *, u32 *); | 	int	(*reset)(struct net_device *, u32 *); | ||||||
| 	int	(*set_rx_ntuple)(struct net_device *, struct ethtool_rx_ntuple *); | 	int	(*set_rx_ntuple)(struct net_device *, | ||||||
|  | 				 struct ethtool_rx_ntuple *); | ||||||
| 	int	(*get_rx_ntuple)(struct net_device *, u32 stringset, void *); | 	int	(*get_rx_ntuple)(struct net_device *, u32 stringset, void *); | ||||||
| }; | }; | ||||||
| #endif /* __KERNEL__ */ | #endif /* __KERNEL__ */ | ||||||
|  |  | ||||||
|  | @ -18,7 +18,7 @@ | ||||||
| #include <linux/ethtool.h> | #include <linux/ethtool.h> | ||||||
| #include <linux/netdevice.h> | #include <linux/netdevice.h> | ||||||
| #include <linux/bitops.h> | #include <linux/bitops.h> | ||||||
| #include <asm/uaccess.h> | #include <linux/uaccess.h> | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  * Some useful ethtool_ops methods that're device independent. |  * Some useful ethtool_ops methods that're device independent. | ||||||
|  | @ -30,6 +30,7 @@ u32 ethtool_op_get_link(struct net_device *dev) | ||||||
| { | { | ||||||
| 	return netif_carrier_ok(dev) ? 1 : 0; | 	return netif_carrier_ok(dev) ? 1 : 0; | ||||||
| } | } | ||||||
|  | EXPORT_SYMBOL(ethtool_op_get_link); | ||||||
| 
 | 
 | ||||||
| u32 ethtool_op_get_rx_csum(struct net_device *dev) | u32 ethtool_op_get_rx_csum(struct net_device *dev) | ||||||
| { | { | ||||||
|  | @ -62,6 +63,7 @@ int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data) | ||||||
| 
 | 
 | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  | EXPORT_SYMBOL(ethtool_op_set_tx_hw_csum); | ||||||
| 
 | 
 | ||||||
| int ethtool_op_set_tx_ipv6_csum(struct net_device *dev, u32 data) | int ethtool_op_set_tx_ipv6_csum(struct net_device *dev, u32 data) | ||||||
| { | { | ||||||
|  | @ -72,11 +74,13 @@ int ethtool_op_set_tx_ipv6_csum(struct net_device *dev, u32 data) | ||||||
| 
 | 
 | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  | EXPORT_SYMBOL(ethtool_op_set_tx_ipv6_csum); | ||||||
| 
 | 
 | ||||||
| u32 ethtool_op_get_sg(struct net_device *dev) | u32 ethtool_op_get_sg(struct net_device *dev) | ||||||
| { | { | ||||||
| 	return (dev->features & NETIF_F_SG) != 0; | 	return (dev->features & NETIF_F_SG) != 0; | ||||||
| } | } | ||||||
|  | EXPORT_SYMBOL(ethtool_op_get_sg); | ||||||
| 
 | 
 | ||||||
| int ethtool_op_set_sg(struct net_device *dev, u32 data) | int ethtool_op_set_sg(struct net_device *dev, u32 data) | ||||||
| { | { | ||||||
|  | @ -87,11 +91,13 @@ int ethtool_op_set_sg(struct net_device *dev, u32 data) | ||||||
| 
 | 
 | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  | EXPORT_SYMBOL(ethtool_op_set_sg); | ||||||
| 
 | 
 | ||||||
| u32 ethtool_op_get_tso(struct net_device *dev) | u32 ethtool_op_get_tso(struct net_device *dev) | ||||||
| { | { | ||||||
| 	return (dev->features & NETIF_F_TSO) != 0; | 	return (dev->features & NETIF_F_TSO) != 0; | ||||||
| } | } | ||||||
|  | EXPORT_SYMBOL(ethtool_op_get_tso); | ||||||
| 
 | 
 | ||||||
| int ethtool_op_set_tso(struct net_device *dev, u32 data) | int ethtool_op_set_tso(struct net_device *dev, u32 data) | ||||||
| { | { | ||||||
|  | @ -102,11 +108,13 @@ int ethtool_op_set_tso(struct net_device *dev, u32 data) | ||||||
| 
 | 
 | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  | EXPORT_SYMBOL(ethtool_op_set_tso); | ||||||
| 
 | 
 | ||||||
| u32 ethtool_op_get_ufo(struct net_device *dev) | u32 ethtool_op_get_ufo(struct net_device *dev) | ||||||
| { | { | ||||||
| 	return (dev->features & NETIF_F_UFO) != 0; | 	return (dev->features & NETIF_F_UFO) != 0; | ||||||
| } | } | ||||||
|  | EXPORT_SYMBOL(ethtool_op_get_ufo); | ||||||
| 
 | 
 | ||||||
| int ethtool_op_set_ufo(struct net_device *dev, u32 data) | int ethtool_op_set_ufo(struct net_device *dev, u32 data) | ||||||
| { | { | ||||||
|  | @ -116,6 +124,7 @@ int ethtool_op_set_ufo(struct net_device *dev, u32 data) | ||||||
| 		dev->features &= ~NETIF_F_UFO; | 		dev->features &= ~NETIF_F_UFO; | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  | EXPORT_SYMBOL(ethtool_op_set_ufo); | ||||||
| 
 | 
 | ||||||
| /* the following list of flags are the same as their associated
 | /* the following list of flags are the same as their associated
 | ||||||
|  * NETIF_F_xxx values in include/linux/netdevice.h |  * NETIF_F_xxx values in include/linux/netdevice.h | ||||||
|  | @ -132,6 +141,7 @@ u32 ethtool_op_get_flags(struct net_device *dev) | ||||||
| 
 | 
 | ||||||
| 	return dev->features & flags_dup_features; | 	return dev->features & flags_dup_features; | ||||||
| } | } | ||||||
|  | EXPORT_SYMBOL(ethtool_op_get_flags); | ||||||
| 
 | 
 | ||||||
| int ethtool_op_set_flags(struct net_device *dev, u32 data) | int ethtool_op_set_flags(struct net_device *dev, u32 data) | ||||||
| { | { | ||||||
|  | @ -160,6 +170,7 @@ int ethtool_op_set_flags(struct net_device *dev, u32 data) | ||||||
| 	dev->features = features; | 	dev->features = features; | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  | EXPORT_SYMBOL(ethtool_op_set_flags); | ||||||
| 
 | 
 | ||||||
| void ethtool_ntuple_flush(struct net_device *dev) | void ethtool_ntuple_flush(struct net_device *dev) | ||||||
| { | { | ||||||
|  | @ -205,7 +216,8 @@ static int ethtool_set_settings(struct net_device *dev, void __user *useraddr) | ||||||
| 	return dev->ethtool_ops->set_settings(dev, &cmd); | 	return dev->ethtool_ops->set_settings(dev, &cmd); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static noinline_for_stack int ethtool_get_drvinfo(struct net_device *dev, void __user *useraddr) | static noinline_for_stack int ethtool_get_drvinfo(struct net_device *dev, | ||||||
|  | 						  void __user *useraddr) | ||||||
| { | { | ||||||
| 	struct ethtool_drvinfo info; | 	struct ethtool_drvinfo info; | ||||||
| 	const struct ethtool_ops *ops = dev->ethtool_ops; | 	const struct ethtool_ops *ops = dev->ethtool_ops; | ||||||
|  | @ -304,7 +316,8 @@ out: | ||||||
| 	return ret; | 	return ret; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev, void __user *useraddr) | static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev, | ||||||
|  | 						void __user *useraddr) | ||||||
| { | { | ||||||
| 	struct ethtool_rxnfc cmd; | 	struct ethtool_rxnfc cmd; | ||||||
| 
 | 
 | ||||||
|  | @ -317,7 +330,8 @@ static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev, void __u | ||||||
| 	return dev->ethtool_ops->set_rxnfc(dev, &cmd); | 	return dev->ethtool_ops->set_rxnfc(dev, &cmd); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev, void __user *useraddr) | static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev, | ||||||
|  | 						void __user *useraddr) | ||||||
| { | { | ||||||
| 	struct ethtool_rxnfc info; | 	struct ethtool_rxnfc info; | ||||||
| 	const struct ethtool_ops *ops = dev->ethtool_ops; | 	const struct ethtool_ops *ops = dev->ethtool_ops; | ||||||
|  | @ -389,7 +403,8 @@ static void __rx_ntuple_filter_add(struct ethtool_rx_ntuple_list *list, | ||||||
| 	list->count++; | 	list->count++; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static noinline_for_stack int ethtool_set_rx_ntuple(struct net_device *dev, void __user *useraddr) | static noinline_for_stack int ethtool_set_rx_ntuple(struct net_device *dev, | ||||||
|  | 						    void __user *useraddr) | ||||||
| { | { | ||||||
| 	struct ethtool_rx_ntuple cmd; | 	struct ethtool_rx_ntuple cmd; | ||||||
| 	const struct ethtool_ops *ops = dev->ethtool_ops; | 	const struct ethtool_ops *ops = dev->ethtool_ops; | ||||||
|  | @ -857,7 +872,8 @@ static int ethtool_set_eeprom(struct net_device *dev, void __user *useraddr) | ||||||
| 	return ret; | 	return ret; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static noinline_for_stack int ethtool_get_coalesce(struct net_device *dev, void __user *useraddr) | static noinline_for_stack int ethtool_get_coalesce(struct net_device *dev, | ||||||
|  | 						   void __user *useraddr) | ||||||
| { | { | ||||||
| 	struct ethtool_coalesce coalesce = { .cmd = ETHTOOL_GCOALESCE }; | 	struct ethtool_coalesce coalesce = { .cmd = ETHTOOL_GCOALESCE }; | ||||||
| 
 | 
 | ||||||
|  | @ -871,7 +887,8 @@ static noinline_for_stack int ethtool_get_coalesce(struct net_device *dev, void | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static noinline_for_stack int ethtool_set_coalesce(struct net_device *dev, void __user *useraddr) | static noinline_for_stack int ethtool_set_coalesce(struct net_device *dev, | ||||||
|  | 						   void __user *useraddr) | ||||||
| { | { | ||||||
| 	struct ethtool_coalesce coalesce; | 	struct ethtool_coalesce coalesce; | ||||||
| 
 | 
 | ||||||
|  | @ -975,6 +992,7 @@ static int ethtool_set_tx_csum(struct net_device *dev, char __user *useraddr) | ||||||
| 
 | 
 | ||||||
| 	return dev->ethtool_ops->set_tx_csum(dev, edata.data); | 	return dev->ethtool_ops->set_tx_csum(dev, edata.data); | ||||||
| } | } | ||||||
|  | EXPORT_SYMBOL(ethtool_op_set_tx_csum); | ||||||
| 
 | 
 | ||||||
| static int ethtool_set_rx_csum(struct net_device *dev, char __user *useraddr) | static int ethtool_set_rx_csum(struct net_device *dev, char __user *useraddr) | ||||||
| { | { | ||||||
|  | @ -1281,7 +1299,8 @@ static int ethtool_set_value(struct net_device *dev, char __user *useraddr, | ||||||
| 	return actor(dev, edata.data); | 	return actor(dev, edata.data); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static noinline_for_stack int ethtool_flash_device(struct net_device *dev, char __user *useraddr) | static noinline_for_stack int ethtool_flash_device(struct net_device *dev, | ||||||
|  | 						   char __user *useraddr) | ||||||
| { | { | ||||||
| 	struct ethtool_flash efl; | 	struct ethtool_flash efl; | ||||||
| 
 | 
 | ||||||
|  | @ -1310,11 +1329,11 @@ int dev_ethtool(struct net *net, struct ifreq *ifr) | ||||||
| 	if (!dev->ethtool_ops) | 	if (!dev->ethtool_ops) | ||||||
| 		return -EOPNOTSUPP; | 		return -EOPNOTSUPP; | ||||||
| 
 | 
 | ||||||
| 	if (copy_from_user(ðcmd, useraddr, sizeof (ethcmd))) | 	if (copy_from_user(ðcmd, useraddr, sizeof(ethcmd))) | ||||||
| 		return -EFAULT; | 		return -EFAULT; | ||||||
| 
 | 
 | ||||||
| 	/* Allow some commands to be done by anyone */ | 	/* Allow some commands to be done by anyone */ | ||||||
| 	switch(ethcmd) { | 	switch (ethcmd) { | ||||||
| 	case ETHTOOL_GDRVINFO: | 	case ETHTOOL_GDRVINFO: | ||||||
| 	case ETHTOOL_GMSGLVL: | 	case ETHTOOL_GMSGLVL: | ||||||
| 	case ETHTOOL_GCOALESCE: | 	case ETHTOOL_GCOALESCE: | ||||||
|  | @ -1342,10 +1361,11 @@ int dev_ethtool(struct net *net, struct ifreq *ifr) | ||||||
| 			return -EPERM; | 			return -EPERM; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (dev->ethtool_ops->begin) | 	if (dev->ethtool_ops->begin) { | ||||||
| 		if ((rc = dev->ethtool_ops->begin(dev)) < 0) | 		rc = dev->ethtool_ops->begin(dev); | ||||||
|  | 		if (rc  < 0) | ||||||
| 			return rc; | 			return rc; | ||||||
| 
 | 	} | ||||||
| 	old_features = dev->features; | 	old_features = dev->features; | ||||||
| 
 | 
 | ||||||
| 	switch (ethcmd) { | 	switch (ethcmd) { | ||||||
|  | @ -1535,16 +1555,3 @@ int dev_ethtool(struct net *net, struct ifreq *ifr) | ||||||
| 
 | 
 | ||||||
| 	return rc; | 	return rc; | ||||||
| } | } | ||||||
| 
 |  | ||||||
| EXPORT_SYMBOL(ethtool_op_get_link); |  | ||||||
| EXPORT_SYMBOL(ethtool_op_get_sg); |  | ||||||
| EXPORT_SYMBOL(ethtool_op_get_tso); |  | ||||||
| EXPORT_SYMBOL(ethtool_op_set_sg); |  | ||||||
| EXPORT_SYMBOL(ethtool_op_set_tso); |  | ||||||
| EXPORT_SYMBOL(ethtool_op_set_tx_csum); |  | ||||||
| EXPORT_SYMBOL(ethtool_op_set_tx_hw_csum); |  | ||||||
| EXPORT_SYMBOL(ethtool_op_set_tx_ipv6_csum); |  | ||||||
| EXPORT_SYMBOL(ethtool_op_set_ufo); |  | ||||||
| EXPORT_SYMBOL(ethtool_op_get_ufo); |  | ||||||
| EXPORT_SYMBOL(ethtool_op_set_flags); |  | ||||||
| EXPORT_SYMBOL(ethtool_op_get_flags); |  | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 chavey
				chavey