Merge branch 'tty-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 31 Jan 2011 22:05:19 +0000 (08:05 +1000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 31 Jan 2011 22:05:19 +0000 (08:05 +1000)
* 'tty-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6:
  tty/serial: fix apbuart build
  n_hdlc: fix read and write locking
  serial: unbreak billionton CF card
  tty: use for_each_console() and WARN() on sysfs failures
  vt: fix issue when fbcon wants to takeover a second time.

Fix up trivial conflict in drivers/tty/tty_io.c

1  2 
drivers/tty/tty_io.c
drivers/tty/vt/vt.c

diff --combined drivers/tty/tty_io.c
index 6158eae0f64a2e669f6c0d3887e7bc64163419ad,dae6fc96182cdab346abafd74a4e63e3aee55ecf..0065da4b11c1a89eefba4d6c3ac17abb25c9a41d
@@@ -3256,8 -3256,8 +3256,8 @@@ static ssize_t show_cons_active(struct 
        struct console *c;
        ssize_t count = 0;
  
 -      acquire_console_sem();
 +      console_lock();
-       for (c = console_drivers; c; c = c->next) {
+       for_each_console(c) {
                if (!c->device)
                        continue;
                if (!c->write)
        while (i--)
                count += sprintf(buf + count, "%s%d%c",
                                 cs[i]->name, cs[i]->index, i ? ' ':'\n');
 -      release_console_sem();
 +      console_unlock();
  
        return count;
  }
@@@ -3306,7 -3306,7 +3306,7 @@@ int __init tty_init(void
        if (IS_ERR(consdev))
                consdev = NULL;
        else
-               device_create_file(consdev, &dev_attr_active);
+               WARN_ON(device_create_file(consdev, &dev_attr_active) < 0);
  
  #ifdef CONFIG_VT
        vty_init(&console_fops);
diff --combined drivers/tty/vt/vt.c
index b230bd3f056f7d59e9c4c015ab687b4c6d257902,955061863ed823f559b892f69f493d139db7a811..147ede3423df6228c781c39100a42937e6437f33
@@@ -1003,9 -1003,9 +1003,9 @@@ static int vt_resize(struct tty_struct 
        struct vc_data *vc = tty->driver_data;
        int ret;
  
 -      acquire_console_sem();
 +      console_lock();
        ret = vc_do_resize(tty, vc, ws->ws_col, ws->ws_row);
 -      release_console_sem();
 +      console_unlock();
        return ret;
  }
  
@@@ -1271,7 -1271,7 +1271,7 @@@ static void default_attr(struct vc_dat
        vc->vc_color = vc->vc_def_color;
  }
  
 -/* console_sem is held */
 +/* console_lock is held */
  static void csi_m(struct vc_data *vc)
  {
        int i;
@@@ -1415,7 -1415,7 +1415,7 @@@ int mouse_reporting(void
        return vc_cons[fg_console].d->vc_report_mouse;
  }
  
 -/* console_sem is held */
 +/* console_lock is held */
  static void set_mode(struct vc_data *vc, int on_off)
  {
        int i;
                }
  }
  
 -/* console_sem is held */
 +/* console_lock is held */
  static void setterm_command(struct vc_data *vc)
  {
        switch(vc->vc_par[0]) {
        }
  }
  
 -/* console_sem is held */
 +/* console_lock is held */
  static void csi_at(struct vc_data *vc, unsigned int nr)
  {
        if (nr > vc->vc_cols - vc->vc_x)
        insert_char(vc, nr);
  }
  
 -/* console_sem is held */
 +/* console_lock is held */
  static void csi_L(struct vc_data *vc, unsigned int nr)
  {
        if (nr > vc->vc_rows - vc->vc_y)
        vc->vc_need_wrap = 0;
  }
  
 -/* console_sem is held */
 +/* console_lock is held */
  static void csi_P(struct vc_data *vc, unsigned int nr)
  {
        if (nr > vc->vc_cols - vc->vc_x)
        delete_char(vc, nr);
  }
  
 -/* console_sem is held */
 +/* console_lock is held */
  static void csi_M(struct vc_data *vc, unsigned int nr)
  {
        if (nr > vc->vc_rows - vc->vc_y)
        vc->vc_need_wrap = 0;
  }
  
 -/* console_sem is held (except via vc_init->reset_terminal */
 +/* console_lock is held (except via vc_init->reset_terminal */
  static void save_cur(struct vc_data *vc)
  {
        vc->vc_saved_x          = vc->vc_x;
        vc->vc_saved_G1         = vc->vc_G1_charset;
  }
  
 -/* console_sem is held */
 +/* console_lock is held */
  static void restore_cur(struct vc_data *vc)
  {
        gotoxy(vc, vc->vc_saved_x, vc->vc_saved_y);
@@@ -1625,7 -1625,7 +1625,7 @@@ enum { ESnormal, ESesc, ESsquare, ESget
        EShash, ESsetG0, ESsetG1, ESpercent, ESignore, ESnonstd,
        ESpalette };
  
 -/* console_sem is held (except via vc_init()) */
 +/* console_lock is held (except via vc_init()) */
  static void reset_terminal(struct vc_data *vc, int do_clear)
  {
        vc->vc_top              = 0;
            csi_J(vc, 2);
  }
  
 -/* console_sem is held */
 +/* console_lock is held */
  static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
  {
        /*
@@@ -2119,7 -2119,7 +2119,7 @@@ static int is_double_width(uint32_t ucs
        return bisearch(ucs, double_width, ARRAY_SIZE(double_width) - 1);
  }
  
 -/* acquires console_sem */
 +/* acquires console_lock */
  static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int count)
  {
  #ifdef VT_BUF_VRAM_ONLY
  
        might_sleep();
  
 -      acquire_console_sem();
 +      console_lock();
        vc = tty->driver_data;
        if (vc == NULL) {
                printk(KERN_ERR "vt: argh, driver_data is NULL !\n");
 -              release_console_sem();
 +              console_unlock();
                return 0;
        }
  
        if (!vc_cons_allocated(currcons)) {
            /* could this happen? */
                printk_once("con_write: tty %d not allocated\n", currcons+1);
 -          release_console_sem();
 +          console_unlock();
            return 0;
        }
  
@@@ -2375,7 -2375,7 +2375,7 @@@ rescan_last_byte
        }
        FLUSH
        console_conditional_schedule();
 -      release_console_sem();
 +      console_unlock();
        notify_update(vc);
        return n;
  #undef FLUSH
   * us to do the switches asynchronously (needed when we want
   * to switch due to a keyboard interrupt).  Synchronization
   * with other console code and prevention of re-entrancy is
 - * ensured with console_sem.
 + * ensured with console_lock.
   */
  static void console_callback(struct work_struct *ignored)
  {
 -      acquire_console_sem();
 +      console_lock();
  
        if (want_console >= 0) {
                if (want_console != fg_console &&
        }
        notify_update(vc_cons[fg_console].d);
  
 -      release_console_sem();
 +      console_unlock();
  }
  
  int set_console(int nr)
@@@ -2603,7 -2603,7 +2603,7 @@@ static struct console vt_console_drive
   */
  
  /*
 - * Generally a bit racy with respect to console_sem().
 + * Generally a bit racy with respect to console_lock();.
   *
   * There are some functions which don't need it.
   *
@@@ -2629,17 -2629,17 +2629,17 @@@ int tioclinux(struct tty_struct *tty, u
        switch (type)
        {
                case TIOCL_SETSEL:
 -                      acquire_console_sem();
 +                      console_lock();
                        ret = set_selection((struct tiocl_selection __user *)(p+1), tty);
 -                      release_console_sem();
 +                      console_unlock();
                        break;
                case TIOCL_PASTESEL:
                        ret = paste_selection(tty);
                        break;
                case TIOCL_UNBLANKSCREEN:
 -                      acquire_console_sem();
 +                      console_lock();
                        unblank_screen();
 -                      release_console_sem();
 +                      console_unlock();
                        break;
                case TIOCL_SELLOADLUT:
                        ret = sel_loadlut(p);
                        }
                        break;
                case TIOCL_BLANKSCREEN: /* until explicitly unblanked, not only poked */
 -                      acquire_console_sem();
 +                      console_lock();
                        ignore_poke = 1;
                        do_blank_screen(0);
 -                      release_console_sem();
 +                      console_unlock();
                        break;
                case TIOCL_BLANKEDSCREEN:
                        ret = console_blanked;
@@@ -2790,11 -2790,11 +2790,11 @@@ static void con_flush_chars(struct tty_
                return;
  
        /* if we race with con_close(), vt may be null */
 -      acquire_console_sem();
 +      console_lock();
        vc = tty->driver_data;
        if (vc)
                set_cursor(vc);
 -      release_console_sem();
 +      console_unlock();
  }
  
  /*
@@@ -2805,7 -2805,7 +2805,7 @@@ static int con_open(struct tty_struct *
        unsigned int currcons = tty->index;
        int ret = 0;
  
 -      acquire_console_sem();
 +      console_lock();
        if (tty->driver_data == NULL) {
                ret = vc_allocate(currcons);
                if (ret == 0) {
  
                        /* Still being freed */
                        if (vc->port.tty) {
 -                              release_console_sem();
 +                              console_unlock();
                                return -ERESTARTSYS;
                        }
                        tty->driver_data = vc;
                                tty->termios->c_iflag |= IUTF8;
                        else
                                tty->termios->c_iflag &= ~IUTF8;
 -                      release_console_sem();
 +                      console_unlock();
                        return ret;
                }
        }
 -      release_console_sem();
 +      console_unlock();
        return ret;
  }
  
@@@ -2844,9 -2844,9 +2844,9 @@@ static void con_shutdown(struct tty_str
  {
        struct vc_data *vc = tty->driver_data;
        BUG_ON(vc == NULL);
 -      acquire_console_sem();
 +      console_lock();
        vc->port.tty = NULL;
 -      release_console_sem();
 +      console_unlock();
        tty_shutdown(tty);
  }
  
@@@ -2893,13 -2893,13 +2893,13 @@@ static int __init con_init(void
        struct vc_data *vc;
        unsigned int currcons = 0, i;
  
 -      acquire_console_sem();
 +      console_lock();
  
        if (conswitchp)
                display_desc = conswitchp->con_startup();
        if (!display_desc) {
                fg_console = 0;
 -              release_console_sem();
 +              console_unlock();
                return 0;
        }
  
        printable = 1;
        printk("\n");
  
 -      release_console_sem();
 +      console_unlock();
  
  #ifdef CONFIG_VT_CONSOLE
        register_console(&vt_console_driver);
@@@ -2994,7 -2994,7 +2994,7 @@@ int __init vty_init(const struct file_o
        if (IS_ERR(tty0dev))
                tty0dev = NULL;
        else
-               device_create_file(tty0dev, &dev_attr_active);
+               WARN_ON(device_create_file(tty0dev, &dev_attr_active) < 0);
  
        vcs_init();
  
@@@ -3037,7 -3037,7 +3037,7 @@@ static int bind_con_driver(const struc
        if (!try_module_get(owner))
                return -ENODEV;
  
 -      acquire_console_sem();
 +      console_lock();
  
        /* check if driver is registered */
        for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
  
        retval = 0;
  err:
 -      release_console_sem();
 +      console_unlock();
        module_put(owner);
        return retval;
  };
@@@ -3171,7 -3171,7 +3171,7 @@@ int unbind_con_driver(const struct cons
        if (!try_module_get(owner))
                return -ENODEV;
  
 -      acquire_console_sem();
 +      console_lock();
  
        /* check if driver is registered and if it is unbindable */
        for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
        }
  
        if (retval) {
 -              release_console_sem();
 +              console_unlock();
                goto err;
        }
  
        }
  
        if (retval) {
 -              release_console_sem();
 +              console_unlock();
                goto err;
        }
  
        if (!con_is_bound(csw)) {
 -              release_console_sem();
 +              console_unlock();
                goto err;
        }
  
        if (!con_is_bound(csw))
                con_driver->flag &= ~CON_DRIVER_FLAG_INIT;
  
 -      release_console_sem();
 +      console_unlock();
        /* ignore return value, binding should not fail */
        bind_con_driver(defcsw, first, last, deflt);
  err:
@@@ -3538,14 -3538,14 +3538,14 @@@ int register_con_driver(const struct co
        if (!try_module_get(owner))
                return -ENODEV;
  
 -      acquire_console_sem();
 +      console_lock();
  
        for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
                con_driver = &registered_con_driver[i];
  
                /* already registered */
                if (con_driver->con == csw)
-                       retval = -EINVAL;
+                       retval = -EBUSY;
        }
  
        if (retval)
        }
  
  err:
 -      release_console_sem();
 +      console_unlock();
        module_put(owner);
        return retval;
  }
@@@ -3613,7 -3613,7 +3613,7 @@@ int unregister_con_driver(const struct 
  {
        int i, retval = -ENODEV;
  
 -      acquire_console_sem();
 +      console_lock();
  
        /* cannot unregister a bound driver */
        if (con_is_bound(csw))
                }
        }
  err:
 -      release_console_sem();
 +      console_unlock();
        return retval;
  }
  EXPORT_SYMBOL(unregister_con_driver);
@@@ -3656,7 -3656,12 +3656,12 @@@ int take_over_console(const struct cons
        int err;
  
        err = register_con_driver(csw, first, last);
+       /* if we get an busy error we still want to bind the console driver
+        * and return success, as we may have unbound the console driver
+        * but not unregistered it.
+       */
+       if (err == -EBUSY)
+               err = 0;
        if (!err)
                bind_con_driver(csw, first, last, deflt);
  
@@@ -3934,9 -3939,9 +3939,9 @@@ int con_set_cmap(unsigned char __user *
  {
        int rc;
  
 -      acquire_console_sem();
 +      console_lock();
        rc = set_get_cmap (arg,1);
 -      release_console_sem();
 +      console_unlock();
  
        return rc;
  }
@@@ -3945,9 -3950,9 +3950,9 @@@ int con_get_cmap(unsigned char __user *
  {
        int rc;
  
 -      acquire_console_sem();
 +      console_lock();
        rc = set_get_cmap (arg,0);
 -      release_console_sem();
 +      console_unlock();
  
        return rc;
  }
@@@ -3994,12 -3999,12 +3999,12 @@@ static int con_font_get(struct vc_data 
        } else
                font.data = NULL;
  
 -      acquire_console_sem();
 +      console_lock();
        if (vc->vc_sw->con_font_get)
                rc = vc->vc_sw->con_font_get(vc, &font);
        else
                rc = -ENOSYS;
 -      release_console_sem();
 +      console_unlock();
  
        if (rc)
                goto out;
@@@ -4076,12 -4081,12 +4081,12 @@@ static int con_font_set(struct vc_data 
        font.data = memdup_user(op->data, size);
        if (IS_ERR(font.data))
                return PTR_ERR(font.data);
 -      acquire_console_sem();
 +      console_lock();
        if (vc->vc_sw->con_font_set)
                rc = vc->vc_sw->con_font_set(vc, &font, op->flags);
        else
                rc = -ENOSYS;
 -      release_console_sem();
 +      console_unlock();
        kfree(font.data);
        return rc;
  }
@@@ -4103,12 -4108,12 +4108,12 @@@ static int con_font_default(struct vc_d
        else
                name[MAX_FONT_NAME - 1] = 0;
  
 -      acquire_console_sem();
 +      console_lock();
        if (vc->vc_sw->con_font_default)
                rc = vc->vc_sw->con_font_default(vc, &font, s);
        else
                rc = -ENOSYS;
 -      release_console_sem();
 +      console_unlock();
        if (!rc) {
                op->width = font.width;
                op->height = font.height;
@@@ -4124,7 -4129,7 +4129,7 @@@ static int con_font_copy(struct vc_dat
        if (vc->vc_mode != KD_TEXT)
                return -EINVAL;
  
 -      acquire_console_sem();
 +      console_lock();
        if (!vc->vc_sw->con_font_copy)
                rc = -ENOSYS;
        else if (con < 0 || !vc_cons_allocated(con))
                rc = 0;
        else
                rc = vc->vc_sw->con_font_copy(vc, con);
 -      release_console_sem();
 +      console_unlock();
        return rc;
  }
  
This page took 0.111928 seconds and 5 git commands to generate.