* [PATCH v5 1/4] staging: octeon: ethernet-mem: replace pr_warn with dev_warn in free functions
2026-04-27 15:15 [PATCH v5 0/4] staging: octeon: modernize logging and refactor to per-device state Ayush Mukkanwar
@ 2026-04-27 15:15 ` Ayush Mukkanwar
2026-05-04 14:20 ` Greg KH
2026-04-27 15:15 ` [PATCH v5 2/4] staging: octeon: replace pr_warn with dev_warn in fill path Ayush Mukkanwar
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Ayush Mukkanwar @ 2026-04-27 15:15 UTC (permalink / raw)
To: gregkh; +Cc: error27, linux-staging, linux-kernel, ayushmukkanwar
Replace pr_warn() calls with dev_warn() in the hardware pool free
functions (cvm_oct_free_hw_skbuff and cvm_oct_free_hw_memory)
to include device information in log messages. The struct device
pointer is passed from cvm_oct_remove() through
cvm_oct_mem_empty_fpa() to the internal free functions.
Signed-off-by: Ayush Mukkanwar <ayushmukkanwar@gmail.com>
---
drivers/staging/octeon/ethernet-mem.c | 30 +++++++++++++++------------
drivers/staging/octeon/ethernet-mem.h | 2 +-
drivers/staging/octeon/ethernet.c | 6 +++---
3 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/drivers/staging/octeon/ethernet-mem.c b/drivers/staging/octeon/ethernet-mem.c
index 532594957ebc..501a2f7487c1 100644
--- a/drivers/staging/octeon/ethernet-mem.c
+++ b/drivers/staging/octeon/ethernet-mem.c
@@ -40,11 +40,13 @@ static int cvm_oct_fill_hw_skbuff(int pool, int size, int elements)
/**
* cvm_oct_free_hw_skbuff- free hardware pool skbuffs
+ * @dev: Device for logging
* @pool: Pool to allocate an skbuff for
* @size: Size of the buffer needed for the pool
* @elements: Number of buffers to allocate
*/
-static void cvm_oct_free_hw_skbuff(int pool, int size, int elements)
+static void cvm_oct_free_hw_skbuff(struct device *dev,
+ int pool, int size, int elements)
{
char *memory;
@@ -59,11 +61,11 @@ static void cvm_oct_free_hw_skbuff(int pool, int size, int elements)
} while (memory);
if (elements < 0)
- pr_warn("Freeing of pool %u had too many skbuffs (%d)\n",
- pool, elements);
+ dev_warn(dev, "Freeing of pool %u had too many skbuffs (%d)\n",
+ pool, elements);
else if (elements > 0)
- pr_warn("Freeing of pool %u is missing %d skbuffs\n",
- pool, elements);
+ dev_warn(dev, "Freeing of pool %u is missing %d skbuffs\n",
+ pool, elements);
}
/**
@@ -107,11 +109,13 @@ static int cvm_oct_fill_hw_memory(int pool, int size, int elements)
/**
* cvm_oct_free_hw_memory - Free memory allocated by cvm_oct_fill_hw_memory
+ * @dev: Device for logging
* @pool: FPA pool to free
* @size: Size of each buffer in the pool
* @elements: Number of buffers that should be in the pool
*/
-static void cvm_oct_free_hw_memory(int pool, int size, int elements)
+static void cvm_oct_free_hw_memory(struct device *dev,
+ int pool, int size, int elements)
{
char *memory;
char *fpa;
@@ -127,11 +131,11 @@ static void cvm_oct_free_hw_memory(int pool, int size, int elements)
} while (fpa);
if (elements < 0)
- pr_warn("Freeing of pool %u had too many buffers (%d)\n",
- pool, elements);
+ dev_warn(dev, "Freeing of pool %u had too many buffers (%d)\n",
+ pool, elements);
else if (elements > 0)
- pr_warn("Warning: Freeing of pool %u is missing %d buffers\n",
- pool, elements);
+ dev_warn(dev, "Freeing of pool %u is missing %d buffers\n",
+ pool, elements);
}
int cvm_oct_mem_fill_fpa(int pool, int size, int elements)
@@ -145,10 +149,10 @@ int cvm_oct_mem_fill_fpa(int pool, int size, int elements)
return freed;
}
-void cvm_oct_mem_empty_fpa(int pool, int size, int elements)
+void cvm_oct_mem_empty_fpa(struct device *dev, int pool, int size, int elements)
{
if (pool == CVMX_FPA_PACKET_POOL)
- cvm_oct_free_hw_skbuff(pool, size, elements);
+ cvm_oct_free_hw_skbuff(dev, pool, size, elements);
else
- cvm_oct_free_hw_memory(pool, size, elements);
+ cvm_oct_free_hw_memory(dev, pool, size, elements);
}
diff --git a/drivers/staging/octeon/ethernet-mem.h b/drivers/staging/octeon/ethernet-mem.h
index 692dcdb7154d..591e0bbb6f10 100644
--- a/drivers/staging/octeon/ethernet-mem.h
+++ b/drivers/staging/octeon/ethernet-mem.h
@@ -6,4 +6,4 @@
*/
int cvm_oct_mem_fill_fpa(int pool, int size, int elements);
-void cvm_oct_mem_empty_fpa(int pool, int size, int elements);
+void cvm_oct_mem_empty_fpa(struct device *dev, int pool, int size, int elements);
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
index eadb74fc14c8..9eed0a89a2f3 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -958,12 +958,12 @@ static void cvm_oct_remove(struct platform_device *pdev)
cvmx_ipd_free_ptr();
/* Free the HW pools */
- cvm_oct_mem_empty_fpa(CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE,
+ cvm_oct_mem_empty_fpa(&pdev->dev, CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE,
num_packet_buffers);
- cvm_oct_mem_empty_fpa(CVMX_FPA_WQE_POOL, CVMX_FPA_WQE_POOL_SIZE,
+ cvm_oct_mem_empty_fpa(&pdev->dev, CVMX_FPA_WQE_POOL, CVMX_FPA_WQE_POOL_SIZE,
num_packet_buffers);
if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL)
- cvm_oct_mem_empty_fpa(CVMX_FPA_OUTPUT_BUFFER_POOL,
+ cvm_oct_mem_empty_fpa(&pdev->dev, CVMX_FPA_OUTPUT_BUFFER_POOL,
CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 128);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v5 2/4] staging: octeon: replace pr_warn with dev_warn in fill path
2026-04-27 15:15 [PATCH v5 0/4] staging: octeon: modernize logging and refactor to per-device state Ayush Mukkanwar
2026-04-27 15:15 ` [PATCH v5 1/4] staging: octeon: ethernet-mem: replace pr_warn with dev_warn in free functions Ayush Mukkanwar
@ 2026-04-27 15:15 ` Ayush Mukkanwar
2026-05-04 14:21 ` Greg KH
2026-04-27 15:15 ` [PATCH v5 3/4] staging: octeon: ethernet: replace pr_err and pr_info with dev_err and netdev_err Ayush Mukkanwar
2026-04-27 15:15 ` [PATCH v5 4/4] staging: octeon: refactor to per-device state and pass platform_device Ayush Mukkanwar
3 siblings, 1 reply; 10+ messages in thread
From: Ayush Mukkanwar @ 2026-04-27 15:15 UTC (permalink / raw)
To: gregkh; +Cc: error27, linux-staging, linux-kernel, ayushmukkanwar
Replace pr_warn() with dev_warn() in cvm_oct_fill_hw_memory() to
include device information in log messages.
To make the device pointer accessible from the workqueue callback,
introduce struct octeon_ethernet_platform to hold both a struct
device pointer and the delayed_work. This replaces the static global
cvm_oct_rx_refill_work. The struct is allocated with devm_kzalloc()
in probe() and stored via platform_set_drvdata(). The worker
retrieves it using container_of().
Add a struct device pointer to oct_rx_group and thread it through
cvm_oct_rx_initialize() to support the NAPI poll refill path.
Signed-off-by: Ayush Mukkanwar <ayushmukkanwar@gmail.com>
---
drivers/staging/octeon/ethernet-mem.c | 12 +++++----
drivers/staging/octeon/ethernet-mem.h | 2 +-
drivers/staging/octeon/ethernet-rx.c | 6 +++--
drivers/staging/octeon/ethernet-rx.h | 6 ++---
drivers/staging/octeon/ethernet.c | 39 ++++++++++++++++++---------
5 files changed, 42 insertions(+), 23 deletions(-)
diff --git a/drivers/staging/octeon/ethernet-mem.c b/drivers/staging/octeon/ethernet-mem.c
index 501a2f7487c1..f182698dd057 100644
--- a/drivers/staging/octeon/ethernet-mem.c
+++ b/drivers/staging/octeon/ethernet-mem.c
@@ -70,13 +70,15 @@ static void cvm_oct_free_hw_skbuff(struct device *dev,
/**
* cvm_oct_fill_hw_memory - fill a hardware pool with memory.
+ * @dev: Device for logging
* @pool: Pool to populate
* @size: Size of each buffer in the pool
* @elements: Number of buffers to allocate
*
* Returns the actual number of buffers allocated.
*/
-static int cvm_oct_fill_hw_memory(int pool, int size, int elements)
+static int cvm_oct_fill_hw_memory(struct device *dev, int pool, int size,
+ int elements)
{
char *memory;
char *fpa;
@@ -95,8 +97,8 @@ static int cvm_oct_fill_hw_memory(int pool, int size, int elements)
*/
memory = kmalloc(size + 256, GFP_ATOMIC);
if (unlikely(!memory)) {
- pr_warn("Unable to allocate %u bytes for FPA pool %d\n",
- elements * size, pool);
+ dev_warn(dev, "Unable to allocate %u bytes for FPA pool %d\n",
+ elements * size, pool);
break;
}
fpa = (char *)(((unsigned long)memory + 256) & ~0x7fUL);
@@ -138,14 +140,14 @@ static void cvm_oct_free_hw_memory(struct device *dev,
pool, elements);
}
-int cvm_oct_mem_fill_fpa(int pool, int size, int elements)
+int cvm_oct_mem_fill_fpa(struct device *dev, int pool, int size, int elements)
{
int freed;
if (pool == CVMX_FPA_PACKET_POOL)
freed = cvm_oct_fill_hw_skbuff(pool, size, elements);
else
- freed = cvm_oct_fill_hw_memory(pool, size, elements);
+ freed = cvm_oct_fill_hw_memory(dev, pool, size, elements);
return freed;
}
diff --git a/drivers/staging/octeon/ethernet-mem.h b/drivers/staging/octeon/ethernet-mem.h
index 591e0bbb6f10..edfc93b2b23b 100644
--- a/drivers/staging/octeon/ethernet-mem.h
+++ b/drivers/staging/octeon/ethernet-mem.h
@@ -5,5 +5,5 @@
* Copyright (c) 2003-2007 Cavium Networks
*/
-int cvm_oct_mem_fill_fpa(int pool, int size, int elements);
+int cvm_oct_mem_fill_fpa(struct device *dev, int pool, int size, int elements);
void cvm_oct_mem_empty_fpa(struct device *dev, int pool, int size, int elements);
diff --git a/drivers/staging/octeon/ethernet-rx.c b/drivers/staging/octeon/ethernet-rx.c
index d0b43d50b83c..a2f4e52d69f3 100644
--- a/drivers/staging/octeon/ethernet-rx.c
+++ b/drivers/staging/octeon/ethernet-rx.c
@@ -35,6 +35,7 @@ static struct oct_rx_group {
int irq;
int group;
struct napi_struct napi;
+ struct device *dev;
} oct_rx_group[16];
/**
@@ -397,7 +398,7 @@ static int cvm_oct_poll(struct oct_rx_group *rx_group, int budget)
/* Restore the scratch area */
cvmx_scratch_write64(CVMX_SCR_SCRATCH, old_scratch);
}
- cvm_oct_rx_refill_pool(0);
+ cvm_oct_rx_refill_pool(rx_group->dev, 0);
return rx_count;
}
@@ -448,7 +449,7 @@ void cvm_oct_poll_controller(struct net_device *dev)
}
#endif
-void cvm_oct_rx_initialize(void)
+void cvm_oct_rx_initialize(struct device *dev)
{
int i;
struct net_device *dev_for_napi = NULL;
@@ -475,6 +476,7 @@ void cvm_oct_rx_initialize(void)
oct_rx_group[i].irq = OCTEON_IRQ_WORKQ0 + i;
oct_rx_group[i].group = i;
+ oct_rx_group[i].dev = dev;
/* Register an IRQ handler to receive POW interrupts */
ret = request_irq(oct_rx_group[i].irq, cvm_oct_do_interrupt, 0,
diff --git a/drivers/staging/octeon/ethernet-rx.h b/drivers/staging/octeon/ethernet-rx.h
index ff6482fa20d6..636ee7d549f6 100644
--- a/drivers/staging/octeon/ethernet-rx.h
+++ b/drivers/staging/octeon/ethernet-rx.h
@@ -6,10 +6,10 @@
*/
void cvm_oct_poll_controller(struct net_device *dev);
-void cvm_oct_rx_initialize(void);
+void cvm_oct_rx_initialize(struct device *dev);
void cvm_oct_rx_shutdown(void);
-static inline void cvm_oct_rx_refill_pool(int fill_threshold)
+static inline void cvm_oct_rx_refill_pool(struct device *dev, int fill_threshold)
{
int number_to_free;
int num_freed;
@@ -20,7 +20,7 @@ static inline void cvm_oct_rx_refill_pool(int fill_threshold)
if (number_to_free > fill_threshold) {
cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE,
-number_to_free);
- num_freed = cvm_oct_mem_fill_fpa(CVMX_FPA_PACKET_POOL,
+ num_freed = cvm_oct_mem_fill_fpa(dev, CVMX_FPA_PACKET_POOL,
CVMX_FPA_PACKET_POOL_SIZE,
number_to_free);
if (num_freed != number_to_free) {
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
index 9eed0a89a2f3..a7ac29c0a4ca 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -104,11 +104,15 @@ struct net_device *cvm_oct_device[TOTAL_NUMBER_OF_PORTS];
u64 cvm_oct_tx_poll_interval;
-static void cvm_oct_rx_refill_worker(struct work_struct *work);
-static DECLARE_DELAYED_WORK(cvm_oct_rx_refill_work, cvm_oct_rx_refill_worker);
+struct octeon_ethernet_platform {
+ struct device *dev;
+ struct delayed_work rx_refill_work;
+};
static void cvm_oct_rx_refill_worker(struct work_struct *work)
{
+ struct octeon_ethernet_platform *plt = container_of(work,
+ struct octeon_ethernet_platform, rx_refill_work.work);
/*
* FPA 0 may have been drained, try to refill it if we need
* more than num_packet_buffers / 2, otherwise normal receive
@@ -116,10 +120,10 @@ static void cvm_oct_rx_refill_worker(struct work_struct *work)
* could be received so cvm_oct_napi_poll would never be
* invoked to do the refill.
*/
- cvm_oct_rx_refill_pool(num_packet_buffers / 2);
+ cvm_oct_rx_refill_pool(plt->dev, num_packet_buffers / 2);
if (!atomic_read(&cvm_oct_poll_queue_stopping))
- schedule_delayed_work(&cvm_oct_rx_refill_work, HZ);
+ schedule_delayed_work(&plt->rx_refill_work, HZ);
}
static void cvm_oct_periodic_worker(struct work_struct *work)
@@ -138,16 +142,16 @@ static void cvm_oct_periodic_worker(struct work_struct *work)
schedule_delayed_work(&priv->port_periodic_work, HZ);
}
-static void cvm_oct_configure_common_hw(void)
+static void cvm_oct_configure_common_hw(struct device *dev)
{
/* Setup the FPA */
cvmx_fpa_enable();
- cvm_oct_mem_fill_fpa(CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE,
+ cvm_oct_mem_fill_fpa(dev, CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE,
num_packet_buffers);
- cvm_oct_mem_fill_fpa(CVMX_FPA_WQE_POOL, CVMX_FPA_WQE_POOL_SIZE,
+ cvm_oct_mem_fill_fpa(dev, CVMX_FPA_WQE_POOL, CVMX_FPA_WQE_POOL_SIZE,
num_packet_buffers);
if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL)
- cvm_oct_mem_fill_fpa(CVMX_FPA_OUTPUT_BUFFER_POOL,
+ cvm_oct_mem_fill_fpa(dev, CVMX_FPA_OUTPUT_BUFFER_POOL,
CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 1024);
#ifdef __LITTLE_ENDIAN
@@ -678,6 +682,15 @@ static int cvm_oct_probe(struct platform_device *pdev)
int qos;
struct device_node *pip;
int mtu_overhead = ETH_HLEN + ETH_FCS_LEN;
+ struct octeon_ethernet_platform *plt;
+
+ plt = devm_kzalloc(&pdev->dev, sizeof(*plt), GFP_KERNEL);
+ if (!plt)
+ return -ENOMEM;
+
+ plt->dev = &pdev->dev;
+ INIT_DELAYED_WORK(&plt->rx_refill_work, cvm_oct_rx_refill_worker);
+ platform_set_drvdata(pdev, plt);
#if IS_ENABLED(CONFIG_VLAN_8021Q)
mtu_overhead += VLAN_HLEN;
@@ -689,7 +702,7 @@ static int cvm_oct_probe(struct platform_device *pdev)
return -EINVAL;
}
- cvm_oct_configure_common_hw();
+ cvm_oct_configure_common_hw(&pdev->dev);
cvmx_helper_initialize_packet_io_global();
@@ -912,26 +925,28 @@ static int cvm_oct_probe(struct platform_device *pdev)
}
cvm_oct_tx_initialize();
- cvm_oct_rx_initialize();
+ cvm_oct_rx_initialize(&pdev->dev);
/*
* 150 uS: about 10 1500-byte packets at 1GE.
*/
cvm_oct_tx_poll_interval = 150 * (octeon_get_clock_rate() / 1000000);
- schedule_delayed_work(&cvm_oct_rx_refill_work, HZ);
+ schedule_delayed_work(&plt->rx_refill_work, HZ);
return 0;
}
static void cvm_oct_remove(struct platform_device *pdev)
{
+ struct octeon_ethernet_platform *plt = platform_get_drvdata(pdev);
int port;
cvmx_ipd_disable();
atomic_inc_return(&cvm_oct_poll_queue_stopping);
- cancel_delayed_work_sync(&cvm_oct_rx_refill_work);
+
+ cancel_delayed_work_sync(&plt->rx_refill_work);
cvm_oct_rx_shutdown();
cvm_oct_tx_shutdown();
--
2.53.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH v5 2/4] staging: octeon: replace pr_warn with dev_warn in fill path
2026-04-27 15:15 ` [PATCH v5 2/4] staging: octeon: replace pr_warn with dev_warn in fill path Ayush Mukkanwar
@ 2026-05-04 14:21 ` Greg KH
2026-05-04 17:04 ` Ayush Mukkanwar
0 siblings, 1 reply; 10+ messages in thread
From: Greg KH @ 2026-05-04 14:21 UTC (permalink / raw)
To: Ayush Mukkanwar; +Cc: error27, linux-staging, linux-kernel
On Mon, Apr 27, 2026 at 08:45:53PM +0530, Ayush Mukkanwar wrote:
> Replace pr_warn() with dev_warn() in cvm_oct_fill_hw_memory() to
> include device information in log messages.
>
> To make the device pointer accessible from the workqueue callback,
> introduce struct octeon_ethernet_platform to hold both a struct
> device pointer and the delayed_work. This replaces the static global
> cvm_oct_rx_refill_work. The struct is allocated with devm_kzalloc()
> in probe() and stored via platform_set_drvdata(). The worker
> retrieves it using container_of().
>
> Add a struct device pointer to oct_rx_group and thread it through
> cvm_oct_rx_initialize() to support the NAPI poll refill path.
Why isn't this the platform device? And why isn't this data just part
of the platform device's data anyway? Why is it a separate "thing"?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v5 2/4] staging: octeon: replace pr_warn with dev_warn in fill path
2026-05-04 14:21 ` Greg KH
@ 2026-05-04 17:04 ` Ayush Mukkanwar
0 siblings, 0 replies; 10+ messages in thread
From: Ayush Mukkanwar @ 2026-05-04 17:04 UTC (permalink / raw)
To: Greg KH; +Cc: error27, linux-staging, linux-kernel
On Mon, May 4, 2026 at 8:26 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Mon, Apr 27, 2026 at 08:45:53PM +0530, Ayush Mukkanwar wrote:
> > Replace pr_warn() with dev_warn() in cvm_oct_fill_hw_memory() to
> > include device information in log messages.
> >
> > To make the device pointer accessible from the workqueue callback,
> > introduce struct octeon_ethernet_platform to hold both a struct
> > device pointer and the delayed_work. This replaces the static global
> > cvm_oct_rx_refill_work. The struct is allocated with devm_kzalloc()
> > in probe() and stored via platform_set_drvdata(). The worker
> > retrieves it using container_of().
> >
> > Add a struct device pointer to oct_rx_group and thread it through
> > cvm_oct_rx_initialize() to support the NAPI poll refill path.
>
> Why isn't this the platform device? And why isn't this data just part
> of the platform device's data anyway? Why is it a separate "thing"?
>
> thanks,
>
> greg k-h
Hi Greg,
Thank you for the review.
The changes you're pointing out were in the later patches of the v5 series.
My mistake was splitting them across patches rather than doing it
correctly from the start, which left an inconsistent intermediate
state.
I've reworked the series so that struct platform_device is passed
from the first patch, and oct_rx_group is placed inside
octeon_ethernet_platform in the same patch that introduces it.
Will send v6 shortly.
Thanks,
Ayush
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v5 3/4] staging: octeon: ethernet: replace pr_err and pr_info with dev_err and netdev_err
2026-04-27 15:15 [PATCH v5 0/4] staging: octeon: modernize logging and refactor to per-device state Ayush Mukkanwar
2026-04-27 15:15 ` [PATCH v5 1/4] staging: octeon: ethernet-mem: replace pr_warn with dev_warn in free functions Ayush Mukkanwar
2026-04-27 15:15 ` [PATCH v5 2/4] staging: octeon: replace pr_warn with dev_warn in fill path Ayush Mukkanwar
@ 2026-04-27 15:15 ` Ayush Mukkanwar
2026-04-27 15:15 ` [PATCH v5 4/4] staging: octeon: refactor to per-device state and pass platform_device Ayush Mukkanwar
3 siblings, 0 replies; 10+ messages in thread
From: Ayush Mukkanwar @ 2026-04-27 15:15 UTC (permalink / raw)
To: gregkh; +Cc: error27, linux-staging, linux-kernel, ayushmukkanwar
Replace pr_err() and pr_info() calls in cvm_oct_probe() with
dev_err(), netdev_err(), and netdev_info() to include device
information in log messages. Use dev_err() where no net_device
is available (allocation failures), and netdev_err()/netdev_info()
where a net_device exists.
Signed-off-by: Ayush Mukkanwar <ayushmukkanwar@gmail.com>
---
drivers/staging/octeon/ethernet.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
index a7ac29c0a4ca..7c3cfd9efa7e 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -698,7 +698,7 @@ static int cvm_oct_probe(struct platform_device *pdev)
pip = pdev->dev.of_node;
if (!pip) {
- pr_err("Error: No 'pip' in /aliases\n");
+ dev_err(&pdev->dev, "No 'pip' in /aliases\n");
return -EINVAL;
}
@@ -796,16 +796,16 @@ static int cvm_oct_probe(struct platform_device *pdev)
dev->max_mtu = OCTEON_MAX_MTU - mtu_overhead;
if (register_netdev(dev) < 0) {
- pr_err("Failed to register ethernet device for POW\n");
+ netdev_err(dev, "Failed to register ethernet device for POW\n");
free_netdev(dev);
} else {
cvm_oct_device[CVMX_PIP_NUM_INPUT_PORTS] = dev;
- pr_info("%s: POW send group %d, receive group %d\n",
- dev->name, pow_send_group,
- pow_receive_group);
+ netdev_info(dev, "POW send group %d, receive group %d\n",
+ pow_send_group,
+ pow_receive_group);
}
} else {
- pr_err("Failed to allocate ethernet device for POW\n");
+ dev_err(&pdev->dev, "Failed to allocate ethernet device for POW\n");
}
}
@@ -825,8 +825,8 @@ static int cvm_oct_probe(struct platform_device *pdev)
struct net_device *dev =
alloc_etherdev(sizeof(struct octeon_ethernet));
if (!dev) {
- pr_err("Failed to allocate ethernet device for port %d\n",
- port);
+ dev_err(&pdev->dev, "Failed to allocate ethernet device for port %d\n",
+ port);
continue;
}
@@ -910,8 +910,8 @@ static int cvm_oct_probe(struct platform_device *pdev)
if (!dev->netdev_ops) {
free_netdev(dev);
} else if (register_netdev(dev) < 0) {
- pr_err("Failed to register ethernet device for interface %d, port %d\n",
- interface, priv->port);
+ netdev_err(dev, "Failed to register ethernet device for interface %d, port %d\n",
+ interface, priv->port);
free_netdev(dev);
} else {
cvm_oct_device[priv->port] = dev;
--
2.53.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v5 4/4] staging: octeon: refactor to per-device state and pass platform_device
2026-04-27 15:15 [PATCH v5 0/4] staging: octeon: modernize logging and refactor to per-device state Ayush Mukkanwar
` (2 preceding siblings ...)
2026-04-27 15:15 ` [PATCH v5 3/4] staging: octeon: ethernet: replace pr_err and pr_info with dev_err and netdev_err Ayush Mukkanwar
@ 2026-04-27 15:15 ` Ayush Mukkanwar
2026-04-28 9:48 ` Dan Carpenter
3 siblings, 1 reply; 10+ messages in thread
From: Ayush Mukkanwar @ 2026-04-27 15:15 UTC (permalink / raw)
To: gregkh; +Cc: error27, linux-staging, linux-kernel, ayushmukkanwar
Move the static oct_rx_group array from ethernet-rx.c into the
octeon_ethernet_platform structure to associate receive group state
with the platform device. Pass struct platform_device instead of
struct device through the ethernet-mem and ethernet-rx call chains,
extracting &pdev->dev only at the point of use in dev_warn() calls.
Move struct oct_rx_group and struct octeon_ethernet_platform
definitions into octeon-ethernet.h so they are shared across
compilation units.
Signed-off-by: Ayush Mukkanwar <ayushmukkanwar@gmail.com>
---
drivers/staging/octeon/ethernet-mem.c | 34 ++++++++--------
drivers/staging/octeon/ethernet-mem.h | 8 +++-
drivers/staging/octeon/ethernet-rx.c | 51 ++++++++++++------------
drivers/staging/octeon/ethernet-rx.h | 11 +++--
drivers/staging/octeon/ethernet.c | 29 ++++++--------
drivers/staging/octeon/octeon-ethernet.h | 18 ++++++++-
6 files changed, 83 insertions(+), 68 deletions(-)
diff --git a/drivers/staging/octeon/ethernet-mem.c b/drivers/staging/octeon/ethernet-mem.c
index f182698dd057..c9b439aaf23f 100644
--- a/drivers/staging/octeon/ethernet-mem.c
+++ b/drivers/staging/octeon/ethernet-mem.c
@@ -5,13 +5,13 @@
* Copyright (c) 2003-2010 Cavium Networks
*/
+#include <linux/platform_device.h>
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <linux/slab.h>
#include "octeon-ethernet.h"
#include "ethernet-mem.h"
-#include "ethernet-defines.h"
/**
* cvm_oct_fill_hw_skbuff - fill the supplied hardware pool with skbuffs
@@ -40,12 +40,12 @@ static int cvm_oct_fill_hw_skbuff(int pool, int size, int elements)
/**
* cvm_oct_free_hw_skbuff- free hardware pool skbuffs
- * @dev: Device for logging
+ * @pdev: Platform device for logging
* @pool: Pool to allocate an skbuff for
* @size: Size of the buffer needed for the pool
* @elements: Number of buffers to allocate
*/
-static void cvm_oct_free_hw_skbuff(struct device *dev,
+static void cvm_oct_free_hw_skbuff(struct platform_device *pdev,
int pool, int size, int elements)
{
char *memory;
@@ -61,23 +61,23 @@ static void cvm_oct_free_hw_skbuff(struct device *dev,
} while (memory);
if (elements < 0)
- dev_warn(dev, "Freeing of pool %u had too many skbuffs (%d)\n",
+ dev_warn(&pdev->dev, "Freeing of pool %u had too many skbuffs (%d)\n",
pool, elements);
else if (elements > 0)
- dev_warn(dev, "Freeing of pool %u is missing %d skbuffs\n",
+ dev_warn(&pdev->dev, "Freeing of pool %u is missing %d skbuffs\n",
pool, elements);
}
/**
* cvm_oct_fill_hw_memory - fill a hardware pool with memory.
- * @dev: Device for logging
+ * @pdev: Platform device for logging
* @pool: Pool to populate
* @size: Size of each buffer in the pool
* @elements: Number of buffers to allocate
*
* Returns the actual number of buffers allocated.
*/
-static int cvm_oct_fill_hw_memory(struct device *dev, int pool, int size,
+static int cvm_oct_fill_hw_memory(struct platform_device *pdev, int pool, int size,
int elements)
{
char *memory;
@@ -97,7 +97,7 @@ static int cvm_oct_fill_hw_memory(struct device *dev, int pool, int size,
*/
memory = kmalloc(size + 256, GFP_ATOMIC);
if (unlikely(!memory)) {
- dev_warn(dev, "Unable to allocate %u bytes for FPA pool %d\n",
+ dev_warn(&pdev->dev, "Unable to allocate %u bytes for FPA pool %d\n",
elements * size, pool);
break;
}
@@ -111,12 +111,12 @@ static int cvm_oct_fill_hw_memory(struct device *dev, int pool, int size,
/**
* cvm_oct_free_hw_memory - Free memory allocated by cvm_oct_fill_hw_memory
- * @dev: Device for logging
+ * @pdev: Platform device for logging
* @pool: FPA pool to free
* @size: Size of each buffer in the pool
* @elements: Number of buffers that should be in the pool
*/
-static void cvm_oct_free_hw_memory(struct device *dev,
+static void cvm_oct_free_hw_memory(struct platform_device *pdev,
int pool, int size, int elements)
{
char *memory;
@@ -133,28 +133,28 @@ static void cvm_oct_free_hw_memory(struct device *dev,
} while (fpa);
if (elements < 0)
- dev_warn(dev, "Freeing of pool %u had too many buffers (%d)\n",
+ dev_warn(&pdev->dev, "Freeing of pool %u had too many buffers (%d)\n",
pool, elements);
else if (elements > 0)
- dev_warn(dev, "Freeing of pool %u is missing %d buffers\n",
+ dev_warn(&pdev->dev, "Freeing of pool %u is missing %d buffers\n",
pool, elements);
}
-int cvm_oct_mem_fill_fpa(struct device *dev, int pool, int size, int elements)
+int cvm_oct_mem_fill_fpa(struct platform_device *pdev, int pool, int size, int elements)
{
int freed;
if (pool == CVMX_FPA_PACKET_POOL)
freed = cvm_oct_fill_hw_skbuff(pool, size, elements);
else
- freed = cvm_oct_fill_hw_memory(dev, pool, size, elements);
+ freed = cvm_oct_fill_hw_memory(pdev, pool, size, elements);
return freed;
}
-void cvm_oct_mem_empty_fpa(struct device *dev, int pool, int size, int elements)
+void cvm_oct_mem_empty_fpa(struct platform_device *pdev, int pool, int size, int elements)
{
if (pool == CVMX_FPA_PACKET_POOL)
- cvm_oct_free_hw_skbuff(dev, pool, size, elements);
+ cvm_oct_free_hw_skbuff(pdev, pool, size, elements);
else
- cvm_oct_free_hw_memory(dev, pool, size, elements);
+ cvm_oct_free_hw_memory(pdev, pool, size, elements);
}
diff --git a/drivers/staging/octeon/ethernet-mem.h b/drivers/staging/octeon/ethernet-mem.h
index edfc93b2b23b..9279bb0de2db 100644
--- a/drivers/staging/octeon/ethernet-mem.h
+++ b/drivers/staging/octeon/ethernet-mem.h
@@ -5,5 +5,9 @@
* Copyright (c) 2003-2007 Cavium Networks
*/
-int cvm_oct_mem_fill_fpa(struct device *dev, int pool, int size, int elements);
-void cvm_oct_mem_empty_fpa(struct device *dev, int pool, int size, int elements);
+struct platform_device;
+
+int cvm_oct_mem_fill_fpa(struct platform_device *pdev, int pool, int size,
+ int elements);
+void cvm_oct_mem_empty_fpa(struct platform_device *pdev, int pool, int size,
+ int elements);
diff --git a/drivers/staging/octeon/ethernet-rx.c b/drivers/staging/octeon/ethernet-rx.c
index a2f4e52d69f3..1afaafbcaf19 100644
--- a/drivers/staging/octeon/ethernet-rx.c
+++ b/drivers/staging/octeon/ethernet-rx.c
@@ -5,6 +5,7 @@
* Copyright (c) 2003-2010 Cavium Networks
*/
+#include <linux/platform_device.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/cache.h>
@@ -31,13 +32,6 @@
static atomic_t oct_rx_ready = ATOMIC_INIT(0);
-static struct oct_rx_group {
- int irq;
- int group;
- struct napi_struct napi;
- struct device *dev;
-} oct_rx_group[16];
-
/**
* cvm_oct_do_interrupt - interrupt handler.
* @irq: Interrupt number.
@@ -398,7 +392,7 @@ static int cvm_oct_poll(struct oct_rx_group *rx_group, int budget)
/* Restore the scratch area */
cvmx_scratch_write64(CVMX_SCR_SCRATCH, old_scratch);
}
- cvm_oct_rx_refill_pool(rx_group->dev, 0);
+ cvm_oct_rx_refill_pool(rx_group->pdev, 0);
return rx_count;
}
@@ -435,24 +429,28 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget)
*/
void cvm_oct_poll_controller(struct net_device *dev)
{
+ struct platform_device *pdev = to_platform_device(dev->dev.parent);
+ struct octeon_ethernet_platform *plt = platform_get_drvdata(pdev);
int i;
if (!atomic_read(&oct_rx_ready))
return;
- for (i = 0; i < ARRAY_SIZE(oct_rx_group); i++) {
+ for (i = 0; i < ARRAY_SIZE(plt->rx_group); i++) {
if (!(pow_receive_groups & BIT(i)))
continue;
- cvm_oct_poll(&oct_rx_group[i], 16);
+ cvm_oct_poll(&plt->rx_group[i], 16);
}
}
#endif
-void cvm_oct_rx_initialize(struct device *dev)
+void cvm_oct_rx_initialize(struct platform_device *pdev)
{
int i;
struct net_device *dev_for_napi = NULL;
+ struct octeon_ethernet_platform *plt = platform_get_drvdata(pdev);
+ struct oct_rx_group *rx_group = plt->rx_group;
for (i = 0; i < TOTAL_NUMBER_OF_PORTS; i++) {
if (cvm_oct_device[i]) {
@@ -464,28 +462,28 @@ void cvm_oct_rx_initialize(struct device *dev)
if (!dev_for_napi)
panic("No net_devices were allocated.");
- for (i = 0; i < ARRAY_SIZE(oct_rx_group); i++) {
+ for (i = 0; i < ARRAY_SIZE(plt->rx_group); i++) {
int ret;
if (!(pow_receive_groups & BIT(i)))
continue;
- netif_napi_add_weight(dev_for_napi, &oct_rx_group[i].napi,
+ netif_napi_add_weight(dev_for_napi, &rx_group[i].napi,
cvm_oct_napi_poll, rx_napi_weight);
- napi_enable(&oct_rx_group[i].napi);
+ napi_enable(&rx_group[i].napi);
- oct_rx_group[i].irq = OCTEON_IRQ_WORKQ0 + i;
- oct_rx_group[i].group = i;
- oct_rx_group[i].dev = dev;
+ rx_group[i].irq = OCTEON_IRQ_WORKQ0 + i;
+ rx_group[i].group = i;
+ rx_group[i].pdev = pdev;
/* Register an IRQ handler to receive POW interrupts */
- ret = request_irq(oct_rx_group[i].irq, cvm_oct_do_interrupt, 0,
- "Ethernet", &oct_rx_group[i].napi);
+ ret = request_irq(rx_group[i].irq, cvm_oct_do_interrupt, 0,
+ "Ethernet", &rx_group[i].napi);
if (ret)
panic("Could not acquire Ethernet IRQ %d\n",
- oct_rx_group[i].irq);
+ rx_group[i].irq);
- disable_irq_nosync(oct_rx_group[i].irq);
+ disable_irq_nosync(rx_group[i].irq);
/* Enable POW interrupt when our port has at least one packet */
if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
@@ -517,16 +515,17 @@ void cvm_oct_rx_initialize(struct device *dev)
/* Schedule NAPI now. This will indirectly enable the
* interrupt.
*/
- napi_schedule(&oct_rx_group[i].napi);
+ napi_schedule(&rx_group[i].napi);
}
atomic_inc(&oct_rx_ready);
}
-void cvm_oct_rx_shutdown(void)
+void cvm_oct_rx_shutdown(struct platform_device *pdev)
{
+ struct octeon_ethernet_platform *plt = platform_get_drvdata(pdev);
int i;
- for (i = 0; i < ARRAY_SIZE(oct_rx_group); i++) {
+ for (i = 0; i < ARRAY_SIZE(plt->rx_group); i++) {
if (!(pow_receive_groups & BIT(i)))
continue;
@@ -537,8 +536,8 @@ void cvm_oct_rx_shutdown(void)
cvmx_write_csr(CVMX_POW_WQ_INT_THRX(i), 0);
/* Free the interrupt handler */
- free_irq(oct_rx_group[i].irq, &oct_rx_group[i].napi);
+ free_irq(plt->rx_group[i].irq, &plt->rx_group[i].napi);
- netif_napi_del(&oct_rx_group[i].napi);
+ netif_napi_del(&plt->rx_group[i].napi);
}
}
diff --git a/drivers/staging/octeon/ethernet-rx.h b/drivers/staging/octeon/ethernet-rx.h
index 636ee7d549f6..6093694326cb 100644
--- a/drivers/staging/octeon/ethernet-rx.h
+++ b/drivers/staging/octeon/ethernet-rx.h
@@ -5,11 +5,14 @@
* Copyright (c) 2003-2007 Cavium Networks
*/
+struct platform_device;
+
void cvm_oct_poll_controller(struct net_device *dev);
-void cvm_oct_rx_initialize(struct device *dev);
-void cvm_oct_rx_shutdown(void);
+void cvm_oct_rx_initialize(struct platform_device *pdev);
+void cvm_oct_rx_shutdown(struct platform_device *pdev);
-static inline void cvm_oct_rx_refill_pool(struct device *dev, int fill_threshold)
+static inline void cvm_oct_rx_refill_pool(struct platform_device *pdev,
+ int fill_threshold)
{
int number_to_free;
int num_freed;
@@ -20,7 +23,7 @@ static inline void cvm_oct_rx_refill_pool(struct device *dev, int fill_threshold
if (number_to_free > fill_threshold) {
cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE,
-number_to_free);
- num_freed = cvm_oct_mem_fill_fpa(dev, CVMX_FPA_PACKET_POOL,
+ num_freed = cvm_oct_mem_fill_fpa(pdev, CVMX_FPA_PACKET_POOL,
CVMX_FPA_PACKET_POOL_SIZE,
number_to_free);
if (num_freed != number_to_free) {
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
index 7c3cfd9efa7e..02984a27523c 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -104,11 +104,6 @@ struct net_device *cvm_oct_device[TOTAL_NUMBER_OF_PORTS];
u64 cvm_oct_tx_poll_interval;
-struct octeon_ethernet_platform {
- struct device *dev;
- struct delayed_work rx_refill_work;
-};
-
static void cvm_oct_rx_refill_worker(struct work_struct *work)
{
struct octeon_ethernet_platform *plt = container_of(work,
@@ -120,7 +115,7 @@ static void cvm_oct_rx_refill_worker(struct work_struct *work)
* could be received so cvm_oct_napi_poll would never be
* invoked to do the refill.
*/
- cvm_oct_rx_refill_pool(plt->dev, num_packet_buffers / 2);
+ cvm_oct_rx_refill_pool(plt->pdev, num_packet_buffers / 2);
if (!atomic_read(&cvm_oct_poll_queue_stopping))
schedule_delayed_work(&plt->rx_refill_work, HZ);
@@ -142,16 +137,16 @@ static void cvm_oct_periodic_worker(struct work_struct *work)
schedule_delayed_work(&priv->port_periodic_work, HZ);
}
-static void cvm_oct_configure_common_hw(struct device *dev)
+static void cvm_oct_configure_common_hw(struct platform_device *pdev)
{
/* Setup the FPA */
cvmx_fpa_enable();
- cvm_oct_mem_fill_fpa(dev, CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE,
+ cvm_oct_mem_fill_fpa(pdev, CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE,
num_packet_buffers);
- cvm_oct_mem_fill_fpa(dev, CVMX_FPA_WQE_POOL, CVMX_FPA_WQE_POOL_SIZE,
+ cvm_oct_mem_fill_fpa(pdev, CVMX_FPA_WQE_POOL, CVMX_FPA_WQE_POOL_SIZE,
num_packet_buffers);
if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL)
- cvm_oct_mem_fill_fpa(dev, CVMX_FPA_OUTPUT_BUFFER_POOL,
+ cvm_oct_mem_fill_fpa(pdev, CVMX_FPA_OUTPUT_BUFFER_POOL,
CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 1024);
#ifdef __LITTLE_ENDIAN
@@ -688,7 +683,7 @@ static int cvm_oct_probe(struct platform_device *pdev)
if (!plt)
return -ENOMEM;
- plt->dev = &pdev->dev;
+ plt->pdev = pdev;
INIT_DELAYED_WORK(&plt->rx_refill_work, cvm_oct_rx_refill_worker);
platform_set_drvdata(pdev, plt);
@@ -702,7 +697,7 @@ static int cvm_oct_probe(struct platform_device *pdev)
return -EINVAL;
}
- cvm_oct_configure_common_hw(&pdev->dev);
+ cvm_oct_configure_common_hw(pdev);
cvmx_helper_initialize_packet_io_global();
@@ -925,7 +920,7 @@ static int cvm_oct_probe(struct platform_device *pdev)
}
cvm_oct_tx_initialize();
- cvm_oct_rx_initialize(&pdev->dev);
+ cvm_oct_rx_initialize(pdev);
/*
* 150 uS: about 10 1500-byte packets at 1GE.
@@ -948,7 +943,7 @@ static void cvm_oct_remove(struct platform_device *pdev)
cancel_delayed_work_sync(&plt->rx_refill_work);
- cvm_oct_rx_shutdown();
+ cvm_oct_rx_shutdown(pdev);
cvm_oct_tx_shutdown();
cvmx_pko_disable();
@@ -973,12 +968,12 @@ static void cvm_oct_remove(struct platform_device *pdev)
cvmx_ipd_free_ptr();
/* Free the HW pools */
- cvm_oct_mem_empty_fpa(&pdev->dev, CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE,
+ cvm_oct_mem_empty_fpa(pdev, CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE,
num_packet_buffers);
- cvm_oct_mem_empty_fpa(&pdev->dev, CVMX_FPA_WQE_POOL, CVMX_FPA_WQE_POOL_SIZE,
+ cvm_oct_mem_empty_fpa(pdev, CVMX_FPA_WQE_POOL, CVMX_FPA_WQE_POOL_SIZE,
num_packet_buffers);
if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL)
- cvm_oct_mem_empty_fpa(&pdev->dev, CVMX_FPA_OUTPUT_BUFFER_POOL,
+ cvm_oct_mem_empty_fpa(pdev, CVMX_FPA_OUTPUT_BUFFER_POOL,
CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 128);
}
diff --git a/drivers/staging/octeon/octeon-ethernet.h b/drivers/staging/octeon/octeon-ethernet.h
index a6140705706f..57e4029a13d0 100644
--- a/drivers/staging/octeon/octeon-ethernet.h
+++ b/drivers/staging/octeon/octeon-ethernet.h
@@ -11,6 +11,7 @@
#ifndef OCTEON_ETHERNET_H
#define OCTEON_ETHERNET_H
+#include <linux/netdevice.h>
#include <linux/of.h>
#include <linux/phy.h>
@@ -70,8 +71,21 @@ struct octeon_ethernet {
u64 link_info;
/* Called periodically to check link status */
void (*poll)(struct net_device *dev);
- struct delayed_work port_periodic_work;
- struct device_node *of_node;
+ struct delayed_work port_periodic_work;
+ struct device_node *of_node;
+};
+
+struct oct_rx_group {
+ int irq;
+ int group;
+ struct napi_struct napi;
+ struct platform_device *pdev;
+};
+
+struct octeon_ethernet_platform {
+ struct platform_device *pdev;
+ struct delayed_work rx_refill_work;
+ struct oct_rx_group rx_group[16];
};
int cvm_oct_free_work(void *work_queue_entry);
--
2.53.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH v5 4/4] staging: octeon: refactor to per-device state and pass platform_device
2026-04-27 15:15 ` [PATCH v5 4/4] staging: octeon: refactor to per-device state and pass platform_device Ayush Mukkanwar
@ 2026-04-28 9:48 ` Dan Carpenter
2026-04-28 14:31 ` Ayush Mukkanwar
0 siblings, 1 reply; 10+ messages in thread
From: Dan Carpenter @ 2026-04-28 9:48 UTC (permalink / raw)
To: Ayush Mukkanwar; +Cc: gregkh, linux-staging, linux-kernel
On Mon, Apr 27, 2026 at 08:45:55PM +0530, Ayush Mukkanwar wrote:
> Move the static oct_rx_group array from ethernet-rx.c into the
> octeon_ethernet_platform structure to associate receive group state
> with the platform device.
How is this related to logging?
> Pass struct platform_device instead of
> struct device through the ethernet-mem and ethernet-rx call chains,
> extracting &pdev->dev only at the point of use in dev_warn() calls.
You're undoing something that you did in patch 1. Just do it
correctly the first time instead of doing it and the fixing it
in the same patchset.
>
> Move struct oct_rx_group and struct octeon_ethernet_platform
> definitions into octeon-ethernet.h so they are shared across
> compilation units.
>
Btw, here:
> + struct octeon_ethernet_platform *plt = platform_get_drvdata(pdev);
Could you name it "plat" instead of "plt"? Generally "plt" is an
acronym for something else. Procedure Linkage Table or
Phy LED Trigger. There are a couple other meanings.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v5 4/4] staging: octeon: refactor to per-device state and pass platform_device
2026-04-28 9:48 ` Dan Carpenter
@ 2026-04-28 14:31 ` Ayush Mukkanwar
0 siblings, 0 replies; 10+ messages in thread
From: Ayush Mukkanwar @ 2026-04-28 14:31 UTC (permalink / raw)
To: Dan Carpenter; +Cc: gregkh, linux-staging, linux-kernel
On Tue, Apr 28, 2026 at 3:18 PM Dan Carpenter <error27@gmail.com> wrote:
>
> On Mon, Apr 27, 2026 at 08:45:55PM +0530, Ayush Mukkanwar wrote:
> > Move the static oct_rx_group array from ethernet-rx.c into the
> > octeon_ethernet_platform structure to associate receive group state
> > with the platform device.
>
> How is this related to logging?
>
> > Pass struct platform_device instead of
> > struct device through the ethernet-mem and ethernet-rx call chains,
> > extracting &pdev->dev only at the point of use in dev_warn() calls.
>
> You're undoing something that you did in patch 1. Just do it
> correctly the first time instead of doing it and the fixing it
> in the same patchset.
>
> >
> > Move struct oct_rx_group and struct octeon_ethernet_platform
> > definitions into octeon-ethernet.h so they are shared across
> > compilation units.
> >
>
> Btw, here:
>
> > + struct octeon_ethernet_platform *plt = platform_get_drvdata(pdev);
>
> Could you name it "plat" instead of "plt"? Generally "plt" is an
> acronym for something else. Procedure Linkage Table or
> Phy LED Trigger. There are a couple other meanings.
>
> regards,
> dan carpenter
>
Thanks for the review, Dan.
The rx_group refactoring was requested by Greg in his v4 review. The
logging conversion required storing a device pointer in the static
oct_rx_group array to pass it through the rx poll path. Greg asked to
eliminate that global state by moving it into the platform device
local structure.
You're right that I should fold the platform_device change into the
earlier patches to avoid the undo. I'll also rename plt to plat. Will
send v6 with these fixes.
^ permalink raw reply [flat|nested] 10+ messages in thread