lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <208699ad-1302-aac1-c2e7-4f469e39a7eb@microchip.com>
Date:   Mon, 27 Apr 2020 12:20:14 +0000
From:   <Eugen.Hristev@...rochip.com>
To:     <alexandru.Ardelean@...log.com>, <jic23@...nel.org>
CC:     <Ludovic.Desroches@...rochip.com>, <linux-kernel@...r.kernel.org>,
        <linux-iio@...r.kernel.org>
Subject: Re: [PATCH v2 1/2] iio: at91-sama5d2_adc: split
 at91_adc_current_chan_is_touch() helper

On 15.04.2020 09:33, Ardelean, Alexandru wrote:

> On Tue, 2020-04-14 at 18:45 +0100, Jonathan Cameron wrote:
>> On Tue, 14 Apr 2020 12:22:45 +0000
>> <Eugen.Hristev@...rochip.com> wrote:
>>
>>> On 13.04.2020 20:05, Jonathan Cameron wrote:
>>>> On Wed, 4 Mar 2020 10:42:18 +0200
>>>> Alexandru Ardelean <alexandru.ardelean@...log.com> wrote:
>>>>
>>>>> This change moves the logic to check if the current channel is the
>>>>> touchscreen channel to a separate helper.
>>>>> This reduces some code duplication, but the main intent is to re-use
>>>>> this
>>>>> in the next patches.
>>>>>
>>>>> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@...log.com>
>>>> Eugen / Ludovic,
>>>>
>>>> Have you had a chance to look at this series?
>>>
>>> Hi Jonathan,
>>>
>>> Does the patch apply correctly for you ?
>>
>> I haven't tried yet :)
>>
> 
> I've rebased this patchset on top of current iio/testing and it still applies.
> 

Hi Alex,

I tried this patch on top of my tree (however I am testing with an older 
kernel 5.4) , and I have issues starting the buffer after you moved my 
code to the preenable callback.

Namely, on the line:

if (!(indio_dev->currentmode & INDIO_ALL_TRIGGERED_MODES))
                return -EINVAL;

And with this , the preenable fails on my side, because the current mode 
is not yet switched to triggered.

I do remember adding this line with a specific reason. It may be related 
to touchscreen operations, but I have to retest the touch with and 
without this line and your patch.

Meanwhile, maybe you have any suggestions on how to fix the buffer ? 
This check here makes any sense to you ?

Thanks,
Eugen

