All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] staging: comedi: amplc_dio200 detach cleanups
@ 2014-07-25 17:07 ` Ian Abbott
  0 siblings, 0 replies; 18+ messages in thread
From: Ian Abbott @ 2014-07-25 17:07 UTC (permalink / raw)
  To: driverdev-devel
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, linux-kernel

Fix a double free_irq() and do a bit more cleaning up of the "detach"
routines.

1) staging: comedi: amplc_dio200_common: prevent extra free_irq()
2) staging: comedi: amplc_dio200_common: remove some tests from
   amplc_dio200_common_detach()
3) staging: comedi: amplc_dio200_pci: no need to test board pointer in
   dio200_pci_detach()

 drivers/staging/comedi/drivers/amplc_dio200_common.c | 9 +++------
 drivers/staging/comedi/drivers/amplc_dio200_pci.c    | 5 +----
 2 files changed, 4 insertions(+), 10 deletions(-)

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

* [PATCH 0/3] staging: comedi: amplc_dio200 detach cleanups
@ 2014-07-25 17:07 ` Ian Abbott
  0 siblings, 0 replies; 18+ messages in thread
From: Ian Abbott @ 2014-07-25 17:07 UTC (permalink / raw)
  To: driverdev-devel; +Cc: Greg Kroah-Hartman, Ian Abbott, linux-kernel

Fix a double free_irq() and do a bit more cleaning up of the "detach"
routines.

1) staging: comedi: amplc_dio200_common: prevent extra free_irq()
2) staging: comedi: amplc_dio200_common: remove some tests from
   amplc_dio200_common_detach()
3) staging: comedi: amplc_dio200_pci: no need to test board pointer in
   dio200_pci_detach()

 drivers/staging/comedi/drivers/amplc_dio200_common.c | 9 +++------
 drivers/staging/comedi/drivers/amplc_dio200_pci.c    | 5 +----
 2 files changed, 4 insertions(+), 10 deletions(-)
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH 1/3] staging: comedi: amplc_dio200_common: prevent extra free_irq()
  2014-07-25 17:07 ` Ian Abbott
@ 2014-07-25 17:07   ` Ian Abbott
  -1 siblings, 0 replies; 18+ messages in thread
From: Ian Abbott @ 2014-07-25 17:07 UTC (permalink / raw)
  To: driverdev-devel
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, linux-kernel

`dio200_detach()` in "amplc_dio200.c" calls
`amplc_dio200_common_detach()` in "amplc_dio200_common.c", followed by
`comedi_legacy_detach()` in "../drivers.c".  Both of those functions
call `free_irq()` if `dev->irq` is non-zero.  The second call produces a
warning message because the handler has already been freed.  Prevent
that by setting `dev->irq = 0` in `amplc_dio200_common_detach()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
 drivers/staging/comedi/drivers/amplc_dio200_common.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c
index 78700e8..3592e58 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200_common.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c
@@ -1202,8 +1202,10 @@ void amplc_dio200_common_detach(struct comedi_device *dev)
 
 	if (!thisboard || !devpriv)
 		return;
-	if (dev->irq)
+	if (dev->irq) {
 		free_irq(dev->irq, dev);
+		dev->irq = 0;
+	}
 }
 EXPORT_SYMBOL_GPL(amplc_dio200_common_detach);
 
-- 
2.0.0


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

* [PATCH 1/3] staging: comedi: amplc_dio200_common: prevent extra free_irq()
@ 2014-07-25 17:07   ` Ian Abbott
  0 siblings, 0 replies; 18+ messages in thread
From: Ian Abbott @ 2014-07-25 17:07 UTC (permalink / raw)
  To: driverdev-devel; +Cc: Greg Kroah-Hartman, Ian Abbott, linux-kernel

`dio200_detach()` in "amplc_dio200.c" calls
`amplc_dio200_common_detach()` in "amplc_dio200_common.c", followed by
`comedi_legacy_detach()` in "../drivers.c".  Both of those functions
call `free_irq()` if `dev->irq` is non-zero.  The second call produces a
warning message because the handler has already been freed.  Prevent
that by setting `dev->irq = 0` in `amplc_dio200_common_detach()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
---
 drivers/staging/comedi/drivers/amplc_dio200_common.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c
index 78700e8..3592e58 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200_common.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c
@@ -1202,8 +1202,10 @@ void amplc_dio200_common_detach(struct comedi_device *dev)
 
 	if (!thisboard || !devpriv)
 		return;
-	if (dev->irq)
+	if (dev->irq) {
 		free_irq(dev->irq, dev);
+		dev->irq = 0;
+	}
 }
 EXPORT_SYMBOL_GPL(amplc_dio200_common_detach);
 
-- 
2.0.0

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH 2/3] staging: comedi: amplc_dio200_common: remove some tests from amplc_dio200_common_detach()
  2014-07-25 17:07 ` Ian Abbott
@ 2014-07-25 17:07   ` Ian Abbott
  -1 siblings, 0 replies; 18+ messages in thread
From: Ian Abbott @ 2014-07-25 17:07 UTC (permalink / raw)
  To: driverdev-devel
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, linux-kernel

`amplc_dio200_common_detach()` doesn't do much apart from freeing the
IRQ handler that was requested by `amplc_dio200_common_attach()` if
`dev->irq` is non-zero.  There is no need to check if the pointer to
the constant board data or the pointer to private per-device data
exist, so remove those tests.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
 drivers/staging/comedi/drivers/amplc_dio200_common.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c
index 3592e58..4cf9e9e 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200_common.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c
@@ -1197,11 +1197,6 @@ EXPORT_SYMBOL_GPL(amplc_dio200_common_attach);
 
 void amplc_dio200_common_detach(struct comedi_device *dev)
 {
-	const struct dio200_board *thisboard = comedi_board(dev);
-	struct dio200_private *devpriv = dev->private;
-
-	if (!thisboard || !devpriv)
-		return;
 	if (dev->irq) {
 		free_irq(dev->irq, dev);
 		dev->irq = 0;
-- 
2.0.0


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

* [PATCH 2/3] staging: comedi: amplc_dio200_common: remove some tests from amplc_dio200_common_detach()
@ 2014-07-25 17:07   ` Ian Abbott
  0 siblings, 0 replies; 18+ messages in thread
From: Ian Abbott @ 2014-07-25 17:07 UTC (permalink / raw)
  To: driverdev-devel; +Cc: Greg Kroah-Hartman, Ian Abbott, linux-kernel

`amplc_dio200_common_detach()` doesn't do much apart from freeing the
IRQ handler that was requested by `amplc_dio200_common_attach()` if
`dev->irq` is non-zero.  There is no need to check if the pointer to
the constant board data or the pointer to private per-device data
exist, so remove those tests.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
---
 drivers/staging/comedi/drivers/amplc_dio200_common.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c
