diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-11-15 17:03:17 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-11-15 17:03:17 -0500 |
commit | fe9d1159b299642f9e1a9b56bbf67a24c31bb418 (patch) | |
tree | 530c6e41beb784adb16a1faae2839edbad2fbb7f /drivers/i2c | |
parent | e5c13537b0153010b4f65b9c55faa78a4c151c93 (diff) | |
parent | 2236baa75f704851d3cd3310569058151acb1f06 (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: Sanity checks on adapter registration
i2c: Mark i2c_adapter.id as deprecated
i2c: Drivers shouldn't include <linux/i2c-id.h>
i2c: Delete unused adapter IDs
i2c: Remove obsolete cleanup for clientdata
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/i2c-core.c | 12 | ||||
-rw-r--r-- | drivers/i2c/i2c-mux.c | 1 |
2 files changed, 12 insertions, 1 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index d231f683f576..6b4cc567645b 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -848,6 +848,18 @@ static int i2c_register_adapter(struct i2c_adapter *adap) | |||
848 | goto out_list; | 848 | goto out_list; |
849 | } | 849 | } |
850 | 850 | ||
851 | /* Sanity checks */ | ||
852 | if (unlikely(adap->name[0] == '\0')) { | ||
853 | pr_err("i2c-core: Attempt to register an adapter with " | ||
854 | "no name!\n"); | ||
855 | return -EINVAL; | ||
856 | } | ||
857 | if (unlikely(!adap->algo)) { | ||
858 | pr_err("i2c-core: Attempt to register adapter '%s' with " | ||
859 | "no algo!\n", adap->name); | ||
860 | return -EINVAL; | ||
861 | } | ||
862 | |||
851 | rt_mutex_init(&adap->bus_lock); | 863 | rt_mutex_init(&adap->bus_lock); |
852 | mutex_init(&adap->userspace_clients_lock); | 864 | mutex_init(&adap->userspace_clients_lock); |
853 | INIT_LIST_HEAD(&adap->userspace_clients); | 865 | INIT_LIST_HEAD(&adap->userspace_clients); |
diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c index d32a4843fc3a..d7a4833be416 100644 --- a/drivers/i2c/i2c-mux.c +++ b/drivers/i2c/i2c-mux.c | |||
@@ -120,7 +120,6 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent, | |||
120 | snprintf(priv->adap.name, sizeof(priv->adap.name), | 120 | snprintf(priv->adap.name, sizeof(priv->adap.name), |
121 | "i2c-%d-mux (chan_id %d)", i2c_adapter_id(parent), chan_id); | 121 | "i2c-%d-mux (chan_id %d)", i2c_adapter_id(parent), chan_id); |
122 | priv->adap.owner = THIS_MODULE; | 122 | priv->adap.owner = THIS_MODULE; |
123 | priv->adap.id = parent->id; | ||
124 | priv->adap.algo = &priv->algo; | 123 | priv->adap.algo = &priv->algo; |
125 | priv->adap.algo_data = priv; | 124 | priv->adap.algo_data = priv; |
126 | priv->adap.dev.parent = &parent->dev; | 125 | priv->adap.dev.parent = &parent->dev; |