Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1608220

[[RESEND]PATCH staging/speakup v3 3/3] use speakup_allocate as per required context

From "Pranay Kr. Srivastava" <pranjas@gmail.com>
Newsgroups linux.kernel
Subject [[RESEND]PATCH staging/speakup v3 3/3] use speakup_allocate as per required context
Date 2017-03-24 09:40 +0100
Message-ID <tosVk-7gO-23@gated-at.bofh.it> (permalink)
References <toaOK-2Hz-37@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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: Pranay Kr. Srivastava <pranjas@gmail.com>
---
 drivers/staging/speakup/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index 2db3f06..b811c86 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -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 */
-static int speakup_allocate(struct vc_data *vc)
+static int speakup_allocate(struct vc_data *vc, gfp_t gfp_flags)
 {
 	int vc_num;
 
 	vc_num = vc->vc_num;
 	if (speakup_console[vc_num] == NULL) {
 		speakup_console[vc_num] = kzalloc(sizeof(*speakup_console[0]),
-						  GFP_ATOMIC);
+						  gfp_flags);
 		if (!speakup_console[vc_num])
 			return -ENOMEM;
 		speakup_date(vc);
@@ -2277,7 +2277,7 @@ static int vt_notifier_call(struct notifier_block *nb,
 	switch (code) {
 	case VT_ALLOCATE:
 		if (vc->vc_mode == KD_TEXT)
-			speakup_allocate(vc);
+			speakup_allocate(vc, GFP_ATOMIC);
 		break;
 	case VT_DEALLOCATE:
 		speakup_deallocate(vc);
@@ -2362,7 +2362,7 @@ static int __init speakup_init(void)
 
 	for (i = 0; i < MAX_NR_CONSOLES; i++)
 		if (vc_cons[i].d) {
-			err = speakup_allocate(vc_cons[i].d);
+			err = speakup_allocate(vc_cons[i].d, GFP_KERNEL);
 			if (err)
 				goto error_kobjects;
 		}
-- 
2.10.2

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH staging/speakup v3 3/3] use speakup_allocate as per required context "Pranay Kr. Srivastava" <pranjas@gmail.com> - 2017-03-21 08:20 +0100
  Re: [PATCH staging/speakup v3 3/3] use speakup_allocate as per  required context Greg KH <gregkh@linuxfoundation.org> - 2017-03-23 14:20 +0100
    [[RESEND]PATCH staging/speakup v3 3/3] use speakup_allocate as per required context "Pranay Kr. Srivastava" <pranjas@gmail.com> - 2017-03-24 09:40 +0100
      Re: [[RESEND]PATCH staging/speakup v3 3/3] use speakup_allocate as  per required context Greg KH <greg@kroah.com> - 2017-03-24 09:50 +0100
        Re: [[RESEND]PATCH staging/speakup v3 3/3] use speakup_allocate as  per required context Pranay Srivastava <pranjas@gmail.com> - 2017-03-24 11:20 +0100

csiph-web