Skip to contentSkip to conversation

ethernet: Improve formatting of conditional statements

PATCH In review Abhinav Srivastava 2 participants 2 messages Oct 15, 2024 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ethernet: Improve formatting of conditional statements

Improve readability of conditional statements in the Octeon ethernet driver by removing unnecessary parentheses and adjusting line breaks. This change focuses on three functions:

- cvm_oct_common_change_mtu()
- cvm_oct_common_set_multicast_list()
- cvm_oct_set_mac_filter()

The modifications make the code more consistent with the Linux kernel coding style guidelines, specifically in regards to the formatting of multi-line conditional statements. No functional changes are made.

---
 drivers/staging/octeon/ethernet.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/staging/octeon/ethernet.c +6 -9
index a5e99cc78a45..77044b7b40da 100644
@@ -248,9 +248,8 @@ static int cvm_oct_common_change_mtu(struct net_device *dev, int new_mtu)
 
 	dev->mtu = new_mtu;
 
-	if ((interface < 2) &&
-	    (cvmx_helper_interface_get_mode(interface) !=
-		CVMX_HELPER_INTERFACE_MODE_SPI)) {
+	if (interface < 2 && cvmx_helper_interface_get_mode(interface) !=
+	CVMX_HELPER_INTERFACE_MODE_SPI){
 		int index = INDEX(priv->port);
 		/* Add ethernet header and FCS, and VLAN if configured. */
 		int max_packet = new_mtu + mtu_overhead;
@@ -294,9 +293,8 @@ static void cvm_oct_common_set_multicast_list(struct net_device *dev)
 	struct octeon_ethernet *priv = netdev_priv(dev);
 	int interface = INTERFACE(priv->port);
 
-	if ((interface < 2) &&
-	    (cvmx_helper_interface_get_mode(interface) !=
-		CVMX_HELPER_INTERFACE_MODE_SPI)) {
+	if (interface < 2 && cvmx_helper_interface_get_mode(interface) !=
+	CVMX_HELPER_INTERFACE_MODE_SPI) {
 		union cvmx_gmxx_rxx_adr_ctl control;
 		int index = INDEX(priv->port);
 
@@ -346,9 +344,8 @@ static int cvm_oct_set_mac_filter(struct net_device *dev)
 	union cvmx_gmxx_prtx_cfg gmx_cfg;
 	int interface = INTERFACE(priv->port);
 
-	if ((interface < 2) &&
-	    (cvmx_helper_interface_get_mode(interface) !=
-		CVMX_HELPER_INTERFACE_MODE_SPI)) {
+	if (interface < 2 && cvmx_helper_interface_get_mode(interface) !=
+	CVMX_HELPER_INTERFACE_MODE_SPI) {
 		int i;
 		const u8 *ptr = dev->dev_addr;
 		u64 mac = 0;
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 8 lines · Abhinav Srivastava

Improve readability of conditional statements in the Octeon ethernet driver by removing unnecessary parentheses and adjusting line breaks. This change focuses on three functions:

- cvm_oct_common_change_mtu()
- cvm_oct_common_set_multicast_list()
- cvm_oct_set_mac_filter()

Quoted 5 lines

The modifications make the code more consistent with the Linux kernel coding style guidelines, specifically in regards to the formatting of multi-line conditional statements. No functional changes are made.

Your subject line looks odd for things that touch this file:

Quoted 1 line
 drivers/staging/octeon/ethernet.c | 15 ++++++---------
	$ git log --oneline drivers/staging/octeon/ethernet.c | head -n 10
	00d066a4d4ed netdev_features: convert NETIF_F_LLTX to dev->lltx
	c46d4073ec68 staging: octeon: ethernet: Convert to platform remove callback returning void
	5cd4dc44b8a0 Merge tag 'staging-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
	8b6ce9b02672 staging: use of_get_ethdev_address()
	524b09ea34a4 staging: use eth_hw_addr_set() in orphan drivers
	a76053707dbf dev_ioctl: split out ndo_eth_ioctl
	9d31d2338950 Merge tag 'net-next-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next
	c295d3007ff6 staging: octeon: Use 'for_each_child_of_node'
	83216e3988cd of: net: pass the dst buffer to of_get_mac_address()
	179f5dc36b0a staging: octeon: repair "fixed-link" support
Quoted 7 lines
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/staging/octeon/ethernet.c +0 -0
index a5e99cc78a45..77044b7b40da 100644

drivers/staging/octeon/ethernet.c static int cvm_oct_common_change_mtu(struct net_device *dev, int new_mtu) · line 252

Quoted 8 lines
drivers/staging/octeon/ethernet.c +2 -3
@@ -248,9 +248,8 @@ static int cvm_oct_common_change_mtu(struct net_device *dev, int new_mtu)
 
 	dev->mtu = new_mtu;
 
-	if ((interface < 2) &&
-	    (cvmx_helper_interface_get_mode(interface) !=
-		CVMX_HELPER_INTERFACE_MODE_SPI)) {
+	if (interface < 2 && cvmx_helper_interface_get_mode(interface) !=
+	CVMX_HELPER_INTERFACE_MODE_SPI){

Surely that can't be right? Did you run checkpatch.pl after you made your change? Please always do so.

Also use scripts/get_maintainer.pl to determine what mailing lists to send stuff too.

thanks,

greg k-h