From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7B54C433DF for ; Wed, 17 Jun 2020 17:49:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A114321532 for ; Wed, 17 Jun 2020 17:49:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="WGvek6gZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726851AbgFQRth (ORCPT ); Wed, 17 Jun 2020 13:49:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726496AbgFQRtf (ORCPT ); Wed, 17 Jun 2020 13:49:35 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47A44C06174E for ; Wed, 17 Jun 2020 10:49:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=xL3Ri7/fnlQ6mXSPI64TxQd77LmoQkjXMFiO++jtms8=; b=WGvek6gZLlDRG8WODAvnXJ/gj vejMUg1KgCQQFWYi02L5FY4YvEFlIxnvAtXVxw+s7PYKwCK+3zgHIRxkT+SuSZ7gUyoe94LvYx1IO vGDHoRgadhlC91N/xY6UdNc/EJuj1hiTWhqkQgYD5oN/eDMAQfIydpq1fNmciZNtQRpsGr/Yzvw7J zXfDQDSACR9tDeYBNs/WmRpMiRJcDJ3BH+jyy33wepKhWEdHTC5RLlrD1+/Z13gu5xqlQGgV6Tlxs OZVRPlzvZ0enOqqeZRYU89ZicAMAp1q0eB8jBrO/QgIJT06pZpxY0Y9i7ES57hi/gk2tJ3LHQmQDV 6j0NTx3RQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:58572) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jlcBn-0003xe-VJ; Wed, 17 Jun 2020 18:49:31 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1jlcBn-0003vD-3O; Wed, 17 Jun 2020 18:49:31 +0100 Date: Wed, 17 Jun 2020 18:49:31 +0100 From: Russell King - ARM Linux admin To: Calvin Johnson Cc: Jeremy Linton , Jon , Cristi Sovaiala , Ioana Ciornei , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Madalin Bucur , netdev@vger.kernel.org, linux.cj@gmail.com Subject: Re: [PATCH v1 2/3] net/fsl: acpize xgmac_mdio Message-ID: <20200617174930.GU1551@shell.armlinux.org.uk> References: <20200617171536.12014-1-calvin.johnson@oss.nxp.com> <20200617171536.12014-3-calvin.johnson@oss.nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200617171536.12014-3-calvin.johnson@oss.nxp.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, Jun 17, 2020 at 10:45:34PM +0530, Calvin Johnson wrote: > From: Jeremy Linton > > Add ACPI support for xgmac MDIO bus registration while maintaining > the existing DT support. > > The function mdiobus_register() inside of_mdiobus_register(), brings > up all the PHYs on the mdio bus and attach them to the bus. > > Signed-off-by: Jeremy Linton > Signed-off-by: Calvin Johnson > --- > > drivers/net/ethernet/freescale/xgmac_mdio.c | 27 +++++++++++++-------- > 1 file changed, 17 insertions(+), 10 deletions(-) > > diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c > index c82c85ef5fb3..fb7f8caff643 100644 > --- a/drivers/net/ethernet/freescale/xgmac_mdio.c > +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c > @@ -245,14 +245,14 @@ static int xgmac_mdio_probe(struct platform_device *pdev) > { > struct device_node *np = pdev->dev.of_node; > struct mii_bus *bus; > - struct resource res; > + struct resource *res; > struct mdio_fsl_priv *priv; > int ret; > > - ret = of_address_to_resource(np, 0, &res); > - if (ret) { > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + if (!res) { > dev_err(&pdev->dev, "could not obtain address\n"); > - return ret; > + return -EINVAL; > } I think, as you're completely rewriting the resource handling, it would be a good idea to switch over to using devm_* stuff here. void __iomem *regs; regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(regs)) { dev_err(&pdev->dev, "could not map resource: %pe\n", regs); return PTR_ERR(regs); } This also gets rid of the error checking on priv->mdio_base below, and of course the unmap/resource handling for priv->mdio_base in the error paths and device removal paths. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!