bsg: Fix build error with CONFIG_BLK_DEV_BSG_COMMON=m
Subsystems (2)
PATCH 1/1 bsg: Fix build error with CONFIG_BLK_DEV_BSG_COMMON=m
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 whenCONFIG_BLK_DEV_BSG_COMMON is y or m.
--- include/linux/bsg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/bsg.h +1 -1
@@ -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
Signature · 1 line
2.32.0.264.g75ae10bc75
Quoted 24 lines · Nathan Chancellor
When
CONFIG_BLK_DEV_BSG_COMMONis enabled as a module, which can happen whenCONFIG_SCSI=mandCONFIG_BLK_DEV_BSGLIB=n, the following error occurs:In file included from
arch/x86/kernel/asm-offsets.c:13:
In file included frominclude/linux/suspend.h:5:
In file included frominclude/linux/swap.h:9:
In file included frominclude/linux/memcontrol.h:22:
In file included frominclude/linux/writeback.h:14:
In file included frominclude/linux/blk-cgroup.h:23:include/linux/blkdev.h:539:26: error: field has incomplete type 'structbsg_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_deviceis kept under an #ifdef directive, which does not work whenCONFIG_BLK_DEV_BSG_COMMONis a module, as the define isCONFIG_BLK_DEV_BSG_COMMON_MODULE.
Quoted 6 lines
Use
IS_ENABLEDinstead, which evaluates to 1 whenCONFIG_BLK_DEV_BSG_COMMONis y or m.Fixes 78011042684d ("scsi: bsg: Move bsg_scsi_ops to drivers/scsi/")Reported-by kernel test robot <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>
Looks fine. Although I have a larger series pending here:
https://lore.kernel.org/linux-scsi/[email protected]/T/#t
that should also fix this issue as a byproduct.