[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZL6Ntazi84za5YX+@corigine.com>
Date: Mon, 24 Jul 2023 16:41:57 +0200
From: Simon Horman <simon.horman@...igine.com>
To: nick.hawkins@....com
Cc: verdun@....com, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, robh+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org, conor+dt@...nel.org,
netdev@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 2/5] net: hpe: Add GXP UMAC MDIO
On Fri, Jul 21, 2023 at 04:20:41PM -0500, nick.hawkins@....com wrote:
...
Hi Nick,
> +static int umac_mdio_read(struct mii_bus *bus, int phy_id, int reg)
> +{
> + struct umac_mdio_priv *umac_mdio = bus->priv;
> + unsigned int value;
> + unsigned int status;
Please use reverse xmas tree - longest line to shortest - for
local variable declarations in new Networking code.
...
> +static int umac_mdio_probe(struct platform_device *pdev)
> +{
> + struct resource *res;
> + struct mii_bus *bus;
> + struct umac_mdio_priv *umac_mdio;
Ditto.
> +
> + int ret;
> +
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (!res) {
> + dev_err(&pdev->dev, "fail to get resource\n");
> + return -ENODEV;
> + }
> +
> + bus = devm_mdiobus_alloc_size(&pdev->dev,
> + sizeof(struct umac_mdio_priv));
> + if (!bus) {
> + dev_err(&pdev->dev, "failed to alloc mii bus\n");
> + return -ENOMEM;
> + }
> +
> + snprintf(bus->id, MII_BUS_ID_SIZE, "%s", dev_name(&pdev->dev));
> +
> + bus->name = dev_name(&pdev->dev);
> + bus->read = umac_mdio_read,
> + bus->write = umac_mdio_write,
Should the comas (',') on the two lines above be semicolons (';') ?
> + bus->parent = &pdev->dev;
> + umac_mdio = bus->priv;
> + umac_mdio->base = devm_ioremap_resource(&pdev->dev, res);
> + if (!umac_mdio->base) {
> + dev_err(&pdev->dev, "failed to do ioremap\n");
> + return -ENODEV;
> + }
> +
> + platform_set_drvdata(pdev, umac_mdio);
> +
> + ret = of_mdiobus_register(bus, pdev->dev.of_node);
> +
> + if (ret < 0) {
> + dev_err(&pdev->dev, "Cannot register MDIO bus (%d)\n", ret);
> + return ret;
> + }
> +
> + return 0;
> +}
...
Powered by blists - more mailing lists