Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp3118345imd; Mon, 29 Oct 2018 01:51:35 -0700 (PDT) X-Google-Smtp-Source: AJdET5fTfkV2IMfX7vAnHLYocizeIgISLdHAjabNREzBERmzYOBx/s7wXOTCM/qVq/ADNlBpJ4a6 X-Received: by 2002:a17:902:7683:: with SMTP id m3-v6mr13747888pll.180.1540803095434; Mon, 29 Oct 2018 01:51:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540803095; cv=none; d=google.com; s=arc-20160816; b=Qh4kNDyUZJCF+lJLpU8KIgVTDHANboor812C1hcwnwdGQeyuUbRm5MqwsfYxHL+2fK xhRiSC42qB7BU9+3AvqewFk9XJVke6sqpbS7t7HH6JOcdQ2FRciDivjSALaGrCzgVNFH YDn2FG5rRsJfQ6G/rILFuWIWFZwWhGZaUn1JuqhJUJPt2zvAFx9E6VsAwZsNI55MzEGC ZaZaflqOUmzsgvyzvuhw/HIDXPDShhYR0dwJq0xzR/OuvdiHkl67+W8tsn0kUDnzpvLd mEvhWDHPmcSULeN90s97uftvUEzIjtNuImsYfqwmTlWJqqhvfR5YjV+tJXveOdw+u/Jx MOVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:reply-to:to:from :dkim-signature; bh=LVbpLsR13j8zpTnoVTUcBz3tEZlmQEcM4LUA0SAkn6Y=; b=h6MdWX6QkclTH3VZA17erCHY9yuBc8wwOknHFD0wjCrY5dZn530/qBClLhWFOyCpvj 4xTFN0yqNjdvM52ANNvErRUPttYDL6/NCtSmh4VCZYWA4Aup8+tQpXW1cl9UrSM8Mzgm ELkLEYk6gIYtkq6AffBio/hPKcdPna+P0tSnZsQhW8tPQEdw4ukyF5jrzjZDiXv+6oHq UkeJm/dQiHLPbUEc3lRWHX+WOy4rVDLwaFOyA3AIuRMmJlhiuXLYJNeqNp7vpv0Dh55Z inRyfCl/ouZ8znOC3MuaAcimMqNaLmAb36s5LUgficq7IsE4qNKTnYmV5Lo4utVX6IDF 0pfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cern.onmicrosoft.com header.s=selector1-cern-ch header.b=mDYYOmTM; 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 y18-v6si19701952pgf.476.2018.10.29.01.51.20; Mon, 29 Oct 2018 01:51:35 -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=pass header.i=@cern.onmicrosoft.com header.s=selector1-cern-ch header.b=mDYYOmTM; 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 S1729547AbeJ2RiQ (ORCPT + 99 others); Mon, 29 Oct 2018 13:38:16 -0400 Received: from mail-eopbgr30080.outbound.protection.outlook.com ([40.107.3.80]:29244 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729096AbeJ2RiQ (ORCPT ); Mon, 29 Oct 2018 13:38:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cern.onmicrosoft.com; s=selector1-cern-ch; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LVbpLsR13j8zpTnoVTUcBz3tEZlmQEcM4LUA0SAkn6Y=; b=mDYYOmTMD9M2IbzB6l0jKgpHEwNP52hZpyClSUslpQu9GVzOAd70Zifti4riQgt/RDF1GV8O8EhK8YCFQPm18lEQtWZGwz6IR0EXcvYj37aLi+f34KPY//MFxOU8Tec7h9hD9qGZWYQBKz9w+C4lv8pH/kS3R4JgOtLGQ9xxr/Q= Received: from VI1PR06CA0099.eurprd06.prod.outlook.com (2603:10a6:803:8c::28) by DB4PR06MB523.eurprd06.prod.outlook.com (2a01:111:e400:983a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1273.19; Mon, 29 Oct 2018 08:50:28 +0000 Received: from HE1EUR02FT057.eop-EUR02.prod.protection.outlook.com (2a01:111:f400:7e05::203) by VI1PR06CA0099.outlook.office365.com (2603:10a6:803:8c::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1273.20 via Frontend Transport; Mon, 29 Oct 2018 08:50:28 +0000 Authentication-Results: spf=pass (sender IP is 188.184.36.46) smtp.mailfrom=cern.ch; korsgaard.com; dkim=none (message not signed) header.d=none;korsgaard.com; dmarc=bestguesspass action=none header.from=cern.ch; Received-SPF: Pass (protection.outlook.com: domain of cern.ch designates 188.184.36.46 as permitted sender) receiver=protection.outlook.com; client-ip=188.184.36.46; helo=cernmxgwlb4.cern.ch; Received: from cernmxgwlb4.cern.ch (188.184.36.46) by HE1EUR02FT057.mail.protection.outlook.com (10.152.11.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1294.14 via Frontend Transport; Mon, 29 Oct 2018 08:50:26 +0000 Received: from cernfe04.cern.ch (188.184.36.41) by cernmxgwlb4.cern.ch (188.184.36.46) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 29 Oct 2018 09:50:14 +0100 Received: from pcbe13614.localnet (2001:1458:202:121::100:40) by smtp.cern.ch (2001:1458:201:66::100:14) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 29 Oct 2018 09:50:13 +0100 From: Federico Vaga To: Peter Korsgaard Reply-To: CC: Peter Korsgaard , linux-i2c , Subject: Re: [PATCH 3/3] i2c:ocores: add polling interface Date: Mon, 29 Oct 2018 09:50:15 +0100 Message-ID: <5352289.A0jT2G1FDH@pcbe13614> In-Reply-To: <87woq438li.fsf@dell.be.48ers.dk> References: <20180625161303.7991-1-federico.vaga@cern.ch> <4222986.LvGMQbjSbS@pcbe13614> <87woq438li.fsf@dell.be.48ers.dk> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Originating-IP: [2001:1458:202:121::100:40] X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:188.184.36.46;IPV:NLI;CTRY:CH;EFV:NLI;SFV:NSPM;SFS:(10001)(10009020)(459900002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB4PR06MB523;H:cernmxgwlb4.cern.ch;FPR:;SPF:None;LANG:en; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e745c8a9-d0e9-4d0b-14d4-08d63d7b9307 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4608076)(5565046)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:DB4PR06MB523; X-MS-TrafficTypeDiagnostic: DB4PR06MB523: X-Microsoft-Exchange-Diagnostics: 1;DB4PR06MB523;20:8VRfCQuZSE4bjq4Ba93eIECibUXynoBtEI1E3ONZfjnXfzkQq04/vH6KfAaCM8U0ht2N/IM7WZ7rY+BidO0EJEA+0wQAz6wYXAAE7AvVE1SD80ApXsQD8CDtF/U1J8L0eQrf2pEcWOE5RMpXmAdAIXyO9Y8nn3+UIr/7uwpWyGWOsvJT7mlj7N7cGmY3TXkMNaVTodfMR6EG2ZcR4DrBXa3YA7xfQQn8ArJCKifQOxGwkLus04/tIymqS3MaaW2vw1YOaVZLanJAiKC4oXR1uU7+4pwMKam2zKLbVh60cYEAyLAt6eG5zCJTsaj4jS5vD7wmPbn5khPGHQNR4+T+A1YCtcdgC97qlAwTqK4NADzaP95dGA3XVLgpHZDAY6hOjeVTd2iqAnsj6ftZhFr+p0AHITXElQxvVJGtCvJ5F0xK7XyprAza+bv0oByvywVikAYnUPheqBhrsEMbXlLjjcxNQmDUYeNfPM+n31HOSQqO3xxWctOqUb+ZWO9sHjS2;4:7I7puvtquB/AuuxI7JE70pqONstcs0ttIPNu+AbRZtFngZLBB+lQEV7SrPzdq2YZxPPNmPfRhcsM+iz6mHSlVqO5hJyDcblf8Y0fKL8iusBav9btShgvZb8cyUk/LknNE5A+rO2I54yTdCIJxkY5UxL1JcwnuP997gbFhhvmHcmbTHdZ9lB670o557/mh8Mx/zsEOa2Zwp0akHysVsNxqWSKISfDbnRDSyA6kpCuZhl1HD8eZbYfNyTs/p9ohi2+QG2zMhsrdOU50BcMzFOecg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93004095)(3231382)(7700054)(944501410)(52105095)(148016)(149066)(150057)(6041310)(201703131423095)(201702281529075)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123560045)(20161123558120)(201708071742011)(7699051)(76991095)(7701012);SRVR:DB4PR06MB523;BCL:0;PCL:0;RULEID:;SRVR:DB4PR06MB523; X-Forefront-PRVS: 084080FC15 X-Microsoft-Exchange-Diagnostics: 1;DB4PR06MB523;23:hWyW3lEEVmN/b+ML3SG+y0hDrRMzCiuu5Fgn37am/q0ZqeRKSo/uOU1We6mqZLUNERxIugVlBxksSV0oNyhLDYB84KUoO63+7DW6YaY8vLjywHAGjMiq0H62ZRysTg86F3bhvqAl6+srBldiUj268Xn4yCu2DnIb0upJJAsX1/qELACAD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nBbxoqc6kfbXkc69TR/ZKbXxUQf7FDYTdmuSXF7Itkj8ouonRsPfblaOb63mcb/nYjZQwllgl+UqCJAQF0V08r+Rl7elpE8T6UBG+Dy2CRZlsSw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DB4PR06MB523;7:LYgEsnyQBOYlETXBCAsWcGk/MKLtHocEllAW71bYc7m3ytXPPy4ysCBZbOsPwReAsHhva8ek88ul2X3R9HCnyu+4Oky0eBEiZrdKW2JoOs585UUSuHu4dRBpADQS3W0CJE5OxtNdHTQVRDddWJdKVA== X-OriginatorOrg: cern.ch X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2018 08:50:26.1646 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e745c8a9-d0e9-4d0b-14d4-08d63d7b9307 X-MS-Exchange-CrossTenant-Id: c80d3499-4a40-4a8c-986e-abce017d6b19 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=c80d3499-4a40-4a8c-986e-abce017d6b19;Ip=[188.184.36.46];Helo=[cernmxgwlb4.cern.ch] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR06MB523 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Peter, On Friday, October 26, 2018 7:45:29 PM CET Peter Korsgaard wrote: > >>>>> "Federico" == Federico Vaga writes: > Hi, > > >> > - } else > >> > + } else { > >> > > >> > msg->buf[i2c->pos++] = oc_getreg(i2c, OCI2C_DATA); > >> > > >> > + } > >> > >> This looks unrelated to $SUBJECT. > > > > Do you prefer a different patch just for styling? > > Yes please, it is a lot nicer to keep functional changes from pure style > changes. Ok > >> > +static void ocores_poll_wait(struct ocores_i2c *i2c) > >> > +{ > >> > + int sleep_min = (8/i2c->bus_clock_khz) * 1000; /* us for 8bits > >> > */ > >> > + u8 loop_on; > >> > + > >> > + usleep_range(sleep_min, sleep_min + 10); > >> > >> 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. 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.