static int s3c24xx_serial_cpufreq_transition(struct notifier_block *nb, unsigned long val, void *data) { struct s3c24xx_uart_port *port; struct uart_port *uport; port = container_of(nb, struct s3c24xx_uart_port, freq_transition); uport = &port->port; /* check to see if port is enabled */ if (port->pm_level != 0) return 0; /* try and work out if the baudrate is changing, we can detect * a change in rate, but we do not have support for detecting * a disturbance in the clock-rate over the change. */ if (IS_ERR(port->clk)) goto exit; if (port->baudclk_rate == clk_get_rate(port->clk)) goto exit; if (val == CPUFREQ_PRECHANGE) { /* we should really shut the port down whilst the * frequency change is in progress. */ } else if (val == CPUFREQ_POSTCHANGE) { struct ktermios *termios; struct tty_struct *tty; if (uport->state == NULL) goto exit; tty = uport->state->port.tty; if (tty == NULL) goto exit; termios = tty->termios; if (termios == NULL) { printk(KERN_WARNING "%s: no termios?\n", __func__); goto exit; } s3c24xx_serial_set_termios(uport, termios, NULL); } exit: return 0; }
static int s3c24xx_serial_cpufreq_transition(struct notifier_block *nb, unsigned long val, void *data) { struct s3c24xx_uart_port *port; struct uart_port *uport; port = container_of(nb, struct s3c24xx_uart_port, freq_transition); uport = &port->port; if (port->pm_level != 0) return 0; if (IS_ERR(port->clk)) goto exit; if (port->baudclk_rate == clk_get_rate(port->clk)) goto exit; if (val == CPUFREQ_PRECHANGE) { } else if (val == CPUFREQ_POSTCHANGE) { struct ktermios *termios; struct tty_struct *tty; if (uport->state == NULL) goto exit; tty = uport->state->port.tty; if (tty == NULL) goto exit; termios = tty->termios; if (termios == NULL) { printk(KERN_WARNING "%s: no termios?\n", __func__); goto exit; } s3c24xx_serial_set_termios(uport, termios, NULL); } exit: return 0; }