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

Bartosz Golaszewski
2020-05-06T07:03:11Z

Hi Andrew,

thanks for the review.

wt., 5 maj 2020 o 19:47 Andrew Lunn <andrew@lunn.ch> 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