linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] staging:iio: misc fixes
@ 2011-10-24  9:43 Jonathan Cameron
  2011-10-24  9:43 ` [PATCH 1/6] staging:iio:light:tsl2563 both intensity channels have same chan_spec Jonathan Cameron
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Jonathan Cameron @ 2011-10-24  9:43 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron

Hi All,

I've just gathered up the fixes sitting in my various trees
ready to send on.  I have lost track of whether all of these
have previously been posted for review so this is to make
sure they all have.  They are all in the github master branch.

I'd like to push these out before the larger changes that
Lars-Peter and I made at the end of last week.

Thanks,

Jonathan

Jonathan Cameron (5):
  staging:iio:light:tsl2563 both intensity channels have same
    chan_spec.
  staging:iio:triggers Remove unecessary existence checks and return
    val
  staging:iio:industrialio-trigger.c Trivial code style brackets fix
  staging:iio:kfifo remove entirely pointless code.
  staging:iio: trigger fixes for repeat request of same trigger and
    allocation failure

Maxin B. John (1):
  staging:iio:light:tsl2563 missing setting of id in get id function.

 drivers/staging/iio/iio_core_trigger.h     |    3 +-
 drivers/staging/iio/industrialio-trigger.c |   34 ++++++++++++++-------------
 drivers/staging/iio/kfifo_buf.c            |    9 +------
 drivers/staging/iio/light/tsl2563.c        |    4 ++-
 4 files changed, 23 insertions(+), 27 deletions(-)

-- 
1.7.7

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

* [PATCH 1/6] staging:iio:light:tsl2563 both intensity channels have same chan_spec.
  2011-10-24  9:43 [PATCH 0/6] staging:iio: misc fixes Jonathan Cameron
@ 2011-10-24  9:43 ` Jonathan Cameron
  2011-10-24  9:43 ` [PATCH 2/6] staging:iio:light:tsl2563 missing setting of id in get id function Jonathan Cameron
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2011-10-24  9:43 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron

Bug has been fixed for some time in the outofstaging tree, but
didn't propogate back to here.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
 drivers/staging/iio/light/tsl2563.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2563.c b/drivers/staging/iio/light/tsl2563.c
index 7e984bc..be99925 100644
--- a/drivers/staging/iio/light/tsl2563.c
+++ b/drivers/staging/iio/light/tsl2563.c
@@ -544,7 +544,7 @@ static const struct iio_chan_spec tsl2563_channels[] = {
 	}, {
 		.type = IIO_INTENSITY,
 		.modified = 1,
-		.channel2 = IIO_MOD_LIGHT_BOTH,
+		.channel2 = IIO_MOD_LIGHT_IR,
 		.info_mask = (1 << IIO_CHAN_INFO_CALIBSCALE_SEPARATE),
 	}
 };
-- 
1.7.7


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

* [PATCH 2/6] staging:iio:light:tsl2563 missing setting of id in get id function.
  2011-10-24  9:43 [PATCH 0/6] staging:iio: misc fixes Jonathan Cameron
  2011-10-24  9:43 ` [PATCH 1/6] staging:iio:light:tsl2563 both intensity channels have same chan_spec Jonathan Cameron
@ 2011-10-24  9:43 ` Jonathan Cameron
  2011-10-24  9:43 ` [PATCH 3/6] staging:iio:triggers Remove unecessary existence checks and return val Jonathan Cameron
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2011-10-24  9:43 UTC (permalink / raw)
  To: linux-iio; +Cc: Maxin B. John, Jonathan Cameron

From: "Maxin B. John" <maxin.john@gmail.com>

Signed-off-by: Maxin B. John <maxin.john@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
 drivers/staging/iio/light/tsl2563.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2563.c b/drivers/staging/iio/light/tsl2563.c
index be99925..6a17945 100644
--- a/drivers/staging/iio/light/tsl2563.c
+++ b/drivers/staging/iio/light/tsl2563.c
@@ -226,6 +226,8 @@ static int tsl2563_read_id(struct tsl2563_chip *chip, u8 *id)
 	if (ret < 0)
 		return ret;
 
+	*id = ret;
+
 	return 0;
 }
 
-- 
1.7.7

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

* [PATCH 3/6] staging:iio:triggers Remove unecessary existence checks and return val
  2011-10-24  9:43 [PATCH 0/6] staging:iio: misc fixes Jonathan Cameron
  2011-10-24  9:43 ` [PATCH 1/6] staging:iio:light:tsl2563 both intensity channels have same chan_spec Jonathan Cameron
  2011-10-24  9:43 ` [PATCH 2/6] staging:iio:light:tsl2563 missing setting of id in get id function Jonathan Cameron
@ 2011-10-24  9:43 ` Jonathan Cameron
  2011-10-24  9:43 ` [PATCH 4/6] staging:iio:industrialio-trigger.c Trivial code style brackets fix Jonathan Cameron
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2011-10-24  9:43 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron

Postenable and predisable are called via buffer->ops so  don't
need to check if buffer exists.

