Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3424839imm; Mon, 4 Jun 2018 03:28:48 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLwE6qMINjDE6CRNKjYRrZNH8BGBMj2MQFGMKykQf8UTrSsajKcQCbnhHaeAJ5RG+fxydsT X-Received: by 2002:a17:902:b110:: with SMTP id q16-v6mr21195869plr.286.1528108128820; Mon, 04 Jun 2018 03:28:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528108128; cv=none; d=google.com; s=arc-20160816; b=qfBJVC2VXlqM0XMYtPS5YA1tWDh5jVYve3ktWmaE+haIkawPI3e4kAsb8VsgktdShJ n5wpaBX3BpAKbOVwYdWVwJppcvQeFYwK/snK6hpenrRP/IyDU1Vn3uE8agF7MjHZxdlu MvLW8bafb5GEJkiqZKHF6z4fCJrXAwHbxzoyN8g9/Zb0DEUOgt6E87O/m6o+hpD0JBkd vDAuD2KFQoDwVyONXeWwowFY74/vRKlzFjvlyeq5d20NAY0T7tGni6loyWwO+oThXJ1T h33bZlXLsJD2UeaMcrKAULOzr48yCT3l473h1S7kPAt2g7igxfJj4hCDzmbg+3xQkYL3 lTiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=mIC3oEulY95H++j+cb1917MVUOoogtktJkxf08AQRFc=; b=TIf4SSuhmrZWOCgb4233mcq+OTA2KaAJX5UkRrp2od/N7O5q/P2S6rVLVCUcJHrP5x ykpY2db4+7+rE08ftAPwgEcbbh2KGmrqt4v4RgqCvFASv50mlDl+gkc8fmXpSalRRS9t xnduBlm/IQO1gcn2bFwN7+G5IRLUJWHU2ZpMrLFCABEnt8jDmcthQKUYZ5UP7mZJ3J13 xTZpx8nTVPCX+TcLDAU2m2YKeaS7Fg+9ETFJLRoUo3kjI6irh9c2Lrgdy+ZUK9yvIoj/ uRWSQCiMbqMJujr0lFA9/jIQ3t2U5ahSV4utviJjXDwtNR6mlh/vRWpqcTNYNsGGMfoH bHaw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f9-v6si43275111plo.568.2018.06.04.03.28.34; Mon, 04 Jun 2018 03:28:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751941AbeFDK1Z (ORCPT + 99 others); Mon, 4 Jun 2018 06:27:25 -0400 Received: from mx0b-001ae601.pphosted.com ([67.231.152.168]:60446 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750868AbeFDK1Y (ORCPT ); Mon, 4 Jun 2018 06:27:24 -0400 Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w54AJI4U005276; Mon, 4 Jun 2018 05:27:20 -0500 Authentication-Results: ppops.net; spf=none smtp.mailfrom=ckeepax@opensource.cirrus.com Received: from mail1.cirrus.com (mail1.cirrus.com [141.131.3.20]) by mx0b-001ae601.pphosted.com with ESMTP id 2jbs9rtf2b-1; Mon, 04 Jun 2018 05:27:20 -0500 Received: from EX17.ad.cirrus.com (unknown [172.20.9.81]) by mail1.cirrus.com (Postfix) with ESMTP id 3826E611C8BA; Mon, 4 Jun 2018 05:27:20 -0500 (CDT) Received: from imbe.wolfsonmicro.main (198.61.95.81) by EX17.ad.cirrus.com (172.20.9.81) with Microsoft SMTP Server id 14.3.301.0; Mon, 4 Jun 2018 11:27:19 +0100 Received: from imbe.wolfsonmicro.main (imbe.wolfsonmicro.main [198.61.95.81]) by imbe.wolfsonmicro.main (8.14.4/8.14.4) with ESMTP id w54ARJOM018515; Mon, 4 Jun 2018 11:27:19 +0100 Date: Mon, 4 Jun 2018 11:27:19 +0100 From: Charles Keepax To: Andy Shevchenko CC: Lee Jones , , "Linux Kernel Mailing List" Subject: Re: [PATCH] mfd: arizona: Don't use regmap_read_poll_timeout Message-ID: <20180604102719.GA18740@imbe.wolfsonmicro.main> References: <20180511135030.14590-1-ckeepax@opensource.cirrus.com> <20180604054452.GD17993@dell> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-12-10) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=878 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806040128 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 04, 2018 at 12:40:37PM +0300, Andy Shevchenko wrote: > On Mon, Jun 4, 2018 at 8:44 AM, Lee Jones wrote: > > On Fri, 11 May 2018, Charles Keepax wrote: > > >> + while (true) { > >> + ret = regmap_read(arizona->regmap, reg, &val); > >> > >> + if ((val & mask) == target) > >> + return 0; > >> + > >> + if (ktime_compare(ktime_get(), timeout) > 0) > >> + break; > >> + > >> + usleep_range(ARIZONA_REG_POLL_DELAY_US / 2, > >> + ARIZONA_REG_POLL_DELAY_US); > >> + } > > >From my point of view infinite loops not good for readability and maintenance. > Perhaps > > do { > ... > } while (ktime_compare(...)); > > ? I would rather not do it that way since then it becomes impossible to have a single poll with no delays happening. I can refactor to remove the while(true) but it will make the code a bit bigger, as I will probably need to duplicate some code outside the loop. Thanks, Charles