Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5272354ybl; Tue, 4 Feb 2020 10:47:57 -0800 (PST) X-Google-Smtp-Source: APXvYqyxVPC6xfdCFFu4seexvMTsHhh1xMMg2LMyX2zJnbWSMVFFTmTt9sgVNHWU5eqDHdN8aXs9 X-Received: by 2002:aca:1011:: with SMTP id 17mr305393oiq.72.1580842077459; Tue, 04 Feb 2020 10:47:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580842077; cv=none; d=google.com; s=arc-20160816; b=zuqXXpuZVhxX3FV33FtvFxWhuG95UhP01lnPgO1MSN67O2wMX1u+bFVjOTS2Z8hoBm OTVvb//BFsoMLu0Pja99lxYSpko/50C0Xp971t35kguSOQwrPtv1B9BHL4O5ag/r1XQZ d+zmvtDiwqKnMRudkKGB2g4MqHH+q8IUDDUQJ5viNaMWSxwuB3BZQiqLy5bXNTPGtkbm HVPQCS/Oi+nxjgLtGKgtDM0D28BqWiGX2sXRpg6aaC1UZiJ04bfeHHPnaKlQfUptnSC0 UnnH/qZclQsmWC7DyX0907iZgxsXSfObdkM4jcTMdI4BW1Oe8LrSt69ovU/v9QetPpLd 8YOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=xqzKkZZwYD8UmTNylzK68UHhE3Ou2TiZoSu6psgptxc=; b=UoHxgLZqMSyHahgwFa8ZbtVVxsMs5/VHDjuQEBZOuM5omYS7PsBIFjcswbHdQMEhci b5PgIpZnMXp9bOtXJJP9I879H6lQenc54cSACz/ih7wu4SWalkuojLYo7svVnAYamLB/ YO61ERYBAc8KLmyBGsv03G6L+paDbIr9JlK1ty/KKPIcyN3jqLJ50dRuhg7Uxp3EPWZv 7t4ZoKKy4IUfIJ7bm88A8m3z8L3UP6GVasBXSgSQ8TFxP2neXU8x8Njfn66L1iggPlLF HO5X4Rzi6oe9//0uNWIlvShUFJCKyMNnTioAQSaCO0uK6pmKA1xH/n2UsvVx74dZCUQp 7eHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=llCdtAB8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l139si10985498oih.233.2020.02.04.10.47.45; Tue, 04 Feb 2020 10:47:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=llCdtAB8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727471AbgBDSqx (ORCPT + 99 others); Tue, 4 Feb 2020 13:46:53 -0500 Received: from mail-yw1-f66.google.com ([209.85.161.66]:36690 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727381AbgBDSqw (ORCPT ); Tue, 4 Feb 2020 13:46:52 -0500 Received: by mail-yw1-f66.google.com with SMTP id n184so18766515ywc.3; Tue, 04 Feb 2020 10:46:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xqzKkZZwYD8UmTNylzK68UHhE3Ou2TiZoSu6psgptxc=; b=llCdtAB8qGVONkL1WDs486cYwq+0N9bCKpYycyW0QBpVz93Ee8uWtEQNHghzDtGGW3 VRMBr1Y0qOS1SmI6D5ub9m3PmBbp40ycsvjSzeCR2yVbs0FVTzrGcJ8BCYdJHFcgz/8f xyA4nkFPh069H3Atlfsb17vQV+lkb+h+NUxFVwlCOdlN5EgwwRGGrFl3iY8OLHBRn4Iy SkReHiQi4RGOrUY4tO3n++mqi70SKo+inieoEgT0V5gmNCYQdAwcATJ2YSGSlRA770MD Fx8RlM+twW1y7tWzNceS8P4T/c+UXbpsGD7Juf2Wk8pxw7JU/CDUYBpj0PxArDpX+NIH YozA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xqzKkZZwYD8UmTNylzK68UHhE3Ou2TiZoSu6psgptxc=; b=CyICAuKFoqPOKD2V/CrBFk/ktw8qQc+T+9dknS/NDtUPNRrG2V1HjeK6Sx+JA35EIy R6uE6czlW08hrvgn1JdZC5mLA3rNU7br+qyyRfdE1+IOSiUlkQNLIdSFmc3AGz34jdMO grluZarHaMkj/t/FP4BKUKu1ApGugLsGENVrSq1PwwEUmxMxZefhiiIEZ1iW4zvM8eeW n+FuelG+ne1aHjG4oFE7OPpnXz0Wc6o+34x9bBrmo93duvyMRY5EC5Kj+KPY5+L+VWef Om8YlbdqBycRkiLl3SC/XVlQXYqrx5o+HmTtQ4YjgibS7nU3mCcDVqvtyFla9j23Thya fI4g== X-Gm-Message-State: APjAAAWHGsX37Rawj8hxcHV0trQpxVHZlfSpmC/KagUUafevnmyNXdKP 590ac/ipfEUFBIWG2JGZ3PoYGwbSdE7y2rpXfP0= X-Received: by 2002:a81:3754:: with SMTP id e81mr7045993ywa.404.1580842011687; Tue, 04 Feb 2020 10:46:51 -0800 (PST) MIME-Version: 1.0 References: <20200131153440.20870-1-calvin.johnson@nxp.com> <20200131153440.20870-4-calvin.johnson@nxp.com> <6501a53b-40aa-5374-3c4a-6b21824f82fd@gmail.com> In-Reply-To: <6501a53b-40aa-5374-3c4a-6b21824f82fd@gmail.com> From: Calvin Johnson Date: Wed, 5 Feb 2020 00:16:39 +0530 Message-ID: Subject: Re: [PATCH v1 3/7] net/fsl: add ACPI support for mdio bus To: Florian Fainelli Cc: Calvin Johnson , Jon Nettleton , linux@armlinux.org.uk, Makarand Pawagi , cristian.sovaiala@nxp.com, laurentiu.tudor@nxp.com, ioana.ciornei@nxp.com, V.Sethi@nxp.com, pankaj.bansal@nxp.com, "Rajesh V . Bikkina" , Calvin Johnson , "David S. Miller" , Madalin Bucur , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 02, 2020 at 07:44:40PM -0800, Florian Fainelli wrote: > > > On 1/31/2020 7:34 AM, Calvin Johnson wrote: > > From: Calvin Johnson > > > > Add ACPI support for MDIO bus registration while maintaining > > the existing DT support. > > > > Signed-off-by: Calvin Johnson > > --- > > [snip] > > > bus = mdiobus_alloc_size(sizeof(struct mdio_fsl_priv)); > > @@ -263,25 +265,41 @@ static int xgmac_mdio_probe(struct platform_device *pdev) > > bus->read = xgmac_mdio_read; > > bus->write = xgmac_mdio_write; > > bus->parent = &pdev->dev; > > - snprintf(bus->id, MII_BUS_ID_SIZE, "%llx", (unsigned long long)res.start); > > + snprintf(bus->id, MII_BUS_ID_SIZE, "%llx", > > + (unsigned long long)res->start); > > You could omit this clean up change. Sure, will avoid split to newline. > > > > /* Set the PHY base address */ > > priv = bus->priv; > > - priv->mdio_base = of_iomap(np, 0); > > + priv->mdio_base = devm_ioremap_resource(&pdev->dev, res); > > if (!priv->mdio_base) { > > This probably needs to become IS_ERR() instead of a plain NULL check Ok. Will take care in v2. > > > ret = -ENOMEM; > > goto err_ioremap; > > } > > > > - priv->is_little_endian = of_property_read_bool(pdev->dev.of_node, > > - "little-endian"); > > - > > - priv->has_a011043 = of_property_read_bool(pdev->dev.of_node, > > - "fsl,erratum-a011043"); > > - > > - ret = of_mdiobus_register(bus, np); > > - if (ret) { > > - dev_err(&pdev->dev, "cannot register MDIO bus\n"); > > + if (is_of_node(pdev->dev.fwnode)) { > > + priv->is_little_endian = of_property_read_bool(pdev->dev.of_node, > > + "little-endian"); > > + > > + priv->has_a011043 = of_property_read_bool(pdev->dev.of_node, > > + "fsl,erratum-a011043"); > > + > > + ret = of_mdiobus_register(bus, np); > > + if (ret) { > > + dev_err(&pdev->dev, "cannot register MDIO bus\n"); > > + goto err_registration; > > + } > > + } else if (is_acpi_node(pdev->dev.fwnode)) { > > + priv->is_little_endian = > > + fwnode_property_read_bool(pdev->dev.fwnode, > > + "little-endian"); > > + ret = fwnode_mdiobus_register(bus, pdev->dev.fwnode); > > + if (ret) { > > + dev_err(&pdev->dev, "cannot register MDIO bus\n"); > > + goto err_registration; > > + } > > The little-endian property read can be moved out of the DT/ACPI paths > and you can just use device_property_read_bool() for that purpose. > Having both fwnode_mdiobus_register() and of_mdiobus_register() looks > fairly redundant, you could quite easily introduce a wrapper: > device_mdiobus_register() which internally takes the appropriate DT/ACPI > paths as needed. Had some difficulty with DT while using fwnode APIs. Will resolve them and provide better integrated code. Thanks Calvin