The return value of iio_device_register_trigger_consumer is
always zero and it isn't checked anyway so get rid of it.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
 drivers/staging/iio/iio_core_trigger.h     |    3 +--
 drivers/staging/iio/industrialio-trigger.c |   16 +++++-----------
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/iio/iio_core_trigger.h b/drivers/staging/iio/iio_core_trigger.h
index 523c288..6f7c56f 100644
--- a/drivers/staging/iio/iio_core_trigger.h
+++ b/drivers/staging/iio/iio_core_trigger.h
@@ -13,8 +13,7 @@
  * iio_device_register_trigger_consumer() - set up an iio_dev to use triggers
  * @indio_dev: iio_dev associated with the device that will consume the trigger
  **/
-
-int iio_device_register_trigger_consumer(struct iio_dev *indio_dev);
+void iio_device_register_trigger_consumer(struct iio_dev *indio_dev);
 
 /**
  * iio_device_unregister_trigger_consumer() - reverse the registration process
diff --git a/drivers/staging/iio/industrialio-trigger.c b/drivers/staging/iio/industrialio-trigger.c
index 2c626e0..ca4124a 100644
--- a/drivers/staging/iio/industrialio-trigger.c
+++ b/drivers/staging/iio/industrialio-trigger.c
@@ -473,12 +473,10 @@ void iio_free_trigger(struct iio_trigger *trig)
 }
 EXPORT_SYMBOL(iio_free_trigger);
 
-int iio_device_register_trigger_consumer(struct iio_dev *indio_dev)
+void iio_device_register_trigger_consumer(struct iio_dev *indio_dev)
 {
 	indio_dev->groups[indio_dev->groupcounter++] =
 		&iio_trigger_consumer_attr_group;
-
-	return 0;
 }
 
 void iio_device_unregister_trigger_consumer(struct iio_dev *indio_dev)
@@ -490,18 +488,14 @@ void iio_device_unregister_trigger_consumer(struct iio_dev *indio_dev)
 
 int iio_triggered_buffer_postenable(struct iio_dev *indio_dev)
 {
-	return indio_dev->trig
-		? iio_trigger_attach_poll_func(indio_dev->trig,
-					       indio_dev->pollfunc)
-		: 0;
+	return iio_trigger_attach_poll_func(indio_dev->trig,
+					    indio_dev->pollfunc);
 }
 EXPORT_SYMBOL(iio_triggered_buffer_postenable);
 
 int iio_triggered_buffer_predisable(struct iio_dev *indio_dev)
 {
-	return indio_dev->trig
-		? iio_trigger_dettach_poll_func(indio_dev->trig,
-						indio_dev->pollfunc)
-		: 0;
+	return iio_trigger_dettach_poll_func(indio_dev->trig,
+					     indio_dev->pollfunc);
 }
 EXPORT_SYMBOL(iio_triggered_buffer_predisable);
-- 
1.7.7

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

* [PATCH 4/6] staging:iio:industrialio-trigger.c Trivial code style brackets fix
  2011-10-24  9:43 [PATCH 0/6] staging:iio: misc fixes Jonathan Cameron
                   ` (2 preceding siblings ...)
  2011-10-24  9:43 ` [PATCH 3/6] staging:iio:triggers Remove unecessary existence checks and return val Jonathan Cameron
@ 2011-10-24  9:43 ` Jonathan Cameron
  2011-10-24  9:43 ` [PATCH 5/6] staging:iio:kfifo remove entirely pointless code Jonathan Cameron
  2011-10-24  9:43 ` [PATCH 6/6] staging:iio: trigger fixes for repeat request of same trigger and allocation failure Jonathan Cameron
  5 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2011-10-24  9:43 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
 drivers/staging/iio/industrialio-trigger.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/iio/industrialio-trigger.c b/drivers/staging/iio/industrialio-trigger.c
index ca4124a..9412013 100644
--- a/drivers/staging/iio/industrialio-trigger.c
+++ b/drivers/staging/iio/industrialio-trigger.c
@@ -159,13 +159,12 @@ EXPORT_SYMBOL(iio_trigger_generic_data_rdy_poll);
 void iio_trigger_poll_chained(struct iio_trigger *trig, s64 time)
 {
 	int i;
-	if (!trig->use_count) {
+	if (!trig->use_count)
 		for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++)
 			if (trig->subirqs[i].enabled) {
 				trig->use_count++;
 				handle_nested_irq(trig->subirq_base + i);
 			}
-	}
 }
 EXPORT_SYMBOL(iio_trigger_poll_chained);
 
@@ -173,10 +172,9 @@ void iio_trigger_notify_done(struct iio_trigger *trig)
 {
 	trig->use_count--;
 	if (trig->use_count == 0 && trig->ops && trig->ops->try_reenable)
-		if (trig->ops->try_reenable(trig)) {
+		if (trig->ops->try_reenable(trig))
 			/* Missed and interrupt so launch new poll now */
 			iio_trigger_poll(trig, 0);
-		}
 }
 EXPORT_SYMBOL(iio_trigger_notify_done);
 
