Re: ADC device not allowed multiple opens

2018-06-06 Thread will sanfilippo
Thanks for all the input. I will look at the adc driver in a bit more detail to see which option is best. My original thought was to do what you had done Andrzej: if the device is already opened, just return OK. But I will look at the various locks and such to determine if there will be issues

Re: ADC device not allowed multiple opens

2018-06-06 Thread Andrzej Kaczmarek
Hi, +1 for proper ref counting btw, trng_nrf52 already works this way except it does not check ref counter explicitly but OS_DEV_F_STATUS_OPEN flag instead. This is also already used in Mynewt as NimBLE host, controller and TinyCrypt can (depending on configuration) just open trng device on its

Re: ADC device not allowed multiple opens

2018-06-06 Thread will sanfilippo
Chris and Vipul: That does indeed seem to be a decent option! I will see if others chime in and if not, add that change. Thanks!!! > On Jun 6, 2018, at 1:32 PM, Vipul Rahane wrote: > > >> On Jun 6, 2018, at 1:01 PM, Christopher Collins wrote: >> >> On Wed, Jun 06, 2018 at 11:57:34AM

Re: ADC device not allowed multiple opens

2018-06-06 Thread Vipul Rahane
> On Jun 6, 2018, at 1:01 PM, Christopher Collins wrote: > > On Wed, Jun 06, 2018 at 11:57:34AM -0700, will sanfilippo wrote: >> Chris: >> >> I might be missing something here, but given that os_dev already has a >> reference count and that handles multiple folks opening/closing the device,

Re: ADC device not allowed multiple opens

2018-06-06 Thread Christopher Collins
On Wed, Jun 06, 2018 at 11:57:34AM -0700, will sanfilippo wrote: > Chris: > > I might be missing something here, but given that os_dev already has a > reference count and that handles multiple folks opening/closing the device, > does the underlying adc driver need a reference count itself? If

Re: ADC device not allowed multiple opens

2018-06-06 Thread will sanfilippo
Chris: I might be missing something here, but given that os_dev already has a reference count and that handles multiple folks opening/closing the device, does the underlying adc driver need a reference count itself? If it just returned no error if opened again this would be fine. I do note

Re: ADC device not allowed multiple opens

2018-06-06 Thread Christopher Collins
On Wed, Jun 06, 2018 at 08:50:34AM -0700, will sanfilippo wrote: > Hello: > > I am not the most familiar with the ADC device so it is possible that it was > being used incorrectly but in any event I ran across something I wanted to > discuss. The call to os_dev_open() allows a device to be

ADC device not allowed multiple opens

2018-06-06 Thread will sanfilippo
Hello: I am not the most familiar with the ADC device so it is possible that it was being used incorrectly but in any event I ran across something I wanted to discuss. The call to os_dev_open() allows a device to be opened multiple times (there is a reference count there). However, the call to