usb/io_edgeport: remove
Subsystems (3)
PATCH 33/33 usb/io_edgeport: remove
Quoted 5 lines · Greg KH
Quoted 4 lines · Nishanth Aravamudan
Hi,
Please consider applying.
Quoted 7 lines
Quoted 5 lines
Description: Use
wait_event_timeout()instead of deprecatedinterruptible_sleep_on_timeout(). Signals are not checked in the current code, so interruptible should not be necessary. Patch is compile-tested.Signed-off-by Nishanth Aravamudan <[email protected]>Applied, thanks.
Greg,
This should fix the behavior of the previous patch (probably not noticed yet). The wake_up*() was not matched properly in the first patch (fixed below). Please consider reverting the previous patch and applying this one instead.
Thanks,
Nish
Description: Use wait_event_timeout() instead of deprecated interruptible_sleep_on_timeout() in one place. Directly use wait-queues in other locations to remove remaining callers of interruptible_sleep_on_timeout(). Signals are not checked in the current code, so interruptible should not be necessary. Thus, the wake_up*() calls were modified to match the wait_event*() ones. There were some naming conflicts, which I tried to resolve appropriately. The final replacement is within a #if 0 / #endif section of code, but in case that code is ever used again, I would prefer it had the correct interface :) Patch is compile-tested.
drivers/usb/serial/io_edgeport.c +21 -20
@@ -261,6 +261,7 @@#include <linux/spinlock.h> #include <linux/serial.h> #include <linux/ioctl.h> +#include <linux/wait.h> #include <asm/uaccess.h> #include <linux/usb.h> #include "usb-serial.h"
@@ -991,7 +992,6 @@ static int edge_open (struct usb_serial_struct usb_serial *serial;struct edgeport_serial *edge_serial;int response; -int timeout;dbg ("%s - port %d" , __FUNCTION__, port->number);
@@ -1073,10 +1073,7 @@ static int edge_open (struct usb_serial_ }/* now wait for the port to be completely opened */ - timeout =OPEN_TIMEOUT ; -while (timeout && edge_port->openPending == TRUE) { - timeout =interruptible_sleep_on_timeout (&edge_port->wait_open, timeout); - } +wait_event_timeout (edge_port->wait_open, (edge_port->openPending != TRUE),OPEN_TIMEOUT );if (edge_port->open == FALSE) {/* open timed out */
@@ -1128,9 +1125,10 @@ static int edge_open (struct usb_serial_************************************************************************/ static void block_until_chase_response (struct edgeport_port *edge_port) { +DEFINE_WAIT (wait);__u16 lastCredits;int timeout =1 *HZ ; -int wait =10 ; +int loop =10 ;while (1 ) {// Save Last credits
@@ -1148,12 +1146,14 @@ static void block_until_chase_response(s }// Block the thread for a while -interruptible_sleep_on_timeout (&edge_port->wait_chase, timeout); +prepare_to_wait (&edge_port->wait_chase, &wait,TASK_UNINTERRUPTIBLE ); +schedule_timeout (timeout); +finish_wait (&edge_port->wait_chase, &wait);if (lastCredits == edge_port->txCredits) {// No activity.. count down. - wait--; -if (wait ==0 ) { + loop--; +if (loop ==0 ) { edge_port->chaseResponsePending = FALSE;dbg ("%s - Chase TIMEOUT" , __FUNCTION__);return ;
@@ -1161,7 +1161,7 @@ static void block_until_chase_response(s }else {// Reset timout value back to 10 seconds dbg ("%s - Last %d, Current %d" , __FUNCTION__, lastCredits, edge_port->txCredits); - wait =10 ; + loop =10 ; } } }
@@ -1179,10 +1179,11 @@ static void block_until_chase_response(s************************************************************************/ static void block_until_tx_empty (struct edgeport_port *edge_port) { +DEFINE_WAIT (wait);struct TxFifo *fifo = &edge_port->txfifo;__u32 lastCount;int timeout =HZ /10 ; -int wait =30 ; +int loop =30 ;while (1 ) {// Save Last count
@@ -1195,20 +1196,22 @@ static void block_until_tx_empty (struct }// Block the thread for a while -interruptible_sleep_on_timeout (&edge_port->wait_chase, timeout); +prepare_to_wait (&edge_port->wait_chase, &wait,TASK_UNINTERRUPTIBLE ); +schedule_timeout (timeout); +finish_wait (&edge_port->wait_chase, &wait);dbg ("%s wait" , __FUNCTION__);if (lastCount == fifo->count) {// No activity.. count down. - wait--; -if (wait ==0 ) { + loop--; +if (loop ==0 ) {dbg ("%s - TIMEOUT" , __FUNCTION__);return ; } }else {// Reset timout value back to seconds - wait =30 ; + loop =30 ; } } }
@@ -2108,7 +2111,7 @@ static void process_rcvd_status (struct// We could choose to do something else when Byte3 says Timeout on Chase from Edgeport, // like wait longer in block_until_chase_response, but for now we don't. edge_port->chaseResponsePending = FALSE; -wake_up_interruptible (&edge_port->wait_chase); +wake_up (&edge_port->wait_chase);return ;case IOSP_EXT_STATUS_RX_CHECK_RSP :
@@ -2131,7 +2134,7 @@ static void process_rcvd_status (struct/* we have completed the open */ edge_port->openPending = FALSE; edge_port->open = TRUE; -wake_up_interruptible (&edge_port->wait_open); +wake_up (&edge_port->wait_open);return ; }
@@ -2500,9 +2503,7 @@ static int write_cmd_usb (struct edgepor// wait for command to finish timeout =COMMAND_TIMEOUT ;#if 0 -while (timeout && edge_port->commandPending == TRUE) { - timeout =interruptible_sleep_on_timeout (&edge_port->wait_command, timeout); - } +wait_event (&edge_port->wait_command, (edge_port->commandPending == FALSE));if (edge_port->commandPending == TRUE) {/* command timed out */
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors