All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacek Anaszewski <j.anaszewski@samsung.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Jacek Anaszewski <j.anaszewski@samsung.com>,
	linux-iio@vger.kernel.org,
	Kyungmin Park <kyungmin.park@samsung.com>,
	s.nawrocki@samsung.com
Subject: Re: [PATCH/RFC v4 0/3] gp2ap020a00f ambient light/proximity sensor
Date: Tue, 20 Aug 2013 16:52:07 +0200	[thread overview]
Message-ID: <52138297.9020908@samsung.com> (raw)
In-Reply-To: <52126D3B.4010401@kernel.org>

On 08/19/2013 09:08 PM, Jonathan Cameron wrote:

>>>>     - I am still encountering "module in use" message when I am trying
>>>>       to execute rmmod on a driver module after generic_buffer application
>>>>       has been launched at least once. This is not specific only to my
>>>>       implementation but also for lps331ap driver (the only one of the
>>>>       remaining IIO drivers supporting triggers I am able to test
>>>>       currently).
>>> Umm.. I'm unsure, but it 'might' be something to do with the interrupt issues
>>> that are firing the above warning (though I doubt it as the lps331ap isn't
>>> suffering from that bug - as it currently stands in tree).
>>> Check that all the sysfs entries are as one would expect (no trigger attached
>>> or buffered enabled etc).  Might be a bug in generic_buffer but I haven't
>>> personally seen it do this.
>>
>> Fixing the warning didn't fix this problem. I've checked sysfs entries
>> - the buffer is not enabled, no trigger is attached. I don't know if
>> this is correct, but when I build build my driver as a module I get
>> also the module industrialio-triggered-buffer.ko built, which has to
>> be loaded prior to the driver module.
> That provides the triggered_buffer utility functions. When those are used
> it needs to be there.
>
> Unfortunately this isn't something I can chase down without the hardware.
> It works fine in the iio_dummy driver.  Could you perhaps just build that
> and check that works fine with a sysfs-trigger?  Would act to indicate
> if there is something causing the issue in this driver that we haven't spotted
> or something nasty is going on in the core.

I've managed to discover what is going on. The bad symptom is in the
information returned by lsmod. Before launching generic_buffer
application the "Used by" column for the driver module is 0.
After the application finishes it is 0x7fffffff.
I figured out that the problem is in the function
iio_trigger_write_current (industrialio-trigger.c:371).

If I comment lines:

if (oldtrig && indio_dev->trig != oldtrig)
	iio_trigger_put(oldtrig);

the issue ceases to appear. It seems that module_put is called too many
times.

Thanks,
Jacek

  reply	other threads:[~2013-08-20 14:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-16 13:11 [PATCH/RFC v4 0/3] gp2ap020a00f ambient light/proximity sensor Jacek Anaszewski
2013-08-18 11:19 ` Jonathan Cameron
2013-08-19 14:50   ` Jacek Anaszewski
2013-08-19 19:08     ` Jonathan Cameron
2013-08-20 14:52       ` Jacek Anaszewski [this message]
2013-08-20 16:09         ` Jonathan Cameron
2013-08-20 17:18         ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52138297.9020908@samsung.com \
    --to=j.anaszewski@samsung.com \
    --cc=jic23@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=s.nawrocki@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.