Hi Jiri,

> On 12. 05. 20, 13:53, Gregory CLEMENT wrote:
>> Warn the upper layer when n_gms is ready to receive data
>> again. Without this the associated virtual tty remains blocked
>> indefinitely.
>> 
>> Fixes: e1eaea46bb40 ("tty: n_gsm line discipline")
>> Signed-off-by: Gregory CLEMENT <gregory.clem...@bootlin.com>
>> ---
>>  drivers/tty/n_gsm.c | 26 ++++++++++++++++++++++----
>>  1 file changed, 22 insertions(+), 4 deletions(-)
>> 
>> diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
>> index d8d196645500..69200bd411f7 100644
>> --- a/drivers/tty/n_gsm.c
>> +++ b/drivers/tty/n_gsm.c
>> @@ -663,7 +663,7 @@ static struct gsm_msg *gsm_data_alloc(struct gsm_mux 
>> *gsm, u8 addr, int len,
>>   *  FIXME: lock against link layer control transmissions
>>   */
>>  
>> -static void gsm_data_kick(struct gsm_mux *gsm)
>> +static void gsm_data_kick(struct gsm_mux *gsm, struct gsm_dlci *dlci)
>>  {
>>      struct gsm_msg *msg, *nmsg;
>>      int len;
>> @@ -695,6 +695,24 @@ static void gsm_data_kick(struct gsm_mux *gsm)
>>  
>>              list_del(&msg->list);
>>              kfree(msg);
>> +
>> +            if (dlci) {
>> +                    tty_port_tty_wakeup(&dlci->port);
>> +            } else {
>> +                    int i = 0;
>> +
>> +                    for (i = 0; i < NUM_DLCI; i++) {
>> +                            struct gsm_dlci *dlci;
>> +
>> +                            dlci = gsm->dlci[i];
>> +                            if (dlci == NULL) {
>> +                                    i++;
>
> This "i++" looks bogus here.

You're right!
Sorry for this.

>
>> +                                    continue;
>> +                            }
>> +
>> +                            tty_port_tty_wakeup(&dlci->port);
>
>
> So simply:
> for (i = 0; i < NUM_DLCI; i++) {
>   struct gsm_dlci *dlci = gsm->dlci[i];
>   if (dlci)
>     tty_port_tty_wakeup(&dlci->port);
> }
>
> ? Or even maybe directly:
> for (i = 0; i < NUM_DLCI; i++)
>   if (gsm->dlci[i])
>     tty_port_tty_wakeup(&gsm->dlci[i]->port);

I will do this, thanks,

Gregory

>
> thanks,
> -- 
> js
> suse labs

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

Reply via email to