Skip to content

Commit d422f40

Browse files
committed
zram: only make zram_wb_devops for CONFIG_ZRAM_WRITEBACK
If writeback isn't configured, then we get the following warning when compiling zram: drivers/block/zram/zram_drv.c:1824:45: warning: unused variable 'zram_wb_devops' [-Wunused-const-variable] Make sure we only define the block_device_operations if that option is enabled. Link: https://lore.kernel.org/lkml/202111261614.gCJMqcyh-lkp@intel.com/ Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 98b26a0 commit d422f40

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/block/zram/zram_drv.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,12 +1853,14 @@ static const struct block_device_operations zram_devops = {
18531853
.owner = THIS_MODULE
18541854
};
18551855

1856+
#ifdef CONFIG_ZRAM_WRITEBACK
18561857
static const struct block_device_operations zram_wb_devops = {
18571858
.open = zram_open,
18581859
.submit_bio = zram_submit_bio,
18591860
.swap_slot_free_notify = zram_slot_free_notify,
18601861
.owner = THIS_MODULE
18611862
};
1863+
#endif
18621864

18631865
static DEVICE_ATTR_WO(compact);
18641866
static DEVICE_ATTR_RW(disksize);

0 commit comments

Comments
 (0)