Commit cac197031ce274efff8a5abea811b9d69ae3d740

Authored by Al Viro
1 parent 09dae7fc57

fusion: switch to ->show_info()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 5 changed files with 11 additions and 95 deletions Side-by-side Diff

drivers/message/fusion/mptfc.c
... ... @@ -109,7 +109,7 @@
109 109 static struct scsi_host_template mptfc_driver_template = {
110 110 .module = THIS_MODULE,
111 111 .proc_name = "mptfc",
112   - .proc_info = mptscsih_proc_info,
  112 + .show_info = mptscsih_show_info,
113 113 .name = "MPT FC Host",
114 114 .info = mptscsih_info,
115 115 .queuecommand = mptfc_qcmd,
drivers/message/fusion/mptsas.c
... ... @@ -1977,7 +1977,7 @@
1977 1977 static struct scsi_host_template mptsas_driver_template = {
1978 1978 .module = THIS_MODULE,
1979 1979 .proc_name = "mptsas",
1980   - .proc_info = mptscsih_proc_info,
  1980 + .show_info = mptscsih_show_info,
1981 1981 .name = "MPT SAS Host",
1982 1982 .info = mptscsih_info,
1983 1983 .queuecommand = mptsas_qcmd,
drivers/message/fusion/mptscsih.c
... ... @@ -1284,101 +1284,17 @@
1284 1284 return h->info_kbuf;
1285 1285 }
1286 1286  
1287   -struct info_str {
1288   - char *buffer;
1289   - int length;
1290   - int offset;
1291   - int pos;
1292   -};
1293   -
1294   -static void
1295   -mptscsih_copy_mem_info(struct info_str *info, char *data, int len)
  1287 +int mptscsih_show_info(struct seq_file *m, struct Scsi_Host *host)
1296 1288 {
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   -
1316   -static int
1317   -mptscsih_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   -
1331   -static int
1332   -mptscsih_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   - */
1362   -int
1363   -mptscsih_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset,
1364   - int length, int func)
1365   -{
1366 1289 MPT_SCSI_HOST *hd = shost_priv(host);
1367 1290 MPT_ADAPTER *ioc = hd->ioc;
1368   - int size = 0;
1369 1291  
1370   - if (func) {
1371   - /*
1372   - * write is not supported
1373   - */
1374   - } else {
1375   - if (start)
1376   - *start = buffer;
  1292 + seq_printf(m, "%s: %s, ", ioc->name, ioc->prod_name);
  1293 + seq_printf(m, "%s%08xh, ", MPT_FW_REV_MAGIC_ID_STRING, ioc->facts.FWVersion.Word);
  1294 + seq_printf(m, "Ports=%d, ", ioc->facts.NumberOfPorts);
  1295 + seq_printf(m, "MaxQ=%d\n", ioc->req_depth);
1377 1296  
1378   - size = mptscsih_host_info(ioc, buffer, offset, length);
1379   - }
1380   -
1381   - return size;
  1297 + return 0;
1382 1298 }
1383 1299  
1384 1300 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
... ... @@ -3348,7 +3264,7 @@
3348 3264 EXPORT_SYMBOL(mptscsih_suspend);
3349 3265 EXPORT_SYMBOL(mptscsih_resume);
3350 3266 #endif
3351   -EXPORT_SYMBOL(mptscsih_proc_info);
  3267 +EXPORT_SYMBOL(mptscsih_show_info);
3352 3268 EXPORT_SYMBOL(mptscsih_info);
3353 3269 EXPORT_SYMBOL(mptscsih_qcmd);
3354 3270 EXPORT_SYMBOL(mptscsih_slave_destroy);
drivers/message/fusion/mptscsih.h
... ... @@ -111,7 +111,7 @@
111 111 extern int mptscsih_suspend(struct pci_dev *pdev, pm_message_t state);
112 112 extern int mptscsih_resume(struct pci_dev *pdev);
113 113 #endif
114   -extern int mptscsih_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, int length, int func);
  114 +extern int mptscsih_show_info(struct seq_file *, struct Scsi_Host *);
115 115 extern const char * mptscsih_info(struct Scsi_Host *SChost);
116 116 extern int mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *));
117 117 extern int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel,
drivers/message/fusion/mptspi.c
... ... @@ -831,7 +831,7 @@
831 831 static struct scsi_host_template mptspi_driver_template = {
832 832 .module = THIS_MODULE,
833 833 .proc_name = "mptspi",
834   - .proc_info = mptscsih_proc_info,
  834 + .show_info = mptscsih_show_info,
835 835 .name = "MPT SPI Host",
836 836 .info = mptscsih_info,
837 837 .queuecommand = mptspi_qcmd,