From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751828AbdAYKGi (ORCPT ); Wed, 25 Jan 2017 05:06:38 -0500 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:59598 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751577AbdAYKGg (ORCPT ); Wed, 25 Jan 2017 05:06:36 -0500 Authentication-Results: ppops.net; spf=none smtp.mailfrom=ckeepax@opensource.wolfsonmicro.com Date: Wed, 25 Jan 2017 10:07:32 +0000 From: Charles Keepax To: Chanwoo Choi CC: , , Subject: Re: [PATCH v2] extcon: arizona: Wait for any running HPDETs to complete on jack removal Message-ID: <20170125100732.GD1754@localhost.localdomain> References: <1485336846-6440-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> <58887456.1060904@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <58887456.1060904@samsung.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1701250097 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > --- > > +#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