aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-03-31 01:42:38 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-04-09 14:13:18 -0400
commitcac197031ce274efff8a5abea811b9d69ae3d740 (patch)
tree09f3a4daf73017f235721205837c6f545dfb8cd6
parent09dae7fc57a010288875ef46a44e30d16cedd232 (diff)
fusion: switch to ->show_info()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--drivers/message/fusion/mptfc.c2
-rw-r--r--drivers/message/fusion/mptsas.c2
-rw-r--r--drivers/message/fusion/mptscsih.c98
-rw-r--r--drivers/message/fusion/mptscsih.h2
-rw-r--r--drivers/message/fusion/mptspi.c2
5 files changed, 11 insertions, 95 deletions
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index c13cd9bc590b..fd75108c355e 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -109,7 +109,7 @@ static int mptfc_host_reset(struct scsi_cmnd *SCpnt);
109static struct scsi_host_template mptfc_driver_template = { 109static struct scsi_host_template mptfc_driver_template = {
110 .module = THIS_MODULE, 110 .module = THIS_MODULE,
111 .proc_name = "mptfc", 111 .proc_name = "mptfc",
112 .proc_info = mptscsih_proc_info, 112 .show_info = mptscsih_show_info,
113 .name = "MPT FC Host", 113 .name = "MPT FC Host",
114 .info = mptscsih_info, 114 .info = mptscsih_info,
115 .queuecommand = mptfc_qcmd, 115 .queuecommand = mptfc_qcmd,
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index fa43c391c8ed..ffee6f781e30 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -1977,7 +1977,7 @@ done:
1977static struct scsi_host_template mptsas_driver_template = { 1977static struct scsi_host_template mptsas_driver_template = {
1978 .module = THIS_MODULE, 1978 .module = THIS_MODULE,
1979 .proc_name = "mptsas", 1979 .proc_name = "mptsas",
1980 .proc_info = mptscsih_proc_info, 1980 .show_info = mptscsih_show_info,
1981 .name = "MPT SAS Host", 1981 .name = "MPT SAS Host",
1982 .info = mptscsih_info, 1982 .info = mptscsih_info,
1983 .queuecommand = mptsas_qcmd, 1983 .queuecommand = mptsas_qcmd,
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index 164afa71bba7..727819cc7034 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -1284,101 +1284,17 @@ mptscsih_info(struct Scsi_Host *SChost)
1284 return h->info_kbuf; 1284 return h->info_kbuf;
1285} 1285}
1286 1286
1287struct info_str { 1287int mptscsih_show_info(struct seq_file *m, struct Scsi_Host *host)
1288 char *buffer;
1289 int length;
1290 int offset;
1291 int pos;
1292};
1293
1294static void
1295mptscsih_copy_mem_info(struct info_str *info, char *data, int len)
1296{
1297 if (info->pos + len > info->length)
1298 len = info->length - info->pos;
1299
1300 if (info->pos + len < info->offset) {
1301 info->pos += len;
1302 return;
1303 }
1304
1305 if (info->pos < info->offset) {
1306 data += (info->offset - info->pos);
1307 len -= (info->offset - info->pos);
1308 }
1309
1310 if (len > 0) {
1311 memcpy(info->buffer + info->pos, data, len);
1312 info->pos += len;
1313 }
1314}
1315
1316static int
1317mptscsih_copy_info(struct info_str *info, char *fmt, ...)
1318{
1319 va_list args;
1320 char buf[81];
1321 int len;
1322
1323 va_start(args, fmt);
1324 len = vsprintf(buf, fmt, args);
1325 va_end(args);
1326
1327 mptscsih_copy_mem_info(info, buf, len);
1328 return len;
1329}
1330
1331static int
1332mptscsih_host_info(MPT_ADAPTER *ioc, char *pbuf, off_t offset, int len)
1333{
1334 struct info_str info;
1335
1336 info.buffer = pbuf;
1337 info.length = len;
1338 info.offset = offset;
1339 info.pos = 0;
1340
1341 mptscsih_copy_info(&info, "%s: %s, ", ioc->name, ioc->prod_name);
1342 mptscsih_copy_info(&info, "%s%08xh, ", MPT_FW_REV_MAGIC_ID_STRING, ioc->facts.FWVersion.Word);
1343 mptscsih_copy_info(&info, "Ports=%d, ", ioc->facts.NumberOfPorts);
1344 mptscsih_copy_info(&info, "MaxQ=%d\n", ioc->req_depth);
1345
1346 return ((info.pos > info.offset) ? info.pos - info.offset : 0);
1347}
1348
1349/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1350/**
1351 * mptscsih_proc_info - Return information about MPT adapter
1352 * @host: scsi host struct
1353 * @buffer: if write, user data; if read, buffer for user
1354 * @start: returns the buffer address
1355 * @offset: if write, 0; if read, the current offset into the buffer from
1356 * the previous read.
1357 * @length: if write, return length;
1358 * @func: write = 1; read = 0
1359 *
1360 * (linux scsi_host_template.info routine)
1361 */
1362int
1363mptscsih_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset,
1364 int length, int func)
1365{ 1288{
1366 MPT_SCSI_HOST *hd = shost_priv(host); 1289 MPT_SCSI_HOST *hd = shost_priv(host);
1367 MPT_ADAPTER *ioc = hd->ioc; 1290 MPT_ADAPTER *ioc = hd->ioc;
1368 int size = 0;
1369 1291
1370 if (func) { 1292 seq_printf(m, "%s: %s, ", ioc->name, ioc->prod_name);
1371 /* 1293 seq_printf(m, "%s%08xh, ", MPT_FW_REV_MAGIC_ID_STRING, ioc->facts.FWVersion.Word);
1372 * write is not supported 1294 seq_printf(m, "Ports=%d, ", ioc->facts.NumberOfPorts);
1373 */ 1295 seq_printf(m, "MaxQ=%d\n", ioc->req_depth);
1374 } else {
1375 if (start)
1376 *start = buffer;
1377
1378 size = mptscsih_host_info(ioc, buffer, offset, length);
1379 }
1380 1296
1381 return size; 1297 return 0;
1382} 1298}
1383 1299
1384/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 1300/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -3348,7 +3264,7 @@ EXPORT_SYMBOL(mptscsih_shutdown);
3348EXPORT_SYMBOL(mptscsih_suspend); 3264EXPORT_SYMBOL(mptscsih_suspend);
3349EXPORT_SYMBOL(mptscsih_resume); 3265EXPORT_SYMBOL(mptscsih_resume);
3350#endif 3266#endif
3351EXPORT_SYMBOL(mptscsih_proc_info); 3267EXPORT_SYMBOL(mptscsih_show_info);
3352EXPORT_SYMBOL(mptscsih_info); 3268EXPORT_SYMBOL(mptscsih_info);
3353EXPORT_SYMBOL(mptscsih_qcmd); 3269EXPORT_SYMBOL(mptscsih_qcmd);
3354EXPORT_SYMBOL(mptscsih_slave_destroy); 3270EXPORT_SYMBOL(mptscsih_slave_destroy);
diff --git a/drivers/message/fusion/mptscsih.h b/drivers/message/fusion/mptscsih.h
index 43e75ff39921..83f503162f7a 100644
--- a/drivers/message/fusion/mptscsih.h
+++ b/drivers/message/fusion/mptscsih.h
@@ -111,7 +111,7 @@ extern void mptscsih_shutdown(struct pci_dev *);
111extern int mptscsih_suspend(struct pci_dev *pdev, pm_message_t state); 111extern int mptscsih_suspend(struct pci_dev *pdev, pm_message_t state);
112extern int mptscsih_resume(struct pci_dev *pdev); 112extern int mptscsih_resume(struct pci_dev *pdev);
113#endif 113#endif
114extern int mptscsih_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, int length, int func); 114extern int mptscsih_show_info(struct seq_file *, struct Scsi_Host *);
115extern const char * mptscsih_info(struct Scsi_Host *SChost); 115extern const char * mptscsih_info(struct Scsi_Host *SChost);
116extern int mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)); 116extern int mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *));
117extern int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, 117extern int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel,
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index c3aabde2dc4f..5653e505f91f 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -831,7 +831,7 @@ static void mptspi_slave_destroy(struct scsi_device *sdev)
831static struct scsi_host_template mptspi_driver_template = { 831static struct scsi_host_template mptspi_driver_template = {
832 .module = THIS_MODULE, 832 .module = THIS_MODULE,
833 .proc_name = "mptspi", 833 .proc_name = "mptspi",
834 .proc_info = mptscsih_proc_info, 834 .show_info = mptscsih_show_info,
835 .name = "MPT SPI Host", 835 .name = "MPT SPI Host",
836 .info = mptscsih_info, 836 .info = mptscsih_info,
837 .queuecommand = mptspi_qcmd, 837 .queuecommand = mptspi_qcmd,