Re: [PATCH 06/11] net: ethernet: mtk-eth-mac: new driver

From: Bartosz Golaszewski
Date: Wed May 06 2020 - 03:03:12 EST


Hi Andrew,

thanks for the review.

wt., 5 maj 2020 o 19:47 Andrew Lunn <andrew@xxxxxxx> napisaÅ(a):
>
> > +static struct net_device *mtk_mac_get_netdev(struct mtk_mac_priv *priv)
> > +{
> > + char *ptr = (char *)priv;
> > +
> > + return (struct net_device *)(ptr - ALIGN(sizeof(struct net_device),
> > + NETDEV_ALIGN));
> > +}
>
> Bit of an odd way to do it. It is much more normal to just have
>
> return priv->netdev;
>

But then you store a pointer to the starting address of the structure
in that very structure. This is actually weirder to me. :) I'd say:
let's generalize it and provide a counterpart to netdev_priv():
priv_to_netdev(), how about that?

For the other issues: I'll address them in v2.

Bart