diff mbox series

[v1] drivers:atlx:Use max macro

Message ID 20240822075004.1367899-1-11162571@vivo.com (mailing list archive)
State Rejected
Delegated to: Netdev Maintainers
Headers show
Series [v1] drivers:atlx:Use max macro | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 16 this patch: 16
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 16 this patch: 16
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 16 this patch: 16
netdev/checkpatch warning WARNING: line length of 89 exceeds 80 columns
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 9 this patch: 9
netdev/source_inline success Was 0 now: 0
netdev/contest fail net-next-2024-08-22--09-00 (tests: 710)

Commit Message

Yang Ruibin Aug. 22, 2024, 7:50 a.m. UTC
Instead of using the max() implementation of
the ternary operator, use real macros.

Signed-off-by: Yang Ruibin <11162571@vivo.com>
---
 drivers/net/ethernet/atheros/atlx/atl2.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Yang Ruibin Aug. 22, 2024, 9:40 a.m. UTC | #1
Sorry, please ignore this patch.
Because the corresponding header file is not included, there may be 
compilation errors.

在 2024/8/22 15:50, Yang Ruibin 写道:
> Instead of using the max() implementation of
> the ternary operator, use real macros.
>
> Signed-off-by: Yang Ruibin <11162571@vivo.com>
> ---
>   drivers/net/ethernet/atheros/atlx/atl2.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c
> index fa9a4919f..3ff669e72 100644
> --- a/drivers/net/ethernet/atheros/atlx/atl2.c
> +++ b/drivers/net/ethernet/atheros/atlx/atl2.c
> @@ -2971,10 +2971,7 @@ static void atl2_check_options(struct atl2_adapter *adapter)
>   #endif
>   	/* init RXD Flow control value */
>   	adapter->hw.fc_rxd_hi = (adapter->rxd_ring_size / 8) * 7;
> -	adapter->hw.fc_rxd_lo = (ATL2_MIN_RXD_COUNT / 8) >
> -		(adapter->rxd_ring_size / 12) ? (ATL2_MIN_RXD_COUNT / 8) :
> -		(adapter->rxd_ring_size / 12);
> -
> +	adapter->hw.fc_rxd_lo = max(ATL2_MIN_RXD_COUNT / 8, adapter->rxd_ring_size / 12);
>   	/* Interrupt Moderate Timer */
>   	opt.type = range_option;
>   	opt.name = "Interrupt Moderate Timer";
Simon Horman Aug. 22, 2024, 12:53 p.m. UTC | #2
On Thu, Aug 22, 2024 at 05:40:28PM +0800, Yang Ruibin wrote:
> Sorry, please ignore this patch.
> Because the corresponding header file is not included, there may be
> compilation errors.

Hi Yang Ruibin,

Thanks for your patch.

Some feedback from a process point of view, for future reference.

1. Please do not top-post in emails to Kernel mailing lists.

2. As a Networking patch, that is not a bug fix, it should
   be explicitly targeted at net-next.

   Subject: [PATCH net-next] ...

3. Looking at git history, it looks like 'net: atheros: ' would be an
   appropriate prefix for this patch.

   Subject: [PATCH net-next] net: atheros: ...

Please consider reading
https://docs.kernel.org/process/maintainer-netdev.html

And please, if you do post a new version, allow 24h to pass since the you
posted this version (as described in the link above).

> 
> 在 2024/8/22 15:50, Yang Ruibin 写道:
> > Instead of using the max() implementation of
> > the ternary operator, use real macros.
> > 
> > Signed-off-by: Yang Ruibin <11162571@vivo.com>
> > ---
> >   drivers/net/ethernet/atheros/atlx/atl2.c | 5 +----
> >   1 file changed, 1 insertion(+), 4 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c
> > index fa9a4919f..3ff669e72 100644
> > --- a/drivers/net/ethernet/atheros/atlx/atl2.c
> > +++ b/drivers/net/ethernet/atheros/atlx/atl2.c
> > @@ -2971,10 +2971,7 @@ static void atl2_check_options(struct atl2_adapter *adapter)
> >   #endif
> >   	/* init RXD Flow control value */
> >   	adapter->hw.fc_rxd_hi = (adapter->rxd_ring_size / 8) * 7;
> > -	adapter->hw.fc_rxd_lo = (ATL2_MIN_RXD_COUNT / 8) >
> > -		(adapter->rxd_ring_size / 12) ? (ATL2_MIN_RXD_COUNT / 8) :
> > -		(adapter->rxd_ring_size / 12);
> > -
> > +	adapter->hw.fc_rxd_lo = max(ATL2_MIN_RXD_COUNT / 8, adapter->rxd_ring_size / 12);

Networking code still prefers lines to be 80 colimns wide or less.
In this case, I would suggest:

	adapter->hw.fc_rxd_lo = max(ATL2_MIN_RXD_COUNT / 8,
				    adapter->rxd_ring_size / 12);

> >   	/* Interrupt Moderate Timer */
> >   	opt.type = range_option;
> >   	opt.name = "Interrupt Moderate Timer";
>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c
index fa9a4919f..3ff669e72 100644
--- a/drivers/net/ethernet/atheros/atlx/atl2.c
+++ b/drivers/net/ethernet/atheros/atlx/atl2.c
@@ -2971,10 +2971,7 @@  static void atl2_check_options(struct atl2_adapter *adapter)
 #endif
 	/* init RXD Flow control value */
 	adapter->hw.fc_rxd_hi = (adapter->rxd_ring_size / 8) * 7;
-	adapter->hw.fc_rxd_lo = (ATL2_MIN_RXD_COUNT / 8) >
-		(adapter->rxd_ring_size / 12) ? (ATL2_MIN_RXD_COUNT / 8) :
-		(adapter->rxd_ring_size / 12);
-
+	adapter->hw.fc_rxd_lo = max(ATL2_MIN_RXD_COUNT / 8, adapter->rxd_ring_size / 12);
 	/* Interrupt Moderate Timer */
 	opt.type = range_option;
 	opt.name = "Interrupt Moderate Timer";