linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sbitmap, scsi/target: add seq_file forward declaration
@ 2018-07-06 13:23 Arnd Bergmann
  2018-07-06 17:07 ` Bart Van Assche
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2018-07-06 13:23 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: Jens Axboe, Felipe Balbi, Matthew Wilcox, linux-scsi,
	James E . J . Bottomley, Arnd Bergmann, Omar Sandoval, Ming Lei,
	Paolo Valente, linux-kernel

The target core runs into a warning in the linux/sbitmap.h
file in some configurations:

In file included from include/target/target_core_base.h:7,
                 from drivers/target/target_core_fabric_lib.c:41:
include/linux/sbitmap.h:331:46: error: 'struct seq_file' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
 void sbitmap_show(struct sbitmap *sb, struct seq_file *m);
                                              ^~~~~~~~

In general, headers should not depend on others being included first,
so this fixes it with a forward declaration for that struct name, but
we probably want to merge the patch through the scsi tree to help
bisection.

Fixes: 10e9cbb6b531 ("scsi: target: Convert target drivers to use sbitmap")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/sbitmap.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/sbitmap.h b/include/linux/sbitmap.h
index e6539536dea9..cc54b9f7ff8b 100644
--- a/include/linux/sbitmap.h
+++ b/include/linux/sbitmap.h
@@ -321,6 +321,8 @@ static inline int sbitmap_test_bit(struct sbitmap *sb, unsigned int bitnr)
 
 unsigned int sbitmap_weight(const struct sbitmap *sb);
 
+struct seq_file;
+
 /**
  * sbitmap_show() - Dump &struct sbitmap information to a &struct seq_file.
  * @sb: Bitmap to show.
-- 
2.9.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] sbitmap, scsi/target: add seq_file forward declaration
  2018-07-06 13:23 [PATCH] sbitmap, scsi/target: add seq_file forward declaration Arnd Bergmann
@ 2018-07-06 17:07 ` Bart Van Assche
  2018-07-06 20:18   ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Van Assche @ 2018-07-06 17:07 UTC (permalink / raw)
  To: arnd, martin.petersen
  Cc: linux-kernel, felipe.balbi, willy, paolo.valente, ming.lei,
	axboe, linux-scsi, osandov, jejb

On Fri, 2018-07-06 at 15:23 +0200, Arnd Bergmann wrote:
> The target core runs into a warning in the linux/sbitmap.h
> file in some configurations:
> 
> In file included from include/target/target_core_base.h:7,
>                  from drivers/target/target_core_fabric_lib.c:41:
> include/linux/sbitmap.h:331:46: error: 'struct seq_file' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
>  void sbitmap_show(struct sbitmap *sb, struct seq_file *m);
>                                               ^~~~~~~~
> 
> In general, headers should not depend on others being included first,
> so this fixes it with a forward declaration for that struct name, but
> we probably want to merge the patch through the scsi tree to help
> bisection.
> 
> Fixes: 10e9cbb6b531 ("scsi: target: Convert target drivers to use sbitmap")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  include/linux/sbitmap.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/linux/sbitmap.h b/include/linux/sbitmap.h
> index e6539536dea9..cc54b9f7ff8b 100644
> --- a/include/linux/sbitmap.h
> +++ b/include/linux/sbitmap.h
> @@ -321,6 +321,8 @@ static inline int sbitmap_test_bit(struct sbitmap *sb, unsigned int bitnr)
>  
>  unsigned int sbitmap_weight(const struct sbitmap *sb);
>  
> +struct seq_file;
> +
>  /**
>   * sbitmap_show() - Dump &struct sbitmap information to a &struct seq_file.
>   * @sb: Bitmap to show.

In many Linux kernel header files all forward declarations are grouped near
the start of the header file (after #includes and #defines and before structure
definitions). Should we follow that pattern in <linux/sbitmap.h>?

Thanks,

Bart.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] sbitmap, scsi/target: add seq_file forward declaration
  2018-07-06 17:07 ` Bart Van Assche
@ 2018-07-06 20:18   ` Arnd Bergmann
  0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2018-07-06 20:18 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: martin.petersen, linux-kernel, felipe.balbi, willy,
	paolo.valente, ming.lei, axboe, linux-scsi, osandov, jejb

On Fri, Jul 6, 2018 at 7:07 PM, Bart Van Assche <Bart.VanAssche@wdc.com> wrote:
> On Fri, 2018-07-06 at 15:23 +0200, Arnd Bergmann wrote:
>> The target core runs into a warning in the linux/sbitmap.h
>> file in some configurations:
>>
>> In file included from include/target/target_core_base.h:7,
>>                  from drivers/target/target_core_fabric_lib.c:41:
>> include/linux/sbitmap.h:331:46: error: 'struct seq_file' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
>>  void sbitmap_show(struct sbitmap *sb, struct seq_file *m);
>>                                               ^~~~~~~~
>>
>> In general, headers should not depend on others being included first,
>> so this fixes it with a forward declaration for that struct name, but
>> we probably want to merge the patch through the scsi tree to help
>> bisection.
>>
>> Fixes: 10e9cbb6b531 ("scsi: target: Convert target drivers to use sbitmap")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>>  include/linux/sbitmap.h | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/include/linux/sbitmap.h b/include/linux/sbitmap.h
>> index e6539536dea9..cc54b9f7ff8b 100644
>> --- a/include/linux/sbitmap.h
>> +++ b/include/linux/sbitmap.h
>> @@ -321,6 +321,8 @@ static inline int sbitmap_test_bit(struct sbitmap *sb, unsigned int bitnr)
>>
>>  unsigned int sbitmap_weight(const struct sbitmap *sb);
>>
>> +struct seq_file;
>> +
>>  /**
>>   * sbitmap_show() - Dump &struct sbitmap information to a &struct seq_file.
>>   * @sb: Bitmap to show.
>
> In many Linux kernel header files all forward declarations are grouped near
> the start of the header file (after #includes and #defines and before structure
> definitions). Should we follow that pattern in <linux/sbitmap.h>?

I couldn't find any other such declaration in this header, so I just put it
close to where it's first used, which is the other common way to do it.
I checked all of include/linux and found that you are right, a clear
majority of the headers just pull all struct declarations in the front.

     Arnd

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-07-06 20:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-06 13:23 [PATCH] sbitmap, scsi/target: add seq_file forward declaration Arnd Bergmann
2018-07-06 17:07 ` Bart Van Assche
2018-07-06 20:18   ` Arnd Bergmann

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).