public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] parport: gsc: remove DMA leftover code
@ 2023-07-26 15:09 Arnd Bergmann
  2023-07-26 15:09 ` [PATCH 2/2] parport: mfc3: avoid empty-body warning Arnd Bergmann
  2023-08-03  8:10 ` [PATCH 1/2] parport: gsc: remove DMA leftover code Helge Deller
  0 siblings, 2 replies; 5+ messages in thread
From: Arnd Bergmann @ 2023-07-26 15:09 UTC (permalink / raw)
  To: James E.J. Bottomley, Helge Deller, Sudip Mukherjee
  Cc: Arnd Bergmann, linux-parisc, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

This driver does not actually work with DMA mode, but still tries
to call ISA DMA interface functions that are stubbed out on
parisc, resulting in a W=1 build warning:

drivers/parport/parport_gsc.c: In function 'parport_remove_chip':
drivers/parport/parport_gsc.c:389:20: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
  389 |    free_dma(p->dma);

Remove the corresponding code as a prerequisite for turning on -Wempty-body
by default in all kernels.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/parport/parport_gsc.c | 28 ++++------------------------
 drivers/parport/parport_gsc.h |  7 -------
 2 files changed, 4 insertions(+), 31 deletions(-)

diff --git a/drivers/parport/parport_gsc.c b/drivers/parport/parport_gsc.c
index 0dcc497b0449a..5e4475254bd0a 100644
--- a/drivers/parport/parport_gsc.c
+++ b/drivers/parport/parport_gsc.c
@@ -28,7 +28,6 @@
 #include <linux/sysctl.h>
 
 #include <asm/io.h>
-#include <asm/dma.h>
 #include <linux/uaccess.h>
 #include <asm/superio.h>
 
@@ -226,9 +225,9 @@ static int parport_PS2_supported(struct parport *pb)
 
 /* --- Initialisation code -------------------------------- */
 