index 3592e58..4cf9e9e 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200_common.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c
@@ -1197,11 +1197,6 @@ EXPORT_SYMBOL_GPL(amplc_dio200_common_attach);
 
 void amplc_dio200_common_detach(struct comedi_device *dev)
 {
-	const struct dio200_board *thisboard = comedi_board(dev);
-	struct dio200_private *devpriv = dev->private;
-
-	if (!thisboard || !devpriv)
-		return;
 	if (dev->irq) {
 		free_irq(dev->irq, dev);
 		dev->irq = 0;
-- 
2.0.0

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH 3/3] staging: comedi: amplc_dio200_pci: no need to test board pointer in dio200_pci_detach()
  2014-07-25 17:07 ` Ian Abbott
@ 2014-07-25 17:07   ` Ian Abbott
  -1 siblings, 0 replies; 18+ messages in thread
From: Ian Abbott @ 2014-07-25 17:07 UTC (permalink / raw)
  To: driverdev-devel
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, linux-kernel

`dio200_pci_detach()` doesn't need to check if the pointer to constant
board data (`thisboard`) and the pointer to private per-device data
(`devpriv`) are valid before calling `amplc_dio200_common_detach()`.  It
has no further need to check `thisboard` so remove the variable
altogether.  Move the test of `devpriv` to the first point it is needs
to be valid.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
 drivers/staging/comedi/drivers/amplc_dio200_pci.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/drivers/amplc_dio200_pci.c b/drivers/staging/comedi/drivers/amplc_dio200_pci.c
index 3cec0e0..1954c1b 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200_pci.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200_pci.c
@@ -414,13 +414,10 @@ static int dio200_pci_auto_attach(struct comedi_device *dev,
 
 static void dio200_pci_detach(struct comedi_device *dev)
 {
-	const struct dio200_board *thisboard = comedi_board(dev);
 	struct dio200_private *devpriv = dev->private;
 
-	if (!thisboard || !devpriv)
-		return;
 	amplc_dio200_common_detach(dev);
-	if (devpriv->io.regtype == mmio_regtype)
+	if (devpriv && devpriv->io.regtype == mmio_regtype)
 		iounmap(devpriv->io.u.membase);
 	comedi_pci_disable(dev);
 }
-- 
2.0.0


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

* [PATCH 3/3] staging: comedi: amplc_dio200_pci: no need to test board pointer in dio200_pci_detach()
@ 2014-07-25 17:07   ` Ian Abbott
  0 siblings, 0 replies; 18+ messages in thread
From: Ian Abbott @ 2014-07-25 17:07 UTC (permalink / raw)
  To: driverdev-devel; +Cc: Greg Kroah-Hartman, Ian Abbott, linux-kernel

`dio200_pci_detach()` doesn't need to check if the pointer to constant
board data (`thisboard`) and the pointer to private per-device data
(`devpriv`) are valid before calling `amplc_dio200_common_detach()`.  It
has no further need to check `thisboard` so remove the variable
altogether.  Move the test of `devpriv` to the first point it is needs
to be valid.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
---
 drivers/staging/comedi/drivers/amplc_dio200_pci.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/drivers/amplc_dio200_pci.c b/drivers/staging/comedi/drivers/amplc_dio200_pci.c
index 3cec0e0..1954c1b 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200_pci.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200_pci.c
@@ -414,13 +414,10 @@ static int dio200_pci_auto_attach(struct comedi_device *dev,
 
 static void dio200_pci_detach(struct comedi_device *dev)
 {
-	const struct dio200_board *thisboard = comedi_board(dev);
 	struct dio200_private *devpriv = dev->private;
 
-	if (!thisboard || !devpriv)
-		return;
 	amplc_dio200_common_detach(dev);
-	if (devpriv->io.regtype == mmio_regtype)
+	if (devpriv && devpriv->io.regtype == mmio_regtype)
 		iounmap(devpriv->io.u.membase);
 	comedi_pci_disable(dev);
 }
-- 
2.0.0

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* RE: [PATCH 0/3] staging: comedi: amplc_dio200 detach cleanups
  2014-07-25 17:07 ` Ian Abbott
@ 2014-07-25 18:14   ` Hartley Sweeten
  -1 siblings, 0 replies; 18+ messages in thread
From: Hartley Sweeten @ 2014-07-25 18:14 UTC (permalink / raw)
  To: Ian Abbott, driverdev-devel; +Cc: Greg Kroah-Hartman, linux-kernel

On Friday, July 25, 2014 10:07 AM, Ian Abbott wrote:
> Fix a double free_irq() and do a bit more cleaning up of the "detach"
> routines.
>
> 1) staging: comedi: amplc_dio200_common: prevent extra free_irq()
> 2) staging: comedi: amplc_dio200_common: remove some tests from
>    amplc_dio200_common_detach()
> 3) staging: comedi: amplc_dio200_pci: no need to test board pointer in
>    dio200_pci_detach()
>
>  drivers/staging/comedi/drivers/amplc_dio200_common.c | 9 +++------
>  drivers/staging/comedi/drivers/amplc_dio200_pci.c    | 5 +----
>  2 files changed, 4 insertions(+), 10 deletions(-)

Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>


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

* RE: [PATCH 0/3] staging: comedi: amplc_dio200 detach cleanups
@ 2014-07-25 18:14   ` Hartley Sweeten
  0 siblings, 0 replies; 18+ messages in thread
From: Hartley Sweeten @ 2014-07-25 18:14 UTC (permalink / raw)
  To: Ian Abbott, driverdev-devel; +Cc: Greg Kroah-Hartman, linux-kernel

On Friday, July 25, 2014 10:07 AM, Ian Abbott wrote:
> Fix a double free_irq() and do a bit more cleaning up of the "detach"
> routines.
>
> 1) staging: comedi: amplc_dio200_common: prevent extra free_irq()
> 2) staging: comedi: amplc_dio200_common: remove some tests from
>    amplc_dio200_common_detach()
> 3) staging: comedi: amplc_dio200_pci: no need to test board pointer in
>    dio200_pci_detach()
>
>  drivers/staging/comedi/drivers/amplc_dio200_common.c | 9 +++------
>  drivers/staging/comedi/drivers/amplc_dio200_pci.c    | 5 +----
>  2 files changed, 4 insertions(+), 10 deletions(-)

Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* RE: [PATCH 1/3] staging: comedi: amplc_dio200_common: prevent extra free_irq()
  2014-07-25 17:07   ` Ian Abbott
@ 2014-07-25 18:23     ` Hartley Sweeten
  -1 siblings, 0 replies; 18+ messages in thread
From: Hartley Sweeten @ 2014-07-25 18:23 UTC (permalink / raw)
  To: Ian Abbott, driverdev-devel; +Cc: Greg Kroah-Hartman, linux-kernel

On Friday, July 25, 2014 10:07 AM, Ian Abbott wrote:
> `dio200_detach()` in "amplc_dio200.c" calls
> `amplc_dio200_common_detach()` in "amplc_dio200_common.c", followed by
> `comedi_legacy_detach()` in "../drivers.c".  Both of those functions
> call `free_irq()` if `dev->irq` is non-zero.  The second call produces a
> warning message because the handler has already been freed.  Prevent
> that by setting `dev->irq = 0` in `amplc_dio200_common_detach()`.
>
> Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
> ---
>  drivers/staging/comedi/drivers/amplc_dio200_common.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c
> index 78700e8..3592e58 100644
> --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c
> +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c
> @@ -1202,8 +1202,10 @@ void amplc_dio200_common_detach(struct comedi_device *dev)
>  
>  	if (!thisboard || !devpriv)
>  		return;
> -	if (dev->irq)
> +	if (dev->irq) {
>  		free_irq(dev->irq, dev);
> +		dev->irq = 0;
> +	}
>  }
>  EXPORT_SYMBOL_GPL(amplc_dio200_common_detach);
 
Ian,

I have already gave a Reviewed-by signoff for this series.

After looking over the code I think a cleaner solution would be to:

1) Use comedi_legacy_detach() directly for the (*detach) in the
   legacy ISA driver.
2) Move the code from amplc_dio200_common_detach() into the
   (*detach) function for the PCI driver.
3) Remove the exported function amplc_dio200_common_detach().

Regards,
Hartley


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

