[PATCH net-next 2/2] net: xilinx: axienet: Add inline comment for stats_lock mutex definition

Suraj Gupta posted 2 patches 3 weeks ago
[PATCH net-next 2/2] net: xilinx: axienet: Add inline comment for stats_lock mutex definition
Posted by Suraj Gupta 3 weeks ago
Add inline comment to document the purpose of the stats_lock mutex in
the axienet_local structure. This mutex protects the hw_stats_seqcount
sequence counter used for hardware statistics synchronization.

Fixes checkpatch warning:
CHECK: struct mutex definition without comment

Signed-off-by: Suraj Gupta <suraj.gupta2@amd.com>
---
 drivers/net/ethernet/xilinx/xilinx_axienet.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet.h b/drivers/net/ethernet/xilinx/xilinx_axienet.h
index 5ff742103beb..99b9c27bbd60 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet.h
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h
@@ -598,7 +598,7 @@ struct axienet_local {
 
 	u64 hw_stat_base[STAT_COUNT];
 	u32 hw_last_counter[STAT_COUNT];
-	seqcount_mutex_t hw_stats_seqcount;
+	seqcount_mutex_t hw_stats_seqcount; /* Lock for hardware statistics */
 	struct mutex stats_lock;
 	struct delayed_work stats_work;
 	bool reset_in_progress;
-- 
2.25.1
Re: [PATCH net-next 2/2] net: xilinx: axienet: Add inline comment for stats_lock mutex definition
Posted by Sean Anderson 3 weeks ago
On 9/11/25 03:28, Suraj Gupta wrote:
> Add inline comment to document the purpose of the stats_lock mutex in
> the axienet_local structure. This mutex protects the hw_stats_seqcount
> sequence counter used for hardware statistics synchronization.
> 
> Fixes checkpatch warning:
> CHECK: struct mutex definition without comment
> 
> Signed-off-by: Suraj Gupta <suraj.gupta2@amd.com>
> ---
>  drivers/net/ethernet/xilinx/xilinx_axienet.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet.h b/drivers/net/ethernet/xilinx/xilinx_axienet.h
> index 5ff742103beb..99b9c27bbd60 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_axienet.h
> +++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h
> @@ -598,7 +598,7 @@ struct axienet_local {
>  
>  	u64 hw_stat_base[STAT_COUNT];
>  	u32 hw_last_counter[STAT_COUNT];
> -	seqcount_mutex_t hw_stats_seqcount;
> +	seqcount_mutex_t hw_stats_seqcount; /* Lock for hardware statistics */
>  	struct mutex stats_lock;
>  	struct delayed_work stats_work;
>  	bool reset_in_progress;

NAK. This is already documented in the kernel-doc comment.
Re: [PATCH net-next 2/2] net: xilinx: axienet: Add inline comment for stats_lock mutex definition
Posted by Andrew Lunn 3 weeks ago
On Thu, Sep 11, 2025 at 10:35:22AM -0400, Sean Anderson wrote:
> On 9/11/25 03:28, Suraj Gupta wrote:
> > Add inline comment to document the purpose of the stats_lock mutex in
> > the axienet_local structure. This mutex protects the hw_stats_seqcount
> > sequence counter used for hardware statistics synchronization.
> > 
> > Fixes checkpatch warning:
> > CHECK: struct mutex definition without comment
> > 
> > Signed-off-by: Suraj Gupta <suraj.gupta2@amd.com>
> > ---
> >  drivers/net/ethernet/xilinx/xilinx_axienet.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet.h b/drivers/net/ethernet/xilinx/xilinx_axienet.h
> > index 5ff742103beb..99b9c27bbd60 100644
> > --- a/drivers/net/ethernet/xilinx/xilinx_axienet.h
> > +++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h
> > @@ -598,7 +598,7 @@ struct axienet_local {
> >  
> >  	u64 hw_stat_base[STAT_COUNT];
> >  	u32 hw_last_counter[STAT_COUNT];
> > -	seqcount_mutex_t hw_stats_seqcount;
> > +	seqcount_mutex_t hw_stats_seqcount; /* Lock for hardware statistics */
> >  	struct mutex stats_lock;
> >  	struct delayed_work stats_work;
> >  	bool reset_in_progress;
> 
> NAK. This is already documented in the kernel-doc comment.

Agreed. checkpatch is just a guide, it does get things wrong, and we
don't insist it is 100% clean.

And the existing comment is much more specific:

   Sequence counter for @hw_stat_base, @hw_last_counter,
   and @reset_in_progress.

This makes it clear exactly what it should protect, and what it does
not protect.

    Andrew

---
pw-bot: cr