--- zzzz-none-000/linux-3.10.107/drivers/usb/misc/sisusbvga/sisusb_con.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/usb/misc/sisusbvga/sisusb_con.c 2021-02-04 17:41:59.000000000 +0000 @@ -169,7 +169,8 @@ if (in_atomic()) return NULL; - if (!(sisusb = sisusb_get_sisusb(console))) + sisusb = sisusb_get_sisusb(console); + if (!sisusb) return NULL; mutex_lock(&sisusb->lock); @@ -208,13 +209,14 @@ struct sisusb_usb_data *sisusb; int cols, rows; - /* This is called by take_over_console(), + /* This is called by do_take_over_console(), * ie by us/under our control. It is * only called after text mode and fonts * are set up/restored. */ - if (!(sisusb = sisusb_get_sisusb(c->vc_num))) + sisusb = sisusb_get_sisusb(c->vc_num); + if (!sisusb) return; mutex_lock(&sisusb->lock); @@ -273,11 +275,12 @@ struct sisusb_usb_data *sisusb; int i; - /* This is called by take_over_console() + /* This is called by do_take_over_console() * and others, ie not under our control. */ - if (!(sisusb = sisusb_get_sisusb(c->vc_num))) + sisusb = sisusb_get_sisusb(c->vc_num); + if (!sisusb) return; mutex_lock(&sisusb->lock); @@ -369,7 +372,8 @@ struct sisusb_usb_data *sisusb; ssize_t written; - if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) + sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num); + if (!sisusb) return; /* sisusb->lock is down */ @@ -395,7 +399,8 @@ u16 *dest; int i; - if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) + sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num); + if (!sisusb) return; /* sisusb->lock is down */ @@ -433,7 +438,8 @@ if (width <= 0 || height <= 0) return; - if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) + sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num); + if (!sisusb) return; /* sisusb->lock is down */ @@ -486,7 +492,8 @@ if (width <= 0 || height <= 0) return; - if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) + sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num); + if (!sisusb) return; /* sisusb->lock is down */ @@ -520,7 +527,8 @@ * Returnvalue != 0 naturally means the opposite. */ - if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) + sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num); + if (!sisusb) return 0; /* sisusb->lock is down */ @@ -569,7 +577,8 @@ * buffer. */ - if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) + sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num); + if (!sisusb) return; /* sisusb->lock is down */ @@ -602,7 +611,8 @@ if (!CON_IS_VISIBLE(c)) return -EINVAL; - if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) + sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num); + if (!sisusb) return -EINVAL; /* sisusb->lock is down */ @@ -637,7 +647,8 @@ ssize_t written; int ret = 0; - if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) + sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num); + if (!sisusb) return 0; /* sisusb->lock is down */ @@ -721,7 +732,8 @@ /* The return value does not seem to be used */ - if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) + sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num); + if (!sisusb) return 0; /* sisusb->lock is down */ @@ -779,7 +791,8 @@ struct sisusb_usb_data *sisusb; int from, to, baseline; - if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) + sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num); + if (!sisusb) return; /* sisusb->lock is down */ @@ -906,7 +919,8 @@ if (!lines) return 1; - if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) + sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num); + if (!sisusb) return 0; /* sisusb->lock is down */ @@ -1018,7 +1032,8 @@ * screenbuffer as the origin. */ - if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) + sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num); + if (!sisusb) return 0; /* sisusb->lock is down */ @@ -1047,7 +1062,8 @@ struct sisusb_usb_data *sisusb; int fh; - if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) + sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num); + if (!sisusb) return -ENODEV; fh = sisusb->current_font_height; @@ -1286,7 +1302,8 @@ if (font->width != 8 || (charcount != 256 && charcount != 512)) return -EINVAL; - if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) + sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num); + if (!sisusb) return -ENODEV; /* sisusb->lock is down */ @@ -1326,7 +1343,8 @@ { struct sisusb_usb_data *sisusb; - if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) + sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num); + if (!sisusb) return -ENODEV; /* sisusb->lock is down */ @@ -1490,8 +1508,9 @@ mutex_unlock(&sisusb->lock); /* Now grab the desired console(s) */ - ret = take_over_console(&sisusb_con, first - 1, last - 1, 0); - + console_lock(); + ret = do_take_over_console(&sisusb_con, first - 1, last - 1, 0); + console_unlock(); if (!ret) sisusb->haveconsole = 1; else { @@ -1535,11 +1554,14 @@ if (sisusb->haveconsole) { for (i = 0; i < MAX_NR_CONSOLES; i++) - if (sisusb->havethisconsole[i]) - take_over_console(&sisusb_dummy_con, i, i, 0); + if (sisusb->havethisconsole[i]) { + console_lock(); + do_take_over_console(&sisusb_dummy_con, i, i, 0); + console_unlock(); /* At this point, con_deinit for all our - * consoles is executed by take_over_console(). + * consoles is executed by do_take_over_console(). */ + } sisusb->haveconsole = 0; }