Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp4068525rwe; Tue, 30 Aug 2022 04:12:03 -0700 (PDT) X-Google-Smtp-Source: AA6agR70eA1fBVttbbcN1+i7Qmfn7ywUpQtgqWzwSyq79D9M5RRqb23WX2MROhl3+twWayB/4IfR X-Received: by 2002:a17:902:cf0b:b0:172:72df:4bc with SMTP id i11-20020a170902cf0b00b0017272df04bcmr20515525plg.44.1661857922306; Tue, 30 Aug 2022 04:12:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661857922; cv=none; d=google.com; s=arc-20160816; b=zpA+RIvtS3ZJdkzulF8qQO6zEWJrtjPTSpYd9lJfzI1J5DFMxmCjB1FZ/ollVbWzr9 EMajleyybaFYMMGxzJX0QRXlm9olVOye/Dayw4OTfdeAhyt3WjOfFTmrb0nDMKDMDGks a+GrDrWW6UYaLHemtC6LXRq5Jodob6iImVrdD1nZ8Tg5ojgpEJioXIwkus25GLvgqTap OJPaPDMKOz4hvAuUMubEh6ngVmYWopMARF/i6Dt1UD4mzEcWcaKKzQLmljgrVvkVmTLt Yr8RPwaEWi1+NrOSoFPlrsMeObzFZjehnJUALnFd6oHmeOm096r8a3xi6ZA9KTm7CZUd pIMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1KKzKw2oZUD+qlvQnvBr8jpSsdZA7CeCTan81UeSwWw=; b=UxC0+Jk+s+fet19G0DnRsPxK736wynkO/+RJ9+SJGZnsnljB582yiEfZWdeEDnrbqO UyHUbQvy0jUaQXa0xF7Gx5TRQwfiojLiMAJsD1OYB7M1qga2bZNgrfGYqP9jKZmLVmtr dIAcVfG4Nj7vFqcS7ZlTMjaCQAGNd252bewR9kYtBxJamLFGJsWSHc3/AYkK9OQSwX/G AeAbpRCSEysQYSaE/2e4lFKadT12xzrc826qRVZ1fRS4S4aslYc3VEjnXeqwoM8wU4ly mHXlvBHYGvG5/gTsu3f5gf5WRm/EK/emhm/gFvq5khUPnBBlmeZ7xJG92ZNfKKDftssu qC2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=i9Iq2HTP; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mu17-20020a17090b389100b001faa50c0b94si13356281pjb.31.2022.08.30.04.11.51; Tue, 30 Aug 2022 04:12:02 -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=@microchip.com header.s=mchp header.b=i9Iq2HTP; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229976AbiH3Kxg (ORCPT + 99 others); Tue, 30 Aug 2022 06:53:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229875AbiH3Kxd (ORCPT ); Tue, 30 Aug 2022 06:53:33 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AF4A61B3C; Tue, 30 Aug 2022 03:53:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1661856811; x=1693392811; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3JtcZwD8ykfZwltMBZg2Y5mHojyWHZBx52LH+LqU5qU=; b=i9Iq2HTPW9om5KJ41RLiywtBmNGflLfPq2Pmq2kHVgel4j/pJnuAtSKH 36P/BIaaReJwiP/BrbfqtBpCFChSjdeU0mpj+Nbo1oRG/lAYqU5LMtG7M kRMmxh3slbemT8IXaEgiZnfm68UF+YJRyOO6HISLHFOhx1jNWeW1mJ50B xC2SdJnn+Iw/ngalDuEqomqnd2uHDc8/XGEsEr2sa6uxlcNrhaosJbwQy ncyaK0OUZOm8sS81ZLN9W9FipbH//7KBGVFnH1s817jGXgSmpFzVTui4c L3bT/xOLp1ieYXWfbADrpOns7+zOTm9bSJ7p18tUcfPXNnS0uiCgQKIiW g==; X-IronPort-AV: E=Sophos;i="5.93,274,1654585200"; d="scan'208";a="188626311" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 30 Aug 2022 03:53:30 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Tue, 30 Aug 2022 03:53:29 -0700 Received: from CHE-LT-I17769U.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Tue, 30 Aug 2022 03:53:24 -0700 From: Arun Ramadoss To: , CC: Woojung Huh , , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Russell King" , Tristram Ha Subject: [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 16:23:01 +0530 Message-ID: <20220830105303.22067-2-arun.ramadoss@microchip.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220830105303.22067-1-arun.ramadoss@microchip.com> References: <20220830105303.22067-1-arun.ramadoss@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 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; } -- 2.36.1