net: fec: use container_of to resolve bufdesc_ex from bufdesc
authorFabian Frederick <fabf@skynet.be>
Sat, 13 Sep 2014 20:38:26 +0000 (22:38 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 15 Sep 2014 16:49:11 +0000 (12:49 -0400)
Use container_of instead of casting first structure member.

ARM cross-compiled but untested.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/fec_main.c

index 8f8e55ea7f858052c3cb3112dc27090af2d58342..e242eacfc430739c69a049b86816c4bc7ffa6abf 100644 (file)
@@ -591,7 +591,7 @@ fec_enet_txq_put_data_tso(struct fec_enet_priv_tx_q *txq, struct sk_buff *skb,
        struct fec_enet_private *fep = netdev_priv(ndev);
        const struct platform_device_id *id_entry =
                                platform_get_device_id(fep->pdev);
-       struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp;
+       struct bufdesc_ex *ebdp = container_of(bdp, struct bufdesc_ex, desc);
        unsigned short status;
        unsigned int estatus = 0;
        dma_addr_t addr;
@@ -651,7 +651,7 @@ fec_enet_txq_put_hdr_tso(struct fec_enet_priv_tx_q *txq,
        const struct platform_device_id *id_entry =
                                platform_get_device_id(fep->pdev);
        int hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
-       struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp;
+       struct bufdesc_ex *ebdp = container_of(bdp, struct bufdesc_ex, desc);
        void *bufaddr;
        unsigned long dmabuf;
        unsigned short status;