Skip to content

Commit f9e9115

Browse files
calebsanderkeithbusch
authored andcommitted
nvme: take const cmd pointer in read-only helpers
nvme_is_fabrics() and nvme_is_write() only read struct nvme_command, so take it by const pointer. This allows callers to pass a const pointer and communicates that these functions don't modify the command. Signed-off-by: Caleb Sander <csander@purestorage.com> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Keith Busch <kbusch@kernel.org>
1 parent 6f9a71c commit f9e9115

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

include/linux/nvme.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1812,7 +1812,7 @@ struct nvme_command {
18121812
};
18131813
};
18141814

1815-
static inline bool nvme_is_fabrics(struct nvme_command *cmd)
1815+
static inline bool nvme_is_fabrics(const struct nvme_command *cmd)
18161816
{
18171817
return cmd->common.opcode == nvme_fabrics_command;
18181818
}
@@ -1831,7 +1831,7 @@ struct nvme_error_slot {
18311831
__u8 resv2[24];
18321832
};
18331833

1834-
static inline bool nvme_is_write(struct nvme_command *cmd)
1834+
static inline bool nvme_is_write(const struct nvme_command *cmd)
18351835
{
18361836
/*
18371837
* What a mess...

0 commit comments

Comments
 (0)