-struct parport *parport_gsc_probe_port(unsigned long base,
+static struct parport *parport_gsc_probe_port(unsigned long base,
 				       unsigned long base_hi, int irq,
-				       int dma, struct parisc_device *padev)
+				       struct parisc_device *padev)
 {
 	struct parport_gsc_private *priv;
 	struct parport_operations *ops;
@@ -250,12 +249,9 @@ struct parport *parport_gsc_probe_port(unsigned long base,
 	}
 	priv->ctr = 0xc;
 	priv->ctr_writable = 0xff;
-	priv->dma_buf = NULL;
-	priv->dma_handle = 0;
 	p->base = base;
 	p->base_hi = base_hi;
 	p->irq = irq;
-	p->dma = dma;
 	p->modes = PARPORT_MODE_PCSPP | PARPORT_MODE_SAFEININT;
 	p->ops = ops;
 	p->private_data = priv;
@@ -286,17 +282,9 @@ struct parport *parport_gsc_probe_port(unsigned long base,
 	if (p->irq == PARPORT_IRQ_AUTO) {
 		p->irq = PARPORT_IRQ_NONE;
 	}
-	if (p->irq != PARPORT_IRQ_NONE) {
+	if (p->irq != PARPORT_IRQ_NONE)
 		pr_cont(", irq %d", p->irq);
 
-		if (p->dma == PARPORT_DMA_AUTO) {
-			p->dma = PARPORT_DMA_NONE;
-		}
-	}
-	if (p->dma == PARPORT_DMA_AUTO) /* To use DMA, giving the irq
-                                           is mandatory (see above) */
-		p->dma = PARPORT_DMA_NONE;
-
 	pr_cont(" [");
 #define printmode(x)							\
 do {									\
@@ -321,7 +309,6 @@ do {									\
 			pr_warn("%s: irq %d in use, resorting to polled operation\n",
 				p->name, p->irq);
 			p->irq = PARPORT_IRQ_NONE;
-			p->dma = PARPORT_DMA_NONE;
 		}
 	}
 
@@ -369,8 +356,7 @@ static int __init parport_init_chip(struct parisc_device *dev)
 		pr_info("%s: enhanced parport-modes not supported\n", __func__);
 	}
 	
-	p = parport_gsc_probe_port(port, 0, dev->irq,
-			/* PARPORT_IRQ_NONE */ PARPORT_DMA_NONE, dev);
+	p = parport_gsc_probe_port(port, 0, dev->irq, dev);
 	if (p)
 		parport_count++;
 	dev_set_drvdata(&dev->dev, p);
@@ -382,16 +368,10 @@ static void __exit parport_remove_chip(struct parisc_device *dev)
 {
 	struct parport *p = dev_get_drvdata(&dev->dev);
 	if (p) {
-		struct parport_gsc_private *priv = p->private_data;
 		struct parport_operations *ops = p->ops;
 		parport_remove_port(p);
-		if (p->dma != PARPORT_DMA_NONE)
-			free_dma(p->dma);
 		if (p->irq != PARPORT_IRQ_NONE)
 			free_irq(p->irq, p);
-		if (priv->dma_buf)
-			dma_free_coherent(&priv->dev->dev, PAGE_SIZE,
-					  priv->dma_buf, priv->dma_handle);
 		kfree (p->private_data);
 		parport_put_port(p);
 		kfree (ops); /* hope no-one cached it */
diff --git a/drivers/parport/parport_gsc.h b/drivers/parport/parport_gsc.h
index 9301217edf12c..d447a568c2570 100644
--- a/drivers/parport/parport_gsc.h
+++ b/drivers/parport/parport_gsc.h
@@ -63,8 +63,6 @@ struct parport_gsc_private {
 	int writeIntrThreshold;
 
 	/* buffer suitable for DMA, if DMA enabled */
-	char *dma_buf;
-	dma_addr_t dma_handle;
 	struct pci_dev *dev;
 };
 
@@ -199,9 +197,4 @@ extern void parport_gsc_inc_use_count(void);
 
 extern void parport_gsc_dec_use_count(void);
 
-extern struct parport *parport_gsc_probe_port(unsigned long base,
-						unsigned long base_hi,
-						int irq, int dma,
-						struct parisc_device *padev);
-
 #endif	/* __DRIVERS_PARPORT_PARPORT_GSC_H */
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] parport: mfc3: avoid empty-body warning
  2023-07-26 15:09 [PATCH 1/2] parport: gsc: remove DMA leftover code Arnd Bergmann
@ 2023-07-26 15:09 ` Arnd Bergmann
  2023-07-26 16:34   ` Sohil Mehta
  2023-07-26 22:32   ` kernel test robot
  2023-08-03  8:10 ` [PATCH 1/2] parport: gsc: remove DMA leftover code Helge Deller
  1 sibling, 2 replies; 5+ messages in thread
From: Arnd Bergmann @ 2023-07-26 15:09 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: Arnd Bergmann, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

on m68k builds, the mfc3 driver causes a warning about an empty if() block:

drivers/parport/parport_mfc3.c: In function 'control_pc_to_mfc3':
drivers/parport/parport_mfc3.c:106:37: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]

Remove it in favor of a simpler comment.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/parport/parport_mfc3.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/parport/parport_mfc3.c b/drivers/parport/parport_mfc3.c
index f4d0da741e856..3d996e89a1c21 100644
--- a/drivers/parport/parport_mfc3.c
+++ b/drivers/parport/parport_mfc3.c
@@ -102,8 +102,7 @@ static unsigned char control_pc_to_mfc3(unsigned char control)
 		ret |= 128;
 	if (control & PARPORT_CONTROL_AUTOFD) /* AUTOLF */
 		ret &= ~64;
-	if (control & PARPORT_CONTROL_STROBE) /* Strobe */
-		/* Handled directly by hardware */;
+	/* PARPORT_CONTROL_STROBE handled directly by hardware *t/
 	return ret;
 }
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] parport: mfc3: avoid empty-body warning
  2023-07-26 15:09 ` [PATCH 2/2] parport: mfc3: avoid empty-body warning Arnd Bergmann
@ 2023-07-26 16:34   ` Sohil Mehta
  2023-07-26 22:32   ` kernel test robot
  1 sibling, 0 replies; 5+ messages in thread
From: Sohil Mehta @ 2023-07-26 16:34 UTC (permalink / raw)
  To: Arnd Bergmann, Sudip Mukherjee; +Cc: Arnd Bergmann, linux-kernel

On 7/26/2023 8:09 AM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>

> +	/* PARPORT_CONTROL_STROBE handled directly by hardware *t/

Is there a typo with the *t/ in the end?

-Sohil



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] parport: mfc3: avoid empty-body warning
  2023-07-26 15:09 ` [PATCH 2/2] parport: mfc3: avoid empty-body warning Arnd Bergmann
  2023-07-26 16:34   ` Sohil Mehta
@ 2023-07-26 22:32   ` kernel test robot
  1 sibling, 0 replies; 5+ messages in thread
From: kernel test robot @ 2023-07-26 22:32 UTC (permalink / raw)
  To: Arnd Bergmann, Sudip Mukherjee; +Cc: oe-kbuild-all, Arnd Bergmann, linux-kernel

Hi Arnd,

kernel test robot noticed the following build warnings:

[auto build test WARNING on deller-parisc/for-next]
[also build test WARNING on linus/master v6.5-rc3 next-20230726]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Arnd-Bergmann/parport-mfc3-avoid-empty-body-warning/20230726-231357
base:   https://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux.git for-next
patch link:    https://lore.kernel.org/r/20230726150944.2265044-2-arnd%40kernel.org
patch subject: [PATCH 2/2] parport: mfc3: avoid empty-body warning
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20230727/202307270631.RUr9mtaB-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230727/202307270631.RUr9mtaB-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202307270631.RUr9mtaB-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/parport/parport_mfc3.c: In function 'control_pc_to_mfc3':
>> drivers/parport/parport_mfc3.c:114:28: warning: "/*" within comment [-Wcomment]
     114 |         if (control & 128) /* /INITP */
         |                             
   drivers/parport/parport_mfc3.c: In function 'mfc3_read_control':
   drivers/parport/parport_mfc3.c:132:16: error: implicit declaration of function 'control_mfc3_to_pc'; did you mean 'control_pc_to_mfc3'? [-Werror=implicit-function-declaration]
     132 |         return control_mfc3_to_pc(pia(p)->ppra & 0xe0);
         |                ^~~~~~~~~~~~~~~~~~
         |                control_pc_to_mfc3
   cc1: some warnings being treated as errors


vim +114 drivers/parport/parport_mfc3.c

^1da177e4c3f41 Linus Torvalds 2005-04-16  108  
^1da177e4c3f41 Linus Torvalds 2005-04-16  109  static unsigned char control_mfc3_to_pc(unsigned char control)
^1da177e4c3f41 Linus Torvalds 2005-04-16  110  {
^1da177e4c3f41 Linus Torvalds 2005-04-16  111  	unsigned char ret = PARPORT_CONTROL_STROBE 
^1da177e4c3f41 Linus Torvalds 2005-04-16  112  			  | PARPORT_CONTROL_AUTOFD | PARPORT_CONTROL_SELECT;
^1da177e4c3f41 Linus Torvalds 2005-04-16  113  
^1da177e4c3f41 Linus Torvalds 2005-04-16 @114  	if (control & 128) /* /INITP */
^1da177e4c3f41 Linus Torvalds 2005-04-16  115  		ret |= PARPORT_CONTROL_INIT;
^1da177e4c3f41 Linus Torvalds 2005-04-16  116  	if (control & 64) /* /AUTOLF */
^1da177e4c3f41 Linus Torvalds 2005-04-16  117  		ret &= ~PARPORT_CONTROL_AUTOFD;
^1da177e4c3f41 Linus Torvalds 2005-04-16  118  	if (control & 32) /* /SELECT_IN */
^1da177e4c3f41 Linus Torvalds 2005-04-16  119  		ret &= ~PARPORT_CONTROL_SELECT;
^1da177e4c3f41 Linus Torvalds 2005-04-16  120  	return ret;
^1da177e4c3f41 Linus Torvalds 2005-04-16  121  }
^1da177e4c3f41 Linus Torvalds 2005-04-16  122  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] parport: gsc: remove DMA leftover code
  2023-07-26 15:09 [PATCH 1/2] parport: gsc: remove DMA leftover code Arnd Bergmann
  2023-07-26 15:09 ` [PATCH 2/2] parport: mfc3: avoid empty-body warning Arnd Bergmann
@ 2023-08-03  8:10 ` Helge Deller
  1 sibling, 0 replies; 5+ messages in thread
