]> git.openfabrics.org - ~emulex/infiniband.git/commit
rt2x00: rt2x00queue: initialize data_queue fields earlier
authorGabor Juhos <juhosg@openwrt.org>
Mon, 3 Jun 2013 21:39:53 +0000 (23:39 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 10 Jun 2013 19:37:34 +0000 (15:37 -0400)
commit10af87c3d99112b3ca279cadd874cd542e4f6699
treeafab71296e00c2bd4c8e5c1288a181ca6b118fa1
parentec71997eff2231098212a99934c0fb987a9e6b04
rt2x00: rt2x00queue: initialize data_queue fields earlier

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: Jakub Kicinski <moorray@wp.pl>
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2x00queue.c