[PATCH 1/1] aacraid: remove pigs in space

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I was amazed at how much embedded space was present in the aacraid driver source files. Just selected five files from the set to clean up for now and the attached patch swelled to 73K in size!

- Removed trailing space or tabs
- Removed spaces embedded within tabs
- Replaced leading 8 spaces with tabs
- Removed spaces before )
- Removed ClusterCommand as it was unused (noticed it as one triggered by above)
- Replaced scsi_status comparison with 0x02, to compare against SAM_STATUS_CHECK_CONDITION.
- Replaced a long series of spaces with tabs
- Replaced some simple if...defined() with ifdef/ifndef

All of this is code inert. I understand such sweeping patches make it hard to pick code changes from the space removal chaff. Also, I have NOT checked this with checkpatch.pl, as this patch's size would probably bloat further enforcing additional style changes. If this is unacceptable, then No Big Deal, this is but a trial balloon in this case with no harm or foul. The in-tree space savings are less than a block size in granularity, so there is no 'real-life' savings introduced by this patch, just some peace of mind ;->

ObligatoryDisclaimer: Please accept my condolences regarding Outlook's handling of patch attachments.

Do not use the in-line patch as source, it is a diff -rub (ignore spaces) to capture the style or trickier changes in the attached patch to make it easier to inspect.

Signed-off-by: Mark Salyzyn <aacraid@xxxxxxxxxxx>

 drivers/scsi/aacraid/aachba.c   |  243 +++++++++++++++----------------
 drivers/scsi/aacraid/aacraid.h  |  310 +++++++++++++++++++---------------------
 drivers/scsi/aacraid/commctrl.c |   80 +++++-----
 drivers/scsi/aacraid/commsup.c  |  202 +++++++++++++-------------
 drivers/scsi/aacraid/linit.c    |   88 +++++------
 5 files changed, 461 insertions(+), 462 deletions(-)

