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: 11630789 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 DD7D614B7 for ; Mon, 29 Jun 2020 12:04:44 +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 B0F6B23D20 for ; Mon, 29 Jun 2020 12:04:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="UrHUe0Nc"; 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 B0F6B23D20 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-mediatek-bounces+patchwork-linux-mediatek=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=cVD6qm82lron4jXjkB7BkOB0u7FbhVi/jm3fE8OoepY=; b=UrHUe0Ncti3C+ITyHtOM7Vw3yu a9jUZH88AYCO+vOwIovuP8hHTbCoJ0X2Hh+I96UGdO/SwnLb1tqYi5llsChyTtzKTLJK/a5jYiIWi NSGU+QXbDmCLhVtOKP7oULA0K5gnfeQnJiwdivXRiawqU2xNG9emu6DC6WyCye5i2ZB+tpGdN1muZ SWmaHQfC3p03o3aPLksazuOcwymAoNSZzF5jp0NwEJx9zDeHK4kNfkcQatZTC1+sr4chMQ24PEEk5 zpR8GrVniga0xO8UV82xDA+DkmfgQkNttEssgsmZ/DnoD+9gRY4TIw0/gC6y75+86u+ZQed5fklmV IKnSoDkw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpsWV-00088X-7f; Mon, 29 Jun 2020 12:04:31 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpsWE-0007zV-Cs for linux-mediatek@lists.infradead.org; Mon, 29 Jun 2020 12:04:15 +0000 Received: by mail-wr1-x443.google.com with SMTP id o11so16270515wrv.9 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=osEb+HBwARaqeq4uaIzpy0aEiz4K3rM46a1X1k9S0uUAgJqf6kwnJIwZ+UPoijf4h/ 3piTyvHRacMCtv27iNbTbHbN2PULsGNJQAOkHKWMlULH3YrIeBE2eXsZQd5ssM8p1UOA Q81wAbs8P60IzhmtogDXVmt8bkkqQwilooi2WHkzjNRB3cd0ViBNennJ2vE8DGb4tHEv 9NxSnXu+Sl7bfz/KYBUHiR7mtfzd8BLGn5lTxPjSxjlmdepFZvDdAhWJZfw/8w+FG7CT mE1j+JT4rbMAB51lAi2MxtMCrK4GQVe6Gwaue9iCy+rh/ChddyHhQLTr2NSQ1jlG1XXN 8aOg== X-Gm-Message-State: AOAM533q+Yg+hymweDhevRHYLq3SJycqcgX6HkDb+wRc3XtvJ+CCoAcw RQdPXi+3YGzAanMUdm+PvT+5CQ== 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:443 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-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=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