-- 
1.7.7


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

* [PATCH 5/6] staging:iio:kfifo remove entirely pointless code.
  2011-10-24  9:43 [PATCH 0/6] staging:iio: misc fixes Jonathan Cameron
                   ` (3 preceding siblings ...)
  2011-10-24  9:43 ` [PATCH 4/6] staging:iio:industrialio-trigger.c Trivial code style brackets fix Jonathan Cameron
@ 2011-10-24  9:43 ` Jonathan Cameron
  2011-10-24  9:43 ` [PATCH 6/6] staging:iio: trigger fixes for repeat request of same trigger and allocation failure Jonathan Cameron
  5 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2011-10-24  9:43 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron

I really don't want to think about how this bit got
in there.  It allocates some storage - copies something
into it then frees it without making use of it.
Oops.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
 drivers/staging/iio/kfifo_buf.c |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/iio/kfifo_buf.c b/drivers/staging/iio/kfifo_buf.c
index e8c234b..fd98a0e 100644
--- a/drivers/staging/iio/kfifo_buf.c
+++ b/drivers/staging/iio/kfifo_buf.c
@@ -150,16 +150,9 @@ static int iio_store_to_kfifo(struct iio_buffer *r,
 {
 	int ret;
 	struct iio_kfifo *kf = iio_to_kfifo(r);
-	u8 *datal = kmalloc(r->bytes_per_datum, GFP_KERNEL);
-	memcpy(datal, data, r->bytes_per_datum - sizeof(timestamp));
-	memcpy(datal + r->bytes_per_datum - sizeof(timestamp),
-		&timestamp, sizeof(timestamp));
 	ret = kfifo_in(&kf->kf, data, r->bytes_per_datum);
-	if (ret != r->bytes_per_datum) {
-		kfree(datal);
+	if (ret != r->bytes_per_datum)
 		return -EBUSY;
-	}
-	kfree(datal);
 	return 0;
 }
 
-- 
1.7.7


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

* [PATCH 6/6] staging:iio: trigger fixes for repeat request of same trigger and allocation failure
  2011-10-24  9:43 [PATCH 0/6] staging:iio: misc fixes Jonathan Cameron
                   ` (4 preceding siblings ...)
  2011-10-24  9:43 ` [PATCH 5/6] staging:iio:kfifo remove entirely pointless code Jonathan Cameron
@ 2011-10-24  9:43 ` Jonathan Cameron
  5 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2011-10-24  9:43 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron

Both of these are decidedly silly bugs show up whilst testing
completely different code paths.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
 drivers/staging/iio/industrialio-trigger.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/iio/industrialio-trigger.c b/drivers/staging/iio/industrialio-trigger.c
index 9412013..20dc8e8 100644
--- a/drivers/staging/iio/industrialio-trigger.c
+++ b/drivers/staging/iio/industrialio-trigger.c
@@ -220,8 +220,16 @@ static int iio_trigger_attach_poll_func(struct iio_trigger *trig,
 	ret = request_threaded_irq(pf->irq, pf->h, pf->thread,
 				   pf->type, pf->name,
 				   pf);
-	if (trig->ops && trig->ops->set_trigger_state && notinuse)
+	if (ret < 0) {
+		module_put(pf->indio_dev->info->driver_module);
+		return ret;
+	}
+
+	if (trig->ops && trig->ops->set_trigger_state && notinuse) {
 		ret = trig->ops->set_trigger_state(trig, true);
+		if (ret < 0)
+			module_put(pf->indio_dev->info->driver_module);
+	}
 
 	return ret;
 }
@@ -334,6 +342,8 @@ static ssize_t iio_trigger_write_current(struct device *dev,
 	mutex_unlock(&indio_dev->mlock);
 
 	trig = iio_trigger_find_by_name(buf, len);
+	if (oldtrig == trig)
+		return len;
 
 	if (trig && indio_dev->info->validate_trigger) {
 		ret = indio_dev->info->validate_trigger(indio_dev, trig);
-- 
1.7.7

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

end of thread, other threads:[~2011-10-24  9:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-24  9:43 [PATCH 0/6] staging:iio: misc fixes Jonathan Cameron
2011-10-24  9:43 ` [PATCH 1/6] staging:iio:light:tsl2563 both intensity channels have same chan_spec Jonathan Cameron
2011-10-24  9:43 ` [PATCH 2/6] staging:iio:light:tsl2563 missing setting of id in get id function Jonathan Cameron
2011-10-24  9:43 ` [PATCH 3/6] staging:iio:triggers Remove unecessary existence checks and return val Jonathan Cameron
2011-10-24  9:43 ` [PATCH 4/6] staging:iio:industrialio-trigger.c Trivial code style brackets fix Jonathan Cameron
2011-10-24  9:43 ` [PATCH 5/6] staging:iio:kfifo remove entirely pointless code Jonathan Cameron
2011-10-24  9:43 ` [PATCH 6/6] staging:iio: trigger fixes for repeat request of same trigger and allocation failure Jonathan Cameron

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).