Commit b1b2b3ca authored by Pranay Kr. Srivastava's avatar Pranay Kr. Srivastava Committed by Greg Kroah-Hartman

staging: speakup: use speakup_allocate as per required context

speakup_allocate used GFP_ATOMIC for allocations
even while during initialization due to it's use
in notifier call.

Pass GFP_ flags as well to speakup_allocate depending
on the context it is called in.
Signed-off-by: default avatarPranay Kr. Srivastava <pranjas@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a15505e6
...@@ -1341,14 +1341,14 @@ static int edit_bits(struct vc_data *vc, u_char type, u_char ch, u_short key) ...@@ -1341,14 +1341,14 @@ static int edit_bits(struct vc_data *vc, u_char type, u_char ch, u_short key)
} }
/* Allocation concurrency is protected by the console semaphore */ /* Allocation concurrency is protected by the console semaphore */
static int speakup_allocate(struct vc_data *vc) static int speakup_allocate(struct vc_data *vc, gfp_t gfp_flags)
{ {
int vc_num; int vc_num;
vc_num = vc->vc_num; vc_num = vc->vc_num;
if (speakup_console[vc_num] == NULL) { if (speakup_console[vc_num] == NULL) {
speakup_console[vc_num] = kzalloc(sizeof(*speakup_console[0]), speakup_console[vc_num] = kzalloc(sizeof(*speakup_console[0]),
GFP_ATOMIC); gfp_flags);
if (!speakup_console[vc_num]) if (!speakup_console[vc_num])
return -ENOMEM; return -ENOMEM;
speakup_date(vc); speakup_date(vc);
...@@ -2277,7 +2277,7 @@ static int vt_notifier_call(struct notifier_block *nb, ...@@ -2277,7 +2277,7 @@ static int vt_notifier_call(struct notifier_block *nb,
switch (code) { switch (code) {
case VT_ALLOCATE: case VT_ALLOCATE:
if (vc->vc_mode == KD_TEXT) if (vc->vc_mode == KD_TEXT)
speakup_allocate(vc); speakup_allocate(vc, GFP_ATOMIC);
break; break;
case VT_DEALLOCATE: case VT_DEALLOCATE:
speakup_deallocate(vc); speakup_deallocate(vc);
...@@ -2362,7 +2362,7 @@ static int __init speakup_init(void) ...@@ -2362,7 +2362,7 @@ static int __init speakup_init(void)
for (i = 0; i < MAX_NR_CONSOLES; i++) for (i = 0; i < MAX_NR_CONSOLES; i++)
if (vc_cons[i].d) { if (vc_cons[i].d) {
err = speakup_allocate(vc_cons[i].d); err = speakup_allocate(vc_cons[i].d, GFP_KERNEL);
if (err) if (err)
goto error_kobjects; goto error_kobjects;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment