Message ID | 20230621153650.440350-1-brgl@bgdev.pl (mailing list archive) |
---|---|
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> 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 85FD7EB64D7 for <linux-arm-kernel@archiver.kernel.org>; Wed, 21 Jun 2023 15:37:55 +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: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:In-Reply-To:References: List-Owner; bh=a9wW6yNiu6FqFFaEgsdloEjPE0HFgllWcyAb1rCQByE=; b=IOFTH03jMTjbrA fV+qgCgIINLjsirKjGKBLB1pAhCFLXm9V3GX1+qlx05++aZ0GnpKCTjZKb6e81f4oH6dCkus87jNB jYcccQA/QGpN2s4589PDPMI0s522JyiqLOAeYFoOrcWIvMNjihy3N2IZ96iVohARLO6YvbP2jpmZH Xu9jXJIHN6bZxN9R3bec6utbvHzlwmlXGsnVH8SMZLPMJss4DFfX5G6GO24MkX2Wg/WFUSPHYQ7vj /6IePRniD8G5v0OwjmEKYcNHG78BvElkCiCqVKTPcXBJuEPDNx+amRcgKWlhDEbPChtawziqDtQvY lgVTNR6+c+QqEYKtl6+w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qBztf-00Extb-1r; Wed, 21 Jun 2023 15:37:27 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qBztL-00ExlS-2d for linux-arm-kernel@lists.infradead.org; Wed, 21 Jun 2023 15:37:11 +0000 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-3f9bff0a543so7583715e9.3 for <linux-arm-kernel@lists.infradead.org>; Wed, 21 Jun 2023 08:37:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687361821; x=1689953821; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=4ClAzoGuEp9Q2PcVgXbgejHlPiXITPfjrxWcfTJEqc0=; b=AQIraaew2/zXvqE91YbkJxU/ss1rbUIc/5WuQ2mQSwEYNaPiuXgCTioCRnA75I2VFH +aCknfvR8zMLhgxgFgf+R4+5qcdatJMkGa8KNvvRfJbcxnUJU0FfInDocxRWkmdMvjXV jA6Ng/H7tcLwo0B5fe3RuLLWT368fspgiGisI9e7Y1/7perYFhsqalEbkJsnHZwzepPc +84/bY1JMoZu5qIIxGa5K2tC0byJVnDuBDEJxR+EkG17r1y/ENGmCwG/xT7yUoz/itB7 8j2kOORbFrSvtdFFb4XNZSbKY7GQ0oPbztBfJ+cawzxzNLskGBR3+E7rrS3ryhjOVjTq eyrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687361821; x=1689953821; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4ClAzoGuEp9Q2PcVgXbgejHlPiXITPfjrxWcfTJEqc0=; b=Gzj6AKj4IkMBugdcoaXc08EqDUYwtHg/YC4zNtcuUUSuCZ4Zwdahala5zelzgSTodj ZAZKYOn7YO58DH2/OCu3rNyWEFtr/KIy7czE3pUCK+lOeCCT2StoZ+IAAhdj27ReKDgM XvKMpafoaiEjt64wjWtqHrgiP9fW4W4SpmQYVxVUNWq1yJWkry65wk9la6dwhAkNTUz3 hq0b59Kjaon5Taz5wj/Z/6HF9FCBcHYaPnDb+KYgbtYvhgP4zKn6y14GaJ2M7EoHkNfR 06oXbskdE9XnF+f8XWZoc2zsqpYyf/FpVgMMYh9+Dl9VwTI2/rGpFtf+QIsfiEKeMsJp JwdQ== X-Gm-Message-State: AC+VfDw03f2ys0P9C0qi9yfUcKaoLJFxnIUkxxyNl40OEQnF3BWIIQkl K/4UmgPp8qCD0FJDscnh3m/tnA== X-Google-Smtp-Source: ACHHUZ6HAkXFQk8+aVBXjAYvPLGkmxJv5JHJtkveKCNtpBoYsdRohmCW1C61OJtW2Tm6Xb1OgI9RQQ== X-Received: by 2002:a7b:c38f:0:b0:3f8:ff4e:8ba3 with SMTP id s15-20020a7bc38f000000b003f8ff4e8ba3mr11474166wmj.38.1687361821346; Wed, 21 Jun 2023 08:37:01 -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.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 08:37:00 -0700 (PDT) From: Bartosz Golaszewski <brgl@bgdev.pl> To: Giuseppe Cavallaro <peppe.cavallaro@st.com>, Alexandre Torgue <alexandre.torgue@foss.st.com>, Jose Abreu <joabreu@synopsys.com>, "David S . Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, Junxiao Chang <junxiao.chang@intel.com>, Vinod Koul <vkoul@kernel.org>, Bhupesh Sharma <bhupesh.sharma@linaro.org> 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 <bartosz.golaszewski@linaro.org> Subject: [PATCH net-next 00/11] net: stmmac: introduce devres helpers for stmmac platform drivers Date: Wed, 21 Jun 2023 17:36:39 +0200 Message-Id: <20230621153650.440350-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230621_083708_012591_FFD4FC83 X-CRM114-Status: GOOD ( 12.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
net: stmmac: introduce devres helpers for stmmac platform drivers
|
expand
|
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> The goal of this series is two-fold: to make the API for stmmac platforms more logically correct (by providing functions that acquire resources with release counterparts that undo only their actions and nothing more) and to provide devres variants of commonly use registration functions that allows to significantly simplify the platform drivers. The current pattern for stmmac platform drivers is to call stmmac_probe_config_dt(), possibly the platform's init() callback and then call stmmac_drv_probe(). The resources allocated by these calls will then be released by calling stmmac_pltfr_remove(). This goes against the commonly accepted way of providing each function that allocated a resource with a function that frees it. First: provide wrappers around platform's init() and exit() callbacks that allow users to skip checking if the callbacks exist manually. Second: provide stmmac_pltfr_probe() which calls the platform init() callback and then calls stmmac_drv_probe() together with a variant of stmmac_pltfr_remove() that DOES NOT call stmmac_remove_config_dt(). For now this variant is called stmmac_pltfr_remove_no_dt() but once all users of the old stmmac_pltfr_remove() are converted to the devres helper, it will be renamed back to stmmac_pltfr_remove() and the no_dt function removed. Finally use the devres helpers in dwmac-qco-ethqos to show how much simplier the driver's probe() becomes. This series obviously just starts the conversion process and other platform drivers will need to be converted once the helpers land in net/. Bartosz Golaszewski (11): net: stmmac: platform: provide stmmac_pltfr_init() net: stmmac: dwmac-generic: use stmmac_pltfr_init() net: stmmac: platform: provide stmmac_pltfr_exit() net: stmmac: dwmac-generic: use stmmac_pltfr_exit() net: stmmac: platform: provide stmmac_pltfr_probe() net: stmmac: dwmac-generic: use stmmac_pltfr_probe() net: stmmac: platform: provide stmmac_pltfr_remove_no_dt() net: stmmac: platform: provide devm_stmmac_probe_config_dt() net: stmmac: dwmac-qco-ethqos: use devm_stmmac_probe_config_dt() net: stmmac: platform: provide devm_stmmac_pltfr_probe() net: stmmac: dwmac-qcom-ethqos: use devm_stmmac_pltfr_probe() .../ethernet/stmicro/stmmac/dwmac-generic.c | 14 +- .../stmicro/stmmac/dwmac-qcom-ethqos.c | 48 ++---- .../ethernet/stmicro/stmmac/stmmac_platform.c | 158 +++++++++++++++++- .../ethernet/stmicro/stmmac/stmmac_platform.h | 14 ++ 4 files changed, 179 insertions(+), 55 deletions(-)