Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp4166532rwe; Tue, 30 Aug 2022 05:54:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR70/6Na3Yvt0lR8Yadjn8pUmfUod4TAfvJxGVZP8PUw7NzRipFUFvM8dOwQyhsCKnV7howe X-Received: by 2002:a17:902:e750:b0:174:f3a4:9338 with SMTP id p16-20020a170902e75000b00174f3a49338mr6332905plf.135.1661864060645; Tue, 30 Aug 2022 05:54:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661864060; cv=none; d=google.com; s=arc-20160816; b=aXoLAbmc2qCnoEaDcLtQUNn/ymK5ku3Ydi1Y2YwCqJsXxJA1fmwTixfneBKAxTSTXo 1ts927TMz9wgPtCeGmlRamBQ5DhzKJaQgWaXiKmHLku9iLO1VbrrPvjPm4iSCot9UQjY Epi7kWTdz9VaTWGgMHdDzbuG5laWnfrJs0P6WFlqChm1DnKQw+cC8SKzkwlogdSfw5lj WVei8lA0SS/6hk+KOX8DPZNf+dcrfuBfb9FyiUNNnwLz4jMbWiiEjMD6HEo/ErJ1WhVg qhCYLirLc2E7VMQliWX7doOcdbIXBJfQ5FMvCv8Rzwzgvw/QRLTMKScTbMbHNnXFVPuP wPtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=M7bxnRn0MHLNZePm0ON+15VulQtEk67FJoxG5y08NKc=; b=MmLiO65Q9hkUnGHrifilumUQ7PF8NmqYwSH0O13GRljSEdeYt5wzNT3sfPbrqkm8Gw ozw2Yq2mRbQqQ2VYF9+1J7TxTFV7m7qRvWyU+maVssD2+4WOYyVpq5jI5uXNtohyXo0r itmXgixspJIJmSJpGWZMNdQY8Nj1TRXxhZ8VuHMfiISwf/yyxoU4qo/W9bpS4aP64VA3 BOAIZQAc7/VzUWZmypK/53VI/RBSfhnvBu/3Xtt8pqQpQUpVy4DNowj6OGEGntUHrc2x 2dKhbLUGJUYci3A6LKcDzcqtjO/ltEE3irgHfUYQJkAyDCEwumc+8ShUp7eRcZ3IAGPX ewdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=z2hPJ1CG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z15-20020a170903018f00b00172aa2103bcsi2488089plg.448.2022.08.30.05.54.09; Tue, 30 Aug 2022 05:54:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=z2hPJ1CG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229882AbiH3Mo7 (ORCPT + 99 others); Tue, 30 Aug 2022 08:44:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229725AbiH3Mo5 (ORCPT ); Tue, 30 Aug 2022 08:44:57 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73C07A460; Tue, 30 Aug 2022 05:44:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=M7bxnRn0MHLNZePm0ON+15VulQtEk67FJoxG5y08NKc=; b=z2hPJ1CGLqAoiJSO0R/S4T248Q 4ysQiCPJlVjuruSN38Xl6UZQukdn4mEi+iK8JiBlB/yaElT/aOnf6+2mbXr2zChsSeDBX8pniMBQO cZeefUxNMIUZhrj+fWxve7DeJzSiYp/QfLcYGl+byjSUWPm/hS+dDKHkT0OFNTXqE3pE=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1oT0bq-00F4Wb-W7; Tue, 30 Aug 2022 14:44:50 +0200 Date: Tue, 30 Aug 2022 14:44:50 +0200 From: Andrew Lunn To: Arun Ramadoss Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Woojung Huh , UNGLinuxDriver@microchip.com, Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , Tristram Ha Subject: Re: [RFC Patch net-next v3 1/3] net: dsa: microchip: use dev_ops->reset instead of exit in ksz_switch_register Message-ID: References: <20220830105303.22067-1-arun.ramadoss@microchip.com> <20220830105303.22067-2-arun.ramadoss@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220830105303.22067-2-arun.ramadoss@microchip.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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