lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7a448fa7-d389-4822-9e18-54520c9dc1e9@mev.co.uk>
Date: Tue, 6 May 2025 12:58:13 +0100
From: Ian Abbott <abbotti@....co.uk>
To: Heikki Huttu <heissendo88@...il.com>, hsweeten@...ionengravers.com,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Staging: comedi: drivers: adl_pci9118.c: Edit file so
 that checkpatch.pl has 0 errors

On 04/05/2025 18:36, Heikki Huttu wrote:
> Change lines that checkpatch.pl throws errors about.
> Errors were about extra parenthesies and typos.

In general, patches should be split into logically different things, so 
coding clean-ups should be separate from typo/spelling corrections in 
comments.

Also, the "Staging" tag in the subject line should only be used for code 
in the "drivers/staging" directory.

> 
> Signed-off-by: Heikki Huttu <heissendo88@...il.com>
> ---
>   drivers/comedi/drivers/adl_pci9118.c | 26 +++++++++++++-------------
>   1 file changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/comedi/drivers/adl_pci9118.c b/drivers/comedi/drivers/adl_pci9118.c
> index a76e2666d583..691c8d6bb767 100644
> --- a/drivers/comedi/drivers/adl_pci9118.c
> +++ b/drivers/comedi/drivers/adl_pci9118.c
> @@ -32,7 +32,7 @@
>    * ranges).
>    *
>    * There are some hardware limitations:
> - * a) You cann't use mixture of unipolar/bipoar ranges or differencial/single
> + * a) You can't use mixture of unipolar/bipolar ranges or differencial/single

Note that "differential" is also spelled incorrectly in the above comment.

>    *  ended inputs.
>    * b) DMA transfers must have the length aligned to two samples (32 bit),
>    *  so there is some problems if cmd->chanlist_len is odd. This driver tries
> @@ -227,7 +227,7 @@ struct pci9118_private {
>   	struct pci9118_dmabuf dmabuf[2];
>   	int softsshdelay;		/*
>   					 * >0 use software S&H,
> -					 * numer is requested delay in ns
> +					 * number is requested delay in ns
>   					 */
>   	unsigned char softsshsample;	/*
>   					 * polarity of S&H signal
> @@ -946,8 +946,8 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
>   	devpriv->ai_add_back = 0;
>   	if (devpriv->master) {
>   		devpriv->usedma = 1;
> -		if ((cmd->flags & CMDF_WAKE_EOS) &&
> -		    (cmd->scan_end_arg == 1)) {
> +		if (cmd->flags & CMDF_WAKE_EOS &&
> +		    cmd->scan_end_arg == 1) {
>   			if (cmd->convert_src == TRIG_NOW)
>   				devpriv->ai_add_back = 1;
>   			if (cmd->convert_src == TRIG_TIMER) {
> @@ -958,9 +958,9 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
>   					 */
>   			}
>   		}
> -		if ((cmd->flags & CMDF_WAKE_EOS) &&
> -		    (cmd->scan_end_arg & 1) &&
> -		    (cmd->scan_end_arg > 1)) {
> +		if (cmd->flags & CMDF_WAKE_EOS &&
> +		    cmd->scan_end_arg & 1 &&
> +		    cmd->scan_end_arg > 1) {
>   			if (cmd->scan_begin_src == TRIG_FOLLOW) {
>   				devpriv->usedma = 0;
>   				/*
> @@ -983,7 +983,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
>   	 */
>   	if (cmd->convert_src == TRIG_NOW && devpriv->softsshdelay) {
>   		devpriv->ai_add_front = 2;
> -		if ((devpriv->usedma == 1) && (devpriv->ai_add_back == 1)) {
> +		if (devpriv->usedma == 1 && devpriv->ai_add_back == 1) {
>   							/* move it to front */
>   			devpriv->ai_add_front++;
>   			devpriv->ai_add_back = 0;
> @@ -1185,7 +1185,7 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev,
>   	    (!(cmd->convert_src & (TRIG_TIMER | TRIG_NOW))))
>   		err |= -EINVAL;
>   
> -	if ((cmd->scan_begin_src == TRIG_FOLLOW) &&
> +	if (cmd->scan_begin_src == TRIG_FOLLOW &&
>   	    (!(cmd->convert_src & (TRIG_TIMER | TRIG_EXT))))
>   		err |= -EINVAL;
>   
> @@ -1210,8 +1210,8 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev,
>   	if (cmd->scan_begin_src & (TRIG_FOLLOW | TRIG_EXT))
>   		err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0);
>   
> -	if ((cmd->scan_begin_src == TRIG_TIMER) &&
> -	    (cmd->convert_src == TRIG_TIMER) && (cmd->scan_end_arg == 1)) {
> +	if (cmd->scan_begin_src == TRIG_TIMER &&
> +	    cmd->convert_src == TRIG_TIMER && cmd->scan_end_arg == 1) {
>   		cmd->scan_begin_src = TRIG_FOLLOW;
>   		cmd->convert_arg = cmd->scan_begin_arg;
>   		cmd->scan_begin_arg = 0;

In my opinion, I don't think it is worth removing a few, harmless extra 
parentheses unless the lines of code need to be changed for other 
reasons.  It just increases the maintenance burden by increasing the 
likelihood of backported bug-fix patches failing to apply.

> @@ -1279,8 +1279,8 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev,
>   			} else {
>   				arg = cmd->convert_arg * cmd->chanlist_len;
>   			}
> -			err |= comedi_check_trigger_arg_min(
> -				&cmd->scan_begin_arg, arg);
> +			err |= comedi_check_trigger_arg_min
> +				(&cmd->scan_begin_arg, arg);

In my opinion, moving that opening parenthesis of the function call to 
the next line makes the code less readable.  There is a checkpatch.pl 
rule that prohibits spaces between the function name and opening 
parenthesis of a function call, but that rule is not detected when the 
opening parenthesis is moved onto the next line.

>   		}
>   	}
>   


-- 
-=( Ian Abbott <abbotti@....co.uk> || MEV Ltd. is a company  )=-
-=( registered in England & Wales.  Regd. number: 02862268.  )=-
-=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
-=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