mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Laszlo Papp <lpapp@kde.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: Lindent formatting issues
Date: Thu, 19 Dec 2013 08:32:11 -0800	[thread overview]
Message-ID: <1387470731.2353.7.camel@joe-AO722> (raw)
In-Reply-To: <CAOMwXhNVJ8HPCe6t=VkCthEiOqNtOczz5Xqy_ciM7rsqWRVOYw@mail.gmail.com>

On Thu, 2013-12-19 at 16:17 +0000, Laszlo Papp wrote:
> On Tue, Dec 17, 2013 at 8:05 PM, Joe Perches <joe@perches.com> wrote:
[]
> > You could also use scripts/checkpatch.pl with
> > the --fix option.
> >
> > ./scripts/checkpatch.pl -f --fix <file>
> >
> > with various --types=<TYPE,...> options.
> >
> > Maybe use: https://lkml.org/lkml/2013/9/23/504
> 
> Thanks Joe. I seem to have further issues with this tool... I tried to
> run it on a file I patched, but it generated a lot of noise unrelated
> to my logical change... :(

checkpatch is really for patches.  Using -f is a
convenience ability.  You can limit what messages
checkpatch emits by using "--types=<FOO[,BAR...]>"

You can show what message classifications are being
used by adding "--show-types".

> Do you happen to know what the best way is to fix it in such cases? I
> am providing some examples below:
> 
>         if (devattr == &sensor_dev_attr_fan1_max_alarm.dev_attr
> -        || devattr == &sensor_dev_attr_fan1_min_alarm.dev_attr
> -        || devattr == &sensor_dev_attr_fan1_fault.dev_attr
> -        || devattr == &sensor_dev_attr_gpio1_alarm.dev_attr
> -        || devattr == &sensor_dev_attr_gpio2_alarm.dev_attr) {
> +           || devattr == &sensor_dev_attr_fan1_min_alarm.dev_attr
> +           || devattr == &sensor_dev_attr_fan1_fault.dev_attr
> +           || devattr == &sensor_dev_attr_gpio1_alarm.dev_attr
> +           || devattr == &sensor_dev_attr_gpio2_alarm.dev_attr) {

Well, here the general kernel style is to put
the logical && or || test at the end of the
previous line so:

	if (devattr == &sensor_dev_attr_fan1_max_alarm.dev_attr ||
	    devattr == &sensor_dev_attr_fan1_min_alarm.dev_attr ||
	    devattr == &sensor_dev_attr_fan1_fault.dev_attr ||
	    devattr == &sensor_dev_attr_gpio1_alarm.dev_attr ||
	    devattr == &sensor_dev_attr_gpio2_alarm.dev_attr) {

would likely be preferred.

> -                                   int n)
> +                                    int n)

This may be indentation alignment but I don't follow
how this is a problem.

> -       int sysfs_modes[4] = {0, 1, 2, 1};
> +       int sysfs_modes[4] = { 0, 1, 2, 1 };

Is this change from Lindent or checkpatch?


  reply	other threads:[~2013-12-19 16:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-17 15:06 Laszlo Papp
2013-12-17 20:05 ` Joe Perches
2013-12-19 16:17   ` Laszlo Papp
2013-12-19 16:32     ` Joe Perches [this message]
2013-12-19 17:30       ` Laszlo Papp
2013-12-19 17:34         ` Joe Perches
2013-12-19 17:38           ` Laszlo Papp

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=1387470731.2353.7.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lpapp@kde.org \
    /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

all inboxes | Powered by JetHome®