[PATCH] staging: most: dim2: remove unused header includes

Rajveer Chaudhari posted 1 patch 20 hours ago
There is a newer version of this series
drivers/staging/most/dim2/dim2.c | 3 ---
drivers/staging/most/dim2/hal.c  | 2 --
2 files changed, 5 deletions(-)
[PATCH] staging: most: dim2: remove unused header includes
Posted by Rajveer Chaudhari 20 hours ago
Remove unused header includes from dim2.c and hal.c to
reduce unnecessary dependencies and improve compilation time.

Signed-off-by: Rajveer Chaudhari <rajveer.chaudhari.linux@gmail.com>
---
 drivers/staging/most/dim2/dim2.c | 3 ---
 drivers/staging/most/dim2/hal.c  | 2 --
 2 files changed, 5 deletions(-)

diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c
index dad2abe6c0c9..b406cc0415b5 100644
--- a/drivers/staging/most/dim2/dim2.c
+++ b/drivers/staging/most/dim2/dim2.c
@@ -7,9 +7,7 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
-#include <linux/module.h>
 #include <linux/printk.h>
-#include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
@@ -17,7 +15,6 @@
 #include <linux/io.h>
 #include <linux/clk.h>
 #include <linux/dma-mapping.h>
-#include <linux/sched.h>
 #include <linux/kthread.h>
 #include <linux/most.h>
 #include <linux/of.h>
diff --git a/drivers/staging/most/dim2/hal.c b/drivers/staging/most/dim2/hal.c
index 6abe3ab2b2cf..50ff3ca37073 100644
--- a/drivers/staging/most/dim2/hal.c
+++ b/drivers/staging/most/dim2/hal.c
@@ -11,8 +11,6 @@
 #include "hal.h"
 #include "errors.h"
 #include "reg.h"
-#include <linux/stddef.h>
-#include <linux/kernel.h>
 #include <linux/io.h>
 
 /*
-- 
2.52.0
Re: [PATCH] staging: most: dim2: remove unused header includes
Posted by kernel test robot 13 hours ago
Hi Rajveer,

kernel test robot noticed the following build errors:

[auto build test ERROR on staging/staging-testing]

url:    https://github.com/intel-lab-lkp/linux/commits/Rajveer-Chaudhari/staging-most-dim2-remove-unused-header-includes/20260208-052613
base:   staging/staging-testing
patch link:    https://lore.kernel.org/r/20260207212354.51694-1-rajveer.chaudhari.linux%40gmail.com
patch subject: [PATCH] staging: most: dim2: remove unused header includes
config: um-allmodconfig (https://download.01.org/0day-ci/archive/20260208/202602081252.5GSGYfhI-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260208/202602081252.5GSGYfhI-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202602081252.5GSGYfhI-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/staging/most/dim2/hal.c:14:
   In file included from include/linux/io.h:12:
   In file included from arch/um/include/asm/io.h:24:
   include/asm-generic/io.h:1209:55: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
    1209 |         return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port;
         |                                                   ~~~~~~~~~~ ^
>> drivers/staging/most/dim2/hal.c:114:22: error: call to undeclared function 'DIV_ROUND_UP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     114 |                 u32 const blocks = DIV_ROUND_UP(size, DBR_BLOCK_SIZE);
         |                                    ^
   drivers/staging/most/dim2/hal.c:134:21: error: call to undeclared function 'DIV_ROUND_UP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     134 |         u32 const blocks = DIV_ROUND_UP(size, DBR_BLOCK_SIZE);
         |                            ^
   drivers/staging/most/dim2/hal.c:759:18: error: call to undeclared function 'DIV_ROUND_UP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     759 |                 ch->dbr_size = ROUND_UP_TO(hw_buffer_size, DBR_BLOCK_SIZE);
         |                                ^
   drivers/staging/most/dim2/hal.c:46:29: note: expanded from macro 'ROUND_UP_TO'
      46 | #define ROUND_UP_TO(x, d)  (DIV_ROUND_UP(x, (d)) * (d))
         |                             ^
   1 warning and 3 errors generated.


vim +/DIV_ROUND_UP +114 drivers/staging/most/dim2/hal.c

ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24   95  
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24   96  /**
51ca97af82af8a drivers/staging/most/dim2/hal.c          Lee Jones       2021-04-14   97   * alloc_dbr() - Allocates DBR memory.
7af9b4444fab2e drivers/staging/most/dim2/hal.c          Lee Jones       2021-04-14   98   * @size: Allocating memory size.
51ca97af82af8a drivers/staging/most/dim2/hal.c          Lee Jones       2021-04-14   99   * Returns: Offset in DBR memory by success or DBR_SIZE if out of memory.
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  100   */
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  101  static int alloc_dbr(u16 size)
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  102  {
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  103  	int mask_size;
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  104  	int i, block_idx = 0;
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  105  
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  106  	if (size <= 0)
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  107  		return DBR_SIZE; /* out of memory */
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  108  
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  109  	mask_size = dbr_get_mask_size(size);
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  110  	if (mask_size == 0)
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  111  		return DBR_SIZE; /* out of memory */
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  112  
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  113  	for (i = 0; i < DBR_MAP_SIZE; i++) {
bdc58e3bef647b drivers/staging/most/hdm-dim2/dim2_hal.c simran singhal  2017-02-22 @114  		u32 const blocks = DIV_ROUND_UP(size, DBR_BLOCK_SIZE);
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  115  		u32 mask = ~((~(u32)0) << blocks);
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  116  
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  117  		do {
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  118  			if ((g.dbr_map[i] & mask) == 0) {
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  119  				g.dbr_map[i] |= mask;
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  120  				return block_idx * DBR_BLOCK_SIZE;
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  121  			}
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  122  			block_idx += mask_size;
9158d33a5d38d1 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-10-15  123  			/* do shift left with 2 steps in case mask_size == 32 */
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  124  			mask <<= mask_size - 1;
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  125  		} while ((mask <<= 1) != 0);
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  126  	}
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  127  
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  128  	return DBR_SIZE; /* out of memory */
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  129  }
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  130  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH] staging: most: dim2: remove unused header includes
Posted by kernel test robot 14 hours ago
Hi Rajveer,

kernel test robot noticed the following build errors:

[auto build test ERROR on staging/staging-testing]

url:    https://github.com/intel-lab-lkp/linux/commits/Rajveer-Chaudhari/staging-most-dim2-remove-unused-header-includes/20260208-052613
base:   staging/staging-testing
patch link:    https://lore.kernel.org/r/20260207212354.51694-1-rajveer.chaudhari.linux%40gmail.com
patch subject: [PATCH] staging: most: dim2: remove unused header includes
config: um-allyesconfig (https://download.01.org/0day-ci/archive/20260208/202602081112.RJSlxpwj-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260208/202602081112.RJSlxpwj-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202602081112.RJSlxpwj-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/staging/most/dim2/hal.c: In function 'alloc_dbr':
>> drivers/staging/most/dim2/hal.c:114:36: error: implicit declaration of function 'DIV_ROUND_UP' [-Wimplicit-function-declaration]
     114 |                 u32 const blocks = DIV_ROUND_UP(size, DBR_BLOCK_SIZE);
         |                                    ^~~~~~~~~~~~


vim +/DIV_ROUND_UP +114 drivers/staging/most/dim2/hal.c

ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24   95  
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24   96  /**
51ca97af82af8a drivers/staging/most/dim2/hal.c          Lee Jones       2021-04-14   97   * alloc_dbr() - Allocates DBR memory.
7af9b4444fab2e drivers/staging/most/dim2/hal.c          Lee Jones       2021-04-14   98   * @size: Allocating memory size.
51ca97af82af8a drivers/staging/most/dim2/hal.c          Lee Jones       2021-04-14   99   * Returns: Offset in DBR memory by success or DBR_SIZE if out of memory.
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  100   */
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  101  static int alloc_dbr(u16 size)
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  102  {
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  103  	int mask_size;
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  104  	int i, block_idx = 0;
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  105  
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  106  	if (size <= 0)
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  107  		return DBR_SIZE; /* out of memory */
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  108  
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  109  	mask_size = dbr_get_mask_size(size);
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  110  	if (mask_size == 0)
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  111  		return DBR_SIZE; /* out of memory */
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  112  
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  113  	for (i = 0; i < DBR_MAP_SIZE; i++) {
bdc58e3bef647b drivers/staging/most/hdm-dim2/dim2_hal.c simran singhal  2017-02-22 @114  		u32 const blocks = DIV_ROUND_UP(size, DBR_BLOCK_SIZE);
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  115  		u32 mask = ~((~(u32)0) << blocks);
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  116  
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  117  		do {
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  118  			if ((g.dbr_map[i] & mask) == 0) {
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  119  				g.dbr_map[i] |= mask;
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  120  				return block_idx * DBR_BLOCK_SIZE;
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  121  			}
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  122  			block_idx += mask_size;
9158d33a5d38d1 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-10-15  123  			/* do shift left with 2 steps in case mask_size == 32 */
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  124  			mask <<= mask_size - 1;
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  125  		} while ((mask <<= 1) != 0);
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  126  	}
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  127  
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  128  	return DBR_SIZE; /* out of memory */
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  129  }
ba3d7ddfb5c6a2 drivers/staging/most/hdm-dim2/dim2_hal.c Christian Gromm 2015-07-24  130  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
[PATCH v2] staging: most: dim2: remove unused header includes
Posted by Rajveer Chaudhari 10 hours ago
Remove unused header includes from dim2.c and hal.c to
reduce unnecessary dependencies and improve compilation time.

Signed-off-by: Rajveer Chaudhari <rajveer.chaudhari.linux@gmail.com>
---

Changes in v2:
- Keep linux/kernel.h in hal.c as it provides DIV_ROUND_UP macro

 drivers/staging/most/dim2/dim2.c | 3 ---
 drivers/staging/most/dim2/hal.c  | 3 +--
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c
index dad2abe6c0c9..b406cc0415b5 100644
--- a/drivers/staging/most/dim2/dim2.c
+++ b/drivers/staging/most/dim2/dim2.c
@@ -7,9 +7,7 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
-#include <linux/module.h>
 #include <linux/printk.h>
-#include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
@@ -17,7 +15,6 @@
 #include <linux/io.h>
 #include <linux/clk.h>
 #include <linux/dma-mapping.h>
-#include <linux/sched.h>
 #include <linux/kthread.h>
 #include <linux/most.h>
 #include <linux/of.h>
diff --git a/drivers/staging/most/dim2/hal.c b/drivers/staging/most/dim2/hal.c
index 6abe3ab2b2cf..cebde0ce2701 100644
--- a/drivers/staging/most/dim2/hal.c
+++ b/drivers/staging/most/dim2/hal.c
@@ -11,9 +11,8 @@
 #include "hal.h"
 #include "errors.h"
 #include "reg.h"
-#include <linux/stddef.h>
-#include <linux/kernel.h>
 #include <linux/io.h>
+#include <linux/kernel.h>
 
 /*
  * Size factor for isochronous DBR buffer.
-- 
2.52.0