From patchwork Mon Jun 29 12:03:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11630809 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 D8DC7913 for ; Mon, 29 Jun 2020 12:06:02 +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 A617E23B06 for ; Mon, 29 Jun 2020 12:06:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="RjkPSPDp"; 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="VvL4yO6j" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A617E23B06 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:References:In-Reply-To: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:List-Owner; bh=3QNUw6gKwApFg6/NzP8rS+4LzhPIr52wBmSZIV4pnEk=; b=RjkPSPDpnEFzS+fHKfXcYOnJE 32yRyD8uPKoPRd2xwYid5pZh88nge4Cg6/pymFq2j9ej9/KAkojDNVebf6e+KIq2F32bCfNGJOygN o79WBi8s9tQLDXbyp0c9RnzHY1TBUpWtxSbmI7KU64hIGPP0Ne7yGOXczS4QbXy6Yh7D/0Z3IuNjE 1/lZv4wn0On0Ln/E86hdO96hRiQIdG8fJCmd2mIwX1iLUD+4vX8DBcL1msOhF0D2A9XaHUQekIO81 8LCWT0GNISQTHoVg9KfYBSozlovg++hwet7PA/PQJDN991YrbjMjWQIr/aijP3MewAAEpBKlQtTCC u/XGY8JrA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpsWG-00081h-I4; Mon, 29 Jun 2020 12:04:16 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpsWD-00080k-G6 for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 12:04:14 +0000 Received: by mail-wm1-x342.google.com with SMTP id f139so15847620wmf.5 for ; Mon, 29 Jun 2020 05:04:13 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=Hz0iVZuquqaAZG91zpdXr2Uyq4D9Tl6Yab1oO2oLyu4=; b=VvL4yO6jCcGsEdtzYiLzKqRQKd+CJHaFyeqJWf7CcFeUmtn3q8wK56Ka3u84RH2/TB NB1CiAymp//XtqnFz5/H+ApJeRCUh/SqYJkad+wuFzUrSypwMyamn05nNgh9bLzgio/4 QBu82NPhZZT4p9ki5bX41KR4ZogP7bglHyn0k1CHfqSTORfkjFmMOuW3F+ZcTgaapo1B kH2qepefaYlMyQ/1lvRS5epPqtlijcTGvri5VRyh7kANgzWCz96TsJFHbd1OpXN75CnZ b9jNoyvkUTRs0Vyin0UkoI4pBwLsrwpFCWDaCSYqIKh9GuRWgBS4RIRv05e4D75Eph+2 us+Q== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=Hz0iVZuquqaAZG91zpdXr2Uyq4D9Tl6Yab1oO2oLyu4=; b=J68wyQjhq0MXdxtOraNb+LNLpIDqOIER2tgHJJbqQuP6iVli+LnsLB8ALtMPgOF2QV hrpd6aSYOxiVk61T7PbgkyvMs03MIYsv5YgLICMmQaZiZ/0EsOyge9Mqr+HH4mx10Fc2 A5i1c3qX+2IofyUYvmL8AAqtk+IGBejzczrA6Y6hKkJg3YunyRBypM0gCy0ONNE75PnE A5l0qo++7FWPgxy35s041+tFY88w4Jr8HmKOMeHjyUoVrB5FpYaEYXsrO5CrkLa1t34l Xo9D5+t4o51y1/cIn7N0eC7ribSolfr2k8J7zLu7eHHOXTggrmDlG9WLUOW98ViDiozU 87Sw== X-Gm-Message-State: AOAM531jbHYlvvOdkv9Vlr3jsXrtarI3h4wXHqOw8Y6LhonyDX2WQDYX maU6zag94XuQnRE5RiVGWkN7eg== X-Google-Smtp-Source: ABdhPJwR+XCjvBHh7hN27yb4wbyQ2NgRHNnJda5bGoNm1j9W8pobPb9+mBDwQzfYrDFvbqSH7NAqWg== X-Received: by 2002:a7b:cc8b:: with SMTP id p11mr17632537wma.180.1593432252690; Mon, 29 Jun 2020 05:04:12 -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.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 05:04:12 -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 01/10] net: ethernet: ixgbe: check the return value of ixgbe_mii_bus_init() Date: Mon, 29 Jun 2020 14:03:37 +0200 Message-Id: <20200629120346.4382-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200629120346.4382-1-brgl@bgdev.pl> References: <20200629120346.4382-1-brgl@bgdev.pl> 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:342 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 This function may fail. Check its return value and propagate the error code. Signed-off-by: Bartosz Golaszewski Reviewed-by: Florian Fainelli Acked-by: Jeff Kirsher --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 97a423ecf808..8752b5eea091 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -11175,10 +11175,14 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) IXGBE_LINK_SPEED_10GB_FULL | IXGBE_LINK_SPEED_1GB_FULL, true); - ixgbe_mii_bus_init(hw); + err = ixgbe_mii_bus_init(hw); + if (err) + goto err_netdev; return 0; +err_netdev: + unregister_netdev(netdev); err_register: ixgbe_release_hw_control(adapter); ixgbe_clear_interrupt_scheme(adapter); From patchwork Mon Jun 29 12:03:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11630813 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 A564D17CA for ; Mon, 29 Jun 2020 12:06:18 +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 7EE2723B06 for ; Mon, 29 Jun 2020 12:06:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="X2N37WCy"; 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="GHZrNXAb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7EE2723B06 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:References:In-Reply-To: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:List-Owner; bh=k2kVMBxK3iryBCv3LcSBanDtDi6jCJHzjtq0sh+xtAo=; b=X2N37WCy/oAOOaCbSeOuAFu+l g4jitHdycMkceHuz9jmK7ksDXxhOmXaKYUI2xacmvNxBbIJpH50ijUCw7p+y6AxDOzqCFo74JlA58 jeDed2/KSfbzAhaT2A7O38nhGCQnmBGl87Uvhz2GXTuux42qJg9eXfz+YD+p+sBWjBIsFN0UqLS/i o9m4q9vJfVU7PQWTrQ56rulUQ19vUNapI3D8h11N9uA1Nq86u8tKKgHFLkxaJQRr8PZNfKrDyIybn ozdMKNCQQeZBMxZfw5P4fHTYEi0sCI8KIrBtjHiPu1Qy9iqm2klGkvnq9NGhCyJ3ZtsTWryOJ2q9T Pgo8EfaXA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpsWY-00089Q-Fe; Mon, 29 Jun 2020 12:04:34 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpsWE-00081A-Sp for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 12:04:16 +0000 Received: by mail-wm1-x341.google.com with SMTP id j18so15126451wmi.3 for ; Mon, 29 Jun 2020 05:04:14 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=nZJ9RrYkX//UjOI/5YYylQYoHuaDDR4YnVJY1VbZiK8=; b=GHZrNXAbixM8hIlftssrgQxdDlC2R8smynvTThHUqsGw3QGlkt8NhoPhAOcQQGzRtw 8UiJW8UelWWaFm3hR3IBZDUiETIQ4cw/d0cKQJ2t1YCJDD+35seh4iu5J6/ZnfNA9Cf2 0PVuY8rWNQGb4TJy8iFdvM58AtK7sHgm7tkKp+d8JruntQqh4/uEGDPUikx3v8VCVX/X t0nKty1pn7Dat78dI2BiItZ4JxBDOUehXZ0nt2E9AXLK4007faqBTbkxlHvbnLr9M2so H+SDo8uHBGYBqIx7PHreVr5lgWWgBQR/mjyFndySyTN3eQfiaXuMtvjj/R5CALJQPX52 cZCQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=nZJ9RrYkX//UjOI/5YYylQYoHuaDDR4YnVJY1VbZiK8=; b=hj5Fp3iKuGQV/mAeysdue/N3oGyPjelIs2Wjj8XBxCjRata6V+euKKGTmHUiF6InPc 6Qm/86cfyEIU/uVlxKHklfBF/M3r9I55p71lNfq+Etzhk9wL2JHyQGUBTztKgiBwdXaJ 6ByYA/buE6O7M85mh+/snlWQwhbV79VsjMM5cEPRZMeYtcPUgYhyqHclcJn6arVEAWzq NO5OMxwwyN8vF2AgfcGJ1F+1WHu2yLs3CxgfsU4ZjO1E99g4LbijA8MzBdbjeZP1wyNi 5+tYI9FWuoTQloYR4rBOjyYY+x9Q8KsCR6BhqIy5EvRKoXTBx60l9P8POraMJK2NhgLI CGdA== X-Gm-Message-State: AOAM531muM60DqkUoM4PfRotQHP61I8rtnOzV61Iky2Bu/BuhNLBHliL 6D6Z0BEko0FbGrRZ26LhXpP5hg== X-Google-Smtp-Source: ABdhPJxPsnR1q89EpF5XRsu5RI2Mrvn6hFviI2UQaVTUzem4LR886XkHZ07utmAJlfbggOLXkkyVfg== X-Received: by 2002:a7b:c381:: with SMTP id s1mr17268979wmj.25.1593432254093; Mon, 29 Jun 2020 05:04:14 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 05:04:13 -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 02/10] net: ethernet: ixgbe: don't call devm_mdiobus_free() Date: Mon, 29 Jun 2020 14:03:38 +0200 Message-Id: <20200629120346.4382-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200629120346.4382-1-brgl@bgdev.pl> References: <20200629120346.4382-1-brgl@bgdev.pl> 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:341 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 The idea behind devres is that the release callbacks are called if probe fails. As we now check the return value of ixgbe_mii_bus_init(), we can drop the call devm_mdiobus_free() in error path as the release callback will be called automatically. Signed-off-by: Bartosz Golaszewski Reviewed-by: Florian Fainelli Acked-by: Jeff Kirsher --- drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c index 2fb97967961c..7980d7265e10 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c @@ -905,7 +905,6 @@ s32 ixgbe_mii_bus_init(struct ixgbe_hw *hw) struct pci_dev *pdev = adapter->pdev; struct device *dev = &adapter->netdev->dev; struct mii_bus *bus; - int err = -ENODEV; bus = devm_mdiobus_alloc(dev); if (!bus) @@ -923,7 +922,7 @@ s32 ixgbe_mii_bus_init(struct ixgbe_hw *hw) case IXGBE_DEV_ID_X550EM_A_1G_T: case IXGBE_DEV_ID_X550EM_A_1G_T_L: if (!ixgbe_x550em_a_has_mii(hw)) - goto ixgbe_no_mii_bus; + return -ENODEV; bus->read = &ixgbe_x550em_a_mii_bus_read; bus->write = &ixgbe_x550em_a_mii_bus_write; break; @@ -948,15 +947,8 @@ s32 ixgbe_mii_bus_init(struct ixgbe_hw *hw) */ hw->phy.mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_SUPPORTS_C22; - err = mdiobus_register(bus); - if (!err) { - adapter->mii_bus = bus; - return 0; - } - -ixgbe_no_mii_bus: - devm_mdiobus_free(dev, bus); - return err; + adapter->mii_bus = bus; + return mdiobus_register(bus); } /** From patchwork Mon Jun 29 12:03:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11630815 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 D628A913 for ; Mon, 29 Jun 2020 12:06:29 +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 A069F23B06 for ; Mon, 29 Jun 2020 12:06:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="1FA3cPY5"; 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="s9kteNeX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A069F23B06 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:References:In-Reply-To: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:List-Owner; bh=4XJ77AiWzzU4TS0tpLmqYV60lJWHtz7YsIi7gnDy9Uo=; b=1FA3cPY5zO4K9Lv56XubycaEx t9pqL6+KNURO7hxOzZwJCe16ZUxbhwN5WXPVKqQ91p9wELkVkrVJf6LQfcpQT5m+pf8Y9uOTZ49+a 9ySqjVTDGu1uuxwLXtXWRxElvrKd0p8In4btJ/E1NQ+jYWf/8+LwRBVD83NzxCA3+wEV02lqIcoj2 0DW29iwpBM4UMKXieXAz+FmbiNDWuWu6sRM/Hp9zLSZg7oWADbZDFIolx36j7/LqAObyl3HUZF5At 472hj0qNKOJAIMeXT/Q7YIOQL9biFCaVutj7qfkxhdk/HMw7tdzUHrxmC6Wvi2nwH9exMArdD7siT yRvWCfiIQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpsWm-0008Ee-US; Mon, 29 Jun 2020 12:04:48 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpsWH-00082M-VJ for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 12:04:19 +0000 Received: by mail-wm1-x342.google.com with SMTP id l2so14371806wmf.0 for ; Mon, 29 Jun 2020 05:04:17 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=kk4GqzupyJ/zMhEjt50iMo8E42JSASWwyoRhFrVXFkw=; b=s9kteNeXi1zTwB+iA/Da/H/SPwbWFgSRcTYjOhHXHWF3DK4DgkjnWLtB3kXWUYcT73 hrQ3sZLr45ONRMe37aZJiaJZqvsJkdNy022pJEVyvesHs/Usys8f1PNEbBh/x2TgLjW5 MzXNu61KMK8OAc8kI7zqSWj6yUSfkkAeWvduGtmpBPGg5zflFGTAloz+lI6SH8ZeyaF4 fgHItffrSY9r+xFcjDC7cJKNDoYT11AD7qfDTq0LviqPvjIASWNkM3GOYEhgZi13/HMO nbFl97jRYhP8AwnmUe5P7dnadnS6u8YZj+1fWhK6Oe2uxf6rzW6Igdl90lnBrDHpjR5z NqZw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=kk4GqzupyJ/zMhEjt50iMo8E42JSASWwyoRhFrVXFkw=; b=WUQpwZTtopgBDkUV8YzhO7YSjp5g4UfTYOcYxVHQkbDSL4Lw2FWh2/R2qNE7Z1N7s8 RvUojIiesoYDvIty3oYmW2juJchz4NT+pcHGFZgn9CjQVESTVR9DkU/Cx9EQH/OXi+Zc zhakQn8yPlZIotGH96yiyWjIjbDcyMhXZIsNb5lsAMWsPowQxlYCs2PIBzcgcqfpmSvo mI2FVjBtcUpz2ROYbKeg+++YlRzvPcnQCW0RwIsWLXooEFpgJQbDRZiQFkeCYcDNu/OD 5SiavLyVIN+Jm5cuLfUsMErUn51czqNhDzDjVDdtN5gkDjMil+1XftggXZY9imJI2Zdh CIsA== X-Gm-Message-State: AOAM532uv2gs5YVF5LB3jVRpHMvnBTTEfrqtN1HqYY74jYHawAgez4j0 YJ5shuSIPGhNrIUIftqBfnLhxw== X-Google-Smtp-Source: ABdhPJyWDqDeFgVInuObhpy/Ftb/2DR2R2EIJXvEfaNkWasvMTcTlNr2GvJFRYK1k6XxTkq/Wt9wfQ== X-Received: by 2002:a1c:cc0d:: with SMTP id h13mr17832883wmb.168.1593432256110; Mon, 29 Jun 2020 05:04:16 -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.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 05:04:15 -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 03/10] net: devres: rename the release callback of devm_register_netdev() Date: Mon, 29 Jun 2020 14:03:39 +0200 Message-Id: <20200629120346.4382-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200629120346.4382-1-brgl@bgdev.pl> References: <20200629120346.4382-1-brgl@bgdev.pl> 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:342 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 Make it an explicit counterpart to devm_register_netdev() just like we do with devm_free_netdev() for better clarity. Signed-off-by: Bartosz Golaszewski Reviewed-by: Florian Fainelli --- net/devres.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/devres.c b/net/devres.c index 57a6a88d11f6..1f9be2133787 100644 --- a/net/devres.c +++ b/net/devres.c @@ -39,7 +39,7 @@ struct net_device *devm_alloc_etherdev_mqs(struct device *dev, int sizeof_priv, } EXPORT_SYMBOL(devm_alloc_etherdev_mqs); -static void devm_netdev_release(struct device *dev, void *this) +static void devm_unregister_netdev(struct device *dev, void *this) { struct net_device_devres *res = this; @@ -77,7 +77,7 @@ int devm_register_netdev(struct device *dev, struct net_device *ndev) netdev_devres_match, ndev))) return -EINVAL; - dr = devres_alloc(devm_netdev_release, sizeof(*dr), GFP_KERNEL); + dr = devres_alloc(devm_unregister_netdev, sizeof(*dr), GFP_KERNEL); if (!dr) return -ENOMEM; From patchwork Mon Jun 29 12:03:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11630819 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 6680A138C for ; Mon, 29 Jun 2020 12:06:35 +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 3EECD23B06 for ; Mon, 29 Jun 2020 12:06:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="xUdnLa6v"; 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="nQ9byLrD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3EECD23B06 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:References:In-Reply-To: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:List-Owner; bh=ajtI9hk0Vup7pfwzkvTLdr0mCjuT3R4lDFieUfUqmG4=; b=xUdnLa6vZbXbRbncbuDPb1pLu Jw3j0ehaO7N4RVEE3Vl20V+lWmWN6Ws65NEUWleD5YhF4Xvx4eKmphnq+LQJ1lylznwpnHmuLyMjk kfZQDQYQXLNl4Lg0klwgdgR5yzH8MQMh6lzAL6CNXGJwHvdY4FFIZALncQ1AK/d3PBF2kL0KufBCl OUPq+IxC+yUxDjl/4c65JpNIjSqThKgO8JO/vEVEmLQU+ro27aWzzQnV5sgQ2B1viOAiaQALo0aos IYebk+E8TdAmf+a4kl4vhAoqgcN7Gl1ngGbu5YZemARUvjk8Pd2hty945167+nlx0pcqv/p8ZSlxM ju5FppuQQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpsWt-0008HT-M6; Mon, 29 Jun 2020 12:04:55 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpsWI-00082h-A2 for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 12:04:21 +0000 Received: by mail-wm1-x342.google.com with SMTP id j18so15126631wmi.3 for ; Mon, 29 Jun 2020 05:04:18 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=vANIsXo74NzXiDIyR10LVPoVvN0SF3cCppVREngNaSg=; b=nQ9byLrDn58wjHMhoadRsTTETa0UhC6JF4a46q+PYUs7UZGZeUDV+Ialz0dd7h+UZR mhqFHyY0EbcDbESld8SYOxPhwBLpUwtVkb7pnzsNitFSbO7EEfGSOy2q2y7CP79Hex0H 1b+M8CdLjEStcijSVXMq80kujGFckpNmUPo54ebhhky847n6l7blHRFboEfpPZTyy81E MMdTQ19QQn9i1JzgLPdR6Txwa+fNw+Wy8dARSM1y/DGypJ0Whb8UBnHg8y/LnybqbSGv f43pJWnxIJUXGw1WzhE2J9N+9sBt5Oq9JRyYdz9w5VzjVb+Gsr45rKUvPRAqZkU/fFCF warw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=vANIsXo74NzXiDIyR10LVPoVvN0SF3cCppVREngNaSg=; b=IWcCWeYQU8oaAiIhJUVviQtqX4L5DCVTrZZ+fMyAxieRUbh8nRYwx/eItN6CjHi3Q/ 1BXnwrJApLxiJZLVtfc7efMgYNcR3fYyMOecW1wfazrIAoCX0pNJ1h6IFsk+zWxXkdzk Rq7o+cRopRPODI/bIAL/UztQNd4T8o0xglkE8xDTLbayBuEXeJfpauQS02NWf28jWpJd km345F5PlaTsv0UOMakmnMeRxM7dREBL77udcifCDVcqgQMWjfSZuziwJVIjrHKFA+z2 9qNz2PNxY+HUwxZI0+07+9btF9fGwx7D9GVy5crpTtscnA7QvnMs7V5W+WHpzYdsE4pj GHQg== X-Gm-Message-State: AOAM532KlGmIlW9OxoijYpOXZ8ayblIBt2xV5NfKxaBkUlExC2TGgsqY qaqcDRiSXiIYCkvU21os9rdqQw== X-Google-Smtp-Source: ABdhPJzzIpHdKMTQ6SjqhWeqI//sR8Iftgms6VcGQcyabxIbGKuFkf8bRkm3ckDgSAITcNYh0w9Y4Q== X-Received: by 2002:a7b:c746:: with SMTP id w6mr17250018wmk.171.1593432257471; Mon, 29 Jun 2020 05:04:17 -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.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 05:04:16 -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 04/10] Documentation: devres: add missing mdio helper Date: Mon, 29 Jun 2020 14:03:40 +0200 Message-Id: <20200629120346.4382-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200629120346.4382-1-brgl@bgdev.pl> References: <20200629120346.4382-1-brgl@bgdev.pl> 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:342 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 We have a devres variant of mdiobus_register() but it's not listed in devres.rst. Add it under other mdio devm functions. Signed-off-by: Bartosz Golaszewski Reviewed-by: Florian Fainelli --- Documentation/driver-api/driver-model/devres.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst index e0b58c392e4f..5463fc8a60c1 100644 --- a/Documentation/driver-api/driver-model/devres.rst +++ b/Documentation/driver-api/driver-model/devres.rst @@ -343,6 +343,7 @@ MDIO devm_mdiobus_alloc() devm_mdiobus_alloc_size() devm_mdiobus_free() + devm_mdiobus_register() MEM devm_free_pages() From patchwork Mon Jun 29 12:03:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11630821 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 700A0138C for ; Mon, 29 Jun 2020 12:06:49 +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 46EFE23B06 for ; Mon, 29 Jun 2020 12:06:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Qb+MYCqi"; 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="wrrcCV/e" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 46EFE23B06 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:References:In-Reply-To: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:List-Owner; bh=w43ZmCJRMewRC0EUxBemaTUEFChwlXqnTk87RmCLims=; b=Qb+MYCqip4FoJJcybplrWaj8W uzofAPGVos0I+vItJZF/ootVagJHYqabQy9KQmt0RnjykUUwAAKuTzT6axvhej4A4tS32mlkPphMb DD9YQ3F9M2ySOY10k9cmm5UGUKwVVsBjn4wjzMkkN5Odm5pJmHFvtdhHsuoREuJKB/sXMtAEDYBgC 9ZuEAgURnuyFPQKYcdxae1TofShLgULiQzaTDSCO0NLWdOmFC72N3CTZ0Pht1/MOqXyFgZ7mKZDTd g1qMVSI/1MOHIqhbhdOkME8d0upTpms/8Jobgjj75P/191ZacSEvzOaKKKO/WBu6IvBNSuyHM/jOR +N2brvI3Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpsX7-0008SA-Pc; Mon, 29 Jun 2020 12:05:09 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpsWJ-00084G-Sz for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 12:04:22 +0000 Received: by mail-wm1-x342.google.com with SMTP id g75so15105521wme.5 for ; Mon, 29 Jun 2020 05:04:19 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=hztYQwCZoivzm5mGWlL7y58+THNI2tIqMQL/obqgBh8=; b=wrrcCV/eHtEzwZIw9VBAP2zQ1gydhl0t9E8l473TWC1k05eOBumji4Os1tiblAIJzO 4wOzef0hZPVEX5d6XcKMyCLmyT1b7YyADt6ahskiop6YYNc4kCYECitUEPTZ2F+fGW7i 6y8Uvfl5xMLYsCcJdugcnS3YtHoCINKs3ujOoex6Br78sdsqIuKWAPmqQBMdtMgzZc4Z IgDmjSTOStUefzpm8hIuT/c2k0/+8rBOE6qocp0QN+rhvRzXyv46oLIUH3XFLdMSc0fo EpUTI/q2/srGjYzlHBIkYZyaLKmmyxTE0lK2PPy6VX9gggVCK384yzLHsG9blwPMptuJ bl8A== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=hztYQwCZoivzm5mGWlL7y58+THNI2tIqMQL/obqgBh8=; b=Feo/LE4ng8mAN+LGg4mtswLYdW/PPQony7PtedkCCuMgJwqTM2Q5EVHA0otzlaThw+ j+yulJSLazpM/Fx0ZQ6QlScikfZb6mEha8zcj3qN4mxbC0uwVmf+Je79i0arrgAkYBx7 KBtbB8/WYqBxTE25BJuWa1AznbogM92A9VNFOOs/mb9ZpsHturcU9z6KF+w/ks1HNhk9 foY99n/Nk0/B/Jnvlh/q7FFFOBLd8y4Svo6zgbafwn0Uq1xGn6XoPPB0Tklmc14GLIdp t5VN6Fdj3jD7du89MzorhCAz4AYGZhk2xx74JhsaEEOOj1ai5UhEg0bckS3Kkv52/5hA XRWA== X-Gm-Message-State: AOAM532vhzSQ7VVQ8YyGxCnO4gffM3BNR14at/3vjuF/PhYyQXzr9usa mZR/uBtAnN5fq1Z6+W+LRFP7lg== X-Google-Smtp-Source: ABdhPJwFYLtezxZPsklmDvGqxvDLuEveoshSgJPr77DKJtvQVHg9COcCXF74kUionqbzZntdIBqycg== X-Received: by 2002:a7b:cc8b:: with SMTP id p11mr17633011wma.180.1593432258934; Mon, 29 Jun 2020 05:04:18 -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.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 05:04:18 -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 05/10] phy: un-inline devm_mdiobus_register() Date: Mon, 29 Jun 2020 14:03:41 +0200 Message-Id: <20200629120346.4382-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200629120346.4382-1-brgl@bgdev.pl> References: <20200629120346.4382-1-brgl@bgdev.pl> 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:342 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 Functions should only be static inline if they're very short. This devres helper is already over 10 lines and it will grow soon as we'll be improving upon its approach. Pull it into mdio_devres.c. Signed-off-by: Bartosz Golaszewski Reviewed-by: Florian Fainelli --- drivers/net/phy/Makefile | 2 +- drivers/net/phy/mdio_devres.c | 18 ++++++++++++++++++ include/linux/phy.h | 15 ++------------- 3 files changed, 21 insertions(+), 14 deletions(-) create mode 100644 drivers/net/phy/mdio_devres.c diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile index dc9e53b511d6..896afdcac437 100644 --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile @@ -3,7 +3,7 @@ libphy-y := phy.o phy-c45.o phy-core.o phy_device.o \ linkmode.o -mdio-bus-y += mdio_bus.o mdio_device.o +mdio-bus-y += mdio_bus.o mdio_device.o mdio_devres.o ifdef CONFIG_MDIO_DEVICE obj-y += mdio-boardinfo.o diff --git a/drivers/net/phy/mdio_devres.c b/drivers/net/phy/mdio_devres.c new file mode 100644 index 000000000000..f0b4b6cfe5e3 --- /dev/null +++ b/drivers/net/phy/mdio_devres.c @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include + +int __devm_mdiobus_register(struct mii_bus *bus, struct module *owner) +{ + int ret; + + if (!bus->is_managed) + return -EPERM; + + ret = __mdiobus_register(bus, owner); + if (!ret) + bus->is_managed_registered = 1; + + return ret; +} +EXPORT_SYMBOL(__devm_mdiobus_register); diff --git a/include/linux/phy.h b/include/linux/phy.h index b693b609b2f5..4935867f024b 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -313,20 +313,9 @@ static inline struct mii_bus *mdiobus_alloc(void) } int __mdiobus_register(struct mii_bus *bus, struct module *owner); +int __devm_mdiobus_register(struct mii_bus *bus, struct module *owner); #define mdiobus_register(bus) __mdiobus_register(bus, THIS_MODULE) -static inline int devm_mdiobus_register(struct mii_bus *bus) -{ - int ret; - - if (!bus->is_managed) - return -EPERM; - - ret = mdiobus_register(bus); - if (!ret) - bus->is_managed_registered = 1; - - return ret; -} +#define devm_mdiobus_register(bus) __devm_mdiobus_register(bus, THIS_MODULE) void mdiobus_unregister(struct mii_bus *bus); void mdiobus_free(struct mii_bus *bus); From patchwork Mon Jun 29 12:03:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11630817 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 18344913 for ; Mon, 29 Jun 2020 12:06:35 +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 E646523B06 for ; Mon, 29 Jun 2020 12:06:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="sQoF6+pU"; 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="bhKeRr58" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E646523B06 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:References:In-Reply-To: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:List-Owner; bh=ntXgGgk8slsPXK6WkmXt82OUAiSCTnGYcWN4HXBJ1TI=; b=sQoF6+pU71lLXXD5wQPQtghNw DrAIA3zPboALGGidF9rYjrfCLhbcPTzaVtvYRWj2qUMT0jEfBHvSslnKRNvauQD1335nt+DmljXI4 ucyEXQCThw0F+sHePjz+7viJfLuw9X69YUfcHV+ITEhCBINZh2rDcKWZKZtAK05F49SuPz6wG/xGs H0t95O22rgblMYXls9toR0LEIkRAGMkdoYULzkA/l99bXdB42Ktp55xCDOEdwLqfoJWxx7C0GV63K FdOLaov04tWBgiQEdDJvAQWkXvm1gjr7aVJMlO2N3NA5P/x2RK4+2Y/WaPDtcutzgn6UBwK4xmfRA lPYY26BmQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpsX0-0008Mp-V1; Mon, 29 Jun 2020 12:05:03 +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 1jpsWL-000859-7P for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 12:04:23 +0000 Received: by mail-wr1-x443.google.com with SMTP id z13so16278055wrw.5 for ; Mon, 29 Jun 2020 05:04:21 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=rcgV1UNGKm4K4QD82m2Udcr1uoHRVa+LAuPxtdS553M=; b=bhKeRr58llmIS9VKgVFyB6mAC7XOTgR+vC4RJRrwyWIr5sh0Pep1GPWHLAgwGzpwAc MGPqTye+7rp41hJ0FSDOVSH+p83Zt/3ZFe7cwcMshyi04ZZeZpr/muoHkBS6d3gEFsqC gL9tprIlM/mTLQfg0PC3ySsy+WIP8DkfosTU4J5ojN9iLGjwYxKS/OZIJyN/rXYZmrgt b/PirIRVemOkzEXXswFvaL53RJkfuhhqpelHeBzIZhnZXZ+/gqm1xcXkTKom438Uu5E3 dMbEgvGvBvjLo2LDuXkeV0gRZt75ZzMGwBn8D2w+jiehl1HPOVrLev1YO1EDLxfeZxlK 6RTw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=rcgV1UNGKm4K4QD82m2Udcr1uoHRVa+LAuPxtdS553M=; b=sP1xvL3YqAx6q012twXNDdotVn+LkEOTbNvgrf65fy6cPGAyFQio8RC6otTOLL+99F JhwHSl92s+XLqgGA0JjzBblmeER9EOtoOVhKQDruFb/s0oiL4/pE1D29OuLb+eGuU9z1 luuLhIe075gJ+vNogQspeuTKIbVkaGl5zJA12V5mAqz/yaC4bVWgGlN3hB5t26Gl56RL 8WdAHnkSxwTy0BuD9nVzmrwgZZUQfqAvhLtmDMwvvlSqa4tFpJjkdAwMgSM7339sHBz9 qhK34qikfyaL8+ki9VmyLbWXaBjfXO9gwOHfkIKIBBSG4/aH5dXcNnQkONAobLm+B29c MVHw== X-Gm-Message-State: AOAM531QlH50VgMiGmKUm2DqFq9O38DfPr3w0KTMl1+V3AQ4VZGZWOTT 7QhjFDhG3drKjH/caLHj58jJCmmcpWM= X-Google-Smtp-Source: ABdhPJwlADkzSAVFbK3JmZ+v+w78Y8jXO+OaWZ19/qk/J/aygV+blBomdVtOyQPcaDByMnxBjS6U2A== X-Received: by 2002:adf:c185:: with SMTP id x5mr18180867wre.403.1593432260279; Mon, 29 Jun 2020 05:04:20 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 05:04:19 -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 06/10] phy: mdio: add kerneldoc for __devm_mdiobus_register() Date: Mon, 29 Jun 2020 14:03:42 +0200 Message-Id: <20200629120346.4382-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200629120346.4382-1-brgl@bgdev.pl> References: <20200629120346.4382-1-brgl@bgdev.pl> 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-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 This function is not documented. Add a short kerneldoc description. Signed-off-by: Bartosz Golaszewski Reviewed-by: Florian Fainelli --- drivers/net/phy/mdio_devres.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/phy/mdio_devres.c b/drivers/net/phy/mdio_devres.c index f0b4b6cfe5e3..3ee887733d4a 100644 --- a/drivers/net/phy/mdio_devres.c +++ b/drivers/net/phy/mdio_devres.c @@ -2,6 +2,13 @@ #include +/** + * __devm_mdiobus_register - Resource-managed variant of mdiobus_register() + * @bus: MII bus structure to register + * @owner: Owning module + * + * Returns 0 on success, negative error number on failure. + */ int __devm_mdiobus_register(struct mii_bus *bus, struct module *owner) { int ret; From patchwork Mon Jun 29 12:03:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11630825 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 8A566138C for ; Mon, 29 Jun 2020 12:06:54 +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 53A4123B06 for ; Mon, 29 Jun 2020 12:06:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="nv/BaJ3J"; 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="cq42QKYm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 53A4123B06 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:References:In-Reply-To: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:List-Owner; bh=aacdTIUm9z+aDEMXxw5I4m1fmc8vyLVTF4s1N3dEmd8=; b=nv/BaJ3JpwtrVlO29I+1Gbzu4 hruufZf8mLGTtPIZUr/F3GKXD9PH2g1kPAfOk2xpOdR4MWZLr5uczJDmv6kLIU4zsSleQZ9PpI6T5 00COU1VzrgqtdYAwoJ9ErqkH0Uc9afEriwsHWwLOuf+6EYmmg7ZE5MJcRvvKVwd2NKV4ZOHnDGkmV yRBRrgFTSYROgqLzv4WNAC5UUok084tSltbN10k+DVlk2o536SIU9tRx0BJaE0JbG9uZAa/GOQkEa qE1N2UxVU2txHnixH6s0bXfiWGL0nswS6tDDLpBgpIXbcGleBZwK888oBp2GU6BEOXHRpWwiulVEq yDY+VVJDw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpsXG-00007S-9C; Mon, 29 Jun 2020 12:05:18 +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 1jpsWM-00085g-Sd for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 12:04:25 +0000 Received: by mail-wr1-x444.google.com with SMTP id q5so16266745wru.6 for ; Mon, 29 Jun 2020 05:04:22 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=xq/04cXluHxdn4oi+41YOzLKGhFgJERYE/hh7Fzob8w=; b=cq42QKYmOY4CtgFfqpxPZGj+yH2jOhEq38bEjhAHoYTOXYGCicGLSutWfhQ6z5Vh2B U0lZ5r8yZIQt2X4ZPwujuxJRz9HH6HNYoSaHyPglfp3ukXWSIqwb+E+J3YLDTwrHMrCV ZIjniX4ZwfBATGFb0Wf3xeffsu5ooRohKhDhMtE0pEWJOCaADxTynAwlB1ez86wcN5nV BtfBAZI0+Xi58iZ+ptSSkUaYiYSzbz5OpsYKp5upjJ/YXYQNPaX+Oc0bLJIwJfT6s9jw 8jSxiCzyozRWdLOocNL5TtWN+mY0/AzdFPQY/sS+4mL9/9eOSmuL6t34Xy96O7G6kg0f WfXQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=xq/04cXluHxdn4oi+41YOzLKGhFgJERYE/hh7Fzob8w=; b=mgrvSeRdpzggTeD04AXd0bQRmWVsTnJioEWsiNZ5Arij6xoiOWKAW9Etx51R7rMD0T E7XYMES7t7nilCyZeI2+/E0ebM3Hvc+qyWuoOBFvzQpcsNZuvQY46J432RZoc/1EVJzt jsYh8hkclQkEMj1COrqyzUgmOWX+55iOXjfndTkKZ38VTAhXnn8qbj8281lToFZ3LarN a39OxNoZuk5iLQNLwP7FXl3J88LCk5q+ZECgF0N1rOZRMy/GR/2WFOVkz5PaFliyeWn5 X5O8m7WBeFJ9sHH1KYHGj07RvsQcTj+3tvJekHZHLlezAEhgoeqshN8FL405m6B+eEj9 qWAQ== X-Gm-Message-State: AOAM531mOqT5cNzl3SCgUQL1ByjkbaPtI4Q/mlRYuJksFULC4ET8if4y Ugu4rlhwitd5AwlFmAMJjlWwxA== X-Google-Smtp-Source: ABdhPJyrWCbmLd6m6LZkBqztyMtmYuEkSUadLFAGKZEzpCnv3LiUC60yUSxB/ZOUMh6W4+tCPoXEpA== X-Received: by 2002:a5d:65cd:: with SMTP id e13mr18265629wrw.213.1593432261778; Mon, 29 Jun 2020 05:04:21 -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.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 05:04:21 -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 07/10] net: phy: don't abuse devres in devm_mdiobus_register() Date: Mon, 29 Jun 2020 14:03:43 +0200 Message-Id: <20200629120346.4382-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200629120346.4382-1-brgl@bgdev.pl> References: <20200629120346.4382-1-brgl@bgdev.pl> 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 We currently have two managed helpers for mdiobus - devm_mdiobus_alloc() and devm_mdiobus_register(). The idea behind devres is that the release callback releases whatever resource the devm function allocates. In the mdiobus case however there's no devres associated with the device by devm_mdiobus_register(). Instead the release callback for devm_mdiobus_alloc(): _devm_mdiobus_free() unregisters the device if it is marked as managed. This all seems wrong. The managed structure shouldn't need to know or care about whether it's managed or not - and this is the case now for struct mii_bus. The devres wrapper should be opaque to the managed resource. This changeset makes devm_mdiobus_alloc() and devm_mdiobus_register() conform to common devres standards: devm_mdiobus_alloc() allocates a devres structure and registers a callback that will call mdiobus_free(). __devm_mdiobus_register() allocated another devres and registers a callback that will unregister the bus. Signed-off-by: Bartosz Golaszewski --- .../driver-api/driver-model/devres.rst | 1 - drivers/net/ethernet/realtek/r8169_main.c | 2 +- drivers/net/phy/mdio_bus.c | 73 ---------------- drivers/net/phy/mdio_devres.c | 83 +++++++++++++++++-- include/linux/phy.h | 10 +-- 5 files changed, 82 insertions(+), 87 deletions(-) diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst index 5463fc8a60c1..e0333d66a7f4 100644 --- a/Documentation/driver-api/driver-model/devres.rst +++ b/Documentation/driver-api/driver-model/devres.rst @@ -342,7 +342,6 @@ LED MDIO devm_mdiobus_alloc() devm_mdiobus_alloc_size() - devm_mdiobus_free() devm_mdiobus_register() MEM diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index b660ddbe4025..bfb68a1b1958 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -5103,7 +5103,7 @@ static int r8169_mdio_register(struct rtl8169_private *tp) new_bus->read = r8169_mdio_read_reg; new_bus->write = r8169_mdio_write_reg; - ret = devm_mdiobus_register(new_bus); + ret = devm_mdiobus_register(&pdev->dev, new_bus); if (ret) return ret; diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 6ceee82b2839..42192991f55d 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -165,79 +165,6 @@ struct mii_bus *mdiobus_alloc_size(size_t size) } EXPORT_SYMBOL(mdiobus_alloc_size); -static void _devm_mdiobus_free(struct device *dev, void *res) -{ - struct mii_bus *bus = *(struct mii_bus **)res; - - if (bus->is_managed_registered && bus->state == MDIOBUS_REGISTERED) - mdiobus_unregister(bus); - - mdiobus_free(bus); -} - -static int devm_mdiobus_match(struct device *dev, void *res, void *data) -{ - struct mii_bus **r = res; - - if (WARN_ON(!r || !*r)) - return 0; - - return *r == data; -} - -/** - * devm_mdiobus_alloc_size - Resource-managed mdiobus_alloc_size() - * @dev: Device to allocate mii_bus for - * @sizeof_priv: Space to allocate for private structure. - * - * Managed mdiobus_alloc_size. mii_bus allocated with this function is - * automatically freed on driver detach. - * - * If an mii_bus allocated with this function needs to be freed separately, - * devm_mdiobus_free() must be used. - * - * RETURNS: - * Pointer to allocated mii_bus on success, NULL on failure. - */ -struct mii_bus *devm_mdiobus_alloc_size(struct device *dev, int sizeof_priv) -{ - struct mii_bus **ptr, *bus; - - ptr = devres_alloc(_devm_mdiobus_free, sizeof(*ptr), GFP_KERNEL); - if (!ptr) - return NULL; - - /* use raw alloc_dr for kmalloc caller tracing */ - bus = mdiobus_alloc_size(sizeof_priv); - if (bus) { - *ptr = bus; - devres_add(dev, ptr); - bus->is_managed = 1; - } else { - devres_free(ptr); - } - - return bus; -} -EXPORT_SYMBOL_GPL(devm_mdiobus_alloc_size); - -/** - * devm_mdiobus_free - Resource-managed mdiobus_free() - * @dev: Device this mii_bus belongs to - * @bus: the mii_bus associated with the device - * - * Free mii_bus allocated with devm_mdiobus_alloc_size(). - */ -void devm_mdiobus_free(struct device *dev, struct mii_bus *bus) -{ - int rc; - - rc = devres_release(dev, _devm_mdiobus_free, - devm_mdiobus_match, bus); - WARN_ON(rc); -} -EXPORT_SYMBOL_GPL(devm_mdiobus_free); - /** * mdiobus_release - mii_bus device release callback * @d: the target struct device that contains the mii_bus diff --git a/drivers/net/phy/mdio_devres.c b/drivers/net/phy/mdio_devres.c index 3ee887733d4a..0b9bd9a61378 100644 --- a/drivers/net/phy/mdio_devres.c +++ b/drivers/net/phy/mdio_devres.c @@ -1,25 +1,96 @@ // SPDX-License-Identifier: GPL-2.0-or-later +#include #include +#include + +struct mdiobus_devres { + struct mii_bus *mii; +}; + +static void devm_mdiobus_free(struct device *dev, void *this) +{ + struct mdiobus_devres *dr = this; + + mdiobus_free(dr->mii); +} + +/** + * devm_mdiobus_alloc_size - Resource-managed mdiobus_alloc_size() + * @dev: Device to allocate mii_bus for + * @sizeof_priv: Space to allocate for private structure + * + * Managed mdiobus_alloc_size. mii_bus allocated with this function is + * automatically freed on driver detach. + * + * RETURNS: + * Pointer to allocated mii_bus on success, NULL on out-of-memory error. + */ +struct mii_bus *devm_mdiobus_alloc_size(struct device *dev, int sizeof_priv) +{ + struct mdiobus_devres *dr; + + dr = devres_alloc(devm_mdiobus_free, sizeof(*dr), GFP_KERNEL); + if (!dr) + return NULL; + + dr->mii = mdiobus_alloc_size(sizeof_priv); + if (!dr->mii) { + devres_free(dr); + return NULL; + } + + devres_add(dev, dr); + return dr->mii; +} +EXPORT_SYMBOL(devm_mdiobus_alloc_size); + +static void devm_mdiobus_unregister(struct device *dev, void *this) +{ + struct mdiobus_devres *dr = this; + + mdiobus_unregister(dr->mii); +} + +static int mdiobus_devres_match(struct device *dev, + void *this, void *match_data) +{ + struct mdiobus_devres *res = this; + struct mii_bus *mii = match_data; + + return mii == res->mii; +} /** * __devm_mdiobus_register - Resource-managed variant of mdiobus_register() + * @dev: Device to register mii_bus for * @bus: MII bus structure to register * @owner: Owning module * * Returns 0 on success, negative error number on failure. */ -int __devm_mdiobus_register(struct mii_bus *bus, struct module *owner) +int __devm_mdiobus_register(struct device *dev, struct mii_bus *bus, + struct module *owner) { + struct mdiobus_devres *dr; int ret; - if (!bus->is_managed) - return -EPERM; + if (WARN_ON(!devres_find(dev, devm_mdiobus_free, + mdiobus_devres_match, bus))) + return -EINVAL; + + dr = devres_alloc(devm_mdiobus_unregister, sizeof(*dr), GFP_KERNEL); + if (!dr) + return -ENOMEM; ret = __mdiobus_register(bus, owner); - if (!ret) - bus->is_managed_registered = 1; + if (ret) { + devres_free(dr); + return ret; + } - return ret; + dr->mii = bus; + devres_add(dev, dr); + return 0; } EXPORT_SYMBOL(__devm_mdiobus_register); diff --git a/include/linux/phy.h b/include/linux/phy.h index 4935867f024b..3695e9d6b3f6 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -260,9 +260,6 @@ struct mii_bus { int (*reset)(struct mii_bus *bus); struct mdio_bus_stats stats[PHY_MAX_ADDR]; - unsigned int is_managed:1; /* is device-managed */ - unsigned int is_managed_registered:1; - /* * A lock to ensure that only one thing can read/write * the MDIO bus at a time @@ -313,9 +310,11 @@ static inline struct mii_bus *mdiobus_alloc(void) } int __mdiobus_register(struct mii_bus *bus, struct module *owner); -int __devm_mdiobus_register(struct mii_bus *bus, struct module *owner); +int __devm_mdiobus_register(struct device *dev, struct mii_bus *bus, + struct module *owner); #define mdiobus_register(bus) __mdiobus_register(bus, THIS_MODULE) -#define devm_mdiobus_register(bus) __devm_mdiobus_register(bus, THIS_MODULE) +#define devm_mdiobus_register(dev, bus) \ + __devm_mdiobus_register(dev, bus, THIS_MODULE) void mdiobus_unregister(struct mii_bus *bus); void mdiobus_free(struct mii_bus *bus); @@ -326,7 +325,6 @@ static inline struct mii_bus *devm_mdiobus_alloc(struct device *dev) } struct mii_bus *mdio_find_bus(const char *mdio_name); -void devm_mdiobus_free(struct device *dev, struct mii_bus *bus); struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); #define PHY_INTERRUPT_DISABLED false From patchwork Mon Jun 29 12:03:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11630827 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 B19BB6C1 for ; Mon, 29 Jun 2020 12:07: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 8355A23B06 for ; Mon, 29 Jun 2020 12:07: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="ZyVOneqb"; 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="Lju5246x" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8355A23B06 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:References:In-Reply-To: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:List-Owner; bh=6H6dpWWlj2YXnKL5pneO21loW+mgdAY4tIo4M167mBU=; b=ZyVOneqbcqky1CH+bR2sTGQH1 e5zAMS4FIWRjIX8wVh6/8rmK6Mom9HVZ9lNMogioTTee93tHzORpj3lSzYp0DuvCRiGY99z85tGMd 1HDk165CgYaKFESOVz5VGZ+8ffzdMAJ81/W/lRx9XiuJ9bUHJgdOXAPZXbY5jiF44QupIabzHNvL4 vmyz/46owNtKGZE/fut7llzMg7jUBWoUEqMFPsDRA6KN18+UsMR35O2Ll32xV+KOCaeEIhGqry7Cf K8ddsxUXe+zI8oL0s/e8AUpYDQyaW8Kcmh0ephckdUoWts0StJVbdYxihe2awMwss/nuuKLhStImf 45Pk5tQKw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpsXK-0000AV-RQ; Mon, 29 Jun 2020 12:05:22 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpsWO-00086J-TH for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 12:04:28 +0000 Received: by mail-wm1-x343.google.com with SMTP id a6so13599369wmm.0 for ; Mon, 29 Jun 2020 05:04:24 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=eg4utbhrf/3v6wZhuPotuFpmqRh7IC4ZAOzFVoP+DSU=; b=Lju5246xETI3n7x5ApaA2zIYYyPdv7uL89+PkXu5UmfdDnoJt/A+1kV4EnWbvWHsfT U0KiDkQo2C6/d8Ee7wMfJSSmn58uoqIdNiTjX8Hz5nTHyctnp2RJTz/wtYYsoJ+dtuhV XjmJm2KbsyS/VgCkUtqgfIB2Q8m9h6+TRtPh688uJ2bkMEAzy6TyrNqZ5+p0Jq6QQPRe TpitUFUM90jHaT+neQCa+q1jY5kpWoCkFluHE4al/HsV1lisaXYbrRjufnYUNHF7JcYD MtPNLz8KCHYZnMSa1RhX8WtsifRsmdGJ5BQYv8xh4yMTTQv22xrYgZ/0nqbMjj7pN0qH WHeg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=eg4utbhrf/3v6wZhuPotuFpmqRh7IC4ZAOzFVoP+DSU=; b=ENlFuZernXNNDwNjEVABulk5lWe8tLpoNgzJFeWEP47PHjUqWF2n+Yeo2B3vWMYfAt 4pECvWMhhdNAsw06CwLRJJhWs/NuvFoweXPNA5QsU/jQy1XTMWN8a2BAzvh/6/ae3BKi u00mzAftUnnOh8WqCnuh45+rvIxu0AwGTTedJXP0P6DTg89C1PzDXfrpcuIK5c2ac+a1 l4epGnoxbg1jy0FbY7Ea5cYBa4lTHH8ZjM3JD7Aut55LZUrquZEScBWL6PLbK+AlU7wT IlIenW8dde1EMWlb7enLbxSBviOWYrV5fVLK9ns4mIil+1vDEVunSQLtHP4a5KzUTWsN khng== X-Gm-Message-State: AOAM531Iq5ix+q0bG+ZDvwOhSEhOvUO4G7Mxdf8Hw5gRwxDDpRSmOY+H 05i0aAr3b/HE0cpmEY29ilK9Sg== X-Google-Smtp-Source: ABdhPJyyXNydd+nOMTGEVlBmI0TP9I7QgzsG5vIU8vPWhBARI6Y2TnNfIwesmyvIGRb47dVl+VGcrA== X-Received: by 2002:a7b:c3d0:: with SMTP id t16mr17776997wmj.117.1593432263901; Mon, 29 Jun 2020 05:04:23 -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.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 05:04:23 -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 08/10] of: mdio: remove the 'extern' keyword from function declarations Date: Mon, 29 Jun 2020 14:03:44 +0200 Message-Id: <20200629120346.4382-9-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200629120346.4382-1-brgl@bgdev.pl> References: <20200629120346.4382-1-brgl@bgdev.pl> 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:343 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 The 'extern' keyword in headers doesn't have any benefit. Remove them all from the of_mdio.h header. Signed-off-by: Bartosz Golaszewski Reviewed-by: Florian Fainelli --- include/linux/of_mdio.h | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h index 0f61a4ac6bcf..ba8e157f24ad 100644 --- a/include/linux/of_mdio.h +++ b/include/linux/of_mdio.h @@ -12,27 +12,26 @@ #include #if IS_ENABLED(CONFIG_OF_MDIO) -extern bool of_mdiobus_child_is_phy(struct device_node *child); -extern int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np); -extern struct phy_device *of_phy_find_device(struct device_node *phy_np); -extern struct phy_device *of_phy_connect(struct net_device *dev, - struct device_node *phy_np, - void (*hndlr)(struct net_device *), - u32 flags, phy_interface_t iface); -extern struct phy_device * +bool of_mdiobus_child_is_phy(struct device_node *child); +int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np); +struct phy_device *of_phy_find_device(struct device_node *phy_np); +struct phy_device * +of_phy_connect(struct net_device *dev, struct device_node *phy_np, + void (*hndlr)(struct net_device *), u32 flags, + phy_interface_t iface); +struct phy_device * of_phy_get_and_connect(struct net_device *dev, struct device_node *np, void (*hndlr)(struct net_device *)); -struct phy_device *of_phy_attach(struct net_device *dev, - struct device_node *phy_np, u32 flags, - phy_interface_t iface); - -extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np); -extern int of_phy_register_fixed_link(struct device_node *np); -extern void of_phy_deregister_fixed_link(struct device_node *np); -extern bool of_phy_is_fixed_link(struct device_node *np); -extern int of_mdiobus_phy_device_register(struct mii_bus *mdio, - struct phy_device *phy, - struct device_node *child, u32 addr); +struct phy_device * +of_phy_attach(struct net_device *dev, struct device_node *phy_np, + u32 flags, phy_interface_t iface); + +struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np); +int of_phy_register_fixed_link(struct device_node *np); +void of_phy_deregister_fixed_link(struct device_node *np); +bool of_phy_is_fixed_link(struct device_node *np); +int of_mdiobus_phy_device_register(struct mii_bus *mdio, struct phy_device *phy, + struct device_node *child, u32 addr); static inline int of_mdio_parse_addr(struct device *dev, const struct device_node *np) From patchwork Mon Jun 29 12:03:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11630823 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 7DA4E913 for ; Mon, 29 Jun 2020 12:06:54 +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 540F623B23 for ; Mon, 29 Jun 2020 12:06:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="C049jdL2"; 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="OjFhA1dn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 540F623B23 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:References:In-Reply-To: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:List-Owner; bh=nLTnsZFLdM6G5OsvNA1/fqspzwYYG1hTFSLcq2ol644=; b=C049jdL2O+AbYbOeUCvWJh0w6 VGYFVNTB0AUdVxKfEzUYAWBMeSb/GCrNeErIv0WxuYARypt1IfLry4o9ZOdThaKnSSxRaIfCtnQam wypzEnB9oGsWyVCilA60bct18r3ry7lzR11VAPErbL6V9XJV+FBLaJzpoHL481lvbU7ZaUb4edf5l lTgxJu84/SUR0HNbB7zHPWQ4XGZ7cUIS7L5ZH5m0gV7J9jRr4busJZfXJlyCTvEpdRzbx/CXjSjp2 aW5kcJv/UZjptHG6ongLgD2nWt9+WnvCN+/P4/Z3NbwgPrJ7k0VKz0XxbAs/5kAABEzTXM5YLTTXI mNkXpl/kw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpsXO-0000DN-Ke; Mon, 29 Jun 2020 12:05:26 +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 1jpsWQ-00086c-7t for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 12:04:29 +0000 Received: by mail-wr1-x443.google.com with SMTP id g18so16312385wrm.2 for ; Mon, 29 Jun 2020 05:04:26 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=eVmQOBvXDEaCTQLZaTTLEM9yQEsfq0hXc2Ftz5NNRNk=; b=OjFhA1dnSrFI1gIICDBzM2SLLegg0XEeK2w3+ih4lI+BQ9GqcJIYdUku4UBlwpSaRZ oWeFaIwiKUGZrfqHnMCp9dhJCf92zn+eTig0GGSBlC3KsWknJDmoO6tgZILVJZUcl+yC QmWi46Gfv5bIDFKLrFhkdsZRMQrJ6P6qJpFqKDDhSzEAk71TG51e5m7PqmRxSF0IaqCc lK9LD+XqZqQRHrKSXKSdHC/hs9aTw8jxruL4o0utD0y5ZWsfoLkJ7uHtuUFgXQu8el/Z IZFO4cHhlix+pszDjPZAgsLlvEXWJMjb1djS9n8VbDBxifgDwWlHj5nio1tnagKzkQpq nW+A== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=eVmQOBvXDEaCTQLZaTTLEM9yQEsfq0hXc2Ftz5NNRNk=; b=iBDbfdyZyRSXmh/iFKoVEo0d2BXthAejume2sGGfJJ0g65UUor4aFUA1Nl7zr3VCZ3 CP3o050XswE03se19ppSzhwOZ8DR/vKj3zzQA7dR4Zpxl7zJd7q+FZj968hqJCa/zqvm l4j400QCR/mrtNPCyfm5ZX0Hao07metcltKrubd2Hkg84qj3pzm/jnsQt/+fKHAO/eDs c3izvgHpd892lygK0TJYlPBwM82pbpwDL2XBXs3BkdgftPM6MyH0UdHGSgNJVYOgfHmN WjptPIPy5qsYev37IO43+8e2TEVwDLvn8m0AJongen5bmrm0NsKg0Ba1lPlrKcv/JMuV zpZQ== X-Gm-Message-State: AOAM530v+T+2gyNX51w/FKHNIg6VcT7EzEat3mj3lwhAqXVfTC/enpxm kXi40EI36yd2IOSRHp7zdRIhmw== X-Google-Smtp-Source: ABdhPJygWkINqtaUiia5EDfNIDWDJjLM7/a2wl0W+j+uTircW3QIDYx940S5jXAlZA8pQbi4TXQ8rw== X-Received: by 2002:adf:84e2:: with SMTP id 89mr17420797wrg.139.1593432265315; Mon, 29 Jun 2020 05:04:25 -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.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 05:04:24 -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 09/10] of: mdio: provide devm_of_mdiobus_register() Date: Mon, 29 Jun 2020 14:03:45 +0200 Message-Id: <20200629120346.4382-10-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200629120346.4382-1-brgl@bgdev.pl> References: <20200629120346.4382-1-brgl@bgdev.pl> 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-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 Implement a managed variant of of_mdiobus_register(). We need to make mdio_devres into its own module because otherwise we'd hit circular sumbol dependencies between phylib and of_mdio. Signed-off-by: Bartosz Golaszewski --- .../driver-api/driver-model/devres.rst | 1 + drivers/net/phy/Makefile | 4 +- drivers/net/phy/mdio_devres.c | 37 +++++++++++++++++++ include/linux/of_mdio.h | 3 ++ 4 files changed, 44 insertions(+), 1 deletion(-) diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst index e0333d66a7f4..eaaaafc21134 100644 --- a/Documentation/driver-api/driver-model/devres.rst +++ b/Documentation/driver-api/driver-model/devres.rst @@ -343,6 +343,7 @@ MDIO devm_mdiobus_alloc() devm_mdiobus_alloc_size() devm_mdiobus_register() + devm_of_mdiobus_register() MEM devm_free_pages() diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile index 896afdcac437..c9a9adf194d5 100644 --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile @@ -3,7 +3,8 @@ libphy-y := phy.o phy-c45.o phy-core.o phy_device.o \ linkmode.o -mdio-bus-y += mdio_bus.o mdio_device.o mdio_devres.o +mdio-bus-y += mdio_bus.o mdio_device.o +mdio-devres-y += mdio_devres.o ifdef CONFIG_MDIO_DEVICE obj-y += mdio-boardinfo.o @@ -17,6 +18,7 @@ libphy-y += $(mdio-bus-y) else obj-$(CONFIG_MDIO_DEVICE) += mdio-bus.o endif +obj-$(CONFIG_MDIO_DEVICE) += mdio-devres.o libphy-$(CONFIG_SWPHY) += swphy.o libphy-$(CONFIG_LED_TRIGGER_PHY) += phy_led_triggers.o diff --git a/drivers/net/phy/mdio_devres.c b/drivers/net/phy/mdio_devres.c index 0b9bd9a61378..b560e99695df 100644 --- a/drivers/net/phy/mdio_devres.c +++ b/drivers/net/phy/mdio_devres.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include +#include #include #include @@ -94,3 +95,39 @@ int __devm_mdiobus_register(struct device *dev, struct mii_bus *bus, return 0; } EXPORT_SYMBOL(__devm_mdiobus_register); + +#if IS_ENABLED(CONFIG_OF_MDIO) +/** + * devm_of_mdiobus_register - Resource managed variant of of_mdiobus_register() + * @dev: Device to register mii_bus for + * @mdio: MII bus structure to register + * @np: Device node to parse + */ +int devm_of_mdiobus_register(struct device *dev, struct mii_bus *mdio, + struct device_node *np) +{ + struct mdiobus_devres *dr; + int ret; + + if (WARN_ON(!devres_find(dev, devm_mdiobus_free, + mdiobus_devres_match, mdio))) + return -EINVAL; + + dr = devres_alloc(devm_mdiobus_unregister, sizeof(*dr), GFP_KERNEL); + if (!dr) + return -ENOMEM; + + ret = of_mdiobus_register(mdio, np); + if (ret) { + devres_free(dr); + return ret; + } + + dr->mii = mdio; + devres_add(dev, dr); + return 0; +} +EXPORT_SYMBOL(devm_of_mdiobus_register); +#endif /* CONFIG_OF_MDIO */ + +MODULE_LICENSE("GPL"); diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h index ba8e157f24ad..1efb88d9f892 100644 --- a/include/linux/of_mdio.h +++ b/include/linux/of_mdio.h @@ -8,12 +8,15 @@ #ifndef __LINUX_OF_MDIO_H #define __LINUX_OF_MDIO_H +#include #include #include #if IS_ENABLED(CONFIG_OF_MDIO) bool of_mdiobus_child_is_phy(struct device_node *child); int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np); +int devm_of_mdiobus_register(struct device *dev, struct mii_bus *mdio, + struct device_node *np); struct phy_device *of_phy_find_device(struct device_node *phy_np); struct phy_device * of_phy_connect(struct net_device *dev, struct device_node *phy_np, From patchwork Mon Jun 29 12:03:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11630829 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 DCA6A6C1 for ; Mon, 29 Jun 2020 12:07:13 +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 B672323B06 for ; Mon, 29 Jun 2020 12:07:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="P8yXsJ2R"; 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="of984BLP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B672323B06 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:References:In-Reply-To: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:List-Owner; bh=HIsXActE9yugJ9V0n1bhzUviTq2C3hbMcvl9efqfsao=; b=P8yXsJ2RgxvG5u59N3nWivnIK a3gIihPVBrxwdbUrrigjuNuNb/ZbKy178S3hnzIHBWk4apooFgHkcRi7ju35N4nLjW1axGNBPAAxI +zvOX2zxlc9RGOY6aSw1NfoCH6BGO351DZpNyqM0usLvE1jT5n97BO1nViWK4s8U8DaSfVI/0tDzg CByjDpPxwWmCDxlqQNKtVS17MptAOqHz1RtyVLkoeiy7OHPeWgzlay6dFof3fqQ4xuhal4zAdqG5y 13uxWcza1fVcD2FPgWCG7dwnjBamKYCriStKPjVt6brPlZbnSUdxs3/cV69YUAY65neAILSeS7ZuP jIxMtkdwQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpsXa-0000RA-LY; Mon, 29 Jun 2020 12:05:38 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpsWR-00086z-MQ for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 12:04:30 +0000 Received: by mail-wm1-x344.google.com with SMTP id f139so15848373wmf.5 for ; Mon, 29 Jun 2020 05:04:27 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=7pEL+pOqyLTkwaRij99JSBZiVqVmOtzJ61ge9c76alE=; b=of984BLPzSM5P+WwmyOWqcZJYwV98nXnukmPddORm7s4hFfzesBN6/ddh4U2m/PDU6 U7zyrLEGeItTXvJtQUt1dUuvsThE3lZ38dqMBT9cWCEKwkxHUamDCpBpGaedCu0yU3JA OMEKDESF6Z+Dg/P4fdW8bjKYdSptxx+16ZaDAHFgGzM2CCXueszbTt7/jsNP4k3G4wfW vhCj/O7zg5dmmRIAaJf3wX6GBBN246Lt1CVVgmSh81ZDHsWzVOmLRAYU13dZqTFhE5mJ cUBwbbK/x0XCTDLHW+rUB89GdvYigHL50OJ07XC/TkMc5hT7UvPM8MrNf0tkQ8gdtoxp nQpQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=7pEL+pOqyLTkwaRij99JSBZiVqVmOtzJ61ge9c76alE=; b=CemG/ZIXZ93GSa3nX7uix2DwTWKAmQx5XBtCgiNblWOAbinj2dnoGyCrNJcXC0k9bH u4lbdw5xoCs5hqBI/0YUVmzoOxuMQrSkpysw+nq//yV15PXoq9xm3WFYxJf56qGb571x 18knSjazS4b9puEhVlG+QsC2yFW8wEunQj6OmaTj6p1XjxgOkZzvyhDMxp3gcKKbFEPT d0DK6+E7l9XcKQVt6p9pah/Y+n+z4xsQ/Y8uURacrSmDaf8hdAzvL22Wx+dnGCtmY8lc VIdm7CpW/VX0xJMvJ7adkcMnYQBNXFGWYE4DA+P0skzoWG8jqOjHYDsSX8LcR/N3+Me3 4L8Q== X-Gm-Message-State: AOAM530Bms6LZzVcCdWn9hOOHe18cD+muKvdRsSp8+21PK2HV8B9dVHp GwPvXip0mxBYRzHt8gTd6jIcIQ== X-Google-Smtp-Source: ABdhPJyd6qa9V9UAIGrinBuxZn8Q8saD0KJTED9NchL3vgnTrBQeXGhAZm//V44PtKtSgMKYvFb6Dg== X-Received: by 2002:a1c:a70d:: with SMTP id q13mr13901671wme.55.1593432266701; Mon, 29 Jun 2020 05:04:26 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 05:04:26 -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 10/10] net: ethernet: mtk-star-emac: use devm_of_mdiobus_register() Date: Mon, 29 Jun 2020 14:03:46 +0200 Message-Id: <20200629120346.4382-11-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200629120346.4382-1-brgl@bgdev.pl> References: <20200629120346.4382-1-brgl@bgdev.pl> 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:344 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 Shrink the code by using the managed variant of of_mdiobus_register(). Signed-off-by: Bartosz Golaszewski --- drivers/net/ethernet/mediatek/mtk_star_emac.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_star_emac.c b/drivers/net/ethernet/mediatek/mtk_star_emac.c index 3e765bdcf9e1..13250553263b 100644 --- a/drivers/net/ethernet/mediatek/mtk_star_emac.c +++ b/drivers/net/ethernet/mediatek/mtk_star_emac.c @@ -1389,7 +1389,7 @@ static int mtk_star_mdio_init(struct net_device *ndev) priv->mii->write = mtk_star_mdio_write; priv->mii->priv = priv; - ret = of_mdiobus_register(priv->mii, mdio_node); + ret = devm_of_mdiobus_register(dev, priv->mii, mdio_node); out_put_node: of_node_put(mdio_node); @@ -1441,13 +1441,6 @@ static void mtk_star_clk_disable_unprepare(void *data) clk_bulk_disable_unprepare(MTK_STAR_NCLKS, priv->clks); } -static void mtk_star_mdiobus_unregister(void *data) -{ - struct mtk_star_priv *priv = data; - - mdiobus_unregister(priv->mii); -} - static int mtk_star_probe(struct platform_device *pdev) { struct device_node *of_node; @@ -1549,10 +1542,6 @@ static int mtk_star_probe(struct platform_device *pdev) if (ret) return ret; - ret = devm_add_action_or_reset(dev, mtk_star_mdiobus_unregister, priv); - if (ret) - return ret; - ret = eth_platform_get_mac_address(dev, ndev->dev_addr); if (ret || !is_valid_ether_addr(ndev->dev_addr)) eth_hw_addr_random(ndev);