From patchwork Fri Jun 23 10:04:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13290253 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5BDE3C001B1 for ; Fri, 23 Jun 2023 10:05:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cXKBInbpVr/MpMF6h+SQ8r85J4VgziE2EPvg6p+DdIs=; b=kynRvdkex097xP BPJnMC/iPsEAzFtM7u7GNaxk86YrKRnr9BfM6QqVNEEaNyZxSLunieQIuGsJ6e7y25xFLBsP+NE45 O7pyCdMzWYB9pHf0Ha0M56XGxFR8eZ+qiVAO4bdkCAOPRd//h1w+9fUPG29J93DDQGAP82Awm89mP oq55bVjhzGQQ3YAjU51MDRfxQ2Ic5PSn8Cxt2/YM541vOJ5z5lGVVlHZh/8vaVpKs5brU01vvRXfd SwNaZ43iI1OSh1ajFtJP70kKzazwG/d5Qu1ZmvLvvrM2YAEvbimnxvQuIhWvLb3iuiq8elRPcZfJd 4uqXP2GromvnsRpVhY4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qCdek-0036BQ-1O; Fri, 23 Jun 2023 10:04:42 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qCdeU-003652-1Y for linux-arm-kernel@lists.infradead.org; Fri, 23 Jun 2023 10:04:28 +0000 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-31272fcedf6so429227f8f.2 for ; Fri, 23 Jun 2023 03:04:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687514664; x=1690106664; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fwzdC7/KLQBqsNQ9Z3vvCuyrSfrs5l5gzbo6Rxb7/UU=; b=MZzt3xHdJawMjIK2dNuZKH1MQAxlWe/r3rUMF7qW6PE/PRdd83nOCHtiSYTzTXRTZ8 DfOMKIIuYCA6SbO8krzJuZyLEsx0eVPqghCXPV+sPuNm+1HPkve4i02Da+6rBpO85y/U rAdHs49OjoVJ3tZNdwKgQ1kUPXnK0ApbjXvXPWTz1dHPYiI3DO0f6+ZtfK7izZev9wkF PzKEunjLx4Vz3uIvjNBVRPvV/vP1u4Xqy8DsZWnsOpKdwZthRS7FxV88/w3hXWX7XAZD IqKK82p2schhSdroYHKUEzX13ZeE6Tw1/zETkCK/zS9zBVC/kTT4RgzP3yzWBrjB17kO 1fvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687514664; x=1690106664; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fwzdC7/KLQBqsNQ9Z3vvCuyrSfrs5l5gzbo6Rxb7/UU=; b=TNzvbIzOzhrDWhMBLosWgkvyQG4BORCA1FGKwVjZF1P75gtMPMQRxe2vjvzr8iX9NJ vJtpMJLUQKGhcAL0gj6PG0YaynscIKQNZg1/YlCzdXyK08ZE2k3xrUuBfrIOBEpip7RV V5MUnTEGWtpEB3yQY+3PIfv/6Zyjlo58vZS+GKtxr3Wi5g04vB7Er6JWekbTKV/Km280 hGW9TJLl+Ly3jpEEmiJDIdI5k2QqI2Bn1d/YsN42WKf7m7RpWI23bLWYVEi0s83beeEd mOyRt0BEa/ds+G2TbnzPGXsj+jm18NG7qsb6GhUjrZd5B0BJ3wR4CZfWz45kCoyyNEkD nceg== X-Gm-Message-State: AC+VfDynhrh01+UZp3OtZlA7hhdDLUclPWWFAxIoI4eCfUbWP+dLGs5n 0Fz/5efGTitN99P+/UfGPlt5UA== X-Google-Smtp-Source: ACHHUZ6X6W97yIjboRztdBubzybbieSu4zcX8uLRfqburrXXcSEhYItvMiMQsetiDQMMc/Ow/qJ8uQ== X-Received: by 2002:adf:f650:0:b0:2d1:3eb9:c3c2 with SMTP id x16-20020adff650000000b002d13eb9c3c2mr3471562wrp.54.1687514664694; Fri, 23 Jun 2023 03:04:24 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:ddc2:ce92:1ed6:27bd]) by smtp.gmail.com with ESMTPSA id x8-20020a5d54c8000000b0030fae360f14sm9079360wrv.68.2023.06.23.03.04.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 03:04:24 -0700 (PDT) From: Bartosz Golaszewski To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Junxiao Chang , Vinod Koul , Bhupesh Sharma Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH net-next v2 03/11] net: stmmac: platform: provide stmmac_pltfr_exit() Date: Fri, 23 Jun 2023 12:04:09 +0200 Message-Id: <20230623100417.93592-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230623100417.93592-1-brgl@bgdev.pl> References: <20230623100417.93592-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230623_030426_886028_FF932AC9 X-CRM114-Status: GOOD ( 13.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Bartosz Golaszewski Provide a helper wrapper around calling the platform's exit() callback. This allows users to skip checking if the callback exists. Signed-off-by: Bartosz Golaszewski --- .../ethernet/stmicro/stmmac/stmmac_platform.c | 22 ++++++++++++++----- .../ethernet/stmicro/stmmac/stmmac_platform.h | 2 ++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 41ca4fc9f863..5b2bc129cd85 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -720,6 +720,20 @@ int stmmac_pltfr_init(struct platform_device *pdev, } EXPORT_SYMBOL_GPL(stmmac_pltfr_init); +/** + * stmmac_pltfr_exit + * @pdev: pointer to the platform device + * @plat: driver data platform structure + * Description: Call the platform's exit callback (if any). + */ +void stmmac_pltfr_exit(struct platform_device *pdev, + struct plat_stmmacenet_data *plat) +{ + if (plat->exit) + plat->exit(pdev, plat->bsp_priv); +} +EXPORT_SYMBOL_GPL(stmmac_pltfr_exit); + /** * stmmac_pltfr_remove * @pdev: platform device pointer @@ -733,10 +747,7 @@ void stmmac_pltfr_remove(struct platform_device *pdev) struct plat_stmmacenet_data *plat = priv->plat; stmmac_dvr_remove(&pdev->dev); - - if (plat->exit) - plat->exit(pdev, plat->bsp_priv); - + stmmac_pltfr_exit(pdev, plat); stmmac_remove_config_dt(pdev, plat); } EXPORT_SYMBOL_GPL(stmmac_pltfr_remove); @@ -756,8 +767,7 @@ static int __maybe_unused stmmac_pltfr_suspend(struct device *dev) struct platform_device *pdev = to_platform_device(dev); ret = stmmac_suspend(dev); - if (priv->plat->exit) - priv->plat->exit(pdev, priv->plat->bsp_priv); + stmmac_pltfr_exit(pdev, priv->plat); return ret; } diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h index 6a2cd47fedcd..e79134cc1d3d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h @@ -21,6 +21,8 @@ int stmmac_get_platform_resources(struct platform_device *pdev, int stmmac_pltfr_init(struct platform_device *pdev, struct plat_stmmacenet_data *plat); +void stmmac_pltfr_exit(struct platform_device *pdev, + struct plat_stmmacenet_data *plat); void stmmac_pltfr_remove(struct platform_device *pdev); extern const struct dev_pm_ops stmmac_pltfr_pm_ops;