~ubuntu-branches/ubuntu/quantal/linux-linaro-mx51/quantal

« back to all changes in this revision

Viewing changes to drivers/tty/tty_io.c

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-3o58a3c1bj7x00rs
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 *  linux/drivers/char/tty_io.c
3
 
 *
4
2
 *  Copyright (C) 1991, 1992  Linus Torvalds
5
3
 */
6
4
 
964
962
}
965
963
 
966
964
void tty_write_unlock(struct tty_struct *tty)
 
965
        __releases(&tty->atomic_write_lock)
967
966
{
968
967
        mutex_unlock(&tty->atomic_write_lock);
969
968
        wake_up_interruptible_poll(&tty->write_wait, POLLOUT);
970
969
}
971
970
 
972
971
int tty_write_lock(struct tty_struct *tty, int ndelay)
 
972
        __acquires(&tty->atomic_write_lock)
973
973
{
974
974
        if (!mutex_trylock(&tty->atomic_write_lock)) {
975
975
                if (ndelay)
1391
1391
                return ERR_PTR(-ENODEV);
1392
1392
 
1393
1393
        tty = alloc_tty_struct();
1394
 
        if (!tty)
1395
 
                goto fail_no_mem;
 
1394
        if (!tty) {
 
1395
                retval = -ENOMEM;
 
1396
                goto err_module_put;
 
1397
        }
1396
1398
        initialize_tty_struct(tty, driver, idx);
1397
1399
 
1398
1400
        retval = tty_driver_install_tty(driver, tty);
1399
 
        if (retval < 0) {
1400
 
                free_tty_struct(tty);
1401
 
                module_put(driver->owner);
1402
 
                return ERR_PTR(retval);
1403
 
        }
 
1401
        if (retval < 0)
 
1402
                goto err_deinit_tty;
1404
1403
 
1405
1404
        /*
1406
1405
         * Structures all installed ... call the ldisc open routines.
1409
1408
         */
1410
1409
        retval = tty_ldisc_setup(tty, tty->link);
1411
1410
        if (retval)
1412
 
                goto release_mem_out;
 
1411
                goto err_release_tty;
1413
1412
        return tty;
1414
1413
 
1415
 
fail_no_mem:
 
1414
err_deinit_tty:
 
1415
        deinitialize_tty_struct(tty);
 
1416
        free_tty_struct(tty);
 
1417
err_module_put:
1416
1418
        module_put(driver->owner);
1417
 
        return ERR_PTR(-ENOMEM);
 
1419
        return ERR_PTR(retval);
1418
1420
 
1419
1421
        /* call the tty release_tty routine to clean out this slot */
1420
 
release_mem_out:
 
1422
err_release_tty:
1421
1423
        if (printk_ratelimit())
1422
1424
                printk(KERN_INFO "tty_init_dev: ldisc open failed, "
1423
1425
                                 "clearing slot %d\n", idx);
1892
1894
        retval = tty_add_file(tty, filp);
1893
1895
        if (retval) {
1894
1896
                tty_unlock();
 
1897
                tty_release(inode, filp);
1895
1898
                return retval;
1896
1899
        }
1897
1900
 
1902
1905
#ifdef TTY_DEBUG_HANGUP
1903
1906
        printk(KERN_DEBUG "opening %s...", tty->name);
1904
1907
#endif
1905
 
        if (!retval) {
1906
 
                if (tty->ops->open)
1907
 
                        retval = tty->ops->open(tty, filp);
1908
 
                else
1909
 
                        retval = -ENODEV;
1910
 
        }
 
1908
        if (tty->ops->open)
 
1909
                retval = tty->ops->open(tty, filp);
 
1910
        else
 
1911
                retval = -ENODEV;
1911
1912
        filp->f_flags = saved_flags;
1912
1913
 
1913
1914
        if (!retval && test_bit(TTY_EXCLUSIVE, &tty->flags) &&
2888
2889
}
2889
2890
 
2890
2891
/**
 
2892
 *      deinitialize_tty_struct
 
2893
 *      @tty: tty to deinitialize
 
2894
 *
 
2895
 *      This subroutine deinitializes a tty structure that has been newly
 
2896
 *      allocated but tty_release cannot be called on that yet.
 
2897
 *
 
2898
 *      Locking: none - tty in question must not be exposed at this point
 
2899
 */
 
2900
void deinitialize_tty_struct(struct tty_struct *tty)
 
2901
{
 
2902
        tty_ldisc_deinit(tty);
 
2903
}
 
2904
 
 
2905
/**
2891
2906
 *      tty_put_char    -       write one character to a tty
2892
2907
 *      @tty: tty
2893
2908
 *      @ch: character