Message ID | bd7fa0b07c85172ecba384e239cb0ecf0780766a.1686600780.git.christophe.jaillet@wanadoo.fr |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp114092vqr; Mon, 12 Jun 2023 13:24:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ40fhVLW1O10HJGduYGFK1W4uiEsn6BmVGw8O/hY4iOQYyPMiz8N6NHhJ+qtdpdL2BE1ZEF X-Received: by 2002:a17:907:3e1c:b0:970:1b2d:45cc with SMTP id hp28-20020a1709073e1c00b009701b2d45ccmr10084753ejc.57.1686601445930; Mon, 12 Jun 2023 13:24:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686601445; cv=none; d=google.com; s=arc-20160816; b=Do7dtAoWDGdyeu6E+LKF4xVEQahwYyNd8jDdMVFMsyLE1e5YAgKMTJA37DsDUxffCR eYj/HidVSnmPWJ+mUezoQvBpqIoGFWoj7hRXyNuGcXS5YVPNFkCbKYT5w+J39+AZnNxU ZW01tY0z7zfvBHeyM8feVRmtHzzmZMLyKoe5P3L+j4wIn4qmTIQi+ahIz21VBEH8SOe3 L3n2GkaiYcAzpdX7yCRjJZmOstdnIm5x6sI2IDXu3umSj6Rst93rNcpOsR7vbkPL0JDf +WvzV2hLekVx9GhuU5UjjnEvf5BqOArgLQOzAjnWtaw6HYBbcO24ri7Tcv1H3lrThBAe syuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=J/2JLtm8exGsXMCV+3V9bGaq28GcUnszoK7rIe0Hpa8=; b=EPU/3wcJfNhNK8fT5iPG1ZObE+9y9H6ZzrDNzsWKHsUn+PNiFDGqMm+z54IO+Y6MOd koiLlEqwRlAE0YSvIK2dkjiI0YTqLs/8F2tFy6uSF6+p2rfFhMJ3u8c+flue4SX5jk5R FNjUJaKOADQIFl0iwfFIz2qy2PScvIiGvMQ2GnMopA9kruA3vn7iOqAx+p0GRD98NzPY 45qWEG5xia+niGKMy6dsYdLKkXW9/cJ547AtsPdDC6czv3GHcWOiyRUS5CajlONZ9SRv iYeivcX/3MzESm3N//koXSXq0At1tOYSngLnTbH8B51X0S+nGT3DxShoRErehh2XqJOD SUCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=X7fAGo4T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r11-20020aa7cfcb000000b0051456f61f7dsi6265486edy.457.2023.06.12.13.23.40; Mon, 12 Jun 2023 13:24:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=X7fAGo4T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237533AbjFLUN7 (ORCPT <rfc822;rust.linux@gmail.com> + 99 others); Mon, 12 Jun 2023 16:13:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233459AbjFLUNx (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 12 Jun 2023 16:13:53 -0400 Received: from smtp.smtpout.orange.fr (smtp-22.smtpout.orange.fr [80.12.242.22]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A94971709 for <linux-kernel@vger.kernel.org>; Mon, 12 Jun 2023 13:13:47 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 8nv2q2OP12KZV8nv8qCDA3; Mon, 12 Jun 2023 22:13:46 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1686600826; bh=J/2JLtm8exGsXMCV+3V9bGaq28GcUnszoK7rIe0Hpa8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=X7fAGo4TuIVG+qDntP/1a5pzA/sKX+7zWKBY6X1z/QQg8NQKl1nygGq7wp5RnsHbG 5iUOvRMvft8s7SKdlZDEXtx2+BbBDMGfTC0PjHkqtGyyfQGwyh4GMQyJ2X6MvjQ/pm S9fFpD4TxsSqI6dJxf2nx45UeQgQGSW6ICSzEW0hpxeRgHowCDAn6b6UWnuZUgEEIf QMbpXeemmSA/OYSmYMqitKsuquypMIdQtoXujve9hfa8Gti8Wid7x4fHVJU9E+aXvF GLArxT3+eeo4+CMWry/aL1V5VPqrF927hnYQ9kQ7XlrGGON/PaAnHQWxltWb4cQsCZ YUONXPyglvTwg== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 12 Jun 2023 22:13:46 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> To: Jonathan Cameron <jic23@kernel.org>, Lars-Peter Clausen <lars@metafoo.de> Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET <christophe.jaillet@wanadoo.fr>, linux-iio@vger.kernel.org Subject: [PATCH 2/2] iio: st_sensors: Remove some redundant includes in st_sensors.h Date: Mon, 12 Jun 2023 22:13:37 +0200 Message-Id: <bd7fa0b07c85172ecba384e239cb0ecf0780766a.1686600780.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 In-Reply-To: <045ca726a9108325a3eaace807a264170895686c.1686600780.git.christophe.jaillet@wanadoo.fr> References: <045ca726a9108325a3eaace807a264170895686c.1686600780.git.christophe.jaillet@wanadoo.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768529797870341200?= X-GMAIL-MSGID: =?utf-8?q?1768529797870341200?= |
Series |
[1/2] iio: st_sensors: Remove some redundant includes
|
|
Commit Message
Christophe JAILLET
June 12, 2023, 8:13 p.m. UTC
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.
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(-)
Comments
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 > > 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>
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? 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> > >
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> > > > > >
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>