• Gabor Juhos's avatar
    rt2x00: rt2x00queue: initialize data_queue fields earlier · 10af87c3
    Gabor Juhos authored
    Support for rt2800 device is broken since my
    'rt2x00: rt2x00dev: use rt2x00dev->tx->limit'
    patch. The changelog of that commit says that the
    TX data queue is initialized already when the
    rt2x00lib_probe_hw() function is called.
    
    However as Jakub noticed it, this statement is not
    correct. The queue->limit field is initialized in
    the rt2x00queue_alloc_entries routine and that is
    not yet called when rt2x00lib_probe_hw() runs.
    Because the value of tx->limit contains zero, the
    driver tries to allocate a kernel fifo with zero
    size and kfifo_alloc rejects that with -EINVAL.
    
      PCI: Enabling device 0000:01:00.0 (0000 -> 0002)
      ieee80211 phy1: rt2x00_set_rt: Info - RT chipset 3071, rev 021c detected
      ieee80211 phy1: rt2x00_set_rf: Info - RF chipset 0008 detected
      ieee80211 phy1: rt2x00lib_probe_dev: Error - Failed to initialize hw
      rt2800pci: probe of 0000:01:00.0 failed with error -22
    
    Move the data_queue field initialization from
    the rt2x00queue_alloc_entries routine into the
    rt2x00queue_init function. The initialization
    code is not strictly related to the allocation,
    and the change ensures that the queue_data fields
    can be used in the probe routines.
    
    The patch also introduces a helper function in
    order to be able to get the correct data_queue_desc
    structure for a given queue. This helper is only
    needed temporarily and it will be removed later.
    Reported-by: default avatarJakub Kicinski <moorray@wp.pl>
    Signed-off-by: default avatarGabor Juhos <juhosg@openwrt.org>
    Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
    10af87c3
rt2x00queue.c 35.8 KB