From 0fd3d91152df5bb6c5f7b9ee68f01a9a1c9a875d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 22 Dec 2020 19:30:28 -0700 Subject: dm: Use access methods for dev/uclass private data Most drivers use these access methods but a few do not. Update them. In some cases the access is not permitted, so mark those with a FIXME tag for the maintainer to check. Signed-off-by: Simon Glass Acked-by: Andy Shevchenko Acked-by: Pratyush Yadav --- drivers/net/fm/eth.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'drivers/net/fm') diff --git a/drivers/net/fm/eth.c b/drivers/net/fm/eth.c index 02ccf1efc3b..a10f87eefc5 100644 --- a/drivers/net/fm/eth.c +++ b/drivers/net/fm/eth.c @@ -547,7 +547,11 @@ static void fm_eth_halt(struct udevice *dev) struct fm_eth *fm_eth; struct fsl_enet_mac *mac; +#ifndef CONFIG_DM_ETH fm_eth = (struct fm_eth *)dev->priv; +#else + fm_eth = dev_get_priv(dev); +#endif mac = fm_eth->mac; /* graceful stop the transmission of frames */ @@ -577,7 +581,11 @@ static int fm_eth_send(struct udevice *dev, void *buf, int len) u16 offset_in; int i; +#ifndef CONFIG_DM_ETH fm_eth = (struct fm_eth *)dev->priv; +#else + fm_eth = dev_get_priv(dev); +#endif pram = fm_eth->tx_pram; txbd = fm_eth->cur_txbd; @@ -664,13 +672,19 @@ static int fm_eth_recv(struct eth_device *dev) static int fm_eth_recv(struct udevice *dev, int flags, uchar **packetp) #endif { - struct fm_eth *fm_eth = (struct fm_eth *)dev->priv; - struct fm_port_bd *rxbd = fm_eth->cur_rxbd; + struct fm_eth *fm_eth; + struct fm_port_bd *rxbd; u32 buf_lo, buf_hi; u16 status, len; int ret = -1; u8 *data; +#ifndef CONFIG_DM_ETH + fm_eth = (struct fm_eth *)dev->priv; +#else + fm_eth = dev_get_priv(dev); +#endif + rxbd = fm_eth->cur_rxbd; status = muram_readw(&rxbd->status); while (!(status & RxBD_EMPTY)) { @@ -704,7 +718,7 @@ static int fm_eth_recv(struct udevice *dev, int flags, uchar **packetp) #ifdef CONFIG_DM_ETH static int fm_eth_free_pkt(struct udevice *dev, uchar *packet, int length) { - struct fm_eth *fm_eth = (struct fm_eth *)dev->priv; + struct fm_eth *fm_eth = (struct fm_eth *)dev_get_priv(dev); fm_eth->cur_rxbd = fm_eth_free_one(fm_eth, fm_eth->cur_rxbd); @@ -1004,7 +1018,7 @@ static struct udevice *fm_get_internal_mdio(struct udevice *dev) static int fm_eth_probe(struct udevice *dev) { - struct fm_eth *fm_eth = (struct fm_eth *)dev->priv; + struct fm_eth *fm_eth = (struct fm_eth *)dev_get_priv(dev); struct ofnode_phandle_args args; void *reg; int ret, index; -- cgit v1.2.3