From patchwork Tue Jul 21 17:13:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Codrin Ciubotariu X-Patchwork-Id: 11676313 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 301876C1 for ; Tue, 21 Jul 2020 17:17:36 +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 079EF2065D for ; Tue, 21 Jul 2020 17:17:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Mj723TzK"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="Z/+l6Gxi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 079EF2065D Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com 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=tFC0aoX1MTucEXyUvk1pcfYfRkIp+6PoWsQP0pJDlK0=; b=Mj723TzKfeX2vfe0uGrLRKKh0 bxrD9+gsFYKnk3lmNxgv2cz0W2DvrcjsIwXWIm7KGDFnnoqVtHtvlAnGFv/a9p5IrxTFW6A1kkHbd IXss50OUd/5bx0gmmwaPo/wIPJqEN9TuG3yrdU/hEXV67YAcCnilUkjEY8v89SE7DQxwTcKpX8Pi9 +YRLQeyyxfs6t3be6XXPYj85o26SmBVlHfONCLCbq0xRCduq/C2TM36HB3TZmpgpAQWM2UD4nwL40 FoxN/iZddBDsTJR/1sMlZXIqL+uh6lJ0p4Fj7pjX158/CHVccPhkpz18pz8alxgXXzQDMtqjuiP2P mdHJubrRg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxvs5-0000x6-BU; Tue, 21 Jul 2020 17:16:05 +0000 Received: from esa2.microchip.iphmx.com ([68.232.149.84]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxvs1-0000uu-5p for linux-arm-kernel@lists.infradead.org; Tue, 21 Jul 2020 17:16:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1595351761; x=1626887761; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BmtTMrdJrMBJ7rJs0O3LHTqKK1doUSizTNZocewKz/0=; b=Z/+l6GxilYkTb7QK/xdpRfjLshoI0YLkMGwlngADg1fhJ9GAS+Gic76I J0B5RYe99GWb3pXWa/Ro4G3dXTT6yufyM8PaVN2s/UhQo0ltIOAnTC65b GEKA/iryMqM41mzmhZzvWV7mgakLhMTJCnax7Uie3+ng/1fP/BEfnyIUa 1/MdTHyS3jJaLLxpw5VC5ovbf2CXEUjrk+ihG/ssvnebn8VGIuDSNphyp +qkSCsORFP+hb1hW9FMQBmWq4oUO7+E9nE37L3H6MlWU1x2beGSgdKB/3 yYPcWu0n7PAcyL9b78RERPamPdfJUiRYtxl8j8g7xWKgo/oOnuwFj64ZZ Q==; IronPort-SDR: LFD9FC8EuYhl6wV/Nqy7EMNDW9oQVfogIP+/eFZci4pAP2V/+Wj5t5I/21ywaTgAxh0PQtJw/X z0xPI4NbJtSjOo79ABi57oylBELBfTngziJpKRhuhOSvut+jfBPe6vTOt3KBgFg9rJ1QxxtSsv 6oklAUXyH7Dz/NrWJ81xTu8lt3vzLAlg3j5nKPcRP2JZLzu6jK1Psn7lzmrxsJkj3eZ4T3eV7n 3VRDYV+l9mBAHCZl4zeNCa7x8DOusbOlDNi67g3+nTo81akRTuTKyYHsVED/L+KH57TpfBTVQI khE= X-IronPort-AV: E=Sophos;i="5.75,379,1589266800"; d="scan'208";a="82696840" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 21 Jul 2020 10:15:59 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Tue, 21 Jul 2020 10:15:59 -0700 Received: from rob-ult-m19940.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Tue, 21 Jul 2020 10:14:02 -0700 From: Codrin Ciubotariu To: , , , Subject: [PATCH net-next v2 1/7] net: macb: use device-managed devm_mdiobus_alloc() Date: Tue, 21 Jul 2020 20:13:10 +0300 Message-ID: <20200721171316.1427582-2-codrin.ciubotariu@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200721171316.1427582-1-codrin.ciubotariu@microchip.com> References: <20200721171316.1427582-1-codrin.ciubotariu@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200721_131601_392519_6D10FFD0 X-CRM114-Status: UNSURE ( 9.69 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.149.84 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [68.232.149.84 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 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: andrew@lunn.ch, alexandre.belloni@bootlin.com, f.fainelli@gmail.com, claudiu.beznea@microchip.com, ludovic.desroches@microchip.com, robh+dt@kernel.org, kuba@kernel.org, Codrin Ciubotariu , davem@davemloft.net Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Use the device-managed variant for the allocating the MDIO bus. This cleans-up the code a little on the remove and error paths. Signed-off-by: Codrin Ciubotariu Reviewed-by: Florian Fainelli --- Changes in v2: - none drivers/net/ethernet/cadence/macb_main.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index a6a35e1b0115..89fe7af5e408 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -769,7 +769,7 @@ static int macb_mii_init(struct macb *bp) /* Enable management port */ macb_writel(bp, NCR, MACB_BIT(MPE)); - bp->mii_bus = mdiobus_alloc(); + bp->mii_bus = devm_mdiobus_alloc(&bp->pdev->dev); if (!bp->mii_bus) { err = -ENOMEM; goto err_out; @@ -787,7 +787,7 @@ static int macb_mii_init(struct macb *bp) err = macb_mdiobus_register(bp); if (err) - goto err_out_free_mdiobus; + goto err_out; err = macb_mii_probe(bp->dev); if (err) @@ -797,8 +797,6 @@ static int macb_mii_init(struct macb *bp) err_out_unregister_bus: mdiobus_unregister(bp->mii_bus); -err_out_free_mdiobus: - mdiobus_free(bp->mii_bus); err_out: return err; } @@ -4571,7 +4569,6 @@ static int macb_probe(struct platform_device *pdev) err_out_unregister_mdio: mdiobus_unregister(bp->mii_bus); - mdiobus_free(bp->mii_bus); err_out_free_netdev: free_netdev(dev); @@ -4599,7 +4596,6 @@ static int macb_remove(struct platform_device *pdev) if (dev) { bp = netdev_priv(dev); mdiobus_unregister(bp->mii_bus); - mdiobus_free(bp->mii_bus); unregister_netdev(dev); tasklet_kill(&bp->hresp_err_tasklet);