Re: [PATCH] Staging: wlan-ng: fix many style issues inhfa384x_usb.c

From: Joe Perches
Date: Fri Apr 23 2010 - 12:00:49 EST


On Fri, 2010-04-23 at 17:15 +0200, Alessandro Ghedini wrote:
> This patch fixes all the errors and most of the checkpatch.pl warnings
> and other style issues in the hfa384x_usb.c file

Hi Alessandro.

Almost there... One more pass and it should be good to go.

> @@ -351,7 +351,8 @@ static int submit_rx_urb(hfa384x_t *hw, gfp_t memflags)
> hw->rx_urb_skb = skb;
>
> result = -ENOLINK;
> - if (!hw->wlandev->hwremoved && !test_bit(WORK_RX_HALT, &hw->usb_flags)) {
> + if (!hw->wlandev->hwremoved &&
> + !test_bit(WORK_RX_HALT, &hw->usb_flags)) {

This is more difficult to read and less standard than

if (!hw->wlandev->hwremoved &&
!test_bit(WORK_RX_HALT, &hw->usb_flags)) {

Please change it.

> @@ -2451,7 +2452,11 @@ int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, unsigned int len)
> currpage = HFA384x_ADDR_CMD_MKPAGE(pdaloc[i].cardaddr);
> curroffset = HFA384x_ADDR_CMD_MKOFF(pdaloc[i].cardaddr);
>
> - result = hfa384x_dormem_wait(hw, currpage, curroffset, buf, len); /* units of bytes */
> + result = hfa384x_dormem_wait(hw,
> + currpage,
> + curroffset,
> + buf,
> + len); /* units of bytes */

Try not to make function calls use separate lines for each argument
unless you've got a specific reason like a comment for each arg or
something.

> @@ -2610,20 +2617,21 @@ int hfa384x_drvr_start(hfa384x_t *hw)
> result = result2 = hfa384x_cmd_initialize(hw);
> if (result1 != 0) {
> if (result2 != 0) {
> - printk(KERN_ERR
> - "cmd_initialize() failed on two attempts, results %d and %d\n",
> - result1, result2);
> + printk
> + (KERN_ERR "cmd_initialize() failed on two attempts,"
> + " results %d and %d\n",
> + result1, result2);

Please don't split the format strings.
As Richard Kennedy said, it makes grep less convenient.

Put the format on the same line as the printk and
use a newer checkpatch.pl.

I think all these should become single line

pr_<level>(fmt, args that fit before col 80);

or multiple lines like:

pr_<level>(fmt,
args until col 80,
more args if necessary);

That may be a personal nit though.

cheers, Joe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/