* RE: [PATCH 1/3] staging: comedi: amplc_dio200_common: prevent extra free_irq()
@ 2014-07-25 18:23     ` Hartley Sweeten
  0 siblings, 0 replies; 18+ messages in thread
From: Hartley Sweeten @ 2014-07-25 18:23 UTC (permalink / raw)
  To: Ian Abbott, driverdev-devel; +Cc: Greg Kroah-Hartman, linux-kernel

On Friday, July 25, 2014 10:07 AM, Ian Abbott wrote:
> `dio200_detach()` in "amplc_dio200.c" calls
> `amplc_dio200_common_detach()` in "amplc_dio200_common.c", followed by
> `comedi_legacy_detach()` in "../drivers.c".  Both of those functions
> call `free_irq()` if `dev->irq` is non-zero.  The second call produces a
> warning message because the handler has already been freed.  Prevent
> that by setting `dev->irq = 0` in `amplc_dio200_common_detach()`.
>
> Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
> ---
>  drivers/staging/comedi/drivers/amplc_dio200_common.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c
> index 78700e8..3592e58 100644
> --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c
> +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c
> @@ -1202,8 +1202,10 @@ void amplc_dio200_common_detach(struct comedi_device *dev)
>  
>  	if (!thisboard || !devpriv)
>  		return;
> -	if (dev->irq)
> +	if (dev->irq) {
>  		free_irq(dev->irq, dev);
> +		dev->irq = 0;
> +	}
>  }
>  EXPORT_SYMBOL_GPL(amplc_dio200_common_detach);
 
Ian,

I have already gave a Reviewed-by signoff for this series.

After looking over the code I think a cleaner solution would be to:

1) Use comedi_legacy_detach() directly for the (*detach) in the
   legacy ISA driver.
2) Move the code from amplc_dio200_common_detach() into the
   (*detach) function for the PCI driver.
3) Remove the exported function amplc_dio200_common_detach().

Regards,
Hartley

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH 1/3] staging: comedi: amplc_dio200_common: prevent extra free_irq()
  2014-07-25 18:23     ` Hartley Sweeten
@ 2014-07-27 18:45       ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 18+ messages in thread
From: Greg Kroah-Hartman @ 2014-07-27 18:45 UTC (permalink / raw)
  To: Hartley Sweeten; +Cc: Ian Abbott, driverdev-devel, linux-kernel

On Fri, Jul 25, 2014 at 06:23:10PM +0000, Hartley Sweeten wrote:
> On Friday, July 25, 2014 10:07 AM, Ian Abbott wrote:
> > `dio200_detach()` in "amplc_dio200.c" calls
> > `amplc_dio200_common_detach()` in "amplc_dio200_common.c", followed by
> > `comedi_legacy_detach()` in "../drivers.c".  Both of those functions
> > call `free_irq()` if `dev->irq` is non-zero.  The second call produces a
> > warning message because the handler has already been freed.  Prevent
> > that by setting `dev->irq = 0` in `amplc_dio200_common_detach()`.
> >
> > Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
> > ---
> >  drivers/staging/comedi/drivers/amplc_dio200_common.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c
> > index 78700e8..3592e58 100644
> > --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c
> > +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c
> > @@ -1202,8 +1202,10 @@ void amplc_dio200_common_detach(struct comedi_device *dev)
> >  
> >  	if (!thisboard || !devpriv)
> >  		return;
> > -	if (dev->irq)
> > +	if (dev->irq) {
> >  		free_irq(dev->irq, dev);
> > +		dev->irq = 0;
> > +	}
> >  }
> >  EXPORT_SYMBOL_GPL(amplc_dio200_common_detach);
>  
> Ian,
> 
> I have already gave a Reviewed-by signoff for this series.
> 
> After looking over the code I think a cleaner solution would be to:
> 
> 1) Use comedi_legacy_detach() directly for the (*detach) in the
>    legacy ISA driver.
> 2) Move the code from amplc_dio200_common_detach() into the
>    (*detach) function for the PCI driver.
> 3) Remove the exported function amplc_dio200_common_detach().

So should I not apply these patches?

confused,

greg k-h

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

* Re: [PATCH 1/3] staging: comedi: amplc_dio200_common: prevent extra free_irq()
@ 2014-07-27 18:45       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 18+ messages in thread
From: Greg Kroah-Hartman @ 2014-07-27 18:45 UTC (permalink / raw)
  To: Hartley Sweeten; +Cc: Ian Abbott, driverdev-devel, linux-kernel

