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


Groups > linux.kernel > #1668636

Re: [patch v2 2/3] staging: speakup: check and convert dev name or ser to dev_t

From Okash Khawaja <okash.khawaja@gmail.com>
Newsgroups linux.kernel
Subject Re: [patch v2 2/3] staging: speakup: check and convert dev name or ser to dev_t
Date 2017-06-18 19:30 +0200
Message-ID <tTMbn-85P-1@gated-at.bofh.it> (permalink)
References <tTEQy-3lF-1@gated-at.bofh.it> <tTEQy-3lF-15@gated-at.bofh.it> <tTIAN-5G8-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

Thanks for the reviews. Couple of things inlined below.

On Sun, Jun 18, 2017 at 04:35:21PM +0300, Andy Shevchenko wrote:
> 
> > +const char *lp_supported[] = { "acntsa", "bns", "dummy", "txprt" };
> 
> static ?
Sure!

> > +       if (ser < 0 || ser > (255 - 64)) {
> 
> > +                pr_err("speakup: Invalid ser param. \
> > +                               Must be between 0 and 191 inclusive.\n");
> 
> Just make it one line.
Is it okay if it becomes larger than 80 chars?

> > +
> > +                       for (i = 0; i < ARRAY_SIZE(lp_supported); i++) {
> > +                               if (strcmp(synth->name, lp_supported[i]) == 0)
> > +                                       break;
> > +                       }
> > +
> > +                       if (i >= ARRAY_SIZE(lp_supported)) {
> 
> match_string()
Cool, didn't know about it

> 
> > +                               pr_err("speakup: lp* is only supported on:");
> 
> > +                               for (i = 0; i < ARRAY_SIZE(lp_supported); i++)
> > +                                       pr_cont(" %s", lp_supported[i]);
> > +                               pr_cont("\n");
> 
> pr_cont() is not the best idea, though I think it will be rare cases
> when it might be broken in pieces.
Hmm... I would like to keep it if it doesn't incur an overhead. It also
indicates to the reader that this all part of same output line. Let me
know what you think.

> 
> > +
> > +                               return -ENOTSUPP;
> > +                       }
> > +               }
> > +
> > +               return tty_dev_name_to_number(synth->dev_name, dev_no);
> > +       }
> > +
> > +       return ser_to_dev(synth->ser, dev_no);
> > +}
> > +
> >  static int spk_ttyio_ldisc_open(struct tty_struct *tty)
> >  {
> >         struct spk_ldisc_data *ldisc_data;
> > --- a/drivers/staging/speakup/spk_types.h
> > +++ b/drivers/staging/speakup/spk_types.h
> > @@ -169,6 +169,7 @@ struct spk_synth {
> >         int jiffies;
> >         int full;
> >         int ser;
> 
> > +       char *dev_name;
> 
> const ?
This becomes the target of module_param in following patch. It complains
when set to const.

Thanks!
Okash

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


Thread

[patch v2 0/3] staging: speakup: support more than ttyS* Okash Khawaja <okash.khawaja@gmail.com> - 2017-06-18 11:40 +0200
  [patch v2 3/3] staging: speakup: make ttyio synths use device name Okash Khawaja <okash.khawaja@gmail.com> - 2017-06-18 11:40 +0200
    Re: [patch v2 3/3] staging: speakup: make ttyio synths use device name Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-18 15:40 +0200
  [patch v2 2/3] staging: speakup: check and convert dev name or ser to dev_t Okash Khawaja <okash.khawaja@gmail.com> - 2017-06-18 11:40 +0200
    Re: [patch v2 2/3] staging: speakup: check and convert dev name or  ser to dev_t Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-18 15:40 +0200
      Re: [patch v2 2/3] staging: speakup: check and convert dev name or  ser to dev_t Okash Khawaja <okash.khawaja@gmail.com> - 2017-06-18 19:30 +0200
        Re: [patch v2 2/3] staging: speakup: check and convert dev name or  ser to dev_t Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-18 22:00 +0200
          Re: [patch v2 2/3] staging: speakup: check and convert dev name or  ser to dev_t Joe Perches <joe@perches.com> - 2017-06-19 02:40 +0200
    Re: [patch v2 2/3] staging: speakup: check and convert dev name or  ser to dev_t Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-19 03:20 +0200
      Re: [patch v2 2/3] staging: speakup: check and convert dev name or  ser to dev_t Okash Khawaja <okash.khawaja@gmail.com> - 2017-06-19 07:40 +0200
      Re: [patch v2 2/3] staging: speakup: check and convert dev name or  ser to dev_t Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-19 07:40 +0200
      Re: [patch v2 2/3] staging: speakup: check and convert dev name or  ser to dev_t Joe Perches <joe@perches.com> - 2017-06-19 07:40 +0200
    Re: [patch v2 2/3] staging: speakup: check and convert dev name or  ser to dev_t Dan Carpenter <dan.carpenter@oracle.com> - 2017-06-19 10:30 +0200
  [patch v2 1/3] tty: add function to convert device name to number Okash Khawaja <okash.khawaja@gmail.com> - 2017-06-18 11:40 +0200
    Re: [patch v2 1/3] tty: add function to convert device name to number Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-18 15:30 +0200
      Re: [patch v2 1/3] tty: add function to convert device name to number Okash Khawaja <okash.khawaja@gmail.com> - 2017-06-19 10:10 +0200

csiph-web