From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754714AbdKATR6 (ORCPT ); Wed, 1 Nov 2017 15:17:58 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:43346 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751587AbdKATR4 (ORCPT ); Wed, 1 Nov 2017 15:17:56 -0400 X-Google-Smtp-Source: ABhQp+R43qCxfi6p1fJ9g+cweJ9nRmOTUUCghAyEVY6r/9C9DT7Fo+Yke/CDjIjTf/c8uOJKyxtHk83r9inEwGinOSs= MIME-Version: 1.0 In-Reply-To: References: <20171101175325.2557ce85@alans-desktop> <4b707ce0-6067-ab36-e167-1acf348d26bf@free.fr> From: Linus Torvalds Date: Wed, 1 Nov 2017 12:17:55 -0700 X-Google-Sender-Auth: iwFS3exag44ts4dziHlmuUHGjEM Message-ID: Subject: Re: [RFC] Improving udelay/ndelay on platforms where that is possible To: Marc Gonzalez Cc: Alan Cox , LKML , Linux ARM , Steven Rostedt , Ingo Molnar , Thomas Gleixner , Peter Zijlstra , John Stultz , Douglas Anderson , Nicolas Pitre , Mark Rutland , Will Deacon , Jonathan Austin , Arnd Bergmann , Kevin Hilman , Russell King , Michael Turquette , Stephen Boyd , Mason Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 1, 2017 at 12:09 PM, Linus Torvalds wrote: > > Yes, there is a *fallback* for when somebody doesn't do ndelay() at > all, but that doesn't make it the default. > > It's just a "the architecture didn't implement ndelay at all, we'll > work around it". Side note: I will continue to claim that anybody who thinks they need ndelay() needs to rethink their position anyway, due to all the issues I did already bring up. So I'd say that pretty much 100% of all ndelay() users are just wrong. If you are doing a driver that needs that kind of delay granularity, you had better already know exactly how long it takes to read the status register, and just do that instead. And if you don't know how long it takes to read a status register, you have no business thinking that you need ndelay(). You probably ended up reading one piece of hardware doc ("the sample-and-hold register takes 200ns to settle") without then reading the other low-level hardware documentation that talks about the timings of the chip accesses from the host side. Linus