[SCSI] aacraid: don't assign cpu_to_le32(int) to u8
authorChristoph Hellwig <hch@infradead.org>
Thu, 8 Nov 2007 17:27:47 +0000 (17:27 +0000)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Sat, 12 Jan 2008 00:22:46 +0000 (18:22 -0600)
On Wed, Nov 07, 2007 at 01:51:44PM -0500, Salyzyn, Mark wrote:
> Christoph Hellwig [mailto:hch@infradead.org] sez:
> > Did anyone run the driver through sparse to see if we have
> > more issues like this?
>
> There are some warnings from sparse, none like this one. I will deal
> with the warnings ...

Actually there are a lot of endianess warnings, fortunately most of them
harmless.  The patch below fixes all of them up (including the ones in
the patch I replied to), except for aac_init_adapter which is really odd
and I don't know what to do.

[jejb fixed up rejections and checkpatch issues]

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Mark Salyzyn <mark_salyzyn@adaptec.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/aacraid/aachba.c
drivers/scsi/aacraid/commsup.c
drivers/scsi/aacraid/dpcsup.c
drivers/scsi/aacraid/linit.c
drivers/scsi/aacraid/rx.c

index ad8912cbe6e77dfb60e73f51dc9fc66e265ffd80..641c303d28ef291487c895cdbdb0be02ff9a87ad 100644 (file)
@@ -981,7 +981,7 @@ static int aac_read_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32
        aac_fib_init(fib);
        readcmd = (struct aac_read *) fib_data(fib);
        readcmd->command = cpu_to_le32(VM_CtBlockRead);
-       readcmd->cid = cpu_to_le16(scmd_id(cmd));
+       readcmd->cid = cpu_to_le32(scmd_id(cmd));
        readcmd->block = cpu_to_le32((u32)(lba&0xffffffff));
        readcmd->count = cpu_to_le32(count * 512);
 
@@ -1072,7 +1072,7 @@ static int aac_write_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3
        aac_fib_init(fib);
        writecmd = (struct aac_write *) fib_data(fib);
        writecmd->command = cpu_to_le32(VM_CtBlockWrite);
-       writecmd->cid = cpu_to_le16(scmd_id(cmd));
+       writecmd->cid = cpu_to_le32(scmd_id(cmd));
        writecmd->block = cpu_to_le32((u32)(lba&0xffffffff));
        writecmd->count = cpu_to_le32(count * 512);
        writecmd->sg.count = cpu_to_le32(1);
@@ -1305,9 +1305,10 @@ int aac_get_adapter_info(struct aac_dev* dev)
                          (int)sizeof(dev->supplement_adapter_info.VpdInfo.Tsid),
                          dev->supplement_adapter_info.VpdInfo.Tsid);
                }
-               if (!aac_check_reset || ((aac_check_reset != 1) &&
-                 (dev->supplement_adapter_info.SupportedOptions2 &
-                 le32_to_cpu(AAC_OPTION_IGNORE_RESET)))) {
+               if (!aac_check_reset ||
+                   ((aac_check_reset != 1) &&
+                    (dev->supplement_adapter_info.SupportedOptions2 &
+                     cpu_to_le32(AAC_OPTION_IGNORE_RESET)))) {
                        printk(KERN_INFO "%s%d: Reset Adapter Ignored\n",
                          dev->name, dev->id);
                }
index cb9a92f894ab0b3004eb6ede382ac627823759dc..310fd80b8c063cb1bf316f4e16120ebb2e0b6fb5 100644 (file)
@@ -796,13 +796,13 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
         */
        switch (le32_to_cpu(aifcmd->command)) {
        case AifCmdDriverNotify:
-               switch (le32_to_cpu(((u32 *)aifcmd->data)[0])) {
+               switch (le32_to_cpu(((__le32 *)aifcmd->data)[0])) {
                /*
                 *      Morph or Expand complete
                 */
                case AifDenMorphComplete:
                case AifDenVolumeExtendComplete:
-                       container = le32_to_cpu(((u32 *)aifcmd->data)[1]);
+                       container = le32_to_cpu(((__le32 *)aifcmd->data)[1]);
                        if (container >= dev->maximum_num_containers)
                                break;
 
@@ -835,25 +835,25 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
                        if (container >= dev->maximum_num_containers)
                                break;
                        if ((dev->fsa_dev[container].config_waiting_on ==
-                           le32_to_cpu(*(u32 *)aifcmd->data)) &&
+                           le32_to_cpu(*(__le32 *)aifcmd->data)) &&
                         time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT))
                                dev->fsa_dev[container].config_waiting_on = 0;
                } else for (container = 0;
                    container < dev->maximum_num_containers; ++container) {
                        if ((dev->fsa_dev[container].config_waiting_on ==
-                           le32_to_cpu(*(u32 *)aifcmd->data)) &&
+                           le32_to_cpu(*(__le32 *)aifcmd->data)) &&
                         time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT))
                                dev->fsa_dev[container].config_waiting_on = 0;
                }
                break;
 
        case AifCmdEventNotify:
