iio:accel:bmc150-accel: fix counting direction

In bmc150_accel_unregister_triggers() triggers should be unregistered in
reverse order of registration. Trigger registration starts with number 0,
counting up. In consequence, trigger number needs to be count down here.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Reviewed-by: Octavian Purdila <octavian.purdila@intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
Hartmut Knaack 2015-06-15 23:48:24 +02:00 committed by Jonathan Cameron
parent c288503b32
commit 7a1d0d91c9

View File

@ -1465,7 +1465,7 @@ static void bmc150_accel_unregister_triggers(struct bmc150_accel_data *data,
{ {
int i; int i;
for (i = from; i >= 0; i++) { for (i = from; i >= 0; i--) {
if (data->triggers[i].indio_trig) { if (data->triggers[i].indio_trig) {
iio_trigger_unregister(data->triggers[i].indio_trig); iio_trigger_unregister(data->triggers[i].indio_trig);
data->triggers[i].indio_trig = NULL; data->triggers[i].indio_trig = NULL;