Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3946CC48BE0 for ; Fri, 11 Jun 2021 18:21:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 18135613AE for ; Fri, 11 Jun 2021 18:21:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230201AbhFKSXU (ORCPT ); Fri, 11 Jun 2021 14:23:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:45932 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230188AbhFKSXU (ORCPT ); Fri, 11 Jun 2021 14:23:20 -0400 Received: from jic23-huawei (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 78BF9613C6; Fri, 11 Jun 2021 18:21:13 +0000 (UTC) Date: Fri, 11 Jun 2021 19:23:03 +0100 From: Jonathan Cameron To: Andy Shevchenko Cc: linux-iio , Jonathan Cameron , Andy Shevchenko , Aleksei Mamlin , Dan Robertson , Hans de Goede , Harinath Nampally , Jelle van der Waa , Jonathan Bakker , Lars-Peter Clausen , Linus Walleij , Michael Hennerich , Mike Looijmans , Sean Nyekjaer , Tomas Melin Subject: Re: [PATCH 00/12] iio:accel: Header Cleanups. Message-ID: <20210611192303.755392d1@jic23-huawei> In-Reply-To: References: <20210611171355.202903-1-jic23@kernel.org> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org On Fri, 11 Jun 2021 20:48:08 +0300 Andy Shevchenko wrote: > On Fri, Jun 11, 2021 at 8:14 PM Jonathan Cameron wrote: > > > > From: Jonathan Cameron > > > > 0-day recently started running the include-what-you-use checker with LLVM builds. > > After it identified a header we should have dropped in a particular patch, > > I decided to experiment with it a little and see if it was useful for tidying > > up includes that have gotten rather out of sync with the code over the years. > > > > Note the tool is something I'd only advocate using to give you hints on what > > might want adjusting so each of these was done by hand inspection. > > > > I've grouped them by manufacturer as otherwise we would have a lot of patches. > > Note that the big 'many device / device type' drivers have been done separately > > so you won't see them in this series. > > > > I'm rather hoping this approach may ease getting reviews of these, but we > > shall see. If people have time to look at ones I haven't directly cc'd them > > on that would be great. There are some drivers touched in here where I don't > > know of a current maintainer. > > Same comment as per staging series. > > I know that kernel.h provides some crucial everywhere used macros / > helpers which are in the TODO list to be split. > > I would recommend dropping kernel.h from the drivers and see what's missed. > > These series probably need to be based on splitting out container_of() > and ARRAY_SIZE() first. Tool obligingly tells me at least one item from kernel.h and you have the correct pair (occasionally it's the kernel specific string routines). e.g. #include "linux/kernel.h" // for kstrtouint, ARRAY_SIZE > > So, no tag from me for now (but I like the idea in general, and thanks > for looking into this). > The tool is rather a blunderbuss for this job which makes it rather time consuming to use. Splitting kernel.h up is a step beyond where I'm interested in going at this stage because it's sure to involve a lot of bike shedding. I 'could' just drop the kernel.h where added on the basis we were clearly getting it indirectly. I've not included a whole bunch of other suggestions on that basis. Note I didn't include a whole bunch of other headers on the basis they were a bit more esoteric. To give an idea of how noisy this is here's the output another file... drivers/iio/trigger/stm32-timer-trigger.c should add these lines: #include // for NULL, size_t #include // for uintptr_t #include // for ssize_t #include "asm-generic/div64.h" // for do_div #include "asm-generic/errno-base.h" // for EINVAL, ENOMEM, EBUSY #include "asm-generic/int-ll64.h" // for u32 #include "asm/page_types.h" // for PAGE_SIZE #include "linux/clk.h" // for clk_enable, clk_dis... #include "linux/compiler_attributes.h" // for __maybe_unused #include "linux/dev_printk.h" // for dev_err #include "linux/device.h" // for dev_get_drvdata #include "linux/device/driver.h" // for device_driver #include "linux/export.h" // for EXPORT_SYMBOL #include "linux/gfp.h" // for GFP_KERNEL #include "linux/iio/types.h" // for IIO_CHAN_INFO_ENABLE #include "linux/kernel.h" // for kstrtouint, ARRAY_SIZE #include "linux/list.h" // for INIT_LIST_HEAD, lis... #include "linux/mod_devicetable.h" // for of_device_id #include "linux/mutex.h" // for mutex_lock, mutex_u... #include "linux/of.h" // for of_property_read_u32 #include "linux/pm.h" // for SIMPLE_DEV_PM_OPS #include "linux/regmap.h" // for regmap_update_bits #include "linux/stddef.h" // for true, false #include "linux/string.h" // for strstr, strlen, str... #include "linux/sysfs.h" // for sysfs_emit, attribu... #include "linux/types.h" // for bool, list_head #include "vdso/bits.h" // for BIT drivers/iio/trigger/stm32-timer-trigger.c should remove these lines: The full include-list for drivers/iio/trigger/stm32-timer-trigger.c: #include // for iio_priv, IIO_SEPARATE #include // for iio_dev_attr, IIO_D... #include // for TIM4_TRGO, TIM1_TRGO #include // for iio_trigger, to_iio... #include // for TIM_CR1, TIM_CR2 #include // for MODULE_ALIAS, MODUL... #include // for of_match_device #include // for platform_get_drvdata #include // for NULL, size_t #include // for uintptr_t #include // for ssize_t #include "asm-generic/div64.h" // for do_div #include "asm-generic/errno-base.h" // for EINVAL, ENOMEM, EBUSY #include "asm-generic/int-ll64.h" // for u32 #include "asm/page_types.h" // for PAGE_SIZE #include "linux/clk.h" // for clk_enable, clk_dis... #include "linux/compiler_attributes.h" // for __maybe_unused #include "linux/dev_printk.h" // for dev_err #include "linux/device.h" // for dev_get_drvdata #include "linux/device/driver.h" // for device_driver #include "linux/export.h" // for EXPORT_SYMBOL #include "linux/gfp.h" // for GFP_KERNEL #include "linux/iio/types.h" // for IIO_CHAN_INFO_ENABLE #include "linux/kernel.h" // for kstrtouint, ARRAY_SIZE #include "linux/list.h" // for INIT_LIST_HEAD, lis... #include "linux/mod_devicetable.h" // for of_device_id #include "linux/mutex.h" // for mutex_lock, mutex_u... #include "linux/of.h" // for of_property_read_u32 #include "linux/pm.h" // for SIMPLE_DEV_PM_OPS #include "linux/regmap.h" // for regmap_update_bits #include "linux/stddef.h" // for true, false #include "linux/string.h" // for strstr, strlen, str... #include "linux/sysfs.h" // for sysfs_emit, attribu... #include "linux/types.h" // for bool, list_head #include "vdso/bits.h" // for BIT