• Zhu Yi's avatar
    iwlwifi: delay firmware loading from pci_probe to network interface open · 5a66926a
    Zhu Yi authored
    This patch moves the firmware loading (read firmware from disk and load
    it into the device SRAM) from pci_probe time to the first network
    interface open time. There are two reasons for doing this:
    
    1. To support kernel buildin iwlwifi drivers. Because kernel initializes
       network devices subsystem before hard disk and SATA subsystem, it is
       impossible to get the firmware image from hard disk in the PCI probe
       handler. Thus delaying the firmware loading into the network
       interface open time is the way to go. Note, we only read the firmware
       image from hard disk the first time the interface is open. After this
       is succeeded, we cache the firmware image into the host memory. This
       is a performance gain when user open and close the interface multiple
       times and is necessary for device suspend and resume.
    
    2. For better power saving. When the iwlwifi modules are loaded (or
       buildin the kernel) but the wireless network interface is not being
       used, it is a good practice the wireless device consumes as less
       power as possible. Unloading the firmware from the wireless device
       and unregister the driver's interrupt handler in the network
       interface close handler provides users a way to achieve this. User
       space network configuration tools (i.e NetworkManager) can also
       contribute here when it detects a wired cable is connected and
       close the wireless interface automatically.
    
    This patch also includes the pci_save/restore_state() fixed by Ian Schram
    upon the first version.
    Signed-off-by: default avatarZhu Yi <yi.zhu@intel.com>
    Signed-off-by: default avatarIan Schram <ischram@telenet.be>
    Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
    5a66926a
iwl3945-base.c 248 KB