drivers/tty/tty_baudrate.c

Source file repositories/reference/linux-study-clean/drivers/tty/tty_baudrate.c

File Facts

System
Linux kernel
Corpus path
drivers/tty/tty_baudrate.c
Extension
.c
Size
6050 bytes
Lines
216
Domain
Driver Families
Bucket
drivers/tty
Inferred role
Driver Families: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (ofound == i && !ibinput) {
				ifound  = i;
			} else {
				ifound = i;
				termios->c_cflag |= (baud_bits[i] << IBSHIFT);
			}
		}
	} while (++i < n_baud_table);

	/* If we found no match then use BOTHER. */
	if (ofound == -1)
		termios->c_cflag |= BOTHER;
	/* Set exact input bits only if the input and output differ or the
	 * user already did.
	 */
	if (ifound == -1 && (ibaud != obaud || ibinput))
		termios->c_cflag |= (BOTHER << IBSHIFT);
}
EXPORT_SYMBOL_GPL(tty_termios_encode_baud_rate);

/**
 *	tty_encode_baud_rate		-	set baud rate of the tty
 *	@tty:   terminal device
 *	@ibaud: input baud rate
 *	@obaud: output baud rate
 *
 *	Update the current termios data for the tty with the new speed
 *	settings. The caller must hold the termios_rwsem for the tty in
 *	question.
 */

void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud, speed_t obaud)
{
	tty_termios_encode_baud_rate(&tty->termios, ibaud, obaud);
}
EXPORT_SYMBOL_GPL(tty_encode_baud_rate);

Annotation

Implementation Notes