linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean Delvare <jdelvare@suse.de>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: Sascha Hauer <s.hauer@pengutronix.de>,
	linux-i2c@vger.kernel.org, Biwen Li <biwen.li@nxp.com>
Subject: Re: [PATCH] i2c: avoid ifdeffery in I2C drivers with optional slave support
Date: Fri, 10 Apr 2020 11:29:14 +0200	[thread overview]
Message-ID: <20200410112914.67a68e32@endymion> (raw)
In-Reply-To: <20200409134027.GB1136@ninjato>

Hi Wolfram, Sascha,

On Thu, 9 Apr 2020 15:40:27 +0200, Wolfram Sang wrote:
> On Wed, Dec 04, 2019 at 10:53:48AM +0100, Sascha Hauer wrote:
> > Always add the (un)reg_slave hooks to struct i2c_algorithm, even when
> > I2C slave support is disabled. With the cost of some binary space I2C
> > drivers with optional I2C slave support no longer have to #ifdef
> > the hooks. For the same reason add a stub for i2c_slave_event and make
> > enum i2c_slave_event present without I2C slave support.
> > 
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>  
> 
> This kind of reverts d5fd120e7860 ("i2c: Only include slave support if
> selected"), so adding Jean here for more discussion.

That commit made sense then as there was only exactly 1 kernel driver
needing this. This might be revisited when more drivers need it.

That being said, as far as I can see only 8 drivers need it today, which
isn't that many, and more importantly, several architectures will
typically not include support for any of them (i386, x86_64 and s390x
for example).

> I don't mind the additional bytes used in i2c_algorithm, so I am in
> favor of this approach.

I find it questionable to increase the memory footprint on all x86_64
systems out there for a feature they do not need. Sure it's only 16
bytes in one structure, but if every subsystem does the same on a
regular basis, it adds up.

More importantly I can't see how the ifdef'd members of struct
i2c_algorithm are the cause of the problem mentioned by Sascha. He
seems to be concerned by drivers with *optional* I2C slave support
having ifdefs. Why can't this be solved in these drivers directly? What
prevents these drivers from unconditionally selecting I2C_SLAVE if that
makes their code more simple? This moves the overhead decision to the
device driver instead of forcing it to the whole subsystem across all
architectures.

-- 
Jean Delvare
SUSE L3 Support

  reply	other threads:[~2020-04-10  9:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20191204095348.9192-1-s.hauer@pengutronix.de>
2020-04-09 13:40 ` [PATCH] i2c: avoid ifdeffery in I2C drivers with optional slave support Wolfram Sang
2020-04-10  9:29   ` Jean Delvare [this message]
2020-04-14 11:56     ` Sascha Hauer
2020-04-14 14:40       ` Jean Delvare
2020-04-15  5:16         ` Sascha Hauer
2020-04-15  9:51           ` Jean Delvare
2020-04-17 14:00           ` Jean Delvare
2020-04-20  6:12             ` Sascha Hauer

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=20200410112914.67a68e32@endymion \
    --to=jdelvare@suse.de \
    --cc=biwen.li@nxp.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=wsa@the-dreams.de \
    /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).