On Fri, Jul 25, 2014 at 06:23:10PM +0000, Hartley Sweeten wrote:
> On Friday, July 25, 2014 10:07 AM, Ian Abbott wrote:
> > `dio200_detach()` in "amplc_dio200.c" calls
> > `amplc_dio200_common_detach()` in "amplc_dio200_common.c", followed by
> > `comedi_legacy_detach()` in "../drivers.c".  Both of those functions
> > call `free_irq()` if `dev->irq` is non-zero.  The second call produces a
> > warning message because the handler has already been freed.  Prevent
> > that by setting `dev->irq = 0` in `amplc_dio200_common_detach()`.
> >
> > Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
> > ---
> >  drivers/staging/comedi/drivers/amplc_dio200_common.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c
> > index 78700e8..3592e58 100644
> > --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c
> > +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c
> > @@ -1202,8 +1202,10 @@ void amplc_dio200_common_detach(struct comedi_device *dev)
> >  
> >  	if (!thisboard || !devpriv)
> >  		return;
> > -	if (dev->irq)
> > +	if (dev->irq) {
> >  		free_irq(dev->irq, dev);
> > +		dev->irq = 0;
> > +	}
> >  }
> >  EXPORT_SYMBOL_GPL(amplc_dio200_common_detach);
>  
> Ian,
> 
> I have already gave a Reviewed-by signoff for this series.
> 
> After looking over the code I think a cleaner solution would be to:
> 
> 1) Use comedi_legacy_detach() directly for the (*detach) in the
>    legacy ISA driver.
> 2) Move the code from amplc_dio200_common_detach() into the
>    (*detach) function for the PCI driver.
> 3) Remove the exported function amplc_dio200_common_detach().

So should I not apply these patches?

confused,

greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH 1/3] staging: comedi: amplc_dio200_common: prevent extra free_irq()
  2014-07-27 18:45       ` Greg Kroah-Hartman
@ 2014-07-28  9:27         ` Ian Abbott
  -1 siblings, 0 replies; 18+ messages in thread
From: Ian Abbott @ 2014-07-28  9:27 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Hartley Sweeten; +Cc: driverdev-devel, linux-kernel

On 2014-07-27 19:45, Greg Kroah-Hartman wrote:
> On Fri, Jul 25, 2014 at 06:23:10PM +0000, Hartley Sweeten wrote:
>> On Friday, July 25, 2014 10:07 AM, Ian Abbott wrote:
>>> `dio200_detach()` in "amplc_dio200.c" calls
>>> `amplc_dio200_common_detach()` in "amplc_dio200_common.c", followed by
>>> `comedi_legacy_detach()` in "../drivers.c".  Both of those functions
>>> call `free_irq()` if `dev->irq` is non-zero.  The second call produces a
>>> warning message because the handler has already been freed.  Prevent
>>> that by setting `dev->irq = 0` in `amplc_dio200_common_detach()`.
>>>
>>> Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
>>> ---
>>>   drivers/staging/comedi/drivers/amplc_dio200_common.c | 4 +++-
>>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c
>>> index 78700e8..3592e58 100644
>>> --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c
>>> +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c
>>> @@ -1202,8 +1202,10 @@ void amplc_dio200_common_detach(struct comedi_device *dev)
>>>
>>>   	if (!thisboard || !devpriv)
>>>   		return;
>>> -	if (dev->irq)
>>> +	if (dev->irq) {
>>>   		free_irq(dev->irq, dev);
>>> +		dev->irq = 0;
>>> +	}
>>>   }
>>>   EXPORT_SYMBOL_GPL(amplc_dio200_common_detach);
>>
>> Ian,
>>
>> I have already gave a Reviewed-by signoff for this series.
>>
>> After looking over the code I think a cleaner solution would be to:
>>
>> 1) Use comedi_legacy_detach() directly for the (*detach) in the
>>     legacy ISA driver.
>> 2) Move the code from amplc_dio200_common_detach() into the
>>     (*detach) function for the PCI driver.
>> 3) Remove the exported function amplc_dio200_common_detach().
>
> So should I not apply these patches?
>
> confused,
>
> greg k-h

