* [PATCH v2 0/3] staging: iio_simple_dummy: minor driver fixes
@ 2015-05-29 21:45 Vladimirs Ambrosovs
2015-05-29 21:45 ` [PATCH v2 1/3] staging: iio_simple_dummy: fix init function Vladimirs Ambrosovs
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Vladimirs Ambrosovs @ 2015-05-29 21:45 UTC (permalink / raw)
To: jic23, daniel.baluta, dan.carpenter, gregkh
Cc: cristina.opriceana, driverdev-devel, linux-iio
v2 Fixed the code as per the comments from version 1:
* Removed unnecessary comments
* Fixed the label name to address label location
* Changed the type of functions, which always return 0 to void
Vladimirs Ambrosovs (3):
staging: iio_simple_dummy: fix init function
staging: iio_simple_dummy: fix return types
staging: iio_simple_dummy: fix module_param type
drivers/staging/iio/iio_dummy_evgen.c | 4 +---
drivers/staging/iio/iio_simple_dummy.c | 21 +++++++++++----------
drivers/staging/iio/iio_simple_dummy_events.c | 4 +---
3 files changed, 13 insertions(+), 16 deletions(-)
--
2.4.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/3] staging: iio_simple_dummy: fix init function
2015-05-29 21:45 [PATCH v2 0/3] staging: iio_simple_dummy: minor driver fixes Vladimirs Ambrosovs
@ 2015-05-29 21:45 ` Vladimirs Ambrosovs
2015-05-29 21:45 ` [PATCH v2 2/3] staging: iio_simple_dummy: fix return types Vladimirs Ambrosovs
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Vladimirs Ambrosovs @ 2015-05-29 21:45 UTC (permalink / raw)
To: jic23, daniel.baluta, dan.carpenter, gregkh
Cc: cristina.opriceana, driverdev-devel, linux-iio,
Vladimirs Ambrosovs
This patch fixes the init function for the iio_simple_dummy driver.
The main issues were absence of kfree for the allocated array, and no
devices being removed in case the probe function fails, running in a loop.
Signed-off-by: Vladimirs Ambrosovs <rodriguez.twister@gmail.com>
---
drivers/staging/iio/iio_simple_dummy.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/iio/iio_simple_dummy.c b/drivers/staging/iio/iio_simple_dummy.c
index b47bf9f..d0a9963 100644
--- a/drivers/staging/iio/iio_simple_dummy.c
+++ b/drivers/staging/iio/iio_simple_dummy.c
@@ -722,9 +722,16 @@ static __init int iio_dummy_init(void)
for (i = 0; i < instances; i++) {
ret = iio_dummy_probe(i);
if (ret < 0)
- return ret;
+ goto error_remove_devs;
}
return 0;
+
+error_remove_devs:
+ while (i--)
+ iio_dummy_remove(i);
+
+ kfree(iio_dummy_devs);
+ return ret;
}
module_init(iio_dummy_init);
--
2.4.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/3] staging: iio_simple_dummy: fix return types
2015-05-29 21:45 [PATCH v2 0/3] staging: iio_simple_dummy: minor driver fixes Vladimirs Ambrosovs
2015-05-29 21:45 ` [PATCH v2 1/3] staging: iio_simple_dummy: fix init function Vladimirs Ambrosovs
@ 2015-05-29 21:45 ` Vladimirs Ambrosovs
2015-05-30 6:54 ` Sudip Mukherjee
2015-05-29 21:45 ` [PATCH v2 3/3] staging: iio_simple_dummy: fix module_param type Vladimirs Ambrosovs
2015-05-30 5:03 ` [PATCH v2 0/3] staging: iio_simple_dummy: minor driver fixes Dan Carpenter
3 siblings, 1 reply; 7+ messages in thread
From: Vladimirs Ambrosovs @ 2015-05-29 21:45 UTC (permalink / raw)
To: jic23, daniel.baluta, dan.carpenter, gregkh
Cc: cristina.opriceana, driverdev-devel, linux-iio,
Vladimirs Ambrosovs
The functions iio_dummy_remove(), iio_simple_dummy_events_unregister() and
iio_dummy_evgen_release_irq() were changed to return void instead of int,
because these functions always return 0.
Signed-off-by: Vladimirs Ambrosovs <rodriguez.twister@gmail.com>
---
drivers/staging/iio/iio_dummy_evgen.c | 4 +---
drivers/staging/iio/iio_simple_dummy.c | 10 ++--------
drivers/staging/iio/iio_simple_dummy_events.c | 4 +---
3 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/iio/iio_dummy_evgen.c b/drivers/staging/iio/iio_dummy_evgen.c
index 0c9c86d..c54d5b5 100644
--- a/drivers/staging/iio/iio_dummy_evgen.c
+++ b/drivers/staging/iio/iio_dummy_evgen.c
@@ -128,13 +128,11 @@ EXPORT_SYMBOL_GPL(iio_dummy_evgen_get_irq);
*
* Used by client driver instances to give the irqs back when they disconnect
*/
-int iio_dummy_evgen_release_irq(int irq)
+void iio_dummy_evgen_release_irq(int irq)
{
mutex_lock(&iio_evgen->lock);
iio_evgen->inuse[irq - iio_evgen->base] = false;
mutex_unlock(&iio_evgen->lock);
-
- return 0;
}
EXPORT_SYMBOL_GPL(iio_dummy_evgen_release_irq);
diff --git a/drivers/staging/iio/iio_simple_dummy.c b/drivers/staging/iio/iio_simple_dummy.c
index d0a9963..dc9482c7 100644
--- a/drivers/staging/iio/iio_simple_dummy.c
+++ b/drivers/staging/iio/iio_simple_dummy.c
@@ -665,9 +665,8 @@ error_ret:
*
* Parameters follow those of iio_dummy_probe for buses.
*/
-static int iio_dummy_remove(int index)
+static void iio_dummy_remove(int index)
{
- int ret;
/*
* Get a pointer to the device instance iio_dev structure
* from the bus subsystem. E.g.
@@ -685,15 +684,10 @@ static int iio_dummy_remove(int index)
/* Buffered capture related cleanup */
iio_simple_dummy_unconfigure_buffer(indio_dev);
- ret = iio_simple_dummy_events_unregister(indio_dev);
- if (ret)
- goto error_ret;
+ iio_simple_dummy_events_unregister(indio_dev);
/* Free all structures */
iio_device_free(indio_dev);
-
-error_ret:
- return ret;
}
/**
diff --git a/drivers/staging/iio/iio_simple_dummy_events.c b/drivers/staging/iio/iio_simple_dummy_events.c
index c32ef78..ecc563c 100644
--- a/drivers/staging/iio/iio_simple_dummy_events.c
+++ b/drivers/staging/iio/iio_simple_dummy_events.c
@@ -257,13 +257,11 @@ error_ret:
* iio_simple_dummy_events_unregister() - tidy up interrupt handling on remove
* @indio_dev: device instance data
*/
-int iio_simple_dummy_events_unregister(struct iio_dev *indio_dev)
+void iio_simple_dummy_events_unregister(struct iio_dev *indio_dev)
{
struct iio_dummy_state *st = iio_priv(indio_dev);
free_irq(st->event_irq, indio_dev);
/* Not part of normal driver */
iio_dummy_evgen_release_irq(st->event_irq);
-
- return 0;
}
--
2.4.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 3/3] staging: iio_simple_dummy: fix module_param type
2015-05-29 21:45 [PATCH v2 0/3] staging: iio_simple_dummy: minor driver fixes Vladimirs Ambrosovs
2015-05-29 21:45 ` [PATCH v2 1/3] staging: iio_simple_dummy: fix init function Vladimirs Ambrosovs
2015-05-29 21:45 ` [PATCH v2 2/3] staging: iio_simple_dummy: fix return types Vladimirs Ambrosovs
@ 2015-05-29 21:45 ` Vladimirs Ambrosovs
2015-05-30 5:03 ` [PATCH v2 0/3] staging: iio_simple_dummy: minor driver fixes Dan Carpenter
3 siblings, 0 replies; 7+ messages in thread
From: Vladimirs Ambrosovs @ 2015-05-29 21:45 UTC (permalink / raw)
To: jic23, daniel.baluta, dan.carpenter, gregkh
Cc: cristina.opriceana, driverdev-devel, linux-iio,
Vladimirs Ambrosovs
Fix the module_param "instances" type to uint, since the variable type
holding the value is unsigned.
Signed-off-by: Vladimirs Ambrosovs <rodriguez.twister@gmail.com>
---
drivers/staging/iio/iio_simple_dummy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/iio/iio_simple_dummy.c b/drivers/staging/iio/iio_simple_dummy.c
index dc9482c7..1629a8a 100644
--- a/drivers/staging/iio/iio_simple_dummy.c
+++ b/drivers/staging/iio/iio_simple_dummy.c
@@ -30,7 +30,7 @@
* dummy devices are registered.
*/
static unsigned instances = 1;
-module_param(instances, int, 0);
+module_param(instances, uint, 0);
/* Pointer array used to fake bus elements */
static struct iio_dev **iio_dummy_devs;
--
2.4.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/3] staging: iio_simple_dummy: minor driver fixes
2015-05-29 21:45 [PATCH v2 0/3] staging: iio_simple_dummy: minor driver fixes Vladimirs Ambrosovs
` (2 preceding siblings ...)
2015-05-29 21:45 ` [PATCH v2 3/3] staging: iio_simple_dummy: fix module_param type Vladimirs Ambrosovs
@ 2015-05-30 5:03 ` Dan Carpenter
3 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2015-05-30 5:03 UTC (permalink / raw)
To: Vladimirs Ambrosovs
Cc: jic23, daniel.baluta, gregkh, cristina.opriceana, linux-iio,
driverdev-devel
Looks nice. :)
regards,
dan carpenter
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/3] staging: iio_simple_dummy: fix return types
2015-05-29 21:45 ` [PATCH v2 2/3] staging: iio_simple_dummy: fix return types Vladimirs Ambrosovs
@ 2015-05-30 6:54 ` Sudip Mukherjee
2015-05-30 7:07 ` Vladimirs Ambrosovs
0 siblings, 1 reply; 7+ messages in thread
From: Sudip Mukherjee @ 2015-05-30 6:54 UTC (permalink / raw)
To: Vladimirs Ambrosovs
Cc: jic23, daniel.baluta, dan.carpenter, gregkh, cristina.opriceana,
linux-iio, driverdev-devel
On Sat, May 30, 2015 at 12:45:22AM +0300, Vladimirs Ambrosovs wrote:
> The functions iio_dummy_remove(), iio_simple_dummy_events_unregister() and
> iio_dummy_evgen_release_irq() were changed to return void instead of int,
> because these functions always return 0.
>
> Signed-off-by: Vladimirs Ambrosovs <rodriguez.twister@gmail.com>
oops. it breaks the build.
drivers/staging/iio/iio_simple_dummy_events.c:260:6: error: conflicting types for ‘iio_simple_dummy_events_unregister’
In file included from drivers/staging/iio/iio_simple_dummy_events.c:18:0:
drivers/staging/iio/iio_simple_dummy.h:82:5: note: previous declaration of ‘iio_simple_dummy_events_unregister’ was here
drivers/staging/iio/iio_dummy_evgen.c:131:6: error: conflicting types for ‘iio_dummy_evgen_release_irq’
In file included from drivers/staging/iio/iio_dummy_evgen.c:24:0:
drivers/staging/iio/iio_dummy_evgen.h:11:5: note: previous declaration of ‘iio_dummy_evgen_release_irq’ was here
drivers/staging/iio/iio_dummy_evgen.c:137:1: error: conflicting types for ‘iio_dummy_evgen_release_irq’
In file included from drivers/staging/iio/iio_dummy_evgen.c:24:0:
drivers/staging/iio/iio_dummy_evgen.h:11:5: note: previous declaration of ‘iio_dummy_evgen_release_irq’ was here
regards
sudip
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/3] staging: iio_simple_dummy: fix return types
2015-05-30 6:54 ` Sudip Mukherjee
@ 2015-05-30 7:07 ` Vladimirs Ambrosovs
0 siblings, 0 replies; 7+ messages in thread
From: Vladimirs Ambrosovs @ 2015-05-30 7:07 UTC (permalink / raw)
To: Sudip Mukherjee
Cc: jic23, daniel.baluta, dan.carpenter, gregkh, cristina.opriceana,
linux-iio, driverdev-devel
On Sat, May 30, 2015 at 12:24:42PM +0530, Sudip Mukherjee wrote:
> On Sat, May 30, 2015 at 12:45:22AM +0300, Vladimirs Ambrosovs wrote:
> > The functions iio_dummy_remove(), iio_simple_dummy_events_unregister() and
> > iio_dummy_evgen_release_irq() were changed to return void instead of int,
> > because these functions always return 0.
> >
> > Signed-off-by: Vladimirs Ambrosovs <rodriguez.twister@gmail.com>
> oops. it breaks the build.
>
> drivers/staging/iio/iio_simple_dummy_events.c:260:6: error: conflicting types for ‘iio_simple_dummy_events_unregister’
> In file included from drivers/staging/iio/iio_simple_dummy_events.c:18:0:
> drivers/staging/iio/iio_simple_dummy.h:82:5: note: previous declaration of ‘iio_simple_dummy_events_unregister’ was here
>
> drivers/staging/iio/iio_dummy_evgen.c:131:6: error: conflicting types for ‘iio_dummy_evgen_release_irq’
> In file included from drivers/staging/iio/iio_dummy_evgen.c:24:0:
> drivers/staging/iio/iio_dummy_evgen.h:11:5: note: previous declaration of ‘iio_dummy_evgen_release_irq’ was here
>
> drivers/staging/iio/iio_dummy_evgen.c:137:1: error: conflicting types for ‘iio_dummy_evgen_release_irq’
> In file included from drivers/staging/iio/iio_dummy_evgen.c:24:0:
> drivers/staging/iio/iio_dummy_evgen.h:11:5: note: previous declaration of ‘iio_dummy_evgen_release_irq’ was here
>
> regards
> sudip
Oops, that's embarassing... Sure, I did check it..
Thanks Sudip, will fix it.
BR,
Vladimirs
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-05-30 7:07 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-29 21:45 [PATCH v2 0/3] staging: iio_simple_dummy: minor driver fixes Vladimirs Ambrosovs
2015-05-29 21:45 ` [PATCH v2 1/3] staging: iio_simple_dummy: fix init function Vladimirs Ambrosovs
2015-05-29 21:45 ` [PATCH v2 2/3] staging: iio_simple_dummy: fix return types Vladimirs Ambrosovs
2015-05-30 6:54 ` Sudip Mukherjee
2015-05-30 7:07 ` Vladimirs Ambrosovs
2015-05-29 21:45 ` [PATCH v2 3/3] staging: iio_simple_dummy: fix module_param type Vladimirs Ambrosovs
2015-05-30 5:03 ` [PATCH v2 0/3] staging: iio_simple_dummy: minor driver fixes Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).