Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / i2c / chips / isp1301_omap.c
index 11d0df3..e6f1ab7 100644 (file)
@@ -27,7 +27,7 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/interrupt.h>
-#include <linux/device.h>
+#include <linux/platform_device.h>
 #include <linux/usb_ch9.h>
 #include <linux/usb_gadget.h>
 #include <linux/usb.h>
@@ -145,7 +145,6 @@ static inline void notresponding(struct isp1301 *isp)
 static unsigned short normal_i2c[] = {
        ISP_BASE, ISP_BASE + 1,
        I2C_CLIENT_END };
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
 
 I2C_CLIENT_INSMOD;
 
@@ -874,25 +873,27 @@ static int otg_init(struct isp1301 *isp)
        return 0;
 }
 
-static int otg_probe(struct device *dev)
+static int otg_probe(struct platform_device *dev)
 {
        // struct omap_usb_config *config = dev->platform_data;
 
-       otg_dev = to_platform_device(dev);
+       otg_dev = dev;
        return 0;
 }
 
-static int otg_remove(struct device *dev)
+static int otg_remove(struct platform_device *dev)
 {
        otg_dev = 0;
        return 0;
 }
 
-struct device_driver omap_otg_driver = {
-       .name           = "omap_otg",
-       .bus            = &platform_bus_type,
+struct platform_driver omap_otg_driver = {
        .probe          = otg_probe,
-       .remove         = otg_remove,   
+       .remove         = otg_remove,
+       .driver         = {
+               .owner  = THIS_MODULE,
+               .name   = "omap_otg",
+       },
 };
 
 static int otg_bind(struct isp1301 *isp)
@@ -902,7 +903,7 @@ static int otg_bind(struct isp1301 *isp)
        if (otg_dev)
                return -EBUSY;
 
-       status = driver_register(&omap_otg_driver);
+       status = platform_driver_register(&omap_otg_driver);
        if (status < 0)
                return status;
 
@@ -913,7 +914,7 @@ static int otg_bind(struct isp1301 *isp)
                status = -ENODEV;
 
        if (status < 0)
-               driver_unregister(&omap_otg_driver);
+               platform_driver_unregister(&omap_otg_driver);
        return status;
 }
 
@@ -934,13 +935,14 @@ static void otg_unbind(struct isp1301 *isp)
 
 static void b_peripheral(struct isp1301 *isp)
 {
-       enable_vbus_draw(isp, 8);
        OTG_CTRL_REG = OTG_CTRL_REG & OTG_XCEIV_OUTPUTS;
        usb_gadget_vbus_connect(isp->otg.gadget);
 
 #ifdef CONFIG_USB_OTG
+       enable_vbus_draw(isp, 8);
        otg_update_isp(isp);
 #else
+       enable_vbus_draw(isp, 100);
        /* UDC driver just set OTG_BSESSVLD */
        isp1301_set_bits(isp, ISP1301_OTG_CONTROL_1, OTG1_DP_PULLUP);
        isp1301_clear_bits(isp, ISP1301_OTG_CONTROL_1, OTG1_DP_PULLDOWN);
@@ -950,7 +952,7 @@ static void b_peripheral(struct isp1301 *isp)
 #endif
 }
 
-static int isp_update_otg(struct isp1301 *isp, u8 stat)
+static void isp_update_otg(struct isp1301 *isp, u8 stat)
 {
        u8                      isp_stat, isp_bstat;
        enum usb_otg_state      state = isp->otg.state;
@@ -1489,12 +1491,10 @@ static int isp1301_probe(struct i2c_adapter *bus, int address, int kind)
        if (the_transceiver)
                return 0;
 
-       isp = kmalloc(sizeof *isp, GFP_KERNEL);
+       isp = kzalloc(sizeof *isp, GFP_KERNEL);
        if (!isp)
                return 0;
 
-       memset(isp, 0, sizeof *isp);
-
        INIT_WORK(&isp->work, isp1301_work, isp);
        init_timer(&isp->timer);
        isp->timer.function = isp1301_timer;
@@ -1504,7 +1504,6 @@ static int isp1301_probe(struct i2c_adapter *bus, int address, int kind)
        isp->client.addr = address;
        i2c_set_clientdata(&isp->client, isp);
        isp->client.adapter = bus;
-       isp->client.id = 1301;
        isp->client.driver = &isp1301_driver;
        strlcpy(isp->client.name, DRIVER_NAME, I2C_NAME_SIZE);
        i2c = &isp->client;
@@ -1633,11 +1632,9 @@ static int isp1301_scan_bus(struct i2c_adapter *bus)
 }
 
 static struct i2c_driver isp1301_driver = {
-       .owner          = THIS_MODULE,
-       .name           = "isp1301_omap",
-       .id             = 1301,         /* FIXME "official", i2c-ids.h */
-       .class          = I2C_CLASS_HWMON,
-       .flags          = I2C_DF_NOTIFY,
+       .driver = {
+               .name   = "isp1301_omap",
+       },
        .attach_adapter = isp1301_scan_bus,
        .detach_client  = isp1301_detach_client,
 };