28 Jul, 2012

1 commit

  • Pull ARM updates from Russell King:
    "First ARM push of this merge window, post me coming back from holiday.
    This is what has been in linux-next for the last few weeks. Not much
    to say which isn't described by the commit summaries."

    * 'for-linus' of git://git.linaro.org/people/rmk/linux-arm: (32 commits)
    ARM: 7463/1: topology: Update cpu_power according to DT information
    ARM: 7462/1: topology: factorize the update of sibling masks
    ARM: 7461/1: topology: Add arch_scale_freq_power function
    ARM: 7456/1: ptrace: provide separate functions for tracing syscall {entry,exit}
    ARM: 7455/1: audit: move syscall auditing until after ptrace SIGTRAP handling
    ARM: 7454/1: entry: don't bother with syscall tracing on ret_from_fork path
    ARM: 7453/1: audit: only allow syscall auditing for pure EABI userspace
    ARM: 7452/1: delay: allow timer-based delay implementation to be selected
    ARM: 7451/1: arch timer: implement read_current_timer and get_cycles
    ARM: 7450/1: dcache: select DCACHE_WORD_ACCESS for little-endian ARMv6+ CPUs
    ARM: 7449/1: use generic strnlen_user and strncpy_from_user functions
    ARM: 7448/1: perf: remove arm_perf_pmu_ids global enumeration
    ARM: 7447/1: rwlocks: remove unused branch labels from trylock routines
    ARM: 7446/1: spinlock: use ticket algorithm for ARMv6+ locking implementation
    ARM: 7445/1: mm: update CONTEXTIDR register to contain PID of current process
    ARM: 7444/1: kernel: add arch-timer C3STOP feature
    ARM: 7460/1: remove asm/locks.h
    ARM: 7439/1: head.S: simplify initial page table mapping
    ARM: 7437/1: zImage: Allow DTB command line concatenation with ATAG_CMDLINE
    ARM: 7436/1: Do not map the vectors page as write-through on UP systems
    ...

    Linus Torvalds
     

10 Jul, 2012

1 commit

  • Make the OS timer registers have IOMEM like properities so they can
    be passed to readl_relaxed/writel_relaxed() et.al. rather than being
    straight volatile dereferences. Add linux/io.h includes where
    required.

    linux/io.h includes added to arch/arm/mach-sa1100/cpu-sa1100.c,
    arch/arm/mach-sa1100/jornada720_ssp.c, arch/arm/mach-sa1100/leds-lart.c
    drivers/input/touchscreen/jornada720_ts.c, drivers/pcmcia/sa1100_shannon.c
    from Arnd.

    This fixes these warnings:

    arch/arm/mach-sa1100/time.c: In function 'sa1100_timer_init':
    arch/arm/mach-sa1100/time.c:104: warning: passing argument 1 of 'clocksource_mmio_init' discards qualifiers from pointer target type
    arch/arm/mach-pxa/time.c: In function 'pxa_timer_init':
    arch/arm/mach-pxa/time.c:126: warning: passing argument 1 of 'clocksource_mmio_init' discards qualifiers from pointer target type

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Russell King

    Russell King
     

14 Jun, 2012

1 commit


07 May, 2012

1 commit


30 Mar, 2012