> 
>>> I will try to test it , if I manage to apply it.
>>> I can only test the ADC though because at this moment I do not have a
>>> touchscreen at disposal.
>>>
>>> Meanwhile, the code looks good for me,
>>>
>>> Reviewed-by: Eugen Hristev <eugen.hristev@...rochip.com>
>>>
>>> By the way, I do not know if my two pending patches on this driver will
>>> conflict or not.
>>
>> As this is a long term rework patch at heart, there isn't any particular
>> rush as long as we don't loose it forever!
>>
>> Thanks,
>>
>> Jonathan
>>
>>> Eugen
>>>
>>>> Thanks,
>>>>
>>>> Jonathan
>>>>
>>>>> ---
>>>>>
>>>>> This patchset continues discussion:
>>>>>
>>>>> https://urldefense.com/v3/__https://lore.kernel.org/linux-iio/20191023082508.17583-1-alexandru.ardelean@analog.com/__;!!A3Ni8CS0y2Y!ql1bYiNMPFlz1twnCCAQpiEBvpzxR_VHAPL712rWFfwy2TSKjZ2UhGBoV7-29Syny6z0yg$
>>>>>
>>>>> Apologies for the delay.
>>>>>
>>>>> Changelog v1 -> v2:
>>>>> * added patch 'iio: at91-sama5d2_adc: split
>>>>> at91_adc_current_chan_is_touch()
>>>>>     helper'
>>>>> * renamed at91_adc_buffer_postenable() -> at91_adc_buffer_preenable()
>>>>>     - at91_adc_buffer_postenable() - now just calls
>>>>>       iio_triggered_buffer_postenable() if the channel isn't the
>>>>> touchscreen
>>>>>       channel
>>>>> * renamed at91_adc_buffer_predisable() -> at91_adc_buffer_postdisable()
>>>>>     - at91_adc_buffer_predisable() - now just calls
>>>>>       iio_triggered_buffer_predisable() if the channel isn't the
>>>>> touchscreen
>>>>>       channel
>>>>>
>>>>>    drivers/iio/adc/at91-sama5d2_adc.c | 31 +++++++++++++++---------------
>>>>>    1 file changed, 15 insertions(+), 16 deletions(-)
>>>>>
>>>>> diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-
>>>>> sama5d2_adc.c
>>>>> index a5c7771227d5..f2a74c47c768 100644
>>>>> --- a/drivers/iio/adc/at91-sama5d2_adc.c
>>>>> +++ b/drivers/iio/adc/at91-sama5d2_adc.c
>>>>> @@ -873,18 +873,24 @@ static int at91_adc_dma_start(struct iio_dev
>>>>> *indio_dev)
>>>>>         return 0;
>>>>>    }
>>>>>
>>>>> +static bool at91_adc_current_chan_is_touch(struct iio_dev *indio_dev)
>>>>> +{
>>>>> +     struct at91_adc_state *st = iio_priv(indio_dev);
>>>>> +
>>>>> +     return !!bitmap_subset(indio_dev->active_scan_mask,
>>>>> +                            &st->touch_st.channels_bitmask,
>>>>> +                            AT91_SAMA5D2_MAX_CHAN_IDX + 1);
>>>>> +}
>>>>> +
>>>>>    static int at91_adc_buffer_postenable(struct iio_dev *indio_dev)
>>>>>    {
>>>>>         int ret;
>>>>>         struct at91_adc_state *st = iio_priv(indio_dev);
>>>>>
>>>>>         /* check if we are enabling triggered buffer or the touchscreen
>>>>> */
>>>>> -     if (bitmap_subset(indio_dev->active_scan_mask,
>>>>> -                       &st->touch_st.channels_bitmask,
>>>>> -                       AT91_SAMA5D2_MAX_CHAN_IDX + 1)) {
>>>>> -             /* touchscreen enabling */
>>>>> +     if (at91_adc_current_chan_is_touch(indio_dev))
>>>>>                 return at91_adc_configure_touch(st, true);
>>>>> -     }
>>>>> +
>>>>>         /* if we are not in triggered mode, we cannot enable the buffer.
>>>>> */
>>>>>         if (!(indio_dev->currentmode & INDIO_ALL_TRIGGERED_MODES))
>>>>>                 return -EINVAL;
>>>>> @@ -906,12 +912,9 @@ static int at91_adc_buffer_predisable(struct
>>>>> iio_dev *indio_dev)
>>>>>         u8 bit;
>>>>>
>>>>>         /* check if we are disabling triggered buffer or the touchscreen
>>>>> */
>>>>> -     if (bitmap_subset(indio_dev->active_scan_mask,
>>>>> -                       &st->touch_st.channels_bitmask,
>>>>> -                       AT91_SAMA5D2_MAX_CHAN_IDX + 1)) {
>>>>> -             /* touchscreen disable */
>>>>> +     if (at91_adc_current_chan_is_touch(indio_dev))
>>>>>                 return at91_adc_configure_touch(st, false);
>>>>> -     }
>>>>> +
>>>>>         /* if we are not in triggered mode, nothing to do here */
>>>>>         if (!(indio_dev->currentmode & INDIO_ALL_TRIGGERED_MODES))
>>>>>                 return -EINVAL;
>>>>> @@ -1886,14 +1889,10 @@ static __maybe_unused int at91_adc_resume(struct
>>>>> device *dev)
>>>>>                 return 0;
>>>>>
>>>>>         /* check if we are enabling triggered buffer or the touchscreen
>>>>> */
>>>>> -     if (bitmap_subset(indio_dev->active_scan_mask,
>>>>> -                       &st->touch_st.channels_bitmask,
>>>>> -                       AT91_SAMA5D2_MAX_CHAN_IDX + 1)) {
>>>>> -             /* touchscreen enabling */
>>>>> +     if (at91_adc_current_chan_is_touch(indio_dev))
>>>>>                 return at91_adc_configure_touch(st, true);
>>>>> -     } else {
>>>>> +     else
>>>>>                 return at91_adc_configure_trigger(st->trig, true);
>>>>> -     }
>>>>>
>>>>>         /* not needed but more explicit */
>>>>>         return 0;
>>>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