From: Helge Deller @ 2023-08-03  8:10 UTC (permalink / raw)
  To: Arnd Bergmann, James E.J. Bottomley, Sudip Mukherjee
  Cc: Arnd Bergmann, linux-parisc, linux-kernel

On 7/26/23 17:09, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> This driver does not actually work with DMA mode, but still tries
> to call ISA DMA interface functions that are stubbed out on
> parisc, resulting in a W=1 build warning:
>
> drivers/parport/parport_gsc.c: In function 'parport_remove_chip':
> drivers/parport/parport_gsc.c:389:20: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
>    389 |    free_dma(p->dma);
>
> Remove the corresponding code as a prerequisite for turning on -Wempty-body
> by default in all kernels.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Thanks Arnd!

I've added it to the parisc for-next git tree.

Helge

> ---
>   drivers/parport/parport_gsc.c | 28 ++++------------------------
>   drivers/parport/parport_gsc.h |  7 -------
>   2 files changed, 4 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/parport/parport_gsc.c b/drivers/parport/parport_gsc.c
> index 0dcc497b0449a..5e4475254bd0a 100644
> --- a/drivers/parport/parport_gsc.c
> +++ b/drivers/parport/parport_gsc.c
> @@ -28,7 +28,6 @@
>   #include <linux/sysctl.h>
>
>   #include <asm/io.h>
> -#include <asm/dma.h>
>   #include <linux/uaccess.h>
>   #include <asm/superio.h>
>
> @@ -226,9 +225,9 @@ static int parport_PS2_supported(struct parport *pb)
>
>   /* --- Initialisation code -------------------------------- */
>
> -struct parport *parport_gsc_probe_port(unsigned long base,
> +static struct parport *parport_gsc_probe_port(unsigned long base,
>   				       unsigned long base_hi, int irq,
> -				       int dma, struct parisc_device *padev)
> +				       struct parisc_device *padev)
>   {
>   	struct parport_gsc_private *priv;
>   	struct parport_operations *ops;
> @@ -250,12 +249,9 @@ struct parport *parport_gsc_probe_port(unsigned long base,
>   	}
>   	priv->ctr = 0xc;
>   	priv->ctr_writable = 0xff;
> -	priv->dma_buf = NULL;
> -	priv->dma_handle = 0;
>   	p->base = base;
>   	p->base_hi = base_hi;
>   	p->irq = irq;
> -	p->dma = dma;
>   	p->modes = PARPORT_MODE_PCSPP | PARPORT_MODE_SAFEININT;
>   	p->ops = ops;
>   	p->private_data = priv;
> @@ -286,17 +282,9 @@ struct parport *parport_gsc_probe_port(unsigned long base,
>   	if (p->irq == PARPORT_IRQ_AUTO) {
>   		p->irq = PARPORT_IRQ_NONE;
>   	}
> -	if (p->irq != PARPORT_IRQ_NONE) {
> +	if (p->irq != PARPORT_IRQ_NONE)
>   		pr_cont(", irq %d", p->irq);
>
> -		if (p->dma == PARPORT_DMA_AUTO) {
> -			p->dma = PARPORT_DMA_NONE;
> -		}
> -	}
> -	if (p->dma == PARPORT_DMA_AUTO) /* To use DMA, giving the irq
> -                                           is mandatory (see above) */
> -		p->dma = PARPORT_DMA_NONE;
> -
>   	pr_cont(" [");
>   #define printmode(x)							\
>   do {									\
> @@ -321,7 +309,6 @@ do {									\
>   			pr_warn("%s: irq %d in use, resorting to polled operation\n",
>   				p->name, p->irq);
>   			p->irq = PARPORT_IRQ_NONE;
> -			p->dma = PARPORT_DMA_NONE;
>   		}
>   	}
>
> @@ -369,8 +356,7 @@ static int __init parport_init_chip(struct parisc_device *dev)
>   		pr_info("%s: enhanced parport-modes not supported\n", __func__);
>   	}
>
> -	p = parport_gsc_probe_port(port, 0, dev->irq,
> -			/* PARPORT_IRQ_NONE */ PARPORT_DMA_NONE, dev);
> +	p = parport_gsc_probe_port(port, 0, dev->irq, dev);
>   	if (p)
>   		parport_count++;
>   	dev_set_drvdata(&dev->dev, p);
> @@ -382,16 +368,10 @@ static void __exit parport_remove_chip(struct parisc_device *dev)
>   {
>   	struct parport *p = dev_get_drvdata(&dev->dev);
>   	if (p) {
> -		struct parport_gsc_private *priv = p->private_data;
>   		struct parport_operations *ops = p->ops;
>   		parport_remove_port(p);
> -		if (p->dma != PARPORT_DMA_NONE)
> -			free_dma(p->dma);
>   		if (p->irq != PARPORT_IRQ_NONE)
>   			free_irq(p->irq, p);
> -		if (priv->dma_buf)
> -			dma_free_coherent(&priv->dev->dev, PAGE_SIZE,
> -					  priv->dma_buf, priv->dma_handle);
>   		kfree (p->private_data);
>   		parport_put_port(p);
>   		kfree (ops); /* hope no-one cached it */
> diff --git a/drivers/parport/parport_gsc.h b/drivers/parport/parport_gsc.h
> index 9301217edf12c..d447a568c2570 100644
> --- a/drivers/parport/parport_gsc.h
> +++ b/drivers/parport/parport_gsc.h
> @@ -63,8 +63,6 @@ struct parport_gsc_private {
>   	int writeIntrThreshold;
>
>   	/* buffer suitable for DMA, if DMA enabled */
> -	char *dma_buf;
> -	dma_addr_t dma_handle;
>   	struct pci_dev *dev;
>   };
>
> @@ -199,9 +197,4 @@ extern void parport_gsc_inc_use_count(void);
>
>   extern void parport_gsc_dec_use_count(void);
>
> -extern struct parport *parport_gsc_probe_port(unsigned long base,
> -						unsigned long base_hi,
> -						int irq, int dma,
> -						struct parisc_device *padev);
> -
>   #endif	/* __DRIVERS_PARPORT_PARPORT_GSC_H */


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-08-03  8:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-26 15:09 [PATCH 1/2] parport: gsc: remove DMA leftover code Arnd Bergmann
2023-07-26 15:09 ` [PATCH 2/2] parport: mfc3: avoid empty-body warning Arnd Bergmann
2023-07-26 16:34   ` Sohil Mehta
2023-07-26 22:32   ` kernel test robot
2023-08-03  8:10 ` [PATCH 1/2] parport: gsc: remove DMA leftover code Helge Deller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox