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 majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html