aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio (follow)
AgeCommit message (Collapse)AuthorFilesLines
2010-09-09gpio: sx150x: correct and refine reset-on-probe behaviorGregory Bean1-5/+21
Replace the arbitrary software-reset call from the device-probe method, because: - It is defective. To work correctly, it should be two byte writes, not a single word write. As it stands, it does nothing. - Some devices with sx150x expanders installed have their NRESET pins ganged on the same line, so resetting one causes the others to reset - not a nice thing to do arbitrarily! - The probe, usually taking place at boot, implies a recent hard-reset, so a software reset at this point is just a waste of energy anyway. Therefore, make it optional, defaulting to off, as this will match the common case of probing at powerup and also matches the current broken no-op behavior. Signed-off-by: Gregory Bean <gbean@codeaurora.org> Reviewed-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-08-12gpiolib: Implement set_debounce for WM831x GPIOsMark Brown1-0/+32
The debounce times are approximate, they can be selected using the two input functions. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2010-08-12gpio: Add STMPE GPIO driverRabin Vincent3-0/+407
Add support for the GPIOs on STMPE I/O Expanders. [l.fu@pengutronix.de: fix set direction input] [l.fu@pengutronix.de: set GPIO alternate function while requesting] Acked-by: Luotao Fu <l.fu@pengutronix.de> Acked-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2010-08-11gpio: sx150x: add Semtech I2C sx150x gpio expander driverGregory Bean3-0/+657
Add support for Semtech SX150-series I2C GPIO expanders. Compatible models include: 8 bits: sx1508q 16 bits: sx1509q Signed-off-by: Gregory Bean <gbean@codeaurora.org> Cc: David Brownell <david-b@pacbell.net> Cc: Jean Delvare <khali@linux-fr.org> Cc: Trilok Soni <tsoni@codeaurora.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-08-11gpiolib: allow nested threaded irqs for poll(2)Daniel Gl?ckner1-2/+2
The pca953x driver requires the use of threaded irqs as its irq demultiplexer can sleep. Our irq handler can be called from any context, so use request_any_context_irq to allow threaded irqs as well. Signed-off-by: Daniel Gl?ckner <dg@emlix.com> Reported-by: Ian Jeffray <ian@jeffray.co.uk> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-08-11gpiolib: get rid of struct poll_desc and workletDaniel Gl?ckner1-53/+27
As sysfs_notify_dirent has been made irq safe, there is no reason to not call it directly from irq. With the work_struct removed, the remaining element in poll_desc is a sysfs_dirent pointer which may not be NULL. We can therefore store it directly in the idr and pass it as context to the irq handler. Most part of the patch deals with renaming defines and variables to reflect their new use without functional change. I also took the opportunity to initialize the idr statically. Signed-off-by: Daniel Gl?ckner <dg@emlix.com> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-08-11gpiolib: decouple might_sleep_if() from DEBUGDavid Brownell1-6/+6
Be more consistent about runtime programming interface abuse warnings, which can reduce some confusion and trigger bugfixes. Based on an observation and patch from Jani Nikula. Also update doc to highlight some sleeping-call issues and to match some recent changes. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Cc: Jani Nikula <ext-jani.1.nikula@nokia.com> Cc: "Ryan Mallon" <ryan@bluewatersys.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-08-11pcf857x: support working w/o platform dataDmitry Eremin-Solenikov1-5/+4
Provide sane defaults for pcf857x, so the driver can be used w/o providing platform data (and thus can be simply bound via OF tree). Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: David Brownell <david-b@pacbell.net> Cc: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-08-11gpio: max730x: make pullups configurable via platformdataMarc Kleine-Budde1-7/+15
The gpios on the max730x chips have support for internal pullups while in input mode. This patch adds support for configuring these pullups via platform data. A new member ("input_pullup_active") to the platform data struct is introduced. A set bit in this variable activates the pullups while the respective port is in input mode. This is a compatible enhancement since unset bits lead to disables pullups which was the default in the original driver. _Note_: the 4 lowest bits in "input_pullup_active" are unused because the first 4 ports of the controller are not used, too. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Reviewed-by: Wolfram Sang <w.sang@pengutronix.de> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-08-05Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6Linus Torvalds2-15/+55
* 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6: (63 commits) of/platform: Register of_platform_drivers with an "of:" prefix of/address: Clean up function declarations of/spi: call of_register_spi_devices() from spi core code of: Provide default of_node_to_nid() implementation. of/device: Make of_device_make_bus_id() usable by other code. of/irq: Fix endian issues in parsing interrupt specifiers of: Fix phandle endian issues of/flattree: fix of_flat_dt_is_compatible() to match the full compatible string of: remove of_default_bus_ids of: make of_find_device_by_node generic microblaze: remove references to of_device and to_of_device sparc: remove references to of_device and to_of_device powerpc: remove references to of_device and to_of_device of/device: Replace of_device with platform_device in includes and core code of/device: Protect against binding of_platform_drivers to non-OF devices of: remove asm/of_device.h of: remove asm/of_platform.h of/platform: remove all of_bus_type and of_platform_bus_type references of: Merge of_platform_bus_type with platform_bus_type drivercore/of: Add OF style matching to platform bus ... Fix up trivial conflicts in arch/microblaze/kernel/Makefile due to just some obj-y removals by the devicetree branch, while the microblaze updates added a new file.
2010-07-31Merge branch 'misc' into develRussell King1-2/+2
Conflicts: arch/arm/mm/init.c
2010-07-27gpio: fix spurious printk when freeing a gpioJon Povey1-3/+4
When freeing a gpio that has not been exported, gpio_unexport() prints a debug message when it should just fall through silently. Example spurious message: gpio_unexport: gpio0 status -22 Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk> Cc: David Brownell <david-b@pacbell.net> Acked-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de> Cc: Gregory Bean <gbean@codeaurora.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-07-27ARM: Fix section build warnings for AMBA driversRussell King1-2/+2
Found in the Versatile build: WARNING: drivers/built-in.o(.data+0x14c): Section mismatch in reference from the variable pl061_gpio_driver to the (unknown reference) .init.data:(unknown) The variable pl061_gpio_driver references the (unknown reference) __initdata (unknown) WARNING: drivers/built-in.o(.data+0x40f8): Section mismatch in reference from the variable pl011_driver to the (unknown reference) .init.data:(unknown) The variable pl011_driver references the (unknown reference) __initdata (unknown) WARNING: drivers/built-in.o(.data+0x5ab4): Section mismatch in reference from the variable pl031_driver to the (unknown reference) .init.data:(unknown) The variable pl031_driver references the (unknown reference) __initdata (unknown) Basically, amba_id structures must not be __initdata. Also fix: WARNING: drivers/built-in.o(.data+0x138): Section mismatch in reference from the variable pl061_gpio_driver to the function .init.text:pl061_probe() The variable pl061_gpio_driver references the function __init pl061_probe() which is an incorrectly annotated probe function. Fix it to reflect the other AMBA bus probe functions by removing the __init attributation. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-07-24Merge commit 'v2.6.35-rc6' into devicetree/nextGrant Likely3-3/+7
Conflicts: arch/sparc/kernel/prom_64.c
2010-07-20Andres has movedAndres Salomon1-1/+1
My Collabora address is no longer enabled - update the MODULE_AUTHOR fields of drivers to my current email address. Signed-off-by: Andres Salomon <dilinger@queued.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-07-05of/gpio: add default of_xlate function if device has a node pointerAnton Vorontsov2-1/+5
Implement generic OF gpio hooks and thus make device-enabled GPIO chips (i.e. the ones that have gpio_chip->dev specified) automatically attach to the OpenFirmware subsystem. Which means that now we can handle I2C and SPI GPIO chips almost* transparently. * "Almost" because some chips still require platform data, and for these chips OF-glue is still needed, though with this change the glue will be much smaller. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Cc: David Brownell <dbrownell@users.sourceforge.net> Cc: Bill Gatliff <bgat@billgatliff.com> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Jean Delvare <khali@linux-fr.org> Cc: Andrew Morton <akpm@linux-foundation.org> CC: linux-kernel@vger.kernel.org CC: devicetree-discuss@lists.ozlabs.org
2010-07-05of/gpio: stop using device_node data pointer to find gpio_chipGrant Likely1-0/+32
Currently the kernel uses the struct device_node.data pointer to resolve a struct gpio_chip pointer from a device tree node. However, the .data member doesn't provide any type checking and there aren't any rules enforced on what it should be used for. There's no guarantee that the data stored in it actually points to an gpio_chip pointer. Instead of relying on the .data pointer, this patch modifies the code to add a lookup function which scans through the registered gpio_chips and returns the gpio_chip that has a pointer to the specified device_node. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> CC: Andrew Morton <akpm@linux-foundation.org> CC: Anton Vorontsov <avorontsov@ru.mvista.com> CC: Grant Likely <grant.likely@secretlab.ca> CC: David Brownell <dbrownell@users.sourceforge.net> CC: Bill Gatliff <bgat@billgatliff.com> CC: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org> CC: Jean Delvare <khali@linux-fr.org> CC: linux-kernel@vger.kernel.org CC: devicetree-discuss@lists.ozlabs.org
2010-07-05of/gpio: Kill of_gpio_chip and add members directly to gpio_chipAnton Vorontsov1-9/+7
The OF gpio infrastructure is great for describing GPIO connections within the device tree. However, using a GPIO binding still requires changes to the gpio controller just to add an of_gpio structure. In most cases, the gpio controller doesn't actually need any special support and the simple OF gpio mapping function is more than sufficient. Additional, the current scheme of using of_gpio_chip requires a convoluted scheme to maintain 1:1 mappings between of_gpio_chip and gpio_chip instances. If the struct of_gpio_chip data members were moved into struct gpio_chip, then it would simplify the processing of OF gpio bindings, and it would make it trivial to use device tree OF connections on existing gpiolib controller drivers. This patch eliminates the of_gpio_chip structure and moves the relevant fields into struct gpio_chip (conditional on CONFIG_OF_GPIO). This move simplifies the existing code and prepares for adding automatic device tree support to existing drivers. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Anton Vorontsov <avorontsov@ru.mvista.com> Cc: Grant Likely <grant.likely@secretlab.ca> Cc: David Brownell <dbrownell@users.sourceforge.net> Cc: Bill Gatliff <bgat@billgatliff.com> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Jean Delvare <khali@linux-fr.org>
2010-07-05gpiolib: cosmetic improvements for error handling in gpiochip_add()Anton Vorontsov1-6/+12
Hopefully it makes the code look nicer and makes it easier to extend this function. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Grant Likely <grant.likely@secretlab.ca> CC: devicetree-discuss@lists.ozlabs.org CC: linux-kernel@vger.kernel.org
2010-06-29drivers/gpio is platform-neutralDavid Brownell2-2/+6
Update Kconfig and Makefile in drivers/gpio to discourage inappropriate addition of platform-specific code. [akpm@linux-foundation.org: fix tpyo] Signed-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-05-28gpio: Fix inverted rdc321x gpio data out registersFlorian Fainelli1-1/+1
rdc_gpio_set_value_impl has the gpio data registers 1 and 2 inverted, fix this. Signed-off-by: Bernhard Loos <bernhardloos@gmail.com> Signed-off-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2010-05-28mfd: Change rdc321x resources flags to IORESOURCE_IOFlorian Fainelli1-2/+2
The rdc321x southbridge PCI device has no MEM PCI resources that we could pass to mfd_add_devices. Since 33254dd5, mfd_add_device checks for the mem_base argument that we set to NULL. Changing the resources passed to our MFD cells from IORESOURCE_MEM to IORESOURCE_IO fixes that. Since we use those resources as offsets to the PCI configuration space base address of the southbridge device this is also more adequate. Signed-off-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2010-05-28gpio: rdc321x needs to select MFD_CORERandy Dunlap1-0/+1
Fix rdc321x-southbridge build: GPIO_RDC321X needs to select MFD_CORE so that the core is built at the same (or higher) tristate level. rdc321x-southbridge.c:(.devinit.text+0x6103): undefined reference to `mfd_add_devices' rdc321x-southbridge.c:(.devexit.text+0xe5f): undefined reference to `mfd_remove_devices' Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Cc: Florian Fainelli <florian@openwrt.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2010-05-28gpio: Add TC35892 GPIO driverRabin Vincent3-0/+389
Add a GPIO driver to support the GPIOs on the TC35892 I/O Expander. Acked-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2010-05-28gpio: Update gfp/slab.h includes for rdc321xTejun Heo1-0/+1
Implicit slab.h inclusion via percpu.h is about to go away. Make sure gfp.h or slab.h is included as necessary. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: Tejun Heo <tj@kernel.org>
2010-05-28gpio: Add support for Janz VMOD-TTL Digital IO moduleIra W. Snyder3-0/+269
The Janz VMOD-TTL is a MODULbus daughterboard which fits onto any MODULbus carrier board. It essentially consists of some various logic and a Zilog Z8536 CIO Counter/Timer and Parallel IO Unit. The board must be physically configured with jumpers to enable a user to drive output signals. I am only interested in outputs, so I have made this driver as simple as possible. It only supports a very minimal subset of the features provided by the Z8536 chip. Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2010-05-28gpio: Add support for RDC321x GPIO controllerFlorian Fainelli3-1/+255
This patch adds a new GPIO driver for the RDC321x SoC GPIO controller. Signed-off-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2010-05-27drivers/gpio/it8761e_gpio: check return value of gpiochip_remove()Daniel Mack1-1/+4
This eliminates the following build warning: drivers/gpio/it8761e_gpio.c: In function `it8761e_gpio_exit': drivers/gpio/it8761e_gpio.c:220: warning: ignoring return value of `gpiochip_remove', declared with attribute warn_unused_result Signed-off-by: Daniel Mack <daniel@caiaq.de> Cc: Denis Turischev <denis@compulab.co.il> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-05-27gpio: add Penwell gpio supportAlek Du2-34/+53
Intel Penwell chip has two 96 pins GPIO blocks, which are very similiar as Intel Langwell chip GPIO block, except for pin number difference. This patch expends the original Langwell GPIO driver to support Penwell's. Signed-off-by: Alek Du <alek.du@intel.com> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-05-27gpiolib: introduce set_debounce methodFelipe Balbi1-0/+43
A few architectures, like OMAP, allow you to set a debouncing time for the gpio before generating the IRQ. Teach gpiolib about that. Mark said: : This would be generally useful for embedded systems, especially where : the interrupt concerned is a wake source. It allows drivers to avoid : spurious interrupts from noisy sources so if the hardware supports it : the driver can avoid having to explicitly wait for the signal to become : stable and software has to cope with fewer events. We've lived without : it for quite some time, though. David said: : I looked at adding debounce support to the generic GPIO calls (and thus : gpiolib) some time back, but decided against it. I forget why at this : time (check list archives) but it wasn't because of lack of utility in : certain contexts. : : One thing to watch out for is just how variable the hardware capabilities : are. Atmel GPIOs have something like a fixed number of 32K clock cycles : for debounce, twl4030 had something odd, OMAPs were more like the Atmel : chips but with a different clock. In some cases debouncing had to be : ganged, not per-GPIO. And so forth. Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> Cc: Tony Lindgren <tony@atomide.com> Cc: David Brownell <david-b@pacbell.net> Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-05-27gpiolib: make gpiochip_add() show a better error messageBen Dooks1-1/+1
The current message, 'not registered' is confusing as it implies it was not registered with something, whereas printing 'failed to register' implies it was the gpiochip_add() call that did not work correctly. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-05-27gpio: max732x: fix input configuration for open-drain pinsMarc Zyngier1-0/+7
Fix a bug I noticed while hacking on the max732x driver for interrupt support. According to the datasheets, open-drain pins have to be configured as output-high (which in that case is actually high impedance) to be used as input. Signed-off-by: Marc Zyngier <maz@misterjones.org> Acked-by: Eric Miao <eric.y.miao@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-05-27max732x: correct nr_port checking off by one errorAxel Lin1-3/+3
Setup both client_group_a and client_group_b if nr_port > 8 (not including nr_port==8). Signed-off-by: Axel Lin <axel.lin@gmail.com> Cc: Eric Miao <eric.miao@marvell.com> Cc: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-05-27pl061: fix offset value range checkingAxel Lin1-1/+1
The valid offset value is 0..PL061_GPIO_NR-1, this patch corrects the offset value range checking. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-05-27gpiolib: a gpio is unsigned, so use %u to print itUwe Kleine-König1-1/+1
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-05-27gpiolib: make names array and its values constUwe Kleine-König3-3/+3
gpiolib doesn't need to modify the names and I assume most initializers use string constants that shouldn't be modified anyhow. [akpm@linux-foundation.org: fix drivers/gpio/cs5535-gpio.c] Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Cc: Kevin Wells <kevin.wells@nxp.com> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-05-27gpio: add interrupt handling capability to max732xMarc Zyngier2-19/+343
Most of the GPIO expanders supported by the max732x driver have interrupt generation capability by reporting changes on input pins through an INT# pin. This patch implements the irq_chip functionnality (edge detection only). Signed-off-by: Marc Zyngier <maz@misterjones.org> Cc: Eric Miao <eric.y.miao@gmail.com> Cc: Jebediah Huang <jebediah.huang@gmail.com> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-05-22Merge remote branch 'origin' into secretlab/next-devicetreeGrant Likely5-16/+47
Merging in current state of Linus' tree to deal with merge conflicts and build failures in vio.c after merge. Conflicts: drivers/i2c/busses/i2c-cpm.c drivers/i2c/busses/i2c-mpc.c drivers/net/gianfar.c Also fixed up one line in arch/powerpc/kernel/vio.c to use the correct node pointer. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-05-21sysfs: Implement sysfs tagged directory support.Eric W. Biederman1-1/+1
The problem. When implementing a network namespace I need to be able to have multiple network devices with the same name. Currently this is a problem for /sys/class/net/*, /sys/devices/virtual/net/*, and potentially a few other directories of the form /sys/ ... /net/*. What this patch does is to add an additional tag field to the sysfs dirent structure. For directories that should show different contents depending on the context such as /sys/class/net/, and /sys/devices/virtual/net/ this tag field is used to specify the context in which those directories should be visible. Effectively this is the same as creating multiple distinct directories with the same name but internally to sysfs the result is nicer. I am calling the concept of a single directory that looks like multiple directories all at the same path in the filesystem tagged directories. For the networking namespace the set of directories whose contents I need to filter with tags can depend on the presence or absence of hotplug hardware or which modules are currently loaded. Which means I need a simple race free way to setup those directories as tagged. To achieve a reace free design all tagged directories are created and managed by sysfs itself. Users of this interface: - define a type in the sysfs_tag_type enumeration. - call sysfs_register_ns_types with the type and it's operations - sysfs_exit_ns when an individual tag is no longer valid - Implement mount_ns() which returns the ns of the calling process so we can attach it to a sysfs superblock. - Implement ktype.namespace() which returns the ns of a syfs kobject. Everything else is left up to sysfs and the driver layer. For the network namespace mount_ns and namespace() are essentially one line functions, and look to remain that. Tags are currently represented a const void * pointers as that is both generic, prevides enough information for equality comparisons, and is trivial to create for current users, as it is just the existing namespace pointer. The work needed in sysfs is more extensive. At each directory or symlink creating I need to check if the directory it is being created in is a tagged directory and if so generate the appropriate tag to place on the sysfs_dirent. Likewise at each symlink or directory removal I need to check if the sysfs directory it is being removed from is a tagged directory and if so figure out which tag goes along with the name I am deleting. Currently only directories which hold kobjects, and symlinks are supported. There is not enough information in the current file attribute interfaces to give us anything to discriminate on which makes it useless, and there are no potential users which makes it an uninteresting problem to solve. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Benjamin Thery <benjamin.thery@bull.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-05-20Merge branch 'topic/asoc' into for-linusTakashi Iwai1-0/+12
Conflicts: sound/soc/codecs/ad1938.c
2010-05-18of: Always use 'struct device.of_node' to get device node pointer.Grant Likely1-1/+1
The following structure elements duplicate the information in 'struct device.of_node' and so are being eliminated. This patch makes all readers of these elements use device.of_node instead. (struct of_device *)->node (struct dev_archdata *)->prom_node (sparc) (struct dev_archdata *)->of_node (powerpc & microblaze) Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-05-11it8761e_gpio: fix bug in gpio numberingDenis Turischev1-9/+9
The SIO chip contains 16 possible gpio lines, not 14. The schematic was not read carefully. Signed-off-by: Denis Turischev <denis@compulab.co.il> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-04-30Merge branch 'merge' of git://git.secretlab.ca/git/linux-2.6Linus Torvalds1-1/+2
* 'merge' of git://git.secretlab.ca/git/linux-2.6: spi: spidev_test gives error upon 1-byte transfer omap2_mcspi: small fixes of output data format omap2_mcspi: Flush posted writes spi: spi_device memory should be released instead of device. spi: release device claimed by bus_find_device_by_name of: check for IS_ERR() serial/mpc52xx_uart: Drop outdated comments gpio: potential null dereference
2010-04-29Merge master.kernel.org:/home/rmk/linux-2.6-armLinus Torvalds1-4/+10
* master.kernel.org:/home/rmk/linux-2.6-arm: ARM: 6061/1: PL061 GPIO: Bug fix - setting gpio for HIGH_LEVEL interrupt is not working. ARM: 5957/1: ARM: RealView SD/MMC Card detection and write-protect using GPIOLIB ARM: 6030/1: KS8695: enable console ARM: 6060/1: PL061 GPIO: Setting gpio val after changing direction to OUT. ARM: 6059/1: PL061 GPIO: Changing *_irq_chip_data with *_irq_data for real irqs. ARM: 6023/1: update bcmring_defconfig to latest version and fix build error ARM: fix build error in arch/arm/kernel/process.c
2010-04-29ARM: 6061/1: PL061 GPIO: Bug fix - setting gpio for HIGH_LEVEL interrupt is not working.viresh kumar1-1/+1
In current implementation of PL061, setting type of irq to HIGH_LEVEL is not working. This patch fixes this bug. Signed-off-by: Viresh Kumar <viresh.kumar@st.com> Acked-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-04-28gpio: potential null dereferenceDan Carpenter1-1/+2
Smatch found a potential null dereference in gpio_setup_irq(). The "pdesc" variable is allocated with idr_find() that can return NULL. If gpio_setup_irq() is called with 0 as gpio_flags and "pdesc" is null, it would OOPs here. Signed-off-by: Dan Carpenter <error27@gmail.com> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-04-27gpio: fix pca953x set_type 'scheduling while atomic' bugMarc Zyngier1-1/+13
Bill Gatliff reported the following bug when using the irq_chip facility of the pca953x driver on a PPC platform: BUG: scheduling while atomic: insmod/1530/0x00000002 He traced it back to an i2c transaction in pca953x_irq_set_type(), which can be called with interrupt disabled (from __setup_irq()). As the i2c controller can sleep while sending a message, this qualifies as a bad idea. This patch moves the i2c transaction to pca953x_irq_bus_sync_unlock(), where it is actually safe to send an i2c message. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Marc Zyngier <maz@misterjones.org> Reported-by: Bill Gatliff <bgat@billgatliff.com> Cc: Eric Miao <eric.y.miao@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-04-22ARM: 6060/1: PL061 GPIO: Setting gpio val after changing direction to OUT.viresh kumar1-0/+6
pl061_direction_output doesn't set value of gpio to value passed to it. This patch sets value of GPIO pin to requested value after changing direction to OUT. Signed-off-by: Viresh Kumar <viresh.kumar@st.com> Acked-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-04-22ARM: 6059/1: PL061 GPIO: Changing *_irq_chip_data with *_irq_data for real irqs.viresh kumar1-3/+3
PL061 driver is using set_irq_chip_data and get_irq_chip_data for real irq lines. It must be using *_irq_data functions instead. As chip_data is used by interrupt controllers also, which makes vic write at incorrect addresses. Signed-off-by: Viresh Kumar <viresh.kumar@st.com> Acked-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-04-07drivers/gpio/timbgpio.c: add missing unlockJulia Lawall1-4/+8
In an error handling case the lock is not unlocked. The return is converted to a goto, to share the unlock at the end of the function. A simplified version of the semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r exists@ expression E1; identifier f; @@ f (...) { <+... * spin_lock_irqsave (E1,...); ... when != E1 * return ...; ...+> } // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Cc: <richard.rojfors@pelagicore.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>