From: Andrew Lunn <andrew@lunn.ch>
To: Arun Ramadoss <arun.ramadoss@microchip.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
Woojung Huh <woojung.huh@microchip.com>,
UNGLinuxDriver@microchip.com,
Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Russell King <linux@armlinux.org.uk>,
Tristram Ha <Tristram.Ha@microchip.com>
Subject: Re: [RFC Patch net-next v3 1/3] net: dsa: microchip: use dev_ops->reset instead of exit in ksz_switch_register
Date: Tue, 30 Aug 2022 14:44:50 +0200 [thread overview]
Message-ID: <Yw4GQgIMSCmF3UMC@lunn.ch> (raw)
In-Reply-To: <20220830105303.22067-2-arun.ramadoss@microchip.com>
On Tue, Aug 30, 2022 at 04:23:01PM +0530, Arun Ramadoss wrote:
> ksz8_switch_exit, ksz9477_switch_exit and lan937x_switch_exit functions
> all call the reset function which is assigned to dev_ops->reset hooks.
> So instead of calling the dev_ops->exit in ksz_switch_register during
> the error condition of dsa_register_switch, dev_ops->reset is used now.
> The dev_ops->exit can be extended in lan937x for freeing up the irq
> during the ksz_spi_remove. If we add the irq remove in the exit function
> and it is called during the dsa_switch_register error condition, kernel
> panic happens since irq is setup only in setup operation. To avoid the
> kernel panic, dev_ops->reset is used instead of exit.
>
> Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com>
> ---
> drivers/net/dsa/microchip/ksz_common.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
> index 6bd69a7e6809..da9bdf753f7a 100644
> --- a/drivers/net/dsa/microchip/ksz_common.c
> +++ b/drivers/net/dsa/microchip/ksz_common.c
> @@ -1963,7 +1963,7 @@ int ksz_switch_register(struct ksz_device *dev)
>
> ret = dsa_register_switch(dev->ds);
> if (ret) {
> - dev->dev_ops->exit(dev);
> + dev->dev_ops->reset(dev);
> return ret;
I don't like this change. You are supposed to be undoing whatever
ksz_switch_register() has done so far. It appears to of called
ops->init() so far, so calling ops->exit() should be the opposite.
If you are making exit() not the opposite of init() in later patches,
it suggests your code structure is wrong. If exit() is not already the
opposite of init() then fix that.
Andrew
next prev parent reply other threads:[~2022-08-30 12:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-30 10:53 [RFC Patch net-next v3 0/3] net: dsa: microchip: lan937x: enable interrupt for internal phy link detection Arun Ramadoss
2022-08-30 10:53 ` [RFC Patch net-next v3 1/3] net: dsa: microchip: use dev_ops->reset instead of exit in ksz_switch_register Arun Ramadoss
2022-08-30 12:44 ` Andrew Lunn [this message]
2022-08-30 10:53 ` [RFC Patch net-next v3 2/3] net: dsa: microchip: add reference to ksz_device inside the ksz_port Arun Ramadoss
2022-08-30 12:47 ` Andrew Lunn
2022-08-30 10:53 ` [RFC Patch net-next v3 3/3] net: dsa: microchip: lan937x: add interrupt support for port phy link Arun Ramadoss
2022-08-30 13:25 ` Andrew Lunn
2022-09-01 9:02 ` Arun.Ramadoss
2022-09-01 12:32 ` Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Yw4GQgIMSCmF3UMC@lunn.ch \
--to=andrew@lunn.ch \
--cc=Tristram.Ha@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=arun.ramadoss@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=vivien.didelot@gmail.com \
--cc=woojung.huh@microchip.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox