Re: [PATCH v1 2/5] net: hpe: Add GXP UMAC MDIO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>  drivers/net/ethernet/hpe/gxp-umac-mdio.c | 158 +++++++++++++++++++++++

This looks to be a standalone MDIO driver. So please move it into
drivers/net/mdio.

> +config NET_VENDOR_HPE
> +	bool "HPE device"
> +	default y
> +	depends on ARCH_HPE

Please add || COMPILE_TEST


> +	help
> +	  Say y here to support the HPE network devices.
> +	  The GXP contains two Ethernet MACs that can be
> +	  connected externally to several physical devices.
> +	  From an external interface perspective the BMC
> +	  provides two SERDES interface connections capable
> +	  of either SGMII or 1000Base-X operation. The BMC
> +	  also provides a RMII interface for sideband
> +	  connections to external Ethernet controllers.
> +
> +if NET_VENDOR_HPE
> +
> +config GXP_UMAC_MDIO
> +	tristate "GXP UMAC mdio support"
> +	depends on ARCH_HPE

You probably also need

        depends on OF_MDIO && HAS_IOMEM
        depends on MDIO_DEVRES

> +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;
> +	int ret;

Networking uses reverse christmas tree. Please sort these longest to
shorted.

...

> +	ret = readl_poll_timeout(umac_mdio->base + UMAC_MII, status,
> +				 !(status & UMAC_MII_MOWNER), 1000, 100000);
> +	if (ret) {
> +		dev_err(bus->parent, "mdio read time out\n");
> +		return -ETIMEDOUT;

return ret;

Don't transform error codes.

> +static int umac_mdio_write(struct mii_bus *bus, int phy_id, int reg, u16 value)
> +{
> +	struct umac_mdio_priv *umac_mdio = bus->priv;
> +	unsigned int status;
> +	int ret;
> +	ret = readl_poll_timeout(umac_mdio->base + UMAC_MII, status,
> +				 !(status & UMAC_MII_MOWNER), 1000, 100000);
> +	if (ret) {
> +		dev_err(bus->parent, "mdio read time out\n");
> +		return -ETIMEDOUT;
> +	}

You can simplify this, do a dev_err() inside an if, and then
unconditionally return ret;

> +static int umac_mdio_probe(struct platform_device *pdev)
> +{
> +	struct resource *res;
> +	struct mii_bus *bus;
> +	struct umac_mdio_priv *umac_mdio;
> +
> +	int ret;


More sorting needed.

And no blank lines please.

    Andrew



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux