diff mbox

[v2,02/14] platform/x86: dell-smbios: drop needless includes

Message ID cc9ebe36b3c0adee5789253b6d77a2a5e3a7e765.1506451187.git.mario.limonciello@dell.com (mailing list archive)
State Rejected, archived
Delegated to: Darren Hart
Headers show

Commit Message

Limonciello, Mario Sept. 26, 2017, 6:50 p.m. UTC
These aren't needed to compile the module.

Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
---
 drivers/platform/x86/dell-smbios.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Darren Hart Sept. 27, 2017, 5:40 p.m. UTC | #1
On Tue, Sep 26, 2017 at 01:50:00PM -0500, Mario Limonciello wrote:
> These aren't needed to compile the module.
> 
> Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>

Hrm...

CONFIG_DELL_SMBIOS=m

$ make drivers/platform/x86/dell-smbios.ko

  CC [M]  drivers/platform/x86/dell-smbios.o
drivers/platform/x86/dell-smbios.c: In function ‘parse_da_table’:
drivers/platform/x86/dell-smbios.c:142:18: error: implicit declaration of function ‘krealloc’ [-Werror=implicit-function-declaration]
  new_da_tokens = krealloc(da_tokens, (da_num_tokens + tokens) *
                  ^~~~~~~~
drivers/platform/x86/dell-smbios.c:142:16: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
  new_da_tokens = krealloc(da_tokens, (da_num_tokens + tokens) *
                ^
drivers/platform/x86/dell-smbios.c: In function ‘dell_smbios_init’:
drivers/platform/x86/dell-smbios.c:193:2: error: implicit declaration of function ‘kfree’ [-Werror=implicit-function-declaration]
  kfree(da_tokens);
  ^~~~~

> ---
>  drivers/platform/x86/dell-smbios.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/platform/x86/dell-smbios.c b/drivers/platform/x86/dell-smbios.c
> index 0a5723468bff..6654ad44a04c 100644
> --- a/drivers/platform/x86/dell-smbios.c
> +++ b/drivers/platform/x86/dell-smbios.c
> @@ -17,10 +17,7 @@
>  #include <linux/module.h>
>  #include <linux/dmi.h>
>  #include <linux/err.h>
> -#include <linux/gfp.h>
>  #include <linux/mutex.h>
> -#include <linux/slab.h>

Appears you do require slab.h...

> -#include <linux/io.h>
>  #include "../../firmware/dcdbas.h"
>  #include "dell-smbios.h"
>  
> -- 
> 2.14.1



> 
>
Limonciello, Mario Sept. 27, 2017, 5:44 p.m. UTC | #2
> -----Original Message-----

> From: Darren Hart [mailto:dvhart@infradead.org]

> Sent: Wednesday, September 27, 2017 1:40 PM

> To: Limonciello, Mario <Mario_Limonciello@Dell.com>

> Cc: Andy Shevchenko <andy.shevchenko@gmail.com>; LKML <linux-

> kernel@vger.kernel.org>; platform-driver-x86@vger.kernel.org;

> quasisec@google.com; pali.rohar@gmail.com

> Subject: Re: [PATCH v2 02/14] platform/x86: dell-smbios: drop needless includes

> 

> On Tue, Sep 26, 2017 at 01:50:00PM -0500, Mario Limonciello wrote:

> > These aren't needed to compile the module.

> >

> > Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>

> 

> Hrm...

> 

> CONFIG_DELL_SMBIOS=m

> 

> $ make drivers/platform/x86/dell-smbios.ko

> 

>   CC [M]  drivers/platform/x86/dell-smbios.o

> drivers/platform/x86/dell-smbios.c: In function ‘parse_da_table’:

> drivers/platform/x86/dell-smbios.c:142:18: error: implicit declaration of function

> ‘krealloc’ [-Werror=implicit-function-declaration]

>   new_da_tokens = krealloc(da_tokens, (da_num_tokens + tokens) *

>                   ^~~~~~~~

> drivers/platform/x86/dell-smbios.c:142:16: warning: assignment makes pointer

> from integer without a cast [-Wint-conversion]

>   new_da_tokens = krealloc(da_tokens, (da_num_tokens + tokens) *

>                 ^

> drivers/platform/x86/dell-smbios.c: In function ‘dell_smbios_init’:

> drivers/platform/x86/dell-smbios.c:193:2: error: implicit declaration of function

> ‘kfree’ [-Werror=implicit-function-declaration]

>   kfree(da_tokens);

>   ^~~~~

> 


Thanks, I've obviously been testing this and didn't notice it.
Not sure why that wasn't exploding on my end.  
Anyway I'll fix for v3.

> > ---

> >  drivers/platform/x86/dell-smbios.c | 3 ---

> >  1 file changed, 3 deletions(-)

> >

> > diff --git a/drivers/platform/x86/dell-smbios.c b/drivers/platform/x86/dell-

> smbios.c

> > index 0a5723468bff..6654ad44a04c 100644

> > --- a/drivers/platform/x86/dell-smbios.c

> > +++ b/drivers/platform/x86/dell-smbios.c

> > @@ -17,10 +17,7 @@

> >  #include <linux/module.h>

> >  #include <linux/dmi.h>

> >  #include <linux/err.h>

> > -#include <linux/gfp.h>

> >  #include <linux/mutex.h>

> > -#include <linux/slab.h>

> 

> Appears you do require slab.h...

> 

> > -#include <linux/io.h>

> >  #include "../../firmware/dcdbas.h"

> >  #include "dell-smbios.h"

> >

> > --

> > 2.14.1

> 

> 

> 

> >

> >

> 

> --

> Darren Hart

> VMware Open Source Technology Center
Darren Hart Sept. 27, 2017, 5:58 p.m. UTC | #3
On Wed, Sep 27, 2017 at 10:40:19AM -0700, Darren Hart wrote:
> On Tue, Sep 26, 2017 at 01:50:00PM -0500, Mario Limonciello wrote:
> > These aren't needed to compile the module.
> > 
> > Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
> 
> Hrm...
> 
> CONFIG_DELL_SMBIOS=m
> 
> $ make drivers/platform/x86/dell-smbios.ko
> 
>   CC [M]  drivers/platform/x86/dell-smbios.o
> drivers/platform/x86/dell-smbios.c: In function ‘parse_da_table’:
> drivers/platform/x86/dell-smbios.c:142:18: error: implicit declaration of function ‘krealloc’ [-Werror=implicit-function-declaration]
>   new_da_tokens = krealloc(da_tokens, (da_num_tokens + tokens) *
>                   ^~~~~~~~
> drivers/platform/x86/dell-smbios.c:142:16: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
>   new_da_tokens = krealloc(da_tokens, (da_num_tokens + tokens) *
>                 ^
> drivers/platform/x86/dell-smbios.c: In function ‘dell_smbios_init’:
> drivers/platform/x86/dell-smbios.c:193:2: error: implicit declaration of function ‘kfree’ [-Werror=implicit-function-declaration]
>   kfree(da_tokens);
>   ^~~~~
> 
> > ---
> >  drivers/platform/x86/dell-smbios.c | 3 ---
...
> > -#include <linux/slab.h>
> 
> Appears you do require slab.h...
> 

I've dropped this one line from this patch, and build is working again. Patches
1-7 look ready to go to me. I'm pushing these to my review branch from some
additional automated testing.

Let me know if there are any objections for 1-7. If we can get these queued now,
we can simplify the review effort for the major functional changes in 8-14.
kernel test robot Sept. 29, 2017, 2:59 p.m. UTC | #4
Hi Mario,

[auto build test ERROR on platform-drivers-x86/for-next]
[also build test ERROR on v4.14-rc2 next-20170928]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Mario-Limonciello/Introduce-support-for-Dell-SMBIOS-over-WMI/20170929-221513
base:   git://git.infradead.org/users/dvhart/linux-platform-drivers-x86.git for-next
config: i386-randconfig-x013-201739 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

Note: the linux-review/Mario-Limonciello/Introduce-support-for-Dell-SMBIOS-over-WMI/20170929-221513 HEAD 95464efdaabbd0db3ed21656ce0f227cfe01ef0c builds fine.
      It only hurts bisectibility.

All error/warnings (new ones prefixed by >>):

   drivers/platform/x86/dell-smbios.c: In function 'parse_da_table':
>> drivers/platform/x86/dell-smbios.c:142:18: error: implicit declaration of function 'krealloc' [-Werror=implicit-function-declaration]
     new_da_tokens = krealloc(da_tokens, (da_num_tokens + tokens) *
                     ^~~~~~~~
>> drivers/platform/x86/dell-smbios.c:142:16: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     new_da_tokens = krealloc(da_tokens, (da_num_tokens + tokens) *
                   ^
   drivers/platform/x86/dell-smbios.c: In function 'dell_smbios_init':
>> drivers/platform/x86/dell-smbios.c:193:2: error: implicit declaration of function 'kfree' [-Werror=implicit-function-declaration]
     kfree(da_tokens);
     ^~~~~
   cc1: some warnings being treated as errors

vim +/krealloc +142 drivers/platform/x86/dell-smbios.c

504b0259 Hans de Goede 2017-03-16  124  
2f9f26bd Michał Kępień 2016-01-22  125  static void __init parse_da_table(const struct dmi_header *dm)
2f9f26bd Michał Kępień 2016-01-22  126  {
2f9f26bd Michał Kępień 2016-01-22  127  	/* Final token is a terminator, so we don't want to copy it */
2f9f26bd Michał Kępień 2016-01-22  128  	int tokens = (dm->length-11)/sizeof(struct calling_interface_token)-1;
2f9f26bd Michał Kępień 2016-01-22  129  	struct calling_interface_token *new_da_tokens;
2f9f26bd Michał Kępień 2016-01-22  130  	struct calling_interface_structure *table =
2f9f26bd Michał Kępień 2016-01-22  131  		container_of(dm, struct calling_interface_structure, header);
2f9f26bd Michał Kępień 2016-01-22  132  
2f9f26bd Michał Kępień 2016-01-22  133  	/* 4 bytes of table header, plus 7 bytes of Dell header, plus at least
2f9f26bd Michał Kępień 2016-01-22  134  	   6 bytes of entry */
2f9f26bd Michał Kępień 2016-01-22  135  
2f9f26bd Michał Kępień 2016-01-22  136  	if (dm->length < 17)
2f9f26bd Michał Kępień 2016-01-22  137  		return;
2f9f26bd Michał Kępień 2016-01-22  138  
2f9f26bd Michał Kępień 2016-01-22  139  	da_command_address = table->cmdIOAddress;
2f9f26bd Michał Kępień 2016-01-22  140  	da_command_code = table->cmdIOCode;
2f9f26bd Michał Kępień 2016-01-22  141  
2f9f26bd Michał Kępień 2016-01-22 @142  	new_da_tokens = krealloc(da_tokens, (da_num_tokens + tokens) *
2f9f26bd Michał Kępień 2016-01-22  143  				 sizeof(struct calling_interface_token),
2f9f26bd Michał Kępień 2016-01-22  144  				 GFP_KERNEL);
2f9f26bd Michał Kępień 2016-01-22  145  
2f9f26bd Michał Kępień 2016-01-22  146  	if (!new_da_tokens)
2f9f26bd Michał Kępień 2016-01-22  147  		return;
2f9f26bd Michał Kępień 2016-01-22  148  	da_tokens = new_da_tokens;
2f9f26bd Michał Kępień 2016-01-22  149  
2f9f26bd Michał Kępień 2016-01-22  150  	memcpy(da_tokens+da_num_tokens, table->tokens,
2f9f26bd Michał Kępień 2016-01-22  151  	       sizeof(struct calling_interface_token) * tokens);
2f9f26bd Michał Kępień 2016-01-22  152  
2f9f26bd Michał Kępień 2016-01-22  153  	da_num_tokens += tokens;
2f9f26bd Michał Kępień 2016-01-22  154  }
2f9f26bd Michał Kępień 2016-01-22  155  
2f9f26bd Michał Kępień 2016-01-22  156  static void __init find_tokens(const struct dmi_header *dm, void *dummy)
2f9f26bd Michał Kępień 2016-01-22  157  {
2f9f26bd Michał Kępień 2016-01-22  158  	switch (dm->type) {
2f9f26bd Michał Kępień 2016-01-22  159  	case 0xd4: /* Indexed IO */
2f9f26bd Michał Kępień 2016-01-22  160  	case 0xd5: /* Protected Area Type 1 */
2f9f26bd Michał Kępień 2016-01-22  161  	case 0xd6: /* Protected Area Type 2 */
2f9f26bd Michał Kępień 2016-01-22  162  		break;
2f9f26bd Michał Kępień 2016-01-22  163  	case 0xda: /* Calling interface */
2f9f26bd Michał Kępień 2016-01-22  164  		parse_da_table(dm);
2f9f26bd Michał Kępień 2016-01-22  165  		break;
2f9f26bd Michał Kępień 2016-01-22  166  	}
2f9f26bd Michał Kępień 2016-01-22  167  }
2f9f26bd Michał Kępień 2016-01-22  168  
2f9f26bd Michał Kępień 2016-01-22  169  static int __init dell_smbios_init(void)
2f9f26bd Michał Kępień 2016-01-22  170  {
2f9f26bd Michał Kępień 2016-01-22  171  	int ret;
2f9f26bd Michał Kępień 2016-01-22  172  
2f9f26bd Michał Kępień 2016-01-22  173  	dmi_walk(find_tokens, NULL);
2f9f26bd Michał Kępień 2016-01-22  174  
2f9f26bd Michał Kępień 2016-01-22  175  	if (!da_tokens)  {
2f9f26bd Michał Kępień 2016-01-22  176  		pr_info("Unable to find dmi tokens\n");
2f9f26bd Michał Kępień 2016-01-22  177  		return -ENODEV;
2f9f26bd Michał Kępień 2016-01-22  178  	}
2f9f26bd Michał Kępień 2016-01-22  179  
2f9f26bd Michał Kępień 2016-01-22  180  	/*
2f9f26bd Michał Kępień 2016-01-22  181  	 * Allocate buffer below 4GB for SMI data--only 32-bit physical addr
2f9f26bd Michał Kępień 2016-01-22  182  	 * is passed to SMI handler.
2f9f26bd Michał Kępień 2016-01-22  183  	 */
2f9f26bd Michał Kępień 2016-01-22  184  	buffer = (void *)__get_free_page(GFP_KERNEL | GFP_DMA32);
2f9f26bd Michał Kępień 2016-01-22  185  	if (!buffer) {
2f9f26bd Michał Kępień 2016-01-22  186  		ret = -ENOMEM;
2f9f26bd Michał Kępień 2016-01-22  187  		goto fail_buffer;
2f9f26bd Michał Kępień 2016-01-22  188  	}
2f9f26bd Michał Kępień 2016-01-22  189  
2f9f26bd Michał Kępień 2016-01-22  190  	return 0;
2f9f26bd Michał Kępień 2016-01-22  191  
2f9f26bd Michał Kępień 2016-01-22  192  fail_buffer:
2f9f26bd Michał Kępień 2016-01-22 @193  	kfree(da_tokens);
2f9f26bd Michał Kępień 2016-01-22  194  	return ret;
2f9f26bd Michał Kępień 2016-01-22  195  }
2f9f26bd Michał Kępień 2016-01-22  196  

:::::: The code at line 142 was first introduced by commit
:::::: 2f9f26bd8614740b3c3b950394d945a99492a28e dell-laptop: extract SMBIOS-related code to a separate module

:::::: TO: Michał Kępień <kernel@kempniu.pl>
:::::: CC: Darren Hart <dvhart@linux.intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/platform/x86/dell-smbios.c b/drivers/platform/x86/dell-smbios.c
index 0a5723468bff..6654ad44a04c 100644
--- a/drivers/platform/x86/dell-smbios.c
+++ b/drivers/platform/x86/dell-smbios.c
@@ -17,10 +17,7 @@ 
 #include <linux/module.h>
 #include <linux/dmi.h>
 #include <linux/err.h>
-#include <linux/gfp.h>
 #include <linux/mutex.h>
-#include <linux/slab.h>
-#include <linux/io.h>
 #include "../../firmware/dcdbas.h"
 #include "dell-smbios.h"