Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp919756imm; Tue, 5 Jun 2018 06:34:30 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLsORt4F3x4evTH5MBHvoK88aybwYiF7ar/aK0XLlEuTzcU2EDzlP8pUT7VDtvLq9N2x+qp X-Received: by 2002:a17:902:164:: with SMTP id 91-v6mr26605422plb.134.1528205670619; Tue, 05 Jun 2018 06:34:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528205670; cv=none; d=google.com; s=arc-20160816; b=MY3TDTiw7yz/4qXLUYE+E/hXaQg0y+RquwZd7Av0WDD5x2lXwV0tEjFl55v9/DukOt YJj+ZXeFyOkBbqPnyRy7pUnCdlDo99UJtzb863qlGESByHxsd8nouXDAQELmCBDtCKdq mrqg+hXcVwOF/WMfHjpv9PST19SFDj5z8kTmA9iszBtTRYAnLTYnNCwlo9URR1Pv3feV m0eL3lsaq6jN++7vNiAemTtdDsHliMI10CybfH6owiDMLJZoRxZplYs+Mi46fOkmzCoQ fMWjyey2SDvtEvhiKjR/sj1qxTflhSzEfU56YPkrFG2xu/6h9hA9ExDEf6NR5aZ0NE8Q DIuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :from:references:cc:to:subject:arc-authentication-results; bh=FJj2SgtRhJgyjhq2lNfetw0F++AYOTXQND8293kxDsA=; b=KRJg2Os4Glq12W+4UwL258iZn3I2HP1pCG7uERhGyST98kL0KaEEBMQdq/t7E+BjTP W9ltQKu7HnO0ukzI+Yc5YjCZOoEE/ufCkNAiiI2GzBN5PY+5Gnqgbq/YVcweJL3Jrjrb xdwMpv1J3iQrraB/w8H8y1OP2jc/T6DWbk4LrGUMHcZFzoVPxhyo8vF9M+kxGuVc4vzx l3AnVLJsHdTz17DHNYh1k4WyxJ8lWBeBVM/ZZMJg4irvReFc1Ff6zgBvbNqAs/GIYnge NuKu1aom8RR0YGJI09oO/tCZsy1cE6DvLXem7Mkye/9zOW105NKVM4WwL8L37aP5MA9D ZI9w== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a3-v6si9463268plm.484.2018.06.05.06.34.16; Tue, 05 Jun 2018 06:34:30 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752242AbeFENdP (ORCPT + 99 others); Tue, 5 Jun 2018 09:33:15 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:38218 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752069AbeFENdL (ORCPT ); Tue, 5 Jun 2018 09:33:11 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w55DX6V3004631 for ; Tue, 5 Jun 2018 09:33:11 -0400 Received: from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.151]) by mx0a-001b2d01.pphosted.com with ESMTP id 2jdt2n519j-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 05 Jun 2018 09:33:07 -0400 Received: from localhost by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 5 Jun 2018 07:31:23 -0600 Received: from b03cxnp08025.gho.boulder.ibm.com (9.17.130.17) by e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 5 Jun 2018 07:31:19 -0600 Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w55DVJZG50462840 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 5 Jun 2018 06:31:19 -0700 Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0288B136055; Tue, 5 Jun 2018 07:31:19 -0600 (MDT) Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 49BD913604F; Tue, 5 Jun 2018 07:31:17 -0600 (MDT) Received: from [9.85.157.187] (unknown [9.85.157.187]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 5 Jun 2018 07:31:17 -0600 (MDT) Subject: Re: [PATCH v9 2/7] i2c: Add FSI-attached I2C master algorithm To: Benjamin Herrenschmidt , Andy Shevchenko Cc: linux-i2c , Linux Kernel Mailing List , devicetree , Wolfram Sang , Rob Herring , Joel Stanley , Mark Rutland , Greg Kroah-Hartman , Randy Dunlap References: <1528138850-18259-1-git-send-email-eajames@linux.vnet.ibm.com> <1528138850-18259-3-git-send-email-eajames@linux.vnet.ibm.com> <7daf29f643bb0445fceef85b1a7fff71048f2aa6.camel@kernel.crashing.org> From: Eddie James Date: Tue, 5 Jun 2018 08:31:16 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <7daf29f643bb0445fceef85b1a7fff71048f2aa6.camel@kernel.crashing.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 18060513-0036-0000-0000-000009E817D3 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009133; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000265; SDB=6.01042672; UDB=6.00533929; IPR=6.00821802; MB=3.00021476; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-05 13:31:23 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18060513-0037-0000-0000-0000478D50E8 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-06-05_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806050156 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/04/2018 06:38 PM, Benjamin Herrenschmidt wrote: > On Mon, 2018-06-04 at 22:21 +0300, Andy Shevchenko wrote: >>> +#define I2C_INT_ENABLE 0x0000ff80 >>> +#define I2C_INT_ERR 0x0000fcc0 >> Now it looks like a flags combinations. >> For me as for reader would be better to see quickly a decoded line. >> >> My proposal is to introduce something like following >> >> _INT_ALL GENMASK() >> _INT_ENABLE (_INT_ALL & ~(_FOO | _BAR)) >> _INT_ERR ... similar way as above ... >> >> What do you think? > I don't think this absolutely needs to change but yes, open coding is > error prone. However I would think it more readable to use positive > logic and just list all the bits that are *set* even if it's a bit more > text: > > #define I2C_INT_ERR (I2C_INT_INV_CMD |\ > I2C_INT_PARITY |\ > I2C_INT_BE_OVERRUN |\ > .../...) > > #define I2C_INT_ENABLE (I2C_INT_ERR |\ > I2C_INT_DAT_REQ |\ > I2C_INT_CMD_COMP) > > Note: Eddie, I notice I2C_INT_BUSY is in "ERR" but not in "ENABLE", any > reason for that ? Yes, we don't want to enable an interrupt if I2C gets into the busy state, as that happens during every transfer.  However it would likely be an error condition if we get that when the transfer is supposed to be complete. These were from the legacy driver... I just realized that neither are actually being used in this driver, so I will drop them. Thanks, Eddie > > Cheers, > Ben. >