Skip to content

Commit 633e2b2

Browse files
Anthony Malletgregkh
authored andcommitted
USB: cdc-acm: fix close_delay and closing_wait units in TIOCSSERIAL
close_delay and closing_wait are specified in hundredth of a second but stored internally in jiffies. Use the jiffies_to_msecs() and msecs_to_jiffies() functions to convert from each other. Signed-off-by: Anthony Mallet <[email protected]> Cc: stable <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 75d7676 commit 633e2b2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/usb/class/cdc-acm.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -896,10 +896,10 @@ static int get_serial_info(struct tty_struct *tty, struct serial_struct *ss)
896896

897897
ss->xmit_fifo_size = acm->writesize;
898898
ss->baud_base = le32_to_cpu(acm->line.dwDTERate);
899-
ss->close_delay = acm->port.close_delay / 10;
899+
ss->close_delay = jiffies_to_msecs(acm->port.close_delay) / 10;
900900
ss->closing_wait = acm->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ?
901901
ASYNC_CLOSING_WAIT_NONE :
902-
acm->port.closing_wait / 10;
902+
jiffies_to_msecs(acm->port.closing_wait) / 10;
903903
return 0;
904904
}
905905

@@ -909,9 +909,10 @@ static int set_serial_info(struct tty_struct *tty, struct serial_struct *ss)
909909
unsigned int closing_wait, close_delay;
910910
int retval = 0;
911911

912-
close_delay = ss->close_delay * 10;
912+
close_delay = msecs_to_jiffies(ss->close_delay * 10);
913913
closing_wait = ss->closing_wait == ASYNC_CLOSING_WAIT_NONE ?
914-
ASYNC_CLOSING_WAIT_NONE : ss->closing_wait * 10;
914+
ASYNC_CLOSING_WAIT_NONE :
915+
msecs_to_jiffies(ss->closing_wait * 10);
915916

916917
mutex_lock(&acm->port.mutex);
917918

0 commit comments

Comments
 (0)