[PATCH v5 03/15] include/scsi/scsicam.h: forward-declare struct block_device

Max Kellermann
2024-04-30T15:29:50Z

After eliminating includes of linux/mm.h, the following build failure
occurred:

In file included from drivers/scsi/fdomain.c:87:
./include/scsi/scsicam.h:16:31: error: 'struct block_device' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
16 | int scsicam_bios_param(struct block_device *bdev, sector_t capacity, int *ip);
| ^~~~~~~~~~~~
./include/scsi/scsicam.h:17:27: error: 'struct block_device' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
17 | bool scsi_partsize(struct block_device *bdev, sector_t capacity, int geom[3]);
| ^~~~~~~~~~~~
./include/scsi/scsicam.h:18:40: error: 'struct block_device' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
18 | unsigned char *scsi_bios_ptable(struct block_device *bdev);
| ^~~~~~~~~~~~
drivers/scsi/fdomain.c: In function 'fdomain_biosparam':
drivers/scsi/fdomain.c:475:45: error: passing argument 1 of 'scsi_bios_ptable' from incompatible pointer type [-Werror=incompatible-pointer-types]
475 | unsigned char *p = scsi_bios_ptable(bdev);
| ^~~~
| |
| struct block_device *
./include/scsi/scsicam.h:18:54: note: expected 'struct block_device *' but argument is of type 'struct block_device *'
18 | unsigned char *scsi_bios_ptable(struct block_device *bdev);
| ~~~~~~~~~~~~~~~~~~~~~^~~~

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
---
include/scsi/scsicam.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/include/scsi/scsicam.h b/include/scsi/scsicam.h
index 6eb9fb7a57d0..c0de038b76b5 100644
--- a/include/scsi/scsicam.h
+++ b/include/scsi/scsicam.h
@@ -16,6 +16,8 @@

#include <linux/types.h> // for sector_t

+struct block_device;
+
int scsicam_bios_param(struct block_device *bdev, sector_t capacity, int *ip);
bool scsi_partsize(struct block_device *bdev, sector_t capacity, int geom[3]);
unsigned char *scsi_bios_ptable(struct block_device *bdev);
--
2.39.2