Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

i2c/isp1301_omap: Build fixes

Build fixes for isp1301_omap; no behavior changes:

- fix incorrect probe() signature (it changed many months ago)
- provide missing functions on H3 and H4 boards
- "sparse" fixes (static, NULL-vs-0)

The H3 build bits subset some of the stuff that was previously in
the OMAP tree but never went to mainline.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>

authored by

David Brownell and committed by
Jean Delvare
d1846b0e ed313489

+47 -18
+47 -18
drivers/i2c/chips/isp1301_omap.c
··· 25 25 #include <linux/slab.h> 26 26 #include <linux/interrupt.h> 27 27 #include <linux/platform_device.h> 28 + #include <linux/gpio.h> 28 29 #include <linux/usb/ch9.h> 29 30 #include <linux/usb/gadget.h> 30 31 #include <linux/usb.h> ··· 34 33 #include <linux/workqueue.h> 35 34 36 35 #include <asm/irq.h> 36 + #include <asm/mach-types.h> 37 + 37 38 #include <mach/usb.h> 39 + #include <mach/mux.h> 38 40 39 41 40 42 #ifndef DEBUG ··· 92 88 93 89 /*-------------------------------------------------------------------------*/ 94 90 95 - #ifdef CONFIG_MACH_OMAP_H2 96 - 97 91 /* board-specific PM hooks */ 98 92 99 - #include <asm/gpio.h> 100 - #include <mach/mux.h> 101 - #include <asm/mach-types.h> 102 - 93 + #if defined(CONFIG_MACH_OMAP_H2) || defined(CONFIG_MACH_OMAP_H3) 103 94 104 95 #if defined(CONFIG_TPS65010) || defined(CONFIG_TPS65010_MODULE) 105 96 ··· 115 116 int status = tps65010_set_vbus_draw(mA); 116 117 if (status < 0) 117 118 pr_debug(" VBUS %d mA error %d\n", mA, status); 119 + } 120 + 121 + static void enable_vbus_source(struct isp1301 *isp) 122 + { 123 + /* this board won't supply more than 8mA vbus power. 124 + * some boards can switch a 100ma "unit load" (or more). 125 + */ 126 + } 127 + 128 + 129 + /* products will deliver OTG messages with LEDs, GUI, etc */ 130 + static inline void notresponding(struct isp1301 *isp) 131 + { 132 + printk(KERN_NOTICE "OTG device not responding.\n"); 133 + } 134 + 135 + 136 + #endif 137 + 138 + #if defined(CONFIG_MACH_OMAP_H4) 139 + 140 + static void enable_vbus_draw(struct isp1301 *isp, unsigned mA) 141 + { 142 + /* H4 controls this by DIP switch S2.4; no soft control. 143 + * ON means the charger is always enabled. Leave it OFF 144 + * unless the OTG port is used only in B-peripheral mode. 145 + */ 118 146 } 119 147 120 148 static void enable_vbus_source(struct isp1301 *isp) ··· 360 334 * NOTE: guaranteeing certain response times might mean we shouldn't 361 335 * share keventd's work queue; a realtime task might be safest. 362 336 */ 363 - void 364 - isp1301_defer_work(struct isp1301 *isp, int work) 337 + static void isp1301_defer_work(struct isp1301 *isp, int work) 365 338 { 366 339 int status; 367 340 ··· 536 511 otg_ctrl = omap_readl(OTG_CTRL) & OTG_CTRL_MASK; 537 512 otg_ctrl &= ~OTG_XCEIV_INPUTS; 538 513 otg_ctrl &= ~(OTG_ID|OTG_ASESSVLD|OTG_VBUSVLD); 539 - 540 514 541 515 if (int_src & INTR_SESS_VLD) 542 516 otg_ctrl |= OTG_ASESSVLD; ··· 910 886 911 887 static int otg_remove(struct platform_device *dev) 912 888 { 913 - otg_dev = 0; 889 + otg_dev = NULL; 914 890 return 0; 915 891 } 916 892 917 - struct platform_driver omap_otg_driver = { 893 + static struct platform_driver omap_otg_driver = { 918 894 .probe = otg_probe, 919 895 .remove = otg_remove, 920 896 .driver = { ··· 1236 1212 1237 1213 isp = dev_get_drvdata(dev); 1238 1214 1215 + /* FIXME -- not with a "new style" driver, it doesn't!! */ 1216 + 1239 1217 /* ugly -- i2c hijacks our memory hook to wait_for_completion() */ 1240 1218 if (isp->i2c_release) 1241 1219 isp->i2c_release(dev); ··· 1259 1233 otg_unbind(isp); 1260 1234 #endif 1261 1235 if (machine_is_omap_h2()) 1262 - omap_free_gpio(2); 1236 + gpio_free(2); 1263 1237 1264 1238 isp->timer.data = 0; 1265 1239 set_bit(WORK_STOP, &isp->todo); ··· 1267 1241 flush_scheduled_work(); 1268 1242 1269 1243 put_device(&i2c->dev); 1270 - the_transceiver = 0; 1244 + the_transceiver = NULL; 1271 1245 1272 1246 return 0; 1273 1247 } ··· 1321 1295 if (!host) { 1322 1296 omap_writew(0, OTG_IRQ_EN); 1323 1297 power_down(isp); 1324 - isp->otg.host = 0; 1298 + isp->otg.host = NULL; 1325 1299 return 0; 1326 1300 } 1327 1301 ··· 1370 1344 isp1301_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget) 1371 1345 { 1372 1346 struct isp1301 *isp = container_of(otg, struct isp1301, otg); 1347 + #ifndef CONFIG_USB_OTG 1373 1348 u32 l; 1349 + #endif 1374 1350 1375 1351 if (!otg || isp != the_transceiver) 1376 1352 return -ENODEV; ··· 1382 1354 if (!isp->otg.default_a) 1383 1355 enable_vbus_draw(isp, 0); 1384 1356 usb_gadget_vbus_disconnect(isp->otg.gadget); 1385 - isp->otg.gadget = 0; 1357 + isp->otg.gadget = NULL; 1386 1358 power_down(isp); 1387 1359 return 0; 1388 1360 } ··· 1407 1379 power_up(isp); 1408 1380 isp->otg.state = OTG_STATE_B_IDLE; 1409 1381 1410 - if (machine_is_omap_h2()) 1382 + if (machine_is_omap_h2() || machine_is_omap_h3()) 1411 1383 isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0); 1412 1384 1413 1385 isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING, ··· 1527 1499 1528 1500 /*-------------------------------------------------------------------------*/ 1529 1501 1530 - static int __init isp1301_probe(struct i2c_client *i2c) 1502 + static int __init 1503 + isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id) 1531 1504 { 1532 1505 int status; 1533 1506 struct isp1301 *isp; ··· 1676 1647 static void __exit isp_exit(void) 1677 1648 { 1678 1649 if (the_transceiver) 1679 - otg_set_transceiver(0); 1650 + otg_set_transceiver(NULL); 1680 1651 i2c_del_driver(&isp1301_driver); 1681 1652 } 1682 1653 module_exit(isp_exit);