Hi Joe, Thank you for your comments.
Best Regards, Ohtake(OKISemi) ----- Original Message ----- From: "Joe Perches" <[email protected]> To: "Masayuki Ohtake" <[email protected]> Cc: "Jean Delvare (PC drivers, core)" <[email protected]>; "Ben Dooks (embedded platforms)" <[email protected]>; "Crane Cai" <[email protected]>; "Samuel Ortiz" <[email protected]>; "Linus Walleij" <[email protected]>; "Ralf Baechle" <[email protected]>; "srinidhi kasagar" <[email protected]>; <[email protected]>; <[email protected]>; "Wang Yong Y"" <[email protected]>; "Wang Qi"" <[email protected]>; "Andrew"" <[email protected]>; <[email protected]>; "Tomoya MORINAGA" <[email protected]>; "Arnd Bergmann" <[email protected]> Sent: Wednesday, September 01, 2010 2:24 PM Subject: Re: [MeeGo-Dev][PATCH] Topcliff: Update PCH_I2C driver to 2.6.35 > 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_<level> for (1) and dev_err for (2). > > There are also times when there are additional standard > arguments that you want to prefix to dev_<level> calls > and that can be simplified with a custom XXX_<level> > define for dev_<level> > > 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 > -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
