Commit fe9d1159 authored by Linus Torvalds's avatar Linus Torvalds

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
parents e5c13537 2236baa7
...@@ -554,3 +554,13 @@ Why: This is a legacy interface which have been replaced by a more ...@@ -554,3 +554,13 @@ Why: This is a legacy interface which have been replaced by a more
Who: NeilBrown <neilb@suse.de> Who: NeilBrown <neilb@suse.de>
---------------------------- ----------------------------
What: i2c_adapter.id
When: June 2011
Why: This field is deprecated. I2C device drivers shouldn't change their
behavior based on the underlying I2C adapter. Instead, the I2C
adapter driver should instantiate the I2C devices and provide the
needed platform-specific information.
Who: Jean Delvare <khali@linux-fr.org>
----------------------------
...@@ -848,6 +848,18 @@ static int i2c_register_adapter(struct i2c_adapter *adap) ...@@ -848,6 +848,18 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
goto out_list; goto out_list;
} }
/* Sanity checks */
if (unlikely(adap->name[0] == '\0')) {
pr_err("i2c-core: Attempt to register an adapter with "
"no name!\n");
return -EINVAL;
}
if (unlikely(!adap->algo)) {
pr_err("i2c-core: Attempt to register adapter '%s' with "
"no algo!\n", adap->name);
return -EINVAL;
}
rt_mutex_init(&adap->bus_lock); rt_mutex_init(&adap->bus_lock);
mutex_init(&adap->userspace_clients_lock); mutex_init(&adap->userspace_clients_lock);
INIT_LIST_HEAD(&adap->userspace_clients); INIT_LIST_HEAD(&adap->userspace_clients);
......
...@@ -120,7 +120,6 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent, ...@@ -120,7 +120,6 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent,
snprintf(priv->adap.name, sizeof(priv->adap.name), snprintf(priv->adap.name, sizeof(priv->adap.name),
"i2c-%d-mux (chan_id %d)", i2c_adapter_id(parent), chan_id); "i2c-%d-mux (chan_id %d)", i2c_adapter_id(parent), chan_id);
priv->adap.owner = THIS_MODULE; priv->adap.owner = THIS_MODULE;
priv->adap.id = parent->id;
priv->adap.algo = &priv->algo; priv->adap.algo = &priv->algo;
priv->adap.algo_data = priv; priv->adap.algo_data = priv;
priv->adap.dev.parent = &parent->dev; priv->adap.dev.parent = &parent->dev;
......
...@@ -391,7 +391,6 @@ static int saa7146_i2c_xfer(struct i2c_adapter* adapter, struct i2c_msg *msg, in ...@@ -391,7 +391,6 @@ static int saa7146_i2c_xfer(struct i2c_adapter* adapter, struct i2c_msg *msg, in
/*****************************************************************************/ /*****************************************************************************/
/* i2c-adapter helper functions */ /* i2c-adapter helper functions */
#include <linux/i2c-id.h>
/* exported algorithm data */ /* exported algorithm data */
static struct i2c_algorithm saa7146_algo = { static struct i2c_algorithm saa7146_algo = {
......
...@@ -451,7 +451,6 @@ static int imx074_probe(struct i2c_client *client, ...@@ -451,7 +451,6 @@ static int imx074_probe(struct i2c_client *client,
ret = imx074_video_probe(icd, client); ret = imx074_video_probe(icd, client);
if (ret < 0) { if (ret < 0) {
icd->ops = NULL; icd->ops = NULL;
i2c_set_clientdata(client, NULL);
kfree(priv); kfree(priv);
return ret; return ret;
} }
...@@ -468,7 +467,6 @@ static int imx074_remove(struct i2c_client *client) ...@@ -468,7 +467,6 @@ static int imx074_remove(struct i2c_client *client)
icd->ops = NULL; icd->ops = NULL;
if (icl->free_bus) if (icl->free_bus)
icl->free_bus(icl); icl->free_bus(icl);
i2c_set_clientdata(client, NULL);
client->driver = NULL; client->driver = NULL;
kfree(priv); kfree(priv);
......
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-id.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <media/ir-core.h> #include <media/ir-core.h>
......
...@@ -1174,7 +1174,6 @@ static int ov6650_probe(struct i2c_client *client, ...@@ -1174,7 +1174,6 @@ static int ov6650_probe(struct i2c_client *client,
if (ret) { if (ret) {
icd->ops = NULL; icd->ops = NULL;
i2c_set_clientdata(client, NULL);
kfree(priv); kfree(priv);
} }
...@@ -1185,7 +1184,6 @@ static int ov6650_remove(struct i2c_client *client) ...@@ -1185,7 +1184,6 @@ static int ov6650_remove(struct i2c_client *client)
{ {
struct ov6650 *priv = to_ov6650(client); struct ov6650 *priv = to_ov6650(client);
i2c_set_clientdata(client, NULL);
kfree(priv); kfree(priv);
return 0; return 0;
} }
......
...@@ -251,7 +251,6 @@ static int apds9802als_probe(struct i2c_client *client, ...@@ -251,7 +251,6 @@ static int apds9802als_probe(struct i2c_client *client,
return res; return res;
als_error1: als_error1:
i2c_set_clientdata(client, NULL);
kfree(data); kfree(data);
return res; return res;
} }
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include <linux/console.h> #include <linux/console.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/i2c-id.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/pci_ids.h> #include <linux/pci_ids.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
...@@ -733,7 +732,6 @@ static int dcon_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -733,7 +732,6 @@ static int dcon_probe(struct i2c_client *client, const struct i2c_device_id *id)
edev: edev:
platform_device_unregister(dcon_device); platform_device_unregister(dcon_device);
dcon_device = NULL; dcon_device = NULL;
i2c_set_clientdata(client, NULL);
eirq: eirq:
free_irq(DCON_IRQ, &dcon_driver); free_irq(DCON_IRQ, &dcon_driver);
einit: einit:
...@@ -757,8 +755,6 @@ static int dcon_remove(struct i2c_client *client) ...@@ -757,8 +755,6 @@ static int dcon_remove(struct i2c_client *client)
platform_device_unregister(dcon_device); platform_device_unregister(dcon_device);
cancel_work_sync(&dcon_work); cancel_work_sync(&dcon_work);
i2c_set_clientdata(client, NULL);
return 0; return 0;
} }
......
...@@ -94,7 +94,6 @@ static int __devinit riva_setup_i2c_bus(struct riva_i2c_chan *chan, ...@@ -94,7 +94,6 @@ static int __devinit riva_setup_i2c_bus(struct riva_i2c_chan *chan,
strcpy(chan->adapter.name, name); strcpy(chan->adapter.name, name);
chan->adapter.owner = THIS_MODULE; chan->adapter.owner = THIS_MODULE;
chan->adapter.id = I2C_HW_B_RIVA;
chan->adapter.class = i2c_class; chan->adapter.class = i2c_class;
chan->adapter.algo_data = &chan->algo; chan->adapter.algo_data = &chan->algo;
chan->adapter.dev.parent = &chan->par->pdev->dev; chan->adapter.dev.parent = &chan->par->pdev->dev;
......
...@@ -32,28 +32,6 @@ ...@@ -32,28 +32,6 @@
*/ */
/* --- Bit algorithm adapters */ /* --- Bit algorithm adapters */
#define I2C_HW_B_BT848 0x010005 /* BT848 video boards */
#define I2C_HW_B_RIVA 0x010010 /* Riva based graphics cards */
#define I2C_HW_B_ZR36067 0x010019 /* Zoran-36057/36067 based boards */
#define I2C_HW_B_CX2388x 0x01001b /* connexant 2388x based tv cards */ #define I2C_HW_B_CX2388x 0x01001b /* connexant 2388x based tv cards */
#define I2C_HW_B_EM28XX 0x01001f /* em28xx video capture cards */
#define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */
#define I2C_HW_B_CX23885 0x010022 /* conexant 23885 based tv cards (bus1) */
#define I2C_HW_B_AU0828 0x010023 /* auvitek au0828 usb bridge */
#define I2C_HW_B_CX231XX 0x010024 /* Conexant CX231XX USB based cards */
#define I2C_HW_B_HDPVR 0x010025 /* Hauppauge HD PVR */
/* --- SGI adapters */
#define I2C_HW_SGI_VINO 0x160000
/* --- SMBus only adapters */
#define I2C_HW_SMBUS_W9968CF 0x04000d
#define I2C_HW_SMBUS_OV511 0x04000e /* OV511(+) USB 1.1 webcam ICs */
#define I2C_HW_SMBUS_OV518 0x04000f /* OV518(+) USB 1.1 webcam ICs */
#define I2C_HW_SMBUS_CAFE 0x040012 /* Marvell 88ALP01 "CAFE" cam */
/* --- Miscellaneous adapters */
#define I2C_HW_SAA7146 0x060000 /* SAA7146 video decoder bus */
#define I2C_HW_SAA7134 0x090000 /* SAA7134 video decoder bus */
#endif /* LINUX_I2C_ID_H */ #endif /* LINUX_I2C_ID_H */
...@@ -353,7 +353,7 @@ struct i2c_algorithm { ...@@ -353,7 +353,7 @@ struct i2c_algorithm {
*/ */
struct i2c_adapter { struct i2c_adapter {
struct module *owner; struct module *owner;
unsigned int id; unsigned int id __deprecated;
unsigned int class; /* classes to allow probing for */ unsigned int class; /* classes to allow probing for */
const struct i2c_algorithm *algo; /* the algorithm to access the bus */ const struct i2c_algorithm *algo; /* the algorithm to access the bus */
void *algo_data; void *algo_data;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment