From: Julian Andres Klode <jak@jak-linux.org>
To: Piotr Chmura <chmooreck@poczta.onet.pl>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>,
devel@driverdev.osuosl.org,
Devin Heitmueller <dheitmueller@kernellabs.com>,
Patrick Dickey <pdickeybeta@gmail.com>, Greg KH <gregkh@suse.de>,
Mauro Carvalho Chehab <maurochehab@gmail.com>,
LMML <linux-media@vger.kernel.org>
Subject: Re: [PATCH 4/7] staging/as102: cleanup - formatting code
Date: Sun, 16 Oct 2011 14:23:59 +0200 [thread overview]
Message-ID: <20111016122359.GA19023@jak-linux.org> (raw)
In-Reply-To: <4E99F313.4050103@poczta.onet.pl>
On Sat, Oct 15, 2011 at 10:54:43PM +0200, Piotr Chmura wrote:
> staging as102: cleanup - formatting code
>
> Cleanup code: change double spaces into single, put tabs instead of spaces where they should be.
>
> Signed-off-by: Piotr Chmura<chmooreck@poczta.onet.pl>
> Cc: Devin Heitmueller<dheitmueller@kernellabs.com>
> Cc: Greg HK<gregkh@suse.de>
Just a few hints from my side. Most of my comments apply to multiple other parts
of the code, but I did not want to quote everything and you should be able to
find the other parts I did not mention explicitely as well.
I don't have much knowledge of kernel code style, but wanted to point out a few
things that seem to be obviously wrong or uncommon, and stuff I wouldn't do. There
may be a few false positives and some things missing.
[And yes, I actually only wanted to comment on the two-space thing, but I somehow
ended up reading the complete patch or the first half of it].
>
> diff -Nur linux.as102.03-typedefs/drivers/staging/as102/as102_drv.c linux.as102.04-tabs/drivers/staging/as102/as102_drv.c
> --- linux.as102.03-typedefs/drivers/staging/as102/as102_drv.c 2011-10-14 17:55:02.000000000 +0200
> +++ linux.as102.04-tabs/drivers/staging/as102/as102_drv.c 2011-10-14 23:20:05.000000000 +0200
> @@ -10,7 +10,7 @@
> *
> * This program is distributed in the hope that it will be useful,
> * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> * GNU General Public License for more details.
> *
> * You should have received a copy of the GNU General Public License
For reference, the standard variant uses two spaces after the period (aka
English Spacing).
> -failed:
> + failed:
> LEAVE();
> /* FIXME: free dvb_XXX */
> return ret;
It's more common to have no indentation before labels (about
7 times more common).
> @@ -332,7 +332,7 @@
>
> /**
> * \brief as102 driver exit point. This function is called when device has
> - * to be removed.
> + * to be removed.
> */
Does it make sense to reindent that? If you intent to keep API documentation
comments, you want to convert them to kernel-doc style anyway.
> dprintk(debug, "min_delay_ms = %d -> %d\n", settings->min_delay_ms,
> - 1000);
> + 1000);
> #endif
Seems to be more indentation than really required.
> @@ -201,7 +201,7 @@
> break;
> case TUNE_STATUS_STREAM_TUNED:
> *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_SYNC |
> - FE_HAS_LOCK;
> + FE_HAS_LOCK;
> break;
I think it looks better with indentation here. Otherwise you might not
read the | at the end of the previous line and think FE_HAS_LOCK is
a strange macro evaluating to a function call. Moving the operator
into the second line would also make this even more clear.
> #else
> - .release = as102_fe_release,
> - .init = as102_fe_init,
> + .release = as102_fe_release,
> + .init = as102_fe_init,
> #endif
> };
Is there a reason why struct members are indented using
two tabs (here and elsewhere)?
>
> @@ -393,7 +393,7 @@
> }
>
> int as102_dvb_register_fe(struct as102_dev_t *as102_dev,
> - struct dvb_frontend *dvb_fe)
> + struct dvb_frontend *dvb_fe)
> {
If there's still space to align further to the right, why not
use it? It makes the code look better if parameters are aligned
below each other (or at least nearly).
> int errno;
> struct dvb_adapter *dvb_adap;
> @@ -407,7 +407,7 @@
> /* init frontend callback ops */
> memcpy(&dvb_fe->ops,&as102_fe_ops, sizeof(struct dvb_frontend_ops));
> strncpy(dvb_fe->ops.info.name, as102_dev->name,
> - sizeof(dvb_fe->ops.info.name));
> + sizeof(dvb_fe->ops.info.name));
>
It does not seem helpful to align like this, it certainly looks
much uglier than the old one which had sizeof aligned with dvb.
> /* set frequency */
> @@ -642,32 +642,32 @@
> * if HP/LP are both set to FEC_NONE, HP will be selected.
> */
> if ((tune_args->hierarchy != HIER_NONE)&&
Misses a space before the &&
> dprintk(debug, "\thierarchy: 0x%02x "
> "selected: %s code_rate_%s: 0x%02x\n",
> - tune_args->hierarchy,
> - tune_args->hier_select == HIER_HIGH_PRIORITY ?
> - "HP" : "LP",
> - tune_args->hier_select == HIER_HIGH_PRIORITY ?
> - "HP" : "LP",
> - tune_args->code_rate);
> + tune_args->hierarchy,
> + tune_args->hier_select == HIER_HIGH_PRIORITY ?
> + "HP" : "LP",
> + tune_args->hier_select == HIER_HIGH_PRIORITY ?
> + "HP" : "LP",
> + tune_args->code_rate);
You indented the second argument one level further than the
first one. And the third argument even more.
> errno = bus_adap->ops->upload_fw_pkt(bus_adap,
> - (uint8_t *)
> - &fw_pkt, 2, 0);
> + (uint8_t *)
> + &fw_pkt, 2, 0);
Splitting after the "&fw_pkt," seems more sensible, as you have the
cast and its operand on the same line then.
>
> static int as102_usb_start_stream(struct as102_dev_t *dev);
> static void as102_usb_stop_stream(struct as102_dev_t *dev);
> @@ -38,59 +38,59 @@
> static int as102_release(struct inode *inode, struct file *file);
>
> static struct usb_device_id as102_usb_id_table[] = {
> - { USB_DEVICE(AS102_USB_DEVICE_VENDOR_ID, AS102_USB_DEVICE_PID_0001) },
> - { USB_DEVICE(PCTV_74E_USB_VID, PCTV_74E_USB_PID) },
> - { USB_DEVICE(ELGATO_EYETV_DTT_USB_VID, ELGATO_EYETV_DTT_USB_PID) },
> - { USB_DEVICE(NBOX_DVBT_DONGLE_USB_VID, NBOX_DVBT_DONGLE_USB_PID) },
> - { } /* Terminating entry */
> + { USB_DEVICE(AS102_USB_DEVICE_VENDOR_ID, AS102_USB_DEVICE_PID_0001) },
> + { USB_DEVICE(PCTV_74E_USB_VID, PCTV_74E_USB_PID) },
> + { USB_DEVICE(ELGATO_EYETV_DTT_USB_VID, ELGATO_EYETV_DTT_USB_PID) },
> + { USB_DEVICE(NBOX_DVBT_DONGLE_USB_VID, NBOX_DVBT_DONGLE_USB_PID) },
> + { } /* Terminating entry */
> };
Again, two levels of indentation do not add anything valuable.
>
> /* Note that this table must always have the same number of entries as the
> - as102_usb_id_table struct */
> + as102_usb_id_table struct */
> static const char *as102_device_names[] = {
> - AS102_REFERENCE_DESIGN,
> - AS102_PCTV_74E,
> - AS102_ELGATO_EYETV_DTT_NAME,
> - AS102_NBOX_DVBT_DONGLE_NAME,
> - NULL /* Terminating entry */
> + AS102_REFERENCE_DESIGN,
> + AS102_PCTV_74E,
> + AS102_ELGATO_EYETV_DTT_NAME,
> + AS102_NBOX_DVBT_DONGLE_NAME,
> + NULL /* Terminating entry */
> };
Same here and at a lot of other locations.
[I stopped here]
--
Julian Andres Klode - Debian Developer, Ubuntu Member
See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.
next prev parent reply other threads:[~2011-10-16 12:24 UTC|newest]
Thread overview: 91+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-25 12:33 Problems cloning the git repostories Patrick Dickey
2011-09-25 13:55 ` Devin Heitmueller
2011-09-26 3:25 ` Mauro Carvalho Chehab
2011-09-27 2:20 ` Devin Heitmueller
2011-09-27 7:44 ` Staging submission: PCTV 80e and PCTV 74e drivers (was Re: Problems cloning the git repostories) Stefan Richter
2011-09-27 17:43 ` Greg KH
2011-09-27 19:33 ` Stefan Richter
2011-10-15 20:54 ` [PATCH 0/7] Staging submission: PCTV 74e drivers and some cleanup (was: Staging submission: PCTV 80e and PCTV 74e drivers) Piotr Chmura
2011-10-17 22:31 ` Greg KH
2011-10-19 12:36 ` Staging questions: WAS Re: [PATCH 0/7] Staging submission: PCTV 74e drivers and some cleanup Patrick Dickey
2011-10-19 13:57 ` Devin Heitmueller
2011-10-20 3:44 ` Mauro Carvalho Chehab
2011-10-20 10:53 ` Patrick Dickey
2011-10-20 11:22 ` Mauro Carvalho Chehab
[not found] ` <4E9992F9.7000101@poczta.onet.pl>
2011-10-15 20:54 ` [PATCH 2/7] staging/as102: add new device nBox DVB-T Dongle Piotr Chmura
2011-10-15 20:54 ` [PATCH 3/7] staging/as102: cleanup - get rid of typedefs Piotr Chmura
2011-10-15 20:54 ` [PATCH 4/7] staging/as102: cleanup - formatting code Piotr Chmura
2011-10-16 12:23 ` Julian Andres Klode [this message]
2011-10-16 12:40 ` Devin Heitmueller
2011-10-16 21:53 ` Dan Carpenter
2011-10-15 20:54 ` [PATCH 5/7] staging as102: cleanup - get rid of pragma(pack) Piotr Chmura
[not found] ` <4E999733.2010802@poczta.onet.pl>
2011-10-15 20:54 ` [PATCH 1/7] Staging submission: PCTV 74e driver (as102) Piotr Chmura
2011-10-16 8:57 ` Stefan Richter
2011-10-16 11:45 ` Devin Heitmueller
2011-10-16 13:44 ` Mauro Carvalho Chehab
2011-10-18 9:10 ` [PATCH 0/14] staging/media/as102: new driver submission (was " Piotr Chmura
2011-10-18 15:52 ` Devin Heitmueller
2011-10-18 17:20 ` Piotr Chmura
2011-10-19 11:41 ` Javier Martinez Canillas
2011-10-19 11:44 ` Mauro Carvalho Chehab
2011-10-19 13:07 ` Piotr Chmura
[not found] ` <20111018094647.d4982eb2.chmooreck@poczta.onet.pl>
2011-10-18 9:11 ` [PATCH 1/14] staging/media/as102: initial import from Abilis Piotr Chmura
2011-10-18 16:24 ` Dan Carpenter
2011-10-18 16:38 ` Mauro Carvalho Chehab
2011-10-18 22:33 ` Dan Carpenter
2011-10-18 19:46 ` [RESEND PATCH " Piotr Chmura
2011-10-30 21:03 ` Piotr Chmura
2011-10-30 21:25 ` Stefan Richter
2011-10-31 10:24 ` Sylwester Nawrocki
2011-10-18 9:11 ` [PATCH 2/14] staging/media/as102: checkpatch fixes Piotr Chmura
2011-10-18 19:48 ` [RESEND PATCH " Piotr Chmura
2011-10-18 9:11 ` [PATCH 3/14] " Piotr Chmura
2011-10-18 19:50 ` [RESEND PATCH " Piotr Chmura
2011-10-18 9:11 ` [PATCH 4/14] " Piotr Chmura
2011-10-18 19:51 ` [RESEND PATCH " Piotr Chmura
2011-10-29 10:22 ` Sylwester Nawrocki
2011-10-29 13:17 ` Piotr Chmura
2011-10-29 16:14 ` Sylwester Nawrocki
2011-10-29 17:48 ` Piotr Chmura
2011-10-29 21:37 ` Sylwester Nawrocki
2011-10-30 7:11 ` [PATCH v3 " Piotr Chmura
2011-10-30 11:17 ` Stefan Richter
2011-10-31 10:48 ` Stefan Richter
2011-10-31 11:47 ` Mauro Carvalho Chehab
2011-10-29 16:25 ` [RESEND PATCH " Piotr Chmura
2011-10-29 16:39 ` Sylwester Nawrocki
2011-10-29 17:00 ` Dan Carpenter
2011-10-18 9:11 ` [PATCH 5/14] " Piotr Chmura
2011-10-18 19:54 ` [RESEND PATCH " Piotr Chmura
2011-10-30 13:53 ` [PATCH v3 " Piotr Chmura
2011-10-18 9:12 ` [PATCH 6/14] " Piotr Chmura
2011-10-18 19:56 ` [RESEND PATCH " Piotr Chmura
2011-10-18 9:12 ` [PATCH 7/14] " Piotr Chmura
2011-10-18 19:57 ` [RESEND PATCH " Piotr Chmura
2011-10-18 9:12 ` [PATCH 8/14] " Piotr Chmura
2011-10-18 19:58 ` [RESEND PATCH " Piotr Chmura
2011-10-18 9:12 ` [PATCH 9/14] staging/media/as102: Add Elgato EyeTV DTT Deluxe Piotr Chmura
2011-10-18 19:59 ` [RESEND PATCH " Piotr Chmura
2011-10-18 9:12 ` [PATCH 10/14] staging/media/as102: properly handle multiple product names Piotr Chmura
2011-10-18 20:02 ` [RESEND PATCH " Piotr Chmura
2011-10-18 20:28 ` Joe Perches
2011-10-18 20:54 ` Piotr Chmura
2011-10-18 20:56 ` Greg KH
2011-10-18 20:58 ` Joe Perches
2011-10-18 9:13 ` [PATCH 11/14] staging/media/as102: fix compile warning about unused function Piotr Chmura
2011-10-18 20:03 ` [RESEND PATCH " Piotr Chmura
2011-10-30 20:04 ` Sylwester Nawrocki
2011-10-30 21:15 ` Stefan Richter
2011-10-18 9:13 ` [PATCH 12/14] staging/media/as102: fix licensing oversight Piotr Chmura
2011-10-18 20:05 ` [RESEND PATCH " Piotr Chmura
2011-10-18 9:13 ` [PATCH 13/14] staging/media/as102: fix compile Piotr Chmura
2011-10-18 9:13 ` [PATCH 14/14] staging/media/as102: add nBox Tuner Dongle support Piotr Chmura
2011-10-15 20:55 ` [PATCH 6/7] staging/as102: cleanup - get rid of editor comments Piotr Chmura
2011-10-15 20:55 ` [PATCH 7/7] staging/as102: cleanup - get rid unnecessary LINUX and WIN32 defines Piotr Chmura
2011-10-30 21:09 ` Problems cloning the git repostories Marek Vasut
2011-09-25 14:53 ` Anca Emanuel
2011-09-25 18:03 ` Johannes Stezenbach
2011-09-26 2:56 ` Mauro Carvalho Chehab
2011-09-26 10:15 ` Scott Jiang
2011-09-26 19:24 ` Johannes Stezenbach
2011-09-26 11:27 ` Patrick Dickey
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=20111016122359.GA19023@jak-linux.org \
--to=jak@jak-linux.org \
--cc=chmooreck@poczta.onet.pl \
--cc=devel@driverdev.osuosl.org \
--cc=dheitmueller@kernellabs.com \
--cc=gregkh@suse.de \
--cc=linux-media@vger.kernel.org \
--cc=maurochehab@gmail.com \
--cc=pdickeybeta@gmail.com \
--cc=stefanr@s5r6.in-berlin.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.