diff options
Diffstat (limited to 'drivers')
38 files changed, 353 insertions, 321 deletions
diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c index db3946e9c66b..216e1e948ff6 100644 --- a/drivers/acpi/apei/apei-base.c +++ b/drivers/acpi/apei/apei-base.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/module.h> | 34 | #include <linux/module.h> |
35 | #include <linux/init.h> | 35 | #include <linux/init.h> |
36 | #include <linux/acpi.h> | 36 | #include <linux/acpi.h> |
37 | #include <linux/slab.h> | ||
37 | #include <linux/io.h> | 38 | #include <linux/io.h> |
38 | #include <linux/kref.h> | 39 | #include <linux/kref.h> |
39 | #include <linux/rculist.h> | 40 | #include <linux/rculist.h> |
diff --git a/drivers/acpi/atomicio.c b/drivers/acpi/atomicio.c index 814b19249616..8f8bd736d4ff 100644 --- a/drivers/acpi/atomicio.c +++ b/drivers/acpi/atomicio.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/kref.h> | 31 | #include <linux/kref.h> |
32 | #include <linux/rculist.h> | 32 | #include <linux/rculist.h> |
33 | #include <linux/interrupt.h> | 33 | #include <linux/interrupt.h> |
34 | #include <linux/slab.h> | ||
34 | #include <acpi/atomicio.h> | 35 | #include <acpi/atomicio.h> |
35 | 36 | ||
36 | #define ACPI_PFX "ACPI: " | 37 | #define ACPI_PFX "ACPI: " |
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c index 3381505c8a6c..72dae92f3cab 100644 --- a/drivers/block/cciss_scsi.c +++ b/drivers/block/cciss_scsi.c | |||
@@ -861,6 +861,7 @@ cciss_scsi_detect(int ctlr) | |||
861 | sh->n_io_port = 0; // I don't think we use these two... | 861 | sh->n_io_port = 0; // I don't think we use these two... |
862 | sh->this_id = SELF_SCSI_ID; | 862 | sh->this_id = SELF_SCSI_ID; |
863 | sh->sg_tablesize = hba[ctlr]->maxsgentries; | 863 | sh->sg_tablesize = hba[ctlr]->maxsgentries; |
864 | sh->max_cmd_len = MAX_COMMAND_SIZE; | ||
864 | 865 | ||
865 | ((struct cciss_scsi_adapter_data_t *) | 866 | ((struct cciss_scsi_adapter_data_t *) |
866 | hba[ctlr]->scsi_ctlr)->scsi_host = sh; | 867 | hba[ctlr]->scsi_ctlr)->scsi_host = sh; |
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c index 91d11631cec9..abb4ec6690fc 100644 --- a/drivers/block/cpqarray.c +++ b/drivers/block/cpqarray.c | |||
@@ -386,7 +386,7 @@ static void __devexit cpqarray_remove_one_eisa (int i) | |||
386 | } | 386 | } |
387 | 387 | ||
388 | /* pdev is NULL for eisa */ | 388 | /* pdev is NULL for eisa */ |
389 | static int __init cpqarray_register_ctlr( int i, struct pci_dev *pdev) | 389 | static int __devinit cpqarray_register_ctlr( int i, struct pci_dev *pdev) |
390 | { | 390 | { |
391 | struct request_queue *q; | 391 | struct request_queue *q; |
392 | int j; | 392 | int j; |
@@ -503,7 +503,7 @@ Enomem4: | |||
503 | return -1; | 503 | return -1; |
504 | } | 504 | } |
505 | 505 | ||
506 | static int __init cpqarray_init_one( struct pci_dev *pdev, | 506 | static int __devinit cpqarray_init_one( struct pci_dev *pdev, |
507 | const struct pci_device_id *ent) | 507 | const struct pci_device_id *ent) |
508 | { | 508 | { |
509 | int i; | 509 | int i; |
@@ -740,7 +740,7 @@ __setup("smart2=", cpqarray_setup); | |||
740 | /* | 740 | /* |
741 | * Find an EISA controller's signature. Set up an hba if we find it. | 741 | * Find an EISA controller's signature. Set up an hba if we find it. |
742 | */ | 742 | */ |
743 | static int __init cpqarray_eisa_detect(void) | 743 | static int __devinit cpqarray_eisa_detect(void) |
744 | { | 744 | { |
745 | int i=0, j; | 745 | int i=0, j; |
746 | __u32 board_id; | 746 | __u32 board_id; |
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 6b077f93acc6..7258c95e895e 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -1236,8 +1236,6 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os, | |||
1236 | /* Last part of the attaching process ... */ | 1236 | /* Last part of the attaching process ... */ |
1237 | if (ns.conn >= C_CONNECTED && | 1237 | if (ns.conn >= C_CONNECTED && |
1238 | os.disk == D_ATTACHING && ns.disk == D_NEGOTIATING) { | 1238 | os.disk == D_ATTACHING && ns.disk == D_NEGOTIATING) { |
1239 | kfree(mdev->p_uuid); /* We expect to receive up-to-date UUIDs soon. */ | ||
1240 | mdev->p_uuid = NULL; /* ...to not use the old ones in the mean time */ | ||
1241 | drbd_send_sizes(mdev, 0, 0); /* to start sync... */ | 1239 | drbd_send_sizes(mdev, 0, 0); /* to start sync... */ |
1242 | drbd_send_uuids(mdev); | 1240 | drbd_send_uuids(mdev); |
1243 | drbd_send_state(mdev); | 1241 | drbd_send_state(mdev); |
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index 632e3245d1bb..2151f18b21de 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c | |||
@@ -1114,6 +1114,12 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp | |||
1114 | mdev->new_state_tmp.i = ns.i; | 1114 | mdev->new_state_tmp.i = ns.i; |
1115 | ns.i = os.i; | 1115 | ns.i = os.i; |
1116 | ns.disk = D_NEGOTIATING; | 1116 | ns.disk = D_NEGOTIATING; |
1117 | |||
1118 | /* We expect to receive up-to-date UUIDs soon. | ||
1119 | To avoid a race in receive_state, free p_uuid while | ||
1120 | holding req_lock. I.e. atomic with the state change */ | ||
1121 | kfree(mdev->p_uuid); | ||
1122 | mdev->p_uuid = NULL; | ||
1117 | } | 1123 | } |
1118 | 1124 | ||
1119 | rv = _drbd_set_state(mdev, ns, CS_VERBOSE, NULL); | 1125 | rv = _drbd_set_state(mdev, ns, CS_VERBOSE, NULL); |
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 35603dd4e6c5..094bdc355b1f 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -302,6 +302,12 @@ struct smi_info { | |||
302 | 302 | ||
303 | static int force_kipmid[SI_MAX_PARMS]; | 303 | static int force_kipmid[SI_MAX_PARMS]; |
304 | static int num_force_kipmid; | 304 | static int num_force_kipmid; |
305 | #ifdef CONFIG_PCI | ||
306 | static int pci_registered; | ||
307 | #endif | ||
308 | #ifdef CONFIG_PPC_OF | ||
309 | static int of_registered; | ||
310 | #endif | ||
305 | 311 | ||
306 | static unsigned int kipmid_max_busy_us[SI_MAX_PARMS]; | 312 | static unsigned int kipmid_max_busy_us[SI_MAX_PARMS]; |
307 | static int num_max_busy_us; | 313 | static int num_max_busy_us; |
@@ -1018,7 +1024,7 @@ static int ipmi_thread(void *data) | |||
1018 | else if (smi_result == SI_SM_IDLE) | 1024 | else if (smi_result == SI_SM_IDLE) |
1019 | schedule_timeout_interruptible(100); | 1025 | schedule_timeout_interruptible(100); |
1020 | else | 1026 | else |
1021 | schedule_timeout_interruptible(0); | 1027 | schedule_timeout_interruptible(1); |
1022 | } | 1028 | } |
1023 | return 0; | 1029 | return 0; |
1024 | } | 1030 | } |
@@ -3314,6 +3320,8 @@ static __devinit int init_ipmi_si(void) | |||
3314 | rv = pci_register_driver(&ipmi_pci_driver); | 3320 | rv = pci_register_driver(&ipmi_pci_driver); |
3315 | if (rv) | 3321 | if (rv) |
3316 | printk(KERN_ERR PFX "Unable to register PCI driver: %d\n", rv); | 3322 | printk(KERN_ERR PFX "Unable to register PCI driver: %d\n", rv); |
3323 | else | ||
3324 | pci_registered = 1; | ||
3317 | #endif | 3325 | #endif |
3318 | 3326 | ||
3319 | #ifdef CONFIG_ACPI | 3327 | #ifdef CONFIG_ACPI |
@@ -3330,6 +3338,7 @@ static __devinit int init_ipmi_si(void) | |||
3330 | 3338 | ||
3331 | #ifdef CONFIG_PPC_OF | 3339 | #ifdef CONFIG_PPC_OF |
3332 | of_register_platform_driver(&ipmi_of_platform_driver); | 3340 | of_register_platform_driver(&ipmi_of_platform_driver); |
3341 | of_registered = 1; | ||
3333 | #endif | 3342 | #endif |
3334 | 3343 | ||
3335 | /* We prefer devices with interrupts, but in the case of a machine | 3344 | /* We prefer devices with interrupts, but in the case of a machine |
@@ -3383,11 +3392,13 @@ static __devinit int init_ipmi_si(void) | |||
3383 | if (unload_when_empty && list_empty(&smi_infos)) { | 3392 | if (unload_when_empty && list_empty(&smi_infos)) { |
3384 | mutex_unlock(&smi_infos_lock); | 3393 | mutex_unlock(&smi_infos_lock); |
3385 | #ifdef CONFIG_PCI | 3394 | #ifdef CONFIG_PCI |
3386 | pci_unregister_driver(&ipmi_pci_driver); | 3395 | if (pci_registered) |
3396 | pci_unregister_driver(&ipmi_pci_driver); | ||
3387 | #endif | 3397 | #endif |
3388 | 3398 | ||
3389 | #ifdef CONFIG_PPC_OF | 3399 | #ifdef CONFIG_PPC_OF |
3390 | of_unregister_platform_driver(&ipmi_of_platform_driver); | 3400 | if (of_registered) |
3401 | of_unregister_platform_driver(&ipmi_of_platform_driver); | ||
3391 | #endif | 3402 | #endif |
3392 | driver_unregister(&ipmi_driver.driver); | 3403 | driver_unregister(&ipmi_driver.driver); |
3393 | printk(KERN_WARNING PFX | 3404 | printk(KERN_WARNING PFX |
@@ -3478,14 +3489,16 @@ static __exit void cleanup_ipmi_si(void) | |||
3478 | return; | 3489 | return; |
3479 | 3490 | ||
3480 | #ifdef CONFIG_PCI | 3491 | #ifdef CONFIG_PCI |
3481 | pci_unregister_driver(&ipmi_pci_driver); | 3492 | if (pci_registered) |
3493 | pci_unregister_driver(&ipmi_pci_driver); | ||
3482 | #endif | 3494 | #endif |
3483 | #ifdef CONFIG_ACPI | 3495 | #ifdef CONFIG_ACPI |
3484 | pnp_unregister_driver(&ipmi_pnp_driver); | 3496 | pnp_unregister_driver(&ipmi_pnp_driver); |
3485 | #endif | 3497 | #endif |
3486 | 3498 | ||
3487 | #ifdef CONFIG_PPC_OF | 3499 | #ifdef CONFIG_PPC_OF |
3488 | of_unregister_platform_driver(&ipmi_of_platform_driver); | 3500 | if (of_registered) |
3501 | of_unregister_platform_driver(&ipmi_of_platform_driver); | ||
3489 | #endif | 3502 | #endif |
3490 | 3503 | ||
3491 | mutex_lock(&smi_infos_lock); | 3504 | mutex_lock(&smi_infos_lock); |
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 724038dab4ca..7face915b963 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
@@ -1,5 +1,5 @@ | |||
1 | # | 1 | # |
2 | # GPIO infrastructure and expanders | 2 | # platform-neutral GPIO infrastructure and expanders |
3 | # | 3 | # |
4 | 4 | ||
5 | config ARCH_WANT_OPTIONAL_GPIOLIB | 5 | config ARCH_WANT_OPTIONAL_GPIOLIB |
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index 51c3cdd41b5a..e53dcff49b4f 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile | |||
@@ -1,4 +1,8 @@ | |||
1 | # gpio support: dedicated expander chips, etc | 1 | # generic gpio support: dedicated expander chips, etc |
2 | # | ||
3 | # NOTE: platform-specific GPIO drivers don't belong in the | ||
4 | # drivers/gpio directory; put them with other platform setup | ||
5 | # code, IRQ controllers, board init, etc. | ||
2 | 6 | ||
3 | ccflags-$(CONFIG_DEBUG_GPIO) += -DDEBUG | 7 | ccflags-$(CONFIG_DEBUG_GPIO) += -DDEBUG |
4 | 8 | ||
diff --git a/drivers/rtc/rtc-davinci.c b/drivers/rtc/rtc-davinci.c index 92a8f6cacda9..34647fc1ee98 100644 --- a/drivers/rtc/rtc-davinci.c +++ b/drivers/rtc/rtc-davinci.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/bcd.h> | 29 | #include <linux/bcd.h> |
30 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
31 | #include <linux/io.h> | 31 | #include <linux/io.h> |
32 | #include <linux/slab.h> | ||
32 | 33 | ||
33 | /* | 34 | /* |
34 | * The DaVinci RTC is a simple RTC with the following | 35 | * The DaVinci RTC is a simple RTC with the following |
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index de033b7ac21f..d827ce570a8c 100644 --- a/drivers/rtc/rtc-ds1307.c +++ b/drivers/rtc/rtc-ds1307.c | |||
@@ -777,7 +777,7 @@ static int __devinit ds1307_probe(struct i2c_client *client, | |||
777 | 777 | ||
778 | read_rtc: | 778 | read_rtc: |
779 | /* read RTC registers */ | 779 | /* read RTC registers */ |
780 | tmp = ds1307->read_block_data(ds1307->client, 0, 8, buf); | 780 | tmp = ds1307->read_block_data(ds1307->client, ds1307->offset, 8, buf); |
781 | if (tmp != 8) { | 781 | if (tmp != 8) { |
782 | pr_debug("read error %d\n", tmp); | 782 | pr_debug("read error %d\n", tmp); |
783 | err = -EIO; | 783 | err = -EIO; |
@@ -862,7 +862,7 @@ read_rtc: | |||
862 | if (ds1307->regs[DS1307_REG_HOUR] & DS1307_BIT_PM) | 862 | if (ds1307->regs[DS1307_REG_HOUR] & DS1307_BIT_PM) |
863 | tmp += 12; | 863 | tmp += 12; |
864 | i2c_smbus_write_byte_data(client, | 864 | i2c_smbus_write_byte_data(client, |
865 | DS1307_REG_HOUR, | 865 | ds1307->offset + DS1307_REG_HOUR, |
866 | bin2bcd(tmp)); | 866 | bin2bcd(tmp)); |
867 | } | 867 | } |
868 | 868 | ||
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c index 9eb62a256e9a..cd6cf575902e 100644 --- a/drivers/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/serial/cpm_uart/cpm_uart_core.c | |||
@@ -930,6 +930,83 @@ static void cpm_uart_config_port(struct uart_port *port, int flags) | |||
930 | } | 930 | } |
931 | } | 931 | } |
932 | 932 | ||
933 | #if defined(CONFIG_CONSOLE_POLL) || defined(CONFIG_SERIAL_CPM_CONSOLE) | ||
934 | /* | ||
935 | * Write a string to the serial port | ||
936 | * Note that this is called with interrupts already disabled | ||
937 | */ | ||
938 | static void cpm_uart_early_write(struct uart_cpm_port *pinfo, | ||
939 | const char *string, u_int count) | ||
940 | { | ||
941 | unsigned int i; | ||
942 | cbd_t __iomem *bdp, *bdbase; | ||
943 | unsigned char *cpm_outp_addr; | ||
944 | |||
945 | /* Get the address of the host memory buffer. | ||
946 | */ | ||
947 | bdp = pinfo->tx_cur; | ||
948 | bdbase = pinfo->tx_bd_base; | ||
949 | |||
950 | /* | ||
951 | * Now, do each character. This is not as bad as it looks | ||
952 | * since this is a holding FIFO and not a transmitting FIFO. | ||
953 | * We could add the complexity of filling the entire transmit | ||
954 | * buffer, but we would just wait longer between accesses...... | ||
955 | */ | ||
956 | for (i = 0; i < count; i++, string++) { | ||
957 | /* Wait for transmitter fifo to empty. | ||
958 | * Ready indicates output is ready, and xmt is doing | ||
959 | * that, not that it is ready for us to send. | ||
960 | */ | ||
961 | while ((in_be16(&bdp->cbd_sc) & BD_SC_READY) != 0) | ||
962 | ; | ||
963 | |||
964 | /* Send the character out. | ||
965 | * If the buffer address is in the CPM DPRAM, don't | ||
966 | * convert it. | ||
967 | */ | ||
968 | cpm_outp_addr = cpm2cpu_addr(in_be32(&bdp->cbd_bufaddr), | ||
969 | pinfo); | ||
970 | *cpm_outp_addr = *string; | ||
971 | |||
972 | out_be16(&bdp->cbd_datlen, 1); | ||
973 | setbits16(&bdp->cbd_sc, BD_SC_READY); | ||
974 | |||
975 | if (in_be16(&bdp->cbd_sc) & BD_SC_WRAP) | ||
976 | bdp = bdbase; | ||
977 | else | ||
978 | bdp++; | ||
979 | |||
980 | /* if a LF, also do CR... */ | ||
981 | if (*string == 10) { | ||
982 | while ((in_be16(&bdp->cbd_sc) & BD_SC_READY) != 0) | ||
983 | ; | ||
984 | |||
985 | cpm_outp_addr = cpm2cpu_addr(in_be32(&bdp->cbd_bufaddr), | ||
986 | pinfo); | ||
987 | *cpm_outp_addr = 13; | ||
988 | |||
989 | out_be16(&bdp->cbd_datlen, 1); | ||
990 | setbits16(&bdp->cbd_sc, BD_SC_READY); | ||
991 | |||
992 | if (in_be16(&bdp->cbd_sc) & BD_SC_WRAP) | ||
993 | bdp = bdbase; | ||
994 | else | ||
995 | bdp++; | ||
996 | } | ||
997 | } | ||
998 | |||
999 | /* | ||
1000 | * Finally, Wait for transmitter & holding register to empty | ||
1001 | * and restore the IER | ||
1002 | */ | ||
1003 | while ((in_be16(&bdp->cbd_sc) & BD_SC_READY) != 0) | ||
1004 | ; | ||
1005 | |||
1006 | pinfo->tx_cur = bdp; | ||
1007 | } | ||
1008 | #endif | ||
1009 | |||
933 | #ifdef CONFIG_CONSOLE_POLL | 1010 | #ifdef CONFIG_CONSOLE_POLL |
934 | /* Serial polling routines for writing and reading from the uart while | 1011 | /* Serial polling routines for writing and reading from the uart while |
935 | * in an interrupt or debug context. | 1012 | * in an interrupt or debug context. |
@@ -999,7 +1076,7 @@ static void cpm_put_poll_char(struct uart_port *port, | |||
999 | static char ch[2]; | 1076 | static char ch[2]; |
1000 | 1077 | ||
1001 | ch[0] = (char)c; | 1078 | ch[0] = (char)c; |
1002 | cpm_uart_early_write(pinfo->port.line, ch, 1); | 1079 | cpm_uart_early_write(pinfo, ch, 1); |
1003 | } | 1080 | } |
1004 | #endif /* CONFIG_CONSOLE_POLL */ | 1081 | #endif /* CONFIG_CONSOLE_POLL */ |
1005 | 1082 | ||
@@ -1130,9 +1207,6 @@ static void cpm_uart_console_write(struct console *co, const char *s, | |||
1130 | u_int count) | 1207 | u_int count) |
1131 | { | 1208 | { |
1132 | struct uart_cpm_port *pinfo = &cpm_uart_ports[co->index]; | 1209 | struct uart_cpm_port *pinfo = &cpm_uart_ports[co->index]; |
1133 | unsigned int i; | ||
1134 | cbd_t __iomem *bdp, *bdbase; | ||
1135 | unsigned char *cp; | ||
1136 | unsigned long flags; | 1210 | unsigned long flags; |
1137 | int nolock = oops_in_progress; | 1211 | int nolock = oops_in_progress; |
1138 | 1212 | ||
@@ -1142,66 +1216,7 @@ static void cpm_uart_console_write(struct console *co, const char *s, | |||
1142 | spin_lock_irqsave(&pinfo->port.lock, flags); | 1216 | spin_lock_irqsave(&pinfo->port.lock, flags); |
1143 | } | 1217 | } |
1144 | 1218 | ||
1145 | /* Get the address of the host memory buffer. | 1219 | cpm_uart_early_write(pinfo, s, count); |
1146 | */ | ||
1147 | bdp = pinfo->tx_cur; | ||
1148 | bdbase = pinfo->tx_bd_base; | ||
1149 | |||
1150 | /* | ||
1151 | * Now, do each character. This is not as bad as it looks | ||
1152 | * since this is a holding FIFO and not a transmitting FIFO. | ||
1153 | * We could add the complexity of filling the entire transmit | ||
1154 | * buffer, but we would just wait longer between accesses...... | ||
1155 | */ | ||
1156 | for (i = 0; i < count; i++, s++) { | ||
1157 | /* Wait for transmitter fifo to empty. | ||
1158 | * Ready indicates output is ready, and xmt is doing | ||
1159 | * that, not that it is ready for us to send. | ||
1160 | */ | ||
1161 | while ((in_be16(&bdp->cbd_sc) & BD_SC_READY) != 0) | ||
1162 | ; | ||
1163 | |||
1164 | /* Send the character out. | ||
1165 | * If the buffer address is in the CPM DPRAM, don't | ||
1166 | * convert it. | ||
1167 | */ | ||
1168 | cp = cpm2cpu_addr(in_be32(&bdp->cbd_bufaddr), pinfo); | ||
1169 | *cp = *s; | ||
1170 | |||
1171 | out_be16(&bdp->cbd_datlen, 1); | ||
1172 | setbits16(&bdp->cbd_sc, BD_SC_READY); | ||
1173 | |||
1174 | if (in_be16(&bdp->cbd_sc) & BD_SC_WRAP) | ||
1175 | bdp = bdbase; | ||
1176 | else | ||
1177 | bdp++; | ||
1178 | |||
1179 | /* if a LF, also do CR... */ | ||
1180 | if (*s == 10) { | ||
1181 | while ((in_be16(&bdp->cbd_sc) & BD_SC_READY) != 0) | ||
1182 | ; | ||
1183 | |||
1184 | cp = cpm2cpu_addr(in_be32(&bdp->cbd_bufaddr), pinfo); | ||
1185 | *cp = 13; | ||
1186 | |||
1187 | out_be16(&bdp->cbd_datlen, 1); | ||
1188 | setbits16(&bdp->cbd_sc, BD_SC_READY); | ||
1189 | |||
1190 | if (in_be16(&bdp->cbd_sc) & BD_SC_WRAP) | ||
1191 | bdp = bdbase; | ||
1192 | else | ||
1193 | bdp++; | ||
1194 | } | ||
1195 | } | ||
1196 | |||
1197 | /* | ||
1198 | * Finally, Wait for transmitter & holding register to empty | ||
1199 | * and restore the IER | ||
1200 | */ | ||
1201 | while ((in_be16(&bdp->cbd_sc) & BD_SC_READY) != 0) | ||
1202 | ; | ||
1203 | |||
1204 | pinfo->tx_cur = bdp; | ||
1205 | 1220 | ||
1206 | if (unlikely(nolock)) { | 1221 | if (unlikely(nolock)) { |
1207 | local_irq_restore(flags); | 1222 | local_irq_restore(flags); |
diff --git a/drivers/staging/tm6000/tm6000-alsa.c b/drivers/staging/tm6000/tm6000-alsa.c index ce081cd44ad4..273e26ede650 100644 --- a/drivers/staging/tm6000/tm6000-alsa.c +++ b/drivers/staging/tm6000/tm6000-alsa.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/device.h> | 15 | #include <linux/device.h> |
16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
17 | #include <linux/usb.h> | 17 | #include <linux/usb.h> |
18 | #include <linux/slab.h> | ||
18 | 19 | ||
19 | #include <asm/delay.h> | 20 | #include <asm/delay.h> |
20 | #include <sound/core.h> | 21 | #include <sound/core.h> |
diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index cedd9044022f..6a9ae40c7c6d 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/i2c.h> | 24 | #include <linux/i2c.h> |
25 | #include <linux/usb.h> | 25 | #include <linux/usb.h> |
26 | #include <linux/version.h> | 26 | #include <linux/version.h> |
27 | #include <linux/slab.h> | ||
27 | #include <media/v4l2-common.h> | 28 | #include <media/v4l2-common.h> |
28 | #include <media/tuner.h> | 29 | #include <media/tuner.h> |
29 | #include <media/tvaudio.h> | 30 | #include <media/tvaudio.h> |
diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index 27f3f551b545..c3690e3580da 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
25 | #include <linux/slab.h> | ||
25 | #include <linux/usb.h> | 26 | #include <linux/usb.h> |
26 | #include <linux/i2c.h> | 27 | #include <linux/i2c.h> |
27 | #include "tm6000.h" | 28 | #include "tm6000.h" |
diff --git a/drivers/staging/tm6000/tm6000-dvb.c b/drivers/staging/tm6000/tm6000-dvb.c index 261e66acbe46..86c1c8b5f25a 100644 --- a/drivers/staging/tm6000/tm6000-dvb.c +++ b/drivers/staging/tm6000/tm6000-dvb.c | |||
@@ -18,6 +18,7 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | #include <linux/slab.h> | ||
21 | #include <linux/usb.h> | 22 | #include <linux/usb.h> |
22 | 23 | ||
23 | #include "tm6000.h" | 24 | #include "tm6000.h" |
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index de98a94d1853..a6bd53ace035 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -1272,8 +1272,7 @@ static int usb_resume_both(struct usb_device *udev, pm_message_t msg) | |||
1272 | 1272 | ||
1273 | static void choose_wakeup(struct usb_device *udev, pm_message_t msg) | 1273 | static void choose_wakeup(struct usb_device *udev, pm_message_t msg) |
1274 | { | 1274 | { |
1275 | int w, i; | 1275 | int w; |
1276 | struct usb_interface *intf; | ||
1277 | 1276 | ||
1278 | /* Remote wakeup is needed only when we actually go to sleep. | 1277 | /* Remote wakeup is needed only when we actually go to sleep. |
1279 | * For things like FREEZE and QUIESCE, if the device is already | 1278 | * For things like FREEZE and QUIESCE, if the device is already |
@@ -1285,16 +1284,10 @@ static void choose_wakeup(struct usb_device *udev, pm_message_t msg) | |||
1285 | return; | 1284 | return; |
1286 | } | 1285 | } |
1287 | 1286 | ||
1288 | /* If remote wakeup is permitted, see whether any interface drivers | 1287 | /* Enable remote wakeup if it is allowed, even if no interface drivers |
1289 | * actually want it. | 1288 | * actually want it. |
1290 | */ | 1289 | */ |
1291 | w = 0; | 1290 | w = device_may_wakeup(&udev->dev); |
1292 | if (device_may_wakeup(&udev->dev) && udev->actconfig) { | ||
1293 | for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) { | ||
1294 | intf = udev->actconfig->interface[i]; | ||
1295 | w |= intf->needs_remote_wakeup; | ||
1296 | } | ||
1297 | } | ||
1298 | 1291 | ||
1299 | /* If the device is autosuspended with the wrong wakeup setting, | 1292 | /* If the device is autosuspended with the wrong wakeup setting, |
1300 | * autoresume now so the setting can be changed. | 1293 | * autoresume now so the setting can be changed. |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index a73e08fdab36..fd4c36ea5e46 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -416,8 +416,11 @@ int usb_sg_init(struct usb_sg_request *io, struct usb_device *dev, | |||
416 | /* A length of zero means transfer the whole sg list */ | 416 | /* A length of zero means transfer the whole sg list */ |
417 | len = length; | 417 | len = length; |
418 | if (len == 0) { | 418 | if (len == 0) { |
419 | for_each_sg(sg, sg, nents, i) | 419 | struct scatterlist *sg2; |
420 | len += sg->length; | 420 | int j; |
421 | |||
422 | for_each_sg(sg, sg2, nents, j) | ||
423 | len += sg2->length; | ||
421 | } | 424 | } |
422 | } else { | 425 | } else { |
423 | /* | 426 | /* |
diff --git a/drivers/usb/gadget/f_eem.c b/drivers/usb/gadget/f_eem.c index 38226e9a371d..95dd4662d6a8 100644 --- a/drivers/usb/gadget/f_eem.c +++ b/drivers/usb/gadget/f_eem.c | |||
@@ -469,8 +469,7 @@ static int eem_unwrap(struct gether *port, | |||
469 | crc = get_unaligned_le32(skb->data + len | 469 | crc = get_unaligned_le32(skb->data + len |
470 | - ETH_FCS_LEN); | 470 | - ETH_FCS_LEN); |
471 | crc2 = ~crc32_le(~0, | 471 | crc2 = ~crc32_le(~0, |
472 | skb->data, | 472 | skb->data, len - ETH_FCS_LEN); |
473 | skb->len - ETH_FCS_LEN); | ||
474 | } else { | 473 | } else { |
475 | crc = get_unaligned_be32(skb->data + len | 474 | crc = get_unaligned_be32(skb->data + len |
476 | - ETH_FCS_LEN); | 475 | - ETH_FCS_LEN); |
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index 7d05a0be5c60..4ce899c9b165 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c | |||
@@ -321,8 +321,8 @@ struct fsg_dev; | |||
321 | /* Data shared by all the FSG instances. */ | 321 | /* Data shared by all the FSG instances. */ |
322 | struct fsg_common { | 322 | struct fsg_common { |
323 | struct usb_gadget *gadget; | 323 | struct usb_gadget *gadget; |
324 | struct fsg_dev *fsg; | 324 | struct fsg_dev *fsg, *new_fsg; |
325 | struct fsg_dev *prev_fsg; | 325 | wait_queue_head_t fsg_wait; |
326 | 326 | ||
327 | /* filesem protects: backing files in use */ | 327 | /* filesem protects: backing files in use */ |
328 | struct rw_semaphore filesem; | 328 | struct rw_semaphore filesem; |
@@ -351,7 +351,6 @@ struct fsg_common { | |||
351 | enum fsg_state state; /* For exception handling */ | 351 | enum fsg_state state; /* For exception handling */ |
352 | unsigned int exception_req_tag; | 352 | unsigned int exception_req_tag; |
353 | 353 | ||
354 | u8 config, new_config; | ||
355 | enum data_direction data_dir; | 354 | enum data_direction data_dir; |
356 | u32 data_size; | 355 | u32 data_size; |
357 | u32 data_size_from_cmnd; | 356 | u32 data_size_from_cmnd; |
@@ -595,7 +594,7 @@ static int fsg_setup(struct usb_function *f, | |||
595 | u16 w_value = le16_to_cpu(ctrl->wValue); | 594 | u16 w_value = le16_to_cpu(ctrl->wValue); |
596 | u16 w_length = le16_to_cpu(ctrl->wLength); | 595 | u16 w_length = le16_to_cpu(ctrl->wLength); |
597 | 596 | ||
598 | if (!fsg->common->config) | 597 | if (!fsg_is_set(fsg->common)) |
599 | return -EOPNOTSUPP; | 598 | return -EOPNOTSUPP; |
600 | 599 | ||
601 | switch (ctrl->bRequest) { | 600 | switch (ctrl->bRequest) { |
@@ -2303,24 +2302,20 @@ static int alloc_request(struct fsg_common *common, struct usb_ep *ep, | |||
2303 | return -ENOMEM; | 2302 | return -ENOMEM; |
2304 | } | 2303 | } |
2305 | 2304 | ||
2306 | /* | 2305 | /* Reset interface setting and re-init endpoint state (toggle etc). */ |
2307 | * Reset interface setting and re-init endpoint state (toggle etc). | 2306 | static int do_set_interface(struct fsg_common *common, struct fsg_dev *new_fsg) |
2308 | * Call with altsetting < 0 to disable the interface. The only other | ||
2309 | * available altsetting is 0, which enables the interface. | ||
2310 | */ | ||
2311 | static int do_set_interface(struct fsg_common *common, int altsetting) | ||
2312 | { | 2307 | { |
2313 | int rc = 0; | 2308 | const struct usb_endpoint_descriptor *d; |
2314 | int i; | 2309 | struct fsg_dev *fsg; |
2315 | const struct usb_endpoint_descriptor *d; | 2310 | int i, rc = 0; |
2316 | 2311 | ||
2317 | if (common->running) | 2312 | if (common->running) |
2318 | DBG(common, "reset interface\n"); | 2313 | DBG(common, "reset interface\n"); |
2319 | 2314 | ||
2320 | reset: | 2315 | reset: |
2321 | /* Deallocate the requests */ | 2316 | /* Deallocate the requests */ |
2322 | if (common->prev_fsg) { | 2317 | if (common->fsg) { |
2323 | struct fsg_dev *fsg = common->prev_fsg; | 2318 | fsg = common->fsg; |
2324 | 2319 | ||
2325 | for (i = 0; i < FSG_NUM_BUFFERS; ++i) { | 2320 | for (i = 0; i < FSG_NUM_BUFFERS; ++i) { |
2326 | struct fsg_buffhd *bh = &common->buffhds[i]; | 2321 | struct fsg_buffhd *bh = &common->buffhds[i]; |
@@ -2345,88 +2340,53 @@ reset: | |||
2345 | fsg->bulk_out_enabled = 0; | 2340 | fsg->bulk_out_enabled = 0; |
2346 | } | 2341 | } |
2347 | 2342 | ||
2348 | common->prev_fsg = 0; | 2343 | common->fsg = NULL; |
2344 | wake_up(&common->fsg_wait); | ||
2349 | } | 2345 | } |
2350 | 2346 | ||
2351 | common->running = 0; | 2347 | common->running = 0; |
2352 | if (altsetting < 0 || rc != 0) | 2348 | if (!new_fsg || rc) |
2353 | return rc; | 2349 | return rc; |
2354 | 2350 | ||
2355 | DBG(common, "set interface %d\n", altsetting); | 2351 | common->fsg = new_fsg; |
2352 | fsg = common->fsg; | ||
2356 | 2353 | ||
2357 | if (fsg_is_set(common)) { | 2354 | /* Enable the endpoints */ |
2358 | struct fsg_dev *fsg = common->fsg; | 2355 | d = fsg_ep_desc(common->gadget, |
2359 | common->prev_fsg = common->fsg; | 2356 | &fsg_fs_bulk_in_desc, &fsg_hs_bulk_in_desc); |
2357 | rc = enable_endpoint(common, fsg->bulk_in, d); | ||
2358 | if (rc) | ||
2359 | goto reset; | ||
2360 | fsg->bulk_in_enabled = 1; | ||
2361 | |||
2362 | d = fsg_ep_desc(common->gadget, | ||
2363 | &fsg_fs_bulk_out_desc, &fsg_hs_bulk_out_desc); | ||
2364 | rc = enable_endpoint(common, fsg->bulk_out, d); | ||
2365 | if (rc) | ||
2366 | goto reset; | ||
2367 | fsg->bulk_out_enabled = 1; | ||
2368 | common->bulk_out_maxpacket = le16_to_cpu(d->wMaxPacketSize); | ||
2369 | clear_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags); | ||
2360 | 2370 | ||
2361 | /* Enable the endpoints */ | 2371 | /* Allocate the requests */ |
2362 | d = fsg_ep_desc(common->gadget, | 2372 | for (i = 0; i < FSG_NUM_BUFFERS; ++i) { |
2363 | &fsg_fs_bulk_in_desc, &fsg_hs_bulk_in_desc); | 2373 | struct fsg_buffhd *bh = &common->buffhds[i]; |
2364 | rc = enable_endpoint(common, fsg->bulk_in, d); | 2374 | |
2375 | rc = alloc_request(common, fsg->bulk_in, &bh->inreq); | ||
2365 | if (rc) | 2376 | if (rc) |
2366 | goto reset; | 2377 | goto reset; |
2367 | fsg->bulk_in_enabled = 1; | 2378 | rc = alloc_request(common, fsg->bulk_out, &bh->outreq); |
2368 | |||
2369 | d = fsg_ep_desc(common->gadget, | ||
2370 | &fsg_fs_bulk_out_desc, &fsg_hs_bulk_out_desc); | ||
2371 | rc = enable_endpoint(common, fsg->bulk_out, d); | ||
2372 | if (rc) | 2379 | if (rc) |
2373 | goto reset; | 2380 | goto reset; |
2374 | fsg->bulk_out_enabled = 1; | 2381 | bh->inreq->buf = bh->outreq->buf = bh->buf; |
2375 | common->bulk_out_maxpacket = le16_to_cpu(d->wMaxPacketSize); | 2382 | bh->inreq->context = bh->outreq->context = bh; |
2376 | clear_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags); | 2383 | bh->inreq->complete = bulk_in_complete; |
2377 | 2384 | bh->outreq->complete = bulk_out_complete; | |
2378 | /* Allocate the requests */ | ||
2379 | for (i = 0; i < FSG_NUM_BUFFERS; ++i) { | ||
2380 | struct fsg_buffhd *bh = &common->buffhds[i]; | ||
2381 | |||
2382 | rc = alloc_request(common, fsg->bulk_in, &bh->inreq); | ||
2383 | if (rc) | ||
2384 | goto reset; | ||
2385 | rc = alloc_request(common, fsg->bulk_out, &bh->outreq); | ||
2386 | if (rc) | ||
2387 | goto reset; | ||
2388 | bh->inreq->buf = bh->outreq->buf = bh->buf; | ||
2389 | bh->inreq->context = bh->outreq->context = bh; | ||
2390 | bh->inreq->complete = bulk_in_complete; | ||
2391 | bh->outreq->complete = bulk_out_complete; | ||
2392 | } | ||
2393 | |||
2394 | common->running = 1; | ||
2395 | for (i = 0; i < common->nluns; ++i) | ||
2396 | common->luns[i].unit_attention_data = SS_RESET_OCCURRED; | ||
2397 | return rc; | ||
2398 | } else { | ||
2399 | return -EIO; | ||
2400 | } | ||
2401 | } | ||
2402 | |||
2403 | |||
2404 | /* | ||
2405 | * Change our operational configuration. This code must agree with the code | ||
2406 | * that returns config descriptors, and with interface altsetting code. | ||
2407 | * | ||
2408 | * It's also responsible for power management interactions. Some | ||
2409 | * configurations might not work with our current power sources. | ||
2410 | * For now we just assume the gadget is always self-powered. | ||
2411 | */ | ||
2412 | static int do_set_config(struct fsg_common *common, u8 new_config) | ||
2413 | { | ||
2414 | int rc = 0; | ||
2415 | |||
2416 | /* Disable the single interface */ | ||
2417 | if (common->config != 0) { | ||
2418 | DBG(common, "reset config\n"); | ||
2419 | common->config = 0; | ||
2420 | rc = do_set_interface(common, -1); | ||
2421 | } | 2385 | } |
2422 | 2386 | ||
2423 | /* Enable the interface */ | 2387 | common->running = 1; |
2424 | if (new_config != 0) { | 2388 | for (i = 0; i < common->nluns; ++i) |
2425 | common->config = new_config; | 2389 | common->luns[i].unit_attention_data = SS_RESET_OCCURRED; |
2426 | rc = do_set_interface(common, 0); | ||
2427 | if (rc != 0) | ||
2428 | common->config = 0; /* Reset on errors */ | ||
2429 | } | ||
2430 | return rc; | 2390 | return rc; |
2431 | } | 2391 | } |
2432 | 2392 | ||
@@ -2437,9 +2397,7 @@ static int do_set_config(struct fsg_common *common, u8 new_config) | |||
2437 | static int fsg_set_alt(struct usb_function *f, unsigned intf, unsigned alt) | 2397 | static int fsg_set_alt(struct usb_function *f, unsigned intf, unsigned alt) |
2438 | { | 2398 | { |
2439 | struct fsg_dev *fsg = fsg_from_func(f); | 2399 | struct fsg_dev *fsg = fsg_from_func(f); |
2440 | fsg->common->prev_fsg = fsg->common->fsg; | 2400 | fsg->common->new_fsg = fsg; |
2441 | fsg->common->fsg = fsg; | ||
2442 | fsg->common->new_config = 1; | ||
2443 | raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE); | 2401 | raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE); |
2444 | return 0; | 2402 | return 0; |
2445 | } | 2403 | } |
@@ -2447,9 +2405,7 @@ static int fsg_set_alt(struct usb_function *f, unsigned intf, unsigned alt) | |||
2447 | static void fsg_disable(struct usb_function *f) | 2405 | static void fsg_disable(struct usb_function *f) |
2448 | { | 2406 | { |
2449 | struct fsg_dev *fsg = fsg_from_func(f); | 2407 | struct fsg_dev *fsg = fsg_from_func(f); |
2450 | fsg->common->prev_fsg = fsg->common->fsg; | 2408 | fsg->common->new_fsg = NULL; |
2451 | fsg->common->fsg = fsg; | ||
2452 | fsg->common->new_config = 0; | ||
2453 | raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE); | 2409 | raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE); |
2454 | } | 2410 | } |
2455 | 2411 | ||
@@ -2459,19 +2415,17 @@ static void fsg_disable(struct usb_function *f) | |||
2459 | static void handle_exception(struct fsg_common *common) | 2415 | static void handle_exception(struct fsg_common *common) |
2460 | { | 2416 | { |
2461 | siginfo_t info; | 2417 | siginfo_t info; |
2462 | int sig; | ||
2463 | int i; | 2418 | int i; |
2464 | struct fsg_buffhd *bh; | 2419 | struct fsg_buffhd *bh; |
2465 | enum fsg_state old_state; | 2420 | enum fsg_state old_state; |
2466 | u8 new_config; | ||
2467 | struct fsg_lun *curlun; | 2421 | struct fsg_lun *curlun; |
2468 | unsigned int exception_req_tag; | 2422 | unsigned int exception_req_tag; |
2469 | int rc; | ||
2470 | 2423 | ||
2471 | /* Clear the existing signals. Anything but SIGUSR1 is converted | 2424 | /* Clear the existing signals. Anything but SIGUSR1 is converted |
2472 | * into a high-priority EXIT exception. */ | 2425 | * into a high-priority EXIT exception. */ |
2473 | for (;;) { | 2426 | for (;;) { |
2474 | sig = dequeue_signal_lock(current, ¤t->blocked, &info); | 2427 | int sig = |
2428 | dequeue_signal_lock(current, ¤t->blocked, &info); | ||
2475 | if (!sig) | 2429 | if (!sig) |
2476 | break; | 2430 | break; |
2477 | if (sig != SIGUSR1) { | 2431 | if (sig != SIGUSR1) { |
@@ -2482,7 +2436,7 @@ static void handle_exception(struct fsg_common *common) | |||
2482 | } | 2436 | } |
2483 | 2437 | ||
2484 | /* Cancel all the pending transfers */ | 2438 | /* Cancel all the pending transfers */ |
2485 | if (fsg_is_set(common)) { | 2439 | if (likely(common->fsg)) { |
2486 | for (i = 0; i < FSG_NUM_BUFFERS; ++i) { | 2440 | for (i = 0; i < FSG_NUM_BUFFERS; ++i) { |
2487 | bh = &common->buffhds[i]; | 2441 | bh = &common->buffhds[i]; |
2488 | if (bh->inreq_busy) | 2442 | if (bh->inreq_busy) |
@@ -2523,7 +2477,6 @@ static void handle_exception(struct fsg_common *common) | |||
2523 | common->next_buffhd_to_fill = &common->buffhds[0]; | 2477 | common->next_buffhd_to_fill = &common->buffhds[0]; |
2524 | common->next_buffhd_to_drain = &common->buffhds[0]; | 2478 | common->next_buffhd_to_drain = &common->buffhds[0]; |
2525 | exception_req_tag = common->exception_req_tag; | 2479 | exception_req_tag = common->exception_req_tag; |
2526 | new_config = common->new_config; | ||
2527 | old_state = common->state; | 2480 | old_state = common->state; |
2528 | 2481 | ||
2529 | if (old_state == FSG_STATE_ABORT_BULK_OUT) | 2482 | if (old_state == FSG_STATE_ABORT_BULK_OUT) |
@@ -2573,12 +2526,12 @@ static void handle_exception(struct fsg_common *common) | |||
2573 | break; | 2526 | break; |
2574 | 2527 | ||
2575 | case FSG_STATE_CONFIG_CHANGE: | 2528 | case FSG_STATE_CONFIG_CHANGE: |
2576 | rc = do_set_config(common, new_config); | 2529 | do_set_interface(common, common->new_fsg); |
2577 | break; | 2530 | break; |
2578 | 2531 | ||
2579 | case FSG_STATE_EXIT: | 2532 | case FSG_STATE_EXIT: |
2580 | case FSG_STATE_TERMINATED: | 2533 | case FSG_STATE_TERMINATED: |
2581 | do_set_config(common, 0); /* Free resources */ | 2534 | do_set_interface(common, NULL); /* Free resources */ |
2582 | spin_lock_irq(&common->lock); | 2535 | spin_lock_irq(&common->lock); |
2583 | common->state = FSG_STATE_TERMINATED; /* Stop the thread */ | 2536 | common->state = FSG_STATE_TERMINATED; /* Stop the thread */ |
2584 | spin_unlock_irq(&common->lock); | 2537 | spin_unlock_irq(&common->lock); |
@@ -2863,6 +2816,7 @@ buffhds_first_it: | |||
2863 | goto error_release; | 2816 | goto error_release; |
2864 | } | 2817 | } |
2865 | init_completion(&common->thread_notifier); | 2818 | init_completion(&common->thread_notifier); |
2819 | init_waitqueue_head(&common->fsg_wait); | ||
2866 | #undef OR | 2820 | #undef OR |
2867 | 2821 | ||
2868 | 2822 | ||
@@ -2957,9 +2911,17 @@ static void fsg_common_release(struct kref *ref) | |||
2957 | static void fsg_unbind(struct usb_configuration *c, struct usb_function *f) | 2911 | static void fsg_unbind(struct usb_configuration *c, struct usb_function *f) |
2958 | { | 2912 | { |
2959 | struct fsg_dev *fsg = fsg_from_func(f); | 2913 | struct fsg_dev *fsg = fsg_from_func(f); |
2914 | struct fsg_common *common = fsg->common; | ||
2960 | 2915 | ||
2961 | DBG(fsg, "unbind\n"); | 2916 | DBG(fsg, "unbind\n"); |
2962 | fsg_common_put(fsg->common); | 2917 | if (fsg->common->fsg == fsg) { |
2918 | fsg->common->new_fsg = NULL; | ||
2919 | raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE); | ||
2920 | /* FIXME: make interruptible or killable somehow? */ | ||
2921 | wait_event(common->fsg_wait, common->fsg != fsg); | ||
2922 | } | ||
2923 | |||
2924 | fsg_common_put(common); | ||
2963 | usb_free_descriptors(fsg->function.descriptors); | 2925 | usb_free_descriptors(fsg->function.descriptors); |
2964 | usb_free_descriptors(fsg->function.hs_descriptors); | 2926 | usb_free_descriptors(fsg->function.hs_descriptors); |
2965 | kfree(fsg); | 2927 | kfree(fsg); |
@@ -2970,7 +2932,6 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f) | |||
2970 | { | 2932 | { |
2971 | struct fsg_dev *fsg = fsg_from_func(f); | 2933 | struct fsg_dev *fsg = fsg_from_func(f); |
2972 | struct usb_gadget *gadget = c->cdev->gadget; | 2934 | struct usb_gadget *gadget = c->cdev->gadget; |
2973 | int rc; | ||
2974 | int i; | 2935 | int i; |
2975 | struct usb_ep *ep; | 2936 | struct usb_ep *ep; |
2976 | 2937 | ||
@@ -2996,6 +2957,11 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f) | |||
2996 | ep->driver_data = fsg->common; /* claim the endpoint */ | 2957 | ep->driver_data = fsg->common; /* claim the endpoint */ |
2997 | fsg->bulk_out = ep; | 2958 | fsg->bulk_out = ep; |
2998 | 2959 | ||
2960 | /* Copy descriptors */ | ||
2961 | f->descriptors = usb_copy_descriptors(fsg_fs_function); | ||
2962 | if (unlikely(!f->descriptors)) | ||
2963 | return -ENOMEM; | ||
2964 | |||
2999 | if (gadget_is_dualspeed(gadget)) { | 2965 | if (gadget_is_dualspeed(gadget)) { |
3000 | /* Assume endpoint addresses are the same for both speeds */ | 2966 | /* Assume endpoint addresses are the same for both speeds */ |
3001 | fsg_hs_bulk_in_desc.bEndpointAddress = | 2967 | fsg_hs_bulk_in_desc.bEndpointAddress = |
@@ -3003,16 +2969,17 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f) | |||
3003 | fsg_hs_bulk_out_desc.bEndpointAddress = | 2969 | fsg_hs_bulk_out_desc.bEndpointAddress = |
3004 | fsg_fs_bulk_out_desc.bEndpointAddress; | 2970 | fsg_fs_bulk_out_desc.bEndpointAddress; |
3005 | f->hs_descriptors = usb_copy_descriptors(fsg_hs_function); | 2971 | f->hs_descriptors = usb_copy_descriptors(fsg_hs_function); |
3006 | if (unlikely(!f->hs_descriptors)) | 2972 | if (unlikely(!f->hs_descriptors)) { |
2973 | usb_free_descriptors(f->descriptors); | ||
3007 | return -ENOMEM; | 2974 | return -ENOMEM; |
2975 | } | ||
3008 | } | 2976 | } |
3009 | 2977 | ||
3010 | return 0; | 2978 | return 0; |
3011 | 2979 | ||
3012 | autoconf_fail: | 2980 | autoconf_fail: |
3013 | ERROR(fsg, "unable to autoconfigure all endpoints\n"); | 2981 | ERROR(fsg, "unable to autoconfigure all endpoints\n"); |
3014 | rc = -ENOTSUPP; | 2982 | return -ENOTSUPP; |
3015 | return rc; | ||
3016 | } | 2983 | } |
3017 | 2984 | ||
3018 | 2985 | ||
@@ -3036,11 +3003,6 @@ static int fsg_add(struct usb_composite_dev *cdev, | |||
3036 | 3003 | ||
3037 | fsg->function.name = FSG_DRIVER_DESC; | 3004 | fsg->function.name = FSG_DRIVER_DESC; |
3038 | fsg->function.strings = fsg_strings_array; | 3005 | fsg->function.strings = fsg_strings_array; |
3039 | fsg->function.descriptors = usb_copy_descriptors(fsg_fs_function); | ||
3040 | if (unlikely(!fsg->function.descriptors)) { | ||
3041 | rc = -ENOMEM; | ||
3042 | goto error_free_fsg; | ||
3043 | } | ||
3044 | fsg->function.bind = fsg_bind; | 3006 | fsg->function.bind = fsg_bind; |
3045 | fsg->function.unbind = fsg_unbind; | 3007 | fsg->function.unbind = fsg_unbind; |
3046 | fsg->function.setup = fsg_setup; | 3008 | fsg->function.setup = fsg_setup; |
@@ -3056,19 +3018,9 @@ static int fsg_add(struct usb_composite_dev *cdev, | |||
3056 | 3018 | ||
3057 | rc = usb_add_function(c, &fsg->function); | 3019 | rc = usb_add_function(c, &fsg->function); |
3058 | if (unlikely(rc)) | 3020 | if (unlikely(rc)) |
3059 | goto error_free_all; | 3021 | kfree(fsg); |
3060 | 3022 | else | |
3061 | fsg_common_get(fsg->common); | 3023 | fsg_common_get(fsg->common); |
3062 | return 0; | ||
3063 | |||
3064 | error_free_all: | ||
3065 | usb_free_descriptors(fsg->function.descriptors); | ||
3066 | /* fsg_bind() might have copied those; or maybe not? who cares | ||
3067 | * -- free it just in case. */ | ||
3068 | usb_free_descriptors(fsg->function.hs_descriptors); | ||
3069 | error_free_fsg: | ||
3070 | kfree(fsg); | ||
3071 | |||
3072 | return rc; | 3024 | return rc; |
3073 | } | 3025 | } |
3074 | 3026 | ||
diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c index 4b0e4a040d6f..d1af253a9105 100644 --- a/drivers/usb/gadget/g_ffs.c +++ b/drivers/usb/gadget/g_ffs.c | |||
@@ -392,6 +392,17 @@ static int __gfs_do_config(struct usb_configuration *c, | |||
392 | if (unlikely(ret < 0)) | 392 | if (unlikely(ret < 0)) |
393 | return ret; | 393 | return ret; |
394 | 394 | ||
395 | /* After previous do_configs there may be some invalid | ||
396 | * pointers in c->interface array. This happens every time | ||
397 | * a user space function with fewer interfaces than a user | ||
398 | * space function that was run before the new one is run. The | ||
399 | * compasit's set_config() assumes that if there is no more | ||
400 | * then MAX_CONFIG_INTERFACES interfaces in a configuration | ||
401 | * then there is a NULL pointer after the last interface in | ||
402 | * c->interface array. We need to make sure this is true. */ | ||
403 | if (c->next_interface_id < ARRAY_SIZE(c->interface)) | ||
404 | c->interface[c->next_interface_id] = NULL; | ||
405 | |||
395 | return 0; | 406 | return 0; |
396 | } | 407 | } |
397 | 408 | ||
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c index 43abf55d8c60..4c3ac5c42237 100644 --- a/drivers/usb/gadget/printer.c +++ b/drivers/usb/gadget/printer.c | |||
@@ -82,7 +82,7 @@ static struct class *usb_gadget_class; | |||
82 | struct printer_dev { | 82 | struct printer_dev { |
83 | spinlock_t lock; /* lock this structure */ | 83 | spinlock_t lock; /* lock this structure */ |
84 | /* lock buffer lists during read/write calls */ | 84 | /* lock buffer lists during read/write calls */ |
85 | spinlock_t lock_printer_io; | 85 | struct mutex lock_printer_io; |
86 | struct usb_gadget *gadget; | 86 | struct usb_gadget *gadget; |
87 | struct usb_request *req; /* for control responses */ | 87 | struct usb_request *req; /* for control responses */ |
88 | u8 config; | 88 | u8 config; |
@@ -567,7 +567,7 @@ printer_read(struct file *fd, char __user *buf, size_t len, loff_t *ptr) | |||
567 | 567 | ||
568 | DBG(dev, "printer_read trying to read %d bytes\n", (int)len); | 568 | DBG(dev, "printer_read trying to read %d bytes\n", (int)len); |
569 | 569 | ||
570 | spin_lock(&dev->lock_printer_io); | 570 | mutex_lock(&dev->lock_printer_io); |
571 | spin_lock_irqsave(&dev->lock, flags); | 571 | spin_lock_irqsave(&dev->lock, flags); |
572 | 572 | ||
573 | /* We will use this flag later to check if a printer reset happened | 573 | /* We will use this flag later to check if a printer reset happened |
@@ -601,7 +601,7 @@ printer_read(struct file *fd, char __user *buf, size_t len, loff_t *ptr) | |||
601 | * call or not. | 601 | * call or not. |
602 | */ | 602 | */ |
603 | if (fd->f_flags & (O_NONBLOCK|O_NDELAY)) { | 603 | if (fd->f_flags & (O_NONBLOCK|O_NDELAY)) { |
604 | spin_unlock(&dev->lock_printer_io); | 604 | mutex_unlock(&dev->lock_printer_io); |
605 | return -EAGAIN; | 605 | return -EAGAIN; |
606 | } | 606 | } |
607 | 607 | ||
@@ -648,7 +648,7 @@ printer_read(struct file *fd, char __user *buf, size_t len, loff_t *ptr) | |||
648 | if (dev->reset_printer) { | 648 | if (dev->reset_printer) { |
649 | list_add(¤t_rx_req->list, &dev->rx_reqs); | 649 | list_add(¤t_rx_req->list, &dev->rx_reqs); |
650 | spin_unlock_irqrestore(&dev->lock, flags); | 650 | spin_unlock_irqrestore(&dev->lock, flags); |
651 | spin_unlock(&dev->lock_printer_io); | 651 | mutex_unlock(&dev->lock_printer_io); |
652 | return -EAGAIN; | 652 | return -EAGAIN; |
653 | } | 653 | } |
654 | 654 | ||
@@ -673,7 +673,7 @@ printer_read(struct file *fd, char __user *buf, size_t len, loff_t *ptr) | |||
673 | dev->current_rx_buf = current_rx_buf; | 673 | dev->current_rx_buf = current_rx_buf; |
674 | 674 | ||
675 | spin_unlock_irqrestore(&dev->lock, flags); | 675 | spin_unlock_irqrestore(&dev->lock, flags); |
676 | spin_unlock(&dev->lock_printer_io); | 676 | mutex_unlock(&dev->lock_printer_io); |
677 | 677 | ||
678 | DBG(dev, "printer_read returned %d bytes\n", (int)bytes_copied); | 678 | DBG(dev, "printer_read returned %d bytes\n", (int)bytes_copied); |
679 | 679 | ||
@@ -697,7 +697,7 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
697 | if (len == 0) | 697 | if (len == 0) |
698 | return -EINVAL; | 698 | return -EINVAL; |
699 | 699 | ||
700 | spin_lock(&dev->lock_printer_io); | 700 | mutex_lock(&dev->lock_printer_io); |
701 | spin_lock_irqsave(&dev->lock, flags); | 701 | spin_lock_irqsave(&dev->lock, flags); |
702 | 702 | ||
703 | /* Check if a printer reset happens while we have interrupts on */ | 703 | /* Check if a printer reset happens while we have interrupts on */ |
@@ -713,7 +713,7 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
713 | * a NON-Blocking call or not. | 713 | * a NON-Blocking call or not. |
714 | */ | 714 | */ |
715 | if (fd->f_flags & (O_NONBLOCK|O_NDELAY)) { | 715 | if (fd->f_flags & (O_NONBLOCK|O_NDELAY)) { |
716 | spin_unlock(&dev->lock_printer_io); | 716 | mutex_unlock(&dev->lock_printer_io); |
717 | return -EAGAIN; | 717 | return -EAGAIN; |
718 | } | 718 | } |
719 | 719 | ||
@@ -752,7 +752,7 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
752 | 752 | ||
753 | if (copy_from_user(req->buf, buf, size)) { | 753 | if (copy_from_user(req->buf, buf, size)) { |
754 | list_add(&req->list, &dev->tx_reqs); | 754 | list_add(&req->list, &dev->tx_reqs); |
755 | spin_unlock(&dev->lock_printer_io); | 755 | mutex_unlock(&dev->lock_printer_io); |
756 | return bytes_copied; | 756 | return bytes_copied; |
757 | } | 757 | } |
758 | 758 | ||
@@ -766,14 +766,14 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
766 | if (dev->reset_printer) { | 766 | if (dev->reset_printer) { |
767 | list_add(&req->list, &dev->tx_reqs); | 767 | list_add(&req->list, &dev->tx_reqs); |
768 | spin_unlock_irqrestore(&dev->lock, flags); | 768 | spin_unlock_irqrestore(&dev->lock, flags); |
769 | spin_unlock(&dev->lock_printer_io); | 769 | mutex_unlock(&dev->lock_printer_io); |
770 | return -EAGAIN; | 770 | return -EAGAIN; |
771 | } | 771 | } |
772 | 772 | ||
773 | if (usb_ep_queue(dev->in_ep, req, GFP_ATOMIC)) { | 773 | if (usb_ep_queue(dev->in_ep, req, GFP_ATOMIC)) { |
774 | list_add(&req->list, &dev->tx_reqs); | 774 | list_add(&req->list, &dev->tx_reqs); |
775 | spin_unlock_irqrestore(&dev->lock, flags); | 775 | spin_unlock_irqrestore(&dev->lock, flags); |
776 | spin_unlock(&dev->lock_printer_io); | 776 | mutex_unlock(&dev->lock_printer_io); |
777 | return -EAGAIN; | 777 | return -EAGAIN; |
778 | } | 778 | } |
779 | 779 | ||
@@ -782,7 +782,7 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
782 | } | 782 | } |
783 | 783 | ||
784 | spin_unlock_irqrestore(&dev->lock, flags); | 784 | spin_unlock_irqrestore(&dev->lock, flags); |
785 | spin_unlock(&dev->lock_printer_io); | 785 | mutex_unlock(&dev->lock_printer_io); |
786 | 786 | ||
787 | DBG(dev, "printer_write sent %d bytes\n", (int)bytes_copied); | 787 | DBG(dev, "printer_write sent %d bytes\n", (int)bytes_copied); |
788 | 788 | ||
@@ -820,11 +820,11 @@ printer_poll(struct file *fd, poll_table *wait) | |||
820 | unsigned long flags; | 820 | unsigned long flags; |
821 | int status = 0; | 821 | int status = 0; |
822 | 822 | ||
823 | spin_lock(&dev->lock_printer_io); | 823 | mutex_lock(&dev->lock_printer_io); |
824 | spin_lock_irqsave(&dev->lock, flags); | 824 | spin_lock_irqsave(&dev->lock, flags); |
825 | setup_rx_reqs(dev); | 825 | setup_rx_reqs(dev); |
826 | spin_unlock_irqrestore(&dev->lock, flags); | 826 | spin_unlock_irqrestore(&dev->lock, flags); |
827 | spin_unlock(&dev->lock_printer_io); | 827 | mutex_unlock(&dev->lock_printer_io); |
828 | 828 | ||
829 | poll_wait(fd, &dev->rx_wait, wait); | 829 | poll_wait(fd, &dev->rx_wait, wait); |
830 | poll_wait(fd, &dev->tx_wait, wait); | 830 | poll_wait(fd, &dev->tx_wait, wait); |
@@ -1461,7 +1461,7 @@ autoconf_fail: | |||
1461 | } | 1461 | } |
1462 | 1462 | ||
1463 | spin_lock_init(&dev->lock); | 1463 | spin_lock_init(&dev->lock); |
1464 | spin_lock_init(&dev->lock_printer_io); | 1464 | mutex_init(&dev->lock_printer_io); |
1465 | INIT_LIST_HEAD(&dev->tx_reqs); | 1465 | INIT_LIST_HEAD(&dev->tx_reqs); |
1466 | INIT_LIST_HEAD(&dev->tx_reqs_active); | 1466 | INIT_LIST_HEAD(&dev->tx_reqs_active); |
1467 | INIT_LIST_HEAD(&dev->rx_reqs); | 1467 | INIT_LIST_HEAD(&dev->rx_reqs); |
@@ -1594,7 +1594,7 @@ cleanup(void) | |||
1594 | { | 1594 | { |
1595 | int status; | 1595 | int status; |
1596 | 1596 | ||
1597 | spin_lock(&usb_printer_gadget.lock_printer_io); | 1597 | mutex_lock(&usb_printer_gadget.lock_printer_io); |
1598 | class_destroy(usb_gadget_class); | 1598 | class_destroy(usb_gadget_class); |
1599 | unregister_chrdev_region(g_printer_devno, 2); | 1599 | unregister_chrdev_region(g_printer_devno, 2); |
1600 | 1600 | ||
@@ -1602,6 +1602,6 @@ cleanup(void) | |||
1602 | if (status) | 1602 | if (status) |
1603 | ERROR(dev, "usb_gadget_unregister_driver %x\n", status); | 1603 | ERROR(dev, "usb_gadget_unregister_driver %x\n", status); |
1604 | 1604 | ||
1605 | spin_unlock(&usb_printer_gadget.lock_printer_io); | 1605 | mutex_unlock(&usb_printer_gadget.lock_printer_io); |
1606 | } | 1606 | } |
1607 | module_exit(cleanup); | 1607 | module_exit(cleanup); |
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c index d5f4c1d45c97..e724a051bfdd 100644 --- a/drivers/usb/gadget/s3c2410_udc.c +++ b/drivers/usb/gadget/s3c2410_udc.c | |||
@@ -1700,9 +1700,13 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | |||
1700 | if (!driver || driver != udc->driver || !driver->unbind) | 1700 | if (!driver || driver != udc->driver || !driver->unbind) |
1701 | return -EINVAL; | 1701 | return -EINVAL; |
1702 | 1702 | ||
1703 | dprintk(DEBUG_NORMAL,"usb_gadget_register_driver() '%s'\n", | 1703 | dprintk(DEBUG_NORMAL, "usb_gadget_unregister_driver() '%s'\n", |
1704 | driver->driver.name); | 1704 | driver->driver.name); |
1705 | 1705 | ||
1706 | /* report disconnect */ | ||
1707 | if (driver->disconnect) | ||
1708 | driver->disconnect(&udc->gadget); | ||
1709 | |||
1706 | driver->unbind(&udc->gadget); | 1710 | driver->unbind(&udc->gadget); |
1707 | 1711 | ||
1708 | device_del(&udc->gadget.dev); | 1712 | device_del(&udc->gadget.dev); |
diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c index 16bdf77f582a..3e8dcb5455e3 100644 --- a/drivers/usb/gadget/u_serial.c +++ b/drivers/usb/gadget/u_serial.c | |||
@@ -536,17 +536,11 @@ recycle: | |||
536 | list_move(&req->list, &port->read_pool); | 536 | list_move(&req->list, &port->read_pool); |
537 | } | 537 | } |
538 | 538 | ||
539 | /* Push from tty to ldisc; this is immediate with low_latency, and | 539 | /* Push from tty to ldisc; without low_latency set this is handled by |
540 | * may trigger callbacks to this driver ... so drop the spinlock. | 540 | * a workqueue, so we won't get callbacks and can hold port_lock |
541 | */ | 541 | */ |
542 | if (tty && do_push) { | 542 | if (tty && do_push) { |
543 | spin_unlock_irq(&port->port_lock); | ||
544 | tty_flip_buffer_push(tty); | 543 | tty_flip_buffer_push(tty); |
545 | wake_up_interruptible(&tty->read_wait); | ||
546 | spin_lock_irq(&port->port_lock); | ||
547 | |||
548 | /* tty may have been closed */ | ||
549 | tty = port->port_tty; | ||
550 | } | 544 | } |
551 | 545 | ||
552 | 546 | ||
@@ -784,11 +778,6 @@ static int gs_open(struct tty_struct *tty, struct file *file) | |||
784 | port->open_count = 1; | 778 | port->open_count = 1; |
785 | port->openclose = false; | 779 | port->openclose = false; |
786 | 780 | ||
787 | /* low_latency means ldiscs work in tasklet context, without | ||
788 | * needing a workqueue schedule ... easier to keep up. | ||
789 | */ | ||
790 | tty->low_latency = 1; | ||
791 | |||
792 | /* if connected, start the I/O stream */ | 781 | /* if connected, start the I/O stream */ |
793 | if (port->port_usb) { | 782 | if (port->port_usb) { |
794 | struct gserial *gser = port->port_usb; | 783 | struct gserial *gser = port->port_usb; |
@@ -1195,6 +1184,7 @@ void gserial_cleanup(void) | |||
1195 | n_ports = 0; | 1184 | n_ports = 0; |
1196 | 1185 | ||
1197 | tty_unregister_driver(gs_tty_driver); | 1186 | tty_unregister_driver(gs_tty_driver); |
1187 | put_tty_driver(gs_tty_driver); | ||
1198 | gs_tty_driver = NULL; | 1188 | gs_tty_driver = NULL; |
1199 | 1189 | ||
1200 | pr_debug("%s: cleaned up ttyGS* support\n", __func__); | 1190 | pr_debug("%s: cleaned up ttyGS* support\n", __func__); |
diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c index 544ccfd7056e..bd4027745aa7 100644 --- a/drivers/usb/host/ehci-mxc.c +++ b/drivers/usb/host/ehci-mxc.c | |||
@@ -207,10 +207,17 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) | |||
207 | /* Initialize the transceiver */ | 207 | /* Initialize the transceiver */ |
208 | if (pdata->otg) { | 208 | if (pdata->otg) { |
209 | pdata->otg->io_priv = hcd->regs + ULPI_VIEWPORT_OFFSET; | 209 | pdata->otg->io_priv = hcd->regs + ULPI_VIEWPORT_OFFSET; |
210 | if (otg_init(pdata->otg) != 0) | 210 | ret = otg_init(pdata->otg); |
211 | dev_err(dev, "unable to init transceiver\n"); | 211 | if (ret) { |
212 | else if (otg_set_vbus(pdata->otg, 1) != 0) | 212 | dev_err(dev, "unable to init transceiver, probably missing\n"); |
213 | ret = -ENODEV; | ||
214 | goto err_add; | ||
215 | } | ||
216 | ret = otg_set_vbus(pdata->otg, 1); | ||
217 | if (ret) { | ||
213 | dev_err(dev, "unable to enable vbus on transceiver\n"); | 218 | dev_err(dev, "unable to enable vbus on transceiver\n"); |
219 | goto err_add; | ||
220 | } | ||
214 | } | 221 | } |
215 | 222 | ||
216 | priv->hcd = hcd; | 223 | priv->hcd = hcd; |
diff --git a/drivers/usb/host/isp1362-hcd.c b/drivers/usb/host/isp1362-hcd.c index 20a0dfe0fe36..0587ad4ce5c2 100644 --- a/drivers/usb/host/isp1362-hcd.c +++ b/drivers/usb/host/isp1362-hcd.c | |||
@@ -2224,12 +2224,9 @@ static void remove_debug_file(struct isp1362_hcd *isp1362_hcd) | |||
2224 | 2224 | ||
2225 | /*-------------------------------------------------------------------------*/ | 2225 | /*-------------------------------------------------------------------------*/ |
2226 | 2226 | ||
2227 | static void isp1362_sw_reset(struct isp1362_hcd *isp1362_hcd) | 2227 | static void __isp1362_sw_reset(struct isp1362_hcd *isp1362_hcd) |
2228 | { | 2228 | { |
2229 | int tmp = 20; | 2229 | int tmp = 20; |
2230 | unsigned long flags; | ||
2231 | |||
2232 | spin_lock_irqsave(&isp1362_hcd->lock, flags); | ||
2233 | 2230 | ||
2234 | isp1362_write_reg16(isp1362_hcd, HCSWRES, HCSWRES_MAGIC); | 2231 | isp1362_write_reg16(isp1362_hcd, HCSWRES, HCSWRES_MAGIC); |
2235 | isp1362_write_reg32(isp1362_hcd, HCCMDSTAT, OHCI_HCR); | 2232 | isp1362_write_reg32(isp1362_hcd, HCCMDSTAT, OHCI_HCR); |
@@ -2240,6 +2237,14 @@ static void isp1362_sw_reset(struct isp1362_hcd *isp1362_hcd) | |||
2240 | } | 2237 | } |
2241 | if (!tmp) | 2238 | if (!tmp) |
2242 | pr_err("Software reset timeout\n"); | 2239 | pr_err("Software reset timeout\n"); |
2240 | } | ||
2241 | |||
2242 | static void isp1362_sw_reset(struct isp1362_hcd *isp1362_hcd) | ||
2243 | { | ||
2244 | unsigned long flags; | ||
2245 | |||
2246 | spin_lock_irqsave(&isp1362_hcd->lock, flags); | ||
2247 | __isp1362_sw_reset(isp1362_hcd); | ||
2243 | spin_unlock_irqrestore(&isp1362_hcd->lock, flags); | 2248 | spin_unlock_irqrestore(&isp1362_hcd->lock, flags); |
2244 | } | 2249 | } |
2245 | 2250 | ||
@@ -2418,7 +2423,7 @@ static void isp1362_hc_stop(struct usb_hcd *hcd) | |||
2418 | if (isp1362_hcd->board && isp1362_hcd->board->reset) | 2423 | if (isp1362_hcd->board && isp1362_hcd->board->reset) |
2419 | isp1362_hcd->board->reset(hcd->self.controller, 1); | 2424 | isp1362_hcd->board->reset(hcd->self.controller, 1); |
2420 | else | 2425 | else |
2421 | isp1362_sw_reset(isp1362_hcd); | 2426 | __isp1362_sw_reset(isp1362_hcd); |
2422 | 2427 | ||
2423 | if (isp1362_hcd->board && isp1362_hcd->board->clock) | 2428 | if (isp1362_hcd->board && isp1362_hcd->board->clock) |
2424 | isp1362_hcd->board->clock(hcd->self.controller, 0); | 2429 | isp1362_hcd->board->clock(hcd->self.controller, 0); |
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index 1a2bb4ce638f..77be3c24a427 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c | |||
@@ -1065,7 +1065,7 @@ static void r8a66597_usb_connect(struct r8a66597 *r8a66597, int port) | |||
1065 | else if (speed == LSMODE) | 1065 | else if (speed == LSMODE) |
1066 | rh->port |= USB_PORT_STAT_LOW_SPEED; | 1066 | rh->port |= USB_PORT_STAT_LOW_SPEED; |
1067 | 1067 | ||
1068 | rh->port &= USB_PORT_STAT_RESET; | 1068 | rh->port &= ~USB_PORT_STAT_RESET; |
1069 | rh->port |= USB_PORT_STAT_ENABLE; | 1069 | rh->port |= USB_PORT_STAT_ENABLE; |
1070 | } | 1070 | } |
1071 | 1071 | ||
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 9012098add6b..94e6934edb09 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -182,8 +182,12 @@ static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring, bool consumer | |||
182 | * set, but other sections talk about dealing with the chain bit set. This was | 182 | * set, but other sections talk about dealing with the chain bit set. This was |
183 | * fixed in the 0.96 specification errata, but we have to assume that all 0.95 | 183 | * fixed in the 0.96 specification errata, but we have to assume that all 0.95 |
184 | * xHCI hardware can't handle the chain bit being cleared on a link TRB. | 184 | * xHCI hardware can't handle the chain bit being cleared on a link TRB. |
185 | * | ||
186 | * @more_trbs_coming: Will you enqueue more TRBs before calling | ||
187 | * prepare_transfer()? | ||
185 | */ | 188 | */ |
186 | static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring *ring, bool consumer) | 189 | static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring *ring, |
190 | bool consumer, bool more_trbs_coming) | ||
187 | { | 191 | { |
188 | u32 chain; | 192 | u32 chain; |
189 | union xhci_trb *next; | 193 | union xhci_trb *next; |
@@ -199,15 +203,28 @@ static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring *ring, bool consumer | |||
199 | while (last_trb(xhci, ring, ring->enq_seg, next)) { | 203 | while (last_trb(xhci, ring, ring->enq_seg, next)) { |
200 | if (!consumer) { | 204 | if (!consumer) { |
201 | if (ring != xhci->event_ring) { | 205 | if (ring != xhci->event_ring) { |
202 | if (chain) { | 206 | /* |
203 | next->link.control |= TRB_CHAIN; | 207 | * If the caller doesn't plan on enqueueing more |
204 | 208 | * TDs before ringing the doorbell, then we | |
205 | /* Give this link TRB to the hardware */ | 209 | * don't want to give the link TRB to the |
206 | wmb(); | 210 | * hardware just yet. We'll give the link TRB |
207 | next->link.control ^= TRB_CYCLE; | 211 | * back in prepare_ring() just before we enqueue |
208 | } else { | 212 | * the TD at the top of the ring. |
213 | */ | ||
214 | if (!chain && !more_trbs_coming) | ||
209 | break; | 215 | break; |
216 | |||
217 | /* If we're not dealing with 0.95 hardware, | ||
218 | * carry over the chain bit of the previous TRB | ||
219 | * (which may mean the chain bit is cleared). | ||
220 | */ | ||
221 | if (!xhci_link_trb_quirk(xhci)) { | ||
222 | next->link.control &= ~TRB_CHAIN; | ||
223 | next->link.control |= chain; | ||
210 | } | 224 | } |
225 | /* Give this link TRB to the hardware */ | ||
226 | wmb(); | ||
227 | next->link.control ^= TRB_CYCLE; | ||
211 | } | 228 | } |
212 | /* Toggle the cycle bit after the last ring segment. */ | 229 | /* Toggle the cycle bit after the last ring segment. */ |
213 | if (last_trb_on_last_seg(xhci, ring, ring->enq_seg, next)) { | 230 | if (last_trb_on_last_seg(xhci, ring, ring->enq_seg, next)) { |
@@ -1707,9 +1724,12 @@ void xhci_handle_event(struct xhci_hcd *xhci) | |||
1707 | /* | 1724 | /* |
1708 | * Generic function for queueing a TRB on a ring. | 1725 | * Generic function for queueing a TRB on a ring. |
1709 | * The caller must have checked to make sure there's room on the ring. | 1726 | * The caller must have checked to make sure there's room on the ring. |
1727 | * | ||
1728 | * @more_trbs_coming: Will you enqueue more TRBs before calling | ||
1729 | * prepare_transfer()? | ||
1710 | */ | 1730 | */ |
1711 | static void queue_trb(struct xhci_hcd *xhci, struct xhci_ring *ring, | 1731 | static void queue_trb(struct xhci_hcd *xhci, struct xhci_ring *ring, |
1712 | bool consumer, | 1732 | bool consumer, bool more_trbs_coming, |
1713 | u32 field1, u32 field2, u32 field3, u32 field4) | 1733 | u32 field1, u32 field2, u32 field3, u32 field4) |
1714 | { | 1734 | { |
1715 | struct xhci_generic_trb *trb; | 1735 | struct xhci_generic_trb *trb; |
@@ -1719,7 +1739,7 @@ static void queue_trb(struct xhci_hcd *xhci, struct xhci_ring *ring, | |||
1719 | trb->field[1] = field2; | 1739 | trb->field[1] = field2; |
1720 | trb->field[2] = field3; | 1740 | trb->field[2] = field3; |
1721 | trb->field[3] = field4; | 1741 | trb->field[3] = field4; |
1722 | inc_enq(xhci, ring, consumer); | 1742 | inc_enq(xhci, ring, consumer, more_trbs_coming); |
1723 | } | 1743 | } |
1724 | 1744 | ||
1725 | /* | 1745 | /* |
@@ -1988,6 +2008,7 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
1988 | int trb_buff_len, this_sg_len, running_total; | 2008 | int trb_buff_len, this_sg_len, running_total; |
1989 | bool first_trb; | 2009 | bool first_trb; |
1990 | u64 addr; | 2010 | u64 addr; |
2011 | bool more_trbs_coming; | ||
1991 | 2012 | ||
1992 | struct xhci_generic_trb *start_trb; | 2013 | struct xhci_generic_trb *start_trb; |
1993 | int start_cycle; | 2014 | int start_cycle; |
@@ -2073,7 +2094,11 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2073 | length_field = TRB_LEN(trb_buff_len) | | 2094 | length_field = TRB_LEN(trb_buff_len) | |
2074 | remainder | | 2095 | remainder | |
2075 | TRB_INTR_TARGET(0); | 2096 | TRB_INTR_TARGET(0); |
2076 | queue_trb(xhci, ep_ring, false, | 2097 | if (num_trbs > 1) |
2098 | more_trbs_coming = true; | ||
2099 | else | ||
2100 | more_trbs_coming = false; | ||
2101 | queue_trb(xhci, ep_ring, false, more_trbs_coming, | ||
2077 | lower_32_bits(addr), | 2102 | lower_32_bits(addr), |
2078 | upper_32_bits(addr), | 2103 | upper_32_bits(addr), |
2079 | length_field, | 2104 | length_field, |
@@ -2124,6 +2149,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2124 | int num_trbs; | 2149 | int num_trbs; |
2125 | struct xhci_generic_trb *start_trb; | 2150 | struct xhci_generic_trb *start_trb; |
2126 | bool first_trb; | 2151 | bool first_trb; |
2152 | bool more_trbs_coming; | ||
2127 | int start_cycle; | 2153 | int start_cycle; |
2128 | u32 field, length_field; | 2154 | u32 field, length_field; |
2129 | 2155 | ||
@@ -2212,7 +2238,11 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2212 | length_field = TRB_LEN(trb_buff_len) | | 2238 | length_field = TRB_LEN(trb_buff_len) | |
2213 | remainder | | 2239 | remainder | |
2214 | TRB_INTR_TARGET(0); | 2240 | TRB_INTR_TARGET(0); |
2215 | queue_trb(xhci, ep_ring, false, | 2241 | if (num_trbs > 1) |
2242 | more_trbs_coming = true; | ||
2243 | else | ||
2244 | more_trbs_coming = false; | ||
2245 | queue_trb(xhci, ep_ring, false, more_trbs_coming, | ||
2216 | lower_32_bits(addr), | 2246 | lower_32_bits(addr), |
2217 | upper_32_bits(addr), | 2247 | upper_32_bits(addr), |
2218 | length_field, | 2248 | length_field, |
@@ -2291,7 +2321,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2291 | /* Queue setup TRB - see section 6.4.1.2.1 */ | 2321 | /* Queue setup TRB - see section 6.4.1.2.1 */ |
2292 | /* FIXME better way to translate setup_packet into two u32 fields? */ | 2322 | /* FIXME better way to translate setup_packet into two u32 fields? */ |
2293 | setup = (struct usb_ctrlrequest *) urb->setup_packet; | 2323 | setup = (struct usb_ctrlrequest *) urb->setup_packet; |
2294 | queue_trb(xhci, ep_ring, false, | 2324 | queue_trb(xhci, ep_ring, false, true, |
2295 | /* FIXME endianness is probably going to bite my ass here. */ | 2325 | /* FIXME endianness is probably going to bite my ass here. */ |
2296 | setup->bRequestType | setup->bRequest << 8 | setup->wValue << 16, | 2326 | setup->bRequestType | setup->bRequest << 8 | setup->wValue << 16, |
2297 | setup->wIndex | setup->wLength << 16, | 2327 | setup->wIndex | setup->wLength << 16, |
@@ -2307,7 +2337,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2307 | if (urb->transfer_buffer_length > 0) { | 2337 | if (urb->transfer_buffer_length > 0) { |
2308 | if (setup->bRequestType & USB_DIR_IN) | 2338 | if (setup->bRequestType & USB_DIR_IN) |
2309 | field |= TRB_DIR_IN; | 2339 | field |= TRB_DIR_IN; |
2310 | queue_trb(xhci, ep_ring, false, | 2340 | queue_trb(xhci, ep_ring, false, true, |
2311 | lower_32_bits(urb->transfer_dma), | 2341 | lower_32_bits(urb->transfer_dma), |
2312 | upper_32_bits(urb->transfer_dma), | 2342 | upper_32_bits(urb->transfer_dma), |
2313 | length_field, | 2343 | length_field, |
@@ -2324,7 +2354,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2324 | field = 0; | 2354 | field = 0; |
2325 | else | 2355 | else |
2326 | field = TRB_DIR_IN; | 2356 | field = TRB_DIR_IN; |
2327 | queue_trb(xhci, ep_ring, false, | 2357 | queue_trb(xhci, ep_ring, false, false, |
2328 | 0, | 2358 | 0, |
2329 | 0, | 2359 | 0, |
2330 | TRB_INTR_TARGET(0), | 2360 | TRB_INTR_TARGET(0), |
@@ -2361,7 +2391,7 @@ static int queue_command(struct xhci_hcd *xhci, u32 field1, u32 field2, | |||
2361 | "unfailable commands failed.\n"); | 2391 | "unfailable commands failed.\n"); |
2362 | return -ENOMEM; | 2392 | return -ENOMEM; |
2363 | } | 2393 | } |
2364 | queue_trb(xhci, xhci->cmd_ring, false, field1, field2, field3, | 2394 | queue_trb(xhci, xhci->cmd_ring, false, false, field1, field2, field3, |
2365 | field4 | xhci->cmd_ring->cycle_state); | 2395 | field4 | xhci->cmd_ring->cycle_state); |
2366 | return 0; | 2396 | return 0; |
2367 | } | 2397 | } |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index fad70bc83555..3b795c56221f 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -219,8 +219,8 @@ static int musb_ulpi_write(struct otg_transceiver *otg, | |||
219 | return 0; | 219 | return 0; |
220 | } | 220 | } |
221 | #else | 221 | #else |
222 | #define musb_ulpi_read(a, b) NULL | 222 | #define musb_ulpi_read NULL |
223 | #define musb_ulpi_write(a, b, c) NULL | 223 | #define musb_ulpi_write NULL |
224 | #endif | 224 | #endif |
225 | 225 | ||
226 | static struct otg_io_access_ops musb_ulpi_access = { | 226 | static struct otg_io_access_ops musb_ulpi_access = { |
@@ -451,10 +451,6 @@ void musb_hnp_stop(struct musb *musb) | |||
451 | * @param power | 451 | * @param power |
452 | */ | 452 | */ |
453 | 453 | ||
454 | #define STAGE0_MASK (MUSB_INTR_RESUME | MUSB_INTR_SESSREQ \ | ||
455 | | MUSB_INTR_VBUSERROR | MUSB_INTR_CONNECT \ | ||
456 | | MUSB_INTR_RESET) | ||
457 | |||
458 | static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | 454 | static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, |
459 | u8 devctl, u8 power) | 455 | u8 devctl, u8 power) |
460 | { | 456 | { |
@@ -642,7 +638,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
642 | handled = IRQ_HANDLED; | 638 | handled = IRQ_HANDLED; |
643 | } | 639 | } |
644 | 640 | ||
645 | 641 | #endif | |
646 | if (int_usb & MUSB_INTR_SUSPEND) { | 642 | if (int_usb & MUSB_INTR_SUSPEND) { |
647 | DBG(1, "SUSPEND (%s) devctl %02x power %02x\n", | 643 | DBG(1, "SUSPEND (%s) devctl %02x power %02x\n", |
648 | otg_state_string(musb), devctl, power); | 644 | otg_state_string(musb), devctl, power); |
@@ -705,6 +701,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
705 | } | 701 | } |
706 | } | 702 | } |
707 | 703 | ||
704 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
708 | if (int_usb & MUSB_INTR_CONNECT) { | 705 | if (int_usb & MUSB_INTR_CONNECT) { |
709 | struct usb_hcd *hcd = musb_to_hcd(musb); | 706 | struct usb_hcd *hcd = musb_to_hcd(musb); |
710 | void __iomem *mbase = musb->mregs; | 707 | void __iomem *mbase = musb->mregs; |
@@ -1597,7 +1594,7 @@ irqreturn_t musb_interrupt(struct musb *musb) | |||
1597 | /* the core can interrupt us for multiple reasons; docs have | 1594 | /* the core can interrupt us for multiple reasons; docs have |
1598 | * a generic interrupt flowchart to follow | 1595 | * a generic interrupt flowchart to follow |
1599 | */ | 1596 | */ |
1600 | if (musb->int_usb & STAGE0_MASK) | 1597 | if (musb->int_usb) |
1601 | retval |= musb_stage0_irq(musb, musb->int_usb, | 1598 | retval |= musb_stage0_irq(musb, musb->int_usb, |
1602 | devctl, power); | 1599 | devctl, power); |
1603 | 1600 | ||
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index b22d02dea7d3..91d67794e350 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
@@ -470,7 +470,8 @@ struct musb_csr_regs { | |||
470 | 470 | ||
471 | struct musb_context_registers { | 471 | struct musb_context_registers { |
472 | 472 | ||
473 | #ifdef CONFIG_PM | 473 | #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \ |
474 | defined(CONFIG_ARCH_OMAP4) | ||
474 | u32 otg_sysconfig, otg_forcestandby; | 475 | u32 otg_sysconfig, otg_forcestandby; |
475 | #endif | 476 | #endif |
476 | u8 power; | 477 | u8 power; |
@@ -484,7 +485,8 @@ struct musb_context_registers { | |||
484 | struct musb_csr_regs index_regs[MUSB_C_NUM_EPS]; | 485 | struct musb_csr_regs index_regs[MUSB_C_NUM_EPS]; |
485 | }; | 486 | }; |
486 | 487 | ||
487 | #ifdef CONFIG_PM | 488 | #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \ |
489 | defined(CONFIG_ARCH_OMAP4) | ||
488 | extern void musb_platform_save_context(struct musb *musb, | 490 | extern void musb_platform_save_context(struct musb *musb, |
489 | struct musb_context_registers *musb_context); | 491 | struct musb_context_registers *musb_context); |
490 | extern void musb_platform_restore_context(struct musb *musb, | 492 | extern void musb_platform_restore_context(struct musb *musb, |
diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c index 1008044a3bbc..dc66e4376d49 100644 --- a/drivers/usb/musb/musbhsdma.c +++ b/drivers/usb/musb/musbhsdma.c | |||
@@ -132,18 +132,9 @@ static void configure_channel(struct dma_channel *channel, | |||
132 | if (mode) { | 132 | if (mode) { |
133 | csr |= 1 << MUSB_HSDMA_MODE1_SHIFT; | 133 | csr |= 1 << MUSB_HSDMA_MODE1_SHIFT; |
134 | BUG_ON(len < packet_sz); | 134 | BUG_ON(len < packet_sz); |
135 | |||
136 | if (packet_sz >= 64) { | ||
137 | csr |= MUSB_HSDMA_BURSTMODE_INCR16 | ||
138 | << MUSB_HSDMA_BURSTMODE_SHIFT; | ||
139 | } else if (packet_sz >= 32) { | ||
140 | csr |= MUSB_HSDMA_BURSTMODE_INCR8 | ||
141 | << MUSB_HSDMA_BURSTMODE_SHIFT; | ||
142 | } else if (packet_sz >= 16) { | ||
143 | csr |= MUSB_HSDMA_BURSTMODE_INCR4 | ||
144 | << MUSB_HSDMA_BURSTMODE_SHIFT; | ||
145 | } | ||
146 | } | 135 | } |
136 | csr |= MUSB_HSDMA_BURSTMODE_INCR16 | ||
137 | << MUSB_HSDMA_BURSTMODE_SHIFT; | ||
147 | 138 | ||
148 | csr |= (musb_channel->epnum << MUSB_HSDMA_ENDPOINT_SHIFT) | 139 | csr |= (musb_channel->epnum << MUSB_HSDMA_ENDPOINT_SHIFT) |
149 | | (1 << MUSB_HSDMA_ENABLE_SHIFT) | 140 | | (1 << MUSB_HSDMA_ENABLE_SHIFT) |
diff --git a/drivers/usb/otg/ulpi.c b/drivers/usb/otg/ulpi.c index b1b346932946..d331b222ad21 100644 --- a/drivers/usb/otg/ulpi.c +++ b/drivers/usb/otg/ulpi.c | |||
@@ -59,12 +59,17 @@ static int ulpi_set_flags(struct otg_transceiver *otg) | |||
59 | 59 | ||
60 | static int ulpi_init(struct otg_transceiver *otg) | 60 | static int ulpi_init(struct otg_transceiver *otg) |
61 | { | 61 | { |
62 | int i, vid, pid; | 62 | int i, vid, pid, ret; |
63 | 63 | u32 ulpi_id = 0; | |
64 | vid = (otg_io_read(otg, ULPI_VENDOR_ID_HIGH) << 8) | | 64 | |
65 | otg_io_read(otg, ULPI_VENDOR_ID_LOW); | 65 | for (i = 0; i < 4; i++) { |
66 | pid = (otg_io_read(otg, ULPI_PRODUCT_ID_HIGH) << 8) | | 66 | ret = otg_io_read(otg, ULPI_PRODUCT_ID_HIGH - i); |
67 | otg_io_read(otg, ULPI_PRODUCT_ID_LOW); | 67 | if (ret < 0) |
68 | return ret; | ||
69 | ulpi_id = (ulpi_id << 8) | ret; | ||
70 | } | ||
71 | vid = ulpi_id & 0xffff; | ||
72 | pid = ulpi_id >> 16; | ||
68 | 73 | ||
69 | pr_info("ULPI transceiver vendor/product ID 0x%04x/0x%04x\n", vid, pid); | 74 | pr_info("ULPI transceiver vendor/product ID 0x%04x/0x%04x\n", vid, pid); |
70 | 75 | ||
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 79dd1ae195e5..da7e334b0407 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -653,7 +653,6 @@ static struct usb_device_id id_table_combined [] = { | |||
653 | { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) }, | 653 | { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) }, |
654 | { USB_DEVICE(EVOLUTION_VID, EVO_HYBRID_PID) }, | 654 | { USB_DEVICE(EVOLUTION_VID, EVO_HYBRID_PID) }, |
655 | { USB_DEVICE(EVOLUTION_VID, EVO_RCM4_PID) }, | 655 | { USB_DEVICE(EVOLUTION_VID, EVO_RCM4_PID) }, |
656 | { USB_DEVICE(CONTEC_VID, CONTEC_COM1USBH_PID) }, | ||
657 | { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) }, | 656 | { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) }, |
658 | { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) }, | 657 | { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) }, |
659 | { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16C_PID) }, | 658 | { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16C_PID) }, |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 94d86c3febcb..bbc159a1df45 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -501,13 +501,6 @@ | |||
501 | #define CONTEC_COM1USBH_PID 0x8311 /* COM-1(USB)H */ | 501 | #define CONTEC_COM1USBH_PID 0x8311 /* COM-1(USB)H */ |
502 | 502 | ||
503 | /* | 503 | /* |
504 | * Contec products (http://www.contec.com) | ||
505 | * Submitted by Daniel Sangorrin | ||
506 | */ | ||
507 | #define CONTEC_VID 0x06CE /* Vendor ID */ | ||
508 | #define CONTEC_COM1USBH_PID 0x8311 /* COM-1(USB)H */ | ||
509 | |||
510 | /* | ||
511 | * Definitions for B&B Electronics products. | 504 | * Definitions for B&B Electronics products. |
512 | */ | 505 | */ |
513 | #define BANDB_VID 0x0856 /* B&B Electronics Vendor ID */ | 506 | #define BANDB_VID 0x0856 /* B&B Electronics Vendor ID */ |
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c index 04bb759536bb..93d72eb8cafc 100644 --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c | |||
@@ -139,6 +139,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
139 | "Could not set interface, error %d\n", | 139 | "Could not set interface, error %d\n", |
140 | retval); | 140 | retval); |
141 | retval = -ENODEV; | 141 | retval = -ENODEV; |
142 | kfree(data); | ||
142 | } | 143 | } |
143 | return retval; | 144 | return retval; |
144 | } | 145 | } |
@@ -155,6 +156,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
155 | "Could not set interface, error %d\n", | 156 | "Could not set interface, error %d\n", |
156 | retval); | 157 | retval); |
157 | retval = -ENODEV; | 158 | retval = -ENODEV; |
159 | kfree(data); | ||
158 | } | 160 | } |
159 | return retval; | 161 | return retval; |
160 | } | 162 | } |
@@ -163,6 +165,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
163 | default: | 165 | default: |
164 | dev_err(&serial->dev->dev, | 166 | dev_err(&serial->dev->dev, |
165 | "unknown number of interfaces: %d\n", nintf); | 167 | "unknown number of interfaces: %d\n", nintf); |
168 | kfree(data); | ||
166 | return -ENODEV; | 169 | return -ENODEV; |
167 | } | 170 | } |
168 | 171 | ||
diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c index 76e7dac6f259..70b1d9d51c96 100644 --- a/drivers/video/geode/gxfb_core.c +++ b/drivers/video/geode/gxfb_core.c | |||
@@ -40,7 +40,7 @@ static int vram; | |||
40 | static int vt_switch; | 40 | static int vt_switch; |
41 | 41 | ||
42 | /* Modes relevant to the GX (taken from modedb.c) */ | 42 | /* Modes relevant to the GX (taken from modedb.c) */ |
43 | static struct fb_videomode gx_modedb[] __initdata = { | 43 | static struct fb_videomode gx_modedb[] __devinitdata = { |
44 | /* 640x480-60 VESA */ | 44 | /* 640x480-60 VESA */ |
45 | { NULL, 60, 640, 480, 39682, 48, 16, 33, 10, 96, 2, | 45 | { NULL, 60, 640, 480, 39682, 48, 16, 33, 10, 96, 2, |
46 | 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, | 46 | 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, |
@@ -110,14 +110,15 @@ static struct fb_videomode gx_modedb[] __initdata = { | |||
110 | #ifdef CONFIG_OLPC | 110 | #ifdef CONFIG_OLPC |
111 | #include <asm/olpc.h> | 111 | #include <asm/olpc.h> |
112 | 112 | ||
113 | static struct fb_videomode gx_dcon_modedb[] __initdata = { | 113 | static struct fb_videomode gx_dcon_modedb[] __devinitdata = { |
114 | /* The only mode the DCON has is 1200x900 */ | 114 | /* The only mode the DCON has is 1200x900 */ |
115 | { NULL, 50, 1200, 900, 17460, 24, 8, 4, 5, 8, 3, | 115 | { NULL, 50, 1200, 900, 17460, 24, 8, 4, 5, 8, 3, |
116 | FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | 116 | FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, |
117 | FB_VMODE_NONINTERLACED, 0 } | 117 | FB_VMODE_NONINTERLACED, 0 } |
118 | }; | 118 | }; |
119 | 119 | ||
120 | static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size) | 120 | static void __devinit get_modedb(struct fb_videomode **modedb, |
121 | unsigned int *size) | ||
121 | { | 122 | { |
122 | if (olpc_has_dcon()) { | 123 | if (olpc_has_dcon()) { |
123 | *modedb = (struct fb_videomode *) gx_dcon_modedb; | 124 | *modedb = (struct fb_videomode *) gx_dcon_modedb; |
@@ -129,7 +130,8 @@ static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size) | |||
129 | } | 130 | } |
130 | 131 | ||
131 | #else | 132 | #else |
132 | static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size) | 133 | static void __devinit get_modedb(struct fb_videomode **modedb, |
134 | unsigned int *size) | ||
133 | { | 135 | { |
134 | *modedb = (struct fb_videomode *) gx_modedb; | 136 | *modedb = (struct fb_videomode *) gx_modedb; |
135 | *size = ARRAY_SIZE(gx_modedb); | 137 | *size = ARRAY_SIZE(gx_modedb); |
@@ -226,7 +228,8 @@ static int gxfb_blank(int blank_mode, struct fb_info *info) | |||
226 | return gx_blank_display(info, blank_mode); | 228 | return gx_blank_display(info, blank_mode); |
227 | } | 229 | } |
228 | 230 | ||
229 | static int __init gxfb_map_video_memory(struct fb_info *info, struct pci_dev *dev) | 231 | static int __devinit gxfb_map_video_memory(struct fb_info *info, |
232 | struct pci_dev *dev) | ||
230 | { | 233 | { |
231 | struct gxfb_par *par = info->par; | 234 | struct gxfb_par *par = info->par; |
232 | int ret; | 235 | int ret; |
@@ -290,7 +293,7 @@ static struct fb_ops gxfb_ops = { | |||
290 | .fb_imageblit = cfb_imageblit, | 293 | .fb_imageblit = cfb_imageblit, |
291 | }; | 294 | }; |
292 | 295 | ||
293 | static struct fb_info * __init gxfb_init_fbinfo(struct device *dev) | 296 | static struct fb_info *__devinit gxfb_init_fbinfo(struct device *dev) |
294 | { | 297 | { |
295 | struct gxfb_par *par; | 298 | struct gxfb_par *par; |
296 | struct fb_info *info; | 299 | struct fb_info *info; |
@@ -371,7 +374,8 @@ static int gxfb_resume(struct pci_dev *pdev) | |||
371 | } | 374 | } |
372 | #endif | 375 | #endif |
373 | 376 | ||
374 | static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id) | 377 | static int __devinit gxfb_probe(struct pci_dev *pdev, |
378 | const struct pci_device_id *id) | ||
375 | { | 379 | { |
376 | struct gxfb_par *par; | 380 | struct gxfb_par *par; |
377 | struct fb_info *info; | 381 | struct fb_info *info; |
@@ -451,7 +455,7 @@ static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *i | |||
451 | return ret; | 455 | return ret; |
452 | } | 456 | } |
453 | 457 | ||
454 | static void gxfb_remove(struct pci_dev *pdev) | 458 | static void __devexit gxfb_remove(struct pci_dev *pdev) |
455 | { | 459 | { |
456 | struct fb_info *info = pci_get_drvdata(pdev); | 460 | struct fb_info *info = pci_get_drvdata(pdev); |
457 | struct gxfb_par *par = info->par; | 461 | struct gxfb_par *par = info->par; |
diff --git a/drivers/video/geode/lxfb_core.c b/drivers/video/geode/lxfb_core.c index 1a18da86d3fa..39bdbedf43b4 100644 --- a/drivers/video/geode/lxfb_core.c +++ b/drivers/video/geode/lxfb_core.c | |||
@@ -35,7 +35,7 @@ static int vt_switch; | |||
35 | * we try to make it something sane - 640x480-60 is sane | 35 | * we try to make it something sane - 640x480-60 is sane |
36 | */ | 36 | */ |
37 | 37 | ||
38 | static struct fb_videomode geode_modedb[] __initdata = { | 38 | static struct fb_videomode geode_modedb[] __devinitdata = { |
39 | /* 640x480-60 */ | 39 | /* 640x480-60 */ |
40 | { NULL, 60, 640, 480, 39682, 48, 8, 25, 2, 88, 2, | 40 | { NULL, 60, 640, 480, 39682, 48, 8, 25, 2, 88, 2, |
41 | FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | 41 | FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, |
@@ -219,14 +219,15 @@ static struct fb_videomode geode_modedb[] __initdata = { | |||
219 | #ifdef CONFIG_OLPC | 219 | #ifdef CONFIG_OLPC |
220 | #include <asm/olpc.h> | 220 | #include <asm/olpc.h> |
221 | 221 | ||
222 | static struct fb_videomode olpc_dcon_modedb[] __initdata = { | 222 | static struct fb_videomode olpc_dcon_modedb[] __devinitdata = { |
223 | /* The only mode the DCON has is 1200x900 */ | 223 | /* The only mode the DCON has is 1200x900 */ |
224 | { NULL, 50, 1200, 900, 17460, 24, 8, 4, 5, 8, 3, | 224 | { NULL, 50, 1200, 900, 17460, 24, 8, 4, 5, 8, 3, |
225 | FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | 225 | FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, |
226 | FB_VMODE_NONINTERLACED, 0 } | 226 | FB_VMODE_NONINTERLACED, 0 } |
227 | }; | 227 | }; |
228 | 228 | ||
229 | static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size) | 229 | static void __devinit get_modedb(struct fb_videomode **modedb, |
230 | unsigned int *size) | ||
230 | { | 231 | { |
231 | if (olpc_has_dcon()) { | 232 | if (olpc_has_dcon()) { |
232 | *modedb = (struct fb_videomode *) olpc_dcon_modedb; | 233 | *modedb = (struct fb_videomode *) olpc_dcon_modedb; |
@@ -238,7 +239,8 @@ static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size) | |||
238 | } | 239 | } |
239 | 240 | ||
240 | #else | 241 | #else |
241 | static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size) | 242 | static void __devinit get_modedb(struct fb_videomode **modedb, |
243 | unsigned int *size) | ||
242 | { | 244 | { |
243 | *modedb = (struct fb_videomode *) geode_modedb; | 245 | *modedb = (struct fb_videomode *) geode_modedb; |
244 | *size = ARRAY_SIZE(geode_modedb); | 246 | *size = ARRAY_SIZE(geode_modedb); |
@@ -334,7 +336,7 @@ static int lxfb_blank(int blank_mode, struct fb_info *info) | |||
334 | } | 336 | } |
335 | 337 | ||
336 | 338 | ||
337 | static int __init lxfb_map_video_memory(struct fb_info *info, | 339 | static int __devinit lxfb_map_video_memory(struct fb_info *info, |
338 | struct pci_dev *dev) | 340 | struct pci_dev *dev) |
339 | { | 341 | { |
340 | struct lxfb_par *par = info->par; | 342 | struct lxfb_par *par = info->par; |
@@ -412,7 +414,7 @@ static struct fb_ops lxfb_ops = { | |||
412 | .fb_imageblit = cfb_imageblit, | 414 | .fb_imageblit = cfb_imageblit, |
413 | }; | 415 | }; |
414 | 416 | ||
415 | static struct fb_info * __init lxfb_init_fbinfo(struct device *dev) | 417 | static struct fb_info * __devinit lxfb_init_fbinfo(struct device *dev) |
416 | { | 418 | { |
417 | struct lxfb_par *par; | 419 | struct lxfb_par *par; |
418 | struct fb_info *info; | 420 | struct fb_info *info; |
@@ -496,7 +498,7 @@ static int lxfb_resume(struct pci_dev *pdev) | |||
496 | #define lxfb_resume NULL | 498 | #define lxfb_resume NULL |
497 | #endif | 499 | #endif |
498 | 500 | ||
499 | static int __init lxfb_probe(struct pci_dev *pdev, | 501 | static int __devinit lxfb_probe(struct pci_dev *pdev, |
500 | const struct pci_device_id *id) | 502 | const struct pci_device_id *id) |
501 | { | 503 | { |
502 | struct lxfb_par *par; | 504 | struct lxfb_par *par; |
@@ -588,7 +590,7 @@ err: | |||
588 | return ret; | 590 | return ret; |
589 | } | 591 | } |
590 | 592 | ||
591 | static void lxfb_remove(struct pci_dev *pdev) | 593 | static void __devexit lxfb_remove(struct pci_dev *pdev) |
592 | { | 594 | { |
593 | struct fb_info *info = pci_get_drvdata(pdev); | 595 | struct fb_info *info = pci_get_drvdata(pdev); |
594 | struct lxfb_par *par = info->par; | 596 | struct lxfb_par *par = info->par; |
diff --git a/drivers/video/nuc900fb.c b/drivers/video/nuc900fb.c index d4cde79ea15e..81687ed26ba9 100644 --- a/drivers/video/nuc900fb.c +++ b/drivers/video/nuc900fb.c | |||
@@ -596,8 +596,6 @@ static int __devinit nuc900fb_probe(struct platform_device *pdev) | |||
596 | goto release_regs; | 596 | goto release_regs; |
597 | } | 597 | } |
598 | 598 | ||
599 | nuc900_driver_clksrc_div(&pdev->dev, "ext", 0x2); | ||
600 | |||
601 | fbi->clk = clk_get(&pdev->dev, NULL); | 599 | fbi->clk = clk_get(&pdev->dev, NULL); |
602 | if (!fbi->clk || IS_ERR(fbi->clk)) { | 600 | if (!fbi->clk || IS_ERR(fbi->clk)) { |
603 | printk(KERN_ERR "nuc900-lcd:failed to get lcd clock source\n"); | 601 | printk(KERN_ERR "nuc900-lcd:failed to get lcd clock source\n"); |