• Tobin C. Harding's avatar
    staging: ks7010: move hw info into dev private data · 18bd6dd1
    Tobin C. Harding authored
    Currently driver uses a hardware information struct description to
    group some SDIO related functionality (work, work queue, sdio private
    data pointer). This structure is then embedded in the device private
    data structure. Having nested structures described in different header
    files means that to view the device private data programmers must open
    two header files. This structure could be embedded anonymously in the
    device private data and achieve the same result (grouping of function
    specific to SDIO) without the need to open multiple headers. However,
    the SDIO private data structure already has various different data and
    pointers, adding the embedded structure adds little extra meaning and
    lengthens all the dereferences throughout the driver, often meaning
    addition line breaks and braces. We can increase readability and
    reduce code complexity by moving the hardware information data and
    pointers to directly be within the device private data structure
    description.
    
    While preparing for this refactoring it was noted that the identifier
    currently used for the delayed work is 'rw_wq', this is confusing
    since the 'wq' suffix typically means 'work queue'. This identifier
    would be more meaningful if it used the suffix 'dwork' as does the
    declaration of queue_delayed_work() (include/linux/workqueue.h).
    
    The identifier for the work queue is currently 'ks7010sdio_wq'. This
    identifier can be shortened without loss of meaning because there is
    only one work queue within the driver. Identifier 'wq' is typical
    within in-tree driver code and aptly describes the pointer.
    
    Current pointer to the SDIO private data is identified by 'sdio_card',
    this is sufficiently meaningful from within the hw_info structure but
    once the hw_info_t structure is removed the pointer would be better to
    have a prefix appended to it to retain the prior level of meaning.
    
    Move members from struct hw_info_t to struct ks_wlan_private.
    
    Rename identifiers;
    struct delayed_work pointer 'rw_wq' to 'rw_dwork'.
    struct workqueue_struct pointer 'ks7010sdio_wq' to 'wq'.
    struct ks_sdio_card  pointer 'sdio_card' to 'ks_sdio_card'.
    
    Remove structure description hw_info_t. Fix init/destroy calls. Fix
    all call sites, SDIO private data access calls, and queuing calls.
    Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    18bd6dd1
ks_hostif.c 76.1 KB