[PATCH] ethernet: Improve formatting of conditional statements

Abhinav Srivastava posted 1 patch 1 month, 1 week ago
drivers/staging/octeon/ethernet.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
[PATCH] ethernet: Improve formatting of conditional statements
Posted by Abhinav Srivastava 1 month, 1 week ago
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.

Signed-off-by: Abhinav Srivastava <atg271@gmail.com>
---
 drivers/staging/octeon/ethernet.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
index a5e99cc78a45..77044b7b40da 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -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;
-- 
2.34.1
Re: [PATCH] ethernet: Improve formatting of conditional statements
Posted by Greg KH 1 month, 1 week ago
On Mon, Oct 14, 2024 at 09:45:07PM -0700, Abhinav Srivastava wrote:
> 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.
> 
> Signed-off-by: Abhinav Srivastava <atg271@gmail.com>

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

>  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

>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
> index a5e99cc78a45..77044b7b40da 100644
> --- a/drivers/staging/octeon/ethernet.c
> +++ b/drivers/staging/octeon/ethernet.c
> @@ -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