linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
To: Phil Carmody
	<phil.carmody-GrGkmOP51GdLN7c7dRTbYkEOCMrvLtNR@public.gmane.org>
Cc: ml.lawnick-Mmb7MZpHnFY@public.gmane.org,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] i2c: reduce parent checking to a NOOP in non-I2C_MUX case
Date: Wed, 7 Aug 2013 16:54:36 +0200	[thread overview]
Message-ID: <20130807145436.GE2978@katana> (raw)
In-Reply-To: <1372233395-13663-1-git-send-email-phil.carmody-GrGkmOP51GdLN7c7dRTbYkEOCMrvLtNR@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1293 bytes --]

On Wed, Jun 26, 2013 at 10:56:35AM +0300, Phil Carmody wrote:
> In 0826374 - i2c: Multiplexed I2C bus core support
> core i2c code increased in size and complexity even when I2C_MUX
> wasn't selected.
> 
> Turning this check into a constant NULL in the n case lets the
> client functions in be simplified too, not needing to include
> never-called calls to the mux-specific helpers.
> 
> Signed-off-by: Phil Carmody <phil.carmody-GrGkmOP51GdLN7c7dRTbYkEOCMrvLtNR@public.gmane.org>

Not my favourite style to have #endif in the code block, but good
enough. Applied to for-next, thanks!

> ---
>  include/linux/i2c.h |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/linux/i2c.h b/include/linux/i2c.h
> index e988fa9..b3c4b8d 100644
> --- a/include/linux/i2c.h
> +++ b/include/linux/i2c.h
> @@ -447,11 +447,13 @@ static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data)
>  static inline struct i2c_adapter *
>  i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter)
>  {
> +#if IS_ENABLED(I2C_MUX)
>  	struct device *parent = adapter->dev.parent;
>  
>  	if (parent != NULL && parent->type == &i2c_adapter_type)
>  		return to_i2c_adapter(parent);
>  	else
> +#endif
>  		return NULL;
>  }
>  
> -- 
> 1.7.9.5
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

      parent reply	other threads:[~2013-08-07 14:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-26  7:56 [PATCH] i2c: reduce parent checking to a NOOP in non-I2C_MUX case Phil Carmody
     [not found] ` <1372233395-13663-1-git-send-email-phil.carmody-GrGkmOP51GdLN7c7dRTbYkEOCMrvLtNR@public.gmane.org>
2013-08-07 14:54   ` Wolfram Sang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130807145436.GE2978@katana \
    --to=wsa-z923lk4zbo2bacvfa/9k2g@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=ml.lawnick-Mmb7MZpHnFY@public.gmane.org \
    --cc=phil.carmody-GrGkmOP51GdLN7c7dRTbYkEOCMrvLtNR@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).