From patchwork Fri Jul 24 10:50:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Codrin Ciubotariu X-Patchwork-Id: 11682961 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 BA8C8618 for ; Fri, 24 Jul 2020 10:52:46 +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 8FBFF2074F for ; Fri, 24 Jul 2020 10:52:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="xmtqREMw"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="1kwPkQUC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8FBFF2074F 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=LIdobQpI6XDB52FacrwFc2WxLoheJc1RoA1jpttyXyI=; b=xmtqREMwBLhANlYJG34il3/RJ 1SQ1Yutpe6c6YIWv0HtzLm928DT+lR5MBZ8Og8AFKqNfQYYIdtQolSkyrq+cKxdBXIJHvrRf9/DQ/ wCyvY874JuVwQ75jojprgfPK6/DURKJSe/851+Q6VMfIct4xpAvv+m0Yy8ulOFP8huByKPz60F+LQ M0dVJmCY2uuZpVMMneVu+a9lMntR2CP3T6ZAYuQOuP+fEfOPScUSxdWMmhHUitqD37mGX8MkD+2kW y0aKUiRMEIMNqlh/hlQeBvnA8F5HonAcwYgdTHtNqI6jx+3bC77oQ3Il1+LQTGjdA7BleHQ1aK7Se YAEENWosw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyvHx-00037A-BR; Fri, 24 Jul 2020 10:50:53 +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 1jyvHr-00034z-N5 for linux-arm-kernel@lists.infradead.org; Fri, 24 Jul 2020 10:50:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1595587847; x=1627123847; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=faYv4zDljy8BCwm/ZtE+efuxM/WTnpKbumDhZlQt/gw=; b=1kwPkQUCNdVmJbuFDLQuNMOTo9Wr8orqrlRYlzkM7Ex9v7Qm/rXvV1mU TUd0/xB/3ux6fEqEM9iXVvktw7KBtXFWh5YOprnFrPKMKJ09TsyragCW1 rrev3f3hJ8Sf8Ame+0Sgf4L2cFcT9qyIAb7gw7Q6J18eG7u3CSU6U9vhd Gg3A7n2WqecRX4VJflf4gMWvQ7YYvuxU8sn1h2WZhNSE5I8aV7J65VYO+ zMvAQgP+//pSlpyFo9/mKx+ATbsZ9fjx+/9PGn0ug+zQsiYuECFYYIi/N CNsPi7hfSSA3r+e+s7hckJft11HVJIoUtsynvA0xaUACACFnHva3Mfofl Q==; IronPort-SDR: IpvGd94rCdYvtCoStj5E3VEe1Dt1eU36W7Whi3G8pPBogN5/kCBxKQmoOcj2diT0hKrLs5ccOG 7qzYOfoGcU5aEby70aDy1hyLyTCsoSdwCePIadwO6lsXueRntU8KULrqFHepT4LSJMytQzV3Rw 2JgdJMkdiGZ+4r+EAgz5TsRo3eJv/8g5Cvmi1HPgTUbl92ltd2T7PjjAXxDva1AtLCwzA2EdF2 BDkyLONWbP4wcKeN9VRRv0uVsCkap2By32/pbs2EMW0PIqdUDRFFdXdFOJ+J2aOa8CfQeot7tm CP0= X-IronPort-AV: E=Sophos;i="5.75,390,1589266800"; d="scan'208";a="83152915" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 24 Jul 2020 03:50:44 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 24 Jul 2020 03:50:01 -0700 Received: from rob-ult-m19940.microchip.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Fri, 24 Jul 2020 03:50:00 -0700 From: Codrin Ciubotariu To: , , , Subject: [PATCH net-next v3 1/7] net: macb: use device-managed devm_mdiobus_alloc() Date: Fri, 24 Jul 2020 13:50:27 +0300 Message-ID: <20200724105033.2124881-2-codrin.ciubotariu@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200724105033.2124881-1-codrin.ciubotariu@microchip.com> References: <20200724105033.2124881-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-20200724_065047_924434_8BD8EE53 X-CRM114-Status: GOOD ( 10.13 ) 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_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 Message has at least one valid DKIM or DK signature -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 Tested-by: Claudiu Beznea Acked-by: Claudiu Beznea Reviewed-by: Florian Fainelli --- Changes in v3: - added tags from Claudiu and Florian 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);