linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: Joe Perches <joe@perches.com>
Cc: "Shirish Gajera" <gshirishfree@gmail.com>,
	w.d.hubbs@gmail.com, chris@the-brannons.com, kirk@reisers.ca,
	samuel.thibault@ens-lyon.org,
	"Greg KH" <gregkh@linuxfoundation.org>,
	"Domagoj Tršan" <domagoj.trsan@gmail.com>,
	mahfouz.saif.elyazal@gmail.com,
	"Ben Hutchings" <ben@decadent.org.uk>,
	roxanagabriela10@gmail.com,
	"Robin Schroer" <sulamiification@gmail.com>,
	dilekuzulmez@gmail.com, "DaeSeok Youn" <daeseok.youn@gmail.com>,
	"Ayşe Melike Yurtoğlu" <aysemelikeyurtoglu@gmail.com>,
	"Rusty Russell" <rusty@rustcorp.com.au>,
	tapaswenipathak@gmail.com, vthakkar1994@gmail.com,
	speakup@linux-speakup.org,
	"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] staging: speakup: Fix warning of line over 80 characters.
Date: Sat, 28 Mar 2015 22:22:55 +0100	[thread overview]
Message-ID: <55171BAF.9050405@nod.at> (raw)
In-Reply-To: <1427577518.2715.8.camel@perches.com>

Am 28.03.2015 um 22:18 schrieb Joe Perches:
> On Sat, 2015-03-28 at 21:40 +0100, Richard Weinberger wrote:
>> On Sat, Mar 28, 2015 at 9:21 PM, Shirish Gajera <gshirishfree@gmail.com> wrote:
>>> This patch fixes the checkpatch.pl warning:
> 
> []
> 
>>> diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
> []
>>> @@ -423,7 +423,8 @@ static void announce_edge(struct vc_data *vc, int msg_id)
>>>         if (spk_bleeps & 1)
>>>                 bleep(spk_y);
>>>         if ((spk_bleeps & 2) && (msg_id < edge_quiet))
>>> -               synth_printf("%s\n", spk_msg_get(MSG_EDGE_MSGS_START + msg_id - 1));
>>> +               synth_printf("%s\n",
>>> +                       spk_msg_get(MSG_EDGE_MSGS_START + msg_id - 1));
>>
>> Instead of blindly adding newlines to silence checkpatch.pl, what
>> about reworking the code?
>> printf("%s\n", ..) cries for a puts().
> 
> There is no synth_puts

So what?
Fix it! :-)

>>> @@ -1131,7 +1132,8 @@ static void spkup_write(const char *in_buf, int count)
>>>         if (in_count > 2 && rep_count > 2) {
>>>                 if (last_type & CH_RPT) {
>>>                         synth_printf(" ");
>>> -                       synth_printf(spk_msg_get(MSG_REPEAT_DESC2), ++rep_count);
>>> +                       synth_printf(spk_msg_get(MSG_REPEAT_DESC2),
>>> +                                       ++rep_count);
>>>                         synth_printf(" ");
>>
>> This printf stuff looks odd. synth_printf() seems to take a format
>> string, in this case the format string
>> is returned by spk_msg_get(), smells like a format string bug.
> 
> Nope, but it would be nicer to avoid these spk_msg_get
> functions for the indices that are used with printf style
> formatting.
> 
>>>                 }
>>>                 rep_count = 0;
>>> @@ -1847,7 +1849,8 @@ static void speakup_win_set(struct vc_data *vc)
>>>                         win_right = spk_x;
>>>                 }
>>>                 snprintf(info, sizeof(info), spk_msg_get(MSG_WINDOW_BOUNDARY),
>>> -                        (win_start) ? spk_msg_get(MSG_END) : spk_msg_get(MSG_START),
>>> +                        (win_start) ?
>>> +                               spk_msg_get(MSG_END) : spk_msg_get(MSG_START),
>>>                          (int)spk_y + 1, (int)spk_x + 1);
>>
>> Same here. Also please resolve the ?: mess.
> 
> I don't think there's a ?: mess, but the code looks wrong.  
> 
> 	win_start ? MSG_END : MSG_START

Face it, the whole code is horrible and lines other 80 chars are the *least*
problem.
Submitting a patch just for the sake of silencing checkpatch.pl is a waste of time.
After applying this patch the driver 0 better than before.

Thanks,
//richard

  reply	other threads:[~2015-03-28 21:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-28 20:21 [PATCH] staging: speakup: Fix warning of line over 80 characters Shirish Gajera
2015-03-28 20:40 ` Richard Weinberger
2015-03-28 21:18   ` Joe Perches
2015-03-28 21:22     ` Richard Weinberger [this message]
2015-03-28 21:35       ` Joe Perches
2015-03-28 23:44         ` Shirish Gajera
2015-03-28 23:54           ` Richard Weinberger
2015-03-29  0:26             ` Shirish Gajera
2015-03-29  9:28               ` Richard Weinberger
2015-03-30  6:17               ` Sudip Mukherjee
2015-03-30  7:23   ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2015-01-18  7:57 Shirish Gajera
2015-01-18  8:29 ` Robin Schroer
2015-01-19 12:19   ` Dan Carpenter
2015-01-18  9:55 ` Ben Hutchings
2015-01-19 12:25   ` Dan Carpenter
     [not found]     ` <CAG77vrrbEmw7OR8N7bcmKEkDwXonsfmJeE6-epYxSMLT5uQpMw@mail.gmail.com>
2015-01-19 20:26       ` Dan Carpenter
2015-01-19 12:23 ` Dan Carpenter
2015-01-25 11:37 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55171BAF.9050405@nod.at \
    --to=richard@nod.at \
    --cc=aysemelikeyurtoglu@gmail.com \
    --cc=ben@decadent.org.uk \
    --cc=chris@the-brannons.com \
    --cc=daeseok.youn@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=dilekuzulmez@gmail.com \
    --cc=domagoj.trsan@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gshirishfree@gmail.com \
    --cc=joe@perches.com \
    --cc=kirk@reisers.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mahfouz.saif.elyazal@gmail.com \
    --cc=roxanagabriela10@gmail.com \
    --cc=rusty@rustcorp.com.au \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=speakup@linux-speakup.org \
    --cc=sulamiification@gmail.com \
    --cc=tapaswenipathak@gmail.com \
    --cc=vthakkar1994@gmail.com \
    --cc=w.d.hubbs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).