go7007: Convert to the new i2c device binding model

Move the go7007 driver away from the legacy i2c binding model, which
is going away really soon now.

The I2C addresses of the audio and video chips in s2250-board didn't
look quite right, apparently they were left-aligned values when Linux
wants right-aligned values, so I fixed them too.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
diff --git a/drivers/staging/go7007/wis-ov7640.c b/drivers/staging/go7007/wis-ov7640.c
index 2f9efca..04d6d3a 100644
--- a/drivers/staging/go7007/wis-ov7640.c
+++ b/drivers/staging/go7007/wis-ov7640.c
@@ -50,76 +50,54 @@
 	return 0;
 }
 
-static struct i2c_driver wis_ov7640_driver;
-
-static struct i2c_client wis_ov7640_client_templ = {
-	.name		= "OV7640 (WIS)",
-	.driver		= &wis_ov7640_driver,
-};
-
-static int wis_ov7640_detect(struct i2c_adapter *adapter, int addr, int kind)
+static int wis_ov7640_probe(struct i2c_client *client,
+			    const struct i2c_device_id *id)
 {
-	struct i2c_client *client;
+	struct i2c_adapter *adapter = client->adapter;
 
 	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
-		return 0;
+		return -ENODEV;
 
-	client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
-	if (client == NULL)
-		return -ENOMEM;
-	memcpy(client, &wis_ov7640_client_templ,
-			sizeof(wis_ov7640_client_templ));
-	client->adapter = adapter;
-	client->addr = addr;
 	client->flags = I2C_CLIENT_SCCB;
 
 	printk(KERN_DEBUG
 		"wis-ov7640: initializing OV7640 at address %d on %s\n",
-		addr, adapter->name);
+		client->addr, adapter->name);
 
 	if (write_regs(client, initial_registers) < 0) {
 		printk(KERN_ERR "wis-ov7640: error initializing OV7640\n");
-		kfree(client);
-		return 0;
+		return -ENODEV;
 	}
 
-	i2c_attach_client(client);
 	return 0;
 }
 
-static int wis_ov7640_detach(struct i2c_client *client)
+static int wis_ov7640_remove(struct i2c_client *client)
 {
-	int r;
-
-	r = i2c_detach_client(client);
-	if (r < 0)
-		return r;
-
-	kfree(client);
 	return 0;
 }
 
+static struct i2c_device_id wis_ov7640_id[] = {
+	{ "wis_ov7640", 0 },
+	{ }
+};
+
 static struct i2c_driver wis_ov7640_driver = {
 	.driver = {
 		.name	= "WIS OV7640 I2C driver",
 	},
-	.id		= I2C_DRIVERID_WIS_OV7640,
-	.detach_client	= wis_ov7640_detach,
+	.probe		= wis_ov7640_probe,
+	.remove		= wis_ov7640_remove,
+	.id_table	= wis_ov7640_id,
 };
 
 static int __init wis_ov7640_init(void)
 {
-	int r;
-
-	r = i2c_add_driver(&wis_ov7640_driver);
-	if (r < 0)
-		return r;
-	return wis_i2c_add_driver(wis_ov7640_driver.id, wis_ov7640_detect);
+	return i2c_add_driver(&wis_ov7640_driver);
 }
 
 static void __exit wis_ov7640_cleanup(void)
 {
-	wis_i2c_del_driver(wis_ov7640_detect);
 	i2c_del_driver(&wis_ov7640_driver);
 }