mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Finn Thain <fthain@linux-m68k.org>
To: Tom Rix <trix@redhat.com>
Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com,
	shivasharan.srikanteshwara@broadcom.com, jejb@linux.ibm.com,
	martin.petersen@oracle.com, nathan@kernel.org,
	ndesaulniers@google.com, megaraidlinux.pdl@broadcom.com,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	llvm@lists.linux.dev
Subject: Re: [PATCH] scsi: megaraid: cleanup formatting of megaraid
Date: Fri, 28 Jan 2022 09:37:58 +1100 (AEDT)	[thread overview]
Message-ID: <953eb015-4b78-f7b-5dc1-6491c6bf27e@linux-m68k.org> (raw)
In-Reply-To: <20220127151945.1244439-1-trix@redhat.com>


On Thu, 27 Jan 2022, trix@redhat.com wrote:

> From: Tom Rix <trix@redhat.com>
> 
> checkpatch reports several hundred formatting errors. Run these files 
> through clang-format and knock off some of them.
> 

That method seems like a good recipe for endless churn unless checkpatch 
and clang-format really agree about these style rules.

Why use checkpatch to assess code style, if we could simply diff the 
existing source with the output from clang-format... but it seems that 
clang-format harms readability, makes indentation errors and uses 
inconsistent style rules. Some examples:

>  static unsigned short int max_sectors_per_io = MAX_SECTORS_PER_IO;
>  module_param(max_sectors_per_io, ushort, 0);
> -MODULE_PARM_DESC(max_sectors_per_io, "Maximum number of sectors per I/O request (default=MAX_SECTORS_PER_IO=128)");
> -
> +MODULE_PARM_DESC(
> +	max_sectors_per_io,
> +	"Maximum number of sectors per I/O request (default=MAX_SECTORS_PER_IO=128)");
>  
>  static unsigned short int max_mbox_busy_wait = MBOX_BUSY_WAIT;
>  module_param(max_mbox_busy_wait, ushort, 0);
> -MODULE_PARM_DESC(max_mbox_busy_wait, "Maximum wait for mailbox in microseconds if busy (default=MBOX_BUSY_WAIT=10)");
> +MODULE_PARM_DESC(
> +	max_mbox_busy_wait,
> +	"Maximum wait for mailbox in microseconds if busy (default=MBOX_BUSY_WAIT=10)");
>  

This code is longer for no real improvement.

>  
>  /*
>   * The File Operations structure for the serial/ioctl interface of the driver
>   */
>  static const struct file_operations megadev_fops = {
> -	.owner		= THIS_MODULE,
> -	.unlocked_ioctl	= megadev_unlocked_ioctl,
> -	.open		= megadev_open,
> -	.llseek		= noop_llseek,
> +	.owner = THIS_MODULE,
> +	.unlocked_ioctl = megadev_unlocked_ioctl,
> +	.open = megadev_open,
> +	.llseek = noop_llseek,
>  };
>  
>  /*

Readability loss.

> -		prod_info_dma_handle = dma_map_single(&adapter->dev->dev,
> -						      (void *)&adapter->product_info,
> -						      sizeof(mega_product_info),
> -						      DMA_FROM_DEVICE);
> +		prod_info_dma_handle = dma_map_single(
> +			&adapter->dev->dev, (void *)&adapter->product_info,
> +			sizeof(mega_product_info), DMA_FROM_DEVICE);
>  

Note the orphaned first parameter and odd indentation.

>  
>  static DEF_SCSI_QCMD(megaraid_queue)
>  
> -/**
> +	/**
>   * mega_allocate_scb()
>   * @adapter: pointer to our soft state
>   * @cmd: scsi command from the mid-layer

Indentation error.

> @@ -418,15 +409,14 @@ static DEF_SCSI_QCMD(megaraid_queue)
>   * Allocate a SCB structure. This is the central structure for controller
>   * commands.
>   */
> -static inline scb_t *
> -mega_allocate_scb(adapter_t *adapter, struct scsi_cmnd *cmd)
> +	static inline scb_t *mega_allocate_scb(adapter_t *adapter,
> +					       struct scsi_cmnd *cmd)
>  {
>  	struct list_head *head = &adapter->free_list;

Same.

> @@ -586,26 +568,25 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
>  
>  		ldrv_num = mega_get_ldrv_num(adapter, cmd, channel);
>  
> -
>  		max_ldrv_num = (adapter->flag & BOARD_40LD) ?
> -			MAX_LOGICAL_DRIVES_40LD : MAX_LOGICAL_DRIVES_8LD;
> +				       MAX_LOGICAL_DRIVES_40LD :
> +					     MAX_LOGICAL_DRIVES_8LD;
>  

Churn, if not readability loss. Note the indentation change here is 
inconsistent with the indentation change noted above.

>  			 * 6-byte READ(0x08) or WRITE(0x0A) cdb
>  			 */
> -			if( cmd->cmd_len == 6 ) {
> -				mbox->m_out.numsectors = (u32) cmd->cmnd[4];
> -				mbox->m_out.lba =
> -					((u32)cmd->cmnd[1] << 16) |
> -					((u32)cmd->cmnd[2] << 8) |
> -					(u32)cmd->cmnd[3];
> +			if (cmd->cmd_len == 6) {
> +				mbox->m_out.numsectors = (u32)cmd->cmnd[4];
> +				mbox->m_out.lba = ((u32)cmd->cmnd[1] << 16) |
> +						  ((u32)cmd->cmnd[2] << 8) |
> +						  (u32)cmd->cmnd[3];
>  
>  				mbox->m_out.lba &= 0x1FFFFF;
>  

Here, the orphaned term is moved up, next to the =. And yet,

>  
>  			/* Calculate Scatter-Gather info */
> -			mbox->m_out.numsgelements = mega_build_sglist(adapter, scb,
> -					(u32 *)&mbox->m_out.xferaddr, &seg);
> +			mbox->m_out.numsgelements =
> +				mega_build_sglist(adapter, scb,
> +						  (u32 *)&mbox->m_out.xferaddr,
> +						  &seg);
>  
>  			return scb;
>  

... here the first term is moved down and orphaned, which is another 
inconsistency.

  reply	other threads:[~2022-01-27 22:38 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27 15:19 trix
2022-01-27 22:37 ` Finn Thain [this message]
2022-01-27 22:47   ` Nick Desaulniers
2022-01-28  0:32     ` Tom Rix
2022-01-28  2:43       ` Joe Perches
2022-01-28  5:31         ` Tom Rix
2022-01-28  8:41           ` Joe Perches
2022-01-28 15:30             ` Tom Rix
2022-01-28 16:23               ` Joe Perches
2022-01-28 23:45               ` Finn Thain
2022-01-28  9:39     ` Miguel Ojeda
2022-01-28 17:42 ` Bart Van Assche
2022-01-28 17:59   ` Tom Rix
2022-01-28 19:11     ` Joe Perches
2022-01-28 19:37       ` Tom Rix
2022-03-02 19:14         ` Tom Rix
2022-03-03  8:35           ` Finn Thain
2022-03-03 11:41             ` Konrad Wilhelm Kleine
     [not found]             ` <CABRYuGk+1AGpvfkR7=LTCm+bN4kt55fwQnQXCjidSXWxuMWsiQ@mail.gmail.com>
2022-03-03 22:44               ` Finn Thain
2022-03-03 23:17                 ` Miguel Ojeda
2022-03-03 23:38                   ` Joe Perches
2022-03-04  5:22                     ` Bart Van Assche
2022-03-04  5:40                       ` Joe Perches
2022-03-05  3:22                       ` Finn Thain
2022-03-04  7:47                     ` Finn Thain
2022-03-04 12:31                     ` Miguel Ojeda
2022-03-04 13:46                     ` Tom Rix
2022-03-04 14:02                       ` Miguel Ojeda
2022-03-04 17:36                         ` Joe Perches
2022-03-04 18:48                           ` Miguel Ojeda
2022-03-04 19:28                             ` Joe Perches
2022-03-04 21:04                               ` Miguel Ojeda
2022-03-05  3:32                               ` Finn Thain
2022-03-04 22:38                         ` Tom Rix
2022-01-28 20:30       ` Bart Van Assche

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=953eb015-4b78-f7b-5dc1-6491c6bf27e@linux-m68k.org \
    --to=fthain@linux-m68k.org \
    --cc=jejb@linux.ibm.com \
    --cc=kashyap.desai@broadcom.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=martin.petersen@oracle.com \
    --cc=megaraidlinux.pdl@broadcom.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=shivasharan.srikanteshwara@broadcom.com \
    --cc=sumit.saxena@broadcom.com \
    --cc=trix@redhat.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

all inboxes | Powered by JetHome®