From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752261Ab0IAFYS (ORCPT ); Wed, 1 Sep 2010 01:24:18 -0400 Received: from mail.perches.com ([173.55.12.10]:1171 "EHLO mail.perches.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751635Ab0IAFYR (ORCPT ); Wed, 1 Sep 2010 01:24:17 -0400 Subject: Re: [MeeGo-Dev][PATCH] Topcliff: Update PCH_I2C driver to 2.6.35 From: Joe Perches To: Masayuki Ohtake Cc: "Jean Delvare (PC drivers, core)" , "Ben Dooks (embedded platforms)" , Crane Cai , Samuel Ortiz , Linus Walleij , Ralf Baechle , srinidhi kasagar , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, "Wang Yong Y\"" , "Wang Qi\"" , "Andrew\"" , arjan@linux.intel.com, Tomoya MORINAGA , Arnd Bergmann In-Reply-To: <001e01cb4993$bc0d75d0$66f8800a@maildom.okisemi.com> References: <4C7DB9CF.5000905@dsn.okisemi.com> <1283309032.1797.123.camel@Joe-Laptop> <001e01cb4993$bc0d75d0$66f8800a@maildom.okisemi.com> Content-Type: text/plain; charset="UTF-8" Date: Tue, 31 Aug 2010 22:24:14 -0700 Message-ID: <1283318654.1797.140.camel@Joe-Laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.30.2 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2010-09-01 at 14:08 +0900, Masayuki Ohtake wrote: > I have a question. > Current our I2C driver has the following 2 patterns dev_err(). > (1) dev_err(adap->pch_adapter.dev.parent, "..."); > (2) dev_err(&pdev->dev, "..."); > > #define pch_err(adap, fmt, arg...) \ > > dev_err(adap->pch_adapter.dev.parent, fmt, ##arg) > In case of using the above code, pattern (1) can apply, but (2) can't. > As to (2), > Should we use as dev_err or define another macro? Hello Ohtake. To me, it's a visual complexity vs std pattern trade-off. A 2 level dereference like dev_info(&dev->dev, ...) isn't overly difficult to read. 3 or more dereferences can be harder and a bit error prone. So I would only use pch_ for (1) and dev_err for (2). There are also times when there are additional standard arguments that you want to prefix to dev_ calls and that can be simplified with a custom XXX_ define for dev_ Look at the current uses in the tree and see what you like. $ grep -rP --include=*.[ch] "#define\s*.+\s+dev_[a-z]{3,7}\s*\(" * These aren't requirements, do what you think best. cheers, Joe