diff -rub a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
--- a/drivers/scsi/aacraid/aachba.c  2008-01-16 09:28:08.244836183 -0500
+++ b/drivers/scsi/aacraid/aachba.c  2008-01-16 10:08:02.185944381 -0500
@@ -196,7 +196,7 @@
                struct fib *fibptr) {
        struct scsi_device *device;

-       if (unlikely(!scsicmd || !scsicmd->scsi_done )) {
+       if (unlikely(!scsicmd || !scsicmd->scsi_done)) {
                dprintk((KERN_WARNING "aac_valid_context: scsi command corrupt\n"));
                 aac_fib_complete(fibptr);
                 aac_fib_free(fibptr);
@@ -243,7 +243,7 @@
                            FsaNormal,
                            1, 1,
                            NULL, NULL);
-       if (status < 0 ) {
+       if (status < 0) {
                printk(KERN_WARNING "aac_get_config_status: SendFIB failed.\n");
        } else {
                struct aac_get_config_status_resp *reply
@@ -439,7 +439,7 @@
                  sizeof (struct aac_get_name),
                  FsaNormal,
                  0, 1,
-                 (fib_callback) get_container_name_callback,
+                 (fib_callback)get_container_name_callback,
                  (void *) scsicmd);

        /*
@@ -663,7 +663,7 @@
 static void inqstrcpy(char *a, char *b)
 {

-       while(*a != (char)0)
+       while (*a != (char)0)
                *b++ = *a++;
 }

@@ -1963,7 +1963,7 @@
                dprintk((KERN_DEBUG "INQUIRY command, ID: %d.\n", cid));
                memset(&inq_data, 0, sizeof (struct inquiry_data));

-               if (scsicmd->cmnd[1] & 0x1 ) {
+               if (scsicmd->cmnd[1] & 0x1) {
                        char *arr = (char *)&inq_data;

                        /* EVPD bit set */
@@ -2442,7 +2442,7 @@
                case  WRITE_12:
                case  READ_16:
                case  WRITE_16:
-                       if(le32_to_cpu(srbreply->data_xfer_length) < scsicmd->underflow ) {
+                       if(le32_to_cpu(srbreply->data_xfer_length) < scsicmd->underflow) {
                                printk(KERN_WARNING"aacraid: SCSI CMD underflow\n");
                        } else {
                                printk(KERN_WARNING"aacraid: SCSI CMD Data Overrun\n");
@@ -2518,7 +2518,7 @@
                scsicmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8;
                break;
        }
-       if (le32_to_cpu(srbreply->scsi_status) == 0x02 ){  // Check Condition
+       if (le32_to_cpu(srbreply->scsi_status) == SAM_STAT_CHECK_CONDITION) {
                int len;
                scsicmd->result |= SAM_STAT_CHECK_CONDITION;
                len = min_t(u32, le32_to_cpu(srbreply->sense_data_size),
diff -rub a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
--- a/drivers/scsi/aacraid/aacraid.h 2008-01-16 09:28:08.244836183 -0500
+++ b/drivers/scsi/aacraid/aacraid.h 2008-01-16 10:00:51.893616629 -0500
@@ -1,4 +1,4 @@
-#if (!defined(dprintk))
+#ifndef dprintk
 # define dprintk(x)
 #endif
 /* eg: if (nblank(dprintk(x))) */
@@ -350,10 +350,6 @@
 #define                ContainerCommand64              501
 #define                ContainerRawIo                  502
 /*
- *     Cluster Commands
- */
-#define                ClusterCommand                  550
-/*
  *     Scsi Port commands (scsi passthrough)
  */
 #define                ScsiPortCommand                 600
@@ -994,7 +990,7 @@
        /*
         *      The following is the device specific extension.
         */
-#if (!defined(AAC_MIN_FOOTPRINT_SIZE))
+#ifndef AAC_MIN_FOOTPRINT_SIZE
 #      define AAC_MIN_FOOTPRINT_SIZE 8192
 #endif
        union
diff -rub a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
--- a/drivers/scsi/aacraid/commctrl.c        2008-01-16 09:28:08.245836057 -0500
+++ b/drivers/scsi/aacraid/commctrl.c        2008-01-16 10:08:41.498951119 -0500
@@ -430,7 +430,7 @@
        version += simple_strtol(driver_version + 1, &driver_version, 10) << 16;
        version += simple_strtol(driver_version + 1, NULL, 10);
        response.version = cpu_to_le32(version);
-#      if (defined(AAC_DRIVER_BUILD))
+#      ifdef AAC_DRIVER_BUILD
                response.build = cpu_to_le32(AAC_DRIVER_BUILD);
 #      else
                response.build = cpu_to_le32(9999);
@@ -593,7 +593,7 @@
                                sg_list[i] = p; // save so we can clean up later
                                sg_indx = i;

-                               if( flags & SRB_DataOut ){
+                               if (flags & SRB_DataOut) {
                                        if(copy_from_user(p,sg_user[i],upsg->sg[i].count)){
                                                dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n"));
                                                rcode = -EFAULT;
@@ -636,7 +636,7 @@
                                sg_list[i] = p; // save so we can clean up later
                                sg_indx = i;

-                               if( flags & SRB_DataOut ){
+                               if (flags & SRB_DataOut) {
                                        if(copy_from_user(p,sg_user[i],upsg->sg[i].count)){
                                                kfree (usg);
                                                dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n"));
@@ -679,7 +679,7 @@
                                sg_list[i] = p; // save so we can clean up later
                                sg_indx = i;

-                               if( flags & SRB_DataOut ){
+                               if (flags & SRB_DataOut) {
                                        if(copy_from_user(p,sg_user[i],usg->sg[i].count)){
                                                dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n"));
                                                rcode = -EFAULT;
@@ -707,7 +707,7 @@
                                sg_list[i] = p; // save so we can clean up later
                                sg_indx = i;

-                               if( flags & SRB_DataOut ){
+                               if (flags & SRB_DataOut) {
                                        if(copy_from_user(p, sg_user[i],
                                                        upsg->sg[i].count)) {
                                                dprintk((KERN_DEBUG"aacraid: Could not copy sg data from user\n"));
@@ -738,7 +738,7 @@
                goto cleanup;
        }

-       if( flags & SRB_DataIn ) {
+       if (flags & SRB_DataIn) {
                for(i = 0 ; i <= sg_indx; i++){
                        byte_count = le32_to_cpu(
                          (dev->adapter_info.options & AAC_OPT_SGMAP_HOST64)
diff -rub a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
--- a/drivers/scsi/aacraid/commsup.c 2008-01-16 09:28:08.246835930 -0500
+++ b/drivers/scsi/aacraid/commsup.c 2008-01-16 10:08:57.925864695 -0500
@@ -116,7 +116,9 @@
        /*
         *      Initialise the fibs
         */
-       for (i = 0, fibptr = &dev->fibs[i]; i < (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); i++, fibptr++)
+       for (i = 0, fibptr = &dev->fibs[i];
+               i < (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB);
+               i++, fibptr++)
        {
                fibptr->dev = dev;
                fibptr->hw_fib_va = hw_fib;
@@ -291,7 +293,8 @@
                        *index = 0; /* Wrap to front of the Producer Queue. */
        }

-        if ((*index + 1) == le32_to_cpu(*(q->headers.consumer))) { /* Queue is full */
+       /* Queue is full */
+       if ((*index + 1) == le32_to_cpu(*(q->headers.consumer))) {
                printk(KERN_WARNING "Queue %d full, %u outstanding.\n",
                                qid, q->numpending);
                return 0;
@@ -637,7 +640,7 @@
        /*
         *      If we plan to do anything check the structure type first.
         */
-       if ( hw_fib->header.StructType != FIB_MAGIC ) {
+       if (hw_fib->header.StructType != FIB_MAGIC) {
                if (dev->comm_interface == AAC_COMM_MESSAGE)
                        kfree (hw_fib);
                return -EINVAL;
@@ -672,7 +675,8 @@
        }
        else
        {
-               printk(KERN_WARNING "aac_fib_adapter_complete: Unknown xferstate detected.\n");
+               printk(KERN_WARNING "aac_fib_adapter_complete: "
+                       "Unknown xferstate detected.\n");
                BUG();
        }
        return 0;
@@ -1510,7 +1514,7 @@
                        hw_fib = fib->hw_fib_va;
                        memset(fib, 0, sizeof(struct fib));
                        fib->type = FSAFS_NTC_FIB_CONTEXT;
-                       fib->size = sizeof( struct fib );
+                       fib->size = sizeof(struct fib);
                        fib->hw_fib_va = hw_fib;
                        fib->data = hw_fib->data;
                        fib->dev = dev;

Sincerely -- Mark Salyzyn

Attachment: aacraid_pigs_in_space.patch
Description: aacraid_pigs_in_space.patch


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux