From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754322Ab2ATQ2P (ORCPT ); Fri, 20 Jan 2012 11:28:15 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:60890 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753504Ab2ATQ2O (ORCPT ); Fri, 20 Jan 2012 11:28:14 -0500 Date: Fri, 20 Jan 2012 16:28:01 +0000 From: Andy Whitcroft To: Joe Perches Cc: Dan Carpenter , Pradheep Shrinivasan , greg@kroah.com, devel@linuxdriverproject.org, swetland@google.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/6] staging:android_pmem.h: Fixes the space and other formating issues pointed out by checkpatch.pl Message-ID: <20120120162801.GE2744@shadowen.org> References: <1326856764-2531-1-git-send-email-pradheep.sh@gmail.com> <20120118065620.GE3294@mwanda> <20120118185457.GH3356@mwanda> <20120120115408.GL3356@mwanda> <1327066144.6176.27.camel@joe2Laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1327066144.6176.27.camel@joe2Laptop> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 20, 2012 at 05:29:04AM -0800, Joe Perches wrote: > On Fri, 2012-01-20 at 14:54 +0300, Dan Carpenter wrote: > > It still complains about the following macros where parenthesis are > > not needed. > > > > ERROR: Macros with complex values should be enclosed in parenthesis > > #156: FILE: staging/android/pmem.c:156: > > +#define PMEM_IS_FREE(id, index) !(pmem[id].bitmap[index].allocated) > > > > Let's just make the check look for an operator with a low > > precedence. > > http://en.wikipedia.org/wiki/Order_of_operations#Programming_languages > > > > Otherwise the submitters are going to change it to: > > > > #define PMEM_IS_FREE(id, index) (!(pmem[id].bitmap[index].allocated)) > > > > That has two pairs of unneeded paranthesis and we run the risk of > > reprogramming the kernel in lisp, by mistake. > > I think the outer parens are necessary. > Imagine PMEM_IS_FREE(foo, bar).another_dereference I don't believe that makes any sense does it, those are pointer operations, and passing 0/1 to those is going to make the . very unhappy. But that is why I am only proposing to do the three which are non-sensicle on pointers. -apw