From: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx> Date: Mon, 20 May 2019 09:07:16 +0200 > +struct ag71xx_buf { > + union { > + struct sk_buff *skb; > + void *rx_buf; > + }; > + union { > + dma_addr_t dma_addr; > + unsigned int len; > + }; > +}; I find this double union very confusing. When using unions you should make it strictly clear which members are used together, at what times, and in which situations. Therefore, please use something like anonymous structures to group the members that are used together at the same time, something like: struct ag71xx_buf { union { struct { struct sk_buff *skb; dma_addr_t dma_addr; } tx; struct { void *rx_buf; unsigned int len; } rx; }; Or at the very least add a very big comment that explains the use of the union members. > +static int ag71xx_mdio_mii_read(struct mii_bus *bus, int addr, int reg) > +{ > + struct ag71xx *ag = bus->priv; > + struct net_device *ndev = ag->ndev; > + int err, val; Reverse christmas tree here please. > +static int ag71xx_mdio_mii_write(struct mii_bus *bus, int addr, int reg, > + u16 val) > +{ > + struct ag71xx *ag = bus->priv; > + struct net_device *ndev = ag->ndev; > + Likewise. > +static int ag71xx_mdio_probe(struct ag71xx *ag) > +{ > + static struct mii_bus *mii_bus; > + struct device *dev = &ag->pdev->dev; > + struct device_node *np = dev->of_node; > + struct net_device *ndev = ag->ndev; > + int err; Likewise. > +static int ag71xx_tx_packets(struct ag71xx *ag, bool flush) > +{ > + struct ag71xx_ring *ring = &ag->tx_ring; > + struct net_device *ndev = ag->ndev; > + bool dma_stuck = false; > + int ring_mask = BIT(ring->order) - 1; > + int ring_size = BIT(ring->order); > + int sent = 0; > + int bytes_compl = 0; > + int n = 0; Likewise. And so on, and so forth, for the rest of this file.