Commit f3307f72 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by James Bottomley

[SCSI] aacraid: don't assign cpu_to_le32(int) to u8

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: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarMark Salyzyn <mark_salyzyn@adaptec.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 3fb89316
...@@ -981,7 +981,7 @@ static int aac_read_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32 ...@@ -981,7 +981,7 @@ static int aac_read_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32
aac_fib_init(fib); aac_fib_init(fib);
readcmd = (struct aac_read *) fib_data(fib); readcmd = (struct aac_read *) fib_data(fib);
readcmd->command = cpu_to_le32(VM_CtBlockRead); 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->block = cpu_to_le32((u32)(lba&0xffffffff));
readcmd->count = cpu_to_le32(count * 512); 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 ...@@ -1072,7 +1072,7 @@ static int aac_write_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u3
aac_fib_init(fib); aac_fib_init(fib);
writecmd = (struct aac_write *) fib_data(fib); writecmd = (struct aac_write *) fib_data(fib);
writecmd->command = cpu_to_le32(VM_CtBlockWrite); 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->block = cpu_to_le32((u32)(lba&0xffffffff));
writecmd->count = cpu_to_le32(count * 512); writecmd->count = cpu_to_le32(count * 512);
writecmd->sg.count = cpu_to_le32(1); writecmd->sg.count = cpu_to_le32(1);
...@@ -1305,9 +1305,10 @@ int aac_get_adapter_info(struct aac_dev* dev) ...@@ -1305,9 +1305,10 @@ int aac_get_adapter_info(struct aac_dev* dev)
(int)sizeof(dev->supplement_adapter_info.VpdInfo.Tsid), (int)sizeof(dev->supplement_adapter_info.VpdInfo.Tsid),
dev->supplement_adapter_info.VpdInfo.Tsid); dev->supplement_adapter_info.VpdInfo.Tsid);
} }
if (!aac_check_reset || ((aac_check_reset != 1) && if (!aac_check_reset ||
(dev->supplement_adapter_info.SupportedOptions2 & ((aac_check_reset != 1) &&
le32_to_cpu(AAC_OPTION_IGNORE_RESET)))) { (dev->supplement_adapter_info.SupportedOptions2 &
cpu_to_le32(AAC_OPTION_IGNORE_RESET)))) {
printk(KERN_INFO "%s%d: Reset Adapter Ignored\n", printk(KERN_INFO "%s%d: Reset Adapter Ignored\n",
dev->name, dev->id); dev->name, dev->id);
} }
......
...@@ -796,13 +796,13 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) ...@@ -796,13 +796,13 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
*/ */
switch (le32_to_cpu(aifcmd->command)) { switch (le32_to_cpu(aifcmd->command)) {
case AifCmdDriverNotify: case AifCmdDriverNotify:
switch (le32_to_cpu(((u32 *)aifcmd->data)[0])) { switch (le32_to_cpu(((__le32 *)aifcmd->data)[0])) {
/* /*
* Morph or Expand complete * Morph or Expand complete
*/ */
case AifDenMorphComplete: case AifDenMorphComplete:
case AifDenVolumeExtendComplete: case AifDenVolumeExtendComplete:
container = le32_to_cpu(((u32 *)aifcmd->data)[1]); container = le32_to_cpu(((__le32 *)aifcmd->data)[1]);
if (container >= dev->maximum_num_containers) if (container >= dev->maximum_num_containers)
break; break;
...@@ -835,25 +835,25 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) ...@@ -835,25 +835,25 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
if (container >= dev->maximum_num_containers) if (container >= dev->maximum_num_containers)
break; break;
if ((dev->fsa_dev[container].config_waiting_on == 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)) time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT))
dev->fsa_dev[container].config_waiting_on = 0; dev->fsa_dev[container].config_waiting_on = 0;
} else for (container = 0; } else for (container = 0;
container < dev->maximum_num_containers; ++container) { container < dev->maximum_num_containers; ++container) {
if ((dev->fsa_dev[container].config_waiting_on == 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)) time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT))
dev->fsa_dev[container].config_waiting_on = 0; dev->fsa_dev[container].config_waiting_on = 0;
} }
break; break;
case AifCmdEventNotify: case AifCmdEventNotify:
switch (le32_to_cpu(((u32 *)aifcmd->data)[0])) { switch (le32_to_cpu(((__le32 *)aifcmd->data)[0])) {
/* /*
* Add an Array. * Add an Array.
*/ */
case AifEnAddContainer: case AifEnAddContainer:
container = le32_to_cpu(((u32 *)aifcmd->data)[1]); container = le32_to_cpu(((__le32 *)aifcmd->data)[1]);
if (container >= dev->maximum_num_containers) if (container >= dev->maximum_num_containers)
break; break;
dev->fsa_dev[container].config_needed = ADD; dev->fsa_dev[container].config_needed = ADD;
...@@ -866,7 +866,7 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) ...@@ -866,7 +866,7 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
* Delete an Array. * Delete an Array.
*/ */
case AifEnDeleteContainer: case AifEnDeleteContainer:
container = le32_to_cpu(((u32 *)aifcmd->data)[1]); container = le32_to_cpu(((__le32 *)aifcmd->data)[1]);
if (container >= dev->maximum_num_containers) if (container >= dev->maximum_num_containers)
break; break;
dev->fsa_dev[container].config_needed = DELETE; dev->fsa_dev[container].config_needed = DELETE;
...@@ -880,7 +880,7 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) ...@@ -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. * waiting on something else, setup to wait on a Config Change.
*/ */
case AifEnContainerChange: case AifEnContainerChange:
container = le32_to_cpu(((u32 *)aifcmd->data)[1]); container = le32_to_cpu(((__le32 *)aifcmd->data)[1]);
if (container >= dev->maximum_num_containers) if (container >= dev->maximum_num_containers)
break; break;
if (dev->fsa_dev[container].config_waiting_on && if (dev->fsa_dev[container].config_waiting_on &&
...@@ -905,13 +905,13 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) ...@@ -905,13 +905,13 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
if (container >= dev->maximum_num_containers) if (container >= dev->maximum_num_containers)
break; break;
if ((dev->fsa_dev[container].config_waiting_on == 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)) time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT))
dev->fsa_dev[container].config_waiting_on = 0; dev->fsa_dev[container].config_waiting_on = 0;
} else for (container = 0; } else for (container = 0;
container < dev->maximum_num_containers; ++container) { container < dev->maximum_num_containers; ++container) {
if ((dev->fsa_dev[container].config_waiting_on == 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)) time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT))
dev->fsa_dev[container].config_waiting_on = 0; dev->fsa_dev[container].config_waiting_on = 0;
} }
...@@ -926,9 +926,9 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) ...@@ -926,9 +926,9 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
* wait for a container change. * wait for a container change.
*/ */
if ((((u32 *)aifcmd->data)[1] == cpu_to_le32(AifJobCtrZero)) if (((__le32 *)aifcmd->data)[1] == cpu_to_le32(AifJobCtrZero) &&
&& ((((u32 *)aifcmd->data)[6] == ((u32 *)aifcmd->data)[5]) (((__le32 *)aifcmd->data)[6] == ((__le32 *)aifcmd->data)[5] ||
|| (((u32 *)aifcmd->data)[4] == cpu_to_le32(AifJobStsSuccess)))) { ((__le32 *)aifcmd->data)[4] == cpu_to_le32(AifJobStsSuccess))) {
for (container = 0; for (container = 0;
container < dev->maximum_num_containers; container < dev->maximum_num_containers;
++container) { ++container) {
...@@ -943,9 +943,9 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) ...@@ -943,9 +943,9 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
jiffies; jiffies;
} }
} }
if ((((u32 *)aifcmd->data)[1] == cpu_to_le32(AifJobCtrZero)) if (((__le32 *)aifcmd->data)[1] == cpu_to_le32(AifJobCtrZero) &&
&& (((u32 *)aifcmd->data)[6] == 0) ((__le32 *)aifcmd->data)[6] == 0 &&
&& (((u32 *)aifcmd->data)[4] == cpu_to_le32(AifJobStsRunning))) { ((__le32 *)aifcmd->data)[4] == cpu_to_le32(AifJobStsRunning)) {
for (container = 0; for (container = 0;
container < dev->maximum_num_containers; container < dev->maximum_num_containers;
++container) { ++container) {
...@@ -1373,9 +1373,10 @@ int aac_check_health(struct aac_dev * aac) ...@@ -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); printk(KERN_ERR "%s: Host adapter BLINK LED 0x%x\n", aac->name, BlinkLED);
if (!aac_check_reset || ((aac_check_reset != 1) && if (!aac_check_reset ||
(aac->supplement_adapter_info.SupportedOptions2 & ((aac_check_reset != 1) &&
le32_to_cpu(AAC_OPTION_IGNORE_RESET)))) (aac->supplement_adapter_info.SupportedOptions2 &
cpu_to_le32(AAC_OPTION_IGNORE_RESET))))
goto out; goto out;
host = aac->scsi_host_ptr; host = aac->scsi_host_ptr;
if (aac->thread->pid != current->pid) if (aac->thread->pid != current->pid)
...@@ -1656,11 +1657,11 @@ int aac_command_thread(void *data) ...@@ -1656,11 +1657,11 @@ int aac_command_thread(void *data)
struct fib *fibptr; struct fib *fibptr;
if ((fibptr = aac_fib_alloc(dev))) { if ((fibptr = aac_fib_alloc(dev))) {
u32 * info; __le32 *info;
aac_fib_init(fibptr); aac_fib_init(fibptr);
info = (u32 *) fib_data(fibptr); info = (__le32 *) fib_data(fibptr);
if (now.tv_usec > 500000) if (now.tv_usec > 500000)
++now.tv_sec; ++now.tv_sec;
......
...@@ -229,11 +229,9 @@ unsigned int aac_command_normal(struct aac_queue *q) ...@@ -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. * 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)) { if ((index & 0x00000002L)) {
struct hw_fib * hw_fib; struct hw_fib * hw_fib;
struct fib * fib; struct fib * fib;
...@@ -301,7 +299,7 @@ unsigned int aac_intr_normal(struct aac_dev * dev, u32 Index) ...@@ -301,7 +299,7 @@ unsigned int aac_intr_normal(struct aac_dev * dev, u32 Index)
if (hwfib->header.Command == cpu_to_le16(NuFileSystem)) if (hwfib->header.Command == cpu_to_le16(NuFileSystem))
{ {
u32 *pstatus = (u32 *)hwfib->data; __le32 *pstatus = (__le32 *)hwfib->data;
if (*pstatus & cpu_to_le32(0xffff0000)) if (*pstatus & cpu_to_le32(0xffff0000))
*pstatus = cpu_to_le32(ST_OK); *pstatus = cpu_to_le32(ST_OK);
} }
......
...@@ -584,11 +584,11 @@ static int aac_eh_reset(struct scsi_cmnd* cmd) ...@@ -584,11 +584,11 @@ static int aac_eh_reset(struct scsi_cmnd* cmd)
* support a register, instead of a commanded, reset. * support a register, instead of a commanded, reset.
*/ */
if ((aac->supplement_adapter_info.SupportedOptions2 & if ((aac->supplement_adapter_info.SupportedOptions2 &
le32_to_cpu(AAC_OPTION_MU_RESET)) && cpu_to_le32(AAC_OPTION_MU_RESET)) &&
aac_check_reset && aac_check_reset &&
((aac_check_reset != 1) || ((aac_check_reset != 1) ||
(aac->supplement_adapter_info.SupportedOptions2 & (aac->supplement_adapter_info.SupportedOptions2 &
le32_to_cpu(AAC_OPTION_IGNORE_RESET)))) cpu_to_le32(AAC_OPTION_IGNORE_RESET))))
aac_reset_adapter(aac, 2); /* Bypass wait for command quiesce */ 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 */ return SUCCESS; /* Cause an immediate retry of the command with a ten second delay after successful tur */
} }
......
...@@ -465,7 +465,7 @@ static int aac_rx_restart_adapter(struct aac_dev *dev, int bled) ...@@ -465,7 +465,7 @@ static int aac_rx_restart_adapter(struct aac_dev *dev, int bled)
u32 var; u32 var;
if (!(dev->supplement_adapter_info.SupportedOptions2 & 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) if (bled)
printk(KERN_ERR "%s%d: adapter kernel panic'd %x.\n", printk(KERN_ERR "%s%d: adapter kernel panic'd %x.\n",
dev->name, dev->id, bled); dev->name, dev->id, bled);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment