Re: [PATCH v2 1/2] staging: octeon: ethernet-spi: replace pr_err with dev_err

Greg KH
2026-04-01T10:09:12Z

On Tue, Mar 31, 2026 at 04:47:56PM +0530, AyushMukkanwar wrote:
> Replace pr_err() calls with dev_err() to include device information
> in log messages. The device pointer is passed through the interrupt
> handler via dev_id, which is changed from &number_spi_ports to
> dev->dev.parent in request_irq and free_irq.
>
> Signed-off-by: AyushMukkanwar <ayushmukkanwar@gmail.com>
> ---
> drivers/staging/octeon/ethernet-spi.c | 59 ++++++++++++++-------------
> 1 file changed, 30 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/staging/octeon/ethernet-spi.c b/drivers/staging/octeon/ethernet-spi.c
> index 699c98c5ec13..8c02920c3cdc 100644
> --- a/drivers/staging/octeon/ethernet-spi.c
> +++ b/drivers/staging/octeon/ethernet-spi.c
> @@ -17,67 +17,67 @@
> static int number_spi_ports;
> static int need_retrain[2] = { 0, 0 };
>
> -static void cvm_oct_spxx_int_pr(union cvmx_spxx_int_reg spx_int_reg, int index)
> +static void cvm_oct_spxx_int_pr(union cvmx_spxx_int_reg spx_int_reg, int index, struct device *dev)

This is ok, but this, but usually the pointer is the first argument.
And shouldn't this be a netdev (see below...)

> @@ -107,14 +107,15 @@ static irqreturn_t cvm_oct_spi_rml_interrupt(int cpl, void *dev_id)
> {
> irqreturn_t return_status = IRQ_NONE;
> union cvmx_npi_rsl_int_blocks rsl_int_blocks;
> + struct device *dev = dev_id;

This isn't ok, the function prototype should really be a pointer, not a
void thing.

> @@ -196,7 +197,7 @@ int cvm_oct_spi_init(struct net_device *dev)
>
> if (number_spi_ports == 0) {
> r = request_irq(OCTEON_IRQ_RML, cvm_oct_spi_rml_interrupt,
> - IRQF_SHARED, "SPI", &number_spi_ports);
> + IRQF_SHARED, "SPI", dev->dev.parent);

Wait, no, you can't do anything with the parent!

This is a netdev, keep it a netdev. Don't pass it "up" the device
heirchary to the device pointer, use the real netdev pointer instead.

Also, it seems you didn't test build your changes, what happened?

thanks,

greg k-h