• Alexander Viro's avatar
    [wan hdlc] new private struct pointer in hdlc_device, and helpers for it · 9f361f7a
    Alexander Viro authored
    New field in hdlc_device: void *priv;
    New helpers:
            struct net_device *alloc_hdlcdev(priv) allocates hdlc, sets ->priv and
    returns pointer to hdlc->netdev
            free_hdlcdev(dev) takes such pointer and frees its hdlc.
    
    wanxl switched to use of those; instead of embedding hdlc into card->ports[]
    we allocate it separately right after card had been allocated and store pointer
    to hdlc->netdev in card->ports[]->dev.  Freeing is done just before freeing
    card.  Pointer back to card->ports[] is stored in hdlc->priv.  port_to_dev()
    and dev_to_port() rewritten in the obvious way; by now the rest of driver
    doesn't care whether hdlc is embedded or not - everything uses port_to_dev()
    and dev_to_port().
    
    That killed embedded hdlc replacing it with pointer to net_device.  Fairly
    similar work will be done in the next few patches for other drivers.
    
    Additionally, setup-after-register and free_irq()-before-unregister races
    had been fixed.
    9f361f7a
wanxl.c 21.3 KB