It fixes a bug (harmless, apart from a kernel warning), and does no 
harm, so might as well apply them.  Hartley's suggestion can be done later.

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-

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

* Re: [PATCH 1/3] staging: comedi: amplc_dio200_common: prevent extra free_irq()
@ 2014-07-28  9:27         ` Ian Abbott
  0 siblings, 0 replies; 18+ messages in thread
From: Ian Abbott @ 2014-07-28  9:27 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Hartley Sweeten; +Cc: driverdev-devel, linux-kernel

On 2014-07-27 19:45, Greg Kroah-Hartman wrote:
> On Fri, Jul 25, 2014 at 06:23:10PM +0000, Hartley Sweeten wrote:
>> On Friday, July 25, 2014 10:07 AM, Ian Abbott wrote:
>>> `dio200_detach()` in "amplc_dio200.c" calls
>>> `amplc_dio200_common_detach()` in "amplc_dio200_common.c", followed by
>>> `comedi_legacy_detach()` in "../drivers.c".  Both of those functions
>>> call `free_irq()` if `dev->irq` is non-zero.  The second call produces a
>>> warning message because the handler has already been freed.  Prevent
>>> that by setting `dev->irq = 0` in `amplc_dio200_common_detach()`.
>>>
>>> Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
>>> ---
>>>   drivers/staging/comedi/drivers/amplc_dio200_common.c | 4 +++-
>>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c
>>> index 78700e8..3592e58 100644
>>> --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c
>>> +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c
>>> @@ -1202,8 +1202,10 @@ void amplc_dio200_common_detach(struct comedi_device *dev)
>>>
>>>   	if (!thisboard || !devpriv)
>>>   		return;
>>> -	if (dev->irq)
>>> +	if (dev->irq) {
>>>   		free_irq(dev->irq, dev);
>>> +		dev->irq = 0;
>>> +	}
>>>   }
>>>   EXPORT_SYMBOL_GPL(amplc_dio200_common_detach);
>>
>> Ian,
>>
>> I have already gave a Reviewed-by signoff for this series.
>>
>> After looking over the code I think a cleaner solution would be to:
>>
>> 1) Use comedi_legacy_detach() directly for the (*detach) in the
>>     legacy ISA driver.
>> 2) Move the code from amplc_dio200_common_detach() into the
>>     (*detach) function for the PCI driver.
>> 3) Remove the exported function amplc_dio200_common_detach().
>
> So should I not apply these patches?
>
> confused,
>
> greg k-h

It fixes a bug (harmless, apart from a kernel warning), and does no 
harm, so might as well apply them.  Hartley's suggestion can be done later.

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* RE: [PATCH 1/3] staging: comedi: amplc_dio200_common: prevent extra free_irq()
  2014-07-27 18:45       ` Greg Kroah-Hartman
@ 2014-07-28 16:35         ` Hartley Sweeten
  -1 siblings, 0 replies; 18+ messages in thread
From: Hartley Sweeten @ 2014-07-28 16:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Ian Abbott, driverdev-devel, linux-kernel

On Sunday, July 27, 2014 11:45 AM, Greg Kroah-Hartman wrote:
> On Fri, Jul 25, 2014 at 06:23:10PM +0000, Hartley Sweeten wrote:
>> On Friday, July 25, 2014 10:07 AM, Ian Abbott wrote:
>>> `dio200_detach()` in "amplc_dio200.c" calls
>>> `amplc_dio200_common_detach()` in "amplc_dio200_common.c", followed by
>>> `comedi_legacy_detach()` in "../drivers.c".  Both of those functions
>>> call `free_irq()` if `dev->irq` is non-zero.  The second call produces a
>>> warning message because the handler has already been freed.  Prevent
>>> that by setting `dev->irq = 0` in `amplc_dio200_common_detach()`.
>>>
>>> Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
>>>
>> I have already gave a Reviewed-by signoff for this series.
>> 
>> After looking over the code I think a cleaner solution would be to:
>> 
>> 1) Use comedi_legacy_detach() directly for the (*detach) in the
>>    legacy ISA driver.
>> 2) Move the code from amplc_dio200_common_detach() into the
>>    (*detach) function for the PCI driver.
>> 3) Remove the exported function amplc_dio200_common_detach().
>
> So should I not apply these patches?

Greg,

Yes, please apply this series from Ian. It does fix a bug with the
duplicate free_irq().

The comments I gave can be addressed in a later patch.

Sorry for the confusion.
Hartley

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

* RE: [PATCH 1/3] staging: comedi: amplc_dio200_common: prevent extra free_irq()
@ 2014-07-28 16:35         ` Hartley Sweeten
  0 siblings, 0 replies; 18+ messages in thread
