public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH 0/3] staging: octeon: add pr_fmt macro to ethernet drivers
@ 2026-03-24 13:30 AyushMukkanwar
  2026-03-24 13:30 ` [PATCH 1/3] staging: octeon: ethernet-mem: add pr_fmt macro AyushMukkanwar
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: AyushMukkanwar @ 2026-03-24 13:30 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, AyushMukkanwar

Add pr_fmt macro to three ethernet driver files in the octeon
staging driver to prefix log messages with the module name,
making debugging easier.

AyushMukkanwar (3):
  staging: octeon: ethernet-mem: add pr_fmt macro
  staging: octeon: ethernet-spi: add pr_fmt macro
  staging: octeon: ethernet: add pr_fmt macro

 drivers/staging/octeon/ethernet-mem.c | 1 +
 drivers/staging/octeon/ethernet-spi.c | 1 +
 drivers/staging/octeon/ethernet.c     | 1 +
 3 files changed, 3 insertions(+)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] staging: octeon: ethernet-mem: add pr_fmt macro
  2026-03-24 13:30 [PATCH 0/3] staging: octeon: add pr_fmt macro to ethernet drivers AyushMukkanwar
@ 2026-03-24 13:30 ` AyushMukkanwar
  2026-03-24 13:30 ` [PATCH 2/3] staging: octeon: ethernet-spi: " AyushMukkanwar
  2026-03-24 13:30 ` [PATCH 3/3] staging: octeon: ethernet: " AyushMukkanwar
  2 siblings, 0 replies; 8+ messages in thread
From: AyushMukkanwar @ 2026-03-24 13:30 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, AyushMukkanwar

Add pr_fmt macro to prefix log messages with the module
name for easier debugging.

Signed-off-by: AyushMukkanwar <ayushmukkanwar@gmail.com>
---
 drivers/staging/octeon/ethernet-mem.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/octeon/ethernet-mem.c b/drivers/staging/octeon/ethernet-mem.c
index 532594957ebc..aea9c69667ce 100644
--- a/drivers/staging/octeon/ethernet-mem.c
+++ b/drivers/staging/octeon/ethernet-mem.c
@@ -5,6 +5,7 @@
  * Copyright (c) 2003-2010 Cavium Networks
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 #include <linux/kernel.h>
 #include <linux/netdevice.h>
 #include <linux/slab.h>
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] staging: octeon: ethernet-spi: add pr_fmt macro
  2026-03-24 13:30 [PATCH 0/3] staging: octeon: add pr_fmt macro to ethernet drivers AyushMukkanwar
  2026-03-24 13:30 ` [PATCH 1/3] staging: octeon: ethernet-mem: add pr_fmt macro AyushMukkanwar
@ 2026-03-24 13:30 ` AyushMukkanwar
  2026-03-24 13:30 ` [PATCH 3/3] staging: octeon: ethernet: " AyushMukkanwar
  2 siblings, 0 replies; 8+ messages in thread
From: AyushMukkanwar @ 2026-03-24 13:30 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, AyushMukkanwar

Add pr_fmt macro to prefix log messages with the module
name for easier debugging.

Signed-off-by: AyushMukkanwar <ayushmukkanwar@gmail.com>
---
 drivers/staging/octeon/ethernet-spi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/octeon/ethernet-spi.c b/drivers/staging/octeon/ethernet-spi.c
index 699c98c5ec13..f6cd34e933da 100644
--- a/drivers/staging/octeon/ethernet-spi.c
+++ b/drivers/staging/octeon/ethernet-spi.c
@@ -5,6 +5,7 @@
  * Copyright (c) 2003-2007 Cavium Networks
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 #include <linux/kernel.h>
 #include <linux/netdevice.h>
 #include <linux/interrupt.h>
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] staging: octeon: ethernet: add pr_fmt macro
  2026-03-24 13:30 [PATCH 0/3] staging: octeon: add pr_fmt macro to ethernet drivers AyushMukkanwar
  2026-03-24 13:30 ` [PATCH 1/3] staging: octeon: ethernet-mem: add pr_fmt macro AyushMukkanwar
  2026-03-24 13:30 ` [PATCH 2/3] staging: octeon: ethernet-spi: " AyushMukkanwar
@ 2026-03-24 13:30 ` AyushMukkanwar
  2026-03-24 14:28   ` Greg KH
  2 siblings, 1 reply; 8+ messages in thread
From: AyushMukkanwar @ 2026-03-24 13:30 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, AyushMukkanwar

Add pr_fmt macro to prefix log messages with the module
name for easier debugging.

Signed-off-by: AyushMukkanwar <ayushmukkanwar@gmail.com>
---
 drivers/staging/octeon/ethernet.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
index eadb74fc14c8..5bb8c303f88b 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -5,6 +5,7 @@
  * Copyright (c) 2003-2007 Cavium Networks
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 #include <linux/platform_device.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] staging: octeon: ethernet: add pr_fmt macro
  2026-03-24 13:30 ` [PATCH 3/3] staging: octeon: ethernet: " AyushMukkanwar
@ 2026-03-24 14:28   ` Greg KH
  2026-03-25  9:03     ` Ayush Mukkanwar
  0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2026-03-24 14:28 UTC (permalink / raw)
  To: AyushMukkanwar; +Cc: linux-staging, linux-kernel

On Tue, Mar 24, 2026 at 07:00:29PM +0530, AyushMukkanwar wrote:
> Add pr_fmt macro to prefix log messages with the module
> name for easier debugging.
> 
> Signed-off-by: AyushMukkanwar <ayushmukkanwar@gmail.com>
> ---
>  drivers/staging/octeon/ethernet.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
> index eadb74fc14c8..5bb8c303f88b 100644
> --- a/drivers/staging/octeon/ethernet.c
> +++ b/drivers/staging/octeon/ethernet.c
> @@ -5,6 +5,7 @@
>   * Copyright (c) 2003-2007 Cavium Networks
>   */
>  
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>  #include <linux/platform_device.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
> -- 
> 2.53.0
> 

How about working to remove the existing pr_*() calls with the proper
dev_*() and netdev_*() calls instead, so that pr_fmt() is not needed at
all?  That is the more "correct" solution here.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] staging: octeon: ethernet: add pr_fmt macro
  2026-03-24 14:28   ` Greg KH
@ 2026-03-25  9:03     ` Ayush Mukkanwar
  2026-03-25  9:11       ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Ayush Mukkanwar @ 2026-03-25  9:03 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-staging, linux-kernel

On Tue, Mar 24, 2026 at 7:58 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Tue, Mar 24, 2026 at 07:00:29PM +0530, AyushMukkanwar wrote:
> > Add pr_fmt macro to prefix log messages with the module
> > name for easier debugging.
> >
> > Signed-off-by: AyushMukkanwar <ayushmukkanwar@gmail.com>
> > ---
> >  drivers/staging/octeon/ethernet.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
> > index eadb74fc14c8..5bb8c303f88b 100644
> > --- a/drivers/staging/octeon/ethernet.c
> > +++ b/drivers/staging/octeon/ethernet.c
> > @@ -5,6 +5,7 @@
> >   * Copyright (c) 2003-2007 Cavium Networks
> >   */
> >
> > +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> >  #include <linux/platform_device.h>
> >  #include <linux/kernel.h>
> >  #include <linux/module.h>
> > --
> > 2.53.0
> >
>
> How about working to remove the existing pr_*() calls with the proper
> dev_*() and netdev_*() calls instead, so that pr_fmt() is not needed at
> all?  That is the more "correct" solution here.
>
> thanks,
>
> greg k-h

Hi Greg,

After investigating, the pr_*() calls in ethernet-mem.c and
ethernet-spi.c are inside functions that only receive hardware pool
indices or register structs with no net_device or device pointer
available, so dev_*() and netdev_*() replacements are not possible
there.

For ethernet.c, device pointers are available at most call sites and I
can replace those with dev_err() and netdev_err()/netdev_info()
appropriately. The two calls where no device pointer is available
would keep pr_err() as is.

Should I proceed with replacing what is possible in ethernet.c and
leave the pr_*() calls in ethernet-mem.c and ethernet-spi.c as they
are, or is there a preferred approach?

Thanks,
Ayush

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] staging: octeon: ethernet: add pr_fmt macro
  2026-03-25  9:03     ` Ayush Mukkanwar
@ 2026-03-25  9:11       ` Greg KH
  2026-03-25 19:12         ` Ayush Mukkanwar
  0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2026-03-25  9:11 UTC (permalink / raw)
  To: Ayush Mukkanwar; +Cc: linux-staging, linux-kernel

On Wed, Mar 25, 2026 at 02:33:00PM +0530, Ayush Mukkanwar wrote:
> On Tue, Mar 24, 2026 at 7:58 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> >
> > On Tue, Mar 24, 2026 at 07:00:29PM +0530, AyushMukkanwar wrote:
> > > Add pr_fmt macro to prefix log messages with the module
> > > name for easier debugging.
> > >
> > > Signed-off-by: AyushMukkanwar <ayushmukkanwar@gmail.com>
> > > ---
> > >  drivers/staging/octeon/ethernet.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
> > > index eadb74fc14c8..5bb8c303f88b 100644
> > > --- a/drivers/staging/octeon/ethernet.c
> > > +++ b/drivers/staging/octeon/ethernet.c
> > > @@ -5,6 +5,7 @@
> > >   * Copyright (c) 2003-2007 Cavium Networks
> > >   */
> > >
> > > +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> > >  #include <linux/platform_device.h>
> > >  #include <linux/kernel.h>
> > >  #include <linux/module.h>
> > > --
> > > 2.53.0
> > >
> >
> > How about working to remove the existing pr_*() calls with the proper
> > dev_*() and netdev_*() calls instead, so that pr_fmt() is not needed at
> > all?  That is the more "correct" solution here.
> >
> > thanks,
> >
> > greg k-h
> 
> Hi Greg,
> 
> After investigating, the pr_*() calls in ethernet-mem.c and
> ethernet-spi.c are inside functions that only receive hardware pool
> indices or register structs with no net_device or device pointer
> available, so dev_*() and netdev_*() replacements are not possible
> there.
> 
> For ethernet.c, device pointers are available at most call sites and I
> can replace those with dev_err() and netdev_err()/netdev_info()
> appropriately. The two calls where no device pointer is available
> would keep pr_err() as is.

That's a good start, but for the others, work back up the call chain to
properly pass in a device pointer so that these warning/error messages
can get printed out properly.  Drivers should not have any "generic"
messages like that, as it does not show what device actually created the
message.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] staging: octeon: ethernet: add pr_fmt macro
  2026-03-25  9:11       ` Greg KH
@ 2026-03-25 19:12         ` Ayush Mukkanwar
  0 siblings, 0 replies; 8+ messages in thread
From: Ayush Mukkanwar @ 2026-03-25 19:12 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-staging, linux-kernel

On Wed, Mar 25, 2026 at 2:41 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Wed, Mar 25, 2026 at 02:33:00PM +0530, Ayush Mukkanwar wrote:
> > On Tue, Mar 24, 2026 at 7:58 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> > >
> > > On Tue, Mar 24, 2026 at 07:00:29PM +0530, AyushMukkanwar wrote:
> > > > Add pr_fmt macro to prefix log messages with the module
> > > > name for easier debugging.
> > > >
> > > > Signed-off-by: AyushMukkanwar <ayushmukkanwar@gmail.com>
> > > > ---
> > > >  drivers/staging/octeon/ethernet.c | 1 +
> > > >  1 file changed, 1 insertion(+)
> > > >
> > > > diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
> > > > index eadb74fc14c8..5bb8c303f88b 100644
> > > > --- a/drivers/staging/octeon/ethernet.c
> > > > +++ b/drivers/staging/octeon/ethernet.c
> > > > @@ -5,6 +5,7 @@
> > > >   * Copyright (c) 2003-2007 Cavium Networks
> > > >   */
> > > >
> > > > +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> > > >  #include <linux/platform_device.h>
> > > >  #include <linux/kernel.h>
> > > >  #include <linux/module.h>
> > > > --
> > > > 2.53.0
> > > >
> > >
> > > How about working to remove the existing pr_*() calls with the proper
> > > dev_*() and netdev_*() calls instead, so that pr_fmt() is not needed at
> > > all?  That is the more "correct" solution here.
> > >
> > > thanks,
> > >
> > > greg k-h
> >
> > Hi Greg,
> >
> > After investigating, the pr_*() calls in ethernet-mem.c and
> > ethernet-spi.c are inside functions that only receive hardware pool
> > indices or register structs with no net_device or device pointer
> > available, so dev_*() and netdev_*() replacements are not possible
> > there.
> >
> > For ethernet.c, device pointers are available at most call sites and I
> > can replace those with dev_err() and netdev_err()/netdev_info()
> > appropriately. The two calls where no device pointer is available
> > would keep pr_err() as is.
>
> That's a good start, but for the others, work back up the call chain to
> properly pass in a device pointer so that these warning/error messages
> can get printed out properly.  Drivers should not have any "generic"
> messages like that, as it does not show what device actually created the
> message.
>
> thanks,
>
> greg k-h

Hi Greg,

After tracing the call chains, the pr_warn() calls are inside
ethernet-mem.c. cvm_oct_mem_fill_fpa() which eventually reaches them
is called from two places:

1. ethernet.c via cvm_oct_configure_common_hw(), which is called from
cvm_oct_probe() - pdev is available here.
2. cvm_oct_rx_refill_pool() in ethernet-rx.h, which is called from
cvm_oct_poll() in ethernet-rx.c - no device pointer is available there
as it is called by the NAPI subsystem and oct_rx_group has no device
pointer either.

Since both call sites share cvm_oct_mem_fill_fpa(), adding a struct
device * parameter would break the second call site. The FPA pool is
shared hardware owned by the platform device, so storing &pdev->dev in
a static global during probe and using that in the mem functions in
ethernet-mem.c seems like the right approach. This avoids changing any
function parameters. The same global could also be used for the
pr_err() calls in ethernet-spi.c, where the interrupt handler has no
device pointer available either. Would that be acceptable, or is there
a preferred way to handle this?

Thanks,
Ayush

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-03-25 19:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-24 13:30 [PATCH 0/3] staging: octeon: add pr_fmt macro to ethernet drivers AyushMukkanwar
2026-03-24 13:30 ` [PATCH 1/3] staging: octeon: ethernet-mem: add pr_fmt macro AyushMukkanwar
2026-03-24 13:30 ` [PATCH 2/3] staging: octeon: ethernet-spi: " AyushMukkanwar
2026-03-24 13:30 ` [PATCH 3/3] staging: octeon: ethernet: " AyushMukkanwar
2026-03-24 14:28   ` Greg KH
2026-03-25  9:03     ` Ayush Mukkanwar
2026-03-25  9:11       ` Greg KH
2026-03-25 19:12         ` Ayush Mukkanwar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox