wd7000: switch to ->show_info()
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 31 Mar 2013 04:17:00 +0000 (00:17 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 9 Apr 2013 18:13:15 +0000 (14:13 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
drivers/scsi/wd7000.c

index d89a5dfd3adec9463061651a23cf0d486489f02b..f9a6e4b0affe895ed8e388f4afaf3d70df941fca 100644 (file)
@@ -1296,9 +1296,9 @@ static void wd7000_revision(Adapter * host)
 
 
 #undef SPRINTF
-#define SPRINTF(args...) { if (pos < (buffer + length)) pos += sprintf (pos, ## args); }
+#define SPRINTF(args...) { seq_printf(m, ## args); }
 
-static int wd7000_set_info(char *buffer, int length, struct Scsi_Host *host)
+static int wd7000_set_info(struct Scsi_Host *host, char *buffer, int length)
 {
        dprintk("Buffer = <%.*s>, length = %d\n", length, buffer, length);
 
@@ -1310,22 +1310,15 @@ static int wd7000_set_info(char *buffer, int length, struct Scsi_Host *host)
 }
 
 
-static int wd7000_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, int length,  int inout)
+static int wd7000_show_info(struct seq_file *m, struct Scsi_Host *host)
 {
        Adapter *adapter = (Adapter *)host->hostdata;
        unsigned long flags;
-       char *pos = buffer;
 #ifdef WD7000_DEBUG
        Mailbox *ogmbs, *icmbs;
        short count;
 #endif
 
-       /*
-        * Has data been written to the file ?
-        */
-       if (inout)
-               return (wd7000_set_info(buffer, length, host));
-
        spin_lock_irqsave(host->host_lock, flags);
        SPRINTF("Host scsi%d: Western Digital WD-7000 (rev %d.%d)\n", host->host_no, adapter->rev1, adapter->rev2);
        SPRINTF("  IO base:      0x%x\n", adapter->iobase);
@@ -1368,17 +1361,7 @@ static int wd7000_proc_info(struct Scsi_Host *host, char *buffer, char **start,
 
        spin_unlock_irqrestore(host->host_lock, flags);
 
-       /*
-        * Calculate start of next buffer, and return value.
-        */
-       *start = buffer + offset;
-
-       if ((pos - buffer) < offset)
-               return (0);
-       else if ((pos - buffer - offset) < length)
-               return (pos - buffer - offset);
-       else
-               return (length);
+       return 0;
 }
 
 
@@ -1413,7 +1396,8 @@ static __init int wd7000_detect(struct scsi_host_template *tpnt)
        for (i = 0; i < NUM_CONFIGS; biosptr[i++] = -1);
 
        tpnt->proc_name = "wd7000";
-       tpnt->proc_info = &wd7000_proc_info;
+       tpnt->show_info = &wd7000_show_info;
+       tpnt->write_info = wd7000_set_info;
 
        /*
         * Set up SCB free list, which is shared by all adapters
@@ -1658,7 +1642,8 @@ MODULE_LICENSE("GPL");
 
 static struct scsi_host_template driver_template = {
        .proc_name              = "wd7000",
-       .proc_info              = wd7000_proc_info,
+       .show_info              = wd7000_show_info,
+       .write_info             = wd7000_set_info,
        .name                   = "Western Digital WD-7000",
        .detect                 = wd7000_detect,
        .release                = wd7000_release,