TTY: tty3270, move initialization to allocation
Let us initialize all the tty3270's members at the place where the structure is allocated. It cleans up tty->ops->open a bit. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: linux390@de.ibm.com Cc: linux-s390@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Родитель
b538c4eaf2
Коммит
9d2ae2335c
|
@ -690,6 +690,16 @@ tty3270_alloc_view(void)
|
||||||
if (!tp->freemem_pages)
|
if (!tp->freemem_pages)
|
||||||
goto out_tp;
|
goto out_tp;
|
||||||
INIT_LIST_HEAD(&tp->freemem);
|
INIT_LIST_HEAD(&tp->freemem);
|
||||||
|
INIT_LIST_HEAD(&tp->lines);
|
||||||
|
INIT_LIST_HEAD(&tp->update);
|
||||||
|
INIT_LIST_HEAD(&tp->rcl_lines);
|
||||||
|
tp->rcl_max = 20;
|
||||||
|
setup_timer(&tp->timer, (void (*)(unsigned long)) tty3270_update,
|
||||||
|
(unsigned long) tp);
|
||||||
|
tasklet_init(&tp->readlet,
|
||||||
|
(void (*)(unsigned long)) tty3270_read_tasklet,
|
||||||
|
(unsigned long) tp->read);
|
||||||
|
|
||||||
for (pages = 0; pages < TTY3270_STRING_PAGES; pages++) {
|
for (pages = 0; pages < TTY3270_STRING_PAGES; pages++) {
|
||||||
tp->freemem_pages[pages] = (void *)
|
tp->freemem_pages[pages] = (void *)
|
||||||
__get_free_pages(GFP_KERNEL|GFP_DMA, 0);
|
__get_free_pages(GFP_KERNEL|GFP_DMA, 0);
|
||||||
|
@ -879,16 +889,6 @@ tty3270_open(struct tty_struct *tty, struct file * filp)
|
||||||
if (IS_ERR(tp))
|
if (IS_ERR(tp))
|
||||||
return PTR_ERR(tp);
|
return PTR_ERR(tp);
|
||||||
|
|
||||||
INIT_LIST_HEAD(&tp->lines);
|
|
||||||
INIT_LIST_HEAD(&tp->update);
|
|
||||||
INIT_LIST_HEAD(&tp->rcl_lines);
|
|
||||||
tp->rcl_max = 20;
|
|
||||||
setup_timer(&tp->timer, (void (*)(unsigned long)) tty3270_update,
|
|
||||||
(unsigned long) tp);
|
|
||||||
tasklet_init(&tp->readlet,
|
|
||||||
(void (*)(unsigned long)) tty3270_read_tasklet,
|
|
||||||
(unsigned long) tp->read);
|
|
||||||
|
|
||||||
rc = raw3270_add_view(&tp->view, &tty3270_fn,
|
rc = raw3270_add_view(&tp->view, &tty3270_fn,
|
||||||
tty->index + RAW3270_FIRSTMINOR);
|
tty->index + RAW3270_FIRSTMINOR);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче