This patch cleans up a variety of checkpatch errors:

        Bunch of space issues.
        C99 comments converted to /* */ format.
        Some switch statement indentations.
        "foo * bar" -> "foo *bar"

Signed-off-by: Bas Peters <baspeter...@gmail.com>
---
 drivers/usb/storage/datafab.c | 183 +++++++++++++++++++++---------------------
 1 file changed, 93 insertions(+), 90 deletions(-)

diff --git a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c
index 7b17c21..78f867d 100644
--- a/drivers/usb/storage/datafab.c
+++ b/drivers/usb/storage/datafab.c
@@ -10,7 +10,7 @@
  *   Many thanks to Robert Baruch for the SanDisk SmartMedia reader driver
  *   which I used as a template for this driver.
  *
- *   Some bugfixes and scatter-gather code by Gregory P. Smith 
+ *   Some bugfixes and scatter-gather code by Gregory P. Smith
  *   (greg-...@electricrain.com)
  *
  *   Fix for media change by Joerg Schneider (j...@joergschneider.com)
@@ -35,8 +35,8 @@
 
 /*
  * This driver attempts to support USB CompactFlash reader/writer devices
- * based on Datafab USB-to-ATA chips.  It was specifically developed for the 
- * Datafab MDCFE-B USB CompactFlash reader but has since been found to work 
+ * based on Datafab USB-to-ATA chips.  It was specifically developed for the
+ * Datafab MDCFE-B USB CompactFlash reader but has since been found to work
  * with a variety of Datafab-based devices from a number of manufacturers.
  * I've received a report of this driver working with a Datafab-based
  * SmartMedia device though please be aware that I'm personally unable to
@@ -153,11 +153,12 @@ static int datafab_read_data(struct us_data *us,
        unsigned int sg_offset = 0;
        struct scatterlist *sg = NULL;
 
-       // we're working in LBA mode.  according to the ATA spec, 
-       // we can support up to 28-bit addressing.  I don't know if Datafab
-       // supports beyond 24-bit addressing.  It's kind of hard to test 
-       // since it requires > 8GB CF card.
-       //
+       /* we're working in LBA mode.  according to the ATA spec,
+        * we can support up to 28-bit addressing.  I don't know if Datafab
+        * supports beyond 24-bit addressing.  It's kind of hard to test
+        * since it requires > 8GB CF card.
+        */
+
        if (sectors > 0x0FFFFFFF)
                return USB_STOR_TRANSPORT_ERROR;
 
@@ -169,9 +170,10 @@ static int datafab_read_data(struct us_data *us,
 
        totallen = sectors * info->ssize;
 
-       // Since we don't read more than 64 KB at a time, we have to create
-       // a bounce buffer and move the data a piece at a time between the
-       // bounce buffer and the actual transfer buffer.
+       /* Since we don't read more than 64 KB at a time, we have to create
+        * a bounce buffer and move the data a piece at a time between the
+        * bounce buffer and the actual transfer buffer.
+        */
 
        alloclen = min(totallen, 65536u);
        buffer = kmalloc(alloclen, GFP_NOIO);
@@ -179,8 +181,9 @@ static int datafab_read_data(struct us_data *us,
                return USB_STOR_TRANSPORT_ERROR;
 
        do {
-               // loop, never allocate or transfer more than 64k at once
-               // (min(128k, 255*info->ssize) is the real limit)
+               /* loop, never allocate or transfer more than 64k at once
+                * (min(128k, 255*info->ssize) is the real limit)
+                */
 
                len = min(totallen, alloclen);
                thistime = (len / info->ssize) & 0xff;
@@ -196,17 +199,17 @@ static int datafab_read_data(struct us_data *us,
                command[6] = 0x20;
                command[7] = 0x01;
 
-               // send the read command
+               /* send the read command */
                result = datafab_bulk_write(us, command, 8);
                if (result != USB_STOR_XFER_GOOD)
                        goto leave;
 
-               // read the result
+               /* read the result */
                result = datafab_bulk_read(us, buffer, len);
                if (result != USB_STOR_XFER_GOOD)
                        goto leave;
 
-               // Store the data in the transfer buffer
+               /* Store the data in the transfer buffer */
                usb_stor_access_xfer_buf(buffer, len, us->srb,
                                 &sg, &sg_offset, TO_XFER_BUF);
 
@@ -237,11 +240,11 @@ static int datafab_write_data(struct us_data *us,
        unsigned int sg_offset = 0;
        struct scatterlist *sg = NULL;
 
-       // we're working in LBA mode.  according to the ATA spec, 
-       // we can support up to 28-bit addressing.  I don't know if Datafab
-       // supports beyond 24-bit addressing.  It's kind of hard to test 
-       // since it requires > 8GB CF card.
-       //
+       /* we're working in LBA mode.  according to the ATA spec,
+        * we can support up to 28-bit addressing.  I don't know if Datafab
+        * supports beyond 24-bit addressing.  It's kind of hard to test
+        * since it requires > 8GB CF card.
+        */
        if (sectors > 0x0FFFFFFF)
                return USB_STOR_TRANSPORT_ERROR;
 
@@ -253,9 +256,10 @@ static int datafab_write_data(struct us_data *us,
 
        totallen = sectors * info->ssize;
 
-       // Since we don't write more than 64 KB at a time, we have to create
-       // a bounce buffer and move the data a piece at a time between the
-       // bounce buffer and the actual transfer buffer.
+       /* Since we don't write more than 64 KB at a time, we have to create
+        * a bounce buffer and move the data a piece at a time between the
+        * bounce buffer and the actual transfer buffer.
+        */
 
        alloclen = min(totallen, 65536u);
        buffer = kmalloc(alloclen, GFP_NOIO);
@@ -263,13 +267,14 @@ static int datafab_write_data(struct us_data *us,
                return USB_STOR_TRANSPORT_ERROR;
 
        do {
-               // loop, never allocate or transfer more than 64k at once
-               // (min(128k, 255*info->ssize) is the real limit)
+               /* loop, never allocate or transfer more than 64k at once
+                * (min(128k, 255*info->ssize) is the real limit)
+                */
 
                len = min(totallen, alloclen);
                thistime = (len / info->ssize) & 0xff;
 
-               // Get the data from the transfer buffer
+               /* Get the data from the transfer buffer */
                usb_stor_access_xfer_buf(buffer, len, us->srb,
                                &sg, &sg_offset, FROM_XFER_BUF);
 
@@ -284,17 +289,17 @@ static int datafab_write_data(struct us_data *us,
                command[6] = 0x30;
                command[7] = 0x02;
 
-               // send the command
+               /* send the command */
                result = datafab_bulk_write(us, command, 8);
                if (result != USB_STOR_XFER_GOOD)
                        goto leave;
 
-               // send the data
+               /* send the data */
                result = datafab_bulk_write(us, buffer, len);
                if (result != USB_STOR_XFER_GOOD)
                        goto leave;
 
-               // read the result
+               /* read the result */
                result = datafab_bulk_read(us, reply, 2);
                if (result != USB_STOR_XFER_GOOD)
                        goto leave;
@@ -322,11 +327,12 @@ static int datafab_write_data(struct us_data *us,
 static int datafab_determine_lun(struct us_data *us,
                                 struct datafab_info *info)
 {
-       // Dual-slot readers can be thought of as dual-LUN devices.
-       // We need to determine which card slot is being used.
-       // We'll send an IDENTIFY DEVICE command and see which LUN responds...
-       //
-       // There might be a better way of doing this?
+       /* Dual-slot readers can be thought of as dual-LUN devices.
+        * We need to determine which card slot is being used.
+        * We'll send an IDENTIFY DEVICE command and see which LUN responds...
+        *
+        * There might be a better way of doing this?
+        */
 
        static unsigned char scommand[8] = { 0, 1, 0, 0, 0, 0xa0, 0xec, 1 };
        unsigned char *command = us->iobuf;
@@ -343,8 +349,7 @@ static int datafab_determine_lun(struct us_data *us,
 
        usb_stor_dbg(us, "locating...\n");
 
-       // we'll try 3 times before giving up...
-       //
+       /* we'll try 3 times before giving up... */
        while (count++ < 3) {
                command[5] = 0xa0;
 
@@ -389,10 +394,10 @@ static int datafab_determine_lun(struct us_data *us,
 static int datafab_id_device(struct us_data *us,
                             struct datafab_info *info)
 {
-       // this is a variation of the ATA "IDENTIFY DEVICE" command...according
-       // to the ATA spec, 'Sector Count' isn't used but the Windows driver
-       // sets this bit so we do too...
-       //
+       /* this is a variation of the ATA "IDENTIFY DEVICE" command...according
+        * to the ATA spec, 'Sector Count' isn't used but the Windows driver
+        * sets this bit so we do too...
+        */
        static unsigned char scommand[8] = { 0, 1, 0, 0, 0, 0xa0, 0xec, 1 };
        unsigned char *command = us->iobuf;
        unsigned char *reply;
@@ -420,15 +425,15 @@ static int datafab_id_device(struct us_data *us,
                goto leave;
        }
 
-       // we'll go ahead and extract the media capacity while we're here...
-       //
+       /*  we'll go ahead and extract the media capacity while we're here... */
+
        rc = datafab_bulk_read(us, reply, 512);
        if (rc == USB_STOR_XFER_GOOD) {
-               // capacity is at word offset 57-58
-               //
-               info->sectors = ((u32)(reply[117]) << 24) | 
+               /* capacity is at word offset 57-58 */
+
+               info->sectors = ((u32)(reply[117]) << 24) |
                                ((u32)(reply[116]) << 16) |
-                               ((u32)(reply[115]) <<  8) | 
+                               ((u32)(reply[115]) <<  8) |
                                ((u32)(reply[114])      );
                rc = USB_STOR_TRANSPORT_GOOD;
                goto leave;
@@ -443,7 +448,7 @@ static int datafab_id_device(struct us_data *us,
 
 
 static int datafab_handle_mode_sense(struct us_data *us,
-                                    struct scsi_cmnd * srb, 
+                                    struct scsi_cmnd *srb,
                                     int sense_6)
 {
        static unsigned char rw_err_page[12] = {
@@ -463,67 +468,67 @@ static int datafab_handle_mode_sense(struct us_data *us,
        struct datafab_info *info = (struct datafab_info *) (us->extra);
        unsigned char *ptr = us->iobuf;
 
-       // most of this stuff is just a hack to get things working.  the
-       // datafab reader doesn't present a SCSI interface so we
-       // fudge the SCSI commands...
-       //
+       /* most of this stuff is just a hack to get things working.  the
+        * datafab reader doesn't present a SCSI interface so we
+        * fudge the SCSI commands...
+        */
 
        pc = srb->cmnd[2] >> 6;
        page_code = srb->cmnd[2] & 0x3F;
 
        switch (pc) {
-          case 0x0:
-                  usb_stor_dbg(us, "Current values\n");
+       case 0x0:
+               usb_stor_dbg(us, "Current values\n");
                break;
-          case 0x1:
-                  usb_stor_dbg(us, "Changeable values\n");
+       case 0x1:
+               usb_stor_dbg(us, "Changeable values\n");
                break;
-          case 0x2:
-                  usb_stor_dbg(us, "Default values\n");
+       case 0x2:
+               usb_stor_dbg(us, "Default values\n");
                break;
-          case 0x3:
-                  usb_stor_dbg(us, "Saves values\n");
+       case 0x3:
+               usb_stor_dbg(us, "Saves values\n");
                break;
        }
 
        memset(ptr, 0, 8);
        if (sense_6) {
-               ptr[2] = 0x00;          // WP enable: 0x80
+               ptr[2] = 0x00;          /* WP enable: 0x80 */
                i = 4;
        } else {
-               ptr[3] = 0x00;          // WP enable: 0x80
+               ptr[3] = 0x00;          /* WP enable: 0x80 */
                i = 8;
        }
 
        switch (page_code) {
-          default:
-               // vendor-specific mode
+       default:
+               /* vendor-specific mode */
                info->sense_key = 0x05;
                info->sense_asc = 0x24;
                info->sense_ascq = 0x00;
                return USB_STOR_TRANSPORT_FAILED;
 
-          case 0x1:
+       case 0x1:
                memcpy(ptr + i, rw_err_page, sizeof(rw_err_page));
                i += sizeof(rw_err_page);
                break;
 
-          case 0x8:
+       case 0x8:
                memcpy(ptr + i, cache_page, sizeof(cache_page));
                i += sizeof(cache_page);
                break;
 
-          case 0x1B:
+       case 0x1B:
                memcpy(ptr + i, rbac_page, sizeof(rbac_page));
                i += sizeof(rbac_page);
                break;
 
-          case 0x1C:
+       case 0x1C:
                memcpy(ptr + i, timer_page, sizeof(timer_page));
                i += sizeof(timer_page);
                break;
 
-          case 0x3F:           // retrieve all pages
+       case 0x3F:              /* retrieve all pages */
                memcpy(ptr + i, timer_page, sizeof(timer_page));
                i += sizeof(timer_page);
                memcpy(ptr + i, rbac_page, sizeof(rbac_page));
@@ -546,13 +551,13 @@ static int datafab_handle_mode_sense(struct us_data *us,
 
 static void datafab_info_destructor(void *extra)
 {
-       // this routine is a placeholder...
-       // currently, we don't allocate any extra memory so we're okay
+       /* this routine is a placeholder...
+        * currently, we don't allocate any extra memory so we're okay
+        */
 }
 
 
-// Transport for the Datafab MDCFE-B
-//
+/* Transport for the Datafab MDCFE-B */
 static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us)
 {
        struct datafab_info *info;
@@ -569,7 +574,7 @@ static int datafab_transport(struct scsi_cmnd *srb, struct 
us_data *us)
                        return USB_STOR_TRANSPORT_ERROR;
 
                us->extra_destructor = datafab_info_destructor;
-               ((struct datafab_info *)us->extra)->lun = -1;
+               ((struct datafab_info *)us->extra)->lun = -1;
        }
 
        info = (struct datafab_info *) (us->extra);
@@ -582,7 +587,7 @@ static int datafab_transport(struct scsi_cmnd *srb, struct 
us_data *us)
        }
 
        if (srb->cmnd[0] == READ_CAPACITY) {
-               info->ssize = 0x200;  // hard coded 512 byte sectors as per ATA 
spec
+               info->ssize = 0x200;  /* hard coded 512 byte sectors as per ATA 
spec */
                rc = datafab_id_device(us, info);
                if (rc != USB_STOR_TRANSPORT_GOOD)
                        return rc;
@@ -590,8 +595,9 @@ static int datafab_transport(struct scsi_cmnd *srb, struct 
us_data *us)
                usb_stor_dbg(us, "READ_CAPACITY:  %ld sectors, %ld bytes per 
sector\n",
                             info->sectors, info->ssize);
 
-               // build the reply
-               // we need the last sector, not the number of sectors
+               /* build the reply
+                * we need the last sector, not the number of sectors
+                */
                ((__be32 *) ptr)[0] = cpu_to_be32(info->sectors - 1);
                ((__be32 *) ptr)[1] = cpu_to_be32(info->ssize);
                usb_stor_set_xfer_buf(ptr, 8, srb);
@@ -604,8 +610,7 @@ static int datafab_transport(struct scsi_cmnd *srb, struct 
us_data *us)
                return USB_STOR_TRANSPORT_ERROR;
        }
 
-       // don't bother implementing READ_6 or WRITE_6.
-       //
+       /* don't bother implementing READ_6 or WRITE_6. */
        if (srb->cmnd[0] == READ_10) {
                block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 
16) |
                        ((u32)(srb->cmnd[4]) <<  8) | ((u32)(srb->cmnd[5]));
@@ -618,8 +623,7 @@ static int datafab_transport(struct scsi_cmnd *srb, struct 
us_data *us)
        }
 
        if (srb->cmnd[0] == READ_12) {
-               // we'll probably never see a READ_12 but we'll do it anyway...
-               //
+               /* we'll probably never see a READ_12 but we'll do it anyway... 
*/
                block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 
16) |
                        ((u32)(srb->cmnd[4]) <<  8) | ((u32)(srb->cmnd[5]));
 
@@ -643,8 +647,7 @@ static int datafab_transport(struct scsi_cmnd *srb, struct 
us_data *us)
        }
 
        if (srb->cmnd[0] == WRITE_12) {
-               // we'll probably never see a WRITE_12 but we'll do it anyway...
-               //
+               /* we'll probably never see a WRITE_12 but we'll do it 
anyway... */
                block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 
16) |
                        ((u32)(srb->cmnd[4]) <<  8) | ((u32)(srb->cmnd[5]));
 
@@ -664,10 +667,10 @@ static int datafab_transport(struct scsi_cmnd *srb, 
struct us_data *us)
        if (srb->cmnd[0] == REQUEST_SENSE) {
                usb_stor_dbg(us, "REQUEST_SENSE - Returning faked response\n");
 
-               // this response is pretty bogus right now.  eventually if 
necessary
-               // we can set the correct sense data.  so far though it hasn't 
been
-               // necessary
-               //
+               /* this response is pretty bogus right now.  eventually if 
necessary
+                * we can set the correct sense data.  so far though it hasn't 
been
+                * necessary
+                */
                memset(ptr, 0, 18);
                ptr[0] = 0xF0;
                ptr[2] = info->sense_key;
@@ -690,9 +693,9 @@ static int datafab_transport(struct scsi_cmnd *srb, struct 
us_data *us)
        }
 
        if (srb->cmnd[0] == ALLOW_MEDIUM_REMOVAL) {
-               // sure.  whatever.  not like we can stop the user from
-               // popping the media out of the device (no locking doors, etc)
-               //
+               /* sure.  whatever.  not like we can stop the user from
+                * popping the media out of the device (no locking doors, etc)
+                */
                return USB_STOR_TRANSPORT_GOOD;
        }
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to