Re: [PATCH v2] extcon: arizona: Wait for any running HPDETs to complete on jack removal

From: Charles Keepax
Date: Wed Jan 25 2017 - 05:06:41 EST


On Wed, Jan 25, 2017 at 06:48:06PM +0900, Chanwoo Choi wrote:
> Hi,
>
> I modified some minor issue and added my comment on below.
> After modified them by myself, Applied it.
>
> On 2017ë 01ì 25ì 18:34, Charles Keepax wrote:
> > As the HPDET can't be aborted mid way through we should not allow any new
> > insertion to be processed until the previous HPDET has finished. It is very
> > unlikely but with low enough debounce settings you could start a new HPDET
> > before the old one has completed, which results in an erroneous reading.
> >
> > Signed-off-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
> > ---
> > +#define ARIZONA_HPDET_WAIT_COUNT 15
> > +#define ARIZONA_HPDET_WAIT_DELAY_MS 20
>
> Move these definitions on the top.
>

You can make this change if it is your preference, but generally
I feel this makes the code less clear. Previously you could
look at this bit of the code locally and clearly see what was
happening now the reader will need to spin all the way up to the
top of the file probably twice.

> > +
> > +static int arizona_hpdet_wait(struct arizona_extcon_info *info)
> > +{
> > + struct arizona *arizona = info->arizona;
> > + unsigned int val;
> > + int i, ret;
> > +
> > + for (i = 0; i < ARIZONA_HPDET_WAIT_COUNT; i++) {
> > + ret = regmap_read(arizona->regmap, ARIZONA_HEADPHONE_DETECT_2,
> > + &val);
>
> Remove the space indentation. I prefer to use only tab indentation.
>

Again I don't mind, but my understanding was this was the
preferred style in the kernel and checkpatch --strict will warn
if you remove the spaces. It does also match the style of the
rest of the file itself.

Thanks,
Charles