Jacek Anaszewski <j.anaszewski@xxxxxxxxxxx> wrote: >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. Will look into this... > >Thanks, >Jacek > > >-- >To unsubscribe from this list: send the line "unsubscribe linux-iio" in >the body of a message to majordomo@xxxxxxxxxxxxxxx >More majordomo info at http://vger.kernel.org/majordomo-info.html -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html