aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-24 15:46:24 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-24 15:46:24 -0400
commitbdaf12b41235b0c59949914de022341e77907461 (patch)
tree2473bf0e3a28fdc2285cf830c9a259d9b85a4061 /include
parent7c024e9534f9edd8d052380a1b40d376c8feb11b (diff)
parentbf5d95c82692ead9ba7876af73dac2edcc8a6191 (diff)
Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging: i2c-viapro: Don't log nacks i2c/pca954x: Remove __devinit and __devexit from probe and remove functions MAINTAINERS: Add maintainer for PCA9541 I2C bus master selector driver i2c/mux: Driver for PCA9541 I2C Master Selector i2c: Optimize function i2c_detect() i2c: Discard warning message on device instantiation from user-space i2c-amd8111: Add proper error handling i2c: Change to new flag variable i2c: Remove unneeded inclusions of <linux/i2c-id.h> i2c: Let i2c_parent_is_i2c_adapter return the parent adapter i2c: Simplify i2c_parent_is_i2c_adapter i2c-pca-platform: Change device name of request_irq i2c: Fix Kconfig dependencies
Diffstat (limited to 'include')
-rw-r--r--include/linux/i2c.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 4bae0b72ed3c..1f66fa06a97c 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -384,11 +384,15 @@ static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data)
384 dev_set_drvdata(&dev->dev, data); 384 dev_set_drvdata(&dev->dev, data);
385} 385}
386 386
387static inline int i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter) 387static inline struct i2c_adapter *
388i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter)
388{ 389{
389 return adapter->dev.parent != NULL 390 struct device *parent = adapter->dev.parent;
390 && adapter->dev.parent->bus == &i2c_bus_type 391
391 && adapter->dev.parent->type == &i2c_adapter_type; 392 if (parent != NULL && parent->type == &i2c_adapter_type)
393 return to_i2c_adapter(parent);
394 else
395 return NULL;
392} 396}
393 397
394/* Adapter locking functions, exported for shared pin cases */ 398/* Adapter locking functions, exported for shared pin cases */