From patchwork Fri Jun 23 10:04:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13290249 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 9283CEB64D7 for ; Fri, 23 Jun 2023 10:05:04 +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=N+JTJHknnjP7z+ 4drRI3nLTdlYxgnebNxaUK8K3eeRCkWjIdWL8VGzCHK+vdBVciQAl9jcQxZ3R+OogmnNDOeD1T0Le q4JyKkg8d+n0E13eqkxvaKnasUVz/NecT0GVSjXiNlAYuEdyv6QCkBP+hP6SFe0TcaEr5cg7JxLYF idIwIQu/NujklEWZNrwgYTkXmTalxRzxnPzKR2dnDiD9FtAuOZr/AkRBaa7gE4wK+RRwXyqcKivca yUI+/A6lW0uqndyfxcuqo8A2jwSvqBSf9Mn9BY3sm+N0aIAMmmZflrOhzpUWDNZxE811AqIH8pQax hv+L6RpY6Y/hmuUxu2Lg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qCdeV-003666-3C; Fri, 23 Jun 2023 10:04:27 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qCdeS-00364Q-1a for linux-arm-kernel@lists.infradead.org; Fri, 23 Jun 2023 10:04:26 +0000 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-3f8fe9dc27aso5101785e9.3 for ; Fri, 23 Jun 2023 03:04:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687514662; x=1690106662; 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=vlo7MECE6WT8irpc++QJKIGj2qAwuykW75HaE87JgC6WhZ4YtwBXnSss/nC8/z1pvI hjPF5qA4MGdqEiG7FBROddqvRiVXtio+8xH2wHemsUhm1mlCdrg4RhSn+4YID921UF/Q 5TlcSD1WgwuqPAKcfVs9noiQ7Y4rNAiKBUnCVjJOrJL50KuwnGSC7Ny2bHov2cl70MTD 0tyXOElThG+N8HVivMT3MrZndyva1w1s5TVe2fxvBt4jq97h41cOaPi1YI0DIjGKQuAV 3VYTPlAYxeyP2m2J3+0QNroKNUe0KRqYhGo163XT4Lpz8Y20c/hTnxchH9Ztn6BtX7g0 f62Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687514662; x=1690106662; 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=WZHPzMCtS4rZSfo1DRx+NReUJ1ATQukJ9TvJOuxzzcEv5RWO0ecSob7jIjUZqU2fJ6 Tskd0KVThqmwp6e1DFe6TTpSmhJB12kZZArhu7Xyo1sw3a6anL0NXB6enF5lp4N7vSPA kUjOj2eSuuOsuEgJRx+VM0xTcd3nFCgzG15Xl7BSqOfoP15igmNRaY/I+BGKW175qxSC 2yuWlYnGKmNVbwdxfIvTt5UVlFGDubt9yWDjrBOunLWmnC0L2aBnwFnCBxrbnbI6QKlV 6+StTSSAbowZhWQOe76YnN4rIWWGuExjZAU81ZIdOP2OrtXo60xBBwe2fyxlLOC0/Gi3 JOhQ== X-Gm-Message-State: AC+VfDyBxScQ6dngSz1KNNXRnlAl+NV0Qm8/coqRSrj1+G7M4Sv6HQGY rSSyGxTv8htCpvFe9aakThec/A== X-Google-Smtp-Source: ACHHUZ7yBYg7767eJ6l0yNyjOWhD+B1pFOg8mtipHqxiEFN19KDOEVQ4rtrMgdPufUYXQ2uhXSvwnA== X-Received: by 2002:adf:f203:0:b0:311:19df:dac7 with SMTP id p3-20020adff203000000b0031119dfdac7mr15154776wro.28.1687514662647; Fri, 23 Jun 2023 03:04:22 -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.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 03:04:22 -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 01/11] net: stmmac: platform: provide stmmac_pltfr_init() Date: Fri, 23 Jun 2023 12:04:07 +0200 Message-Id: <20230623100417.93592-2-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_030424_556645_47F57C40 X-CRM114-Status: GOOD ( 16.03 ) 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 Fri Jun 23 10:04:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13290250 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 9C24CC001B0 for ; Fri, 23 Jun 2023 10:05:06 +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=MtPpjvnF6+OTu/ P4CwEqnSRYF0wD0o8p6l8rcdt9HXAGydonBbREp+2SHfO0OfRX2wIQauyCncy4LtjY37bz6wXzLtn b0Dqco4kurPSrqclsHovt6UdyMOGNu3zkU1PXxel/bG50OZH1WmP47lPO/PdsNgL2RIUbndc2CtjH yP+Mi0aFib8JU0++h1b1v2xuzJgCjrm45+6esBsPdGD3w4DaxxMtfyyExlEMNbIUjb3pgGtSVxkR7 WI050iuFtibID74mmprZbBbwzcCFVjdf954I78RUOtevR+b1DQn+sTxwf3i4JAz4GgHMEoXS4sum5 ab6ZojAwxmXT3WFiOhGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qCdej-0036B6-2z; Fri, 23 Jun 2023 10:04:41 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qCdeT-00364V-1b for linux-arm-kernel@lists.infradead.org; Fri, 23 Jun 2023 10:04:26 +0000 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3129c55e1d1so535759f8f.0 for ; Fri, 23 Jun 2023 03:04:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687514663; x=1690106663; 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=VJVkqpM0z1wIlKhzeq04Rr7yyGW6m3B/0zSZk0ZF4oiorHhFrGx3eAZ1O4ghz35lwf 2Vzj0yeKHFt8iyIvWIANy0BeEEJLy58mwkOpyJ8EUD5cfbEnin8OZiW5Qrfrhba4IafS AhgymSi7xoCo2CAObI5Le7wjzGVwohZoop4TrW0K1NQs6HjtaoIvw8x3N0+kNrhlaH5u c/9DBysGIZT8a3wYKYvZtOBcF/ETPZ+WRMljR5pIW7cK9jng1I/pvaqfvfNjG+c+Jlm6 09/vv4XjZtDB+2OBy6nNaWUZoMVcVTMTyK/bex35Sk8ATc0doQDj7H5pCe/C1yS/tvg/ WZuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687514663; x=1690106663; 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=QiLM5YpUjoHLWipPj5lXi/yWqUM3BJiUOly/F9iE9qZ5Do17+SNP/IASa39rLSadx/ lNKMaNno+VH0ZnY8E+9/Qf+o6AFHY7LvOWvFy9HrXcM3bnofzwIqNUMgqfkYeBkUvr9b I+xgWOLzbvHKGKY9SSpJvfn2B/uvEcRaJhNY1QXOitP07RJxKOqlO3fuVORe7EFV6Fcp wKyhrbZZJyfUEt6njDjCPNMrkJlfCf+D0PjY8oZzPNt0M3vcNHHZkbCCzRZMcXVwh3S0 QikZHTWaVn452X5Lcn1ewG/+2e00iEa4jKfPJL8w/w672wvHo8uaC4ssiR2ZN4U3J7zP RQkQ== X-Gm-Message-State: AC+VfDxOqu85i1Ev8Rp2qH8ym/4w7Iib075dv0RTI+haUGDXDFZ8rTER 37xe/EhL2z8cRiSOnDhTlpBc9Q== X-Google-Smtp-Source: ACHHUZ4BlcG23HC/pK8EJxlXEJOy4hJWAWELm8KN8y0FLwbTfwQ/yreCzwvqxmKh8BtYzNpWMvINCQ== X-Received: by 2002:adf:e6d2:0:b0:311:1d4a:33e6 with SMTP id y18-20020adfe6d2000000b003111d4a33e6mr18600252wrm.48.1687514663606; Fri, 23 Jun 2023 03:04:23 -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.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 03:04:23 -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 02/11] net: stmmac: dwmac-generic: use stmmac_pltfr_init() Date: Fri, 23 Jun 2023 12:04:08 +0200 Message-Id: <20230623100417.93592-3-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_030425_534289_92E6D4DD X-CRM114-Status: GOOD ( 12.32 ) 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 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; From patchwork Fri Jun 23 10:04:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13290252 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 68B3BC001B0 for ; Fri, 23 Jun 2023 10:05:10 +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=0DEvgOzqLGyINQ 9rwbhjRhucfaitGJBsvwcXc8UMvMsjmslmPAjfu/W4KV5p5ODVV7I7xYkgq3andThJvzbVqm+zaDj PEvWOAEiIaDpJXyNjGDnA+dE+ag8784KYN9tubtcn01smZ4nG/Q+eVIKseYhFTwoGtWOSlZi6SVyC q73vxvmMkek+kXwNogvE2jBHVe3lO2K700fqLTfaHyGqfbFAxHlIVs9DnJL7d6b5K0lOlWlJyu0Fn sgv+SnvXU3vHXp9eONu3TE68r3jx8F9rWRUJWU9cXvWDROLPx7pIrHJWbilpjR8eEuvQmkMLDQHO5 9aNFGXE1BManh4ReFoRQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qCdek-0036Bo-38; Fri, 23 Jun 2023 10:04:42 +0000 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qCdeW-00365p-1v for linux-arm-kernel@lists.infradead.org; Fri, 23 Jun 2023 10:04:29 +0000 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-31122c346f4so676228f8f.3 for ; Fri, 23 Jun 2023 03:04:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687514666; x=1690106666; 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=dLurroqnBfuZlrXTJOSO1ec8tkOeNMC7/5FOt5gGsGnx23ekrR748s6VoPpqzDKbl3 vWDMKD0wmLDtvfzCrlozDHyfcJeiN5yr+038ii6HY3l6YuEJqjShtFub/I0GFcC4U4Rr 6CXXMUTEGhm5w0hGK/fuJUOwY8YbXrOC+taP5VC3tIqIKij5+05rpXvb9eTReVJw0FN7 X5RfuLo8m7WYea1CwT8CcQCrZwdD0/O7CJK0yTqZsz8AGv7j/3DVE2f8OmP5261eyp3g qmxa+PUTNAd68WMx25arfe7WHqgX23/QkOhrMBYsMnNWRm/KUMynJUcWHz9jmRSH8taH xUUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687514666; x=1690106666; 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=PDgPRez3HXFvPVANZVSEUcq6QmccYUCTI9/NCeAcl7MRomyBthBMvUoSFXIB5Z7Ia+ F9pvLv1YtUhz8b4zSTz74MoNU5w7gXUXSPJiYn45B7VBsmNqjMJwYjVR4f0aQx3S6fcU 9bUG03EZyiznbRi0L82xGFaFrrPjlTc8JREB8oohTcw89mjlmFAD95lgwiy9Mb4X/DZ3 eqlXSeiTOiDs2nlh+DpSmHOuSoYhGsb3pe2mfE/cghhCR/hPYiOBIW008NQyb5xSg3+J Wp53CIY+HUHL0MuCSG9Bek8b3R9ez2HvvC1Me6xj5WSNbYO3mT7JerfaJfZ0g0r+kHGB Vmgw== X-Gm-Message-State: AC+VfDyrYIBlBDfKIgdGjIkmQ/kv2ga89TPbsNqW5bH9njHsFW4wPZvj Ss1AzecY+ia0q3AiP0HpkKb0kA== X-Google-Smtp-Source: ACHHUZ4qSPzss8jYv0izBVyPiiYbfcs2GaupcDqzwF7GJoL6obvzFc7cSfwPYlFhIi3eERWkxmjvhA== X-Received: by 2002:a5d:568a:0:b0:30a:eac8:e5c1 with SMTP id f10-20020a5d568a000000b0030aeac8e5c1mr20824466wrv.6.1687514665831; Fri, 23 Jun 2023 03:04:25 -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.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 03:04:25 -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 04/11] net: stmmac: dwmac-generic: use stmmac_pltfr_exit() Date: Fri, 23 Jun 2023 12:04:10 +0200 Message-Id: <20230623100417.93592-5-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_030428_634988_23D96239 X-CRM114-Status: GOOD ( 11.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 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 Fri Jun 23 10:04:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13290259 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 43EBAC001DC for ; Fri, 23 Jun 2023 10:05:16 +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=0/WAhvk7fzo9Vx TjK0+FtFMkuVfXYhVAnwUdcAwWjb/wpFWzgs8SAdiOP/Wo5SknuDrtDTr8lAyf09Jcu7GN4ymBZCj c5lLPqwDf1vAZJrhCsad7agAeOnFGehVDKTn8FigTs7hm+5gs0sS85DwFXIng5O7roJk8UV5KqpC8 SIxs0Ln599phQlE8gF7S+hxwqZcBJ4kaoYkCu/VRpRz2EKZUCIKg8LL0bYv8BRpHhWVcWZ9z9PGX5 npWxXXPBSn8d7q9WF+I3483UiCoa/noRFMNB8r/IPywCnfbBvXQ2r9kODginabjB32aLp61CNiSin Gvtx6io05EJ0MIWwv0Qg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qCdel-0036C9-1Z; Fri, 23 Jun 2023 10:04:43 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qCdeW-00365z-39 for linux-arm-kernel@lists.infradead.org; Fri, 23 Jun 2023 10:04:30 +0000 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-311167ba376so476633f8f.1 for ; Fri, 23 Jun 2023 03:04:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687514667; x=1690106667; 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=Gmn4CPGBxppaf2DODUZSGsz6WLHyEDshmlrrZb0eSOwPmIpH4TMuoDUOKrGpHn9Di3 P8M3l7gt3UFAvZyyQWDyxXYnl8qMIi4/FtrrFaWROrxh8NDVim2nsZv1aqTr91wzvWcX 8ZYBk22LyUUzPiEASzIKPB5n8dD87s82maoXgJdq7z9mElBSIqvAf+dI5PwTl1avMDjT mO1X56utPBOMbxw8KqBMay4XGZh7apBIwzpgtGWkOdTlPJVn7SNLg+EMXZQFdk1f/OZ7 SR3Q8XTLp04H4Q9yL8yG8w/P8TZ/jsiQo27cA8fP3rNJ6ghcUO4Dva+oMElyJr2IzCnE Hslg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687514667; x=1690106667; 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=Mc0TRWqviORGsgSepAAXHc3zwjzG/Xi2mnBlA3yNlHRLWHVrjqsv9KhQSLabPO997i s2j0SPJy5fX5mz0KUXej/vCeEg5V0ZztpXYUP65li9RiKnIccVaylBl6+dt3lmGraOJf JpdhFEjo0m9OnCO8EJW52QHkqOJj4qwR62MuU1jDYX2JfG8/uAZ0XZuLvP0CIgChcYi1 W3iAVEcf91pQxZfAIB+6kA6xKhbM0GVl2vPWBdn+JyCFFIcXvs1xbo38D9FVcFICRWYq NtnxdlmE1nsS/keooW7Sc4p5/R97osHUZYM+XKmGbIC20OjUCGJzkU9QXPzDSTQtSvW6 XKig== X-Gm-Message-State: AC+VfDxTUnftb+igrJdfcr8m13Z6Pc6LFy9wOq4w5jJ/F98W3L/9MKWS JTJe3xlAE4MWM5uah6edoc5maQ== X-Google-Smtp-Source: ACHHUZ5fYRMaygvi2CJWcmAn7/oTOJt3J07hgY5PtNkWFV293rqUyRH/TNtyiRVcXAUg8vmlR8vUqA== X-Received: by 2002:adf:f607:0:b0:30e:5fe4:9cc1 with SMTP id t7-20020adff607000000b0030e5fe49cc1mr17926510wrp.29.1687514666860; Fri, 23 Jun 2023 03:04:26 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 03:04:26 -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 05/11] net: stmmac: platform: provide stmmac_pltfr_probe() Date: Fri, 23 Jun 2023 12:04:11 +0200 Message-Id: <20230623100417.93592-6-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_030429_013716_FFCB41A7 X-CRM114-Status: GOOD ( 11.54 ) 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 Fri Jun 23 10:04:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13290251 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 54200EB64D7 for ; Fri, 23 Jun 2023 10:05:09 +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=UZb/Z1+jVT3eQQ Oj0yxVsp9pU11GsWLi+sX1Z1n3xonyTOUMifJRXpSi0yaFLLr0FZFeSvsP68Gl1XmtkpbnPL7AEkW dK2ymQZd53mXoWBeYwwbq5E5ZDp2zFIEw1/4Rrk9YY3GVO8eJxERMTqfDj91di/xmZf6EbMjGduOs g86dmvfq8CrBHT7P48dfU2TeKdkOuC+GyHnQ5HLMe7Ste88ie8Oc3j5H2O4Skyb/84z80tCxDHBxe uYHlgUef9ayxKvfLXxW6EDEYb5Hu3Z3X57nOErlDMHEo+/0LEX27614o8VXsk0b4VISW//9wUmO6n yFiqH2k/qpHMpTuarPfA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qCdem-0036CY-01; Fri, 23 Jun 2023 10:04:44 +0000 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qCdeY-00366J-0I for linux-arm-kernel@lists.infradead.org; Fri, 23 Jun 2023 10:04:31 +0000 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-311183ef595so488262f8f.0 for ; Fri, 23 Jun 2023 03:04:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687514668; x=1690106668; 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=l0DUJdzlIHLN9/12vsEkAUNYNor4yQLqqSoGRxNk3EPmXOD2uFpAHbY4VklRmVQl3W +ENIrmsfRrIo4VfPjgmUQ/qlVWQ/ASV+aqcDfTJW9cv55BQDIxyjuiuCIZ4ey++WfOVZ e1P2A4jCjaM+XdtvCqaOpk3t2uaYGGziW1b1bYWPSrzQ7RFEhHoKViWdajx1ztsw+2oN bnk9AbhndEj+pJmoqRdzjQ34R9lSf+WGThG2I/dM3n8sMm339S386riM8UpqOyAs/hIl HePSRoIZgG9WM5dzaaaI+QNv3jNFWhnplP86qSx4p1RkU6q37ZAgOElyDOcrJT12BHma qu/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687514668; x=1690106668; 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=PHOANAJcpdUmI3u7Ffq6B2Gk1OMSyldM7AhNrs2AxWS/BiqTd4XH/fLCzxugVLmudD 3WZOCG+Jln9Zhvk5h5pzFYRZ4/yXIWtF3FeoeBhZogy0Jfvu3e1rnfUX9fBmAmTT/e0u C3swDrnfrmMKWACg3IAdZo+TgtFlz47oOjso9YuE0c8AtI+vih+nppv3QCEml67D1rNi 6ytJSBL+MdNUPTy3IVQs0zS1swNhYmXZIjPQ3A+PUJvWPpzXMj4DXHo+qBeoHE9R3aIp r/fqe8N0nnoYWpIvH+ox6F1naUKAy+qxefSUJFwMLldFaTbVZP1DR+gMwDgs2s8X968t k7rQ== X-Gm-Message-State: AC+VfDxFjSq1YqBQF3NVS2JAfNI8EVKy2XYfADGWAtAAiUcunnxt/rKH AoiNCE70K+oUebEf2DpYrqLS5pyCDXSTbms1bzY= X-Google-Smtp-Source: ACHHUZ6FLrSK9VU9Oq4F41PZ3cJGKL7Y2Pamvyhspuem2ue7YRvUpv2Kv8yhkqC7Oo450xcBGrhcpA== X-Received: by 2002:a5d:5346:0:b0:30f:cb74:35f9 with SMTP id t6-20020a5d5346000000b0030fcb7435f9mr17053297wrv.66.1687514667863; Fri, 23 Jun 2023 03:04:27 -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.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 03:04:27 -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 06/11] net: stmmac: dwmac-generic: use stmmac_pltfr_probe() Date: Fri, 23 Jun 2023 12:04:12 +0200 Message-Id: <20230623100417.93592-7-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_030430_128793_D26F5B1D X-CRM114-Status: GOOD ( 11.41 ) 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 Fri Jun 23 10:04:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13290257 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 F2A54C001B0 for ; Fri, 23 Jun 2023 10:05:14 +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=GJPE1FvUCRSZ1Z L4ZCpNDt6sSFu31zR6tdIqvTaAWtqF/zlXKGfbBnkzhJT5Oi3P5J642Cc80R8osqdcfOYjQWF85MO wP8ybYNXqS7x4btComSFyv7Y4dI40WoUTpXbaYdUrbB1KsW+ZGNZGkkGNCXI00VXzu9eWdwoYxUKa obXk5r3a47YLFP4BaUj+vefr+DMVPlAs9Fkj7inYvdPzDCdb/EFyZDegRE4ubP8epGRCHxdRCp5GY s3h2NYQO6ezPAo0ta1V5VYI75kEwAWPI85V9/JdHi/3DZdXzpcnY2iUIes9ZoajVJa0mFFEfBATzN qDWydcGDfyzxfn2usn6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qCdem-0036Cy-1h; Fri, 23 Jun 2023 10:04:44 +0000 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qCdeY-003678-2T for linux-arm-kernel@lists.infradead.org; Fri, 23 Jun 2023 10:04:31 +0000 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-31126037f41so495749f8f.2 for ; Fri, 23 Jun 2023 03:04:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687514669; x=1690106669; 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=eqSeo+sjCAKrN1PhWFnU8m2bX62dkk//RSa+mhdep5Am2/hvnd1c/spwgUf7UT8S+J DMn1c4hnrsC9dhMXtA0DGjXjpUQ+EzJkHb6xwKO4k/sfxR/S91g9f34oXkXhrF167u/a jKCk4PQUr/+LGiVH9h9X1QwBzqmB1WBEs/zOwuJ76DOfi5n8R8lSBPuhqI4SpVs6y+lT W1JLncUby2C0RfAB0uN/ZzltRPnuX4MSo87iEt4e5dFWx7jeVNPoBowuo+iDuXQiqRjL RSYchx2ZVcrvpGzaugbS+4n2XUtIJnVCsBPHlyYLvjawalaYX37MftDL87DI6V7A9611 XlZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687514669; x=1690106669; 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=P5uP2WoW/P9298f5Q1sVLcbian2yMTY4JN4UZ5AxdgGE9nhFbHU2c3drj/ySJsQ3WM JzVY9U6VDYfYF8TMwxqsrtUZ8z7kPJPXruP5u1c3LCQ081M9tVQG2cnVcr+3SQHmhuDj 1Ma1CqICvUvVj7A+Ji2q1LGr3/5fiCkqQeaoPsjXWiC4sJ9E1t6wRhjji1ROP/MzVO97 yctAjC1ZFDvmgragpZZcjeBwRKqeEIkTvH5/Cy3y60E4PUiqM6Udm5yqU4MmF5JqBEEt OG9NB8xQx4kMHxTJKVTGQadetioypXuyUqysNwzTvdMGr174NSbaZitdkVZtjX2hf09J EfhA== X-Gm-Message-State: AC+VfDwfm7gmXqMKBGvyC5oJf3D0RHawyJlCsxf3noiG8DZze+wjD24p lwuKec99lASXnVCvo4C9x7ZYZA== X-Google-Smtp-Source: ACHHUZ4bVCpHhUCnxYiI3JTV0LWY7FqHqFM5Tihm/PAqtSEUDYD7cm5xfHqQ00GaUxgHhpUKVF5oaw== X-Received: by 2002:adf:f844:0:b0:311:f28:c65b with SMTP id d4-20020adff844000000b003110f28c65bmr14808026wrq.23.1687514669140; Fri, 23 Jun 2023 03:04:29 -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.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 03:04:28 -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 07/11] net: stmmac: platform: provide stmmac_pltfr_remove_no_dt() Date: Fri, 23 Jun 2023 12:04:13 +0200 Message-Id: <20230623100417.93592-8-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_030430_800693_BD62F39E X-CRM114-Status: GOOD ( 13.77 ) 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 Fri Jun 23 10:04:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13290255 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 B518DC001B0 for ; Fri, 23 Jun 2023 10:05:12 +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=CUJw1cKwfaBD28eRhlCum3Yv5+Lir+YRvpXvcQywylc=; b=nQTsioRKYokobD vQ5rsIXTizoV9HvQ9kMMWIiopDuYMrhmW22aZdyPzEd827QOYQqCASYHOiwMyWcNdRcli2k3B4OrS +mlIacJnpF5fUJnW1CcVI1cM/Ih2In/CFha/YTEdULjvMNbPirjC5Mntlfqb/Kxlsn2GHgdxyDE8r 7W3W8ygZB+GrLCBJxziAWtGEn0xTBveZR4IJCJfrqYvzX28fh0mpoNMUfzwYTVSjdddB2I1g9TkLu cVux6xr2ZJcDZ71/N7NHu5hdTZMwV24+VbnDZlQrq4ow3VRYNOd00yGfhm2hzur/NGE5WCZKylIZF gI6W+HfDzbAqvpu600CQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qCden-0036DR-0F; Fri, 23 Jun 2023 10:04:45 +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 1qCdea-00367Z-12 for linux-arm-kernel@lists.infradead.org; Fri, 23 Jun 2023 10:04:33 +0000 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3f9b258f3a2so6013125e9.0 for ; Fri, 23 Jun 2023 03:04:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687514670; x=1690106670; 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=2cNHhMxhOfIzH/XHLTmouuIYkabX6E9UflfjKJEOOE0=; b=LdIUgCCTq0idPl/Zeo2cKCPZMdEeYGT8+6AR9Ux4KqGKZkPgzBOOMzv4sA+WBy2WLg /1aMqPBM7vFbpCy5AJOOimdCEtx2D3ZZw44YQZamm1EsfcMSUH94yIJeqkx0Lpu8Phte WfCZ4s5VMhUbuYpiqrwG5LC7/epRQImm+muTLLLVNX4EM8CXVtmn6y2Bcsh1NOdCrZix LU1qlkiC3LQF6fbgSKI1S3QCsYJVg2aiSCuhcLkwcT72Dwdy5PN51Vko3a6HLmWYZzXr Fh5xzD5dlNdgFtHvYXknQAVuVyXsTsVHNjaTOJ4z88Cyu5Uvbxo5xWZ+UvTxta0fkSRM e39w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687514670; x=1690106670; 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=2cNHhMxhOfIzH/XHLTmouuIYkabX6E9UflfjKJEOOE0=; b=AULrsTDDCbz4KwL8B29dRoA9mSrNrgHZXittglK3vUzQZRroy8lxoXvUbX03kwtYKr 1dsPp/VN970rhSst/rhhvGOHERvygab6MUV8sZFr9Fp/Cd2HLzUwRJ8ay8dEjWVXboeL g1h3ajSj50inlWcZd6ASYTOalxuFLxxzEqdSJhaAI0BFPGmGsJ1uEV+GrCv4z/sL96/P M9NdaROJzEyX+/iWdJcNjTDCy4nY4LuQlYsUcRhxWcf6ZfZDdZXEHiYdJD8r8P7Eh2wT twe555R8CLjqZcjKUVSTz/9LXAA2HD/iOJea9llWzgH/tyYvO/2JCUZKC945uDbP42r3 WKTQ== X-Gm-Message-State: AC+VfDwBXHwRPpqAEmoUFoz/O9MflOBF/hZrj41mgg2v1p3fr9grsFcm DD9amih+BGRF++c31yK/G3dYvA== X-Google-Smtp-Source: ACHHUZ5fFiUq67rJVfopwJJLocjgBdy8zJzhGhOVI52C/HVl5gR+sEaM1MNtJDXXtmhY23x6LvVKxQ== X-Received: by 2002:a7b:cb56:0:b0:3f7:e48b:974d with SMTP id v22-20020a7bcb56000000b003f7e48b974dmr20647085wmj.27.1687514670179; Fri, 23 Jun 2023 03:04:30 -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.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 03:04:29 -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 08/11] net: stmmac: platform: provide devm_stmmac_probe_config_dt() Date: Fri, 23 Jun 2023 12:04:14 +0200 Message-Id: <20230623100417.93592-9-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_030432_356865_788051F4 X-CRM114-Status: GOOD ( 12.67 ) 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 | 41 +++++++++++++++++++ .../ethernet/stmicro/stmmac/stmmac_platform.h | 2 + 2 files changed, 43 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 58d5c5cc2269..82d8a1c76476 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 @@ -651,12 +685,19 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) return ERR_PTR(-EINVAL); } +struct plat_stmmacenet_data * +devm_stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) +{ + return ERR_PTR(-EINVAL); +} + void stmmac_remove_config_dt(struct platform_device *pdev, struct plat_stmmacenet_data *plat) { } #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 Fri Jun 23 10:04:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13290254 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 8B8A3C001DC 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=41rdYGVjz2rdutobAg0Vvrj93/0Xn7Dl2iTBWxHz7oc=; b=QiCHECZA4uDORt sf3b4pn9J3hpDwPa7k1BWGNx4eQhPt/AWVEp6byjUFRn8aIPayvE2MVfsoyG43Vme0ucskZJ7p7tg n8fO0WBIZC3t8+jc6NxzgSNrfpCqTFFTiDdKosddJsShMjo9YFmmes1oy5B6DwGQojkyDlzhHOmtq NDG0GDbDCkf9H3sC4woqee6DsswOAwc+8EBNLqmUJH/jzxcGrzbOVKOzCLyM7ENAU7IVMXrKpoQJJ Llw+SwcAj5rHDg3FQme6ma7Y+ZCv2Y3TdP5LpsxE8+UDSICYQz6mIkI8Q2fz/2CBmfc8OqmPJ/qJy EfzlghgX7w7ODCYLxvMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qCdeo-0036Eh-1M; Fri, 23 Jun 2023 10:04:46 +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 1qCdeb-003685-2b for linux-arm-kernel@lists.infradead.org; Fri, 23 Jun 2023 10:04:35 +0000 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-4f96d680399so488485e87.0 for ; Fri, 23 Jun 2023 03:04:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687514671; x=1690106671; 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=4RrfktXNAJwAB4YKI7AhrOTkkSSFAJtDqMbawS4RLXRU5DinHjF7CTFSigQBHC7iun +YDIaduuKs4+CPc704rh4dOqG2+uib8T2ARzA+eYiQpVsSrDsoHs5MhJ92gGnEQWWCOU ws1GuZVq7hs+GHqFW8H2gdvjHti3LyRGY/fB9UNR8ukBvoeAFkKUQS18FrBNBD+svGeE FD+xzGUuAWQZ668fyg/Kh1z3zUkfkgGZ2GTc/DuKGntnrIMl/fhhxWGStGXzDoGTUyFP +DFDoVMcbMNEp7XnnEpjRW3tZSOkz9TNN7fEiGQi1Imc6TrAGY8bKuiDqI2DoGqUfSls zczw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687514671; x=1690106671; 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=AUX6BBETdjkdZxZTdvEcc0wnKXJhhY98+/wr5F5suxomocbaHGFQ8SauGJL78nTrmh WiJieYG8kQJ/nuXPpYS2XmxM9ArD4OZZ5iEXZAAUVjK1bHtXeJABf2DwnaiBn16AgGnt 28A1J3FX1quJPeR2mM+m85S4XR6l3wesPe2GOG9fiLrE631LxP0kdBc0VvUFT3zPHTbZ 2WJoLsGad0NOTqgzYoxoWjBjS/bNt3Qk3u625PK5g+1bjdF52FOXGBTVbMAnnhSaHb24 hNztD7KxtIojkVwSjG3BjH/QxqPdALMR/U2OD07pLNxTJerdAH3n8Q0KSsi/IqvzI0zV pvBA== X-Gm-Message-State: AC+VfDxhKmw3Zd8PnT/ujRoKoVUCfu6Fyu30kD8nmUv4CL79lVbnMyt6 8RFr+iFP295MXLeinhSXv6KCpg== X-Google-Smtp-Source: ACHHUZ4hc5yse0n/OkIOTa2lRRWP3QII9JIGZqIe33wxnA+Dle/2IPmFy08WfsqOBtiEmCK5yv4D2g== X-Received: by 2002:a05:6512:2213:b0:4f9:657e:3ea4 with SMTP id h19-20020a056512221300b004f9657e3ea4mr4547946lfu.43.1687514671192; Fri, 23 Jun 2023 03:04:31 -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.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 03:04:30 -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 09/11] net: stmmac: dwmac-qco-ethqos: use devm_stmmac_probe_config_dt() Date: Fri, 23 Jun 2023 12:04:15 +0200 Message-Id: <20230623100417.93592-10-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_030433_862683_C0B72066 X-CRM114-Status: GOOD ( 15.46 ) 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 Fri Jun 23 10:04:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13290258 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 2D192EB64DD for ; Fri, 23 Jun 2023 10:05:16 +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=cts4fY+eWo5rG1x1UU4NBlWjqSXdKnD0CP2p+wclyO4=; b=QTQhganOKlhAYa LRSxoNMfF75h73IYinb5cwm/tmnjUt1Pyqr601FIKvQv8neDfP3fgAsV3JkemxTgyq/xGmfrXmjIU dIkI7ZxS/egy6PKw03SwXJ83KrcrS/T3dsZ9bAUNFKnCK3A8GSfoe3wSkg921HVnX3bqmhEhliOXR Si7VZ7v4ShKdwYbVQVwU0siDP6QXJZTuuKL96YRJco9NoVrtlShs0usC4dlHQ38uvwJEeW/+Pk7/T A17IS68Jb0kXtfy4DXi/kJlUvilmTNyqd2epJhenEMFZKhJ8rV2p0po2AY0RhW4mDBlw2HYS6+IVV ymAheT2FPxkNrLSb84tg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qCden-0036E3-2L; Fri, 23 Jun 2023 10:04:45 +0000 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qCdeb-00368O-22 for linux-arm-kernel@lists.infradead.org; Fri, 23 Jun 2023 10:04:34 +0000 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-3094910b150so516189f8f.0 for ; Fri, 23 Jun 2023 03:04:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687514672; x=1690106672; 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=ii2x6MMLssuPPDNgYZGKvPLHM+c/zKC3YPgF49rTzdU=; b=xSDCg+lQUTIDMHwkxHAv0qmSrhP3TF+2Q+0dynApoIaSJ5GIQM6boUZKpmYDJLDuIP BOEE/sQ2caNPKZ1VaFG7OZwGiPYnsN9M90ejDCYrmbZJTTCLS/jfL3VuASK7IbdgtUm8 6PpCE0fAhax4EJ36dRSkksMuIH/rHPH7J1PBgvNevC22JeNI4uq1L9CEtfIUlw0Iaq30 WBH3cUDzzwurXlrJIDqzk3Vfd2W9XovQSWzJ+KylTKtr79sm7p8zwZZ4jw5WHgFoQLXT ORDkSaDF2Xep9pqXC8oU4uxnl3oy3wSOhvV8X/TirT9j0K6ocU4LZH7IT1DirOgPUW9k 35fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687514672; x=1690106672; 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=ii2x6MMLssuPPDNgYZGKvPLHM+c/zKC3YPgF49rTzdU=; b=Z8mgDsshz+ZX8W0ouao5f3qbi+ylvirEc3z7zKq95sHxNtzi7CMhnlxHp6Kx+y14jV HLFMB5PABvyw5UTFU2Bza5GTn1tLNsG+xqt1uuqClxdsQPxJbtLqA0uVpzs0IlswkIuf 0buGcAraNajwiLkC6EhJrtRNrmZqzh1WkOAKgsjTvY0Wq3Qck5eTjNW8yKXgSpPG4dmA VXLCOfgFiwKJTEWZZKGxeftge5Tk1xHcIoUXzsQpaRQ9EokGvdp7cGp6B6WYd25XavVG e8IeDNp5fvmirX67CcEhPccv0iSZn8RPPDI0D+ktY8QX5xu/PbT3qjJQ3uZfazXSRrn5 CH4w== X-Gm-Message-State: AC+VfDxNKDG+CtXAmJHAD2TInQ2RLrM8+BQpZwTsOE12G5cC77zdgDiI 4Xzuf9i4u/bFN2M+609BIrlnOQ== X-Google-Smtp-Source: ACHHUZ4zkuuP4XLvWsf7VK9/F+8V9/cJeGdLNhhFXFsK0B4wOm3wwwI0PE3dMoROI9fRkKxT0tyIbw== X-Received: by 2002:a5d:6ad1:0:b0:2f5:d3d7:7af4 with SMTP id u17-20020a5d6ad1000000b002f5d3d77af4mr16354365wrw.63.1687514672396; Fri, 23 Jun 2023 03:04:32 -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.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 03:04:31 -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 10/11] net: stmmac: platform: provide devm_stmmac_pltfr_probe() Date: Fri, 23 Jun 2023 12:04:16 +0200 Message-Id: <20230623100417.93592-11-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_030433_665018_97081028 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 82d8a1c76476..231152ee5a32 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -803,6 +803,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 Fri Jun 23 10:04:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13290256 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 4A791EB64D7 for ; Fri, 23 Jun 2023 10:05:14 +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=yKqeJpIMNMsrut FsBpn8Om56LdH1QYtQpxSNKF2LDhpXwMysi8dRvdW64BaZYTCW9/vvXG40Eyay1TauCQFoMoyAuBj 5VzxeHmiIp6Ytcr8QgqGn41LePPXsbrontwXbFI5NA7M5sTMG0Dxt/4i1F1Qf6+2il8aWcnrvCcT5 58uYtCmk+4dftIb/mBMEyJ4l81S2Uu/S3QlETHMO3z+JDWxVg823+5l/gKq8Pcd3d+ZOM09/CUHU0 c67rTRu/nZ5ICQQcQBgrhMXUUHBvzslTlLv7/wv5vwGoh1W+HQGmFj6mx8tfFfGdOKFCrHCAQX96D HBiki7DhP55r2YA7vNzQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qCdep-0036FH-08; Fri, 23 Jun 2023 10:04:47 +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 1qCded-00368u-1L for linux-arm-kernel@lists.infradead.org; Fri, 23 Jun 2023 10:04:36 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3f9c532fa45so5267325e9.2 for ; Fri, 23 Jun 2023 03:04:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687514673; x=1690106673; 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=zuGv3jqXPXNst6BYdlNOz5i7R06BMmZUVLJVX6sdqiNUSMSJA2TAJOvJxpPq7poHFl FHr5u/kNtB7MlgZf+OWwoWxJ6Jxu8gW0lGRZwQY8yPD1iznE9mpGFEjJM3mAoU7ZRbRK MRYVo7oR/4TUl7HvpOZsCmJ5nu7qLJus9x9vo5gmUfvUhlC4qJsBa63p2GNLpiliJdH8 hV88Vin4HqHWY3tNDp3gTuszcYIIA1WEyz4n9c4yXp62IKJ36mBCCsXKu1PmbJQ1p11J atLvDgsPjPDAdkzCsH3ErVKInQek3T5Hapaa49UXesn9QL4rWhG7caUsMcQi5XO7qFTV xk3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687514673; x=1690106673; 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=kCfY38/aa4yI+Uzko66NXRZmUfUOGufsgrO/tLHU9LgBQdtNxbwUGJ/BboOsHj/wGg 65zZjZjPsJfT9D15QsdXcVOkYK7m3xGBuGd1ZP9DAHz2VBgWn3ZR4R3HoQDGWAArs1sL PXHl6O/kTaYVKdFoUFJck8H/rwWtqfnsIM2a+y6hrnjFEJ0+BLZCEMR0ovbjXvzZieP8 2/x8cT+6B17LxHx7lp8RqDeQ3CS2DjZYDmSBtKH7BMEuDZMLSnByGKp6/umRmreefRL6 qjD68udct9NYuy0GS6Mp5TC4zAZ3Y9xhpsSTzhSLEVVOzaxNFuWRScIjZS7wqHpUSVzr /TFQ== X-Gm-Message-State: AC+VfDxoazM/e68IchP67H5FLeDjnRnAB92PIdNU+p2MYDAfQyYT6deE 2L8251oWxX0BkER2Fr8JUHO8SA== X-Google-Smtp-Source: ACHHUZ6QwnIxjXMCCySl+cTuiFkXSm9Z1C26KrzkHt/AtwA5hawwYsHJNk48HZyL8sHOloJRl0dkvw== X-Received: by 2002:a7b:cd10:0:b0:3f9:b79b:e74e with SMTP id f16-20020a7bcd10000000b003f9b79be74emr7799589wmj.22.1687514673633; Fri, 23 Jun 2023 03:04:33 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 03:04:33 -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 11/11] net: stmmac: dwmac-qcom-ethqos: use devm_stmmac_pltfr_probe() Date: Fri, 23 Jun 2023 12:04:17 +0200 Message-Id: <20230623100417.93592-12-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_030435_449931_8D95C8E0 X-CRM114-Status: GOOD ( 13.00 ) 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,