All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bsg: Fix build error with CONFIG_BLK_DEV_BSG_COMMON=m
@ 2021-07-30  1:21 Nathan Chancellor
  2021-07-30  7:27 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2021-07-30  1:21 UTC (permalink / raw)
  To: FUJITA Tomonori, Martin K. Petersen, Christoph Hellwig
  Cc: linux-scsi, linux-kernel, Nathan Chancellor, kernel test robot

When CONFIG_BLK_DEV_BSG_COMMON is enabled as a module, which can happen
when CONFIG_SCSI=m and CONFIG_BLK_DEV_BSGLIB=n, the following error
occurs:

In file included from arch/x86/kernel/asm-offsets.c:13:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:22:
In file included from include/linux/writeback.h:14:
In file included from include/linux/blk-cgroup.h:23:
include/linux/blkdev.h:539:26: error: field has incomplete type 'struct
bsg_class_device'
        struct bsg_class_device bsg_dev;
                                ^
include/linux/blkdev.h:539:9: note: forward declaration of 'struct
bsg_class_device'
        struct bsg_class_device bsg_dev;
               ^
1 error generated.

The definition of struct bsg_class_device is kept under an #ifdef
directive, which does not work when CONFIG_BLK_DEV_BSG_COMMON is a
module, as the define is CONFIG_BLK_DEV_BSG_COMMON_MODULE.

Use IS_ENABLED instead, which evaluates to 1 when
CONFIG_BLK_DEV_BSG_COMMON is y or m.

Fixes: 78011042684d ("scsi: bsg: Move bsg_scsi_ops to drivers/scsi/")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 include/linux/bsg.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/bsg.h b/include/linux/bsg.h
index b887da20bd41..9602ae3ab01b 100644
--- a/include/linux/bsg.h
+++ b/include/linux/bsg.h
@@ -7,7 +7,7 @@
 struct request;
 struct request_queue;
 
-#ifdef CONFIG_BLK_DEV_BSG_COMMON
+#if IS_ENABLED(CONFIG_BLK_DEV_BSG_COMMON)
 struct bsg_ops {
 	int	(*check_proto)(struct sg_io_v4 *hdr);
 	int	(*fill_hdr)(struct request *rq, struct sg_io_v4 *hdr,

base-commit: 08dc2f9b53afbbc897bc895aa41906194f5af1cf
-- 
2.32.0.264.g75ae10bc75


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

* Re: [PATCH] bsg: Fix build error with CONFIG_BLK_DEV_BSG_COMMON=m
  2021-07-30  1:21 [PATCH] bsg: Fix build error with CONFIG_BLK_DEV_BSG_COMMON=m Nathan Chancellor
@ 2021-07-30  7:27 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2021-07-30  7:27 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: FUJITA Tomonori, Martin K. Petersen, Christoph Hellwig,
	linux-scsi, linux-kernel, kernel test robot

On Thu, Jul 29, 2021 at 06:21:08PM -0700, Nathan Chancellor wrote:
> When CONFIG_BLK_DEV_BSG_COMMON is enabled as a module, which can happen
> when CONFIG_SCSI=m and CONFIG_BLK_DEV_BSGLIB=n, the following error
> occurs:
> 
> In file included from arch/x86/kernel/asm-offsets.c:13:
> In file included from include/linux/suspend.h:5:
> In file included from include/linux/swap.h:9:
> In file included from include/linux/memcontrol.h:22:
> In file included from include/linux/writeback.h:14:
> In file included from include/linux/blk-cgroup.h:23:
> include/linux/blkdev.h:539:26: error: field has incomplete type 'struct
> bsg_class_device'
>         struct bsg_class_device bsg_dev;
>                                 ^
> include/linux/blkdev.h:539:9: note: forward declaration of 'struct
> bsg_class_device'
>         struct bsg_class_device bsg_dev;
>                ^
> 1 error generated.
> 
> The definition of struct bsg_class_device is kept under an #ifdef
> directive, which does not work when CONFIG_BLK_DEV_BSG_COMMON is a
> module, as the define is CONFIG_BLK_DEV_BSG_COMMON_MODULE.
> 
> Use IS_ENABLED instead, which evaluates to 1 when
> CONFIG_BLK_DEV_BSG_COMMON is y or m.
> 
> Fixes: 78011042684d ("scsi: bsg: Move bsg_scsi_ops to drivers/scsi/")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Looks fine.  Although I have a larger series pending here:

https://lore.kernel.org/linux-scsi/20210729064845.1044147-1-hch@lst.de/T/#t

that should also fix this issue as a byproduct.

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

end of thread, other threads:[~2021-07-30  7:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-30  1:21 [PATCH] bsg: Fix build error with CONFIG_BLK_DEV_BSG_COMMON=m Nathan Chancellor
2021-07-30  7:27 ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.