From: Hartley Sweeten @ 2014-07-28 16:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Ian Abbott, driverdev-devel, linux-kernel

On Sunday, July 27, 2014 11:45 AM, Greg Kroah-Hartman wrote:
> On Fri, Jul 25, 2014 at 06:23:10PM +0000, Hartley Sweeten wrote:
>> On Friday, July 25, 2014 10:07 AM, Ian Abbott wrote:
>>> `dio200_detach()` in "amplc_dio200.c" calls
>>> `amplc_dio200_common_detach()` in "amplc_dio200_common.c", followed by
>>> `comedi_legacy_detach()` in "../drivers.c".  Both of those functions
>>> call `free_irq()` if `dev->irq` is non-zero.  The second call produces a
>>> warning message because the handler has already been freed.  Prevent
>>> that by setting `dev->irq = 0` in `amplc_dio200_common_detach()`.
>>>
>>> Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
>>>
>> I have already gave a Reviewed-by signoff for this series.
>> 
>> After looking over the code I think a cleaner solution would be to:
>> 
>> 1) Use comedi_legacy_detach() directly for the (*detach) in the
>>    legacy ISA driver.
>> 2) Move the code from amplc_dio200_common_detach() into the
>>    (*detach) function for the PCI driver.
>> 3) Remove the exported function amplc_dio200_common_detach().
>
> So should I not apply these patches?

Greg,

Yes, please apply this series from Ian. It does fix a bug with the
duplicate free_irq().

The comments I gave can be addressed in a later patch.

Sorry for the confusion.
Hartley
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

end of thread, other threads:[~2014-07-28 16:35 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-25 17:07 [PATCH 0/3] staging: comedi: amplc_dio200 detach cleanups Ian Abbott
2014-07-25 17:07 ` Ian Abbott
2014-07-25 17:07 ` [PATCH 1/3] staging: comedi: amplc_dio200_common: prevent extra free_irq() Ian Abbott
2014-07-25 17:07   ` Ian Abbott
2014-07-25 18:23   ` Hartley Sweeten
2014-07-25 18:23     ` Hartley Sweeten
2014-07-27 18:45     ` Greg Kroah-Hartman
2014-07-27 18:45       ` Greg Kroah-Hartman
2014-07-28  9:27       ` Ian Abbott
2014-07-28  9:27         ` Ian Abbott
2014-07-28 16:35       ` Hartley Sweeten
2014-07-28 16:35         ` Hartley Sweeten
2014-07-25 17:07 ` [PATCH 2/3] staging: comedi: amplc_dio200_common: remove some tests from amplc_dio200_common_detach() Ian Abbott
2014-07-25 17:07   ` Ian Abbott
2014-07-25 17:07 ` [PATCH 3/3] staging: comedi: amplc_dio200_pci: no need to test board pointer in dio200_pci_detach() Ian Abbott
2014-07-25 17:07   ` Ian Abbott
2014-07-25 18:14 ` [PATCH 0/3] staging: comedi: amplc_dio200 detach cleanups Hartley Sweeten
2014-07-25 18:14   ` Hartley Sweeten

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.