Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp237287imm; Mon, 4 Jun 2018 16:39:25 -0700 (PDT) X-Google-Smtp-Source: ADUXVKITuXZdbNj97Jjb/nPMkhcJ+yiXnxkLgSQ/1MJjE7QWfCChAAkizyo6y7H/dysnAIVmHFdM X-Received: by 2002:a17:902:6ac7:: with SMTP id i7-v6mr23569653plt.288.1528155565165; Mon, 04 Jun 2018 16:39:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528155565; cv=none; d=google.com; s=arc-20160816; b=YXwMioR0/tdyfdbp6fyRt2JRdSYuDmSp4ITqJrJQ3XQP93pr8ynESPWr3ZVFcSCC6d FUROp2uEQ9lz2r5sHLhH6cHyXGSl02e9Ui6NrIcbbuq/PrB7i7dQpQIkleaXjk4keTa5 jU8zunEMIBXzDeXXBcoAS+IjPWVWNaNZdS12nfq3kVcDt1mqzX3C16ZZt39fgLUPqR3G YD/nJ3dO244wJYc/r2/WMRAebg/kSjmDHhQ1VjQqzuRSZjyrokkY6duxh+HqXwUyiwmw PWGdWpQtr9uvbn5jj4hSeZ5QhV1c0Di0Ju1di2H8ftL+T9TCRXF55fPMVZ4gfpSUTnTu C1Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=pVfKgY5socjYWH2lXVIat+tuX8Ce+n5Q7sSE3b9IuMk=; b=aK4cqUvqnb9NFGVr5ozLtgfR/SHtHJ8t3CNCI5gkIwQG6x3M8qn8e0xWPq41MwklxC BB+XIb5ecLzLLDMqHPal7H+BO8nOYS9/v9GRCIPO+WJCwASP/G6Ru011tIGZTwG83Mx4 Cahof5ug2RTp2Tyoc24Hr1C4yAZnJNkkPLPqJrJS4OOPWnok3L5wsXmddM+fcII416IR CW66naavjy9YWexECODwq9lebHSVkpDSX6KxsD1qXR09D4fKeE2GibvAPueMqV7dyedj b4WI6sqVLxLXta+RT1F809iYB7hPWCEls97eKuM5jOnTrBtje8qzr7xOySdxynITeCAw GZ0Q== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f8-v6si23204472pgr.35.2018.06.04.16.39.09; Mon, 04 Jun 2018 16:39:25 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752095AbeFDXin (ORCPT + 99 others); Mon, 4 Jun 2018 19:38:43 -0400 Received: from gate.crashing.org ([63.228.1.57]:32866 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751170AbeFDXim (ORCPT ); Mon, 4 Jun 2018 19:38:42 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id w54Nc6XK019700; Mon, 4 Jun 2018 18:38:07 -0500 Message-ID: <7daf29f643bb0445fceef85b1a7fff71048f2aa6.camel@kernel.crashing.org> Subject: Re: [PATCH v9 2/7] i2c: Add FSI-attached I2C master algorithm From: Benjamin Herrenschmidt To: Andy Shevchenko , Eddie James Cc: linux-i2c , Linux Kernel Mailing List , devicetree , Wolfram Sang , Rob Herring , Joel Stanley , Mark Rutland , Greg Kroah-Hartman , Randy Dunlap Date: Tue, 05 Jun 2018 09:38:06 +1000 In-Reply-To: References: <1528138850-18259-1-git-send-email-eajames@linux.vnet.ibm.com> <1528138850-18259-3-git-send-email-eajames@linux.vnet.ibm.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.1 (3.28.1-2.fc28) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 ? Cheers, Ben.