From patchwork Mon Jun 29 12:03:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11630811 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A5521138C for ; Mon, 29 Jun 2020 12:06:05 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7F1CB23B06 for ; Mon, 29 Jun 2020 12:06:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="sXebFL0e"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="W34A5EzI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7F1CB23B06 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject: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=RU1B/JB47BWUQ1wqZltUbRClpRMODETDybDJxorQ/yc=; b=sXebFL0e+ZwnlFXegsuDBar3au kA4i4czJNHUXyu2IDxkCv3w0Nb5U5iH4IYu0Yxnl5KeczxOx1/EKpCYEImYB4SyqvqfjY5IaIZy+J Qe5jNnSrTvLRgkmV3eOghuOAOnt3+2TVV0v2gyPCRG+yAbzAx78aHunlCYUAuhxu/AAfrOdZjmsGf 58hMa5S0sl7p4j3CO3au5srmS4YjkFN0B7GwAhed7mcmYxHr9+ZtZrhV2aazsD9dUbYcwRSDnE8B1 fBDFrFsSrzcBF9MqvYIb/BzXbKpxp9dCs4iK/YWyzZmLEtY8fRxVTIQa1SvJOegD/8hn2Hnyqa3nC XaqNSbBw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpsWL-00084S-Qk; Mon, 29 Jun 2020 12:04:21 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpsWD-0007zU-8Y for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 12:04:14 +0000 Received: by mail-wr1-x444.google.com with SMTP id q5so16266139wru.6 for ; Mon, 29 Jun 2020 05:04:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=C3SFeAEvbOoZI/xpVJ8MO71Sd1LqnSCGoIeWQbxnMQg=; b=W34A5EzIFj5HWi2O+Uu6ihBeBiDeWhpckbWrX2jnfqXAR3x0qNViaW+WgvnvpxwiWO MGqgE1enmwmS0gQxdKT5NnCo8pT8qbnyks2TEEdLnPjFm0OCLBWs+QPHAs9eXm7uQdat JWbhorZHQ3BtymX0aXM/lywfKu/bT8ZNk4SSMGwMY45YdISPCRJHVeIp8gOWUa6hI3x5 yl2q7FCGF3ftBuUSxFt5y3sPjglhVa+3G49n58H+eBi39BWD3W01vtmugl+iYZj5MxaS mkrYBWhfSoM6r/EQlCIFuE/GmGSu3DIPQIVdw8C/+juCBxxelde4Yfeywt4RMER4CJbR 0+DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=C3SFeAEvbOoZI/xpVJ8MO71Sd1LqnSCGoIeWQbxnMQg=; b=D4AxsguPkIvzrViu+pCTGV3vcMN53nQfpQZlcfMjtY7kOy8CTCUbuBHod9me868rDJ xeQ5FwW8V3M/DcyyNPf8B9YbDRgVF7h9lFzzcf7SysoOnpldjB/XEXG1aYESsapkpxAc iN/Chu1d+aXr4WRPIub3UcWmhPZf1L954EkJroYMzYIF8zVbBhxoHcAO/DxGTUY7o5/X XE79djP6N6RtloQjEOLXC8pCFSe4Try4NIMhbFVI6KsZJvBgbmavQcYgoyI2K681xvKO Nv5AlcB6mwC0B1wMrZAenkvCKRItbGX4sTuoXagF0cIEBQfHzcZoM3hBx4JFEjAhln51 hRhw== X-Gm-Message-State: AOAM533aiZfAgpf9qNzgh9JMqCHak3MBN8YzMBGKcTSTfi0frK+GpYy5 xoBBwy5zGQkVne4GMBT7Q+69kw== X-Google-Smtp-Source: ABdhPJzvKPYK67MLNdl2CXmAriudaJFiLrZRmwhzT6FCEy4WwbiER21DP71IWFlJPEiw6dlp0MpaYQ== X-Received: by 2002:adf:e40e:: with SMTP id g14mr18038664wrm.271.1593432250982; Mon, 29 Jun 2020 05:04:10 -0700 (PDT) Received: from localhost.localdomain (lfbn-nic-1-65-232.w2-15.abo.wanadoo.fr. [2.15.156.232]) by smtp.gmail.com with ESMTPSA id d81sm25274347wmc.0.2020.06.29.05.04.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 05:04:10 -0700 (PDT) From: Bartosz Golaszewski To: Jeff Kirsher , "David S . Miller" , Jakub Kicinski , John Crispin , Sean Wang , Mark Lee , Matthias Brugger , Heiner Kallweit , Andrew Lunn , Florian Fainelli , Russell King , Rob Herring , Frank Rowand Subject: [PATCH v2 00/10] net: improve devres helpers Date: Mon, 29 Jun 2020 14:03:36 +0200 Message-Id: <20200629120346.4382-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:444 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Bartosz Golaszewski So it seems like there's no support for relaxing certain networking devres helpers to not require previously allocated structures to also be managed. However the way mdio devres variants are implemented is still wrong and I modified my series to address it while keeping the functions strict. First two patches modify the ixgbe driver to get rid of the last user of devm_mdiobus_free(). Patches 3, 4, 5 and 6 are mostly cosmetic. Patch 7 fixes the way devm_mdiobus_register() is implemented. Patches 8 & 9 provide a managed variant of of_mdiobus_register() and last patch uses it in mtk-star-emac driver. v1 -> v2: - drop the patch relaxing devm_register_netdev() - require struct mii_bus to be managed in devm_mdiobus_register() and devm_of_mdiobus_register() but don't store that information in the structure itself: use devres_find() instead Bartosz Golaszewski (10): net: ethernet: ixgbe: check the return value of ixgbe_mii_bus_init() net: ethernet: ixgbe: don't call devm_mdiobus_free() net: devres: rename the release callback of devm_register_netdev() Documentation: devres: add missing mdio helper phy: un-inline devm_mdiobus_register() phy: mdio: add kerneldoc for __devm_mdiobus_register() net: phy: don't abuse devres in devm_mdiobus_register() of: mdio: remove the 'extern' keyword from function declarations of: mdio: provide devm_of_mdiobus_register() net: ethernet: mtk-star-emac: use devm_of_mdiobus_register() .../driver-api/driver-model/devres.rst | 3 +- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 6 +- drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 14 +- drivers/net/ethernet/mediatek/mtk_star_emac.c | 13 +- drivers/net/ethernet/realtek/r8169_main.c | 2 +- drivers/net/phy/Makefile | 2 + drivers/net/phy/mdio_bus.c | 73 ---------- drivers/net/phy/mdio_devres.c | 133 ++++++++++++++++++ include/linux/of_mdio.h | 40 +++--- include/linux/phy.h | 21 +-- net/devres.c | 4 +- 11 files changed, 174 insertions(+), 137 deletions(-) create mode 100644 drivers/net/phy/mdio_devres.c Acked-by: Jakub Kicinski