-               switch (le32_to_cpu(((u32 *)aifcmd->data)[0])) {
+               switch (le32_to_cpu(((__le32 *)aifcmd->data)[0])) {
                /*
                 *      Add an Array.
                 */
                case AifEnAddContainer:
-                       container = le32_to_cpu(((u32 *)aifcmd->data)[1]);
+                       container = le32_to_cpu(((__le32 *)aifcmd->data)[1]);
                        if (container >= dev->maximum_num_containers)
                                break;
                        dev->fsa_dev[container].config_needed = ADD;
@@ -866,7 +866,7 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
                 *      Delete an Array.
                 */
                case AifEnDeleteContainer:
-                       container = le32_to_cpu(((u32 *)aifcmd->data)[1]);
+                       container = le32_to_cpu(((__le32 *)aifcmd->data)[1]);
                        if (container >= dev->maximum_num_containers)
                                break;
                        dev->fsa_dev[container].config_needed = DELETE;
@@ -880,7 +880,7 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
                 * waiting on something else, setup to wait on a Config Change.
                 */
                case AifEnContainerChange:
-                       container = le32_to_cpu(((u32 *)aifcmd->data)[1]);
+                       container = le32_to_cpu(((__le32 *)aifcmd->data)[1]);
                        if (container >= dev->maximum_num_containers)
                                break;
                        if (dev->fsa_dev[container].config_waiting_on &&
@@ -905,13 +905,13 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
                        if (container >= dev->maximum_num_containers)
                                break;
                        if ((dev->fsa_dev[container].config_waiting_on ==
-                           le32_to_cpu(*(u32 *)aifcmd->data)) &&
+                           le32_to_cpu(*(__le32 *)aifcmd->data)) &&
                         time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT))
                                dev->fsa_dev[container].config_waiting_on = 0;
                } else for (container = 0;
                    container < dev->maximum_num_containers; ++container) {
                        if ((dev->fsa_dev[container].config_waiting_on ==
-                           le32_to_cpu(*(u32 *)aifcmd->data)) &&
+                           le32_to_cpu(*(__le32 *)aifcmd->data)) &&
                         time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT))
                                dev->fsa_dev[container].config_waiting_on = 0;
                }
@@ -926,9 +926,9 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
                 * wait for a container change.
                 */
 
-               if ((((u32 *)aifcmd->data)[1] == cpu_to_le32(AifJobCtrZero))
-                && ((((u32 *)aifcmd->data)[6] == ((u32 *)aifcmd->data)[5])
-                 || (((u32 *)aifcmd->data)[4] == cpu_to_le32(AifJobStsSuccess)))) {
+               if (((__le32 *)aifcmd->data)[1] == cpu_to_le32(AifJobCtrZero) &&
+                   (((__le32 *)aifcmd->data)[6] == ((__le32 *)aifcmd->data)[5] ||
+                    ((__le32 *)aifcmd->data)[4] == cpu_to_le32(AifJobStsSuccess))) {
                        for (container = 0;
                            container < dev->maximum_num_containers;
                            ++container) {
@@ -943,9 +943,9 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
                                        jiffies;
                        }
                }
-               if ((((u32 *)aifcmd->data)[1] == cpu_to_le32(AifJobCtrZero))
-                && (((u32 *)aifcmd->data)[6] == 0)
-                && (((u32 *)aifcmd->data)[4] == cpu_to_le32(AifJobStsRunning))) {
+               if (((__le32 *)aifcmd->data)[1] == cpu_to_le32(AifJobCtrZero) &&
+                   ((__le32 *)aifcmd->data)[6] == 0 &&
+                   ((__le32 *)aifcmd->data)[4] == cpu_to_le32(AifJobStsRunning)) {
                        for (container = 0;
                            container < dev->maximum_num_containers;
                            ++container) {
@@ -1373,9 +1373,10 @@ int aac_check_health(struct aac_dev * aac)
 
        printk(KERN_ERR "%s: Host adapter BLINK LED 0x%x\n", aac->name, BlinkLED);
 
-       if (!aac_check_reset || ((aac_check_reset != 1) &&
-               (aac->supplement_adapter_info.SupportedOptions2 &
-                       le32_to_cpu(AAC_OPTION_IGNORE_RESET))))
+       if (!aac_check_reset ||
+           ((aac_check_reset != 1) &&
+            (aac->supplement_adapter_info.SupportedOptions2 &
+             cpu_to_le32(AAC_OPTION_IGNORE_RESET))))
                goto out;
        host = aac->scsi_host_ptr;
        if (aac->thread->pid != current->pid)
@@ -1656,11 +1657,11 @@ int aac_command_thread(void *data)
                                struct fib *fibptr;
 
                                if ((fibptr = aac_fib_alloc(dev))) {
-                                       u32 * info;
+                                       __le32 *info;
 
                                        aac_fib_init(fibptr);
 
-                                       info = (u32 *) fib_data(fibptr);
+                                       info = (__le32 *) fib_data(fibptr);
                                        if (now.tv_usec > 500000)
                                                ++now.tv_sec;
 
index e6032ffc66a693597b685c859fc994cac64eedc0..4726ab666c520e897fe2ede75b3c5c3a75f34939 100644 (file)
@@ -229,11 +229,9 @@ unsigned int aac_command_normal(struct aac_queue *q)
  *     all QE there are and wake up all the waiters before exiting.
  */
 
-unsigned int aac_intr_normal(struct aac_dev * dev, u32 Index)
+unsigned int aac_intr_normal(struct aac_dev *dev, u32 index)
 {
-       u32 index = le32_to_cpu(Index);
-
-       dprintk((KERN_INFO "aac_intr_normal(%p,%x)\n", dev, Index));
+       dprintk((KERN_INFO "aac_intr_normal(%p,%x)\n", dev, index));
        if ((index & 0x00000002L)) {
                struct hw_fib * hw_fib;
                struct fib * fib;
@@ -301,7 +299,7 @@ unsigned int aac_intr_normal(struct aac_dev * dev, u32 Index)
 
                if (hwfib->header.Command == cpu_to_le16(NuFileSystem))
                {
-                       u32 *pstatus = (u32 *)hwfib->data;
+                       __le32 *pstatus = (__le32 *)hwfib->data;
                        if (*pstatus & cpu_to_le32(0xffff0000))
                                *pstatus = cpu_to_le32(ST_OK);
                }
index b4c9ff1b08591d508547c0063b39944c34436360..782fae83ab48acb651ddefc6dbd3a82cb3906951 100644 (file)
@@ -584,11 +584,11 @@ static int aac_eh_reset(struct scsi_cmnd* cmd)
         * support a register, instead of a commanded, reset.
         */
        if ((aac->supplement_adapter_info.SupportedOptions2 &
-          le32_to_cpu(AAC_OPTION_MU_RESET)) &&
-         aac_check_reset &&
-         ((aac_check_reset != 1) ||
-          (aac->supplement_adapter_info.SupportedOptions2 &
-           le32_to_cpu(AAC_OPTION_IGNORE_RESET))))
+            cpu_to_le32(AAC_OPTION_MU_RESET)) &&
+           aac_check_reset &&
+           ((aac_check_reset != 1) ||
+            (aac->supplement_adapter_info.SupportedOptions2 &
+             cpu_to_le32(AAC_OPTION_IGNORE_RESET))))
                aac_reset_adapter(aac, 2); /* Bypass wait for command quiesce */
        return SUCCESS; /* Cause an immediate retry of the command with a ten second delay after successful tur */
 }
index 710a03e54ed067bd51e2843189147fb0ccaba9f7..9b831519a6faad5aceb9685ad93074b499e58866 100644 (file)
@@ -465,7 +465,7 @@ static int aac_rx_restart_adapter(struct aac_dev *dev, int bled)
        u32 var;
 
        if (!(dev->supplement_adapter_info.SupportedOptions2 &
-         le32_to_cpu(AAC_OPTION_MU_RESET)) || (bled >= 0) || (bled == -2)) {
+           cpu_to_le32(AAC_OPTION_MU_RESET)) || (bled >= 0) || (bled == -2)) {
                if (bled)
                        printk(KERN_ERR "%s%d: adapter kernel panic'd %x.\n",
                                dev->name, dev->id, bled);