From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mitchel Humpherys Subject: Re: [PATCH v4 1/2] iopoll: Introduce memory-mapped IO polling macros Date: Thu, 09 Oct 2014 15:45:05 -0700 Message-ID: References: <1412126893-15796-1-git-send-email-mitchelh@codeaurora.org> <1412126893-15796-2-git-send-email-mitchelh@codeaurora.org> <23910474.oJQUXZsx4W@wuerfel> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: (Mitchel Humpherys's message of "Tue, 07 Oct 2014 18:47:59 -0700") List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Arnd Bergmann Cc: Will Deacon , iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, Thierry Reding , Matt Wagantall , linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org List-Id: iommu@lists.linux-foundation.org On Tue, Oct 07 2014 at 06:47:59 PM, Mitchel Humpherys wrote: >>> +#define readl_poll_timeout_atomic(addr, val, cond, max_reads, time_between_us) \ >>> +({ \ >>> + int count; \ >>> + for (count = (max_reads); count > 0; count--) { \ >>> + (val) = readl(addr); \ >>> + if (cond) \ >>> + break; \ >>> + udelay(time_between_us); \ >>> + } \ >>> + (cond) ? 0 : -ETIMEDOUT; \ >>> +}) >> >> udelay has a large variability, I think it would be better to also use >> ktime_compare here and make the interface the same as the other one. >> You might want to add a warning if someone tries to pass more than a few >> microseconds as the timeout. > > Sounds good, will update in v5. Except I'll probably hold off on adding a warning about udelay since udelay already includes a "warning" (a compile error, actually) when exceedingly large delays are requested. -Mitch -- Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project From mboxrd@z Thu Jan 1 00:00:00 1970 From: mitchelh@codeaurora.org (Mitchel Humpherys) Date: Thu, 09 Oct 2014 15:45:05 -0700 Subject: [PATCH v4 1/2] iopoll: Introduce memory-mapped IO polling macros In-Reply-To: (Mitchel Humpherys's message of "Tue, 07 Oct 2014 18:47:59 -0700") References: <1412126893-15796-1-git-send-email-mitchelh@codeaurora.org> <1412126893-15796-2-git-send-email-mitchelh@codeaurora.org> <23910474.oJQUXZsx4W@wuerfel> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Tue, Oct 07 2014 at 06:47:59 PM, Mitchel Humpherys wrote: >>> +#define readl_poll_timeout_atomic(addr, val, cond, max_reads, time_between_us) \ >>> +({ \ >>> + int count; \ >>> + for (count = (max_reads); count > 0; count--) { \ >>> + (val) = readl(addr); \ >>> + if (cond) \ >>> + break; \ >>> + udelay(time_between_us); \ >>> + } \ >>> + (cond) ? 0 : -ETIMEDOUT; \ >>> +}) >> >> udelay has a large variability, I think it would be better to also use >> ktime_compare here and make the interface the same as the other one. >> You might want to add a warning if someone tries to pass more than a few >> microseconds as the timeout. > > Sounds good, will update in v5. Except I'll probably hold off on adding a warning about udelay since udelay already includes a "warning" (a compile error, actually) when exceedingly large delays are requested. -Mitch -- Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project