aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Busch <keith.busch@intel.com>2015-11-28 10:49:22 -0500
committerJens Axboe <axboe@fb.com>2015-11-29 16:34:57 -0500
commitc4699e70d1db14119708dae76dac7c43e1e12988 (patch)
tree62ea32a6868e9e424de64067c1d6aadacfb8654f
parent77032ca66f86fa631b38b2e7feeb2b953e59f2f0 (diff)
lightnvm: Simplify config when disabled
We shouldn't compile an object file to get empty implementations; conforms to linux coding style on conditional compilation. Signed-off-by: Keith Busch <keith.busch@intel.com> Signed-off-by: Matias Bjørling <m@bjorling.me> Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--drivers/nvme/host/Makefile3
-rw-r--r--drivers/nvme/host/lightnvm.c13
-rw-r--r--drivers/nvme/host/nvme.h14
3 files changed, 16 insertions, 14 deletions
diff --git a/drivers/nvme/host/Makefile b/drivers/nvme/host/Makefile
index 219dc206fa5f..a5fe23952586 100644
--- a/drivers/nvme/host/Makefile
+++ b/drivers/nvme/host/Makefile
@@ -1,4 +1,5 @@
1 1
2obj-$(CONFIG_BLK_DEV_NVME) += nvme.o 2obj-$(CONFIG_BLK_DEV_NVME) += nvme.o
3 3
4nvme-y += pci.o scsi.o lightnvm.o 4lightnvm-$(CONFIG_NVM) := lightnvm.o
5nvme-y += pci.o scsi.o $(lightnvm-y)
diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index 9202d1a468d0..07451d6c6ae8 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -22,8 +22,6 @@
22 22
23#include "nvme.h" 23#include "nvme.h"
24 24
25#ifdef CONFIG_NVM
26
27#include <linux/nvme.h> 25#include <linux/nvme.h>
28#include <linux/bitops.h> 26#include <linux/bitops.h>
29#include <linux/lightnvm.h> 27#include <linux/lightnvm.h>
@@ -588,14 +586,3 @@ int nvme_nvm_ns_supported(struct nvme_ns *ns, struct nvme_id_ns *id)
588 586
589 return 0; 587 return 0;
590} 588}
591#else
592int nvme_nvm_register(struct request_queue *q, char *disk_name)
593{
594 return 0;
595}
596void nvme_nvm_unregister(struct request_queue *q, char *disk_name) {};
597int nvme_nvm_ns_supported(struct nvme_ns *ns, struct nvme_id_ns *id)
598{
599 return 0;
600}
601#endif /* CONFIG_NVM */
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index fdb4e5bad9ac..044253dca30a 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -136,8 +136,22 @@ int nvme_sg_io(struct nvme_ns *ns, struct sg_io_hdr __user *u_hdr);
136int nvme_sg_io32(struct nvme_ns *ns, unsigned long arg); 136int nvme_sg_io32(struct nvme_ns *ns, unsigned long arg);
137int nvme_sg_get_version_num(int __user *ip); 137int nvme_sg_get_version_num(int __user *ip);
138 138
139#ifdef CONFIG_NVM
139int nvme_nvm_ns_supported(struct nvme_ns *ns, struct nvme_id_ns *id); 140int nvme_nvm_ns_supported(struct nvme_ns *ns, struct nvme_id_ns *id);
140int nvme_nvm_register(struct request_queue *q, char *disk_name); 141int nvme_nvm_register(struct request_queue *q, char *disk_name);
141void nvme_nvm_unregister(struct request_queue *q, char *disk_name); 142void nvme_nvm_unregister(struct request_queue *q, char *disk_name);
143#else
144static inline int nvme_nvm_register(struct request_queue *q, char *disk_name)
145{
146 return 0;
147}
148
149static inline void nvme_nvm_unregister(struct request_queue *q, char *disk_name) {};
150
151static inline int nvme_nvm_ns_supported(struct nvme_ns *ns, struct nvme_id_ns *id)
152{
153 return 0;
154}
155#endif /* CONFIG_NVM */
142 156
143#endif /* _NVME_H */ 157#endif /* _NVME_H */