Skip to content
Snippets Groups Projects
  1. May 20, 2010
  2. Mar 30, 2010
    • Tejun Heo's avatar
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo authored
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Guess-its-ok-by: default avatarChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  3. Feb 09, 2010
  4. Jan 21, 2010
  5. Jan 07, 2010
  6. Dec 11, 2009
  7. Dec 04, 2009
  8. Nov 03, 2009
  9. Oct 20, 2009
  10. Oct 19, 2009
    • Inaky Perez-Gonzalez's avatar
      wimax/i2400m: SDIO: fix oops on reset when TXing on uninitialized data · a8ee303c
      Inaky Perez-Gonzalez authored
      
      Currently the SDIO part of the TX resources were initialized/released
      with bus_dev_{start,stop}.
      
      The generic code's TX subsystem is destroyed afterwards, so there is a
      window from the bus-TX destruction to the generic-TX destruction where
      the generic-TX code might call into bus-TX to do transactions.
      
      The SDIO code cannot really cope with this (whereas in USB, how it is
      laid out, it correctly ignores it). In any case, it made no sense for
      the SDIO TX code to be in i2400m->bus_dev_start/stop(), so moved to
      i2400m->bus_setup/release(), which also takes care of the oops.
      
      Signed-off-by: default avatarInaky Perez-Gonzalez <inaky@linux.intel.com>
      a8ee303c
    • Inaky Perez-Gonzalez's avatar
      wimax/i2400m: make i2400m->bus_dev_{stop,start}() optional · 097acbef
      Inaky Perez-Gonzalez authored
      
      In coming commits, the i2400m SDIO driver will not use
      i2400m->bus_dev_stop().
      
      Thus changed to check before calling, as an empty stub has more
      overhead than a call to check if the function pointer is non-NULL.
      
      Signed-off-by: default avatarInaky Perez-Gonzalez <inaky@linux.intel.com>
      097acbef
    • Inaky Perez-Gonzalez's avatar
      wimax/i2400m: fix oops caused by race condition when exiting USB kthreads · 4a78fd9a
      Inaky Perez-Gonzalez authored
      
      Current i2400m USB code had to threads (one for processing RX, one for
      TX). When calling i2400m_{tx,rx}_release(), it would crash if the
      thread had exited already due to an error.
      
      So changed the code to have the thread fill in/out
      i2400mu->{tx,rx}_kthread under a spinlock; then the _release()
      function will call kthread_stop() only if {rx,tx}_kthread is still
      set.
      
      Signed-off-by: default avatarInaky Perez-Gonzalez <inaky@linux.intel.com>
      4a78fd9a
    • Inaky Perez-Gonzalez's avatar
      wimax/i2400m: Let device's status reports change the device state · 0c96859d
      Inaky Perez-Gonzalez authored
      
      Currently __i2400m_dev_start was forcing, after uploading firmware and
      doing a few checks to WIMAX_ST_UNINITIALIZED.
      
      This can be overriding state changes that the device might have caused
      by sending reports; thus it makes more sense to remove it and let the
      device update the status on its own by sending reports.
      
      Signed-off-by: default avatarInaky Perez-Gonzalez <inaky@linux.intel.com>
      0c96859d
    • Inaky Perez-Gonzalez's avatar
      wimax/i2400m: fix oops in TX when tearing down the device · 46c50147
      Inaky Perez-Gonzalez authored
      
      All the entry points into the TX module should check if the device has
      been torn down. Otherwise, when the device resets or shuts down, there
      are windows when a call to i2400m_tx*() will oops the system.
      
      For that, make i2400m_tx_release() set i2400m->tx_buf to NULL under
      the tx_lock. Then, any entry point [i2400m_tx(), _tx_msg_sent(),
      _tx_msg_get()] will check for i2400m->tx_buf to be NULL and exit
      gracefully.
      
      Signed-off-by: default avatarInaky Perez-Gonzalez <inaky@linux.intel.com>
      46c50147
    • Inaky Perez-Gonzalez's avatar
      wimax/i2400m: queue device's report until the driver is ready for them · a0beba21
      Inaky Perez-Gonzalez authored
      
      The i2400m might start sending reports to the driver before it is done
      setting up all the infrastructure needed for handling them.
      
      Currently we were just dropping them when the driver wasn't ready and
      that is bad in certain situations, as the sync between the driver's
      idea of the device's state and the device's state dissapears.
      
      This changes that by implementing a queue for handling
      reports. Incoming reports are appended to it and a workstruct is woken
      to process the list of queued reports.
      
      When the device is not yet ready to handle them, the workstruct is not
      woken, but at soon as the device becomes ready again, the queue is
      processed.
      
      As a consequence of this, i2400m_queue_work() is no longer used, and
      thus removed.
      
      Signed-off-by: default avatarInaky Perez-Gonzalez <inaky@linux.intel.com>
      a0beba21
    • Inaky Perez-Gonzalez's avatar
      wimax/i2400m: move i2400m_init() out of i2400m.h · af77dfa7
      Inaky Perez-Gonzalez authored
      
      Upcoming changes will have to add things to this function that expose
      more internals, which would mean more forward declarators.
      
      Frankly, it doesn't need to be an inline, so moved to driver.c, where
      the declarations will be taken from the header file.
      
      Signed-off-by: default avatarInaky Perez-Gonzalez <inaky@linux.intel.com>
      af77dfa7
    • Inaky Perez-Gonzalez's avatar
      wimax/i2400m: fix deadlock: don't do BUS reset under i2400m->init_mutex · b9ee9501
      Inaky Perez-Gonzalez authored
      
      Since the addition of the pre/post reset handlers, it became clear
      that we cannot do a I2400M-RT-BUS type reset while holding the
      init_mutex, as in the case of USB, it will deadlock when trying to
      call i2400m_pre_reset().
      
      Thus, the following changes:
      
       - clarify the fact that calling bus_reset() w/ I2400M_RT_BUS while
         holding init_mutex is a no-no.
      
       - i2400m_dev_reset_handle() will do a BUS reset to recover a gone
         device after unlocking init_mutex.
      
       - in the USB reset implementation, when cold and warm reset fails,
         fallback to QUEUING a usb reset, not executing a USB reset, so it
         happens from another context and does not deadlock.
      
      Signed-off-by: default avatarInaky Perez-Gonzalez <inaky@linux.intel.com>
      b9ee9501
    • Inaky Perez-Gonzalez's avatar
      wimax/i2400m: when stopping the device, cancel any pending message · 5eeae35b
      Inaky Perez-Gonzalez authored
      
      The stop procedure for the device must make sure that any task that is
      waiting on a message is properly cancelled.
      
      This was being taken care of only by the __i2400m_dev_reset_handle()
      path and the rest was working by chance because the waits have a
      timeout.
      
      Fixed by adding a proper cancellation in __i2400m_dev_stop().
      
      Signed-off-by: default avatarInaky Perez-Gonzalez <inaky@linux.intel.com>
      5eeae35b
    • Cindy H Kao's avatar
      wimax/i2400m: change the bcf_len to exclude the extended header size · 28cff50d
      Cindy H Kao authored
      
      The actual fw->size may not equal to the bcf size indicated in
      the bcf header if the extended bcf debug header is added in the tail.
      
      To reflect the actual fw size that will be downloaded to the device,
      it is now retrived from from the size field indicated in the bcf header.
      
      All of the headers (if there are extended headers) should indicate same
      value for the size field since only one set of firmware chunks is downloaded
      
      Signed-off-by: default avatarCindy H Kao <cindy.h.kao@intel.com>
      28cff50d
    • Cindy H Kao's avatar
      wimax/i2400m: use JUMP cmd for last FW chunk indication · 6f4fc90a
      Cindy H Kao authored
      
      Both secure and non-secure boot must set the JUMP command in the
      bootmode header as the last FW chunk, so we change to use the JUMP
      command to decide if the FW chunk download is completed.
      
      Since we tend to use one single FW to support both secure and non-secure
      boot for most of the time, I2400M_BRH_SIGNED_JUMP is actually found
      even for non-secure boot. But in case the FW does come with
      I2400M_BRH_JUMP, we check for both of them in i2400m_dnload_bcf().
      
      Signed-off-by: default avatarCindy H Kao <cindy.h.kao@intel.com>
      Signed-off-by: default avatarInaky Perez-Gonzalez <inaky@linux.intel.com>
      6f4fc90a
    • Inaky Perez-Gonzalez's avatar
      wimax/i2400m: fix race condition with tcpdump et al · 9835fd84
      Inaky Perez-Gonzalez authored
      
      tcpdump and friends were not being able to decode packets sent via
      WiMAX; they had a zero ethernet type, even when the stack was properly
      sending them to the device with the right type.
      
      It happens that the driver was overwriting the (fake) ethernet header
      for creating the hardware header and that was bitting the cloning used
      by tcpdump (et al) to look into the packets.
      
      Use pkskb_expand_head() [method copied from the e1000 driver] to fix.
      
      Thanks to Herbert Xu and Andi Kleen for helping to diagnose and
      pointing to the right fix.
      
      Cc: Herbert Xu <gondor.apana.org.au>
      Cc: Andi Kleen <andi@firstfloor.org>
      Signed-off-by: default avatarInaky Perez-Gonzalez <inaky@linux.intel.com>
      9835fd84
    • Inaky Perez-Gonzalez's avatar
      wimax/i2400m: reduce verbosity of debug messages in boot mode · e1633fd6
      Inaky Perez-Gonzalez authored
      
      Missed a debug message that was being constantly printed as a
      dev_err(); became annoying. Demote it to a debug message.
      
      Signed-off-by: default avatarInaky Perez-Gonzalez <inaky@linux.intel.com>
      e1633fd6
    • Inaky Perez-Gonzalez's avatar
      wimax/i2400m: Implement pre/post reset support in the USB driver · 3725d8c9
      Inaky Perez-Gonzalez authored
      
      The USB stack can callback a driver is about to be reset by an
      external entity and right after it, so the driver can save state and
      then restore it.
      
      This commit implements said support; it is implemented actually in the
      core, bus-generic driver [i2400m_{pre,post}_reset()] and used by the
      bus-specific drivers. This way the SDIO driver can also use it once
      said support is brought to the SDIO stack.
      
      Signed-off-by: default avatarInaky Perez-Gonzalez <inaky@linux.intel.com>
      3725d8c9
    • Inaky Perez-Gonzalez's avatar
      wimax/i2400m: do bootmode buffer management in i2400m_setup/release() · 2869da85
      Inaky Perez-Gonzalez authored
      
      After the introduction of i2400m->bus_setup/release, there is no more
      race condition where the bootmode buffers are needed before
      i2400m_setup() is called.
      
      Before, the SDIO driver would setup RX before calling i2400m_setup()
      and thus need those buffers; now RX setup is done in
      i2400m->bus_setup(), which is called by i2400m_setup().
      
      Thus, all the bootmode buffer management can now be done completely
      inside i2400m_setup()/i2400m_release(), removing complexity from the
      bus-specific drivers.
      
      Signed-off-by: default avatarInaky Perez-Gonzalez <inaky@linux.intel.com>
      2869da85
    • Inaky Perez-Gonzalez's avatar
      wimax/i2400m: introduce i2400m->bus_setup/release · 0856ccf2
      Inaky Perez-Gonzalez authored
      
      The SDIO subdriver of the i2400m requires certain steps to be done
      before we do any acces to the device, even for doing firmware upload.
      
      This lead to a few ugly hacks, which basically involve doing those
      steps in probe() before calling i2400m_setup() and undoing them in
      disconnect() after claling i2400m_release(); but then, much of those
      steps have to be repeated when resetting the device, suspending, etc
      (in upcoming pre/post reset support).
      
      Thus, a new pair of optional, bus-specific calls
      i2400m->bus_{setup/release} are introduced. These are used to setup
      basic infrastructure needed to load firmware onto the device.
      
      This commit also updates the SDIO subdriver to use said calls.
      
      Signed-off-by: default avatarInaky Perez-Gonzalez <inaky@linux.intel.com>
      0856ccf2
    • Inaky Perez-Gonzalez's avatar
      wimax/i2400m: clarify and fix i2400m->{ready,updown} · c2315b4e
      Inaky Perez-Gonzalez authored
      
      The i2400m driver uses two different bits to distinguish how much the
      driver is up. i2400m->ready is used to denote that the infrastructure
      to communicate with the device is up and running. i2400m->updown is
      used to indicate if 'ready' and the device is up and running, ready to
      take control and data traffic.
      
      However, all this was pretty dirty and not clear, with many open spots
      where race conditions were present.
      
      This commit cleans up the situation by:
      
       - documenting the usage of both bits
      
       - setting them only in specific, well controlled places
         (i2400m_dev_start, i2400m_dev_stop)
      
       - ensuring the i2400m workqueue can't get in the middle of the
         setting by flushing it when i2400m->ready is set to zero. This
         allows the report hook not having to check again for the bit to be
         set [rx.c:i2400m_report_hook_work()].
      
       - using i2400m->updown to determine if the device is up and running
         instead of the wimax state in i2400m_dev_reset_handle().
      
       - not loosing missed messages sent by the hardware before
         i2400m->ready is set. In rx.c, whatever the device sends can be
         sent to user space over the message pipes as soon as the wimax
         device is registered, so don't wait for i2400m->ready to be set.
      
      Signed-off-by: default avatarInaky Perez-Gonzalez <inaky@linux.intel.com>
      c2315b4e
    • Inaky Perez-Gonzalez's avatar
      wimax/i2400m: cleanup initialization/destruction flow · 8f90f3ee
      Inaky Perez-Gonzalez authored
      
      Currently the i2400m driver was starting in a weird way: registering a
      network device, setting the device up and then registering a WiMAX
      device.
      
      This is an historic artifact, and was causing issues, a some early
      reports the device sends were getting lost by issue of the wimax_dev
      not being registered.
      
      Fix said situation by doing the wimax device registration in
      i2400m_setup() after network device registration and before starting
      thed device.
      
      As well, removed spurious setting of the state to UNINITIALIZED;
      i2400m.dev_start() does that already.
      
      Signed-off-by: default avatarInaky Perez-Gonzalez <inaky@linux.intel.com>
      8f90f3ee
    • Inaky Perez-Gonzalez's avatar
      wimax/i2400m: on device stop, clean up pending wake & TX work · ac53aed9
      Inaky Perez-Gonzalez authored
      
      When the i2400m device needs to wake up an idle WiMAX connection, it
      schedules a workqueue job to do it.
      
      Currently, only when the network stack called the _stop() method this
      work struct was being cancelled. This has to be done every time the
      device is stopped.
      
      So add a call in i2400m_dev_stop() to take care of such cleanup, which
      is now wrapped in i2400m_net_wake_stop().
      
      Signed-off-by: default avatarInaky Perez-Gonzalez <inaky@linux.intel.com>
      ac53aed9
    • Inaky Perez-Gonzalez's avatar
      wimax/i2400m: don't overwrite error codes when failing to load firmware · cb5b756f
      Inaky Perez-Gonzalez authored
      
      Make sure that i2400m_dev_bootstrap() doesn't overwrite the last known
      error code with -ENOENT; when a firmware fails to load, we want to
      know the cause and not a generic error code.
      
      Signed-off-by: default avatarInaky Perez-Gonzalez <inaky@linux.intel.com>
      cb5b756f
    • Inaky Perez-Gonzalez's avatar
      wimax/i2400m: implement .reset_resume in USB subdriver · 1a5a73c0
      Inaky Perez-Gonzalez authored
      
      Current driver didn't implement the .reset_resume method. The i2400m
      normally always reset on a comeback from system standby/hibernation.
      
      This requires previously applied commits to cache the firmware image
      file.
      
      Signed-off-by: default avatarInaky Perez-Gonzalez <inaky@linux.intel.com>
      1a5a73c0
Loading