1 commit

  • Pull a few PCMCIA updates from Dominik Brodowski.

    Fix up trivial conflict (modified code in question had been removed) in
    drivers/pcmcia/soc_common.c.

    * git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia:
    pcmcia at91_cf: fix raw gpio number usage
    ARM: pxa: fix error handling in pxa2xx_drv_pcmcia_probe
    pcmcia: Convert to DEFINE_PCI_DEVICE_TABLE
    pcmcia: convert drivers/pcmcia/* to use module_platform_driver()
    pcmcia: irq: Remove IRQF_DISABLED

    Linus Torvalds
     

29 Mar, 2012

2 commits

  • …m/linux/kernel/git/dhowells/linux-asm_system

    Pull "Disintegrate and delete asm/system.h" from David Howells:
    "Here are a bunch of patches to disintegrate asm/system.h into a set of
    separate bits to relieve the problem of circular inclusion
    dependencies.

    I've built all the working defconfigs from all the arches that I can
    and made sure that they don't break.

    The reason for these patches is that I recently encountered a circular
    dependency problem that came about when I produced some patches to
    optimise get_order() by rewriting it to use ilog2().

    This uses bitops - and on the SH arch asm/bitops.h drags in
    asm-generic/get_order.h by a circuituous route involving asm/system.h.

    The main difficulty seems to be asm/system.h. It holds a number of
    low level bits with no/few dependencies that are commonly used (eg.
    memory barriers) and a number of bits with more dependencies that
    aren't used in many places (eg. switch_to()).

    These patches break asm/system.h up into the following core pieces:

    (1) asm/barrier.h

    Move memory barriers here. This already done for MIPS and Alpha.

    (2) asm/switch_to.h

    Move switch_to() and related stuff here.

    (3) asm/exec.h

    Move arch_align_stack() here. Other process execution related bits
    could perhaps go here from asm/processor.h.

    (4) asm/cmpxchg.h

    Move xchg() and cmpxchg() here as they're full word atomic ops and
    frequently used by atomic_xchg() and atomic_cmpxchg().

    (5) asm/bug.h

    Move die() and related bits.

    (6) asm/auxvec.h

    Move AT_VECTOR_SIZE_ARCH here.

    Other arch headers are created as needed on a per-arch basis."

    Fixed up some conflicts from other header file cleanups and moving code
    around that has happened in the meantime, so David's testing is somewhat
    weakened by that. We'll find out anything that got broken and fix it..

    * tag 'split-asm_system_h-for-linus-20120328' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-asm_system: (38 commits)
    Delete all instances of asm/system.h
    Remove all #inclusions of asm/system.h
    Add #includes needed to permit the removal of asm/system.h
    Move all declarations of free_initmem() to linux/mm.h
    Disintegrate asm/system.h for OpenRISC
    Split arch_align_stack() out from asm-generic/system.h
    Split the switch_to() wrapper out of asm-generic/system.h
    Move the asm-generic/system.h xchg() implementation to asm-generic/cmpxchg.h
    Create asm-generic/barrier.h
    Make asm-generic/cmpxchg.h #include asm-generic/cmpxchg-local.h
    Disintegrate asm/system.h for Xtensa
    Disintegrate asm/system.h for Unicore32 [based on ver #3, changed by gxt]
    Disintegrate asm/system.h for Tile
    Disintegrate asm/system.h for Sparc
    Disintegrate asm/system.h for SH
    Disintegrate asm/system.h for Score
    Disintegrate asm/system.h for S390
    Disintegrate asm/system.h for PowerPC
    Disintegrate asm/system.h for PA-RISC
    Disintegrate asm/system.h for MN10300
    ...

    Linus Torvalds
     
  • Remove all #inclusions of asm/system.h preparatory to splitting and killing
    it. Performed with the following command:

    perl -p -i -e 's!^#\s*include\s*.*\n!!' `grep -Irl '^#\s*include\s*' *`

    Signed-off-by: David Howells

    David Howells
     

28 Mar, 2012

2 commits

  • Pull ARM platform updates from Russell King:
    "This covers platform stuff for platforms I have a direct interest in
    (iow, I have the hardware). Essentially:
    - as we no longer support any other Acorn platforms other than RiscPC
    anymore, we can collect all that code into mach-rpc.
    - convert Acorn expansion card stuff to use IRQ allocation functions,
    and get rid of NO_IRQ from there.
    - cleanups to the ebsa110 platform to move some private stuff out of
    its header files.
    - large amount of SA11x0 updates:
    - conversion of private DMA implementation to DMA engine support
    (this actually gives us greater flexibility in drivers over the old
    API.)
    - re-worked ucb1x00 updates - convert to genirq, remove sa11x0
    dependencies, fix various minor issues
    - move platform specific sa11x0 framebuffer data into platform files
    in arch/arm instead of keeping this in the driver itself
    - update sa11x0 IrDA driver for DMA engine, and allow it to use DMA
    for SIR transmissions as well as FIR
    - rework sa1111 support for genirq, and irq allocation
    - fix sa1111 IRQ support so it works again
    - use sparse IRQ support

    After this, I have one more pull request remaining from my current
    set, which I think is going to be the most problematical as it
    generates 8 conflicts."

    Fixed up the trivial conflict in arch/arm/mach-rpc/Makefile as per
    Russell.

    * 'platforms' of git://git.linaro.org/people/rmk/linux-arm: (125 commits)
    ARM: 7343/1: sa11x0: convert to sparse IRQ
    ARM: 7342/2: sa1100: prepare for sparse irq conversion
    ARM: 7341/1: input: prepare jornada720 keyboard and ts for sa11x0 sparse irq
    ARM: 7340/1: rtc: sa1100: include mach/irqs.h instead of asm/irq.h
    ARM: sa11x0: remove unused DMA controller definitions
    ARM: sa11x0: remove old SoC private DMA driver
    USB: sa1111: add hcd .reset method
    USB: sa1111: add OHCI shutdown methods
    USB: sa1111: reorganize ohci-sa1111.c
    USB: sa1111: get rid of nasty printk(KERN_DEBUG "%s: ...", __FILE__)
    USB: sa1111: sparse and checkpatch cleanups
    ARM: sa11x0: don't static map sa1111
    ARM: sa1111: use dev_err() rather than printk()
    ARM: sa1111: cleanup sub-device registration and unregistration
    ARM: sa1111: only setup DMA for DMA capable devices
    ARM: sa1111: register sa1111 devices with dmabounce in bus notifier
    ARM: sa1111: move USB interface register definitions to ohci-sa1111.c
    ARM: sa1111: move PCMCIA interface register definitions to sa1111_generic.c
    ARM: sa1111: move PS/2 interface register definitions to sa1111p2.c
    ARM: sa1111: delete unused physical GPIO register definitions
    ...

    Linus Torvalds
     
  • Pull "ARM: device tree work" from Arnd Bergmann:
    "Most of these patches convert code from using static platform data to
    describing the hardware in the device tree. This is only the first
    half of the changes for v3.4 because a lot of patches for this topic
    came in the last week before the merge window.

    Signed-off-by: Arnd Bergmann "

    Fix up trivial conflicts in arch/arm/mach-vexpress/{Kconfig,core.h}

    * tag 'dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (86 commits)
    Document: devicetree: add OF documents for arch-mmp
    ARM: dts: append DTS file of pxa168
    ARM: mmp: append OF support on pxa168
    ARM: mmp: enable rtc clk in pxa168
    i2c: pxa: add OF support
    serial: pxa: add OF support
    arm/dts: mt_ventoux: very basic support for TeeJet Mt.Ventoux board
    ARM: OMAP2+: Remove extra ifdefs for board-generic
    ARM: OMAP2+: Fix build error when only ARCH_OMAP2/3 or 4 is selected
    ASoC: DT: Add digital microphone binding to PAZ00 board.
    ARM: dt: Add ARM PMU to tegra*.dtsi
    ARM: at91: at91sam9x5cm/dt: add leds support
    ARM: at91: usb_a9g20/dt: add gpio-keys support
    ARM: at91: at91sam9m10g45ek/dt: add gpio-keys support
    ARM: at91: at91sam9m10g45ek/dt: add leds support
    ARM: at91: usb_a9g20/dt: add leds support
    ARM: at91/pio: add new PIO3 features
    ARM: at91: add sam9_smc.o to at91sam9x5 build
    ARM: at91/tc/clocksource: Add 32 bit variant to Timer Counter
    ARM: at91/tc: add device tree support to atmel_tclib
    ...

    Linus Torvalds
     

26 Mar, 2012

1 commit


24 Mar, 2012

3 commits

  • Move the PCMCIA interface register definitions into the driver, rather
    than keeping them in a common place.

    Acked-by: Nicolas Pitre
    Signed-off-by: Russell King

    Russell King
     
  • Pull #3 ARM updates from Russell King:
    "This adds gpio support to soc_common, allowing an amount of code to be
    deleted from each PCMCIA socket driver for the PXA/SA11x0 SoCs."

    * 'pcmcia' of git://git.linaro.org/people/rmk/linux-arm:
    PCMCIA: sa1111: rename sa1111 socket drivers to have sa1111_ prefix.
    PCMCIA: make lubbock socket driver part of sa1111_cs
    PCMCIA: add Kconfig control for building sa11xx_base.c
    PCMCIA: sa1111: jornada720: no need to disable IRQs around sa1111_set_io
    PCMCIA: sa1111: pass along sa1111_pcmcia_configure_socket() failure code
    PCMCIA: soc_common: remove explicit wrprot initialization in socket drivers
    PCMCIA: soc_common: remove soc_pcmcia_*_irqs functions
    PCMCIA: sa11x0: h3600: convert to use new irq/gpio management
    PCMCIA: sa11x0: simpad: convert to use new irq/gpio management
    PCMCIA: sa11x0: shannon: convert to use new irq/gpio management
    PCMCIA: sa11x0: nanoengine: convert reset handling to use GPIO subsystem
    PCMCIA: sa11x0: nanoengine: convert to use new irq/gpio management
    PCMCIA: sa11x0: cerf: convert reset handling to use GPIO subsystem
    PCMCIA: sa11x0: cerf: convert to use new irq/gpio management
    PCMCIA: sa11x0: assabet: convert to use new irq/gpio management
    PCMCIA: sa1111: use new per-socket irq/gpio infrastructure
    PCMCIA: pxa: convert PXA socket drivers to use new irq/gpio management
    PCMCIA: soc_common: add GPIO support for card status signals
    PCMCIA: soc_common: move common initialization into soc_common

    Linus Torvalds
     
  • Pull PCI changes (including maintainer change) from Jesse Barnes:
    "This pull has some good cleanups from Bjorn and Yinghai, as well as
    some more code from Yinghai to better handle resource re-allocation
    when enabled.

    There's also a new initcall_debug feature from Arjan which will print
    out quirk timing information to help identify slow quirks for fixing
    or refinement (Yinghai sent in a few patches to do just that once the
    new debug code landed).

    Beyond that, I'm handing off PCI maintainership to Bjorn Helgaas.
    He's been a core PCI and Linux contributor for some time now, and has
    kindly volunteered to take over. I just don't feel I have the time
    for PCI review and work that it deserves lately (I've taken on some
    other projects), and haven't been as responsive lately as I'd like, so
    I approached Bjorn asking if he'd like to manage things. He's going
    to give it a try, and I'm confident he'll do at least as well as I
    have in keeping the tree managed, patches flowing, and keeping things
    stable."

    Fix up some fairly trivial conflicts due to other cleanups (mips device
    resource fixup cleanups clashing with list handling cleanup, ppc iseries
    removal clashing with pci_probe_only cleanup etc)

    * 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci: (112 commits)
    PCI: Bjorn gets PCI hotplug too
    PCI: hand PCI maintenance over to Bjorn Helgaas
    unicore32/PCI: move include to asm/pci.h
    sparc/PCI: convert devtree and arch-probed bus addresses to resource
    powerpc/PCI: allow reallocation on PA Semi
    powerpc/PCI: convert devtree bus addresses to resource
    powerpc/PCI: compute I/O space bus-to-resource offset consistently
    arm/PCI: don't export pci_flags
    PCI: fix bridge I/O window bus-to-resource conversion
    x86/PCI: add spinlock held check to 'pcibios_fwaddrmap_lookup()'
    PCI / PCIe: Introduce command line option to disable ARI
    PCI: make acpihp use __pci_remove_bus_device instead
    PCI: export __pci_remove_bus_device
    PCI: Rename pci_remove_behind_bridge to pci_stop_and_remove_behind_bridge
    PCI: Rename pci_remove_bus_device to pci_stop_and_remove_bus_device
    PCI: print out PCI device info along with duration
    PCI: Move "pci reassigndev resource alignment" out of quirks.c
    PCI: Use class for quirk for usb host controller fixup
    PCI: Use class for quirk for ti816x class fixup
    PCI: Use class for quirk for intel e100 interrupt fixup
    ...

    Linus Torvalds
     

10 Mar, 2012

1 commit


09 Mar, 2012

1 commit


03 Mar, 2012

5 commits

  • This patches fixes two things:
    * Use gpio_valid function to check gpio before usage
    This must be done after 63b4c29678500 which uses -EINVAL for unused pin's
    * Use gpio_to_irq to convert gpio's to irq
    The driver assumed a 1:1 mapping between gpio and irq numbers. This is no
    longer true after d0fbda9add3281.

    Tested on custom RM9200 board with 8gb CF card.

    Signed-off-by: Joachim Eastwood
    Acked-by: Jean-Christophe PLAGNIOL-VILLARD
    Signed-off-by: Dominik Brodowski

    Joachim Eastwood
     
  • If pxa2xx_drv_pcmcia_add_one fails, it will go to err1 error path.
    Add a missing clk_put in the error path.

    Checking the ret value after the for loop is redundant, it is always false.
    Thus remove the redundant checking.

    Signed-off-by: Axel Lin
    Acked-by: Eric Miao
    Acked-by: Marek Vasut
    Signed-off-by: Dominik Brodowski

    Axel Lin
     
  • Convert static struct pci_device_id *[] to static DEFINE_PCI_DEVICE_TABLE
    tables. Also convert to use PCI_DEVICE macro for better readablity.

    Signed-off-by: Axel Lin
    Signed-off-by: Dominik Brodowski

    Axel Lin
     
  • This patch converts the drivers in drivers/pcmcia/* to use the
    module_platform_driver() macro which makes the code smaller and a bit
    simpler.

    Signed-off-by: Axel Lin
    Acked-by: Wolfram Sang
    Acked-by: Olof Johansson
    Acked-by: Michael Hennerich
    Acked-by: Marc Zyngier [for the viper part]
    Acked-by: Manuel Lauss [for the db1xxx_ss.c part]
    Signed-off-by: Dominik Brodowski

    Axel Lin
     
  • Since commit [e58aa3d2: genirq: Run irq handlers with interrupts disabled],
    We run all interrupt handlers with interrupts disabled
    and we even check and yell when an interrupt handler
    returns with interrupts enabled (see commit [b738a50a:
    genirq: Warn when handler enables interrupts]).

    So now this flag is a NOOP and can be removed.

    Signed-off-by: Yong Zhang
    Acked-by: Wolfram Sang
    Signed-off-by: Dominik Brodowski

    Yong Zhang
     

29 Feb, 2012

1 commit

  • …nto at91/staging/base2+cleanup

    * 'at91-3.4-base2+cleanup' of git://github.com/at91linux/linux-at91: (20 commits)
    ARM: at91: properly sort dtb files in Makefile.boot
    ARM: at91: add at91sam9g25ek.dts in Makefile.boot
    ARM: at91/board-dt: drop default console
    Atmel: move console default platform_device to serial driver
    ARM: at91: merge SRAM Memory banks thanks to mirroring
    ARM: at91: finally drop at91_sys_read/write
    ARM: at91/rtc-at91sam9: pass the GPBR to use via resources
    ARM: at91:rtc/rtc-at91sam9: ioremap register bank
    ARM: at91/rtc-at91sam9: each SoC can select the RTT device to use
    ARM: at91/PMC: make register base soc independent
    ARM: at91/PMC: move assignment out of printf
    ARM: at91/pm_slowclock: add runtime detection of memory contoller
    ARM: at91: make sdram/ddr register base soc independent
    ARM: at91: move at91rm9200 sdramc defines to at91rm9200_sdramc.h
    ARM: at91/pm_slowclock: function slow_clock() accepts parameters
    ARM: at91/pm_slowclock: rename register to named define
    ARM: at91/ST: remove not needed casts
    ARM: at91: make ST (System Timer) soc independent
    ARM: at91: make matrix register base soc independent
    ARM: at91/at91x40: remove use of at91_sys_read/write

    Based on top of the at91/9x5, rmk/for-armsoc, at91/device-board,
    at91/pm_cleanup and at91/base.

    Signed-off-by: Arnd Bergmann <arnd@arndb.de>

    Arnd Bergmann
     

28 Feb, 2012

1 commit


23 Feb, 2012

1 commit


21 Feb, 2012

10 commits


16 Feb, 2012

1 commit

  • If pxa2xx_drv_pcmcia_add_one fails, it will go to err1 error path.
    Add a missing clk_put in the error path.

    Checking the ret value after the for loop is redundant, it is always false.
    Thus remove the redundant checking.

    Signed-off-by: Axel Lin
    Acked-by: Eric Miao
    Acked-by: Marek Vasut
    Signed-off-by: Haojian Zhuang

    Axel Lin
     

09 Feb, 2012

3 commits

  • Add platform hooks to be called when individual sa1111 devices are
    enabled and disabled. This will allow us to move some platform
    specifics out of the individual drivers.

    Acked-by: Nicolas Pitre
    Signed-off-by: Russell King

    Russell King
     
  • Rather than having direct register accesses to NCR_0 scattered amongst
    the code, provide a function instead. This contains the necessary
    race protection for this platform, ensuring that updates to this
    register are safe.

    Signed-off-by: Russell King

    Russell King
     
  • This fixes a memory-corrupting bug: not only does it cause the warning,
    but as a result of dropping the refcount to zero, it causes the
    pcmcia_socket0 device structure to be freed while it still has
    references, causing slab caches corruption. A fatal oops quickly
    follows this warning - often even just a 'dmesg' following the warning
    causes the kernel to oops.

    While testing suspend/resume on an ARM device with PCMCIA support, and a
    CF card inserted, I found that after five suspend and resumes, the
    kernel would complain, and shortly die after with slab corruption.

    WARNING: at include/linux/kref.h:41 kobject_get+0x28/0x50()

    As the message doesn't give a clue about which kobject, and the built-in
    debugging in drivers/base/power/main.c happens too late, this was added
    right before each get_device():

    printk("%s: %p [%s] %u\n", __func__, dev, kobject_name(&dev->kobj), atomic_read(&dev->kobj.kref.refcount));

    and on the 3rd s2ram cycle, the following behaviour observed:

    On the 3rd suspend/resume cycle:

    dpm_prepare: c1a0d998 [pcmcia_socket0] 3
    dpm_suspend: c1a0d998 [pcmcia_socket0] 3
    dpm_suspend_noirq: c1a0d998 [pcmcia_socket0] 3
    dpm_resume_noirq: c1a0d998 [pcmcia_socket0] 3
    dpm_resume: c1a0d998 [pcmcia_socket0] 3
    dpm_complete: c1a0d998 [pcmcia_socket0] 2

    4th:

    dpm_prepare: c1a0d998 [pcmcia_socket0] 2
    dpm_suspend: c1a0d998 [pcmcia_socket0] 2
    dpm_suspend_noirq: c1a0d998 [pcmcia_socket0] 2
    dpm_resume_noirq: c1a0d998 [pcmcia_socket0] 2
    dpm_resume: c1a0d998 [pcmcia_socket0] 2
    dpm_complete: c1a0d998 [pcmcia_socket0] 1

    5th:

    dpm_prepare: c1a0d998 [pcmcia_socket0] 1
    dpm_suspend: c1a0d998 [pcmcia_socket0] 1
    dpm_suspend_noirq: c1a0d998 [pcmcia_socket0] 1
    dpm_resume_noirq: c1a0d998 [pcmcia_socket0] 1
    dpm_resume: c1a0d998 [pcmcia_socket0] 1
    dpm_complete: c1a0d998 [pcmcia_socket0] 0
    ------------[ cut here ]------------
    WARNING: at include/linux/kref.h:41 kobject_get+0x28/0x50()
    Modules linked in: ucb1x00_core
    Backtrace:
    [] (dump_backtrace+0x0/0x110) from [] (dump_stack+0x18/0x1c)
    [] (dump_stack+0x0/0x1c) from [] (warn_slowpath_common+0x50/0x68)
    [] (warn_slowpath_common+0x0/0x68) from [] (warn_slowpath_null+0x24/0x28)
    [] (warn_slowpath_null+0x0/0x28) from [] (kobject_get+0x28/0x50)
    [] (kobject_get+0x0/0x50) from [] (get_device+0x1c/0x24)
    [] (dpm_complete+0x0/0x1a0) from [] (dpm_resume_end+0x1c/0x20)
    ...

    Looking at commit 7b24e7988263 ("pcmcia: split up central event handler"),
    the following change was made to cs.c:

    return 0;
    }
    #endif
    -
    - send_event(skt, CS_EVENT_PM_RESUME, CS_EVENT_PRI_LOW);
    + if (!(skt->state & SOCKET_CARDBUS) && (skt->callback))
    + skt->callback->early_resume(skt);
    return 0;
    }

    And the corresponding change in ds.c is from:

    -static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
    -{
    - struct pcmcia_socket *s = pcmcia_get_socket(skt);
    ...
    - switch (event) {
    ...
    - case CS_EVENT_PM_RESUME:
    - if (verify_cis_cache(skt) != 0) {
    - dev_dbg(&skt->dev, "cis mismatch - different card\n");
    - /* first, remove the card */
    - ds_event(skt, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH);
    - mutex_lock(&s->ops_mutex);
    - destroy_cis_cache(skt);
    - kfree(skt->fake_cis);
    - skt->fake_cis = NULL;
    - s->functions = 0;
    - mutex_unlock(&s->ops_mutex);
    - /* now, add the new card */
    - ds_event(skt, CS_EVENT_CARD_INSERTION,
    - CS_EVENT_PRI_LOW);
    - }
    - break;
    ...
    - }

    - pcmcia_put_socket(s);

    - return 0;
    -} /* ds_event */

    to:

    +static int pcmcia_bus_early_resume(struct pcmcia_socket *skt)
    +{
    + if (!verify_cis_cache(skt)) {
    + pcmcia_put_socket(skt);
    + return 0;
    + }

    + dev_dbg(&skt->dev, "cis mismatch - different card\n");

    + /* first, remove the card */
    + pcmcia_bus_remove(skt);
    + mutex_lock(&skt->ops_mutex);
    + destroy_cis_cache(skt);
    + kfree(skt->fake_cis);
    + skt->fake_cis = NULL;
    + skt->functions = 0;
    + mutex_unlock(&skt->ops_mutex);

    + /* now, add the new card */
    + pcmcia_bus_add(skt);
    + return 0;
    +}

    As can be seen, the original function called pcmcia_get_socket() and
    pcmcia_put_socket() around the guts, whereas the replacement code
    calls pcmcia_put_socket() only in one path. This creates an imbalance
    in the refcounting.

    Testing with pcmcia_put_socket() put removed shows that the bug is gone:

    dpm_suspend: c1a10998 [pcmcia_socket0] 5
    dpm_suspend_noirq: c1a10998 [pcmcia_socket0] 5
    dpm_resume_noirq: c1a10998 [pcmcia_socket0] 5
    dpm_resume: c1a10998 [pcmcia_socket0] 5
    dpm_complete: c1a10998 [pcmcia_socket0] 5

    Tested-by: Russell King
    Signed-off-by: Russell King
    Cc: Dominik Brodowski
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Russell King
     

04 Feb, 2012

3 commits