aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds2010-10-24 12:46:24 -0700
committerLinus Torvalds2010-10-24 12:46:24 -0700
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)
dev_set_drvdata(&dev->dev, data);
}
-static inline int i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter)
+static inline struct i2c_adapter *
+i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter)
{
- return adapter->dev.parent != NULL
- && adapter->dev.parent->bus == &i2c_bus_type
- && adapter->dev.parent->type == &i2c_adapter_type;
+ struct device *parent = adapter->dev.parent;
+
+ if (parent != NULL && parent->type == &i2c_adapter_type)
+ return to_i2c_adapter(parent);
+ else
+ return NULL;
}
/* Adapter locking functions, exported for shared pin cases */