Re: [PATCH SPEAKUP v2 3/3] use spkeaup_allocate as per required context

2017-02-28 Thread Greg KH
On Tue, Feb 28, 2017 at 01:57:55PM +0530, Pranay Kr. Srivastava wrote:
> 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 
> ---
>  drivers/staging/speakup/main.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)

Your subject line contains a misspelling :(

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH SPEAKUP v2 3/3] use spkeaup_allocate as per required context

2017-02-28 Thread Samuel Thibault
Pranay Kr. Srivastava, on mar. 28 févr. 2017 13:57:55 +0530, wrote:
> 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 

Reviewed-by: Samuel Thibault 

> ---
>  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 ca817ca..ede842e 100644
> --- a/drivers/staging/speakup/main.c
> +++ b/drivers/staging/speakup/main.c
> @@ -1327,14 +1327,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] == NULL)
>   return -ENOMEM;
>   speakup_date(vc);
> @@ -2257,7 +2257,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);
> @@ -2343,7 +2343,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
> 

-- 
Samuel
(03:13:14)  bon
(03:13:19)  il est tard :p
(03:13:25)  c'est l'heure de manger
(03:13:38)  hm j'ai mangé à 1h moi, j'ai des horaires raisonnables
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH SPEAKUP v2 3/3] use spkeaup_allocate as per required context

2017-02-28 Thread Pranay Kr. Srivastava
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 
---
 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 ca817ca..ede842e 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -1327,14 +1327,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] == NULL)
return -ENOMEM;
speakup_date(vc);
@@ -2257,7 +2257,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);
@@ -2343,7 +2343,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

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel