diff options
author | Arnd Bergmann <arnd@arndb.de> | 2018-02-02 08:12:18 -0500 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2018-02-13 21:37:01 -0500 |
commit | d9ea463a1cc7f0a6254cbd8228e1948c345a4acd (patch) | |
tree | b38b55d94a8223912d927f254f89898b327b3569 /drivers/scsi/qedf | |
parent | bc2e1299a828a13a44c3140a3c0a183c87872606 (diff) |
scsi: qedf: fix LTO-enabled build
The prototype for qedf_dbg_fops/qedf_debugfs_ops doesn't match the definition,
which causes the final link to fail with link-time optimizations:
drivers/scsi/qedf/qedf_main.c:34: error: type of 'qedf_dbg_fops' does not match original declaration [-Werror=lto-type-mismatch]
extern struct file_operations qedf_dbg_fops;
drivers/scsi/qedf/qedf_debugfs.c:443: note: 'qedf_dbg_fops' was previously declared here
const struct file_operations qedf_dbg_fops[] = {
drivers/scsi/qedf/qedf_main.c:33: error: type of 'qedf_debugfs_ops' does not match original declaration [-Werror=lto-type-mismatch]
extern struct qedf_debugfs_ops qedf_debugfs_ops;
drivers/scsi/qedf/qedf_debugfs.c:102: note: 'qedf_debugfs_ops' was previously declared here
struct qedf_debugfs_ops qedf_debugfs_ops[] = {
This corrects the prototype and moves it into a shared header file where it
belongs. The file operations can also be marked 'const' like the
qedf_debugfs_ops.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Chad Dupuis <chad.dupuis@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/qedf')
-rw-r--r-- | drivers/scsi/qedf/qedf_dbg.h | 17 | ||||
-rw-r--r-- | drivers/scsi/qedf/qedf_debugfs.c | 6 | ||||
-rw-r--r-- | drivers/scsi/qedf/qedf_main.c | 8 |
3 files changed, 16 insertions, 15 deletions
diff --git a/drivers/scsi/qedf/qedf_dbg.h b/drivers/scsi/qedf/qedf_dbg.h index 50083cae84c3..77c27e888969 100644 --- a/drivers/scsi/qedf/qedf_dbg.h +++ b/drivers/scsi/qedf/qedf_dbg.h | |||
@@ -116,6 +116,14 @@ extern int qedf_create_sysfs_attr(struct Scsi_Host *shost, | |||
116 | extern void qedf_remove_sysfs_attr(struct Scsi_Host *shost, | 116 | extern void qedf_remove_sysfs_attr(struct Scsi_Host *shost, |
117 | struct sysfs_bin_attrs *iter); | 117 | struct sysfs_bin_attrs *iter); |
118 | 118 | ||
119 | struct qedf_debugfs_ops { | ||
120 | char *name; | ||
121 | struct qedf_list_of_funcs *qedf_funcs; | ||
122 | }; | ||
123 | |||
124 | extern const struct qedf_debugfs_ops qedf_debugfs_ops[]; | ||
125 | extern const struct file_operations qedf_dbg_fops[]; | ||
126 | |||
119 | #ifdef CONFIG_DEBUG_FS | 127 | #ifdef CONFIG_DEBUG_FS |
120 | /* DebugFS related code */ | 128 | /* DebugFS related code */ |
121 | struct qedf_list_of_funcs { | 129 | struct qedf_list_of_funcs { |
@@ -123,11 +131,6 @@ struct qedf_list_of_funcs { | |||
123 | ssize_t (*oper_func)(struct qedf_dbg_ctx *qedf); | 131 | ssize_t (*oper_func)(struct qedf_dbg_ctx *qedf); |
124 | }; | 132 | }; |
125 | 133 | ||
126 | struct qedf_debugfs_ops { | ||
127 | char *name; | ||
128 | struct qedf_list_of_funcs *qedf_funcs; | ||
129 | }; | ||
130 | |||
131 | #define qedf_dbg_fileops(drv, ops) \ | 134 | #define qedf_dbg_fileops(drv, ops) \ |
132 | { \ | 135 | { \ |
133 | .owner = THIS_MODULE, \ | 136 | .owner = THIS_MODULE, \ |
@@ -147,8 +150,8 @@ struct qedf_debugfs_ops { | |||
147 | } | 150 | } |
148 | 151 | ||
149 | extern void qedf_dbg_host_init(struct qedf_dbg_ctx *qedf, | 152 | extern void qedf_dbg_host_init(struct qedf_dbg_ctx *qedf, |
150 | struct qedf_debugfs_ops *dops, | 153 | const struct qedf_debugfs_ops *dops, |
151 | struct file_operations *fops); | 154 | const struct file_operations *fops); |
152 | extern void qedf_dbg_host_exit(struct qedf_dbg_ctx *qedf); | 155 | extern void qedf_dbg_host_exit(struct qedf_dbg_ctx *qedf); |
153 | extern void qedf_dbg_init(char *drv_name); | 156 | extern void qedf_dbg_init(char *drv_name); |
154 | extern void qedf_dbg_exit(void); | 157 | extern void qedf_dbg_exit(void); |
diff --git a/drivers/scsi/qedf/qedf_debugfs.c b/drivers/scsi/qedf/qedf_debugfs.c index 2b1ef3075e93..c539a7ae3a7e 100644 --- a/drivers/scsi/qedf/qedf_debugfs.c +++ b/drivers/scsi/qedf/qedf_debugfs.c | |||
@@ -23,8 +23,8 @@ static struct dentry *qedf_dbg_root; | |||
23 | **/ | 23 | **/ |
24 | void | 24 | void |
25 | qedf_dbg_host_init(struct qedf_dbg_ctx *qedf, | 25 | qedf_dbg_host_init(struct qedf_dbg_ctx *qedf, |
26 | struct qedf_debugfs_ops *dops, | 26 | const struct qedf_debugfs_ops *dops, |
27 | struct file_operations *fops) | 27 | const struct file_operations *fops) |
28 | { | 28 | { |
29 | char host_dirname[32]; | 29 | char host_dirname[32]; |
30 | struct dentry *file_dentry = NULL; | 30 | struct dentry *file_dentry = NULL; |
@@ -99,7 +99,7 @@ qedf_dbg_exit(void) | |||
99 | qedf_dbg_root = NULL; | 99 | qedf_dbg_root = NULL; |
100 | } | 100 | } |
101 | 101 | ||
102 | struct qedf_debugfs_ops qedf_debugfs_ops[] = { | 102 | const struct qedf_debugfs_ops qedf_debugfs_ops[] = { |
103 | { "fp_int", NULL }, | 103 | { "fp_int", NULL }, |
104 | { "io_trace", NULL }, | 104 | { "io_trace", NULL }, |
105 | { "debug", NULL }, | 105 | { "debug", NULL }, |
diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index ccd9a08ea030..284ccb566b19 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/if_vlan.h> | 23 | #include <linux/if_vlan.h> |
24 | #include <linux/cpu.h> | 24 | #include <linux/cpu.h> |
25 | #include "qedf.h" | 25 | #include "qedf.h" |
26 | #include "qedf_dbg.h" | ||
26 | #include <uapi/linux/pci_regs.h> | 27 | #include <uapi/linux/pci_regs.h> |
27 | 28 | ||
28 | const struct qed_fcoe_ops *qed_ops; | 29 | const struct qed_fcoe_ops *qed_ops; |
@@ -30,9 +31,6 @@ const struct qed_fcoe_ops *qed_ops; | |||
30 | static int qedf_probe(struct pci_dev *pdev, const struct pci_device_id *id); | 31 | static int qedf_probe(struct pci_dev *pdev, const struct pci_device_id *id); |
31 | static void qedf_remove(struct pci_dev *pdev); | 32 | static void qedf_remove(struct pci_dev *pdev); |
32 | 33 | ||
33 | extern struct qedf_debugfs_ops qedf_debugfs_ops; | ||
34 | extern struct file_operations qedf_dbg_fops; | ||
35 | |||
36 | /* | 34 | /* |
37 | * Driver module parameters. | 35 | * Driver module parameters. |
38 | */ | 36 | */ |
@@ -3155,8 +3153,8 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) | |||
3155 | } | 3153 | } |
3156 | 3154 | ||
3157 | #ifdef CONFIG_DEBUG_FS | 3155 | #ifdef CONFIG_DEBUG_FS |
3158 | qedf_dbg_host_init(&(qedf->dbg_ctx), &qedf_debugfs_ops, | 3156 | qedf_dbg_host_init(&(qedf->dbg_ctx), qedf_debugfs_ops, |
3159 | &qedf_dbg_fops); | 3157 | qedf_dbg_fops); |
3160 | #endif | 3158 | #endif |
3161 | 3159 | ||
3162 | /* Start LL2 */ | 3160 | /* Start LL2 */ |