* [PATCH] i2c: reduce parent checking to a NOOP in non-I2C_MUX case
@ 2013-06-26 7:56 Phil Carmody
[not found] ` <1372233395-13663-1-git-send-email-phil.carmody-GrGkmOP51GdLN7c7dRTbYkEOCMrvLtNR@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Phil Carmody @ 2013-06-26 7:56 UTC (permalink / raw)
To: wsa-z923LK4zBo2bacvFa/9K2g
Cc: ml.lawnick-Mmb7MZpHnFY, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
Phil Carmody
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>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] i2c: reduce parent checking to a NOOP in non-I2C_MUX case
[not found] ` <1372233395-13663-1-git-send-email-phil.carmody-GrGkmOP51GdLN7c7dRTbYkEOCMrvLtNR@public.gmane.org>
@ 2013-08-07 14:54 ` Wolfram Sang
0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2013-08-07 14:54 UTC (permalink / raw)
To: Phil Carmody; +Cc: ml.lawnick-Mmb7MZpHnFY, linux-i2c-u79uwXL29TY76Z2rM5mHXA
[-- 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 --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-08-07 14:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).