kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	<linux-kernel@vger.kernel.org>, <kernel-janitors@vger.kernel.org>,
	<linux-iio@vger.kernel.org>
Subject: Re: [PATCH 2/2] iio: st_sensors: Remove some redundant includes in st_sensors.h
Date: Sun, 2 Jul 2023 18:31:33 +0800	[thread overview]
Message-ID: <20230702183133.00007c8d@Huawei.com> (raw)
In-Reply-To: <1d367f33-3ed2-63d0-093a-7d1f561cca10@wanadoo.fr>

On Mon, 19 Jun 2023 22:02:37 +0200
Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:

> Le 17/06/2023 à 20:49, Jonathan Cameron a écrit :
> > On Mon, 12 Jun 2023 22:13:37 +0200
> > Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
> >   
> >> There is no need to include i2c.h and spi/spi.h in st_sensors.h.
> >> Should it be needed, st_sensors_(i2c|spi).h should be used.  
> > Agreed these should be dropped from here.
> > 
> > But I don't agree with statement that i2c.h and spi/spi.h should
> > be gotten implicitly from st_sensors_i2c.h / st_sensors_spi.h
> > If they are needed the should be included directly in the files
> > where they are needed.
> > 
> > Jonathan  
> 
> Another option I thought about was to:
>     - keep the includes in st_sensors.h
> 
>     - move function declaration in st_sensors.h
> int st_sensors_spi_configure(struct iio_dev *indio_dev,
> 			     struct spi_device *spi);
> and
> int st_sensors_i2c_configure(struct iio_dev *indio_dev,
> 			     struct i2c_client *client);
> 
>     - remove st_sensors_spi.h and st_sensors_i2c.h
> 
> At least, it would simplify things a remove 2 mostly useless .h file.
> 
> It would not give the benefit of removing some include for files that do 
> not require spi.h or i2c.h, but as these includes are already there, it 
> wouldn't make things worst :)
> 
> What do you think of this approach?

Gut feeling is not worth bothering...  Having separate _i2c.h and _spi.h
seems fine to me.  I'm fine with this patch, just not the description.

Jonathan

> 
> CJ
> 
> >   
> >>
> >> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> >> ---
> >> Based on one of my script, this reduces the number of included files from
> >> 573 files to 515 files when compiling drivers/iio/accel/st_accel_buffer.c
> >> ---
> >>   include/linux/iio/common/st_sensors.h | 2 --
> >>   1 file changed, 2 deletions(-)
> >>
> >> diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
> >> index 607c3a89a647..a1d3d57d6d6e 100644
> >> --- a/include/linux/iio/common/st_sensors.h
> >> +++ b/include/linux/iio/common/st_sensors.h
> >> @@ -10,8 +10,6 @@
> >>   #ifndef ST_SENSORS_H
> >>   #define ST_SENSORS_H
> >>   
> >> -#include <linux/i2c.h>
> >> -#include <linux/spi/spi.h>
> >>   #include <linux/irqreturn.h>
> >>   #include <linux/iio/iio.h>
> >>   #include <linux/iio/trigger.h>  
> > 
> >   
> 


  reply	other threads:[~2023-07-02 10:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-12 20:13 [PATCH 1/2] iio: st_sensors: Remove some redundant includes Christophe JAILLET
2023-06-12 20:13 ` [PATCH 2/2] iio: st_sensors: Remove some redundant includes in st_sensors.h Christophe JAILLET
2023-06-17 18:49   ` Jonathan Cameron
2023-06-19 20:02     ` Christophe JAILLET
2023-07-02 10:31       ` Jonathan Cameron [this message]
2023-06-17 18:47 ` [PATCH 1/2] iio: st_sensors: Remove some redundant includes Jonathan Cameron

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=20230702183133.00007c8d@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=jic23@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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).