diff --git a/arch/arm/src/a1x/a1x_serial.c b/arch/arm/src/a1x/a1x_serial.c index 3e6de03544..10027ceeb7 100644 --- a/arch/arm/src/a1x/a1x_serial.c +++ b/arch/arm/src/a1x/a1x_serial.c @@ -1270,8 +1270,6 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) * that only one speed is supported. */ - /* Get the c_speed field in the termios struct */ - priv->baud = cfgetispeed(termiosp); /* TODO: Re-calculate the optimal CCLK divisor for the new baud and diff --git a/arch/arm/src/am335x/am335x_serial.c b/arch/arm/src/am335x/am335x_serial.c index 708b3d91ba..d11a02b19d 100644 --- a/arch/arm/src/am335x/am335x_serial.c +++ b/arch/arm/src/am335x/am335x_serial.c @@ -1090,8 +1090,6 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) * that only one speed is supported. */ - /* Get the c_speed field in the termios struct */ - priv->baud = cfgetispeed(termiosp); /* TODO: Re-calculate the optimal CCLK divisor for the new baud and diff --git a/arch/arm/src/cxd56xx/cxd56_serial.c b/arch/arm/src/cxd56xx/cxd56_serial.c index cd699daa01..c44be0070b 100644 --- a/arch/arm/src/cxd56xx/cxd56_serial.c +++ b/arch/arm/src/cxd56xx/cxd56_serial.c @@ -778,8 +778,6 @@ static int up_ioctl(FAR struct file *filep, int cmd, unsigned long arg) flags = spin_lock_irqsave(); - cfsetispeed(termiosp, priv->baud); - termiosp->c_cflag = ((priv->parity != 0) ? PARENB : 0) | ((priv->parity == 1) ? PARODD : 0) | #ifdef CONFIG_SERIAL_OFLOWCONTROL @@ -790,6 +788,8 @@ static int up_ioctl(FAR struct file *filep, int cmd, unsigned long arg) #endif ((priv->stopbits2) ? CSTOPB : 0); + cfsetispeed(termiosp, priv->baud); + switch (priv->bits) { case 5: diff --git a/arch/arm/src/efm32/efm32_serial.c b/arch/arm/src/efm32/efm32_serial.c index f149f8236b..3e4d24b336 100644 --- a/arch/arm/src/efm32/efm32_serial.c +++ b/arch/arm/src/efm32/efm32_serial.c @@ -839,8 +839,6 @@ static int efm32_ioctl(struct file *filep, int cmd, unsigned long arg) break; } - cfsetispeed(termiosp, priv->config->baud); - /* Note that since we only support 8/9 bit modes and * there is no way to report 9-bit mode, we always claim 8. */ @@ -848,6 +846,8 @@ static int efm32_ioctl(struct file *filep, int cmd, unsigned long arg) termiosp->c_cflag = CS8; /* TODO: PARENB, PARODD, CSTOPB, CCTS_IFLOW, CCTS_OFLOW */ + + cfsetispeed(termiosp, priv->config->baud); } break; diff --git a/arch/arm/src/imxrt/imxrt_serial.c b/arch/arm/src/imxrt/imxrt_serial.c index 838c0fb06d..17e3abf6ca 100644 --- a/arch/arm/src/imxrt/imxrt_serial.c +++ b/arch/arm/src/imxrt/imxrt_serial.c @@ -1155,10 +1155,6 @@ static int imxrt_ioctl(struct file *filep, int cmd, unsigned long arg) break; } - /* Return baud */ - - cfsetispeed(termiosp, priv->baud); - /* Return parity */ termiosp->c_cflag = ((priv->parity != 0) ? PARENB : 0) | @@ -1176,6 +1172,10 @@ static int imxrt_ioctl(struct file *filep, int cmd, unsigned long arg) #ifdef CONFIG_SERIAL_IFLOWCONTROL termiosp->c_cflag |= ((priv->iflow) ? CRTS_IFLOW : 0); #endif + /* Return baud */ + + cfsetispeed(termiosp, priv->baud); + /* Return number of bits */ switch (priv->bits) diff --git a/arch/arm/src/kinetis/kinetis_serial.c b/arch/arm/src/kinetis/kinetis_serial.c index 55245570a1..52ce2369b8 100644 --- a/arch/arm/src/kinetis/kinetis_serial.c +++ b/arch/arm/src/kinetis/kinetis_serial.c @@ -1341,8 +1341,6 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) break; } - cfsetispeed(termiosp, priv->baud); - /* Note: CSIZE only supports 5-8 bits. The driver only support 8/9 bit * modes and therefore is no way to report 9-bit mode, we always claim * 8 bit mode. @@ -1360,6 +1358,8 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) # endif CS8; + cfsetispeed(termiosp, priv->baud); + /* TODO: CCTS_IFLOW, CCTS_OFLOW */ } break; diff --git a/arch/arm/src/lc823450/lc823450_serial.c b/arch/arm/src/lc823450/lc823450_serial.c index a7ce831b60..7003f78f06 100644 --- a/arch/arm/src/lc823450/lc823450_serial.c +++ b/arch/arm/src/lc823450/lc823450_serial.c @@ -757,8 +757,6 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) break; } - cfsetispeed(termiosp, priv->baud); - /* Note that since we only support 8/9 bit modes and * there is no way to report 9-bit mode, we always claim 8. */ @@ -773,6 +771,8 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) ((priv->iflow) ? CRTS_IFLOW : 0) | #endif CS8; + + cfsetispeed(termiosp, priv->baud); } break; diff --git a/arch/arm/src/lpc17xx_40xx/lpc17_40_serial.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_serial.c index 1f2a6f1559..6e921cc617 100644 --- a/arch/arm/src/lpc17xx_40xx/lpc17_40_serial.c +++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_serial.c @@ -1391,8 +1391,6 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) * that only one speed is supported. */ - /* Get the c_speed field in the termios struct */ - priv->baud = cfgetispeed(termiosp); /* TODO: Re-calculate the optimal CCLK divisor for the new baud and diff --git a/arch/arm/src/nrf52/nrf52_serial.c b/arch/arm/src/nrf52/nrf52_serial.c index 6f59ead8fc..860b3d7d9f 100644 --- a/arch/arm/src/nrf52/nrf52_serial.c +++ b/arch/arm/src/nrf52/nrf52_serial.c @@ -475,12 +475,6 @@ static int nrf52_ioctl(struct file *filep, int cmd, unsigned long arg) break; } - /* Get baud */ - - cfsetispeed(termiosp, config->baud); - - /* Get flags */ - termiosp->c_cflag = ((config->parity != 0) ? PARENB : 0) | ((config->parity == 1) ? PARODD : 0) | ((config->stopbits2) ? CSTOPB : 0) | @@ -492,6 +486,8 @@ static int nrf52_ioctl(struct file *filep, int cmd, unsigned long arg) #endif CS8; + cfsetispeed(termiosp, config->baud); + break; } diff --git a/arch/arm/src/nuc1xx/nuc_serial.c b/arch/arm/src/nuc1xx/nuc_serial.c index 5754266bab..f6d540a103 100644 --- a/arch/arm/src/nuc1xx/nuc_serial.c +++ b/arch/arm/src/nuc1xx/nuc_serial.c @@ -797,8 +797,6 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) * that only one speed is supported. */ - /* Get the c_speed field in the termios struct */ - priv->baud = cfgetispeed(termiosp); /* Reset the baud */ diff --git a/arch/arm/src/s32k1xx/s32k1xx_serial.c b/arch/arm/src/s32k1xx/s32k1xx_serial.c index 492ecd169c..cd1eea7764 100644 --- a/arch/arm/src/s32k1xx/s32k1xx_serial.c +++ b/arch/arm/src/s32k1xx/s32k1xx_serial.c @@ -727,10 +727,6 @@ static int s32k1xx_ioctl(struct file *filep, int cmd, unsigned long arg) break; } - /* Return baud */ - - cfsetispeed(termiosp, priv->baud); - /* Return parity */ termiosp->c_cflag = ((priv->parity != 0) ? PARENB : 0) | @@ -748,6 +744,10 @@ static int s32k1xx_ioctl(struct file *filep, int cmd, unsigned long arg) #ifdef CONFIG_SERIAL_IFLOWCONTROL termiosp->c_cflag |= ((priv->iflow) ? CRTS_IFLOW : 0); #endif + /* Return baud */ + + cfsetispeed(termiosp, priv->baud); + /* Return number of bits */ switch (priv->bits) diff --git a/arch/arm/src/sam34/sam_serial.c b/arch/arm/src/sam34/sam_serial.c index 0ff9e9c13b..9f152b1d4d 100644 --- a/arch/arm/src/sam34/sam_serial.c +++ b/arch/arm/src/sam34/sam_serial.c @@ -1013,10 +1013,6 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) break; } - /* Return baud */ - - cfsetispeed(termiosp, priv->baud); - /* Return parity */ termiosp->c_cflag = ((priv->parity != 0) ? PARENB : 0) | @@ -1031,6 +1027,10 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) #if defined(CONFIG_SERIAL_IFLOWCONTROL) || defined(CONFIG_SERIAL_OFLOWCONTROL) termiosp->c_cflag |= (priv->flowc) ? (CCTS_OFLOW | CRTS_IFLOW): 0; #endif + /* Return baud */ + + cfsetispeed(termiosp, priv->baud); + /* Return number of bits */ switch (priv->bits) diff --git a/arch/arm/src/sama5/sam_flexcom_serial.c b/arch/arm/src/sama5/sam_flexcom_serial.c index b2d026074a..802e07bf7a 100644 --- a/arch/arm/src/sama5/sam_flexcom_serial.c +++ b/arch/arm/src/sama5/sam_flexcom_serial.c @@ -820,10 +820,6 @@ static int flexus_ioctl(struct file *filep, int cmd, unsigned long arg) break; } - /* Return baud */ - - cfsetispeed(termiosp, priv->baud); - /* Return parity */ termiosp->c_cflag = ((priv->parity != 0) ? PARENB : 0) | @@ -838,6 +834,10 @@ static int flexus_ioctl(struct file *filep, int cmd, unsigned long arg) #if defined(CONFIG_SERIAL_IFLOWCONTROL) || defined(CONFIG_SERIAL_OFLOWCONTROL) termiosp->c_cflag |= (priv->flowc) ? (CCTS_OFLOW | CRTS_IFLOW): 0; #endif + /* Return baud */ + + cfsetispeed(termiosp, priv->baud); + /* Return number of bits */ switch (priv->bits) diff --git a/arch/arm/src/sama5/sam_serial.c b/arch/arm/src/sama5/sam_serial.c index 8b4472fa77..63af6d18e9 100644 --- a/arch/arm/src/sama5/sam_serial.c +++ b/arch/arm/src/sama5/sam_serial.c @@ -1270,10 +1270,6 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) break; } - /* Return baud */ - - cfsetispeed(termiosp, priv->baud); - /* Return parity */ termiosp->c_cflag = ((priv->parity != 0) ? PARENB : 0) | @@ -1288,6 +1284,10 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) #if defined(CONFIG_SERIAL_IFLOWCONTROL) || defined(CONFIG_SERIAL_OFLOWCONTROL) termiosp->c_cflag |= (priv->flowc) ? (CCTS_OFLOW | CRTS_IFLOW): 0; #endif + /* Return baud */ + + cfsetispeed(termiosp, priv->baud); + /* Return number of bits */ switch (priv->bits) diff --git a/arch/arm/src/samv7/sam_serial.c b/arch/arm/src/samv7/sam_serial.c index 4977c9c8f2..66f468a9ba 100644 --- a/arch/arm/src/samv7/sam_serial.c +++ b/arch/arm/src/samv7/sam_serial.c @@ -1081,10 +1081,6 @@ static int sam_ioctl(struct file *filep, int cmd, unsigned long arg) break; } - /* Return baud */ - - cfsetispeed(termiosp, priv->baud); - /* Return parity */ termiosp->c_cflag = ((priv->parity != 0) ? PARENB : 0) | @@ -1099,6 +1095,10 @@ static int sam_ioctl(struct file *filep, int cmd, unsigned long arg) #if defined(CONFIG_SERIAL_IFLOWCONTROL) || defined(CONFIG_SERIAL_OFLOWCONTROL) termiosp->c_cflag |= (priv->flowc) ? (CCTS_OFLOW | CRTS_IFLOW): 0; #endif + /* Return baud */ + + cfsetispeed(termiosp, priv->baud); + /* Return number of bits */ switch (priv->bits) diff --git a/arch/arm/src/stm32/stm32_serial.c b/arch/arm/src/stm32/stm32_serial.c index efb3d903d1..e2f1670b40 100644 --- a/arch/arm/src/stm32/stm32_serial.c +++ b/arch/arm/src/stm32/stm32_serial.c @@ -2019,8 +2019,6 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) break; } - cfsetispeed(termiosp, priv->baud); - /* Note that since we only support 8/9 bit modes and * there is no way to report 9-bit mode, we always claim 8. */ @@ -2037,6 +2035,8 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) #endif CS8; + cfsetispeed(termiosp, priv->baud); + /* TODO: CCTS_IFLOW, CCTS_OFLOW */ } break; diff --git a/arch/arm/src/stm32f7/stm32_serial.c b/arch/arm/src/stm32f7/stm32_serial.c index ad1f3d1729..19d9116cf9 100644 --- a/arch/arm/src/stm32f7/stm32_serial.c +++ b/arch/arm/src/stm32f7/stm32_serial.c @@ -2568,8 +2568,6 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) break; } - cfsetispeed(termiosp, priv->baud); - /* Note that since we only support 8/9 bit modes and * there is no way to report 9-bit mode, we always claim 8. */ @@ -2586,6 +2584,8 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) #endif CS8; + cfsetispeed(termiosp, priv->baud); + /* TODO: CCTS_IFLOW, CCTS_OFLOW */ } break; diff --git a/arch/arm/src/stm32h7/stm32_serial.c b/arch/arm/src/stm32h7/stm32_serial.c index dcfd3b061e..952fed37a9 100644 --- a/arch/arm/src/stm32h7/stm32_serial.c +++ b/arch/arm/src/stm32h7/stm32_serial.c @@ -1670,8 +1670,6 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) break; } - cfsetispeed(termiosp, priv->baud); - /* Note that since we only support 8/9 bit modes and * there is no way to report 9-bit mode, we always claim 8. */ @@ -1688,6 +1686,8 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) #endif CS8; + cfsetispeed(termiosp, priv->baud); + /* TODO: CCTS_IFLOW, CCTS_OFLOW */ } break; diff --git a/arch/arm/src/stm32l4/stm32l4_serial.c b/arch/arm/src/stm32l4/stm32l4_serial.c index 176e3e678f..d0f3a16205 100644 --- a/arch/arm/src/stm32l4/stm32l4_serial.c +++ b/arch/arm/src/stm32l4/stm32l4_serial.c @@ -2013,8 +2013,6 @@ static int stm32l4serial_ioctl(FAR struct file *filep, int cmd, break; } - cfsetispeed(termiosp, priv->baud); - /* Note that since we only support 8/9 bit modes and * there is no way to report 9-bit mode, we always claim 8. */ @@ -2031,6 +2029,8 @@ static int stm32l4serial_ioctl(FAR struct file *filep, int cmd, #endif CS8; + cfsetispeed(termiosp, priv->baud); + /* TODO: CCTS_IFLOW, CCTS_OFLOW */ } break; diff --git a/arch/arm/src/tiva/common/tiva_serial.c b/arch/arm/src/tiva/common/tiva_serial.c index db77a3be5a..9353c5fdf3 100644 --- a/arch/arm/src/tiva/common/tiva_serial.c +++ b/arch/arm/src/tiva/common/tiva_serial.c @@ -1073,8 +1073,6 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) break; } - cfsetispeed(termiosp, priv->baud); - if (priv->bits >= 5 && priv->bits <= 8) { ccflag |= (CS5 + (priv->bits - 5)); @@ -1099,6 +1097,8 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) */ termiosp->c_cflag = ccflag; + + cfsetispeed(termiosp, priv->baud); } break; diff --git a/arch/arm/src/tms570/tms570_serial.c b/arch/arm/src/tms570/tms570_serial.c index 922303b0a8..995473e499 100644 --- a/arch/arm/src/tms570/tms570_serial.c +++ b/arch/arm/src/tms570/tms570_serial.c @@ -551,10 +551,6 @@ static int tms570_ioctl(struct file *filep, int cmd, unsigned long arg) break; } - /* Return baud */ - - cfsetispeed(termiosp, priv->config.baud); - /* Return parity */ termiosp->c_cflag = ((priv->config.parity != 0) ? PARENB : 0) | @@ -564,6 +560,10 @@ static int tms570_ioctl(struct file *filep, int cmd, unsigned long arg) termiosp->c_cflag |= (priv->config.stopbits2) ? CSTOPB : 0; + /* Return baud */ + + cfsetispeed(termiosp, priv->config.baud); + /* Return number of bits */ switch (priv->config.bits) diff --git a/arch/xtensa/src/esp32/esp32_serial.c b/arch/xtensa/src/esp32/esp32_serial.c index c53f516f13..ddaa6ec69d 100644 --- a/arch/xtensa/src/esp32/esp32_serial.c +++ b/arch/xtensa/src/esp32/esp32_serial.c @@ -845,10 +845,6 @@ static int esp32_ioctl(struct file *filep, int cmd, unsigned long arg) break; } - /* Return baud */ - - cfsetispeed(termiosp, priv->baud); - /* Return parity */ termiosp->c_cflag = ((priv->parity != 0) ? PARENB : 0) | @@ -863,6 +859,10 @@ static int esp32_ioctl(struct file *filep, int cmd, unsigned long arg) #if defined(CONFIG_SERIAL_IFLOWCONTROL) || defined(CONFIG_SERIAL_OFLOWCONTROL) termiosp->c_cflag |= (priv->flowc) ? (CCTS_OFLOW | CRTS_IFLOW): 0; #endif + /* Return baud */ + + cfsetispeed(termiosp, priv->baud); + /* Return number of bits */ switch (priv->bits)