/*
 * ------------------------------------------------------------
 * rs_stop() and rs_start()
 *
 * This routines are called before setting or resetting tty->stopped.
 * They enable or disable transmitter interrupts, as necessary.
 * ------------------------------------------------------------
 */
static void rs_stop(struct tty_struct *tty)
{
    struct s3c3410_serial *info = (struct s3c3410_serial *) tty->driver_data;
    unsigned long flags = 0;

    if	(serial_paranoia_check(info, tty->device, "rs_stop"))
    	return;

    save_flags(flags);
    cli();
    tx_stop();
    rx_stop();
    restore_flags(flags);
}
Exemple #2
0
static int whitebox_release(struct inode* inode, struct file* filp) {
    struct whitebox_user_source *user_source = &whitebox_device->user_source;
    struct whitebox_rf_sink *rf_sink = &whitebox_device->rf_sink;
    struct whitebox_user_sink *user_sink = &whitebox_device->user_sink;
    struct whitebox_rf_source *rf_source = &whitebox_device->rf_source;
    d_printk(2, "whitebox release\n");
    
    if (atomic_read(&use_count) != 1) {
        d_printk(0, "Device not in use");
        return -ENOENT;
    }

    if (whitebox_device->state == WDS_TX || whitebox_device->state == WDS_TX_STREAMING) {
        while (tx_stop(whitebox_device) < 0)
            cpu_relax();
    }
    if (whitebox_device->state == WDS_RX || whitebox_device->state == WDS_RX_STREAMING) {
        while (rx_stop(whitebox_device) < 0)
            cpu_relax();
    }

    // Turn off LO
    whitebox_device->adf4351_regs[2] |= WA_PD_MASK;
    whitebox_gpio_adf4351_write(whitebox_device->platform_data,
        whitebox_device->adf4351_regs[2]);

    // Disable DAC
    whitebox_gpio_dac_disable(whitebox_device->platform_data);

    whitebox_rf_sink_free(rf_sink);
    whitebox_user_source_free(user_source);
    whitebox_rf_source_free(rf_source);
    whitebox_user_sink_free(user_sink);

    atomic_dec(&use_count);
    return 0;
}