mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: linux-scsi@vger.kernel.org,
	"James E . J . Bottomley" <jejb@linux.vnet.ibm.com>,
	QLogic-Storage-Upstream@cavium.com,
	"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Nicolas Pitre <nico@linaro.org>, Andi Kleen <ak@linux.intel.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Manish Rangankar <Manish.Rangankar@cavium.com>,
	Tomer Tayar <Tomer.Tayar@cavium.com>,
	"David S. Miller" <davem@davemloft.net>,
	Ariel Elior <Ariel.Elior@cavium.com>,
	Arun Easi <arun.easi@cavium.com>,
	Nilesh Javali <nilesh.javali@cavium.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 5/6] scsi: qedi: fix building with LTO
Date: Fri,  2 Feb 2018 14:12:19 +0100	[thread overview]
Message-ID: <20180202131225.1658853-6-arnd@arndb.de> (raw)
In-Reply-To: <20180202131225.1658853-1-arnd@arndb.de>

When link-time optimizations are enabled, qedi fails to build because
of mismatched prototypes:

drivers/scsi/qedi/qedi_gbl.h:27:37: error: type of 'qedi_dbg_fops' does not match original declaration [-Werror=lto-type-mismatch]
 extern const struct file_operations qedi_dbg_fops;
                                     ^
drivers/scsi/qedi/qedi_debugfs.c:239:30: note: 'qedi_dbg_fops' was previously declared here
 const struct file_operations qedi_dbg_fops[] = {
                              ^
drivers/scsi/qedi/qedi_gbl.h:26:32: error: type of 'qedi_debugfs_ops' does not match original declaration [-Werror=lto-type-mismatch]
 extern struct qedi_debugfs_ops qedi_debugfs_ops;
                                ^
drivers/scsi/qedi/qedi_debugfs.c:102:25: note: 'qedi_debugfs_ops' was previously declared here
 struct qedi_debugfs_ops qedi_debugfs_ops[] = {

This changes the declaration to match the definition, and adapts the
users as necessary. Since both array can be constant here, I'm adding
the 'const' everywhere for consistency.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/scsi/qedi/qedi_dbg.h     | 2 +-
 drivers/scsi/qedi/qedi_debugfs.c | 4 ++--
 drivers/scsi/qedi/qedi_gbl.h     | 4 ++--
 drivers/scsi/qedi/qedi_main.c    | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/qedi/qedi_dbg.h b/drivers/scsi/qedi/qedi_dbg.h
index c55572badfb0..358f40567849 100644
--- a/drivers/scsi/qedi/qedi_dbg.h
+++ b/drivers/scsi/qedi/qedi_dbg.h
@@ -134,7 +134,7 @@ struct qedi_debugfs_ops {
 }
 
 void qedi_dbg_host_init(struct qedi_dbg_ctx *qedi,
-			struct qedi_debugfs_ops *dops,
+			const struct qedi_debugfs_ops *dops,
 			const struct file_operations *fops);
 void qedi_dbg_host_exit(struct qedi_dbg_ctx *qedi);
 void qedi_dbg_init(char *drv_name);
diff --git a/drivers/scsi/qedi/qedi_debugfs.c b/drivers/scsi/qedi/qedi_debugfs.c
index fd8a1eea3163..fd914ca4149a 100644
--- a/drivers/scsi/qedi/qedi_debugfs.c
+++ b/drivers/scsi/qedi/qedi_debugfs.c
@@ -19,7 +19,7 @@ static struct dentry *qedi_dbg_root;
 
 void
 qedi_dbg_host_init(struct qedi_dbg_ctx *qedi,
-		   struct qedi_debugfs_ops *dops,
+		   const struct qedi_debugfs_ops *dops,
 		   const struct file_operations *fops)
 {
 	char host_dirname[32];
@@ -99,7 +99,7 @@ static struct qedi_list_of_funcs qedi_dbg_do_not_recover_ops[] = {
 	{ NULL, NULL }
 };
 
-struct qedi_debugfs_ops qedi_debugfs_ops[] = {
+const struct qedi_debugfs_ops qedi_debugfs_ops[] = {
 	{ "gbl_ctx", NULL },
 	{ "do_not_recover", qedi_dbg_do_not_recover_ops},
 	{ "io_trace", NULL },
diff --git a/drivers/scsi/qedi/qedi_gbl.h b/drivers/scsi/qedi/qedi_gbl.h
index f5b5a31999aa..a2aa06ed1620 100644
--- a/drivers/scsi/qedi/qedi_gbl.h
+++ b/drivers/scsi/qedi/qedi_gbl.h
@@ -23,8 +23,8 @@ extern uint qedi_io_tracing;
 extern struct scsi_host_template qedi_host_template;
 extern struct iscsi_transport qedi_iscsi_transport;
 extern const struct qed_iscsi_ops *qedi_ops;
-extern struct qedi_debugfs_ops qedi_debugfs_ops;
-extern const struct file_operations qedi_dbg_fops;
+extern const struct qedi_debugfs_ops qedi_debugfs_ops[];
+extern const struct file_operations qedi_dbg_fops[];
 extern struct device_attribute *qedi_shost_attrs[];
 
 int qedi_alloc_sq(struct qedi_ctx *qedi, struct qedi_endpoint *ep);
diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
index 029e2e69b29f..e992f9d3ef00 100644
--- a/drivers/scsi/qedi/qedi_main.c
+++ b/drivers/scsi/qedi/qedi_main.c
@@ -2303,8 +2303,8 @@ static int __qedi_probe(struct pci_dev *pdev, int mode)
 	}
 
 #ifdef CONFIG_DEBUG_FS
-	qedi_dbg_host_init(&qedi->dbg_ctx, &qedi_debugfs_ops,
-			   &qedi_dbg_fops);
+	qedi_dbg_host_init(&qedi->dbg_ctx, qedi_debugfs_ops,
+			   qedi_dbg_fops);
 #endif
 	QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
 		  "QLogic FastLinQ iSCSI Module qedi %s, FW %d.%d.%d.%d\n",
-- 
2.9.0

  parent reply	other threads:[~2018-02-02 13:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180202131225.1658853-1-arnd@arndb.de>
2018-02-02 13:12 ` [PATCH 1/6] scsi: fc_encode: work around strncpy size warnings Arnd Bergmann
2018-02-02 13:12 ` [PATCH 2/6] scsi: NCR53c406a: avoid section mismatch with LTO Arnd Bergmann
2018-02-09 23:47   ` Martin K. Petersen
2018-02-02 13:12 ` [PATCH 3/6] scsi: sym53c416: " Arnd Bergmann
2018-02-09 23:47   ` Martin K. Petersen
2018-02-02 13:12 ` [PATCH 4/6] scsi: qedf: fix LTO-enabled build Arnd Bergmann
2018-02-07 15:38   ` Chad Dupuis
2018-02-09 23:24   ` Martin K. Petersen
2018-02-02 13:12 ` Arnd Bergmann [this message]
2018-02-05  6:08   ` [PATCH 5/6] scsi: qedi: fix building with LTO Rangankar, Manish
2018-02-07  1:24   ` Martin K. Petersen
2018-02-02 13:12 ` [PATCH 6/6] scsi: qedf: use correct strncpy() size Arnd Bergmann
2018-02-05  2:56   ` kbuild test robot
2018-02-07 16:26   ` Chad Dupuis
2018-02-09 23:36   ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180202131225.1658853-6-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=Ariel.Elior@cavium.com \
    --cc=Manish.Rangankar@cavium.com \
    --cc=QLogic-Storage-Upstream@cavium.com \
    --cc=Tomer.Tayar@cavium.com \
    --cc=ak@linux.intel.com \
    --cc=arun.easi@cavium.com \
    --cc=davem@davemloft.net \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=nico@linaro.org \
    --cc=nilesh.javali@cavium.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®