From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752519AbcGGKBr (ORCPT ); Thu, 7 Jul 2016 06:01:47 -0400 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:34335 "EHLO metis.ext.4.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932108AbcGGKBp (ORCPT ); Thu, 7 Jul 2016 06:01:45 -0400 Message-ID: <1467885703.4236.40.camel@pengutronix.de> Subject: Re: [PATCH] regmap: add iopoll-like polling macro From: Philipp Zabel To: Mark Brown Cc: linux-kernel@vger.kernel.org, kernel@pengutronix.de Date: Thu, 07 Jul 2016 12:01:43 +0200 In-Reply-To: <20160707094254.GK6247@sirena.org.uk> References: <1467814781-15007-1-git-send-email-p.zabel@pengutronix.de> <20160707094254.GK6247@sirena.org.uk> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.9-1+b1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:100:96de:80ff:fec2:9969 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mark, thank you for the comments. Am Donnerstag, den 07.07.2016, 11:42 +0200 schrieb Mark Brown: > On Wed, Jul 06, 2016 at 04:19:41PM +0200, Philipp Zabel wrote: > > > This patch adds a macro regmap_read_poll_timeout that works similar > > to the readx_poll_timeout defined in linux/iopoll.h, except that this > > can also return the error value returned by a failed regmap_read. > > Please make this a proper function. I can't, the condition has to be evaluated inside the loop. This is basically a poor man's function template. > > + if (sleep_us) \ > > + usleep_range((sleep_us >> 2) + 1, sleep_us); \ > > Just write / 4 rather than a shift, the compiler should do the right > thing and it's easier for readers. Ok. Since this is copied from the readx_poll_timeout macro in include/linux/iopoll.h, I should probably suggest the same change there. regards Philipp