From patchwork Wed Jun 21 15:36:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13287568 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 451D7EB64DC for ; Wed, 21 Jun 2023 15:37:32 +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=xBkPgeyY1DAcQrsnr8F0m8CqENfjJwchcNAhTfyRgn0=; b=vVaSdBcHZEN/NW 7VcI/tr8TbY2J3AoWQvkydI4zbOvrEQfd/CuqP1cKY705md0hyUnDZnclZe4yQBMGiY/USDrEVJVN bYHeUqMgXdKWqwFIEpzcYAKALdPIRnqgS1k1MXwrnsccSpNIjIElpnQ3obcCcbqlc0mihrWwDGJEQ j6ErawcoRnhozKq+QqWJaEr/2e3DCyNdepErkST75t1eEHu3rw4dM48Y6CF3zWEhvXY0KLbLVRIy9 dk0cWN+RALfyON2f9DjwH0MRE8plz6oywf+7Ew7L4tI6k9LupVc8ObqNQ4GVmA8zD9VuXPe0ooM3b AQwKw/Z5dvhoXTr/CYFQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qBztP-00Exoy-27; Wed, 21 Jun 2023 15:37:11 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qBztL-00Exlx-2e for linux-arm-kernel@lists.infradead.org; Wed, 21 Jun 2023 15:37:09 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3f9b4a715d9so26732375e9.0 for ; Wed, 21 Jun 2023 08:37:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687361822; x=1689953822; 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=cfAhAsug9ufzHE7mkap9OTTt62MSzJGSWiVrEWzAwlU=; b=Hkolap0343pI2fTeDMlSL1ecIJgWvi+Cb3axXsbFUnMqYfjB0CdwOKmdaJCFujs4LI 0Rc9dnin8sX/+/MAm7llAX+pu3vF9n0x9GAmBwyyeDeGTFTfpDJ4L9KjfqG2N91gNgYI 55uWZk+4qz6IH6GmNakF9fu2scRuEmaclyvRs4aNEXa8gZ4/TMo0q+TtRFf8qkHzZvd0 tZjiIO5QubenHiHbQcsBfYJcJJ3oQs8Uwa1ETmppDB0V38beg2XzIi4EBzfod8JGFr/n js20442BN7akSbBSzSQKV1H96WRh3TlDX1c5fOPtTYOjTLrF9BaDoUuZxGZtP1rmWoTX xAUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687361822; x=1689953822; 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=cfAhAsug9ufzHE7mkap9OTTt62MSzJGSWiVrEWzAwlU=; b=jA1AdIT7m7b67CExNk8RA27ZGhuUWvzdklWuTweZwpnTpIr3wrzsbViI46/IMryPle uCoNcmZlj5mIIb1w8qjsKcsZzOgUNPLRcTExO4RTTWqjlXTuavdKYYSAJGSk7lgr85Ey bu356qbAirNnjnoIINAnqtsi43T7DoDJ8msFkSg2zneDnlIoeevj1FMB11fgUIkjktUN 98T2uJlue1r7929g+CHCL4S130KZMpU+tthh0IJji5yLNGNBXuBrox+RbKbHFyvAUte1 Xntlm6a8AoKHegJkHgEjBkcAUFmKBsggx8ptS+LxMRcR9pYJKRRafFvukhh+pxnntYeY Y0Cg== X-Gm-Message-State: AC+VfDy7Fmf/+k1azlRnNF668RW2bdbJMMvGXL0Y9mlZ9v24s+Bk3sjB TsGHVm7sp4AF3jSkPO5gg3E7tA== X-Google-Smtp-Source: ACHHUZ61KtPw7PZMSqkd+p+2S3J7vRMgyN38QB8hapuEJIl2U4P060oQ1mu5xvl7D6IGcQD0QKv/mA== X-Received: by 2002:a05:600c:3659:b0:3f7:aee8:c23a with SMTP id y25-20020a05600c365900b003f7aee8c23amr19068795wmq.19.1687361822463; Wed, 21 Jun 2023 08:37:02 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:a69f:8ee3:6907:ccdf]) by smtp.gmail.com with ESMTPSA id l13-20020a1c790d000000b003f7ed463954sm5322491wme.25.2023.06.21.08.37.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 08:37:02 -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 01/11] net: stmmac: platform: provide stmmac_pltfr_init() Date: Wed, 21 Jun 2023 17:36:40 +0200 Message-Id: <20230621153650.440350-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230621153650.440350-1-brgl@bgdev.pl> References: <20230621153650.440350-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230621_083707_994917_53620ABF X-CRM114-Status: GOOD ( 16.23 ) 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 init() callback. This allows users to skip checking if the callback exists. Signed-off-by: Bartosz Golaszewski --- .../ethernet/stmicro/stmmac/stmmac_platform.c | 25 +++++++++++++++++-- .../ethernet/stmicro/stmmac/stmmac_platform.h | 3 +++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 3c6b55b60461..41ca4fc9f863 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -701,6 +701,25 @@ int stmmac_get_platform_resources(struct platform_device *pdev, } EXPORT_SYMBOL_GPL(stmmac_get_platform_resources); +/** + * stmmac_pltfr_init + * @pdev: pointer to the platform device + * @plat: driver data platform structure + * Description: Call the platform's init callback (if any) and propagate + * the return value. + */ +int stmmac_pltfr_init(struct platform_device *pdev, + struct plat_stmmacenet_data *plat) +{ + int ret = 0; + + if (plat->init) + ret = plat->init(pdev, plat->bsp_priv); + + return ret; +} +EXPORT_SYMBOL_GPL(stmmac_pltfr_init); + /** * stmmac_pltfr_remove * @pdev: platform device pointer @@ -755,9 +774,11 @@ static int __maybe_unused stmmac_pltfr_resume(struct device *dev) struct net_device *ndev = dev_get_drvdata(dev); struct stmmac_priv *priv = netdev_priv(ndev); struct platform_device *pdev = to_platform_device(dev); + int ret; - if (priv->plat->init) - priv->plat->init(pdev, priv->plat->bsp_priv); + ret = stmmac_pltfr_init(pdev, priv->plat->bsp_priv); + if (ret) + return ret; return stmmac_resume(dev); } diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h index f7e457946681..6a2cd47fedcd 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h @@ -19,6 +19,9 @@ void stmmac_remove_config_dt(struct platform_device *pdev, int stmmac_get_platform_resources(struct platform_device *pdev, struct stmmac_resources *stmmac_res); +int stmmac_pltfr_init(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; From patchwork Wed Jun 21 15:36:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13287569 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 3699BEB64D8 for ; Wed, 21 Jun 2023 15:37:44 +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=QV8Lyts1oNj2jAvM+GZXnWT6Zw8qKl6yl3a32xzFDE0=; b=Eprbh2GESQTRBL wuM0sfXUhSeYx/sjs9A466/SRCopexduyHVf+rmgvaJ+0rSHzuiPXtXG5IPT8nLp/yhb72kKbQ6Yv HGA1N6GYD/IZ+aKLlG24/3XRo8DbYvsbWsfqq7DxnuMGkUld6HW5e3JLderqXUTq4JLQHDtgcnIt5 BqZ45d4BWW8GpraHKHvRUeDrVYe0Rn4i0v/FSosoKbeRCD0+WNmmqKvpuFLCfZm6rW8TMnvNGCOVa j+1ecqKmuDKA3/jz6Nedkim5krrEVKWMxh7TudA1lPl90EEJsq5f9gEXVOXWNhXspP8wn00YDMD/v B6YobSF9q+Vezb3eOWGw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qBztQ-00ExpB-0X; Wed, 21 Jun 2023 15:37:12 +0000 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qBztL-00Exm3-2N for linux-arm-kernel@lists.infradead.org; Wed, 21 Jun 2023 15:37:09 +0000 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3f8ff5fe50aso41246315e9.0 for ; Wed, 21 Jun 2023 08:37:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687361823; x=1689953823; 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=ohR2MIoFexvaG1IRw5Am1pEJrTY7jcRqlxnO/EQTdy8=; b=dkyDfYiIBxOJV2hxR/4c8Uta3MSZJK6qmT57b/J+17eBqI0hCGQ4XExaV4F7mYh4be VgT3ePn99e8bol/sXnx1xvaO+w76lIn+/zPxUZDiMYIOPqYTFeXmZfLsWUl39mCAqHVm HmyVVnGIWuw9CPtJxjxzHypnrORSkLN6pecDdYnUN5jV4DzRvqFQ+pZ6CnSJD5xIYOKa B2ovTwgnrU+dxC4JIU+t0UGPXJiIBbiAJrMXERMaiJ65jYeyaF0Jjc2Ovwlz89sqjlUT c2h5du2jStF+P4xOeLkev3lON5iHC9iTT22u8lbT6RBnHQbRkWakb1/EofidM1kHhnNO VpQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687361823; x=1689953823; 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=ohR2MIoFexvaG1IRw5Am1pEJrTY7jcRqlxnO/EQTdy8=; b=eGm7B1uHAmb+/kU1dmVHfgQqhzOr9M7FCqNqD1TKcCcE0uDYMamQwX+/djUfdf0NNC IBt6n3vO54o/CdYKa1X3W+B+iTB4njxRYxVdt41vM+k4TH0A+m0fbfRHx0fzzJeIBDlH HCbYE4PYEM59XcwgJKc3OUAHmoRGhQr4RAB45uL90xnQZwXW8iv90LLUiKVU8KHS9U8t yDKRJNX+oS6dIWwgxm/NrDp1R81LLIe9WfTjKU5GwirTln5bBNE+pPBs1NalAOIgfeyv cZZxHpXd891irbTRGl6a6oFkJMJDyTIqq/GKZJrSHU+kCm94S+OhjQCea9SgyfGImQBl y7bw== X-Gm-Message-State: AC+VfDx/PAHLCG6fVE35fOKVqkZatw/jHlPCkZVWM/blxdKnDjAro1Ut shUJV9GViRFakFa/bF2LmNfxnw== X-Google-Smtp-Source: ACHHUZ6ZDp52UApJ3piW/H11lxFyTw3oeRrK9CSYjqYjy6prgfBnCMfLOO2kaY9rWqwnOQ/4eCyV9w== X-Received: by 2002:a05:600c:21d8:b0:3f9:bc32:ca6c with SMTP id x24-20020a05600c21d800b003f9bc32ca6cmr2740533wmj.13.1687361823489; Wed, 21 Jun 2023 08:37:03 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:a69f:8ee3:6907:ccdf]) by smtp.gmail.com with ESMTPSA id l13-20020a1c790d000000b003f7ed463954sm5322491wme.25.2023.06.21.08.37.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 08:37:03 -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 02/11] net: stmmac: dwmac-generic: use stmmac_pltfr_init() Date: Wed, 21 Jun 2023 17:36:41 +0200 Message-Id: <20230621153650.440350-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230621153650.440350-1-brgl@bgdev.pl> References: <20230621153650.440350-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230621_083707_997498_2953B08F X-CRM114-Status: GOOD ( 12.43 ) 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 Shrink the code in dwmac-generic by using the new stmmac_pltfr_init() helper. Signed-off-by: Bartosz Golaszewski --- drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c index ef1023930fd0..b7fc79864e8c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c @@ -47,11 +47,9 @@ static int dwmac_generic_probe(struct platform_device *pdev) } /* Custom initialisation (if needed) */ - if (plat_dat->init) { - ret = plat_dat->init(pdev, plat_dat->bsp_priv); - if (ret) - goto err_remove_config_dt; - } + ret = stmmac_pltfr_init(pdev, plat_dat); + if (ret) + goto err_remove_config_dt; ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); if (ret) From patchwork Wed Jun 21 15:36:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13287575 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 20C22C0015E for ; Wed, 21 Jun 2023 15:37:56 +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=gDB67QvBAbMnjf yqdc/p3LHXHfe4mXtjHRv7n7YVkCvvWVh7NgxLcRhInggx3rz95PmKsFQwPg6wh+4lGaSU1YVSWtM HJ1mRIxiFXlhEW0oTAR7dhNJCH+aOmLgEPuYMqFATpiAS/U3k9/kBmDEMtiuOgoRPSebBcy5J5zIy wV6whqQwwUFsGKJDnctbq1wD4Ac+5MQtITYVMddHwG9dKgpn9nXPEKGamKFUIKwBldDToTEmbPtfu T3oH6GwAlv5gJfufxpauuFVn4jDH/QS2sCRJZ5yEnh2oLbIMuPN9uDaaQK7aytaoxdOOo94sq0p4H wknVBTCOU2kFaXdVGZzw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qBztf-00ExtC-0E; Wed, 21 Jun 2023 15:37:27 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qBztL-00ExmA-2e for linux-arm-kernel@lists.infradead.org; Wed, 21 Jun 2023 15:37:11 +0000 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-4f865f0e16cso6393133e87.3 for ; Wed, 21 Jun 2023 08:37:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687361825; x=1689953825; 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=JDQhrhG+gEzY/R4QQnG7RzCwbzoc1hFLLMgvZVVfnRJe8nxWvaKxhak6tsdD9HKRSN o/lnDk+VvBQg7o+rChNMyQLaPVIBXPRMD2cUj8+ENXruqpJo/O5v5LGKYi57J8Y2FtjI bYx5odt/A89YoCT1JoBn4vy8f24Lsz6Ze5+aI0q6t74ry1UKuuZVuDpiL9DsQxytoUur cyBJh2TlI0oRDBXw2mYVaGX4UWsJ+KPGznNoApHpRnvj9jT15KXWVCnVX8+GNbxQLrZY g2jksyNz0I7WPclj04bl5RlRfxvELs7ev3oKxY0iJIM/MMG2wLWSoeHnzx1RYbQ2ICJ8 q34Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687361825; x=1689953825; 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=VyPSDRmITaHf+fP+VPrjLzXfuIlTA0128KeTGvxvP1qy01Tf3gA/fQPKr1f+C7aS5a Iw9X5HwbSMTE6ijlNq2yXtQMmVpFtAeHb1JQThNJA2AoUg+mZbtiL+nGOAwZ6JWR/PGG 4I5CiSxBo0izB0OGWrrTPqiDBR/zMICtsh66zV4rezEUm4+hq91MZjSY7CeK9FaMUgJw RW6KqrH1vMrS43v6MCdJJMlSQ1r5T+R168xzz2syjIThBvrjI7CBbEV31Y5g9dTOH9I1 nLpqM5vITL6/J/i0HD2CRrMMfK4f0EgBc0xqojOTxpRt+/LLm83D1tWOe+fNNWgPZ1ML VAZA== X-Gm-Message-State: AC+VfDyuwo7nsTPUFax21EOnWf3Mta9Re/0jTCdEEy+OQSLDnIbdY+qc MkWZRaQreUA4c6hRgz4TCVpTJg== X-Google-Smtp-Source: ACHHUZ7/oqSJCenAAa8lnFgdX+Cu/iYwD4IrKqGSFvkhqDbvRPxiA0zrBKUV9uODTH007C1TlggT0A== X-Received: by 2002:ac2:5b1e:0:b0:4f8:5d15:99e5 with SMTP id v30-20020ac25b1e000000b004f85d1599e5mr8290068lfn.32.1687361824777; Wed, 21 Jun 2023 08:37:04 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:a69f:8ee3:6907:ccdf]) by smtp.gmail.com with ESMTPSA id l13-20020a1c790d000000b003f7ed463954sm5322491wme.25.2023.06.21.08.37.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 08:37:04 -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 03/11] net: stmmac: platform: provide stmmac_pltfr_exit() Date: Wed, 21 Jun 2023 17:36:42 +0200 Message-Id: <20230621153650.440350-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230621153650.440350-1-brgl@bgdev.pl> References: <20230621153650.440350-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230621_083707_997067_317B678B X-CRM114-Status: GOOD ( 13.59 ) 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; From patchwork Wed Jun 21 15:36:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13287570 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 14915EB64D7 for ; Wed, 21 Jun 2023 15:37:49 +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=hgFr/XEidOFWEVcWB8TTrwfsZIJmQoCu5TZMmVUe2M4=; b=GOzM9oxcb5nbNR EpX4DW7ZVk0szJQyOdrrWvSUbzcHhlina+BwynCeMWyo36NoLee3ogGOgTZMlaeBdFeXLHBVuEFOB zNTae30MT3uIRKn1Vg0nyV/Iih8OMBFL03umhhbGP3hrBgK0w5ilQqU613uW6rog0HMa73jFjR8m3 ZJ1JpvPnG642tKO5TL39TDO6zrfzMtTUKX1AuQmdyZh7rkBPKdxSA/7gZLmusNpwKxvYXs/tC+xr+ hVaQ9YxjFrDdpyn6nuYchYgyQ40lPraYVBAJVRGemG/F9ass82fZZjUZ6DzuHknvZhtP0yigUu87V f5xFKLkAvC94vUCgz+eA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qBzte-00Exsq-1n; Wed, 21 Jun 2023 15:37:26 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qBztM-00ExmL-0G for linux-arm-kernel@lists.infradead.org; Wed, 21 Jun 2023 15:37:10 +0000 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3f8f3786f1dso66490365e9.2 for ; Wed, 21 Jun 2023 08:37:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687361826; x=1689953826; 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=/JiCzEeqmjiEw3zDpGmObBnm4eT4Z865O2xg4BsYR1E=; b=zAnRcyEUDD5wtE0JhsBJCTGSOI9JVuvZGa/odSLqFHGsQXN85gQbvlTZBX+am6cdI+ wCvXHD639o04po8/nN9twgtY0tb8Ta1S3yBXDl7G0Fd9XQKAb1wC9qdjPaWIBd5mOT48 7zeagteknLjoF5nSF0V7R/AtC20zPvspcgJBBYFLMPkitQz6gJSXwUKaWBwX5jxjEOHy JOpbdPE6txob69F4MW2cyB9+zk0UbktknOZ49yzYBKDghJy0OqxuCH4OAwiGOYqiNK5A L8qJa5APnKWbZKMZxsy51rLkI/usP+ajNckWWYum2ZWXFca8SHEIjTp4o0UIVhnnXfW3 mt1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687361826; x=1689953826; 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=/JiCzEeqmjiEw3zDpGmObBnm4eT4Z865O2xg4BsYR1E=; b=ZIVWpl8NGhR8j0qQ0gAvIakWQWa10hf8Fcn63fZdgbBFRazR9uuGuhKbFRIu8TtTBk sJ5DjCHL43mbk0Wh+qOYnFCI4PPOTkk9ISKuJizqW/HDKbchlt2ZrfInx2QC04rp0XH2 i2ufKiG5kNmPby/QqwYeBwbnRiCyJlJT4p9nBEgdYp6vJnNx59B7AQR3N/UyVuZ4rYix 3FD82G9EblY6fBoLLXq1zGvywMRssweEgcdcCgkY01N3zCvBtFbuZ70JetGzJ5gLxAKq o9N3Lx6G8LKyPXkk/x8oYb/jfqmyql0LGnKUSNiENhooc6g3NUZcRgOijd+Md6bTQi2Y gRWw== X-Gm-Message-State: AC+VfDyHA5Nf+Ori9qC1qNPPLR2pE66mHi3j7FTGUnUIKwm3BmnXyUob d2PM6lrpXEGQ+YnPX+fk7XpFnA== X-Google-Smtp-Source: ACHHUZ7xPJZ1J9M1CQ6hghcx/4kh4qmQUTaDMOedqzbwk1iUrz91I0UBgHrzOTPLQtNdytzHq/JnJg== X-Received: by 2002:a7b:c391:0:b0:3f9:b3f5:b8f with SMTP id s17-20020a7bc391000000b003f9b3f50b8fmr5845974wmj.34.1687361826051; Wed, 21 Jun 2023 08:37:06 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:a69f:8ee3:6907:ccdf]) by smtp.gmail.com with ESMTPSA id l13-20020a1c790d000000b003f7ed463954sm5322491wme.25.2023.06.21.08.37.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 08:37:05 -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 04/11] net: stmmac: dwmac-generic: use stmmac_pltfr_exit() Date: Wed, 21 Jun 2023 17:36:43 +0200 Message-Id: <20230621153650.440350-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230621153650.440350-1-brgl@bgdev.pl> References: <20230621153650.440350-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230621_083708_121496_954A9385 X-CRM114-Status: GOOD ( 11.34 ) 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 Shrink the code in dwmac-generic by using the new stmmac_pltfr_exit() helper. Signed-off-by: Bartosz Golaszewski --- drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c index b7fc79864e8c..dabf05601221 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c @@ -58,8 +58,7 @@ static int dwmac_generic_probe(struct platform_device *pdev) return 0; err_exit: - if (plat_dat->exit) - plat_dat->exit(pdev, plat_dat->bsp_priv); + stmmac_pltfr_exit(pdev, plat_dat); err_remove_config_dt: if (pdev->dev.of_node) stmmac_remove_config_dt(pdev, plat_dat); From patchwork Wed Jun 21 15:36:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13287571 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 EBE58EB64DC for ; Wed, 21 Jun 2023 15:37:50 +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=F/yaZXo04SwOdu1FebPLqz4oKMnPu0HtJlE53P3bQ8k=; b=Q955Qpqha1KNsN F+/kIldXkOrDcZSRI1l2u+jHxBcWu245Rmv/VBQSXENb7QAm8q2RpI9MU+PQaDNub6+10M2jiQPSF gKg5jKpxZWcYFd39RYE4fbRPYFrlOzzoJyQc2I/+z8skxOZ0HSo10PnWPTFe1jzgbcrpQoxAuVn9M RKa05g4lx/xoFUFx67sQQU3XRUg+Q2/RSN8huF27pzd5b6Gpc6qR7QsDbOuGzot1Ls7LATZWR0nrX XTar2x4UWnLKTr3VawW9hgp6/8Cw58HyPl4HftCwwWOY+d3TSR5acYgwrKamSI/0Bq+EkqKLjq9FL rqlUDEA685ZED35J8Vkw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qBzte-00ExsX-0E; Wed, 21 Jun 2023 15:37:26 +0000 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qBztM-00ExmO-0m for linux-arm-kernel@lists.infradead.org; Wed, 21 Jun 2023 15:37:10 +0000 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3f901f87195so39704405e9.1 for ; Wed, 21 Jun 2023 08:37:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687361827; x=1689953827; 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=M1MdpjqTiZB/Ps9LoJ+Yhj9at3Zx7ZNJ3CPY0Mq713Y=; b=G6zYz9cKoSNRIVlhsRux2o+ct2G37TFxEQtQQVXLGOrYecbehoGdxONWH8lp7WkNTZ 7KMH4O2hnylqp7YUNNwIGyorY+eT/iE/kuv74lWBsVrEaOvH3eHxgd9NWS3iwiuDqn08 pZu6f1/jsxiy8/DZTT6w8uFkt26l1A+XYmazHQgKzYJkWYB9N39o57Kmjg1fn4H+AaIK nIAofbGW5NZ0oVR4Fh8U4u57UZINc9copdCKprqr7ZIEk78QDbVbNOYsYPISczGi0zMw RAH9Fb02vq6DS22CwN4VHCOK1HHQfP0NvUHuaTTrVww5MX8yolM/P6F9eTNz6mKlqz0q ZzhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687361827; x=1689953827; 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=M1MdpjqTiZB/Ps9LoJ+Yhj9at3Zx7ZNJ3CPY0Mq713Y=; b=V5gJFKV3pmyuepnIzTgVu2u+oMhAlJjSUhjH1e03BYmLlBnpGQz+C4bUMCws3Gzr9M saPHpHsdoX4HuR0Y7aGu+exRMWujjZdBORSrttwCfhjgueruxGfJiH02myd6s3v8g803 K2unQM33lpIINZAPQUsCHTPn/Gw7JfJI641Nv02V9QhFm4Pxt/p9hl9uUVOHXCRXwJoX rzGQCxPKOWL04+Kx45ZzEkTqVzi2t+hCXP9DXisLi0DXrKqjSI8sutR7cfrUdYqCbOLl IzHe7f9AHdHkD1G2wmrIEU+HuPozuZMxVz6wkk1WaHbgt7fh6X27BodDQmktDHX68OLk 1XPg== X-Gm-Message-State: AC+VfDxYO13N8ljOdLWEQD2vz3r/MwUDX501FpyTx4NFg6J1LjXYfsnF uulj3eTl0fYoKOmRQ7O6iR0uLw== X-Google-Smtp-Source: ACHHUZ7El/Ih0d2Yz/gKGvMngTDUjCNwXQ864fWEFUCB1ReXz/MhJ1k+riyAXlWajUNesQKCvoVyww== X-Received: by 2002:a1c:f616:0:b0:3f6:d90:3db with SMTP id w22-20020a1cf616000000b003f60d9003dbmr13811551wmc.3.1687361827133; Wed, 21 Jun 2023 08:37:07 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:a69f:8ee3:6907:ccdf]) by smtp.gmail.com with ESMTPSA id l13-20020a1c790d000000b003f7ed463954sm5322491wme.25.2023.06.21.08.37.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 08:37:06 -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 05/11] net: stmmac: platform: provide stmmac_pltfr_probe() Date: Wed, 21 Jun 2023 17:36:44 +0200 Message-Id: <20230621153650.440350-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230621153650.440350-1-brgl@bgdev.pl> References: <20230621153650.440350-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230621_083708_279425_5F96C566 X-CRM114-Status: GOOD ( 11.74 ) 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 Implement stmmac_pltfr_probe() which is the logical API counterpart for stmmac_pltfr_remove(). It calls the platform's init() callback and then probes the stmmac device. Signed-off-by: Bartosz Golaszewski --- .../ethernet/stmicro/stmmac/stmmac_platform.c | 28 +++++++++++++++++++ .../ethernet/stmicro/stmmac/stmmac_platform.h | 3 ++ 2 files changed, 31 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 5b2bc129cd85..df417cdab8c1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -734,6 +734,34 @@ void stmmac_pltfr_exit(struct platform_device *pdev, } EXPORT_SYMBOL_GPL(stmmac_pltfr_exit); +/** + * stmmac_pltfr_probe + * @pdev: platform device pointer + * @plat: driver data platform structure + * @res: stmmac resources structure + * Description: This calls the platform's init() callback and probes the + * stmmac driver. + */ +int stmmac_pltfr_probe(struct platform_device *pdev, + struct plat_stmmacenet_data *plat, + struct stmmac_resources *res) +{ + int ret; + + ret = stmmac_pltfr_init(pdev, plat); + if (ret) + return ret; + + ret = stmmac_dvr_probe(&pdev->dev, plat, res); + if (ret) { + stmmac_pltfr_exit(pdev, plat); + return ret; + } + + return ret; +} +EXPORT_SYMBOL_GPL(stmmac_pltfr_probe); + /** * stmmac_pltfr_remove * @pdev: platform device pointer diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h index e79134cc1d3d..f968e658c9d2 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h @@ -24,6 +24,9 @@ int stmmac_pltfr_init(struct platform_device *pdev, void stmmac_pltfr_exit(struct platform_device *pdev, struct plat_stmmacenet_data *plat); +int stmmac_pltfr_probe(struct platform_device *pdev, + struct plat_stmmacenet_data *plat, + struct stmmac_resources *res); void stmmac_pltfr_remove(struct platform_device *pdev); extern const struct dev_pm_ops stmmac_pltfr_pm_ops; From patchwork Wed Jun 21 15:36:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13287572 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 6F6E3EB64D7 for ; Wed, 21 Jun 2023 15:37:52 +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=4L2wtGtUXUkSeE+xOzCXHbFKODMfMhTIrLeP+INlarE=; b=Hx8PYC9qdkGGvL iIxUtUNwaJ27Xvy+ViNrQ+lm3ez7tBhtytsuXeBxxAAvXZogLtNQO2V8pefkciWEHIX+uAEAGAgSg B7lDo5Pvw4pWG8Lgjh0RiXA+bJHjHHmNytpPHct/cpW+4YrlVaD9jamwMF8tNiIMa/VkWO+NwMxtQ N98o26S41JAEkmyDloIp5mp2CuLPG9MCJLWaF+Qg1p88ZJYc3L7ditVfOKU80HEOyNsEOqE89TIqW sxFew8np7FGnJqYMR3AmckqBXFahAc1B7IYkJew7nvNro6ftGcjP/7El1dxiwjc1AlU8IePmLZjqh 6fH6uNgQlb1PR9OH3cow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qBztg-00Exu1-0K; Wed, 21 Jun 2023 15:37:28 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qBztO-00Exnj-1k for linux-arm-kernel@lists.infradead.org; Wed, 21 Jun 2023 15:37:12 +0000 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-4f86bc35f13so5901655e87.1 for ; Wed, 21 Jun 2023 08:37:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687361828; x=1689953828; 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=yItovFwloe3duebYnq7A6B4V/jKgQ44zzRGa/G+pPW8=; b=CSv88/ZWPsCkujCLeQvR5zV6QJ197upQiupFOf7hhQJLU4holZQmyEM8afOeiopPJI rxkkXknIdFBsXaGs9e5eQl8cmqwLLSitBBUYN4EkfgWs1N3I08bYlFaMCcxWlpL00o5R m+Z0PytTuM0BQ2VA1FUXHz93HaoWpBMXD7Xg1oI0Iex7kwBXSFxukS+BVYvPEM1Z+x/J 1MMnplXM//mLc8MN0qTVv7Q3KJFsN8GnzobJyIhzjWXEbG/2zt6VldBu8G2I7bJGs2ei Te8uSE3lkY289Edv22F486sKBj0Hx/GJT7tkzQsTOMVS4qqtocy0eoZE2IXrcvMDnFyM oU0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687361828; x=1689953828; 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=yItovFwloe3duebYnq7A6B4V/jKgQ44zzRGa/G+pPW8=; b=EecQRl3rjXSJ+mnV/VueyYTRImOVfVt9tY/9Avi4VbTySmu6p7+SF8HsspvtEzwXx9 N/xdGVUikIS31PHeFU3B3FCHTkJyjOASS7vilnay9XWRiws12X+WRohRngFLLX6SylC9 P2Ld2k9EUGWufVArcAvnK0CxyV5boBWa8MIU+ZwiQM85qvWRa6n52pDli8/FwMv92Ho+ D7OcwkbbX3lun8fnDnizXIpzGNWRuL3ucW+Yfh0h8SO/b9ZhhO/CXp8GaU5xYq+FwbLW EhXEaevW6fNh7W/rRFpfmua/nUEzwh5/uXVMWsotwnLZ6Mcy2xcJ0OjQRbJHbyFkzqCq 1KVw== X-Gm-Message-State: AC+VfDyKZEKlQCrVTdD86/kqwNST/R7QRJUSqdVhR0FJpv13Xgz0LZWE 9LptooJvuFMEUJvvjoBum/UMdajA/ZkfoOD/uJ0= X-Google-Smtp-Source: ACHHUZ6zjgqtk9I7hnzpINsxw7Jk5ONzx9X2XtIX2vI7/3ICM1PCWSNZh/mAZPlvVnMabN82Dm8Q4g== X-Received: by 2002:a05:6512:3b0a:b0:4f8:6fe9:3c9c with SMTP id f10-20020a0565123b0a00b004f86fe93c9cmr992970lfv.49.1687361828170; Wed, 21 Jun 2023 08:37:08 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:a69f:8ee3:6907:ccdf]) by smtp.gmail.com with ESMTPSA id l13-20020a1c790d000000b003f7ed463954sm5322491wme.25.2023.06.21.08.37.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 08:37:07 -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 06/11] net: stmmac: dwmac-generic: use stmmac_pltfr_probe() Date: Wed, 21 Jun 2023 17:36:45 +0200 Message-Id: <20230621153650.440350-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230621153650.440350-1-brgl@bgdev.pl> References: <20230621153650.440350-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230621_083710_579146_2FBC1BC9 X-CRM114-Status: GOOD ( 11.61 ) 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 Shrink the code and remove labels by using the new stmmac_pltfr_probe() function. Signed-off-by: Bartosz Golaszewski --- drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c index dabf05601221..20fc455b3337 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c @@ -46,19 +46,12 @@ static int dwmac_generic_probe(struct platform_device *pdev) plat_dat->unicast_filter_entries = 1; } - /* Custom initialisation (if needed) */ - ret = stmmac_pltfr_init(pdev, plat_dat); + ret = stmmac_pltfr_probe(pdev, plat_dat, &stmmac_res); if (ret) goto err_remove_config_dt; - ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); - if (ret) - goto err_exit; - return 0; -err_exit: - stmmac_pltfr_exit(pdev, plat_dat); err_remove_config_dt: if (pdev->dev.of_node) stmmac_remove_config_dt(pdev, plat_dat); From patchwork Wed Jun 21 15:36:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13287579 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 4A628EB64D7 for ; Wed, 21 Jun 2023 15:37:59 +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=D526+2u5qZOqXPDk7e8/KgDbAX1tHzPIUnwYKz3/uNA=; b=ywRByttpl6Q2GP 1i4xAGoPvjY5N2HMYhlviGnzp/Iv7cfimwyDgsZYBV7DzaAcTstorcmNmJqMfU6O1YcORHmkbUwM2 elFlrMlczW1tX1RIuVdo+lXWKtK5xiHQ5TxVh8ZH8+kmzuQ5KtYd3ZkiWc7dRB5L2DDYNaa2uZgYF J/t9pNn0ap1UvZUg9SC5M1trwB528+f0Uqf2XpB3nMIPYpcrGOM/qaw5nYTWzR58Qa3bD4HXW8OIM ZbxlSkDRATvlG7/Nt1sJJr6+/vpwSQ/oZ2VWKOT+/Zw3/3E6YQGAzSI2orLb8wPzjboOZl4B5ncp4 YlO4LH8DT19X5UQC670g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qBztg-00ExuX-1x; Wed, 21 Jun 2023 15:37:28 +0000 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qBztP-00Exo1-0b for linux-arm-kernel@lists.infradead.org; Wed, 21 Jun 2023 15:37:12 +0000 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-4f86bc35f13so5901680e87.1 for ; Wed, 21 Jun 2023 08:37:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687361829; x=1689953829; 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=jabdaiTACMvGCMLJ1hwhPAwP261O3guFNIkOypEaFEs=; b=iG7OfDCk3JDXJMpMe5FwY7oS1o3s1Nvx9x2APRVXDEve97G6AYWW8S/2RDRZtlP4b/ aDrsWqVsROpv7zXRW9DWRTmH1qqcyVjNN2Xhyjmz3PBMs0AlQHlyfhiACVgiVQQyKWDi OObFeo1/781gyvg+8LOciR+e1zqcDmI+umqnmkJLnPHvRvqn2r2LfA92wrJDvxt37lW0 GX+uGFlJQhc0SLqQ70RUt7kJiR9PZYlesbkhkhLGmOJ5Zk0K7+hQ6IjBUcIT7seW8Jui 0yqngOHSp0/CYOv0+ORCvbaYwqkzPV9ZuXxXlmAHOup61KLjOSUSY8CVF7APhwWZyq5D jfhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687361829; x=1689953829; 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=jabdaiTACMvGCMLJ1hwhPAwP261O3guFNIkOypEaFEs=; b=h+DpkHEoen1n6V5qS6bb1ycKpPGMEpV+qRtZ5ixrZAKfe058uvb7HSCfiJddgkEb1b Wn353ihGiqHSyhC6Li145HF+lC1jOyuhwE1JioEgNM+nkxEm5H2eBenDVUqzCIeqbpXS EAB2xJ98Sbx6NGo1TiHd4cB2h2Y29zPvfSScIXVHcIQylEyBgtBtI1f/Ff862EfwD3ap FwPQ9apVTEVO88zOFRCkSUQOm8ONz+dwSSvQnm/tyKEpzphXDx0LWR2hcpdzCkOM7JxG 7Ee12RBOG0OHAAY4DWhWn55iGLsiCwvNR1E8FgvqmI4y85Gi/9U7nT4BybvEO3Gp4w1P Or4g== X-Gm-Message-State: AC+VfDyjQfqs2B97hNbLAYoaOCj45OSYhnFv859asXUgeOhCwoV0L1O0 OCGQTOMr9iVqZ2Mg7zoVj0zfWA== X-Google-Smtp-Source: ACHHUZ7O6m3NitPkltuHDknRSK9sSvm6K9sSsjvlHBt+9Nc1zRq0igP7Yk0EiNzUJ+83oxpIYhIKTg== X-Received: by 2002:a19:ab12:0:b0:4f8:cd67:88e6 with SMTP id u18-20020a19ab12000000b004f8cd6788e6mr3668244lfe.44.1687361829235; Wed, 21 Jun 2023 08:37:09 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:a69f:8ee3:6907:ccdf]) by smtp.gmail.com with ESMTPSA id l13-20020a1c790d000000b003f7ed463954sm5322491wme.25.2023.06.21.08.37.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 08:37:08 -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 07/11] net: stmmac: platform: provide stmmac_pltfr_remove_no_dt() Date: Wed, 21 Jun 2023 17:36:46 +0200 Message-Id: <20230621153650.440350-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230621153650.440350-1-brgl@bgdev.pl> References: <20230621153650.440350-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230621_083711_221350_C60A3AED X-CRM114-Status: GOOD ( 13.98 ) 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 Add a variant of stmmac_pltfr_remove() that only frees resources allocated by stmmac_pltfr_probe() and - unlike stmmac_pltfr_remove() - does not call stmmac_remove_config_dt(). Signed-off-by: Bartosz Golaszewski --- .../ethernet/stmicro/stmmac/stmmac_platform.c | 20 +++++++++++++++++-- .../ethernet/stmicro/stmmac/stmmac_platform.h | 1 + 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index df417cdab8c1..58d5c5cc2269 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -762,6 +762,23 @@ int stmmac_pltfr_probe(struct platform_device *pdev, } EXPORT_SYMBOL_GPL(stmmac_pltfr_probe); +/** + * stmmac_pltfr_remove_no_dt + * @pdev: pointer to the platform device + * Description: This undoes the effects of stmmac_pltfr_probe() by removing the + * driver and calling the platform's exit() callback. + */ +void stmmac_pltfr_remove_no_dt(struct platform_device *pdev) +{ + struct net_device *ndev = platform_get_drvdata(pdev); + struct stmmac_priv *priv = netdev_priv(ndev); + struct plat_stmmacenet_data *plat = priv->plat; + + stmmac_dvr_remove(&pdev->dev); + stmmac_pltfr_exit(pdev, plat); +} +EXPORT_SYMBOL_GPL(stmmac_pltfr_remove_no_dt); + /** * stmmac_pltfr_remove * @pdev: platform device pointer @@ -774,8 +791,7 @@ void stmmac_pltfr_remove(struct platform_device *pdev) struct stmmac_priv *priv = netdev_priv(ndev); struct plat_stmmacenet_data *plat = priv->plat; - stmmac_dvr_remove(&pdev->dev); - stmmac_pltfr_exit(pdev, plat); + stmmac_pltfr_remove_no_dt(pdev); stmmac_remove_config_dt(pdev, plat); } EXPORT_SYMBOL_GPL(stmmac_pltfr_remove); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h index f968e658c9d2..af52d5aa2b9a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h @@ -27,6 +27,7 @@ void stmmac_pltfr_exit(struct platform_device *pdev, int stmmac_pltfr_probe(struct platform_device *pdev, struct plat_stmmacenet_data *plat, struct stmmac_resources *res); +void stmmac_pltfr_remove_no_dt(struct platform_device *pdev); void stmmac_pltfr_remove(struct platform_device *pdev); extern const struct dev_pm_ops stmmac_pltfr_pm_ops; From patchwork Wed Jun 21 15:36:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13287573 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 410A2EB64DD for ; Wed, 21 Jun 2023 15:37:53 +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=96R8HtrP7XrmSyxKBxDskWIIpzU07zS11nps5EL+VO4=; b=tqzZCQ2WTnStmP IIqoZ1Ee8oRmbbcA+Nlb0fxdxxd1CNoc1mTBmEbCqgEfW13q5lO4PmPSkBZ0z0AcyC/Mfn+RVu+4z FZwHIe2/BG59ThGkWERgpI30+33YczYPNL55/QiaCtIomc/rgAF0fcNIjLgMyWByzSBkOTud4yapd qaUBQjtXyJlqsHjanSaXJObjOKu8brmJ2JaI+zc4UN+geA9UzuwxE8UdpP3pyblhl/ADtBg6xnkRw q6sc03xjSMJwuM/t0t4kYxiEJU/8vqHsXdR3v9eGbvNyAWF7eOARdEyGRws+aFssl7YyOlEWtR6p2 j34eUPEkj5FQp6tzbx0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qBzth-00Exv5-0W; Wed, 21 Jun 2023 15:37:29 +0000 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qBztQ-00ExoO-2D for linux-arm-kernel@lists.infradead.org; Wed, 21 Jun 2023 15:37:14 +0000 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-4f86d8a8fd4so5683367e87.3 for ; Wed, 21 Jun 2023 08:37:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687361830; x=1689953830; 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=ZXhQ0UIxbIRXJu72M9URbDfOLtQ/Rc/6HlYK7uavKwg=; b=ZKNhsBXVBWDsZT+gQdyHtPSF2CiUZVn4CH6FHKpTsKLUctQft/ssO2/+UcidIhXoYH yaRcbER3BLmJX2YRyh2Qvhy3wzwg0LeX6QpjXO0PvLPe7V4TFPTDbX0ZVff9ownq7439 Q8Z7u3EF7o/MgMWDNR6O3IgHWvB5ArH6vvoJD4s16hZbMC2/zBfT7GJ6heD12O0/2E0s dbIpgvmhH2I+OKUzQxtKEWgGaisUjfeMOP78NKVcoOKszCa2f2T/SzgjG+ig5aN7ZH+2 s6Z2FnCYcI4mE5O/rt3od3+4hevgnH0SYppx8dLK49t5XHV9TjyAF7SVqR7RLcEn3ynA p80w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687361830; x=1689953830; 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=ZXhQ0UIxbIRXJu72M9URbDfOLtQ/Rc/6HlYK7uavKwg=; b=Dw/5qG2o8CPdG3mOVs0tWSA3vOYcu5xrd2n4j9fE0Tz0VsxdR7t2G3jlXoj8xl5Gk+ DcdH/UYgvnQMDeMrXwfuc4PC+UbOydWQLmWbi+5pBoFlu4E+dLp+XjB4kC47Bk1qeVNv /Jp2yYzY1CKRXMPO4qriUWRK4rtItxWQU0ZMauz5pp8qv/lt1U7P6uaGBXhsI3effg/3 s01T7ljUNsRK3MCNFHVyLzx7COIq4rc/x1g/HDRuLJwhg8U5ICZJrT4Ylo9Z2lTojUTl RnerMeWvKRtFxvyh64Cjmrj+x3zD3VjUhx2eHB3q8JTgCKd5cBHiptOvpc6QJNhal3tC 5KzQ== X-Gm-Message-State: AC+VfDzkyse/Gw9JaClAmVYGv9iE2RKGdd/ADBiUiXbeCe7lBZEyphe4 PLoB65Gv4wdTlHyc/4eHdzKP0w== X-Google-Smtp-Source: ACHHUZ4uJSo2gHx8ZKi/3Nrj3/6juOImyrIJVAJT2kltHhI9yCnZTfyVARk3e8AbVi+9c52J2HXnIg== X-Received: by 2002:ac2:5f99:0:b0:4f8:6cad:aae7 with SMTP id r25-20020ac25f99000000b004f86cadaae7mr6596886lfe.61.1687361830338; Wed, 21 Jun 2023 08:37:10 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:a69f:8ee3:6907:ccdf]) by smtp.gmail.com with ESMTPSA id l13-20020a1c790d000000b003f7ed463954sm5322491wme.25.2023.06.21.08.37.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 08:37:09 -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 08/11] net: stmmac: platform: provide devm_stmmac_probe_config_dt() Date: Wed, 21 Jun 2023 17:36:47 +0200 Message-Id: <20230621153650.440350-9-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230621153650.440350-1-brgl@bgdev.pl> References: <20230621153650.440350-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230621_083712_729302_9AAD7A68 X-CRM114-Status: GOOD ( 12.90 ) 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 devres variant of stmmac_probe_config_dt() that allows users to skip calling stmmac_remove_config_dt() at driver detach. Signed-off-by: Bartosz Golaszewski --- .../ethernet/stmicro/stmmac/stmmac_platform.c | 35 +++++++++++++++++++ .../ethernet/stmicro/stmmac/stmmac_platform.h | 2 ++ 2 files changed, 37 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 58d5c5cc2269..043fdfdef6d4 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -8,6 +8,7 @@ Author: Giuseppe Cavallaro *******************************************************************************/ +#include #include #include #include @@ -629,6 +630,39 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) return ret; } +static void devm_stmmac_remove_config_dt(void *data) +{ + struct plat_stmmacenet_data *plat = data; + + /* Platform data argument is unused */ + stmmac_remove_config_dt(NULL, plat); +} + +/** + * devm_stmmac_probe_config_dt + * @pdev: platform_device structure + * @mac: MAC address to use + * Description: Devres variant of stmmac_probe_config_dt(). Does not require + * the user to call stmmac_remove_config_dt() at driver detach. + */ +struct plat_stmmacenet_data * +devm_stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) +{ + struct plat_stmmacenet_data *plat; + int ret; + + plat = stmmac_probe_config_dt(pdev, mac); + if (IS_ERR(plat)) + return plat; + + ret = devm_add_action_or_reset(&pdev->dev, + devm_stmmac_remove_config_dt, plat); + if (ret) + return ERR_PTR(ret); + + return plat; +} + /** * stmmac_remove_config_dt - undo the effects of stmmac_probe_config_dt() * @pdev: platform_device structure @@ -657,6 +691,7 @@ void stmmac_remove_config_dt(struct platform_device *pdev, } #endif /* CONFIG_OF */ EXPORT_SYMBOL_GPL(stmmac_probe_config_dt); +EXPORT_SYMBOL_GPL(devm_stmmac_probe_config_dt); EXPORT_SYMBOL_GPL(stmmac_remove_config_dt); int stmmac_get_platform_resources(struct platform_device *pdev, diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h index af52d5aa2b9a..8c1e5b2e9dae 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h @@ -13,6 +13,8 @@ struct plat_stmmacenet_data * stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac); +struct plat_stmmacenet_data * +devm_stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac); void stmmac_remove_config_dt(struct platform_device *pdev, struct plat_stmmacenet_data *plat); From patchwork Wed Jun 21 15:36:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13287577 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 E6900EB64DD for ; Wed, 21 Jun 2023 15:37:58 +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=41rdYGVjz2rdutobAg0Vvrj93/0Xn7Dl2iTBWxHz7oc=; b=VfI5Iz9yVMB3jj 5d3omPE9xo+O4rM7nU7ORpzgDYXCgPZUxJt2t2yvY/8PbAmbsOrh+7/XV0cA0a7KD5FWSCvfgoEFR m2P7agbvH8GhKF+tyCCOvgyxzQdpfsC5VYGjl5rTwswD4+urweC9mnV0is0eDj/GVJFGjaavEYrUt 117eTRGpp558q1u3PozXNl7wmJWKMbtHyaFdJwYW2S3xC6pqWzcLdicMI7lLrwpNVTYhahX7UlCCq AKaWHNAZv9xnN36DGZbJ9Cs3dQOw1xB3Vp/la1eBu9z8Qw6CqgUk7LMs2T55+goNuSfNbps/jcRgz TRnVp5QUya3LiqPG0NQQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qBzth-00ExvZ-2J; Wed, 21 Jun 2023 15:37:29 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qBztR-00Exp6-2V for linux-arm-kernel@lists.infradead.org; Wed, 21 Jun 2023 15:37:15 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3f9c532fa45so6264535e9.2 for ; Wed, 21 Jun 2023 08:37:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687361831; x=1689953831; 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=tzkZoWqIdrFL84uinSijWf7BmQOJpWDfpkjROxZd1c8=; b=PcGca/hWjJcVv+Y/tbmdA71BgJ7Lr6OMUaqZiMiOw/DP9D2tyjb2ebFZwqVne5WD/Z JQWUu6+eZ+cphu8t9HiFXX4Oe0PApDoD8mDbNRalw0FyE7F29WNYN61faxh1Wh+JUY2T SCtMK2sfzM6L5oWuLO06DYM+7eITR+bMkb0qsRAjucXpmWBHc756CN2nbbp2Evg5ifd5 J4USwnkUh2Ml7zPchKernlpz+3oGy56v10NHcOt7x0+WKK0GbHYvIlYSwD2k3lpbTaFg F79ZuOgORX3hOD6C9VxWLe06gI/y9L3VIhoAh012UQeyay+mV+a+vRRIuuMEFENPYXzz KMrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687361831; x=1689953831; 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=tzkZoWqIdrFL84uinSijWf7BmQOJpWDfpkjROxZd1c8=; b=KregMpoXMSrRvU71r+4/r7OiegTb5c4BGUI4kXJnnNXWa4gn0BcbQ6TgMR8FCuJ+yu fDADdR/V1s+KHMnzo+ks7PcI86G2QHl4ZhEO4Mnoaqgcn/k9SaTKww7kED7WdO3Vm6v2 wrnW+98+p9DCX5Ho41s3BPB/rT9Ju05fHxNzsnq1fBhETOGtmfNhF0wQCf2JtQYHU7eN 6eP8tWEbwrZ1fZGDnkTedsFr0LQeXbzRTK2PzVODs2LiVfbvA2kYOTvaYwtGeBbTbZ+p 3KxStPpu2Bx+RYKxyM2xW6HVFRrsEOfidrdyKpNmrXuiXofb8I/m6R0ZgOcDJjWHVs5F M3PA== X-Gm-Message-State: AC+VfDzeaaJ2gxvHHUdl8rUSMRfMWPzeATyx6/nJVV3hJBr24gsE/jmh fbDWFB1IwMQho6boc+Swa+yYCQ== X-Google-Smtp-Source: ACHHUZ6+m4x+02dzD0msTZyYePiggPtcVzXmvvy5Lf7/ySBqdENggcehBQ1qprkG4JzujBxj3sOUTA== X-Received: by 2002:a05:600c:22d8:b0:3f8:f884:ebe7 with SMTP id 24-20020a05600c22d800b003f8f884ebe7mr10660338wmg.0.1687361831603; Wed, 21 Jun 2023 08:37:11 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:a69f:8ee3:6907:ccdf]) by smtp.gmail.com with ESMTPSA id l13-20020a1c790d000000b003f7ed463954sm5322491wme.25.2023.06.21.08.37.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 08:37:11 -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 09/11] net: stmmac: dwmac-qco-ethqos: use devm_stmmac_probe_config_dt() Date: Wed, 21 Jun 2023 17:36:48 +0200 Message-Id: <20230621153650.440350-10-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230621153650.440350-1-brgl@bgdev.pl> References: <20230621153650.440350-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230621_083713_809296_361F4BB7 X-CRM114-Status: GOOD ( 15.64 ) 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 Significantly simplify the driver's probe() function by using the devres variant of stmmac_probe_config_dt(). This allows to drop the goto jumps entirely. The remove_new() callback now needs to be switched to stmmac_pltfr_remove_no_dt(). Signed-off-by: Bartosz Golaszewski --- .../stmicro/stmmac/dwmac-qcom-ethqos.c | 49 ++++++------------- 1 file changed, 15 insertions(+), 34 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index fa0fc53c56a3..7b9fbcb8d84d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -708,7 +708,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev) if (ret) return ret; - plat_dat = stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); if (IS_ERR(plat_dat)) { dev_err(dev, "dt configuration failed\n"); return PTR_ERR(plat_dat); @@ -717,10 +717,8 @@ static int qcom_ethqos_probe(struct platform_device *pdev) plat_dat->clks_config = ethqos_clks_config; ethqos = devm_kzalloc(dev, sizeof(*ethqos), GFP_KERNEL); - if (!ethqos) { - ret = -ENOMEM; - goto out_config_dt; - } + if (!ethqos) + return -ENOMEM; ethqos->phy_mode = device_get_phy_mode(dev); switch (ethqos->phy_mode) { @@ -734,19 +732,15 @@ static int qcom_ethqos_probe(struct platform_device *pdev) ethqos->configure_func = ethqos_configure_sgmii; break; case -ENODEV: - ret = -ENODEV; - goto out_config_dt; + return -ENODEV; default: - ret = -EINVAL; - goto out_config_dt; + return -EINVAL; } ethqos->pdev = pdev; ethqos->rgmii_base = devm_platform_ioremap_resource_byname(pdev, "rgmii"); - if (IS_ERR(ethqos->rgmii_base)) { - ret = PTR_ERR(ethqos->rgmii_base); - goto out_config_dt; - } + if (IS_ERR(ethqos->rgmii_base)) + return PTR_ERR(ethqos->rgmii_base); ethqos->mac_base = stmmac_res.addr; @@ -757,24 +751,20 @@ static int qcom_ethqos_probe(struct platform_device *pdev) ethqos->has_emac_ge_3 = data->has_emac_ge_3; ethqos->link_clk = devm_clk_get(dev, data->link_clk_name ?: "rgmii"); - if (IS_ERR(ethqos->link_clk)) { - ret = PTR_ERR(ethqos->link_clk); - goto out_config_dt; - } + if (IS_ERR(ethqos->link_clk)) + return PTR_ERR(ethqos->link_clk); ret = ethqos_clks_config(ethqos, true); if (ret) - goto out_config_dt; + return ret; ret = devm_add_action_or_reset(dev, ethqos_clks_disable, ethqos); if (ret) - goto out_config_dt; + return ret; ethqos->serdes_phy = devm_phy_optional_get(dev, "serdes"); - if (IS_ERR(ethqos->serdes_phy)) { - ret = PTR_ERR(ethqos->serdes_phy); - goto out_config_dt; - } + if (IS_ERR(ethqos->serdes_phy)) + return PTR_ERR(ethqos->serdes_phy); ethqos->speed = SPEED_1000; ethqos_update_link_clk(ethqos, SPEED_1000); @@ -797,16 +787,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev) plat_dat->serdes_powerdown = qcom_ethqos_serdes_powerdown; } - ret = stmmac_dvr_probe(dev, plat_dat, &stmmac_res); - if (ret) - goto out_config_dt; - - return ret; - -out_config_dt: - stmmac_remove_config_dt(pdev, plat_dat); - - return ret; + return stmmac_dvr_probe(dev, plat_dat, &stmmac_res); } static const struct of_device_id qcom_ethqos_match[] = { @@ -820,7 +801,7 @@ MODULE_DEVICE_TABLE(of, qcom_ethqos_match); static struct platform_driver qcom_ethqos_driver = { .probe = qcom_ethqos_probe, - .remove_new = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove_no_dt, .driver = { .name = "qcom-ethqos", .pm = &stmmac_pltfr_pm_ops, From patchwork Wed Jun 21 15:36:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13287576 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 3DE0FEB64DC for ; Wed, 21 Jun 2023 15:37:58 +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=4teHuKWxD25I9tARqaRpQq4scc80XPge/KhCcvdUdeI=; b=1k0WaYCwMZs68l ALMfBrSm3WhmViT54miGROntl2RhcUFbZy+AoUTXgDA7j3XvPLDnmlc3236EkhJdvkn95YfXo6Wbg uFhjqe4koNJBxMCbjRCJLaVQJ7lia6PO6NQyHvwMUJxkrzpJHR+GajTExcu4wuI2ShYcbzjwnMtco iVNAepNviIDGpGmXAh68JLSQS+BXirXO0j2o8Sm3Ye8+TfsRR2A5vCeTWTwhgZVaNxaqcZkrZyLIr jglGXiIUDCC1zGfiGvoeXoPAuUR0MUW9mT+uZcg0KhWYPiZxPc0HR8Gfx2XRGQW/mETP5kyCOD/rI TGLVV7z0HgYiE1WHyPgQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qBzti-00Exw3-0w; Wed, 21 Jun 2023 15:37:30 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qBztS-00Exq4-2p for linux-arm-kernel@lists.infradead.org; Wed, 21 Jun 2023 15:37:16 +0000 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3f8f3786f1dso66491485e9.2 for ; Wed, 21 Jun 2023 08:37:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687361832; x=1689953832; 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=oGD2YNQo5DCptfM/plxJR3RlHOdJ1opqXIoNZJpMScQ=; b=INYNN1dz0gWjscIjzw8UtsEksmuIN5TllH30vYEzWIJjI/XN4mMGeBoiY7Y5XeQ/MV dZQdk+Txvg8zLoqET1De3mQ2qah+eU+uv9xFt2U1EVqc7GsUf5cWliGG6gr9Firtaogs amX4HCMgtPHjrkoSlqgq2cgHIAr/N6fFv6tkR0CtQDNBNURaXRXGWfIw3+ZcuIKuHXj/ Q3lU1XAFbedveozvSaSw21nwM8AwPbSp5Ygdo5ska0ouusbn9WCq7tMeoK88rqpM+fPi idGAcKQ5SkNkWKICMcZQ5aPNeZY3VmGwrEU1mqdPSI8gCbZzfKf3LSacBZ5mRBQiAfyu RzuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687361832; x=1689953832; 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=oGD2YNQo5DCptfM/plxJR3RlHOdJ1opqXIoNZJpMScQ=; b=GUedalOvXHZ+JE5PFA6o2MBfSAKKKXiTnaOnrO2XwYfHhn6Vg3oMFu+bJhP60qN3Ie Z6weW3Z2Gj3D3fP4oEdJ/DE788kfF+ehLSNOCBYLzX4ov/OTHUptdJvOifeNnLo9onBC VBrDW/a6Gziy8X30wM0A6sYzSxCkmlcePEp07wJRSpti/MgQbLHXV2auy/VXAjjAwYzw YRQ/W7uQH4oLGuHW7/Sk/mAaeZp8DfOpsxZcEun1fH5nTKle4wokycyPw6rC7T0taP0W QwS3yoGQ84Zva6htM6xxBaTIEnoIO6mM7BB3O4+CjBplR2gUnTpm1a8OGlgUQXfteChU 5qfA== X-Gm-Message-State: AC+VfDz2fyVkj4GpxlSn/ScajyiDAiwNQxR4dhZ0z0uptzbgce032Ngv Ggkr6buFLD63LOGSvdSqW4+Pgg== X-Google-Smtp-Source: ACHHUZ69sgYoTgZluegZ/SRfV86MRMgLoC7Hzm7bkGWZ5zV2hOQoqblgZYilUY5Pkexsl1OEY22JNw== X-Received: by 2002:a1c:6a1a:0:b0:3f9:b8b1:9d2 with SMTP id f26-20020a1c6a1a000000b003f9b8b109d2mr4122895wmc.33.1687361832707; Wed, 21 Jun 2023 08:37:12 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:a69f:8ee3:6907:ccdf]) by smtp.gmail.com with ESMTPSA id l13-20020a1c790d000000b003f7ed463954sm5322491wme.25.2023.06.21.08.37.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 08:37:12 -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 10/11] net: stmmac: platform: provide devm_stmmac_pltfr_probe() Date: Wed, 21 Jun 2023 17:36:49 +0200 Message-Id: <20230621153650.440350-11-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230621153650.440350-1-brgl@bgdev.pl> References: <20230621153650.440350-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230621_083714_908604_8024D223 X-CRM114-Status: GOOD ( 12.13 ) 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 devres variant of stmmac_pltfr_probe() which allows users to skip calling stmmac_pltfr_remove() at driver detach. Signed-off-by: Bartosz Golaszewski --- .../ethernet/stmicro/stmmac/stmmac_platform.c | 30 +++++++++++++++++++ .../ethernet/stmicro/stmmac/stmmac_platform.h | 3 ++ 2 files changed, 33 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 043fdfdef6d4..6b0dce6cb661 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -797,6 +797,36 @@ int stmmac_pltfr_probe(struct platform_device *pdev, } EXPORT_SYMBOL_GPL(stmmac_pltfr_probe); +static void devm_stmmac_pltfr_remove(void *data) +{ + struct platform_device *pdev = data; + + stmmac_pltfr_remove_no_dt(pdev); +} + +/** + * devm_stmmac_pltfr_probe + * @pdev: pointer to the platform device + * @plat: driver data platform structure + * @res: stmmac resources + * Description: Devres variant of stmmac_pltfr_probe(). Allows users to skip + * calling stmmac_pltfr_remove() on driver detach. + */ +int devm_stmmac_pltfr_probe(struct platform_device *pdev, + struct plat_stmmacenet_data *plat, + struct stmmac_resources *res) +{ + int ret; + + ret = stmmac_pltfr_probe(pdev, plat, res); + if (ret) + return ret; + + return devm_add_action_or_reset(&pdev->dev, devm_stmmac_pltfr_remove, + pdev); +} +EXPORT_SYMBOL_GPL(devm_stmmac_pltfr_probe); + /** * stmmac_pltfr_remove_no_dt * @pdev: pointer to the platform device diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h index 8c1e5b2e9dae..c5565b2a70ac 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h @@ -29,6 +29,9 @@ void stmmac_pltfr_exit(struct platform_device *pdev, int stmmac_pltfr_probe(struct platform_device *pdev, struct plat_stmmacenet_data *plat, struct stmmac_resources *res); +int devm_stmmac_pltfr_probe(struct platform_device *pdev, + struct plat_stmmacenet_data *plat, + struct stmmac_resources *res); void stmmac_pltfr_remove_no_dt(struct platform_device *pdev); void stmmac_pltfr_remove(struct platform_device *pdev); extern const struct dev_pm_ops stmmac_pltfr_pm_ops; From patchwork Wed Jun 21 15:36:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13287578 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 4314BC001DB for ; Wed, 21 Jun 2023 15:38:00 +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=lG73n0BBe4TIgsS/AqJ086DZiYLMGq9TFR988dwiI9E=; b=e//c9UxvIlrE5D mDIqPMiiLyS/YNnu03qyoEtHBisARV5FMOCM3U5DeXU7dVn7ZukTKkr1OKzOAnO7Q5DWhDMb4bH3V e/uv9QRipwchmNZb12idrQBsPWA8VekXXq4AC2DbdGP1Wr0MD0e4bgOHRS12YQfZAM6VVSNPExdfE zJKLhIj+cRW2daXcnYGONOuFiREOKmM4Q8E82JbdOumZtd4TN2FHLpQrKwk+dUHtMTU7JyJ7m30aS jBHeocE2UuTwhrS89JOk4xE+dZ5B2Q39dFjcVOWR8AYyAnikFXrngnLmXvguc9b8eM4AAELZT6zHU AjYI98S/uA/cZjYUmN0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qBzti-00Exwb-2g; Wed, 21 Jun 2023 15:37:30 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qBztT-00ExqR-2D for linux-arm-kernel@lists.infradead.org; Wed, 21 Jun 2023 15:37:16 +0000 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3f9b0f139feso40851335e9.3 for ; Wed, 21 Jun 2023 08:37:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687361834; x=1689953834; 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=E6sVXJ2cleHMEi/0WcOIV4n/ZjjS+cQY293Qzlx7CXQ=; b=ytqBTHWqr0O6rcQRNtmKsh6dLK9ftebsw4tdZY0QALt/SZisDjORIlR8rIG6/uV3md Fi9A4HVDkOyoWSMA7Mz7056cAx44DmV7cxp+RvXiGtXEmoT53ssbK/UINJgMzKIxvjiX i6NQ8irc3evTR/v0RNBj96Z3U0BLUfvP7hZoPoOFthjN4cKd5kn+4dQvMOLTziRTaxA5 C4MjpzPVOkOSoxgU8IRrMXT42kvmzDvulnhca8o+5D8Rm/UVKjTQQPM0hbKnRFubb8MC GcihCfDkvFZHTukagIqhhPGdtFVti8r8T6ObiUbjglX8KjcFlCqOoEerd/t0KuX9ecDg G5jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687361834; x=1689953834; 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=E6sVXJ2cleHMEi/0WcOIV4n/ZjjS+cQY293Qzlx7CXQ=; b=KSHsRHKbPeEu1gEhvOH5vvKXRJWtp5dINSCHV/vbFmWdT9Srfy4PnjtWvM6xbppoWP IkPWW3DBDI+YlyFXQDAQjz9WmbR2eWByZKGkpfLM7DNzQVESGvwCSaV0oFITSCCvFUty eTUmB+CXgTP0VXSlfJug1gv3VTGLJTzMIFyu3jTxteeaGm1VDy0HI+aKUGw6kyooxm74 UdL8ju5SREpO2W98J/SkcmRuRt+p1wZYOB5KQgpQDyzujesZLwUQBP8BNtuhi2xuE1vH M/7OPLu/EUsL6slLrXYPNZTKxrPkL92taMk4RtOYQNvZtDRepzsIy0GrWv3O1aY3io95 psWw== X-Gm-Message-State: AC+VfDxHDAbGIIYFiP8QfjjNYxvNadikWMmiiQ41SDCD4/0EHrw6hegF 2qCaRWFyL2PrfmNL5j2OWrg0lg== X-Google-Smtp-Source: ACHHUZ6vWMgzwi5LD2ZvSmbyFHyTJXtLbN1jGnRVAYlkgSjDYwX4jrJvwJ0I7n0yZevtJM1G7OlRsA== X-Received: by 2002:a7b:c8c9:0:b0:3f9:b8df:26ae with SMTP id f9-20020a7bc8c9000000b003f9b8df26aemr3963143wml.34.1687361833803; Wed, 21 Jun 2023 08:37:13 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:a69f:8ee3:6907:ccdf]) by smtp.gmail.com with ESMTPSA id l13-20020a1c790d000000b003f7ed463954sm5322491wme.25.2023.06.21.08.37.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 08:37:13 -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 11/11] net: stmmac: dwmac-qcom-ethqos: use devm_stmmac_pltfr_probe() Date: Wed, 21 Jun 2023 17:36:50 +0200 Message-Id: <20230621153650.440350-12-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230621153650.440350-1-brgl@bgdev.pl> References: <20230621153650.440350-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230621_083715_722810_17F1D7D0 X-CRM114-Status: GOOD ( 13.20 ) 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 Use the devres variant of stmmac_pltfr_probe() and finally drop the remove() callback entirely. Signed-off-by: Bartosz Golaszewski --- drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index 7b9fbcb8d84d..e62940414e54 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -787,7 +787,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev) plat_dat->serdes_powerdown = qcom_ethqos_serdes_powerdown; } - return stmmac_dvr_probe(dev, plat_dat, &stmmac_res); + return devm_stmmac_pltfr_probe(pdev, plat_dat, &stmmac_res); } static const struct of_device_id qcom_ethqos_match[] = { @@ -801,7 +801,6 @@ MODULE_DEVICE_TABLE(of, qcom_ethqos_match); static struct platform_driver qcom_ethqos_driver = { .probe = qcom_ethqos_probe, - .remove_new = stmmac_pltfr_remove_no_dt, .driver = { .name = "qcom-ethqos", .pm = &stmmac_pltfr_pm_ops,