From patchwork Mon Jan 11 17:43:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 360826 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6B8FC433DB for ; Mon, 11 Jan 2021 17:45:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 66EA022AAF for ; Mon, 11 Jan 2021 17:45:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389791AbhAKRo1 (ORCPT ); Mon, 11 Jan 2021 12:44:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389732AbhAKRoV (ORCPT ); Mon, 11 Jan 2021 12:44:21 -0500 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41352C0617A5 for ; Mon, 11 Jan 2021 09:43:40 -0800 (PST) Received: by mail-ej1-x632.google.com with SMTP id jx16so793417ejb.10 for ; Mon, 11 Jan 2021 09:43:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UU3FB+g8F4Nk3f4RaT1VmvnnzOjaL3mrsS+FSId6TB4=; b=C2/vt6pc5UvPBedaEho2aPdDmrAoQjcegSvVb1IqGx0zR1BRNgMemirzLYkuuyu2gp PXAdv07jLbl8KHcjg7CY+5fL7L+oqkRgBzVG5GPkE9Ar6Ib/eXJXJ58kpNMSArzf3grQ fiTRcalX7sFaLNL3lh2TyN1ytN2qFlzb08G45CYWZUcuYEQyviO0t7e9lLByYbzXWIQA GTmW6r0bymH+wnilacp0DIgLpVpxl8VaFooKMEn/Ro5ltD0ukszV6U+hq/FbKC0gdvWh mefM9EoHYCaNJaIFpewQdo/kI0CMdUx6S6qbZmAq8POffVYoBRm8o272/2K2HlrSBAja 3wPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UU3FB+g8F4Nk3f4RaT1VmvnnzOjaL3mrsS+FSId6TB4=; b=i84UreUL8w/GW9YZB5K0fzwPdKHmouu1XyV8EFbtv4l/IgCiNh6cuy/dMNKDorFGvN ZxNXan0FmT21Y/Bea/isB447gA9bMiDn0yynwmbjhnMbDkBFUuk1l7Chro66mnpyy0rP pZKPraBj6kSZ0ZYV1u5Wg/ge2SX83vw/bEVnuQ8jiEMnY80O/hXmGUOL3Ar9/hNR1WOo dyLaGwlYmXNoy2tyaDbFcfOvEJGMtbvZcUz675thjoRjpaExYM70M5kE0nZNFReDSIFn utU4wNjWMMxpdFcsanxDvzs+dwLii9eO4Nj6eGr27gwfZZu2F4NImXcHoPsxpsE6jZrT i1xw== X-Gm-Message-State: AOAM530uvq5Qfmpr+xA+3lGy+PpcwgLhgsU6EPDuTn7WCzRo0Hq7KNbY WEhHQUUQe+DMLahNnmACJkE= X-Google-Smtp-Source: ABdhPJxxui7MF/k4lu2HL1Izl4+SW+wq2LbAacKt/faAZn74gwVvRyrV4w5iLF0P5JiZrCRYYQPQJg== X-Received: by 2002:a17:906:31cb:: with SMTP id f11mr426112ejf.468.1610387019001; Mon, 11 Jan 2021 09:43:39 -0800 (PST) Received: from localhost.localdomain (5-12-227-87.residential.rdsnet.ro. [5.12.227.87]) by smtp.gmail.com with ESMTPSA id j22sm111132ejy.106.2021.01.11.09.43.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jan 2021 09:43:38 -0800 (PST) From: Vladimir Oltean To: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org Cc: alexandre.belloni@bootlin.com, andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, alexandru.marginean@nxp.com, claudiu.manoil@nxp.com, xiaoliang.yang_1@nxp.com, hongbo.wang@nxp.com, jiri@resnulli.us, idosch@idosch.org, UNGLinuxDriver@microchip.com Subject: [PATCH v4 net-next 05/10] net: dsa: felix: perform teardown in reverse order of setup Date: Mon, 11 Jan 2021 19:43:11 +0200 Message-Id: <20210111174316.3515736-6-olteanv@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210111174316.3515736-1-olteanv@gmail.com> References: <20210111174316.3515736-1-olteanv@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Vladimir Oltean In general it is desirable that cleanup is the reverse process of setup. In this case I am not seeing any particular issue, but with the introduction of devlink-sb for felix, a non-obvious decision had to be made as to where to put its cleanup method. When there's a convention in place, that decision becomes obvious. Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- Changes in v4: Removed the unnecessary if condition. Changes in v3: None. Changes in v2: None. drivers/net/dsa/ocelot/felix.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index 79d0508e5910..83c995360481 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -639,14 +639,14 @@ static void felix_teardown(struct dsa_switch *ds) struct felix *felix = ocelot_to_felix(ocelot); int port; - if (felix->info->mdio_bus_free) - felix->info->mdio_bus_free(ocelot); + ocelot_deinit_timestamp(ocelot); + ocelot_deinit(ocelot); for (port = 0; port < ocelot->num_phys_ports; port++) ocelot_deinit_port(ocelot, port); - ocelot_deinit_timestamp(ocelot); - /* stop workqueue thread */ - ocelot_deinit(ocelot); + + if (felix->info->mdio_bus_free) + felix->info->mdio_bus_free(ocelot); } static int felix_hwtstamp_get(struct dsa_switch *ds, int port,