• Grygorii Strashko's avatar
    net: ethernet: ti: cpts: rework initialization/deinitialization · 8a2c9a5a
    Grygorii Strashko authored
    The current implementation CPTS initialization and deinitialization
    (represented by cpts_register/unregister()) does too many static
    initialization from .ndo_open(), which is reasonable to do once at probe
    time instead, and also require caller to allocate memory for struct cpts,
    which is internal for CPTS driver in general.
    
    This patch splits CPTS initialization and deinitialization on two parts:
    
    - static initializtion cpts_create()/cpts_release() which expected to be
    executed when parent driver is probed/removed;
    
    - dynamic part cpts_register/unregister() which expected to be executed
    when network device is opened/closed.
    
    As result, current code of CPTS parent driver - CPSW - will be simplified
    (and it also will allow simplify adding support for Keystone 2 devices in
    the future), plus more initialization errors will be catched earlier. In
    addition, this change allows to clean up cpts.h for the case when CPTS is
    disabled.
    Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    8a2c9a5a
cpts.h 6.04 KB