diff mbox series

[net-next,v12,04/15] net: stmmac: dwmac-loongson: Drop useless platform data

Message ID 37949d69a2b35018dd418f5ee138abf217a82550.1714046812.git.siyanteng@loongson.cn (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series stmmac: Add Loongson platform support | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for 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: 926 this patch: 926
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 6 maintainers not CCed: pabeni@redhat.com edumazet@google.com linux-stm32@st-md-mailman.stormreply.com linux-arm-kernel@lists.infradead.org kuba@kernel.org mcoquelin.stm32@gmail.com
netdev/build_clang success Errors and warnings before: 937 this patch: 937
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: 937 this patch: 937
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Yanteng Si April 25, 2024, 1:04 p.m. UTC
The multicast_filter_bins is initialized twice, it should
be 256, let's drop the first useless assignment.

Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn>
Signed-off-by: Yinggang Gu <guyinggang@loongson.cn>
Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Serge Semin May 3, 2024, 10:55 a.m. UTC | #1
On Thu, Apr 25, 2024 at 09:04:35PM +0800, Yanteng Si wrote:
> The multicast_filter_bins is initialized twice, it should
> be 256, let's drop the first useless assignment.

Please drop the second plat_stmmacenet_data::multicast_filter_bins
init statement and just change the first one to initializing the
correct value - 256. Thus you'll have
1. the multicast and unicast filters size inits done in the same place;
2. the in-situ comments preserved (it's not like they're that much
helpful, but seeing the rest of the lines have a comment above it
would be nice to have the comment preserved here too);
3. dropped the statement closely attached to the return statement
(in kernel it's a widespread practice to separate the return
statement with an empty line).

The unit 1. is the main reason of course.

A bit more readable commit log would be:

"The plat_stmmacenet_data::multicast_filter_bins field is twice
initialized in the loongson_default_data() method. Drop the redundant
initialization, but for the readability sake keep the filters init
statements defined in the same place of the method."

-Serge(y)

> 
> Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn>
> Signed-off-by: Yinggang Gu <guyinggang@loongson.cn>
> Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
> ---
>  drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> index 9e40c28d453a..19906ea67636 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> @@ -15,9 +15,6 @@ static int loongson_default_data(struct plat_stmmacenet_data *plat)
>  	plat->has_gmac = 1;
>  	plat->force_sf_dma_mode = 1;
>  
> -	/* Set default value for multicast hash bins */
> -	plat->multicast_filter_bins = HASH_TABLE_SIZE;
> -
>  	/* Set default value for unicast filter entries */
>  	plat->unicast_filter_entries = 1;
>  
> -- 
> 2.31.4
>
Serge Semin May 3, 2024, 2:47 p.m. UTC | #2
On Fri, May 03, 2024 at 01:55:38PM +0300, Serge Semin wrote:
> On Thu, Apr 25, 2024 at 09:04:35PM +0800, Yanteng Si wrote:
> > The multicast_filter_bins is initialized twice, it should
> > be 256, let's drop the first useless assignment.
> 
> Please drop the second plat_stmmacenet_data::multicast_filter_bins
> init statement and just change the first one to initializing the
> correct value - 256. Thus you'll have
> 1. the multicast and unicast filters size inits done in the same place;
> 2. the in-situ comments preserved (it's not like they're that much
> helpful, but seeing the rest of the lines have a comment above it
> would be nice to have the comment preserved here too);
> 3. dropped the statement closely attached to the return statement
> (in kernel it's a widespread practice to separate the return
> statement with an empty line).
> 
> The unit 1. is the main reason of course.
> 
> A bit more readable commit log would be:
> 

> "The plat_stmmacenet_data::multicast_filter_bins field is twice
> initialized in the loongson_default_data() method. Drop the redundant
> initialization, but for the readability sake keep the filters init
> statements defined in the same place of the method."

[PATCH net-next v12 04/15] net: stmmac: dwmac-loongson: Drop useless platform data

The patch subject is too generic. Just make it:

[PATCH net-next v12 04/15] net: stmmac: dwmac-loongson: Drop duplicated hash-based filter size init

-Serge(y)

> 
> -Serge(y)
> 
> > 
> > Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn>
> > Signed-off-by: Yinggang Gu <guyinggang@loongson.cn>
> > Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
> > ---
> >  drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c | 3 ---
> >  1 file changed, 3 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> > index 9e40c28d453a..19906ea67636 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> > @@ -15,9 +15,6 @@ static int loongson_default_data(struct plat_stmmacenet_data *plat)
> >  	plat->has_gmac = 1;
> >  	plat->force_sf_dma_mode = 1;
> >  
> > -	/* Set default value for multicast hash bins */
> > -	plat->multicast_filter_bins = HASH_TABLE_SIZE;
> > -
> >  	/* Set default value for unicast filter entries */
> >  	plat->unicast_filter_entries = 1;
> >  
> > -- 
> > 2.31.4
> >
Yanteng Si May 13, 2024, 9:46 a.m. UTC | #3
在 2024/5/3 18:55, Serge Semin 写道:
> On Thu, Apr 25, 2024 at 09:04:35PM +0800, Yanteng Si wrote:
>> The multicast_filter_bins is initialized twice, it should
>> be 256, let's drop the first useless assignment.
> Please drop the second plat_stmmacenet_data::multicast_filter_bins
> init statement and just change the first one to initializing the
> correct value - 256. Thus you'll have
> 1. the multicast and unicast filters size inits done in the same place;
> 2. the in-situ comments preserved (it's not like they're that much
> helpful, but seeing the rest of the lines have a comment above it
> would be nice to have the comment preserved here too);
> 3. dropped the statement closely attached to the return statement
> (in kernel it's a widespread practice to separate the return
> statement with an empty line).
>
> The unit 1. is the main reason of course.
>
> A bit more readable commit log would be:
>
> "The plat_stmmacenet_data::multicast_filter_bins  field is twice
> initialized in the loongson_default_data() method. Drop the redundant
> initialization, but for the readability sake keep the filters init
> statements defined in the same place of the method."

OK!


Thanks,

Yanteng
Yanteng Si May 13, 2024, 9:47 a.m. UTC | #4
在 2024/5/3 22:47, Serge Semin 写道:
> On Fri, May 03, 2024 at 01:55:38PM +0300, Serge Semin wrote:
>> On Thu, Apr 25, 2024 at 09:04:35PM +0800, Yanteng Si wrote:
>>> The multicast_filter_bins is initialized twice, it should
>>> be 256, let's drop the first useless assignment.
>> Please drop the second plat_stmmacenet_data::multicast_filter_bins
>> init statement and just change the first one to initializing the
>> correct value - 256. Thus you'll have
>> 1. the multicast and unicast filters size inits done in the same place;
>> 2. the in-situ comments preserved (it's not like they're that much
>> helpful, but seeing the rest of the lines have a comment above it
>> would be nice to have the comment preserved here too);
>> 3. dropped the statement closely attached to the return statement
>> (in kernel it's a widespread practice to separate the return
>> statement with an empty line).
>>
>> The unit 1. is the main reason of course.
>>
>> A bit more readable commit log would be:
>>
>> "The plat_stmmacenet_data::multicast_filter_bins  field is twice
>> initialized in the loongson_default_data() method. Drop the redundant
>> initialization, but for the readability sake keep the filters init
>> statements defined in the same place of the method."
> [PATCH net-next v12 04/15] net: stmmac: dwmac-loongson: Drop useless platform data
>
> The patch subject is too generic. Just make it:
>
> [PATCH net-next v12 04/15] net: stmmac: dwmac-loongson: Drop duplicated hash-based filter size init

OK, Thanks!


Thanks,

Yanteng
diff mbox series

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
index 9e40c28d453a..19906ea67636 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
@@ -15,9 +15,6 @@  static int loongson_default_data(struct plat_stmmacenet_data *plat)
 	plat->has_gmac = 1;
 	plat->force_sf_dma_mode = 1;
 
-	/* Set default value for multicast hash bins */
-	plat->multicast_filter_bins = HASH_TABLE_SIZE;
-
 	/* Set default value for unicast filter entries */
 	plat->unicast_filter_entries = 1;