Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp3363991imd; Mon, 29 Oct 2018 06:07:05 -0700 (PDT) X-Google-Smtp-Source: AJdET5er3YN0xUHDNpSwCeEcKm6sKpzFwfb21+PMIdIbsn7h+mzpuIuOnzCRP9/fPFuEi83mcYtX X-Received: by 2002:a17:902:8d83:: with SMTP id v3-v6mr14259813plo.162.1540818425679; Mon, 29 Oct 2018 06:07:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540818425; cv=none; d=google.com; s=arc-20160816; b=xjnXO4oftoJ4wVZEBMgpUX2P70oalhGuPUn4/4FqdIlPEgia0D9DE+asbdzPsC3POF JIP8U+lSWIZgGdB7cOI7bcIalzF1piHgpfTDz1/7OshBRjTEyu5yoWiQOeNgVtWNpNgs TXtRSWAXmQNX0H3kSGLvzLMTATUZB5ZDzzUpMc5Zh8d5tS/OIMkjIklc3pg2rr65fGeT ifqDaKdLPw1bUjsiNyK6S3vvKSjgwZeH7x0y6oy6YwEO3ECWB2fii9HZXDHI05z8vTOW 5J8r/BXNi0gfec0ajtv8aihtnGr8quYdzK/WHx84qBhy6BKcHR8RxDWvp6yrcHlnoakP IziQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:dkim-signature; bh=HhOss3t/D5OWI5zhM8Hag1e35zlkzx3kXjNsw5TjDaM=; b=rc9hv+njDwIHmkUMGMNRuTN246rQVszIIb8urPudXpD2xCiX9LFa7XFAKc1dHZEFDu fLW6OZp58wlORCV9k3sFAFFmJ+a/3K8LBQDn/0rQLzuL+tL9d44JJulEOq+St5Mj+Frv ZdikB2f6WrRP5JCLyHrliI0PqaZuSM7QnBt59skEqtQcfqRTdZvzPtgeY6oWm6DHN7Od MueMay1wxahkHftNr4M+w8xsyG72Cw8LLL3QtaKdtJIJhbPK+NSWMpvgEKxMNBdKj18G jclaVKguLLlhpVKl4IfdXR7wlfNFkdXkYZTRTv6wcSIXWtU8WbfO8Wmku5FR1U/pxB3D YnpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=jmNOesas; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x2-v6si20190078pln.232.2018.10.29.06.06.50; Mon, 29 Oct 2018 06:07:05 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=jmNOesas; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726468AbeJ2Vwx (ORCPT + 99 others); Mon, 29 Oct 2018 17:52:53 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:46255 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725886AbeJ2Vwx (ORCPT ); Mon, 29 Oct 2018 17:52:53 -0400 Received: by mail-ed1-f67.google.com with SMTP id v18-v6so7184165edq.13; Mon, 29 Oct 2018 06:04:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=HhOss3t/D5OWI5zhM8Hag1e35zlkzx3kXjNsw5TjDaM=; b=jmNOesasNQd3E6j+Ym89Ms9Sg0qpFN/L/QQ2Pp1qX2ClJ66cZvfdHqVqjypU93kUtI IrZESOQoKUD6DqWWe+EMCdSEFA49rlmRK6NAkIxePFk9OpIGkAOCWUZ+1Q1Rp7k7ueEY ctw4OrMAIPCQblkWgTGQvGKq0uRWfGbP4iEYVJ7xWH7RRNUn6SVxCYy5dDIbvMT6vpFS qPewHdn5Pk/7hQ3X/Htb/BrIxphSK3t134MjGjU9umqQLlm6N4hIHBevGDSLYGKjOlov uCjnE/Wg+fRTAFu+m8shkCg7uNQ60JU7+Sr7Z0/mhZyDmKaZx37Tyfoe5vEwYbgGp6dY uSGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=HhOss3t/D5OWI5zhM8Hag1e35zlkzx3kXjNsw5TjDaM=; b=QbJVQMDgGjOPIqCAtWe9EjLckVKcoP8fdBDP2etJ7xvsxRgyjG7Y4+N/K4bCphUp5z mnsmNNvW9KasMSAzoFQCc7lmA8GADtFmSLfH/R1Q9NNK4la1YxuhZDQQhTxM3VfnTGtu ZyGAryyrfSnWdoFPifq/r28S+oGuiHHQfXoFNnyaJma/BX+dGdmX43YTb0hsBT/iqEVT 7NbtR86lIvEwOwJI53KC6iGG69SjBM110fD6MUbS1saHz74di1LGJSahhJqcTKVt7/SA PDFx4nakVsMdvF2EGOaivGO4iVWZVCKbR4BF2ksGu5Su7J+m+0BacbgzkL8HE0XHFUjj 4ZQQ== X-Gm-Message-State: AGRZ1gJfbawmhWiclh1IQwRY8AsGt6g+1EZNK76LV4MyH5pIINFxRqUA 7tgYa+d1jw8kc2z/nDSMeyrAGRs2 X-Received: by 2002:a17:906:6308:: with SMTP id p8-v6mr4346358ejk.100.1540818255864; Mon, 29 Oct 2018 06:04:15 -0700 (PDT) Received: from dell.be.48ers.dk (d528f5fe4.static.telenet.be. [82.143.95.228]) by smtp.gmail.com with ESMTPSA id a4-v6sm5829154edt.82.2018.10.29.06.04.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Oct 2018 06:04:14 -0700 (PDT) Received: from peko by dell.be.48ers.dk with local (Exim 4.89) (envelope-from ) id 1gH7DJ-0004Uf-Og; Mon, 29 Oct 2018 14:04:13 +0100 From: Peter Korsgaard To: Federico Vaga Cc: Peter Korsgaard , linux-i2c , Subject: Re: [PATCH 3/3] i2c:ocores: add polling interface References: <20180625161303.7991-1-federico.vaga@cern.ch> <4222986.LvGMQbjSbS@pcbe13614> <87woq438li.fsf@dell.be.48ers.dk> <5352289.A0jT2G1FDH@pcbe13614> Date: Mon, 29 Oct 2018 14:04:13 +0100 In-Reply-To: <5352289.A0jT2G1FDH@pcbe13614> (Federico Vaga's message of "Mon, 29 Oct 2018 09:50:15 +0100") Message-ID: <87muqwzyya.fsf@dell.be.48ers.dk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>>>> "Federico" == Federico Vaga writes: Hi, >> >> Where does this 10 come from? >> > >> > It's true, it's just a random number. It can be zero as well, and we ask >> > the system to just sleep for that amount of time. >> > >> > (1) usleep_range(sleep_min, sleep_min); >> >> Or just usleep(sleep_min); > This does not exist as far as I know; the alternative is an active wait with > udelay. But then, it is not that different from just start polling TIP or BUSY > flags. Ahh yes. > I think that something like this could be better > (2) usleep_range(sleep_min, sleep_min * XXX); > But. > Since it is better to make this patch ready for xfer_irqless, then I will > definitively go for udelay(). The reason is that, xfer_irqless may run in > atomic context where we can't sleep at all. Great! BTW I noticed that your sleep_min calculation looked odd: int sleep_min = (8/i2c->bus_clock_khz) * 1000; /* us for 8bits bus_clock_khz almost certainly will be bigger than 8 (E.G. likely 100KHz), so the above set sleep_min to 0. Please move the * 1000 before the division. -- Bye, Peter Korsgaard