2005-12-22 05:20:25

by Dax Kelson

[permalink] [raw]
Subject: ETA for Areca RAID driver (arcmsr) in mainline?

I just got a shiny new (for me at least, the card has been out for
months) Areca RAID card.

The driver (arcmsr) is in the -mm kernel, but hasn't yet made it to the
mainline kernel. I'm curious what remains to be done before this can
happen?

Dax Kelson



2005-12-22 05:30:34

by Lee Revell

[permalink] [raw]
Subject: Re: ETA for Areca RAID driver (arcmsr) in mainline?

On Wed, 2005-12-21 at 22:20 -0700, Dax Kelson wrote:
> I just got a shiny new (for me at least, the card has been out for
> months) Areca RAID card.
>
> The driver (arcmsr) is in the -mm kernel, but hasn't yet made it to the
> mainline kernel. I'm curious what remains to be done before this can
> happen?

Well, often all that's needed are some user reports that the driver
works for them.

Does it?

Lee

2005-12-22 06:26:31

by Dax Kelson

[permalink] [raw]
Subject: Re: ETA for Areca RAID driver (arcmsr) in mainline?

On Thu, 2005-12-22 at 00:34 -0500, Lee Revell wrote:
> On Wed, 2005-12-21 at 22:20 -0700, Dax Kelson wrote:
> > I just got a shiny new (for me at least, the card has been out for
> > months) Areca RAID card.
> >
> > The driver (arcmsr) is in the -mm kernel, but hasn't yet made it to the
> > mainline kernel. I'm curious what remains to be done before this can
> > happen?
>
> Well, often all that's needed are some user reports that the driver
> works for them.
>
> Does it?

According to google searches, yes.

At one time there was an issue raised about stack consumption, but that
appears fixed??

Dax Kelson

2005-12-22 06:43:57

by Adrian Bunk

[permalink] [raw]
Subject: Re: ETA for Areca RAID driver (arcmsr) in mainline?

On Wed, Dec 21, 2005 at 10:20:31PM -0700, Dax Kelson wrote:

> I just got a shiny new (for me at least, the card has been out for
> months) Areca RAID card.
>
> The driver (arcmsr) is in the -mm kernel, but hasn't yet made it to the
> mainline kernel. I'm curious what remains to be done before this can
> happen?


The top of the patch in -mm says:


(hch sez:

There's lots of architectural problems. It's doing it's own queueing, it's
stuffing kernel structures into memory on the hardware and so on. Basically
someone knowledgeable about the hardware needs to start from scratch on it.

Unfortunately it seems the hardware is more and more widely available so
we'll have to bite that bullet one day.)


> Dax Kelson

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

2005-12-22 07:00:16

by Lee Revell

[permalink] [raw]
Subject: Re: ETA for Areca RAID driver (arcmsr) in mainline?

On Wed, 2005-12-21 at 23:26 -0700, Dax Kelson wrote:
> On Thu, 2005-12-22 at 00:34 -0500, Lee Revell wrote:
> > On Wed, 2005-12-21 at 22:20 -0700, Dax Kelson wrote:
> > > I just got a shiny new (for me at least, the card has been out for
> > > months) Areca RAID card.
> > >
> > > The driver (arcmsr) is in the -mm kernel, but hasn't yet made it to the
> > > mainline kernel. I'm curious what remains to be done before this can
> > > happen?
> >
> > Well, often all that's needed are some user reports that the driver
> > works for them.
> >
> > Does it?
>
> According to google searches, yes.
>
> At one time there was an issue raised about stack consumption, but that
> appears fixed??

I meant, does it work for *you*?

Lee

2005-12-22 07:23:54

by Dax Kelson

[permalink] [raw]
Subject: Re: ETA for Areca RAID driver (arcmsr) in mainline?

On Thu, 2005-12-22 at 02:04 -0500, Lee Revell wrote:
> On Wed, 2005-12-21 at 23:26 -0700, Dax Kelson wrote:
> > On Thu, 2005-12-22 at 00:34 -0500, Lee Revell wrote:
> > > On Wed, 2005-12-21 at 22:20 -0700, Dax Kelson wrote:
> > > > I just got a shiny new (for me at least, the card has been out for
> > > > months) Areca RAID card.
> > > >
> > > > The driver (arcmsr) is in the -mm kernel, but hasn't yet made it to the
> > > > mainline kernel. I'm curious what remains to be done before this can
> > > > happen?
> > >
> > > Well, often all that's needed are some user reports that the driver
> > > works for them.
> > >
> > > Does it?
> >
> > According to google searches, yes.
> >
> > At one time there was an issue raised about stack consumption, but that
> > appears fixed??
>
> I meant, does it work for *you*?

Like I said, I just barely got the card. I'm working on getting a custom
installer built so I get find out the answer. If it was already in
mainline I'd already have a system installed. :)

Dax Kelson

2005-12-22 08:17:56

by Oliver Neukum

[permalink] [raw]
Subject: Re: ETA for Areca RAID driver (arcmsr) in mainline?

Am Donnerstag, 22. Dezember 2005 06:34 schrieb Lee Revell:
> On Wed, 2005-12-21 at 22:20 -0700, Dax Kelson wrote:
> > I just got a shiny new (for me at least, the card has been out for
> > months) Areca RAID card.
> >
> > The driver (arcmsr) is in the -mm kernel, but hasn't yet made it to the
> > mainline kernel. I'm curious what remains to be done before this can
> > happen?
>
> Well, often all that's needed are some user reports that the driver
> works for them.

Is that a reasonable strategy? Why is a _new_ driver present only in -mm?
It hardly can break anything. It is possible that Andrew is quicker merging
but still I can't see the advantage if this persists for any length of time.

Regards
Oliver

2005-12-22 08:20:08

by Arjan van de Ven

[permalink] [raw]
Subject: Re: ETA for Areca RAID driver (arcmsr) in mainline?

On Thu, 2005-12-22 at 09:17 +0100, Oliver Neukum wrote:
> Am Donnerstag, 22. Dezember 2005 06:34 schrieb Lee Revell:
> > On Wed, 2005-12-21 at 22:20 -0700, Dax Kelson wrote:
> > > I just got a shiny new (for me at least, the card has been out for
> > > months) Areca RAID card.
> > >
> > > The driver (arcmsr) is in the -mm kernel, but hasn't yet made it to the
> > > mainline kernel. I'm curious what remains to be done before this can
> > > happen?
> >
> > Well, often all that's needed are some user reports that the driver
> > works for them.
>
> Is that a reasonable strategy? Why is a _new_ driver present only in -mm?
> It hardly can break anything. It is possible that Andrew is quicker merging
> but still I can't see the advantage if this persists for any length of time.

afaik that's not the strategy here.
It's more "we're waiting for the structural issues to be resolved" which
sounds quite reasonable.


2005-12-22 13:25:18

by Andrew Morton

[permalink] [raw]
Subject: Re: ETA for Areca RAID driver (arcmsr) in mainline?

Arjan van de Ven <[email protected]> wrote:
>
> On Thu, 2005-12-22 at 09:17 +0100, Oliver Neukum wrote:
> > Am Donnerstag, 22. Dezember 2005 06:34 schrieb Lee Revell:
> > > On Wed, 2005-12-21 at 22:20 -0700, Dax Kelson wrote:
> > > > I just got a shiny new (for me at least, the card has been out for
> > > > months) Areca RAID card.
> > > >
> > > > The driver (arcmsr) is in the -mm kernel, but hasn't yet made it to the
> > > > mainline kernel. I'm curious what remains to be done before this can
> > > > happen?
> > >
> > > Well, often all that's needed are some user reports that the driver
> > > works for them.
> >
> > Is that a reasonable strategy? Why is a _new_ driver present only in -mm?
> > It hardly can break anything. It is possible that Andrew is quicker merging
> > but still I can't see the advantage if this persists for any length of time.
>
> afaik that's not the strategy here.
> It's more "we're waiting for the structural issues to be resolved" which
> sounds quite reasonable.
>

Yes, there are lots of stylistic and API-usage issues with the driver and
it needs someone to fix them all up. Unfortunately the original
developer's English is very poor and he's obviously quite unfamiliar with
how Linux development happens.

This is all resolveable - it just needs someone to get down and work with
Erich on knocking the driver into shape. But as yet, nobody has stepped up
to do that work.

And yes, the driver does apparently work.

2005-12-22 19:31:12

by Dax Kelson

[permalink] [raw]
Subject: Re: ETA for Areca RAID driver (arcmsr) in mainline?

On Thu, 2005-12-22 at 05:24 -0800, Andrew Morton wrote:

> Yes, there are lots of stylistic and API-usage issues with the driver and
> it needs someone to fix them all up. Unfortunately the original
> developer's English is very poor and he's obviously quite unfamiliar with
> how Linux development happens.
>
> This is all resolveable - it just needs someone to get down and work with
> Erich on knocking the driver into shape. But as yet, nobody has stepped up
> to do that work.
>
> And yes, the driver does apparently work.

I emailed Areca and got a response that indicated they didn't know about
the remaining stylistic and API-usage issues with the driver.

If someone could spell it out to them what exactly needs to to be fixed
for it to get merged into the Linus tree, they sound eager to do the
work.

The current driver does indeed work. Last night I copied several hundred
gigabytes of data using the driver.

Dax Kelson
Guru Labs

2005-12-30 19:32:00

by Randy Dunlap

[permalink] [raw]
Subject: Re: ETA for Areca RAID driver (arcmsr) in mainline?

On Thu, 22 Dec 2005 12:31:34 -0700 Dax Kelson wrote:

> On Thu, 2005-12-22 at 05:24 -0800, Andrew Morton wrote:
>
> > Yes, there are lots of stylistic and API-usage issues with the driver and
> > it needs someone to fix them all up. Unfortunately the original
> > developer's English is very poor and he's obviously quite unfamiliar with
> > how Linux development happens.
> >
> > This is all resolveable - it just needs someone to get down and work with
> > Erich on knocking the driver into shape. But as yet, nobody has stepped up
> > to do that work.
> >
> > And yes, the driver does apparently work.
>
> I emailed Areca and got a response that indicated they didn't know about
> the remaining stylistic and API-usage issues with the driver.
>
> If someone could spell it out to them what exactly needs to to be fixed
> for it to get merged into the Linus tree, they sound eager to do the
> work.
>
> The current driver does indeed work. Last night I copied several hundred
> gigabytes of data using the driver.


Here's a start on some cleanups and a list of general issues.
I'm not addressing SCSI or MM/DMA API issues, if there are any.

0. some Kconfig and Makefile cleanups
1. fix arcmsr_device_id_table[] inits;
2. fix return (value); -- don't use parenethese
3. fix one-line-ifs-with-braces -- remove braces
4. struct _XYZ & typedef XYZ, PXYZ -- convert to struct XYZ only
5. check NULL usage
6. no "return;" at end of func; -- removed
7. return -ENXIO instead of ENXIO;

Patch for above items is below.

More issues, not yet patched:

8. check sparse warnings, stack usage, init/exit sections;
9. don't use // comments;
10. use printk levels
11. pPCI_DEV: bad naming (throughout driver; don't use mixed case)
12. some comments are unreadable (non-ASCII ?)
13. uintNN_t int types: use kernel types except for userspace interfaces
14. use kernel-doc
15. try to fit source files into 80 columns


And Erich, you could probably benifit from reading an introduction
to Linux development tutorial that I did. It's here:
http://www.xenotime.net/linux/mentor/linux-mentoring.pdf

---
~Randy



From: Randy Dunlap <[email protected]>

Many Linux kernel style cleanups.

Signed-off-by: Randy Dunlap <[email protected]>
---
drivers/scsi/Kconfig | 28 +-
drivers/scsi/arcmsr/Makefile | 4
drivers/scsi/arcmsr/arcmsr.c | 574 ++++++++++++++++++-----------------------
drivers/scsi/arcmsr/arcmsr.h | 140 ++++------
drivers/scsi/arcmsr/arcmsr.txt | 34 +-
5 files changed, 354 insertions(+), 426 deletions(-)

--- linux-2615-rc7.orig/drivers/scsi/Kconfig
+++ linux-2615-rc7/drivers/scsi/Kconfig
@@ -289,20 +289,6 @@ config SCSI_DECSII
tristate "DEC SII Scsi Driver"
depends on MACH_DECSTATION && SCSI && 32BIT

-config SCSI_ARCMSR
- tristate "ARECA ARC11X0[PCI-X]/ARC12X0[PCI-EXPRESS] SATA-RAID support"
- depends on PCI && SCSI
- help
- This driver supports all of ARECA's SATA RAID controllers cards.
- This is an ARECA maintained driver by Erich Chen.
- If you have any problems, please mail to: < [email protected] >
- Areca have suport Linux RAID config tools
-
- < http://www.areca.com.tw >
-
- To compile this driver as a module, choose M here: the
- module will be called arcmsr (modprobe arcmsr) .
-
config BLK_DEV_3W_XXXX_RAID
tristate "3ware 5/6/7/8xxx ATA-RAID support"
depends on PCI && SCSI
@@ -472,6 +458,20 @@ config SCSI_IN2000
To compile this driver as a module, choose M here: the
module will be called in2000.

+config SCSI_ARCMSR
+ tristate "ARECA ARC11X0[PCI-X]/ARC12X0[PCI-EXPRESS] SATA-RAID support"
+ depends on PCI && SCSI
+ help
+ This driver supports all of ARECA's SATA RAID controller cards.
+ This is an ARECA-maintained driver by Erich Chen.
+ If you have any problems, please mail to: < [email protected] >
+ Areca supports Linux RAID config tools.
+
+ < http://www.areca.com.tw >
+
+ To compile this driver as a module, choose M here: the
+ module will be called arcmsr (modprobe arcmsr).
+
source "drivers/scsi/megaraid/Kconfig.megaraid"

config SCSI_SATA
--- linux-2615-rc7.orig/drivers/scsi/arcmsr/Makefile
+++ linux-2615-rc7/drivers/scsi/arcmsr/Makefile
@@ -2,7 +2,3 @@
# Makefile for the ARECA PCI-X PCI-EXPRESS SATA RAID controllers SCSI driver.

obj-$(CONFIG_SCSI_ARCMSR) := arcmsr.o
-
-EXTRA_CFLAGS += -I.
-
-
--- linux-2615-rc7.orig/drivers/scsi/arcmsr/arcmsr.h
+++ linux-2615-rc7/drivers/scsi/arcmsr/arcmsr.h
@@ -19,31 +19,29 @@
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
************************************************************************
-** Redistribution and use in source and binary forms,with or without
-** modification,are permitted provided that the following conditions
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
** are met:
** 1. Redistributions of source code must retain the above copyright
-** notice,this list of conditions and the following disclaimer.
+** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
-** notice,this list of conditions and the following disclaimer in the
+** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-** IMPLIED WARRANTIES,INCLUDING,BUT NOT LIMITED TO,THE IMPLIED WARRANTIES
+** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,INDIRECT,
-** INCIDENTAL,SPECIAL,EXEMPLARY,OR CONSEQUENTIAL DAMAGES(INCLUDING,BUT
-** NOT LIMITED TO,PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA,OR PROFITS; OR BUSINESS INTERRUPTION)HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY,WHETHER IN CONTRACT,STRICT LIABILITY,OR TORT
+** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT
+** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION)HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
**(INCLUDING NEGLIGENCE OR OTHERWISE)ARISING IN ANY WAY OUT OF THE USE OF
-** THIS SOFTWARE,EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**************************************************************************
*/
-#include <linux/config.h>
-#include <linux/version.h>
/*
**********************************************************************************
**
@@ -97,24 +95,24 @@
** IOCTL CONTROL CODE
************************************************************************
*/
-typedef struct _CMD_IO_CONTROL {
+struct CMD_IO_CONTROL {
uint32_t HeaderLength;
uint8_t Signature[8];
uint32_t Timeout;
uint32_t ControlCode;
uint32_t ReturnCode;
uint32_t Length;
-} CMD_IO_CONTROL, *PCMD_IO_CONTROL;
+};
/*
************************************************************************************************************
**
************************************************************************************************************
*/
-typedef struct _CMD_IOCTL_FIELD {
- CMD_IO_CONTROL cmdioctl; /*ioctl header */
+struct CMD_IOCTL_FIELD {
+ struct CMD_IO_CONTROL cmdioctl; /*ioctl header */
uint8_t ioctldatabuffer[1032]; /*areca gui program does not accept more than 1031 byte */
-} CMD_IOCTL_FIELD, *PCMD_IOCTL_FIELD;
-/*error code for StorPortLogError,ScsiPortLogError*/
+};
+/*error code for StorPortLogError, ScsiPortLogError*/
#define ARCMSR_IOP_ERROR_ILLEGALPCI 0x0001
#define ARCMSR_IOP_ERROR_VENDORID 0x0002
#define ARCMSR_IOP_ERROR_DEVICEID 0x0002
@@ -158,36 +156,36 @@ typedef struct _CMD_IOCTL_FIELD {
*************************************************************
*/
#define IS_SG64_ADDR 0x01000000 /* bit24 */
-typedef struct _SG32ENTRY { /* size 8 bytes *//* length bit 24 == 0 */
- uint32_t length; /* high 8 bit == flag,low 24 bit == length */
+struct SG32ENTRY { /* size 8 bytes *//* length bit 24 == 0 */
+ uint32_t length; /* high 8 bit == flag, low 24 bit == length */
uint32_t address;
-} SG32ENTRY, *PSG32ENTRY;
-typedef struct _SG64ENTRY { /* size 12 bytes *//* length bit 24 == 1 */
- uint32_t length; /* high 8 bit == flag,low 24 bit == length */
+};
+struct SG64ENTRY { /* size 12 bytes *//* length bit 24 == 1 */
+ uint32_t length; /* high 8 bit == flag, low 24 bit == length */
uint32_t address;
uint32_t addresshigh;
-} SG64ENTRY, *PSG64ENTRY;
-typedef struct _SGENTRY_UNION {
+};
+struct SGENTRY_UNION {
union {
- SG32ENTRY sg32entry; /* 30h Scatter gather address */
- SG64ENTRY sg64entry; /* 30h */
+ struct SG32ENTRY sg32entry; /* 30h Scatter gather address */
+ struct SG64ENTRY sg64entry; /* 30h */
} u;
-} SGENTRY_UNION, PSGENTRY_UNION;
+};
/*
**********************************
**
**********************************
*/
-typedef struct _QBUFFER {
+struct QBUFFER {
uint32_t data_len;
uint8_t data[124];
-} QBUFFER, *PQBUFFER;
+};
/*
************************************************************************************************
** FIRMWARE INFO
************************************************************************************************
*/
-typedef struct _FIRMWARE_INFO {
+struct FIRMWARE_INFO {
uint32_t signature; /*0,00-03 */
uint32_t request_len; /*1,04-07 */
uint32_t numbers_queue; /*2,08-11 */
@@ -197,7 +195,7 @@ typedef struct _FIRMWARE_INFO {
char model[8]; /*15,60-67 */
char firmware_ver[16]; /*17,68-83 */
char device_map[16]; /*21,84-99 */
-} FIRMWARE_INFO, *PFIRMWARE_INFO;
+};
/*
************************************************************************************************
** ARECA FIRMWARE SPEC
@@ -311,7 +309,7 @@ typedef struct _FIRMWARE_INFO {
** size 0x1F8 (504)
************************************************************************************************
*/
-typedef struct _ARCMSR_CDB {
+struct ARCMSR_CDB {
uint8_t Bus; /* 00h should be 0 */
uint8_t TargetID; /* 01h should be 0--15 */
uint8_t LUN; /* 02h should be 0--7 */
@@ -323,9 +321,9 @@ typedef struct _ARCMSR_CDB {
#define ARCMSR_CDB_FLAG_SGL_BSIZE 0x01 /* bit 0: 0(256) / 1(512) bytes */
#define ARCMSR_CDB_FLAG_BIOS 0x02 /* bit 1: 0(from driver) / 1(from BIOS) */
#define ARCMSR_CDB_FLAG_WRITE 0x04 /* bit 2: 0(Data in) / 1(Data out) */
-#define ARCMSR_CDB_FLAG_SIMPLEQ 0x00 /* bit 4/3 ,00 : simple Q,01 : head of Q,10 : ordered Q */
-#define ARCMSR_CDB_FLAG_HEADQ 0x08
-#define ARCMSR_CDB_FLAG_ORDEREDQ 0x10
+#define ARCMSR_CDB_FLAG_SIMPLEQ 0x00 /* bit 4/3: 00: simple Q */
+#define ARCMSR_CDB_FLAG_HEADQ 0x08 /* 01: head of Q */
+#define ARCMSR_CDB_FLAG_ORDEREDQ 0x10 /* 10: ordered Q */
uint8_t Reserved1; /* 07h */

uint32_t Context; /* 08h Address of this request */
@@ -355,10 +353,10 @@ typedef struct _ARCMSR_CDB {
uint8_t SenseData[15]; /* 21h output */

union {
- SG32ENTRY sg32entry[ARCMSR_MAX_SG_ENTRIES]; /* 30h Scatter gather address */
- SG64ENTRY sg64entry[ARCMSR_MAX_SG_ENTRIES]; /* 30h */
+ struct SG32ENTRY sg32entry[ARCMSR_MAX_SG_ENTRIES]; /* 30h Scatter gather address */
+ struct SG64ENTRY sg64entry[ARCMSR_MAX_SG_ENTRIES]; /* 30h */
} u;
-} ARCMSR_CDB, *PARCMSR_CDB;
+};
/*
******************************************************************************************************
** Messaging Unit (MU) of the Intel R 80331 I/O processor (80331)
@@ -421,7 +419,7 @@ typedef struct _ARCMSR_CDB {
** 0FFCH ] 1004 Index Registers
*******************************************************************************
*/
-typedef struct _MU {
+struct MU {
uint32_t resrved0[4]; /*0000 000F */
uint32_t inbound_msgaddr0; /*0010 0013 */
uint32_t inbound_msgaddr1; /*0014 0017 */
@@ -444,20 +442,20 @@ typedef struct _MU {
uint32_t reserved4[32]; /*0E80 0EFF 32 */
uint32_t ioctl_rbuffer[32]; /*0F00 0F7F 32 */
uint32_t reserved5[32]; /*0F80 0FFF 32 */
-} MU, *PMU;
+};
/*
*********************************************************************
** Adapter Control Block
**
*********************************************************************
*/
-typedef struct _ACB {
+struct ACB {
struct pci_dev *pPCI_DEV;
struct Scsi_Host *host;
unsigned long vir2phy_offset; /* Offset is used in making arc cdb physical to virtual calculations */
uint32_t outbound_int_enable;

- struct _MU *pmu; /* message unit ATU inbound base address0 */
+ struct MU *pmu; /* message unit ATU inbound base address0 */

uint8_t adapter_index; /* */
uint8_t irq;
@@ -471,14 +469,14 @@ typedef struct _ACB {
#define ACB_F_BUS_RESET 0x0040
#define ACB_F_IOP_INITED 0x0080 /* iop init */

- struct _CCB *pccbwait2go[ARCMSR_MAX_OUTSTANDING_CMD];
+ struct CCB *pccbwait2go[ARCMSR_MAX_OUTSTANDING_CMD];
atomic_t ccbwait2gocount;
atomic_t ccboutstandingcount;

void *dma_coherent; /* dma_coherent used for memory free */
dma_addr_t dma_coherent_handle; /* dma_coherent_handle used for memory free */
- struct _CCB *pccb_pool[ARCMSR_MAX_FREECCB_NUM]; /* serial ccb pointer array */
- struct _CCB *pccbringQ[ARCMSR_MAX_FREECCB_NUM]; /* working ccb pointer array */
+ struct CCB *pccb_pool[ARCMSR_MAX_FREECCB_NUM]; /* serial ccb pointer array */
+ struct CCB *pccbringQ[ARCMSR_MAX_FREECCB_NUM]; /* working ccb pointer array */
int32_t ccb_doneindex; /* done ccb array index */
int32_t ccb_startindex; /* start ccb array index */

@@ -495,7 +493,7 @@ typedef struct _ACB {
spinlock_t qbuffer_lockunlock;
spinlock_t ccb_doneindex_lockunlock;
spinlock_t ccb_startindex_lockunlock;
- uint8_t devstate[ARCMSR_MAX_TARGETID][ARCMSR_MAX_TARGETLUN]; /* id0 ..... id15,lun0...lun7 */
+ uint8_t devstate[ARCMSR_MAX_TARGETID][ARCMSR_MAX_TARGETLUN]; /* id0 ..... id15, lun0...lun7 */
#define ARECA_RAID_GONE 0x55
#define ARECA_RAID_GOOD 0xaa
uint32_t num_resets;
@@ -506,23 +504,23 @@ typedef struct _ACB {
uint32_t firm_ide_channels; /*4,16-19 */
char firm_model[12]; /*15,60-67 */
char firm_version[20]; /*17,68-83 */
-} ACB, *PACB; /* HW_DEVICE_EXTENSION */
+};
/*
*********************************************************************
** Command Control Block (SrbExtension)
-** CCB must be not cross page boundary,and the order from offset 0
+** CCB must be not cross page boundary, and the order from offset 0
** structure describing an ATA disk request
** this CCB length must be 32 bytes boundary
*********************************************************************
*/
-typedef struct _CCB {
- struct _ARCMSR_CDB arcmsr_cdb; /* 0-503 (size of CDB=504): arcmsr messenger scsi command descriptor size 504 bytes */
+struct CCB {
+ struct ARCMSR_CDB arcmsr_cdb; /* 0-503 (size of CDB=504): arcmsr messenger scsi command descriptor size 504 bytes */
uint32_t cdb_shifted_phyaddr; /* 504-507 */
uint32_t reserved1; /* 508-511 */
/* ======================512+32 bytes======================== */
#if BITS_PER_LONG == 64
struct scsi_cmnd *pcmd; /* 512-515 516-519 pointer of linux scsi command */
- struct _ACB *pACB; /* 520-523 524-527 */
+ struct ACB *pACB; /* 520-523 524-527 */

uint16_t ccb_flags; /* 528-529 */
#define CCB_FLAG_READ 0x0000
@@ -538,7 +536,7 @@ typedef struct _CCB {
uint32_t reserved2[3]; /* 532-535 536-539 540-543 */
#else
struct scsi_cmnd *pcmd; /* 512-515 pointer of linux scsi command */
- struct _ACB *pACB; /* 516-519 */
+ struct ACB *pACB; /* 516-519 */

uint16_t ccb_flags; /* 520-521 */
#define CCB_FLAG_READ 0x0000
@@ -554,25 +552,25 @@ typedef struct _CCB {
uint32_t reserved2[5]; /* 524-527 528-531 532-535 536-539 540-543 */
#endif
/* ========================================================== */
-} CCB, *PCCB;
+};
/*
*********************************************************************
**
*********************************************************************
*/
-typedef struct _HCBARC {
- struct _ACB *pACB[ARCMSR_MAX_ADAPTER];
+struct HCBARC {
+ struct ACB *pACB[ARCMSR_MAX_ADAPTER];

int32_t arcmsr_major_number;

uint8_t adapterCnt;
uint8_t reserved[3];
-} HCBARC, *PHCBARC;
+};
/*
*************************************************************
*************************************************************
*/
-typedef struct _SENSE_DATA {
+struct SENSE_DATA {
uint8_t ErrorCode:7;
uint8_t Valid:1;
uint8_t SegmentNumber;
@@ -588,7 +586,7 @@ typedef struct _SENSE_DATA {
uint8_t AdditionalSenseCodeQualifier;
uint8_t FieldReplaceableUnitCode;
uint8_t SenseKeySpecific[3];
-} SENSE_DATA, *PSENSE_DATA;
+};
/*
**********************************
** Peripheral Device Type definitions
@@ -755,7 +753,7 @@ typedef struct _SENSE_DATA {
#define ARCMSR_PCI2PCI_REVISIONID_REG 0x08 /*byte */
/*
**==============================================================================
-** 0x0b-0x09 : 0180_00 (class code 1,native pci mode )
+** 0x0b-0x09 : 0180_00 (class code 1, native pci mode )
** Bit Default Description
** 23:16 06h Base Class Code (BCC): Indicates that this is a bridge device.
** 15:08 04h Sub Class Code (SCC): Indicates this is of type PCI-to-PCI bridge.
@@ -796,7 +794,7 @@ typedef struct _SENSE_DATA {
#define ARCMSR_PCI2PCI_PRIMARY_LATENCYTIMER_REG 0x0D /*byte */
/*
**==============================================================================
-** 0x0e : (header type,single function )
+** 0x0e : (header type, single function )
** Bit Default Description
** 07 0 Multi-function device (MVD): 80331 is a single-function device.
** 06:00 01h Header Type (HTYPE): Defines the layout of addresses 10h through 3Fh in configuration space.
@@ -838,12 +836,12 @@ typedef struct _SENSE_DATA {
** Bit Default Description
** Secondary Latency Timer (STV):
** 07:00 00h (Conventional PCI) Conventional PCI Mode: Secondary bus Master latency timer.
-** Indicates the number of PCI clock cycles,referenced from the assertion of FRAME# to the expiration of the timer,
+** Indicates the number of PCI clock cycles, referenced from the assertion of FRAME# to the expiration of the timer,
** when bridge may continue as master of the current transaction. All bits are writable,
** resulting in a granularity of 1 PCI clock cycle.
** When the timer expires (i.e., equals 00h) bridge relinquishes the bus after the first data transfer when its PCI bus grant has been deasserted.
** or 40h (PCI-X) PCI-X Mode: Secondary bus Master latency timer.
-** Indicates the number of PCI clock cycles,referenced from the assertion of FRAME# to the expiration of the timer,
+** Indicates the number of PCI clock cycles, referenced from the assertion of FRAME# to the expiration of the timer,
** when bridge may continue as master of the current transaction. All bits are writable,
** resulting in a granularity of 1 PCI clock cycle.
** When the timer expires (i.e., equals 00h) bridge relinquishes the bus at the next ADB.
@@ -985,7 +983,7 @@ typedef struct _SENSE_DATA {
** The delayed completion is then discarded.
** 09 0b Secondary Discard Timer (SDT): Sets the maximum number of PCI clock cycles that bridge waits for an initiator on the secondary bus to repeat a delayed transaction request.
** The counter starts when the delayed transaction completion is ready to be returned to the initiator.
-** When the initiator has not repeated the transaction at least once before the counter expires,bridge discards the delayed transaction from its queues.
+** When the initiator has not repeated the transaction at least once before the counter expires, bridge discards the delayed transaction from its queues.
** 0b=The secondary master time-out counter is 2 15 PCI clock cycles.
** 1b=The secondary master time-out counter is 2 10 PCI clock cycles.
** 08 0b Primary Discard Timer (PDT): Sets the maximum number of PCI clock cycles that bridge waits for an initiator on the primary bus to repeat a delayed transaction request.
@@ -998,15 +996,15 @@ typedef struct _SENSE_DATA {
** When cleared to 0b: The bridge deasserts S_RST#, when it had been asserted by writing this bit to a 1b.
** When set to 1b: The bridge asserts S_RST#.
** 05 0b Master Abort Mode (MAM): Dictates bridge behavior on the initiator bus when a master abort termination occurs in response to a delayed transaction initiated by bridge on the target bus.
-** 0b=The bridge asserts TRDY# in response to a non-locked delayed transaction,and returns FFFF FFFFh when a read.
-** 1b=When the transaction had not yet been completed on the initiator bus (e.g.,delayed reads, or non-posted writes),
+** 0b=The bridge asserts TRDY# in response to a non-locked delayed transaction, and returns FFFF FFFFh when a read.
+** 1b=When the transaction had not yet been completed on the initiator bus (e.g., delayed reads, or non-posted writes),
** then bridge returns a Target Abort in response to the original requester
** when it returns looking for its delayed completion on the initiator bus.
** When the transaction had completed on the initiator bus (e.g., a PMW), then bridge asserts P_SERR# (when enabled).
** For PCI-X transactions this bit is an enable for the assertion of P_SERR# due to a master abort while attempting to deliver a posted memory write on the destination bus.
** 04 0b VGA Alias Filter Enable: This bit dictates bridge behavior in conjunction with the VGA enable bit (also of this register),
** and the VGA Palette Snoop Enable bit (Command Register).
-** When the VGA enable, or VGA Palette Snoop enable bits are on (i.e., 1b) the VGA Aliasing bit for the corresponding enabled functionality,:
+** When the VGA enable, or VGA Palette Snoop enable bits are on (i.e., 1b) the VGA Aliasing bit for the corresponding enabled functionality:
** 0b=Ignores address bits AD[15:10] when decoding VGA I/O addresses.
** 1b=Ensures that address bits AD[15:10] equal 000000b when decoding VGA I/O addresses.
** When all VGA cycle forwarding is disabled, (i.e., VGA Enable bit =0b and VGA Palette Snoop bit =0b), then this bit has no impact on bridge behavior.
@@ -1058,7 +1056,7 @@ typedef struct _SENSE_DATA {
**==============================================================================
** 0x42-0x41: Secondary Arbiter Control/Status Register - SACSR
** Bit Default Description
-** 15:12 1111b Grant Time-out Violator: This field indicates the agent that violated the Grant Time-out rule (PCI=16 clocks,PCI-X=6 clocks).
+** 15:12 1111b Grant Time-out Violator: This field indicates the agent that violated the Grant Time-out rule (PCI=16 clocks, PCI-X=6 clocks).
** Note that this field is only meaningful when:
** # Bit[11] of this register is set to 1b, indicating that a Grant Time-out violation had occurred.
** # bridge internal arbiter is enabled.
@@ -1617,7 +1615,7 @@ typedef struct _SENSE_DATA {
** 07:00 00H Programming Interface - None defined
***********************************************************************************
*/
-#define ARCMSR_ATU_CLASS_CODE_REG 0x09 /*3bytes 0x0B,0x0A,0x09 */
+#define ARCMSR_ATU_CLASS_CODE_REG 0x09 /*3 bytes: 0x0B,0x0A,0x09 */
/*
***********************************************************************************
** ATU Cacheline Size Register - ATUCLSR
@@ -4568,7 +4566,7 @@ typedef struct _SENSE_DATA {
** byte 2 : command code 0x52
** byte 3 : raidset#
** byte 4/5/6/7 : device mask for expansion
-** byte 8/9/10 : (8:0 no change, 1 change, 0xff:terminate, 9:new raid level,10:new stripe size 0/1/2/3/4/5->4/8/16/32/64/128K )
+** byte 8/9/10 : (8:0 no change, 1 change, 0xff:terminate; 9:new raid level; 10:new stripe size 0/1/2/3/4/5->4/8/16/32/64/128K )
** byte 11/12/13 : repeat for each volume in the raidset ....
**
** GUI_ACTIVATE_RAIDSET : Activate incomplete raid set
--- linux-2615-rc7.orig/drivers/scsi/arcmsr/arcmsr.txt
+++ linux-2615-rc7/drivers/scsi/arcmsr/arcmsr.txt
@@ -27,9 +27,9 @@ History
1.20.00.07 3/23/2005 Erich Chen bug fix with arcmsr_scsi_host_template_init ocur segmentation fault,
if RAID adapter does not on PCI slot and modprobe/rmmod this driver twice.
bug fix enormous stack usage (Adrian Bunk's comment)
- 1.20.00.08 6/23/2005 Erich Chen bug fix with abort command,in case of heavy loading when sata cable
+ 1.20.00.08 6/23/2005 Erich Chen bug fix with abort command, in case of heavy loading when sata cable
working on low quality connection
- 1.20.00.09 9/12/2005 Erich Chen bug fix with abort command handling,firmware version check
+ 1.20.00.09 9/12/2005 Erich Chen bug fix with abort command handling, firmware version check
and firmware update notify for hardware bug fix
1.20.00.10 9/23/2005 Erich Chen enhance sysfs function for change driver's max tag Q number.
add DMA_64BIT_MASK for backward compatible with all 2.6.x
@@ -75,15 +75,15 @@ config SCSI_ARCMSR
tristate "ARECA ARC11X0[PCI-X]/ARC12X0[PCI-EXPRESS] SATA-RAID support"
depends on PCI && SCSI
help
- This driver supports all of ARECA's SATA RAID controllers cards.
- This is an ARECA maintained driver by Erich Chen.
+ This driver supports all of ARECA's SATA RAID controller cards.
+ This is an ARECA-maintained driver by Erich Chen.
If you have any problems, please mail to: < [email protected] >
- Areca have suport Linux RAID config tools
+ Areca supports Linux RAID config tools.

< http://www.areca.com.tw >

To compile this driver as a module, choose M here: the
- module will be called arcmsr (modprobe arcmsr) .
+ module will be called arcmsr (modprobe arcmsr).

....
...
@@ -110,25 +110,25 @@ Copyright
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
************************************************************************
-** Redistribution and use in source and binary forms,with or without
-** modification,are permitted provided that the following conditions
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
** are met:
** 1. Redistributions of source code must retain the above copyright
-** notice,this list of conditions and the following disclaimer.
+** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
-** notice,this list of conditions and the following disclaimer in the
+** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-** IMPLIED WARRANTIES,INCLUDING,BUT NOT LIMITED TO,THE IMPLIED WARRANTIES
+** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,INDIRECT,
-** INCIDENTAL,SPECIAL,EXEMPLARY,OR CONSEQUENTIAL DAMAGES(INCLUDING,BUT
-** NOT LIMITED TO,PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA,OR PROFITS; OR BUSINESS INTERRUPTION)HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY,WHETHER IN CONTRACT,STRICT LIABILITY,OR TORT
+** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT
+** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION)HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
**(INCLUDING NEGLIGENCE OR OTHERWISE)ARISING IN ANY WAY OUT OF THE USE OF
-** THIS SOFTWARE,EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**************************************************************************
--- linux-2615-rc7.orig/drivers/scsi/arcmsr/arcmsr.c
+++ linux-2615-rc7/drivers/scsi/arcmsr/arcmsr.c
@@ -19,27 +19,27 @@
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
************************************************************************
-** Redistribution and use in source and binary forms,with or without
-** modification,are permitted provided that the following conditions
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
** are met:
** 1. Redistributions of source code must retain the above copyright
-** notice,this list of conditions and the following disclaimer.
+** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
-** notice,this list of conditions and the following disclaimer in the
+** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-** IMPLIED WARRANTIES,INCLUDING,BUT NOT LIMITED TO,THE IMPLIED WARRANTIES
+** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,INDIRECT,
-** INCIDENTAL,SPECIAL,EXEMPLARY,OR CONSEQUENTIAL DAMAGES(INCLUDING,BUT
-** NOT LIMITED TO,PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA,OR PROFITS; OR BUSINESS INTERRUPTION)HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY,WHETHER IN CONTRACT,STRICT LIABILITY,OR TORT
+** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT
+** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION)HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
**(INCLUDING NEGLIGENCE OR OTHERWISE)ARISING IN ANY WAY OUT OF THE USE OF
-** THIS SOFTWARE,EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**************************************************************************
** History
**
@@ -67,9 +67,9 @@
** 1.20.00.07 3/23/2005 Erich Chen bug fix with arcmsr_scsi_host_template_init ocur segmentation fault,
** if RAID adapter does not on PCI slot and modprobe/rmmod this driver twice.
** bug fix enormous stack usage (Adrian Bunk's comment)
-** 1.20.00.08 6/23/2005 Erich Chen bug fix with abort command,in case of heavy loading when sata cable
+** 1.20.00.08 6/23/2005 Erich Chen bug fix with abort command, in case of heavy loading when sata cable
** working on low quality connection
-** 1.20.00.09 9/12/2005 Erich Chen bug fix with abort command handling,firmware version check
+** 1.20.00.09 9/12/2005 Erich Chen bug fix with abort command handling, firmware version check
** and firmware update notify for hardware bug fix
** 1.20.00.10 9/23/2005 Erich Chen enhance sysfs function for change driver's max tag Q number.
** add DMA_64BIT_MASK for backward compatible with all 2.6.x
@@ -82,7 +82,7 @@
** change 64bit pci_set_consistent_dma_mask into 32bit
** increcct adapter count if adapter initialize fail.
** miss edit at arcmsr_build_ccb....
-** psge += sizeof(struct _SG64ENTRY *) => psge += sizeof(struct _SG64ENTRY)
+** psge += sizeof(struct SG64ENTRY *) => psge += sizeof(struct SG64ENTRY)
** 64 bits sg entry would be incorrectly calculated
** thanks Kornel Wieliczek give me kindly notify and detail description
******************************************************************************************
@@ -117,7 +117,7 @@ MODULE_LICENSE("Dual BSD/GPL");
**********************************************************************************
*/
static u_int8_t arcmsr_adapterCnt = 0;
-static struct _HCBARC arcmsr_host_control_block;
+static struct HCBARC arcmsr_host_control_block;
/*
**********************************************************************************
**********************************************************************************
@@ -128,8 +128,8 @@ static int arcmsr_fops_close(struct inod
static int arcmsr_fops_open(struct inode *inode, struct file *filep);
static int arcmsr_halt_notify(struct notifier_block *nb, unsigned long event,
void *buf);
-static int arcmsr_initialize(struct _ACB *pACB, struct pci_dev *pPCI_DEV);
-static int arcmsr_iop_ioctlcmd(struct _ACB *pACB, int ioctl_cmd, void *arg);
+static int arcmsr_initialize(struct ACB *pACB, struct pci_dev *pPCI_DEV);
+static int arcmsr_iop_ioctlcmd(struct ACB *pACB, int ioctl_cmd, void *arg);
static int arcmsr_proc_info(struct Scsi_Host *host, char *buffer, char **start,
off_t offset, int length, int inout);
static int arcmsr_bios_param(struct scsi_device *sdev,
@@ -144,11 +144,11 @@ static int arcmsr_ioctl(struct scsi_devi
static int __devinit arcmsr_device_probe(struct pci_dev *pPCI_DEV,
const struct pci_device_id *id);
static void arcmsr_device_remove(struct pci_dev *pPCI_DEV);
-static void arcmsr_pcidev_disattach(struct _ACB *pACB);
-static void arcmsr_iop_init(struct _ACB *pACB);
-static void arcmsr_free_ccb_pool(struct _ACB *pACB);
-static irqreturn_t arcmsr_interrupt(struct _ACB *pACB);
-static u_int8_t arcmsr_wait_msgint_ready(struct _ACB *pACB);
+static void arcmsr_pcidev_disattach(struct ACB *pACB);
+static void arcmsr_iop_init(struct ACB *pACB);
+static void arcmsr_free_ccb_pool(struct ACB *pACB);
+static irqreturn_t arcmsr_interrupt(struct ACB *pACB);
+static u_int8_t arcmsr_wait_msgint_ready(struct ACB *pACB);
static const char *arcmsr_info(struct Scsi_Host *);
/*
**********************************************************************************
@@ -158,7 +158,7 @@ static const char *arcmsr_info(struct Sc
static ssize_t arcmsr_show_firmware_info(struct class_device *dev, char *buf)
{
struct Scsi_Host *host = class_to_shost(dev);
- struct _ACB *pACB = (struct _ACB *)host->hostdata;
+ struct ACB *pACB = (struct ACB *)host->hostdata;
unsigned long flags = 0;
ssize_t len;

@@ -186,7 +186,7 @@ static ssize_t arcmsr_show_firmware_info
static ssize_t arcmsr_show_driver_state(struct class_device *dev, char *buf)
{
struct Scsi_Host *host = class_to_shost(dev);
- struct _ACB *pACB = (struct _ACB *)host->hostdata;
+ struct ACB *pACB = (struct ACB *)host->hostdata;
unsigned long flags = 0;
ssize_t len;

@@ -236,9 +236,8 @@ static struct class_device_attribute *ar
static int arcmsr_adjust_disk_queue_depth(struct scsi_device *sdev,
int queue_depth)
{
- if (queue_depth > ARCMSR_MAX_CMD_PERLUN) {
+ if (queue_depth > ARCMSR_MAX_CMD_PERLUN)
queue_depth = ARCMSR_MAX_CMD_PERLUN;
- }
scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
return queue_depth;
}
@@ -246,16 +245,13 @@ static struct scsi_host_template arcmsr_
.module = THIS_MODULE,
.proc_name = "arcmsr",
.proc_info = arcmsr_proc_info,
- .name = "ARCMSR ARECA SATA RAID HOST Adapter" ARCMSR_DRIVER_VERSION, /* *name */
+ .name = "ARCMSR ARECA SATA RAID HOST Adapter" ARCMSR_DRIVER_VERSION,
.release = arcmsr_release,
.info = arcmsr_info,
.ioctl = arcmsr_ioctl,
.queuecommand = arcmsr_queue_command,
- .eh_strategy_handler = NULL,
.eh_abort_handler = arcmsr_cmd_abort,
- .eh_device_reset_handler = NULL,
.eh_bus_reset_handler = arcmsr_bus_reset,
- .eh_host_reset_handler = NULL,
.bios_param = arcmsr_bios_param,
.change_queue_depth = arcmsr_adjust_disk_queue_depth,
.can_queue = ARCMSR_MAX_OUTSTANDING_CMD,
@@ -274,7 +270,8 @@ static struct scsi_host_template arcmsr_
**********************************************************************************
*/
static struct notifier_block arcmsr_event_notifier =
- { arcmsr_halt_notify, NULL, 0 };
+ { .notifier_call = arcmsr_halt_notify };
+
static struct file_operations arcmsr_file_operations = {
.owner = THIS_MODULE,
.ioctl = arcmsr_fops_ioctl,
@@ -284,26 +281,16 @@ static struct file_operations arcmsr_fil

/* We do our own ID filtering. So, grab all SCSI storage class devices. */
static struct pci_device_id arcmsr_device_id_table[] __devinitdata = {
- {.vendor = PCIVendorIDARECA,.device = PCIDeviceIDARC1110,.subvendor =
- PCI_ANY_ID,.subdevice = PCI_ANY_ID,},
- {.vendor = PCIVendorIDARECA,.device = PCIDeviceIDARC1120,.subvendor =
- PCI_ANY_ID,.subdevice = PCI_ANY_ID,},
- {.vendor = PCIVendorIDARECA,.device = PCIDeviceIDARC1130,.subvendor =
- PCI_ANY_ID,.subdevice = PCI_ANY_ID,},
- {.vendor = PCIVendorIDARECA,.device = PCIDeviceIDARC1160,.subvendor =
- PCI_ANY_ID,.subdevice = PCI_ANY_ID,},
- {.vendor = PCIVendorIDARECA,.device = PCIDeviceIDARC1170,.subvendor =
- PCI_ANY_ID,.subdevice = PCI_ANY_ID,},
- {.vendor = PCIVendorIDARECA,.device = PCIDeviceIDARC1210,.subvendor =
- PCI_ANY_ID,.subdevice = PCI_ANY_ID,},
- {.vendor = PCIVendorIDARECA,.device = PCIDeviceIDARC1220,.subvendor =
- PCI_ANY_ID,.subdevice = PCI_ANY_ID,},
- {.vendor = PCIVendorIDARECA,.device = PCIDeviceIDARC1230,.subvendor =
- PCI_ANY_ID,.subdevice = PCI_ANY_ID,},
- {.vendor = PCIVendorIDARECA,.device = PCIDeviceIDARC1260,.subvendor =
- PCI_ANY_ID,.subdevice = PCI_ANY_ID,},
- {.vendor = PCIVendorIDARECA,.device = PCIDeviceIDARC1270,.subvendor =
- PCI_ANY_ID,.subdevice = PCI_ANY_ID,},
+ {PCI_DEVICE(PCIVendorIDARECA, PCIDeviceIDARC1110)},
+ {PCI_DEVICE(PCIVendorIDARECA, PCIDeviceIDARC1120)},
+ {PCI_DEVICE(PCIVendorIDARECA, PCIDeviceIDARC1130)},
+ {PCI_DEVICE(PCIVendorIDARECA, PCIDeviceIDARC1160)},
+ {PCI_DEVICE(PCIVendorIDARECA, PCIDeviceIDARC1170)},
+ {PCI_DEVICE(PCIVendorIDARECA, PCIDeviceIDARC1210)},
+ {PCI_DEVICE(PCIVendorIDARECA, PCIDeviceIDARC1220)},
+ {PCI_DEVICE(PCIVendorIDARECA, PCIDeviceIDARC1230)},
+ {PCI_DEVICE(PCIVendorIDARECA, PCIDeviceIDARC1260)},
+ {PCI_DEVICE(PCIVendorIDARECA, PCIDeviceIDARC1270)},
{0, 0}, /* Terminating entry */
};

@@ -323,24 +310,23 @@ static irqreturn_t arcmsr_do_interrupt(i
struct pt_regs *regs)
{
irqreturn_t handle_state;
- struct _HCBARC *pHCBARC = &arcmsr_host_control_block;
- struct _ACB *pACB;
- struct _ACB *pACBtmp;
+ struct HCBARC *pHCBARC = &arcmsr_host_control_block;
+ struct ACB *pACB;
+ struct ACB *pACBtmp;
int i = 0;

- pACB = (struct _ACB *)dev_id;
+ pACB = (struct ACB *)dev_id;
pACBtmp = pHCBARC->pACB[i];
while ((pACB != pACBtmp) && pACBtmp && (i < ARCMSR_MAX_ADAPTER)) {
i++;
pACBtmp = pHCBARC->pACB[i];
}
- if (!pACBtmp) {
+ if (!pACBtmp)
return IRQ_NONE;
- }
spin_lock_irq(&pACB->isr_lockunlock);
handle_state = arcmsr_interrupt(pACB);
spin_unlock_irq(&pACB->isr_lockunlock);
- return (handle_state);
+ return handle_state;
}

/*
@@ -365,7 +351,7 @@ static int arcmsr_bios_param(struct scsi
geom[0] = heads;
geom[1] = sectors;
geom[2] = cylinders;
- return (0);
+ return 0;
}

/*
@@ -376,8 +362,8 @@ static int __devinit arcmsr_device_probe
const struct pci_device_id *id)
{
struct Scsi_Host *host;
- struct _HCBARC *pHCBARC = &arcmsr_host_control_block;
- struct _ACB *pACB;
+ struct HCBARC *pHCBARC = &arcmsr_host_control_block;
+ struct ACB *pACB;
uint8_t bus, dev_fun;

if (pci_enable_device(pPCI_DEV)) {
@@ -388,20 +374,20 @@ static int __devinit arcmsr_device_probe
/* allocate scsi host information (includes out adapter) scsi_host_alloc==scsi_register */
if ((host =
scsi_host_alloc(&arcmsr_scsi_host_template,
- sizeof(struct _ACB))) == 0) {
+ sizeof(struct ACB))) == 0) {
printk("arcmsr%d adapter probe: scsi_host_alloc error \n",
arcmsr_adapterCnt);
return -ENODEV;
}
- if (!pci_set_dma_mask(pPCI_DEV, DMA_64BIT_MASK)) {
+ if (!pci_set_dma_mask(pPCI_DEV, DMA_64BIT_MASK))
printk
("ARECA RAID ADAPTER%d: 64BITS PCI BUS DMA ADDRESSING SUPPORTED\n",
arcmsr_adapterCnt);
- } else if (!pci_set_dma_mask(pPCI_DEV, DMA_32BIT_MASK)) {
+ else if (!pci_set_dma_mask(pPCI_DEV, DMA_32BIT_MASK))
printk
("ARECA RAID ADAPTER%d: 32BITS PCI BUS DMA ADDRESSING SUPPORTED\n",
arcmsr_adapterCnt);
- } else {
+ else {
printk("ARECA RAID ADAPTER%d: No suitable DMA available.\n",
arcmsr_adapterCnt);
return -ENOMEM;
@@ -414,8 +400,8 @@ static int __devinit arcmsr_device_probe
}
bus = pPCI_DEV->bus->number;
dev_fun = pPCI_DEV->devfn;
- pACB = (struct _ACB *)host->hostdata;
- memset(pACB, 0, sizeof(struct _ACB));
+ pACB = (struct ACB *)host->hostdata;
+ memset(pACB, 0, sizeof(struct ACB));
spin_lock_init(&pACB->isr_lockunlock);
spin_lock_init(&pACB->wait2go_lockunlock);
spin_lock_init(&pACB->qbuffer_lockunlock);
@@ -426,7 +412,7 @@ static int __devinit arcmsr_device_probe
host->max_sectors = ARCMSR_MAX_XFER_SECTORS;
host->max_lun = ARCMSR_MAX_TARGETLUN;
host->max_id = ARCMSR_MAX_TARGETID; /*16:8 */
- host->max_cmd_len = 16; /*this is issue of 64bit LBA ,over 2T byte */
+ host->max_cmd_len = 16; /*this is issue of 64bit LBA, over 2T byte */
host->sg_tablesize = ARCMSR_MAX_SG_ENTRIES;
host->can_queue = ARCMSR_MAX_OUTSTANDING_CMD; /* max simultaneous cmds */
host->cmd_per_lun = ARCMSR_MAX_CMD_PERLUN;
@@ -483,12 +469,12 @@ static int __devinit arcmsr_device_probe
static void arcmsr_device_remove(struct pci_dev *pPCI_DEV)
{
struct Scsi_Host *host = pci_get_drvdata(pPCI_DEV);
- struct _HCBARC *pHCBARC = &arcmsr_host_control_block;
- struct _ACB *pACB = (struct _ACB *)host->hostdata;
+ struct HCBARC *pHCBARC = &arcmsr_host_control_block;
+ struct ACB *pACB = (struct ACB *)host->hostdata;
int i;

/* Flush cache to disk */
- /* Free irq,otherwise extra interrupt is generated */
+ /* Free irq, otherwise extra interrupt is generated */
/* Issue a blocking(interrupts disabled) command to the card */
arcmsr_pcidev_disattach(pACB);
scsi_remove_host(host);
@@ -496,13 +482,11 @@ static void arcmsr_device_remove(struct
pci_set_drvdata(pPCI_DEV, NULL);
/*if this is last pACB */
for (i = 0; i < ARCMSR_MAX_ADAPTER; i++) {
- if (pHCBARC->pACB[i] != NULL) {
+ if (pHCBARC->pACB[i])
return; /* this is not last adapter's release */
- }
}
unregister_chrdev(pHCBARC->arcmsr_major_number, "arcmsr");
unregister_reboot_notifier(&arcmsr_event_notifier);
- return;
}

/*
@@ -513,14 +497,14 @@ static int arcmsr_scsi_host_template_ini
*host_template)
{
int error;
- struct _HCBARC *pHCBARC = &arcmsr_host_control_block;
+ struct HCBARC *pHCBARC = &arcmsr_host_control_block;

/*
** register as a PCI hot-plug driver module
*/
- memset(pHCBARC, 0, sizeof(struct _HCBARC));
+ memset(pHCBARC, 0, sizeof(struct HCBARC));
error = pci_module_init(&arcmsr_pci_driver);
- if (pHCBARC->pACB[0] != NULL) {
+ if (pHCBARC->pACB[0]) {
host_template->proc_name = "arcmsr";
register_reboot_notifier(&arcmsr_event_notifier);
pHCBARC->arcmsr_major_number =
@@ -528,7 +512,7 @@ static int arcmsr_scsi_host_template_ini
printk("arcmsr device major number %d \n",
pHCBARC->arcmsr_major_number);
}
- return (error);
+ return error;
}

/*
@@ -537,7 +521,7 @@ static int arcmsr_scsi_host_template_ini
*/
static int arcmsr_module_init(void)
{
- return (arcmsr_scsi_host_template_init(&arcmsr_scsi_host_template));
+ return arcmsr_scsi_host_template_init(&arcmsr_scsi_host_template);
}

/*
@@ -547,7 +531,6 @@ static int arcmsr_module_init(void)
static void arcmsr_module_exit(void)
{
pci_unregister_driver(&arcmsr_pci_driver);
- return;
}

module_init(arcmsr_module_init);
@@ -556,9 +539,9 @@ module_exit(arcmsr_module_exit);
**********************************************************************
**********************************************************************
*/
-static void arcmsr_pci_unmap_dma(struct _CCB *pCCB)
+static void arcmsr_pci_unmap_dma(struct CCB *pCCB)
{
- struct _ACB *pACB = pCCB->pACB;
+ struct ACB *pACB = pCCB->pACB;
struct scsi_cmnd *pcmd = pCCB->pcmd;

if (pcmd->use_sg != 0) {
@@ -573,7 +556,6 @@ static void arcmsr_pci_unmap_dma(struct
pcmd->request_bufflen,
pcmd->sc_data_direction);
}
- return;
}

/*
@@ -583,23 +565,19 @@ static void arcmsr_pci_unmap_dma(struct
static int arcmsr_fops_open(struct inode *inode, struct file *filep)
{
int i, minor;
- struct _HCBARC *pHCBARC = &arcmsr_host_control_block;
- struct _ACB *pACB;
+ struct HCBARC *pHCBARC = &arcmsr_host_control_block;
+ struct ACB *pACB;

minor = MINOR(inode->i_rdev);
- if (minor >= pHCBARC->adapterCnt) {
+ if (minor >= pHCBARC->adapterCnt)
return -ENXIO;
- }
for (i = 0; i < ARCMSR_MAX_ADAPTER; i++) {
- if ((pACB = pHCBARC->pACB[i]) != NULL) {
- if (pACB->adapter_index == minor) {
+ if ((pACB = pHCBARC->pACB[i]))
+ if (pACB->adapter_index == minor)
break;
- }
- }
}
- if (i >= ARCMSR_MAX_ADAPTER) {
+ if (i >= ARCMSR_MAX_ADAPTER)
return -ENXIO;
- }
return 0; /* success */
}

@@ -610,23 +588,19 @@ static int arcmsr_fops_open(struct inode
static int arcmsr_fops_close(struct inode *inode, struct file *filep)
{
int i, minor;
- struct _HCBARC *pHCBARC = &arcmsr_host_control_block;
- struct _ACB *pACB;
+ struct HCBARC *pHCBARC = &arcmsr_host_control_block;
+ struct ACB *pACB;

minor = MINOR(inode->i_rdev);
- if (minor >= pHCBARC->adapterCnt) {
+ if (minor >= pHCBARC->adapterCnt)
return -ENXIO;
- }
for (i = 0; i < ARCMSR_MAX_ADAPTER; i++) {
- if ((pACB = pHCBARC->pACB[i]) != NULL) {
- if (pACB->adapter_index == minor) {
+ if ((pACB = pHCBARC->pACB[i]))
+ if (pACB->adapter_index == minor)
break;
- }
- }
}
- if (i >= ARCMSR_MAX_ADAPTER) {
+ if (i >= ARCMSR_MAX_ADAPTER)
return -ENXIO;
- }
return 0;
}

@@ -638,23 +612,19 @@ static int arcmsr_fops_ioctl(struct inod
unsigned int ioctl_cmd, unsigned long arg)
{
int i, minor;
- struct _HCBARC *pHCBARC = &arcmsr_host_control_block;
- struct _ACB *pACB;
+ struct HCBARC *pHCBARC = &arcmsr_host_control_block;
+ struct ACB *pACB;

minor = MINOR(inode->i_rdev);
- if (minor >= pHCBARC->adapterCnt) {
+ if (minor >= pHCBARC->adapterCnt)
return -ENXIO;
- }
for (i = 0; i < ARCMSR_MAX_ADAPTER; i++) {
- if ((pACB = pHCBARC->pACB[i]) != NULL) {
- if (pACB->adapter_index == minor) {
+ if ((pACB = pHCBARC->pACB[i]))
+ if (pACB->adapter_index == minor)
break;
- }
- }
}
- if (i >= ARCMSR_MAX_ADAPTER) {
+ if (i >= ARCMSR_MAX_ADAPTER)
return -ENXIO;
- }
/*
************************************************************
** We do not allow muti ioctls to the driver at the same duration.
@@ -667,10 +637,9 @@ static int arcmsr_fops_ioctl(struct inod
************************************************************************
************************************************************************
*/
-static void arcmsr_flush_adapter_cache(struct _ACB *pACB)
+static void arcmsr_flush_adapter_cache(struct ACB *pACB)
{
writel(ARCMSR_INBOUND_MESG0_FLUSH_CACHE, &pACB->pmu->inbound_msgaddr0);
- return;
}

/*
@@ -678,10 +647,10 @@ static void arcmsr_flush_adapter_cache(s
** Q back this CCB into ACB ArrayCCB
**********************************************************************
*/
-static void arcmsr_ccb_complete(struct _CCB *pCCB)
+static void arcmsr_ccb_complete(struct CCB *pCCB)
{
unsigned long flag;
- struct _ACB *pACB = pCCB->pACB;
+ struct ACB *pACB = pCCB->pACB;
struct scsi_cmnd *pcmd = pCCB->pcmd;

arcmsr_pci_unmap_dma(pCCB);
@@ -694,7 +663,6 @@ static void arcmsr_ccb_complete(struct _
pACB->ccb_doneindex %= ARCMSR_MAX_FREECCB_NUM;
spin_unlock_irqrestore(&pACB->ccb_doneindex_lockunlock, flag);
pcmd->scsi_done(pcmd);
- return;
}

/*
@@ -702,18 +670,18 @@ static void arcmsr_ccb_complete(struct _
** if scsi error do auto request sense
**********************************************************************
*/
-static void arcmsr_report_sense_info(struct _CCB *pCCB)
+static void arcmsr_report_sense_info(struct CCB *pCCB)
{
struct scsi_cmnd *pcmd = pCCB->pcmd;
- struct _SENSE_DATA *psenseBuffer =
- (struct _SENSE_DATA *)pcmd->sense_buffer;
+ struct SENSE_DATA *psenseBuffer =
+ (struct SENSE_DATA *)pcmd->sense_buffer;

pcmd->result = DID_OK << 16;
if (psenseBuffer) {
int sense_data_length =
- sizeof(struct _SENSE_DATA) <
+ sizeof(struct SENSE_DATA) <
sizeof(pcmd->
- sense_buffer) ? sizeof(struct _SENSE_DATA) :
+ sense_buffer) ? sizeof(struct SENSE_DATA) :
sizeof(pcmd->sense_buffer);
memset(psenseBuffer, 0, sizeof(pcmd->sense_buffer));
memcpy(psenseBuffer, pCCB->arcmsr_cdb.SenseData,
@@ -721,7 +689,6 @@ static void arcmsr_report_sense_info(str
psenseBuffer->ErrorCode = 0x70;
psenseBuffer->Valid = 1;
}
- return;
}

/*
@@ -729,7 +696,7 @@ static void arcmsr_report_sense_info(str
** to insert pCCB into tail of pACB wait exec ccbQ
*********************************************************************
*/
-static void arcmsr_queue_wait2go_ccb(struct _ACB *pACB, struct _CCB *pCCB)
+static void arcmsr_queue_wait2go_ccb(struct ACB *pACB, struct CCB *pCCB)
{
unsigned long flag;
int i = 0;
@@ -745,26 +712,24 @@ static void arcmsr_queue_wait2go_ccb(str
i++;
i %= ARCMSR_MAX_OUTSTANDING_CMD;
}
- return;
}

/*
*********************************************************************
*********************************************************************
*/
-static void arcmsr_abort_allcmd(struct _ACB *pACB)
+static void arcmsr_abort_allcmd(struct ACB *pACB)
{
printk
("arcmsr_abort_allcmd: try to abort all outstanding command............\n");
writel(ARCMSR_INBOUND_MESG0_ABORT_CMD, &pACB->pmu->inbound_msgaddr0);
- return;
}

/*
**********************************************************************
**********************************************************************
*/
-static u_int8_t arcmsr_wait_msgint_ready(struct _ACB *pACB)
+static u_int8_t arcmsr_wait_msgint_ready(struct ACB *pACB)
{
uint32_t Index;
uint8_t Retries = 0x00;
@@ -788,9 +753,9 @@ static u_int8_t arcmsr_wait_msgint_ready
** Return Value: Nothing.
****************************************************************************
*/
-static void arcmsr_iop_reset(struct _ACB *pACB)
+static void arcmsr_iop_reset(struct ACB *pACB)
{
- struct _CCB *pCCB;
+ struct CCB *pCCB;
uint32_t intmask_org, mask;
int i = 0;

@@ -828,7 +793,7 @@ static void arcmsr_iop_reset(struct _ACB
i = 0;
while (atomic_read(&pACB->ccbwait2gocount) != 0) {
pCCB = pACB->pccbwait2go[i];
- if (pCCB != NULL) {
+ if (pCCB) {
pACB->pccbwait2go[i] = NULL;
pCCB->startdone = ARCMSR_CCB_ABORTED;
pCCB->pcmd->result = DID_ABORT << 16;
@@ -839,24 +804,23 @@ static void arcmsr_iop_reset(struct _ACB
i %= ARCMSR_MAX_OUTSTANDING_CMD;
}
atomic_set(&pACB->ccboutstandingcount, 0);
- return;
}

/*
**********************************************************************
**********************************************************************
*/
-static void arcmsr_build_ccb(struct _ACB *pACB, struct _CCB *pCCB,
+static void arcmsr_build_ccb(struct ACB *pACB, struct CCB *pCCB,
struct scsi_cmnd *pcmd)
{
- struct _ARCMSR_CDB *pARCMSR_CDB =
- (struct _ARCMSR_CDB *)&pCCB->arcmsr_cdb;
- int8_t *psge = (int8_t *) & pARCMSR_CDB->u;
+ struct ARCMSR_CDB *pARCMSR_CDB =
+ (struct ARCMSR_CDB *)&pCCB->arcmsr_cdb;
+ int8_t *psge = (int8_t *)&pARCMSR_CDB->u;
uint32_t address_lo, address_hi;
int arccdbsize = 0x30;

pCCB->pcmd = pcmd;
- memset(pARCMSR_CDB, 0, sizeof(struct _ARCMSR_CDB));
+ memset(pARCMSR_CDB, 0, sizeof(struct ARCMSR_CDB));
pARCMSR_CDB->Bus = 0;
pARCMSR_CDB->TargetID = pcmd->device->id;
pARCMSR_CDB->LUN = pcmd->device->lun;
@@ -882,31 +846,30 @@ static void arcmsr_build_ccb(struct _ACB
address_hi =
cpu_to_le32(dma_addr_hi32(sg_dma_address(sl)));
if (address_hi == 0) {
- struct _SG32ENTRY *pdma_sg =
- (struct _SG32ENTRY *)psge;
+ struct SG32ENTRY *pdma_sg =
+ (struct SG32ENTRY *)psge;

pdma_sg->address = address_lo;
pdma_sg->length = length;
- psge += sizeof(struct _SG32ENTRY);
- arccdbsize += sizeof(struct _SG32ENTRY);
+ psge += sizeof(struct SG32ENTRY);
+ arccdbsize += sizeof(struct SG32ENTRY);
} else {
- struct _SG64ENTRY *pdma_sg =
- (struct _SG64ENTRY *)psge;
+ struct SG64ENTRY *pdma_sg =
+ (struct SG64ENTRY *)psge;

pdma_sg->addresshigh = address_hi;
pdma_sg->address = address_lo;
pdma_sg->length = length | IS_SG64_ADDR;
- psge += sizeof(struct _SG64ENTRY);
- arccdbsize += sizeof(struct _SG64ENTRY);
+ psge += sizeof(struct SG64ENTRY);
+ arccdbsize += sizeof(struct SG64ENTRY);
}
sl++;
cdb_sgcount++;
}
pARCMSR_CDB->sgcount = (uint8_t) cdb_sgcount;
pARCMSR_CDB->DataLength = pcmd->request_bufflen;
- if (arccdbsize > 256) {
+ if (arccdbsize > 256)
pARCMSR_CDB->Flags |= ARCMSR_CDB_FLAG_SGL_BSIZE;
- }
} else if (pcmd->request_bufflen) {
dma_addr_t dma_addr;
dma_addr =
@@ -917,11 +880,11 @@ static void arcmsr_build_ccb(struct _ACB
address_lo = cpu_to_le32(dma_addr_lo32(dma_addr));
address_hi = cpu_to_le32(dma_addr_hi32(dma_addr));
if (address_hi == 0) {
- struct _SG32ENTRY *pdma_sg = (struct _SG32ENTRY *)psge;
+ struct SG32ENTRY *pdma_sg = (struct SG32ENTRY *)psge;
pdma_sg->address = address_lo;
pdma_sg->length = pcmd->request_bufflen;
} else {
- struct _SG64ENTRY *pdma_sg = (struct _SG64ENTRY *)psge;
+ struct SG64ENTRY *pdma_sg = (struct SG64ENTRY *)psge;
pdma_sg->addresshigh = address_hi;
pdma_sg->address = address_lo;
pdma_sg->length = pcmd->request_bufflen | IS_SG64_ADDR;
@@ -933,7 +896,6 @@ static void arcmsr_build_ccb(struct _ACB
pARCMSR_CDB->Flags |= ARCMSR_CDB_FLAG_WRITE;
pCCB->ccb_flags |= CCB_FLAG_WRITE;
}
- return;
}

/*
@@ -947,31 +909,29 @@ static void arcmsr_build_ccb(struct _ACB
** specific ARC adapter.
**************************************************************************
*/
-static void arcmsr_post_ccb(struct _ACB *pACB, struct _CCB *pCCB)
+static void arcmsr_post_ccb(struct ACB *pACB, struct CCB *pCCB)
{
uint32_t cdb_shifted_phyaddr = pCCB->cdb_shifted_phyaddr;
- struct _ARCMSR_CDB *pARCMSR_CDB =
- (struct _ARCMSR_CDB *)&pCCB->arcmsr_cdb;
+ struct ARCMSR_CDB *pARCMSR_CDB =
+ (struct ARCMSR_CDB *)&pCCB->arcmsr_cdb;

atomic_inc(&pACB->ccboutstandingcount);
pCCB->startdone = ARCMSR_CCB_START;
- if (pARCMSR_CDB->Flags & ARCMSR_CDB_FLAG_SGL_BSIZE) {
+ if (pARCMSR_CDB->Flags & ARCMSR_CDB_FLAG_SGL_BSIZE)
writel(cdb_shifted_phyaddr | ARCMSR_CCBPOST_FLAG_SGL_BSIZE,
&pACB->pmu->inbound_queueport);
- } else {
+ else
writel(cdb_shifted_phyaddr, &pACB->pmu->inbound_queueport);
- }
- return;
}

/*
**************************************************************************
**************************************************************************
*/
-static void arcmsr_post_wait2go_ccb(struct _ACB *pACB)
+static void arcmsr_post_wait2go_ccb(struct ACB *pACB)
{
unsigned long flag;
- struct _CCB *pCCB;
+ struct CCB *pCCB;
int i = 0;

spin_lock_irqsave(&pACB->wait2go_lockunlock, flag);
@@ -979,7 +939,7 @@ static void arcmsr_post_wait2go_ccb(stru
&& (atomic_read(&pACB->ccboutstandingcount) <
ARCMSR_MAX_OUTSTANDING_CMD)) {
pCCB = pACB->pccbwait2go[i];
- if (pCCB != NULL) {
+ if (pCCB) {
pACB->pccbwait2go[i] = NULL;
arcmsr_post_ccb(pACB, pCCB);
atomic_dec(&pACB->ccbwait2gocount);
@@ -988,7 +948,6 @@ static void arcmsr_post_wait2go_ccb(stru
i %= ARCMSR_MAX_OUTSTANDING_CMD;
}
spin_unlock_irqrestore(&pACB->wait2go_lockunlock, flag);
- return;
}

/*
@@ -997,10 +956,10 @@ static void arcmsr_post_wait2go_ccb(stru
** Output:
**********************************************************************
*/
-static void arcmsr_post_Qbuffer(struct _ACB *pACB)
+static void arcmsr_post_Qbuffer(struct ACB *pACB)
{
uint8_t *pQbuffer;
- PQBUFFER pwbuffer = (PQBUFFER) & pACB->pmu->ioctl_wbuffer;
+ struct QBUFFER *pwbuffer = (struct QBUFFER *)&pACB->pmu->ioctl_wbuffer;
uint8_t *iop_data = (uint8_t *) pwbuffer->data;
int32_t allxfer_len = 0;

@@ -1019,31 +978,28 @@ static void arcmsr_post_Qbuffer(struct _
*/
writel(ARCMSR_INBOUND_DRIVER_DATA_WRITE_OK,
&pACB->pmu->inbound_doorbell);
- return;
}

/*
************************************************************************
************************************************************************
*/
-static void arcmsr_stop_adapter_bgrb(struct _ACB *pACB)
+static void arcmsr_stop_adapter_bgrb(struct ACB *pACB)
{
pACB->acb_flags |= ACB_F_MSG_STOP_BGRB;
pACB->acb_flags &= ~ACB_F_MSG_START_BGRB;
writel(ARCMSR_INBOUND_MESG0_STOP_BGRB, &pACB->pmu->inbound_msgaddr0);
- return;
}

/*
************************************************************************
************************************************************************
*/
-static void arcmsr_free_ccb_pool(struct _ACB *pACB)
+static void arcmsr_free_ccb_pool(struct ACB *pACB)
{
dma_free_coherent(&pACB->pPCI_DEV->dev,
- ARCMSR_MAX_FREECCB_NUM * sizeof(struct _CCB) + 0x20,
+ ARCMSR_MAX_FREECCB_NUM * sizeof(struct CCB) + 0x20,
pACB->dma_coherent, pACB->dma_coherent_handle);
- return;
}

/*
@@ -1065,9 +1021,9 @@ static void arcmsr_free_ccb_pool(struct
** DRIVER_OK 0x00 // Driver status
**********************************************************************
*/
-static irqreturn_t arcmsr_interrupt(struct _ACB *pACB)
+static irqreturn_t arcmsr_interrupt(struct ACB *pACB)
{
- struct _CCB *pCCB;
+ struct CCB *pCCB;
uint32_t flag_ccb, outbound_intstatus, outbound_doorbell;

/*
@@ -1087,8 +1043,8 @@ static irqreturn_t arcmsr_interrupt(stru
outbound_doorbell = readl(&pACB->pmu->outbound_doorbell);
writel(outbound_doorbell, &pACB->pmu->outbound_doorbell); /*clear interrupt */
if (outbound_doorbell & ARCMSR_OUTBOUND_IOP331_DATA_WRITE_OK) {
- PQBUFFER prbuffer =
- (PQBUFFER) & pACB->pmu->ioctl_rbuffer;
+ struct QBUFFER *prbuffer =
+ (struct QBUFFER *)&pACB->pmu->ioctl_rbuffer;
uint8_t *iop_data = (uint8_t *) prbuffer->data;
uint8_t *pQbuffer;
int32_t my_empty_len, iop_len, rqbuf_firstindex,
@@ -1125,8 +1081,8 @@ static irqreturn_t arcmsr_interrupt(stru
*/
if (pACB->wqbuf_firstindex != pACB->wqbuf_lastindex) {
uint8_t *pQbuffer;
- PQBUFFER pwbuffer =
- (PQBUFFER) & pACB->pmu->ioctl_wbuffer;
+ struct QBUFFER *pwbuffer =
+ (struct QBUFFER *)&pACB->pmu->ioctl_wbuffer;
uint8_t *iop_data = (uint8_t *) pwbuffer->data;
int32_t allxfer_len = 0;

@@ -1167,7 +1123,7 @@ static irqreturn_t arcmsr_interrupt(stru
break; /*chip FIFO no ccb for completion already */
}
/* check if command done with no error */
- pCCB = (struct _CCB *)(pACB->vir2phy_offset + (flag_ccb << 5)); /*frame must be 32 bytes aligned */
+ pCCB = (struct CCB *)(pACB->vir2phy_offset + (flag_ccb << 5)); /*frame must be 32 bytes aligned */
if ((pCCB->pACB != pACB)
|| (pCCB->startdone != ARCMSR_CCB_START)) {
if (pCCB->startdone == ARCMSR_CCB_ABORTED) {
@@ -1190,10 +1146,9 @@ static irqreturn_t arcmsr_interrupt(stru
id = pCCB->pcmd->device->id;
lun = pCCB->pcmd->device->lun;
if ((flag_ccb & ARCMSR_CCBREPLY_FLAG_ERROR) == 0) {
- if (pACB->devstate[id][lun] == ARECA_RAID_GONE) {
+ if (pACB->devstate[id][lun] == ARECA_RAID_GONE)
pACB->devstate[id][lun] =
ARECA_RAID_GOOD;
- }
pCCB->pcmd->result = DID_OK << 16;
arcmsr_ccb_complete(pCCB);
} else {
@@ -1240,13 +1195,11 @@ static irqreturn_t arcmsr_interrupt(stru
}
} /*drain reply FIFO */
}
- if (!(outbound_intstatus & ARCMSR_MU_OUTBOUND_HANDLE_INT)) {
+ if (!(outbound_intstatus & ARCMSR_MU_OUTBOUND_HANDLE_INT))
/*it must be share irq */
return IRQ_NONE;
- }
- if (atomic_read(&pACB->ccbwait2gocount) != 0) {
+ if (atomic_read(&pACB->ccbwait2gocount) != 0)
arcmsr_post_wait2go_ccb(pACB); /*try to post all pending ccb */
- }
return IRQ_HANDLED;
}

@@ -1254,9 +1207,9 @@ static irqreturn_t arcmsr_interrupt(stru
*******************************************************************************
*******************************************************************************
*/
-static void arcmsr_iop_parking(struct _ACB *pACB)
+static void arcmsr_iop_parking(struct ACB *pACB)
{
- if (pACB != NULL) {
+ if (pACB) {
/* stop adapter background rebuild */
if (pACB->acb_flags & ACB_F_MSG_START_BGRB) {
pACB->acb_flags &= ~ACB_F_MSG_START_BGRB;
@@ -1280,20 +1233,19 @@ static void arcmsr_iop_parking(struct _A
***********************************************************************
************************************************************************
*/
-static int arcmsr_iop_ioctlcmd(struct _ACB *pACB, int ioctl_cmd, void *arg)
+static int arcmsr_iop_ioctlcmd(struct ACB *pACB, int ioctl_cmd, void *arg)
{
- struct _CMD_IOCTL_FIELD *pcmdioctlfld;
+ struct CMD_IOCTL_FIELD *pcmdioctlfld;
dma_addr_t cmd_handle;
int retvalue = 0;
/* Only let one of these through at a time */

pcmdioctlfld =
pci_alloc_consistent(pACB->pPCI_DEV,
- sizeof(struct _CMD_IOCTL_FIELD), &cmd_handle);
- if (pcmdioctlfld == NULL) {
+ sizeof(struct CMD_IOCTL_FIELD), &cmd_handle);
+ if (pcmdioctlfld == NULL)
return -ENOMEM;
- }
- if (copy_from_user(pcmdioctlfld, arg, sizeof(struct _CMD_IOCTL_FIELD))
+ if (copy_from_user(pcmdioctlfld, arg, sizeof(struct CMD_IOCTL_FIELD))
!= 0) {
retvalue = -EFAULT;
goto ioctl_out;
@@ -1332,8 +1284,8 @@ static int arcmsr_iop_ioctlcmd(struct _A
allxfer_len++;
}
if (pACB->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
- PQBUFFER prbuffer =
- (PQBUFFER) & pACB->pmu->ioctl_rbuffer;
+ struct QBUFFER *prbuffer =
+ (struct QBUFFER *)&pACB->pmu->ioctl_rbuffer;
uint8_t *pQbuffer;
uint8_t *iop_data = (uint8_t *) prbuffer->data;
int32_t iop_len;
@@ -1361,7 +1313,7 @@ static int arcmsr_iop_ioctlcmd(struct _A
ARCMSR_IOCTL_RETURNCODE_OK;
if (copy_to_user
(arg, pcmdioctlfld,
- sizeof(struct _CMD_IOCTL_FIELD)) != 0) {
+ sizeof(struct CMD_IOCTL_FIELD)) != 0) {
retvalue = -EFAULT;
}
pci_free_consistent(pACB->pPCI_DEV, 1032, ver_addr,
@@ -1423,7 +1375,7 @@ static int arcmsr_iop_ioctlcmd(struct _A
spin_unlock_irqrestore(&pACB->qbuffer_lockunlock, flag);
if (copy_to_user
(arg, pcmdioctlfld,
- sizeof(struct _CMD_IOCTL_FIELD)) != 0) {
+ sizeof(struct CMD_IOCTL_FIELD)) != 0) {
retvalue = -EFAULT;
}
pci_free_consistent(pACB->pPCI_DEV, 1032, ver_addr,
@@ -1450,7 +1402,7 @@ static int arcmsr_iop_ioctlcmd(struct _A
ARCMSR_IOCTL_RETURNCODE_OK;
if (copy_to_user
(arg, pcmdioctlfld,
- sizeof(struct _CMD_IOCTL_FIELD)) != 0) {
+ sizeof(struct CMD_IOCTL_FIELD)) != 0) {
retvalue = -EFAULT;
}
}
@@ -1475,7 +1427,7 @@ static int arcmsr_iop_ioctlcmd(struct _A
ARCMSR_IOCTL_RETURNCODE_OK;
if (copy_to_user
(arg, pcmdioctlfld,
- sizeof(struct _CMD_IOCTL_FIELD)) != 0) {
+ sizeof(struct CMD_IOCTL_FIELD)) != 0) {
retvalue = -EFAULT;
}
}
@@ -1498,16 +1450,16 @@ static int arcmsr_iop_ioctlcmd(struct _A
pACB->wqbuf_firstindex = 0;
pACB->wqbuf_lastindex = 0;
pQbuffer = pACB->rqbuffer;
- memset(pQbuffer, 0, sizeof(struct _QBUFFER));
+ memset(pQbuffer, 0, sizeof(struct QBUFFER));
pQbuffer = pACB->wqbuffer;
- memset(pQbuffer, 0, sizeof(struct _QBUFFER));
+ memset(pQbuffer, 0, sizeof(struct QBUFFER));
spin_unlock_irqrestore(&pACB->qbuffer_lockunlock, flag);
/*report success */
pcmdioctlfld->cmdioctl.ReturnCode =
ARCMSR_IOCTL_RETURNCODE_OK;
if (copy_to_user
(arg, pcmdioctlfld,
- sizeof(struct _CMD_IOCTL_FIELD)) != 0) {
+ sizeof(struct CMD_IOCTL_FIELD)) != 0) {
retvalue = -EFAULT;
}
}
@@ -1518,7 +1470,7 @@ static int arcmsr_iop_ioctlcmd(struct _A
ARCMSR_IOCTL_RETURNCODE_3F;
if (copy_to_user
(arg, pcmdioctlfld,
- sizeof(struct _CMD_IOCTL_FIELD)) != 0) {
+ sizeof(struct CMD_IOCTL_FIELD)) != 0) {
retvalue = -EFAULT;
}
}
@@ -1533,7 +1485,7 @@ static int arcmsr_iop_ioctlcmd(struct _A
ARCMSR_IOCTL_RETURNCODE_OK;
if (copy_to_user
(arg, pcmdioctlfld,
- sizeof(struct _CMD_IOCTL_FIELD)) != 0) {
+ sizeof(struct CMD_IOCTL_FIELD)) != 0) {
retvalue = -EFAULT;
}
}
@@ -1557,7 +1509,7 @@ static int arcmsr_iop_ioctlcmd(struct _A
retvalue = -EFAULT;
}
ioctl_out:
- pci_free_consistent(pACB->pPCI_DEV, sizeof(struct _CMD_IOCTL_FIELD),
+ pci_free_consistent(pACB->pPCI_DEV, sizeof(struct CMD_IOCTL_FIELD),
pcmdioctlfld, cmd_handle);
return retvalue;
}
@@ -1566,8 +1518,8 @@ static int arcmsr_iop_ioctlcmd(struct _A
************************************************************************
** arcmsr_ioctl
** Performs ioctl requests not satified by the upper levels.
-** copy_from_user(to,from,n)
-** copy_to_user(to,from,n)
+** copy_from_user(to, from, n)
+** copy_to_user(to, from, n)
**
** The scsi_device struct contains what we know about each given scsi
** device.
@@ -1642,34 +1594,32 @@ static int arcmsr_iop_ioctlcmd(struct _A
*/
static int arcmsr_ioctl(struct scsi_device *dev, int ioctl_cmd, void *arg)
{
- struct _ACB *pACB;
- struct _HCBARC *pHCBARC = &arcmsr_host_control_block;
+ struct ACB *pACB;
+ struct HCBARC *pHCBARC = &arcmsr_host_control_block;
int32_t match = 0x55AA, i;

for (i = 0; i < ARCMSR_MAX_ADAPTER; i++) {
- if ((pACB = pHCBARC->pACB[i]) != NULL) {
+ if ((pACB = pHCBARC->pACB[i])) {
if (pACB->host == dev->host) {
match = i;
break;
}
}
}
- if (match == 0x55AA) {
+ if (match == 0x55AA)
return -ENXIO;
- }
- if (!arg) {
+ if (!arg)
return -EINVAL;
- }
- return (arcmsr_iop_ioctlcmd(pACB, ioctl_cmd, arg));
+ return arcmsr_iop_ioctlcmd(pACB, ioctl_cmd, arg);
}

/*
**************************************************************************
**************************************************************************
*/
-static struct _CCB *arcmsr_get_freeccb(struct _ACB *pACB)
+static struct CCB *arcmsr_get_freeccb(struct ACB *pACB)
{
- struct _CCB *pCCB;
+ struct CCB *pCCB;
unsigned long flag;
int ccb_startindex, ccb_doneindex;

@@ -1679,13 +1629,12 @@ static struct _CCB *arcmsr_get_freeccb(s
pCCB = pACB->pccbringQ[ccb_startindex];
ccb_startindex++;
ccb_startindex %= ARCMSR_MAX_FREECCB_NUM;
- if (ccb_doneindex != ccb_startindex) {
+ if (ccb_doneindex != ccb_startindex)
pACB->ccb_startindex = ccb_startindex;
- } else {
+ else
pCCB = NULL;
- }
spin_unlock_irqrestore(&pACB->ccb_startindex_lockunlock, flag);
- return (pCCB);
+ return pCCB;
}

/*
@@ -1713,13 +1662,13 @@ static struct _CCB *arcmsr_get_freeccb(s
** // A SCSI Command is assigned a nonzero serial_number when internal_cmnd
** // passes it to the driver's queue command function. The serial_number
** // is cleared when scsi_done is entered indicating that the command has
-** // been completed. If a timeout occurs,the serial number at the moment
+** // been completed. If a timeout occurs, the serial number at the moment
** // of timeout is copied into serial_number_at_timeout. By subsequently
** // comparing the serial_number and serial_number_at_timeout fields
-** // during abort or reset processing,we can detect whether the command
+** // during abort or reset processing, we can detect whether the command
** // has already completed. This also detects cases where the command has
** // completed and the SCSI Command structure has already being reused
-** // for another command,so that we can avoid incorrectly aborting or
+** // for another command, so that we can avoid incorrectly aborting or
** // resetting the new command.
** //
**
@@ -1734,7 +1683,7 @@ static struct _CCB *arcmsr_get_freeccb(s
**
** //
** // We handle the timeout differently if it happens when a reset,
-** // abort,etc are in process.
+** // abort, etc are in process.
** //
** unsigned volatile char internal_timeout;
** struct scsi_cmnd *bh_next;
@@ -1767,7 +1716,7 @@ static struct _CCB *arcmsr_get_freeccb(s
** unsigned short sglist_len;
** // size of malloc'd scatter-gather list
** unsigned short abort_reason;
-** // If the mid-level code requests an abort,this is the reason.
+** // If the mid-level code requests an abort, this is the reason.
** unsigned bufflen;
** // Size of data buffer
** void *buffer;
@@ -1779,7 +1728,7 @@ static struct _CCB *arcmsr_get_freeccb(s
**
** unsigned transfersize;
** // How much we are guaranteed to transfer with each SCSI transfer
-** // (ie,between disconnect/reconnects. Probably==sector size
+** // (ie, between disconnect/reconnects. Probably==sector size
** int resid;
** // Number of bytes requested to be transferred
** // less actual number transferred (0 if not supported)
@@ -1813,7 +1762,7 @@ static struct _CCB *arcmsr_get_freeccb(s
** unsigned char tag;
** // SCSI-II queued command tag
** unsigned long pid;
-** // Process ID,starts at 0
+** // Process ID, starts at 0
** };
**
** The scsi_cmnd structure is used by scsi.c internally,
@@ -1839,8 +1788,8 @@ static int arcmsr_queue_command(struct s
void (*done) (struct scsi_cmnd *))
{
struct Scsi_Host *host = cmd->device->host;
- struct _ACB *pACB = (struct _ACB *)host->hostdata;
- struct _CCB *pCCB;
+ struct ACB *pACB = (struct ACB *)host->hostdata;
+ struct CCB *pCCB;
int target = cmd->device->id;
int lun = cmd->device->lun;

@@ -1848,18 +1797,17 @@ static int arcmsr_queue_command(struct s
cmd->host_scribble = NULL;
cmd->result = 0;
if (cmd->cmnd[0] == SYNCHRONIZE_CACHE) { /* 0x35 avoid synchronizing disk cache cmd after .remove : arcmsr_device_remove (linux bug) */
- if (pACB->devstate[target][lun] == ARECA_RAID_GONE) {
+ if (pACB->devstate[target][lun] == ARECA_RAID_GONE)
cmd->result = (DID_NO_CONNECT << 16);
- }
cmd->scsi_done(cmd);
- return (0);
+ return 0;
}
if (pACB->acb_flags & ACB_F_BUS_RESET) {
printk("arcmsr%d bus reset and return busy \n",
pACB->adapter_index);
cmd->result = (DID_BUS_BUSY << 16);
cmd->scsi_done(cmd);
- return (0);
+ return 0;
}
if (pACB->devstate[target][lun] == ARECA_RAID_GONE) {
uint8_t block_cmd;
@@ -1871,10 +1819,10 @@ static int arcmsr_queue_command(struct s
pACB->adapter_index, cmd->cmnd[0], target, lun);
cmd->result = (DID_NO_CONNECT << 16);
cmd->scsi_done(cmd);
- return (0);
+ return 0;
}
}
- if ((pCCB = arcmsr_get_freeccb(pACB)) != NULL) {
+ if ((pCCB = arcmsr_get_freeccb(pACB))) {
arcmsr_build_ccb(pACB, pCCB, cmd);
if (atomic_read(&pACB->ccboutstandingcount) <
ARCMSR_MAX_OUTSTANDING_CMD) {
@@ -1901,7 +1849,7 @@ static int arcmsr_queue_command(struct s
cmd->result = (DID_BUS_BUSY << 16);
cmd->scsi_done(cmd);
}
- return (0);
+ return 0;
}

/*
@@ -1909,7 +1857,7 @@ static int arcmsr_queue_command(struct s
** get firmware miscellaneous data
**********************************************************************
*/
-static void arcmsr_get_firmware_spec(struct _ACB *pACB)
+static void arcmsr_get_firmware_spec(struct ACB *pACB)
{
char *acb_firm_model = pACB->firm_model;
char *acb_firm_version = pACB->firm_version;
@@ -1951,7 +1899,6 @@ static void arcmsr_get_firmware_spec(str
pACB->firm_numbers_queue = readl(&pACB->pmu->message_rbuffer[2]); /*firm_numbers_queue,2,08-11 */
pACB->firm_sdram_size = readl(&pACB->pmu->message_rbuffer[3]); /*firm_sdram_size,3,12-15 */
pACB->firm_ide_channels = readl(&pACB->pmu->message_rbuffer[4]); /*firm_ide_channels,4,16-19 */
- return;
}

/*
@@ -1959,21 +1906,20 @@ static void arcmsr_get_firmware_spec(str
** start background rebulid
**********************************************************************
*/
-static void arcmsr_start_adapter_bgrb(struct _ACB *pACB)
+static void arcmsr_start_adapter_bgrb(struct ACB *pACB)
{
pACB->acb_flags |= ACB_F_MSG_START_BGRB;
pACB->acb_flags &= ~ACB_F_MSG_STOP_BGRB;
writel(ARCMSR_INBOUND_MESG0_START_BGRB, &pACB->pmu->inbound_msgaddr0);
- return;
}

/*
**********************************************************************
**********************************************************************
*/
-static void arcmsr_polling_ccbdone(struct _ACB *pACB, struct _CCB *poll_ccb)
+static void arcmsr_polling_ccbdone(struct ACB *pACB, struct CCB *poll_ccb)
{
- struct _CCB *pCCB;
+ struct CCB *pCCB;
uint32_t flag_ccb, outbound_intstatus, poll_ccb_done = 0, poll_count =
0;
int id, lun;
@@ -1986,18 +1932,17 @@ static void arcmsr_polling_ccbdone(struc
while (1) {
if ((flag_ccb =
readl(&pACB->pmu->outbound_queueport)) == 0xFFFFFFFF) {
- if (poll_ccb_done) {
+ if (poll_ccb_done)
break; /*chip FIFO no ccb for completion already */
- } else {
+ else {
msleep(25);
- if (poll_count > 100) {
+ if (poll_count > 100)
break;
- }
goto polling_ccb_retry;
}
}
- /* check ifcommand done with no error */
- pCCB = (struct _CCB *)(pACB->vir2phy_offset + (flag_ccb << 5)); /*frame must be 32 bytes aligned */
+ /* check if command done with no error */
+ pCCB = (struct CCB *)(pACB->vir2phy_offset + (flag_ccb << 5)); /*frame must be 32 bytes aligned */
if ((pCCB->pACB != pACB)
|| (pCCB->startdone != ARCMSR_CCB_START)) {
if ((pCCB->startdone == ARCMSR_CCB_ABORTED)
@@ -2021,9 +1966,8 @@ static void arcmsr_polling_ccbdone(struc
id = pCCB->pcmd->device->id;
lun = pCCB->pcmd->device->lun;
if ((flag_ccb & ARCMSR_CCBREPLY_FLAG_ERROR) == 0) {
- if (pACB->devstate[id][lun] == ARECA_RAID_GONE) {
+ if (pACB->devstate[id][lun] == ARECA_RAID_GONE)
pACB->devstate[id][lun] = ARECA_RAID_GOOD;
- }
pCCB->pcmd->result = DID_OK << 16;
arcmsr_ccb_complete(pCCB);
} else {
@@ -2067,7 +2011,6 @@ static void arcmsr_polling_ccbdone(struc
}
}
} /*drain reply FIFO */
- return;
}

/*
@@ -2075,7 +2018,7 @@ static void arcmsr_polling_ccbdone(struc
** start background rebulid
**********************************************************************
*/
-static void arcmsr_iop_init(struct _ACB *pACB)
+static void arcmsr_iop_init(struct ACB *pACB)
{
uint32_t intmask_org, mask, outbound_doorbell, firmware_state = 0;

@@ -2098,7 +2041,7 @@ static void arcmsr_iop_init(struct _ACB
writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK,
&pACB->pmu->inbound_doorbell);
}
- /* enable outbound Post Queue,outbound message0,outbell doorbell Interrupt */
+ /* enable outbound Post Queue, outbound message0, outbound doorbell Interrupt */
mask =
~(ARCMSR_MU_OUTBOUND_POSTQUEUE_INTMASKENABLE |
ARCMSR_MU_OUTBOUND_DOORBELL_INTMASKENABLE |
@@ -2106,7 +2049,6 @@ static void arcmsr_iop_init(struct _ACB
writel(intmask_org & mask, &pACB->pmu->outbound_intmask);
pACB->outbound_int_enable = ~(intmask_org & mask) & 0x000000ff;
pACB->acb_flags |= ACB_F_IOP_INITED;
- return;
}

/*
@@ -2115,10 +2057,10 @@ static void arcmsr_iop_init(struct _ACB
*/
static int arcmsr_bus_reset(struct scsi_cmnd *cmd)
{
- struct _ACB *pACB;
+ struct ACB *pACB;
int retry = 0;

- pACB = (struct _ACB *)cmd->device->host->hostdata;
+ pACB = (struct ACB *)cmd->device->host->hostdata;
printk("arcmsr%d bus reset ..... \n", pACB->adapter_index);
pACB->num_resets++;
pACB->acb_flags |= ACB_F_BUS_RESET;
@@ -2140,8 +2082,8 @@ static int arcmsr_bus_reset(struct scsi_
*/
static int arcmsr_seek_cmd2abort(struct scsi_cmnd *pabortcmd)
{
- struct _ACB *pACB = (struct _ACB *)pabortcmd->device->host->hostdata;
- struct _CCB *pCCB;
+ struct ACB *pACB = (struct ACB *)pabortcmd->device->host->hostdata;
+ struct CCB *pCCB;
uint32_t intmask_org, mask;
int i = 0;

@@ -2151,7 +2093,7 @@ static int arcmsr_seek_cmd2abort(struct
** It is the upper layer do abort command this lock just prior to calling us.
** First determine if we currently own this command.
** Start by searching the device queue. If not found
- ** at all,and the system wanted us to just abort the
+ ** at all, and the system wanted us to just abort the
** command return success.
*****************************************************************************
*/
@@ -2174,13 +2116,13 @@ static int arcmsr_seek_cmd2abort(struct
/*
**********************************************************
** seek this command at our command list
- ** if command found then remove,abort it and free this CCB
+ ** if command found then remove, abort it and free this CCB
**********************************************************
*/
if (atomic_read(&pACB->ccbwait2gocount) != 0) {
for (i = 0; i < ARCMSR_MAX_OUTSTANDING_CMD; i++) {
pCCB = pACB->pccbwait2go[i];
- if (pCCB != NULL) {
+ if (pCCB) {
if (pCCB->pcmd == pabortcmd) {
printk
("arcmsr%d scsi id=%d lun=%d abort ccb '0x%p' pending command \n",
@@ -2192,12 +2134,12 @@ static int arcmsr_seek_cmd2abort(struct
pCCB->pcmd->result = DID_ABORT << 16;
arcmsr_ccb_complete(pCCB);
atomic_dec(&pACB->ccbwait2gocount);
- return (SUCCESS);
+ return SUCCESS;
}
}
}
}
- return (SUCCESS);
+ return SUCCESS;
abort_outstanding_cmd:
/* disable all outbound interrupt */
intmask_org = readl(&pACB->pmu->outbound_intmask);
@@ -2212,7 +2154,7 @@ static int arcmsr_seek_cmd2abort(struct
ARCMSR_MU_OUTBOUND_MESSAGE0_INTMASKENABLE);
writel(intmask_org & mask, &pACB->pmu->outbound_intmask);
atomic_set(&pACB->ccboutstandingcount, 0);
- return (SUCCESS);
+ return SUCCESS;
}

/*
@@ -2221,7 +2163,7 @@ static int arcmsr_seek_cmd2abort(struct
*/
static int arcmsr_cmd_abort(struct scsi_cmnd *cmd)
{
- struct _ACB *pACB = (struct _ACB *)cmd->device->host->hostdata;
+ struct ACB *pACB = (struct ACB *)cmd->device->host->hostdata;
int error;

printk("arcmsr%d abort device command of scsi id=%d lun=%d \n",
@@ -2233,11 +2175,10 @@ static int arcmsr_cmd_abort(struct scsi_
************************************************
*/
error = arcmsr_seek_cmd2abort(cmd);
- if (error != SUCCESS) {
+ if (error != SUCCESS)
printk("arcmsr%d abort command failed scsi id=%d lun=%d \n",
pACB->adapter_index, cmd->device->id, cmd->device->lun);
- }
- return (error);
+ return error;
}

/*
@@ -2293,10 +2234,10 @@ static int arcmsr_cmd_abort(struct scsi_
static const char *arcmsr_info(struct Scsi_Host *host)
{
static char buf[256];
- struct _ACB *pACB;
+ struct ACB *pACB;
uint16_t device_id;

- pACB = (struct _ACB *)host->hostdata;
+ pACB = (struct ACB *)host->hostdata;
device_id = pACB->pPCI_DEV->device;
switch (device_id) {
case PCIDeviceIDARC1110:
@@ -2377,16 +2318,16 @@ static const char *arcmsr_info(struct Sc
************************************************************************
************************************************************************
*/
-static int arcmsr_initialize(struct _ACB *pACB, struct pci_dev *pPCI_DEV)
+static int arcmsr_initialize(struct ACB *pACB, struct pci_dev *pPCI_DEV)
{
uint32_t intmask_org, page_base, page_offset, mem_base_start;
dma_addr_t dma_coherent_handle, dma_addr;
- struct _HCBARC *pHCBARC = &arcmsr_host_control_block;
+ struct HCBARC *pHCBARC = &arcmsr_host_control_block;
uint8_t pcicmd;
void *dma_coherent;
void *page_remapped;
int i, j;
- struct _CCB *pccb_tmp;
+ struct CCB *pccb_tmp;

/* Enable Busmaster/Mem */
pci_read_config_byte(pPCI_DEV, PCI_COMMAND, &pcicmd);
@@ -2400,9 +2341,9 @@ static int arcmsr_initialize(struct _ACB
if (page_remapped == NULL) {
printk("arcmsr%d memory mapping region fail \n",
arcmsr_adapterCnt);
- return (ENXIO);
+ return -ENXIO;
}
- pACB->pmu = (struct _MU *)(page_remapped + page_offset);
+ pACB->pmu = (struct MU *)(page_remapped + page_offset);
pACB->acb_flags |=
(ACB_F_IOCTL_WQBUFFER_CLEARED | ACB_F_IOCTL_RQBUFFER_CLEARED);
pACB->acb_flags &= ~ACB_F_SCSISTOPADAPTER;
@@ -2444,7 +2385,7 @@ static int arcmsr_initialize(struct _ACB
/* Attempt to claim larger area for request queue pCCB). */
dma_coherent =
dma_alloc_coherent(&pPCI_DEV->dev,
- ARCMSR_MAX_FREECCB_NUM * sizeof(struct _CCB) +
+ ARCMSR_MAX_FREECCB_NUM * sizeof(struct CCB) +
0x20, &dma_coherent_handle, GFP_KERNEL);
if (dma_coherent == NULL) {
printk("arcmsr%d dma_alloc_coherent got error \n",
@@ -2454,7 +2395,7 @@ static int arcmsr_initialize(struct _ACB
pACB->dma_coherent = dma_coherent;
pACB->dma_coherent_handle = dma_coherent_handle;
memset(dma_coherent, 0,
- ARCMSR_MAX_FREECCB_NUM * sizeof(struct _CCB) + 0x20);
+ ARCMSR_MAX_FREECCB_NUM * sizeof(struct CCB) + 0x20);
if (((unsigned long)dma_coherent & 0x1F) != 0) { /*ccb address must 32 (0x20) boundary */
dma_coherent =
dma_coherent + (0x20 -
@@ -2465,12 +2406,12 @@ static int arcmsr_initialize(struct _ACB
0x1F));
}
dma_addr = dma_coherent_handle;
- pccb_tmp = (struct _CCB *)dma_coherent;
+ pccb_tmp = (struct CCB *)dma_coherent;
for (i = 0; i < ARCMSR_MAX_FREECCB_NUM; i++) {
pccb_tmp->cdb_shifted_phyaddr = dma_addr >> 5;
pccb_tmp->pACB = pACB;
pACB->pccbringQ[i] = pACB->pccb_pool[i] = pccb_tmp;
- dma_addr = dma_addr + sizeof(struct _CCB);
+ dma_addr = dma_addr + sizeof(struct CCB);
pccb_tmp++;
}
pACB->vir2phy_offset =
@@ -2498,7 +2439,7 @@ static int arcmsr_initialize(struct _ACB
writel(intmask_org | ARCMSR_MU_OUTBOUND_ALL_INTMASKENABLE,
&pACB->pmu->outbound_intmask);
arcmsr_adapterCnt++;
- return (0);
+ return 0;
}

/*
@@ -2507,17 +2448,17 @@ static int arcmsr_initialize(struct _ACB
*/
static int arcmsr_set_info(char *buffer, int length)
{
- return (0);
+ return 0;
}

/*
*********************************************************************
*********************************************************************
*/
-static void arcmsr_pcidev_disattach(struct _ACB *pACB)
+static void arcmsr_pcidev_disattach(struct ACB *pACB)
{
- struct _CCB *pCCB;
- struct _HCBARC *pHCBARC = &arcmsr_host_control_block;
+ struct CCB *pCCB;
+ struct HCBARC *pHCBARC = &arcmsr_host_control_block;
uint32_t intmask_org, mask;
int i = 0;

@@ -2559,9 +2500,8 @@ static void arcmsr_pcidev_disattach(stru
}
for (i = 0; i < ARCMSR_MAX_FREECCB_NUM; i++) {
pCCB = pACB->pccb_pool[i];
- if (pCCB->startdone == ARCMSR_CCB_START) {
+ if (pCCB->startdone == ARCMSR_CCB_START)
pCCB->startdone = ARCMSR_CCB_ABORTED;
- }
}
/* enable all outbound interrupt */
mask =
@@ -2574,7 +2514,7 @@ static void arcmsr_pcidev_disattach(stru
if (atomic_read(&pACB->ccbwait2gocount) != 0) { /*remove first wait2go ccb and abort it */
for (i = 0; i < ARCMSR_MAX_OUTSTANDING_CMD; i++) {
pCCB = pACB->pccbwait2go[i];
- if (pCCB != NULL) {
+ if (pCCB) {
pACB->pccbwait2go[i] = NULL;
pCCB->startdone = ARCMSR_CCB_ABORTED;
pCCB->pcmd->result = DID_ABORT << 16;
@@ -2587,9 +2527,8 @@ static void arcmsr_pcidev_disattach(stru
pci_release_regions(pACB->pPCI_DEV);
iounmap(pACB->pmu);
arcmsr_free_ccb_pool(pACB);
- pHCBARC->pACB[pACB->adapter_index] = 0; /* clear record */
+ pHCBARC->pACB[pACB->adapter_index] = NULL; /* clear record */
arcmsr_adapterCnt--;
- return;
}

/*
@@ -2599,8 +2538,8 @@ static void arcmsr_pcidev_disattach(stru
static int arcmsr_halt_notify(struct notifier_block *nb, unsigned long event,
void *buf)
{
- struct _ACB *pACB;
- struct _HCBARC *pHCBARC = &arcmsr_host_control_block;
+ struct ACB *pACB;
+ struct HCBARC *pHCBARC = &arcmsr_host_control_block;
struct Scsi_Host *host;
int i;

@@ -2610,11 +2549,10 @@ static int arcmsr_halt_notify(struct not
}
for (i = 0; i < ARCMSR_MAX_ADAPTER; i++) {
pACB = pHCBARC->pACB[i];
- if (pACB == NULL) {
+ if (!pACB)
continue;
- }
/* Flush cache to disk */
- /* Free irq,otherwise extra interrupt is generated */
+ /* Free irq, otherwise extra interrupt is generated */
/* Issue a blocking(interrupts disabled) command to the card */
host = pACB->host;
arcmsr_pcidev_disattach(pACB);
@@ -2640,13 +2578,13 @@ static int arcmsr_proc_info(struct Scsi_
off_t offset, int length, int inout)
{
uint8_t i;
- struct _HCBARC *pHCBARC = &arcmsr_host_control_block;
+ struct HCBARC *pHCBARC = &arcmsr_host_control_block;
char *pos = buffer;
- struct _ACB *pACB;
+ struct ACB *pACB;
+
+ if (inout)
+ return arcmsr_set_info(buffer, length);

- if (inout) {
- return (arcmsr_set_info(buffer, length));
- }
for (i = 0; i < ARCMSR_MAX_ADAPTER; i++) {
pACB = pHCBARC->pACB[i];
if (pACB == NULL)
@@ -2657,13 +2595,11 @@ static int arcmsr_proc_info(struct Scsi_
SPRINTF("===========================\n");
}
*start = buffer + offset;
- if (pos - buffer < offset) {
+ if (pos - buffer < offset)
return 0;
- } else if (pos - buffer - offset < length) {
- return (pos - buffer - offset);
- } else {
- return length;
- }
+ else if (pos - buffer - offset < length)
+ return pos - buffer - offset;
+ return length;
}

/*
@@ -2672,37 +2608,35 @@ static int arcmsr_proc_info(struct Scsi_
*/
static int arcmsr_release(struct Scsi_Host *host)
{
- struct _ACB *pACB;
- struct _HCBARC *pHCBARC = &arcmsr_host_control_block;
+ struct ACB *pACB;
+ struct HCBARC *pHCBARC = &arcmsr_host_control_block;
uint8_t match = 0xff, i;

- if (host == NULL) {
+ if (host == NULL)
return -ENXIO;
- }
- pACB = (struct _ACB *)host->hostdata;
- if (pACB == NULL) {
+
+ pACB = (struct ACB *)host->hostdata;
+ if (!pACB)
return -ENXIO;
- }
+
for (i = 0; i < ARCMSR_MAX_ADAPTER; i++) {
- if (pHCBARC->pACB[i] == pACB) {
+ if (pHCBARC->pACB[i] == pACB)
match = i;
- }
}
- if (match == 0xff) {
+ if (match == 0xff)
return -ENXIO;
- }
+
/* Flush cache to disk */
- /* Free irq,otherwise extra interrupt is generated */
+ /* Free irq, otherwise extra interrupt is generated */
/* Issue a blocking(interrupts disabled) command to the card */
arcmsr_pcidev_disattach(pACB);
scsi_unregister(host);
/*if this is last pACB */
for (i = 0; i < ARCMSR_MAX_ADAPTER; i++) {
- if (pHCBARC->pACB[i] != NULL) {
- return (0); /* this is not last adapter's release */
- }
+ if (pHCBARC->pACB[i])
+ return 0; /* this is not last adapter's release */
}
unregister_chrdev(pHCBARC->arcmsr_major_number, "arcmsr");
unregister_reboot_notifier(&arcmsr_event_notifier);
- return (0);
+ return 0;
}

2005-12-31 05:21:27

by Randy Dunlap

[permalink] [raw]
Subject: [PATCH 2/2] Areca RAID driver (arcmsr) cleanups

>
> Here's a start on some cleanups and a list of general issues.
> I'm not addressing SCSI or MM/DMA API issues, if there are any.

[PATCH 1/2]
> 0. some Kconfig and Makefile cleanups
> 1. fix arcmsr_device_id_table[] inits;
> 2. fix return (value); -- don't use parenethese
> 3. fix one-line-ifs-with-braces -- remove braces
> 4. struct _XYZ & typedef XYZ, PXYZ -- convert to struct XYZ only
> 5. check NULL usage
> 6. no "return;" at end of func; -- removed
> 7. return -ENXIO instead of ENXIO;
>
> Patch for above items is below.
>
> More issues, not yet patched:
>
> 8. check sparse warnings, stack usage, init/exit sections;
> 9. don't use // comments;
> 10. use printk levels
> 11. pPCI_DEV: bad naming (throughout driver; don't use mixed case)
> 12. some comments are unreadable (non-ASCII ?)
> 13. uintNN_t int types: use kernel types except for userspace interfaces
> 14. use kernel-doc
> 15. try to fit source files into 80 columns
> ---

Erich, here are some more notes for you:

16. Tab size in Linux kernel is 8 (not less).
17. Don't put changelog comments in source files. That's what
SCMs are for (source code manager tools).
18. Put arcmsr.txt in Documentation/scsi/, not in scsi/arcmsr/.
19. Maybe use sysfs (/sys) instead of /proc.
---




From: Randy Dunlap <[email protected]>

More Areca (arcmsr) cleanups:

Fix about 1/2 of sparse warnings
(There are no stack size problems.)
Lots of long lines now fit into 80 columns (but not all of them).
Too much indentation in arcmsr_iop_ioctlcmd() and in arcmsr_info()

Signed-off-by: Randy Dunlap <[email protected]>
---
drivers/scsi/arcmsr/arcmsr.c | 1103 +++++++++++++++++++++----------------------
1 files changed, 561 insertions(+), 542 deletions(-)

--- linux-2615-rc7.orig/drivers/scsi/arcmsr/arcmsr.c
+++ linux-2615-rc7/drivers/scsi/arcmsr/arcmsr.c
@@ -1,5 +1,5 @@
/*
-******************************************************************************************
+***************************************************************************
** O.S : Linux
** FILE NAME : arcmsr.c
** BY : Erich Chen
@@ -43,49 +43,74 @@
**************************************************************************
** History
**
-** REV# DATE NAME DESCRIPTION
-** 1.00.00.00 3/31/2004 Erich Chen First release
-** 1.10.00.04 7/28/2004 Erich Chen modify for ioctl
-** 1.10.00.06 8/28/2004 Erich Chen modify for 2.6.x
-** 1.10.00.08 9/28/2004 Erich Chen modify for x86_64
-** 1.10.00.10 10/10/2004 Erich Chen bug fix for SMP & ioctl
-** 1.20.00.00 11/29/2004 Erich Chen bug fix with arcmsr_bus_reset when PHY error
-** 1.20.00.02 12/09/2004 Erich Chen bug fix with over 2T bytes RAID Volume
-** 1.20.00.04 1/09/2005 Erich Chen fits for Debian linux kernel version 2.2.xx
-** 1.20.00.05 2/20/2005 Erich Chen cleanly as look like a Linux driver at 2.6.x
-** thanks for peoples kindness comment
-** Kornel Wieliczek
-** Christoph Hellwig
-** Adrian Bunk
-** Andrew Morton
-** Christoph Hellwig
-** James Bottomley
-** Arjan van de Ven
-** 1.20.00.06 3/12/2005 Erich Chen fix with arcmsr_pci_unmap_dma "unsigned long" cast,
-** modify PCCB POOL allocated by "dma_alloc_coherent"
-** (Kornel Wieliczek's comment)
-** 1.20.00.07 3/23/2005 Erich Chen bug fix with arcmsr_scsi_host_template_init ocur segmentation fault,
-** if RAID adapter does not on PCI slot and modprobe/rmmod this driver twice.
-** bug fix enormous stack usage (Adrian Bunk's comment)
-** 1.20.00.08 6/23/2005 Erich Chen bug fix with abort command, in case of heavy loading when sata cable
-** working on low quality connection
-** 1.20.00.09 9/12/2005 Erich Chen bug fix with abort command handling, firmware version check
-** and firmware update notify for hardware bug fix
-** 1.20.00.10 9/23/2005 Erich Chen enhance sysfs function for change driver's max tag Q number.
-** add DMA_64BIT_MASK for backward compatible with all 2.6.x
-** add some useful message for abort command
-** add ioctl code 'ARCMSR_IOCTL_FLUSH_ADAPTER_CACHE'
-** customer can send this command for sync raid volume data
-** 1.20.00.11 9/29/2005 Erich Chen by comment of Arjan van de Ven fix incorrect msleep redefine
-** cast off sizeof(dma_addr_t) condition for 64bit pci_set_dma_mask
-** 1.20.00.12 9/30/2005 Erich Chen bug fix with 64bit platform's ccbs using if over 4G system memory
-** change 64bit pci_set_consistent_dma_mask into 32bit
-** increcct adapter count if adapter initialize fail.
-** miss edit at arcmsr_build_ccb....
-** psge += sizeof(struct SG64ENTRY *) => psge += sizeof(struct SG64ENTRY)
-** 64 bits sg entry would be incorrectly calculated
-** thanks Kornel Wieliczek give me kindly notify and detail description
-******************************************************************************************
+** REV# DATE NAME DESCRIPTION
+** 1.00.00.00 03/31/2004 Erich Chen First release
+** 1.10.00.04 07/28/2004 Erich Chen modify for ioctl
+** 1.10.00.06 08/28/2004 Erich Chen modify for 2.6.x
+** 1.10.00.08 09/28/2004 Erich Chen modify for x86_64
+** 1.10.00.10 10/10/2004 Erich Chen bug fix for SMP & ioctl
+** 1.20.00.00 11/29/2004 Erich Chen bug fix with arcmsr_bus_reset
+** when PHY error
+** 1.20.00.02 12/09/2004 Erich Chen bug fix with over 2TB RAID Volume
+** 1.20.00.04 1/09/2005 Erich Chen fix for Debian linux kernel
+** version 2.2.xx
+** 1.20.00.05 2/20/2005 Erich Chen clean to look like a Linux
+** driver at 2.6.x
+** thanks for peoples kindness comment
+** Kornel Wieliczek
+** Christoph Hellwig
+** Adrian Bunk
+** Andrew Morton
+** Christoph Hellwig
+** James Bottomley
+** Arjan van de Ven
+** 1.20.00.06 3/12/2005 Erich Chen fix with arcmsr_pci_unmap_dma
+** "unsigned long" cast,
+** modify PCCB POOL allocated by
+** "dma_alloc_coherent"
+** (Kornel Wieliczek's comment)
+** 1.20.00.07 3/23/2005 Erich Chen bug fix with
+** arcmsr_scsi_host_template_init
+** occur segmentation fault,
+** if RAID adapter does not own PCI slot
+** and modprobe/rmmod this driver twice.
+** bug fix enormous stack usage
+** (Adrian Bunk's comment)
+** 1.20.00.08 6/23/2005 Erich Chen bug fix with abort command, in case
+** of heavy loading when sata cable
+** working on low quality connection
+** 1.20.00.09 9/12/2005 Erich Chen bug fix with abort command handling,
+** firmware version check
+** and firmware update notify for
+** hardware bug fix
+** 1.20.00.10 9/23/2005 Erich Chen enhance sysfs function for change
+** driver's max tag Q number.
+** add DMA_64BIT_MASK for backward
+** compatible with all 2.6.x
+** add some useful message for abort
+** command;
+** add ioctl code
+** 'ARCMSR_IOCTL_FLUSH_ADAPTER_CACHE';
+** customer can send this command to
+** sync raid volume data
+** 1.20.00.11 9/29/2005 Erich Chen by comment of Arjan van de Ven fix
+** incorrect msleep redefine
+** cast off sizeof(dma_addr_t) condition
+** for 64bit pci_set_dma_mask
+** 1.20.00.12 9/30/2005 Erich Chen bug fix with 64-bit platform's ccbs
+** using if over 4G system memory
+** change 64-bit
+** pci_set_consistent_dma_mask into 32-bit
+** incorrect adapter count if adapter
+** initialize fail.
+** miss edit at arcmsr_build_ccb....
+** psge += sizeof(struct SG64ENTRY *) =>
+** psge += sizeof(struct SG64ENTRY)
+** 64 bits sg entry would be incorrectly
+** calculated
+** thanks Kornel Wieliczek give me kindly
+** notify and detail description
+***************************************************************************
*/
#include <linux/module.h>
#include <linux/reboot.h>
@@ -113,14 +138,14 @@ MODULE_DESCRIPTION("ARECA (ARC11xx/12xx)
MODULE_LICENSE("Dual BSD/GPL");

/*
-**********************************************************************************
-**********************************************************************************
+***************************************************************************
+***************************************************************************
*/
static u_int8_t arcmsr_adapterCnt = 0;
static struct HCBARC arcmsr_host_control_block;
/*
-**********************************************************************************
-**********************************************************************************
+***************************************************************************
+***************************************************************************
*/
static int arcmsr_fops_ioctl(struct inode *inode, struct file *filep,
unsigned int ioctl_cmd, unsigned long arg);
@@ -129,7 +154,7 @@ static int arcmsr_fops_open(struct inode
static int arcmsr_halt_notify(struct notifier_block *nb, unsigned long event,
void *buf);
static int arcmsr_initialize(struct ACB *pACB, struct pci_dev *pPCI_DEV);
-static int arcmsr_iop_ioctlcmd(struct ACB *pACB, int ioctl_cmd, void *arg);
+static int arcmsr_iop_ioctlcmd(struct ACB *pACB, int ioctl_cmd, void __user *arg);
static int arcmsr_proc_info(struct Scsi_Host *host, char *buffer, char **start,
off_t offset, int length, int inout);
static int arcmsr_bios_param(struct scsi_device *sdev,
@@ -140,7 +165,7 @@ static int arcmsr_queue_command(struct s
void (*done) (struct scsi_cmnd *));
static int arcmsr_cmd_abort(struct scsi_cmnd *);
static int arcmsr_bus_reset(struct scsi_cmnd *);
-static int arcmsr_ioctl(struct scsi_device *dev, int ioctl_cmd, void *arg);
+static int arcmsr_ioctl(struct scsi_device *dev, int ioctl_cmd, void __user *arg);
static int __devinit arcmsr_device_probe(struct pci_dev *pPCI_DEV,
const struct pci_device_id *id);
static void arcmsr_device_remove(struct pci_dev *pPCI_DEV);
@@ -151,9 +176,8 @@ static irqreturn_t arcmsr_interrupt(stru
static u_int8_t arcmsr_wait_msgint_ready(struct ACB *pACB);
static const char *arcmsr_info(struct Scsi_Host *);
/*
-**********************************************************************************
-**
-**********************************************************************************
+***************************************************************************
+***************************************************************************
*/
static ssize_t arcmsr_show_firmware_info(struct class_device *dev, char *buf)
{
@@ -265,9 +289,9 @@ static struct scsi_host_template arcmsr_
};

/*
-**********************************************************************************
+***************************************************************************
** notifier block to get a notify on system shutdown/halt/reboot
-**********************************************************************************
+***************************************************************************
*/
static struct notifier_block arcmsr_event_notifier =
{ .notifier_call = arcmsr_halt_notify };
@@ -371,7 +395,8 @@ static int __devinit arcmsr_device_probe
arcmsr_adapterCnt);
return -ENODEV;
}
- /* allocate scsi host information (includes out adapter) scsi_host_alloc==scsi_register */
+ /* allocate scsi host information (includes our adapter)
+ * scsi_host_alloc==scsi_register */
if ((host =
scsi_host_alloc(&arcmsr_scsi_host_template,
sizeof(struct ACB))) == 0) {
@@ -412,9 +437,9 @@ static int __devinit arcmsr_device_probe
host->max_sectors = ARCMSR_MAX_XFER_SECTORS;
host->max_lun = ARCMSR_MAX_TARGETLUN;
host->max_id = ARCMSR_MAX_TARGETID; /*16:8 */
- host->max_cmd_len = 16; /*this is issue of 64bit LBA, over 2T byte */
+ host->max_cmd_len = 16; /* this is issue of 64bit LBA, over 2T byte */
host->sg_tablesize = ARCMSR_MAX_SG_ENTRIES;
- host->can_queue = ARCMSR_MAX_OUTSTANDING_CMD; /* max simultaneous cmds */
+ host->can_queue = ARCMSR_MAX_OUTSTANDING_CMD; /* max simultaneous cmds */
host->cmd_per_lun = ARCMSR_MAX_CMD_PERLUN;
host->this_id = ARCMSR_SCSI_INITIATOR_ID;
host->unique_id = (bus << 8) | dev_fun;
@@ -480,7 +505,7 @@ static void arcmsr_device_remove(struct
scsi_remove_host(host);
scsi_host_put(host);
pci_set_drvdata(pPCI_DEV, NULL);
- /*if this is last pACB */
+ /* if this is last pACB */
for (i = 0; i < ARCMSR_MAX_ADAPTER; i++) {
if (pHCBARC->pACB[i])
return; /* this is not last adapter's release */
@@ -550,17 +575,16 @@ static void arcmsr_pci_unmap_dma(struct
sl = (struct scatterlist *)pcmd->request_buffer;
pci_unmap_sg(pACB->pPCI_DEV, sl, pcmd->use_sg,
pcmd->sc_data_direction);
- } else if (pcmd->request_bufflen != 0) {
+ } else if (pcmd->request_bufflen != 0)
pci_unmap_single(pACB->pPCI_DEV,
(dma_addr_t) (unsigned long)pcmd->SCp.ptr,
pcmd->request_bufflen,
pcmd->sc_data_direction);
- }
}

/*
-**********************************************************************************
-**********************************************************************************
+***************************************************************************
+***************************************************************************
*/
static int arcmsr_fops_open(struct inode *inode, struct file *filep)
{
@@ -582,8 +606,8 @@ static int arcmsr_fops_open(struct inode
}

/*
-**********************************************************************************
-**********************************************************************************
+***************************************************************************
+***************************************************************************
*/
static int arcmsr_fops_close(struct inode *inode, struct file *filep)
{
@@ -605,8 +629,8 @@ static int arcmsr_fops_close(struct inod
}

/*
-**********************************************************************************
-**********************************************************************************
+***************************************************************************
+***************************************************************************
*/
static int arcmsr_fops_ioctl(struct inode *inode, struct file *filep,
unsigned int ioctl_cmd, unsigned long arg)
@@ -627,10 +651,10 @@ static int arcmsr_fops_ioctl(struct inod
return -ENXIO;
/*
************************************************************
- ** We do not allow muti ioctls to the driver at the same duration.
+ ** We do not allow multi ioctls to the driver at the same duration.
************************************************************
*/
- return arcmsr_iop_ioctlcmd(pACB, ioctl_cmd, (void *)arg);
+ return arcmsr_iop_ioctlcmd(pACB, ioctl_cmd, (void __user *)arg);
}

/*
@@ -737,12 +761,14 @@ static u_int8_t arcmsr_wait_msgint_ready
for (Index = 0; Index < 100; Index++) {
if (readl(&pACB->pmu->outbound_intstatus) &
ARCMSR_MU_OUTBOUND_MESSAGE0_INT) {
- writel(ARCMSR_MU_OUTBOUND_MESSAGE0_INT, &pACB->pmu->outbound_intstatus); /*clear interrupt */
+ writel(ARCMSR_MU_OUTBOUND_MESSAGE0_INT,
+ &pACB->pmu->outbound_intstatus);
+ /* clear interrupt */
return 0x00;
}
msleep_interruptible(10);
- } /*max 1 seconds */
- } while (Retries++ < 20); /*max 20 sec */
+ } /* max 1 seconds */
+ } while (Retries++ < 20); /* max 20 sec */
return 0xff;
}

@@ -770,7 +796,7 @@ static void arcmsr_iop_reset(struct ACB
printk
("arcmsr_iop_reset: wait 'abort all outstanding command' timeout................. \n");
}
- /*clear all outbound posted Q */
+ /* clear all outbound posted Q */
for (i = 0; i < ARCMSR_MAX_OUTSTANDING_CMD; i++) {
readl(&pACB->pmu->outbound_queueport);
}
@@ -900,7 +926,7 @@ static void arcmsr_build_ccb(struct ACB

/*
**************************************************************************
-** arcmsr_post_ccb - Send a protocol specific ARC send postcard to a AIOC .
+** arcmsr_post_ccb - Send a protocol specific ARC send postcard to a AIOC.
** handle: Handle of registered ARC protocol driver
** adapter_id: AIOC unique identifier(integer)
** pPOSTCARD_SEND: Pointer to ARC send postcard
@@ -968,13 +994,15 @@ static void arcmsr_post_Qbuffer(struct A
pQbuffer = &pACB->wqbuffer[pACB->wqbuf_firstindex];
memcpy(iop_data, pQbuffer, 1);
pACB->wqbuf_firstindex++;
- pACB->wqbuf_firstindex %= ARCMSR_MAX_QBUFFER; /*if last index number set it to 0 */
+ /* if last index number set it to 0 */
+ pACB->wqbuf_firstindex %= ARCMSR_MAX_QBUFFER;
iop_data++;
allxfer_len++;
}
pwbuffer->data_len = allxfer_len;
/*
- ** push inbound doorbell and wait reply at hwinterrupt routine for next Qbuffer post
+ ** push inbound doorbell and wait reply at hwinterrupt routine
+ ** for next Qbuffer post
*/
writel(ARCMSR_INBOUND_DRIVER_DATA_WRITE_OK,
&pACB->pmu->inbound_doorbell);
@@ -1033,7 +1061,8 @@ static irqreturn_t arcmsr_interrupt(stru
*/
outbound_intstatus =
readl(&pACB->pmu->outbound_intstatus) & pACB->outbound_int_enable;
- writel(outbound_intstatus, &pACB->pmu->outbound_intstatus); /*clear interrupt */
+ /* clear interrupt */
+ writel(outbound_intstatus, &pACB->pmu->outbound_intstatus);
if (outbound_intstatus & ARCMSR_MU_OUTBOUND_DOORBELL_INT) {
/*
*********************************************
@@ -1041,7 +1070,8 @@ static irqreturn_t arcmsr_interrupt(stru
*********************************************
*/
outbound_doorbell = readl(&pACB->pmu->outbound_doorbell);
- writel(outbound_doorbell, &pACB->pmu->outbound_doorbell); /*clear interrupt */
+ /* clear interrupt */
+ writel(outbound_doorbell, &pACB->pmu->outbound_doorbell);
if (outbound_doorbell & ARCMSR_OUTBOUND_IOP331_DATA_WRITE_OK) {
struct QBUFFER *prbuffer =
(struct QBUFFER *)&pACB->pmu->ioctl_rbuffer;
@@ -1050,7 +1080,7 @@ static irqreturn_t arcmsr_interrupt(stru
int32_t my_empty_len, iop_len, rqbuf_firstindex,
rqbuf_lastindex;

- /*check this iop data if overflow my rqbuffer */
+ /* check this iop data if overflow my rqbuffer */
rqbuf_lastindex = pACB->rqbuf_lastindex;
rqbuf_firstindex = pACB->rqbuf_firstindex;
iop_len = prbuffer->data_len;
@@ -1064,14 +1094,18 @@ static irqreturn_t arcmsr_interrupt(stru
rqbuf_lastindex];
memcpy(pQbuffer, iop_data, 1);
pACB->rqbuf_lastindex++;
- pACB->rqbuf_lastindex %= ARCMSR_MAX_QBUFFER; /*if last index number set it to 0 */
+ /* if last index number set it to 0 */
+ pACB->rqbuf_lastindex %=
+ ARCMSR_MAX_QBUFFER;
iop_data++;
iop_len--;
}
- writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK, &pACB->pmu->inbound_doorbell); /*signature, let IOP331 know data has been readed */
- } else {
+ /* signature, let IOP331 know data has been
+ * read */
+ writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK,
+ &pACB->pmu->inbound_doorbell);
+ } else
pACB->acb_flags |= ACB_F_IOPDATA_OVERFLOW;
- }
}
if (outbound_doorbell & ARCMSR_OUTBOUND_IOP331_DATA_READ_OK) {
/*
@@ -1089,41 +1123,45 @@ static irqreturn_t arcmsr_interrupt(stru
while ((pACB->wqbuf_firstindex !=
pACB->wqbuf_lastindex)
&& (allxfer_len < 124)) {
- pQbuffer =
- &pACB->wqbuffer[pACB->
- wqbuf_firstindex];
+ pQbuffer = &pACB->wqbuffer[
+ pACB->wqbuf_firstindex];
memcpy(iop_data, pQbuffer, 1);
pACB->wqbuf_firstindex++;
- pACB->wqbuf_firstindex %= ARCMSR_MAX_QBUFFER; /*if last index number set it to 0 */
+ /* if last index number set it to 0 */
+ pACB->wqbuf_firstindex %=
+ ARCMSR_MAX_QBUFFER;
iop_data++;
allxfer_len++;
}
pwbuffer->data_len = allxfer_len;
/*
- ** push inbound doorbell tell iop driver data write ok and wait reply on next hwinterrupt for next Qbuffer post
+ ** push inbound doorbell tell iop driver
+ ** data write ok and wait reply on next
+ ** hwinterrupt for next Qbuffer post
*/
writel(ARCMSR_INBOUND_DRIVER_DATA_WRITE_OK,
&pACB->pmu->inbound_doorbell);
- } else {
+ } else
pACB->acb_flags |= ACB_F_IOCTL_WQBUFFER_CLEARED;
- }
}
}
if (outbound_intstatus & ARCMSR_MU_OUTBOUND_POSTQUEUE_INT) {
int id, lun;
/*
- *****************************************************************************
+ **********************************************************
** areca cdb command done
- *****************************************************************************
+ **********************************************************
*/
while (1) {
if ((flag_ccb =
readl(&pACB->pmu->outbound_queueport)) ==
0xFFFFFFFF) {
- break; /*chip FIFO no ccb for completion already */
+ break; /* chip FIFO no ccb for completion already */
}
/* check if command done with no error */
- pCCB = (struct CCB *)(pACB->vir2phy_offset + (flag_ccb << 5)); /*frame must be 32 bytes aligned */
+ /* frame must be 32 bytes aligned */
+ pCCB = (struct CCB *)(pACB->vir2phy_offset +
+ (flag_ccb << 5));
if ((pCCB->pACB != pACB)
|| (pCCB->startdone != ARCMSR_CCB_START)) {
if (pCCB->startdone == ARCMSR_CCB_ABORTED) {
@@ -1181,31 +1219,35 @@ static irqreturn_t arcmsr_interrupt(stru
}
break;
default:
- /* error occur Q all error ccb to errorccbpending Q */
+ /* error occur Q all error ccb to
+ * errorccbpending Q */
printk
("arcmsr%d scsi id=%d lun=%d isr get command error done, but got unknow DeviceStatus=0x%x \n",
pACB->adapter_index, id, lun,
pCCB->arcmsr_cdb.DeviceStatus);
pACB->devstate[id][lun] =
ARECA_RAID_GONE;
- pCCB->pcmd->result = DID_NO_CONNECT << 16; /*unknow error or crc error just for retry */
+ /* unknown error or crc error just for
+ * retry */
+ pCCB->pcmd->result =
+ DID_NO_CONNECT << 16;
arcmsr_ccb_complete(pCCB);
break;
}
}
- } /*drain reply FIFO */
+ } /* drain reply FIFO */
}
if (!(outbound_intstatus & ARCMSR_MU_OUTBOUND_HANDLE_INT))
- /*it must be share irq */
+ /* it must be share irq */
return IRQ_NONE;
if (atomic_read(&pACB->ccbwait2gocount) != 0)
- arcmsr_post_wait2go_ccb(pACB); /*try to post all pending ccb */
+ arcmsr_post_wait2go_ccb(pACB); /* try to post all pending ccb */
return IRQ_HANDLED;
}

/*
-*******************************************************************************
-*******************************************************************************
+***************************************************************************
+***************************************************************************
*/
static void arcmsr_iop_parking(struct ACB *pACB)
{
@@ -1233,282 +1275,257 @@ static void arcmsr_iop_parking(struct AC
***********************************************************************
************************************************************************
*/
-static int arcmsr_iop_ioctlcmd(struct ACB *pACB, int ioctl_cmd, void *arg)
+static int arcmsr_iop_ioctlcmd(struct ACB *pACB, int ioctl_cmd, void __user *arg)
{
struct CMD_IOCTL_FIELD *pcmdioctlfld;
dma_addr_t cmd_handle;
int retvalue = 0;
/* Only let one of these through at a time */

- pcmdioctlfld =
- pci_alloc_consistent(pACB->pPCI_DEV,
- sizeof(struct CMD_IOCTL_FIELD), &cmd_handle);
- if (pcmdioctlfld == NULL)
+ pcmdioctlfld = pci_alloc_consistent(pACB->pPCI_DEV,
+ sizeof(struct CMD_IOCTL_FIELD), &cmd_handle);
+ if (!pcmdioctlfld)
return -ENOMEM;
- if (copy_from_user(pcmdioctlfld, arg, sizeof(struct CMD_IOCTL_FIELD))
- != 0) {
+ if (copy_from_user(pcmdioctlfld, arg, sizeof(struct CMD_IOCTL_FIELD))) {
retvalue = -EFAULT;
goto ioctl_out;
}
- if (memcmp(pcmdioctlfld->cmdioctl.Signature, "ARCMSR", 6) != 0) {
+ if (memcmp(pcmdioctlfld->cmdioctl.Signature, "ARCMSR", 6)) {
retvalue = -EINVAL;
goto ioctl_out;
}
switch (ioctl_cmd) {
case ARCMSR_IOCTL_READ_RQBUFFER:
- {
- unsigned long flag;
- unsigned long *ver_addr;
- dma_addr_t buf_handle;
- uint8_t *pQbuffer, *ptmpQbuffer;
- int32_t allxfer_len = 0;
-
- ver_addr =
- pci_alloc_consistent(pACB->pPCI_DEV, 1032,
- &buf_handle);
- if (ver_addr == NULL) {
- retvalue = -ENOMEM;
- goto ioctl_out;
- }
- ptmpQbuffer = (uint8_t *) ver_addr;
- spin_lock_irqsave(&pACB->qbuffer_lockunlock, flag);
- while ((pACB->rqbuf_firstindex != pACB->rqbuf_lastindex)
- && (allxfer_len < 1031)) {
- /*copy READ QBUFFER to srb */
- pQbuffer =
- &pACB->rqbuffer[pACB->rqbuf_firstindex];
- memcpy(ptmpQbuffer, pQbuffer, 1);
- pACB->rqbuf_firstindex++;
- pACB->rqbuf_firstindex %= ARCMSR_MAX_QBUFFER; /*if last index number set it to 0 */
- ptmpQbuffer++;
- allxfer_len++;
- }
- if (pACB->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
- struct QBUFFER *prbuffer =
- (struct QBUFFER *)&pACB->pmu->ioctl_rbuffer;
- uint8_t *pQbuffer;
- uint8_t *iop_data = (uint8_t *) prbuffer->data;
- int32_t iop_len;
-
- pACB->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
- iop_len = (int32_t) prbuffer->data_len;
- /*this iop data does no chance to make me overflow again here, so just do it */
- while (iop_len > 0) {
- pQbuffer =
- &pACB->rqbuffer[pACB->
- rqbuf_lastindex];
- memcpy(pQbuffer, iop_data, 1);
- pACB->rqbuf_lastindex++;
- pACB->rqbuf_lastindex %= ARCMSR_MAX_QBUFFER; /*if last index number set it to 0 */
- iop_data++;
- iop_len--;
- }
- writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK, &pACB->pmu->inbound_doorbell); /*signature, let IOP331 know data has been readed */
- }
- spin_unlock_irqrestore(&pACB->qbuffer_lockunlock, flag);
- memcpy(pcmdioctlfld->ioctldatabuffer,
- (uint8_t *) ver_addr, allxfer_len);
- pcmdioctlfld->cmdioctl.Length = allxfer_len;
- pcmdioctlfld->cmdioctl.ReturnCode =
- ARCMSR_IOCTL_RETURNCODE_OK;
- if (copy_to_user
- (arg, pcmdioctlfld,
- sizeof(struct CMD_IOCTL_FIELD)) != 0) {
- retvalue = -EFAULT;
- }
- pci_free_consistent(pACB->pPCI_DEV, 1032, ver_addr,
- buf_handle);
+ {
+ unsigned long flag;
+ unsigned long *ver_addr;
+ dma_addr_t buf_handle;
+ uint8_t *pQbuffer, *ptmpQbuffer;
+ int32_t allxfer_len = 0;
+
+ ver_addr = pci_alloc_consistent(pACB->pPCI_DEV, 1032,
+ &buf_handle);
+ if (!ver_addr) {
+ retvalue = -ENOMEM;
+ goto ioctl_out;
+ }
+ ptmpQbuffer = (uint8_t *) ver_addr;
+ spin_lock_irqsave(&pACB->qbuffer_lockunlock, flag);
+ while ((pACB->rqbuf_firstindex != pACB->rqbuf_lastindex)
+ && (allxfer_len < 1031)) {
+ /* copy READ QBUFFER to srb */
+ pQbuffer = &pACB->rqbuffer[pACB->rqbuf_firstindex];
+ memcpy(ptmpQbuffer, pQbuffer, 1);
+ pACB->rqbuf_firstindex++;
+ /* if last index number set it to 0 */
+ pACB->rqbuf_firstindex %= ARCMSR_MAX_QBUFFER;
+ ptmpQbuffer++;
+ allxfer_len++;
}
+ if (pACB->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
+ struct QBUFFER *prbuffer =
+ (struct QBUFFER *)&pACB->pmu->ioctl_rbuffer;
+ uint8_t *pQbuffer;
+ uint8_t *iop_data = (uint8_t *) prbuffer->data;
+ int32_t iop_len;
+
+ pACB->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
+ iop_len = (int32_t) prbuffer->data_len;
+ /* this iop data has no chance to make me
+ * overflow again here, so just do it */
+ while (iop_len > 0) {
+ pQbuffer = &pACB->rqbuffer[pACB->
+ rqbuf_lastindex];
+ memcpy(pQbuffer, iop_data, 1);
+ pACB->rqbuf_lastindex++;
+ /* if last index number set it to 0 */
+ pACB->rqbuf_lastindex %= ARCMSR_MAX_QBUFFER;
+ iop_data++;
+ iop_len--;
+ }
+ /* signature, let IOP331 know data has been read */
+ writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK,
+ &pACB->pmu->inbound_doorbell);
+ }
+ spin_unlock_irqrestore(&pACB->qbuffer_lockunlock, flag);
+ memcpy(pcmdioctlfld->ioctldatabuffer,
+ (uint8_t *) ver_addr, allxfer_len);
+ pcmdioctlfld->cmdioctl.Length = allxfer_len;
+ pcmdioctlfld->cmdioctl.ReturnCode = ARCMSR_IOCTL_RETURNCODE_OK;
+ if (copy_to_user(arg, pcmdioctlfld,
+ sizeof(struct CMD_IOCTL_FIELD)))
+ retvalue = -EFAULT;
+ pci_free_consistent(pACB->pPCI_DEV, 1032, ver_addr, buf_handle);
break;
+ }
case ARCMSR_IOCTL_WRITE_WQBUFFER:
- {
- unsigned long flag;
- unsigned long *ver_addr;
- dma_addr_t buf_handle;
- int32_t my_empty_len, user_len, wqbuf_firstindex,
- wqbuf_lastindex;
- uint8_t *pQbuffer, *ptmpuserbuffer;
-
- ver_addr =
- pci_alloc_consistent(pACB->pPCI_DEV, 1032,
- &buf_handle);
- if (ver_addr == NULL) {
- retvalue = -ENOMEM;
- goto ioctl_out;
- }
- ptmpuserbuffer = (uint8_t *) ver_addr;
- user_len = pcmdioctlfld->cmdioctl.Length;
- memcpy(ptmpuserbuffer, pcmdioctlfld->ioctldatabuffer,
- user_len);
- /*check if data xfer length of this request will overflow my array qbuffer */
- spin_lock_irqsave(&pACB->qbuffer_lockunlock, flag);
- wqbuf_lastindex = pACB->wqbuf_lastindex;
- wqbuf_firstindex = pACB->wqbuf_firstindex;
- my_empty_len =
- (wqbuf_firstindex - wqbuf_lastindex -
- 1) & (ARCMSR_MAX_QBUFFER - 1);
- if (my_empty_len >= user_len) {
- while (user_len > 0) {
- /*copy srb data to wqbuffer */
- pQbuffer =
- &pACB->wqbuffer[pACB->
- wqbuf_lastindex];
- memcpy(pQbuffer, ptmpuserbuffer, 1);
- pACB->wqbuf_lastindex++;
- pACB->wqbuf_lastindex %= ARCMSR_MAX_QBUFFER; /*if last index number set it to 0 */
- ptmpuserbuffer++;
- user_len--;
- }
- /*post fist Qbuffer */
- if (pACB->
- acb_flags & ACB_F_IOCTL_WQBUFFER_CLEARED) {
- pACB->acb_flags &=
- ~ACB_F_IOCTL_WQBUFFER_CLEARED;
- arcmsr_post_Qbuffer(pACB);
- }
- pcmdioctlfld->cmdioctl.ReturnCode =
- ARCMSR_IOCTL_RETURNCODE_OK;
- } else {
- pcmdioctlfld->cmdioctl.ReturnCode =
- ARCMSR_IOCTL_RETURNCODE_ERROR;
+ {
+ unsigned long flag;
+ unsigned long *ver_addr;
+ dma_addr_t buf_handle;
+ int32_t my_empty_len, user_len, wqbuf_firstindex,
+ wqbuf_lastindex;
+ uint8_t *pQbuffer, *ptmpuserbuffer;
+
+ ver_addr = pci_alloc_consistent(pACB->pPCI_DEV, 1032,
+ &buf_handle);
+ if (ver_addr == NULL) {
+ retvalue = -ENOMEM;
+ goto ioctl_out;
+ }
+ ptmpuserbuffer = (uint8_t *) ver_addr;
+ user_len = pcmdioctlfld->cmdioctl.Length;
+ memcpy(ptmpuserbuffer, pcmdioctlfld->ioctldatabuffer,
+ user_len);
+ /* check if data xfer length of this request will
+ * overflow my array qbuffer */
+ spin_lock_irqsave(&pACB->qbuffer_lockunlock, flag);
+ wqbuf_lastindex = pACB->wqbuf_lastindex;
+ wqbuf_firstindex = pACB->wqbuf_firstindex;
+ my_empty_len = (wqbuf_firstindex - wqbuf_lastindex - 1) &
+ (ARCMSR_MAX_QBUFFER - 1);
+ if (my_empty_len >= user_len) {
+ while (user_len > 0) {
+ /* copy srb data to wqbuffer */
+ pQbuffer = &pACB->wqbuffer[pACB->
+ wqbuf_lastindex];
+ memcpy(pQbuffer, ptmpuserbuffer, 1);
+ pACB->wqbuf_lastindex++;
+ /* if last index number set it to 0 */
+ pACB->wqbuf_lastindex %= ARCMSR_MAX_QBUFFER;
+ ptmpuserbuffer++;
+ user_len--;
+ }
+ /* post first Qbuffer */
+ if (pACB->acb_flags & ACB_F_IOCTL_WQBUFFER_CLEARED) {
+ pACB->acb_flags &=
+ ~ACB_F_IOCTL_WQBUFFER_CLEARED;
+ arcmsr_post_Qbuffer(pACB);
}
- spin_unlock_irqrestore(&pACB->qbuffer_lockunlock, flag);
- if (copy_to_user
- (arg, pcmdioctlfld,
- sizeof(struct CMD_IOCTL_FIELD)) != 0) {
- retvalue = -EFAULT;
- }
- pci_free_consistent(pACB->pPCI_DEV, 1032, ver_addr,
- buf_handle);
- }
- break;
- case ARCMSR_IOCTL_CLEAR_RQBUFFER:
- {
- unsigned long flag;
- uint8_t *pQbuffer = pACB->rqbuffer;
-
- if (pACB->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
- pACB->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
- writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK, &pACB->pmu->inbound_doorbell); /*signature, let IOP331 know data has been readed */
- }
- pACB->acb_flags |= ACB_F_IOCTL_RQBUFFER_CLEARED;
- spin_lock_irqsave(&pACB->qbuffer_lockunlock, flag);
- pACB->rqbuf_firstindex = 0;
- pACB->rqbuf_lastindex = 0;
- memset(pQbuffer, 0, ARCMSR_MAX_QBUFFER);
- spin_unlock_irqrestore(&pACB->qbuffer_lockunlock, flag);
- /*report success */
pcmdioctlfld->cmdioctl.ReturnCode =
ARCMSR_IOCTL_RETURNCODE_OK;
- if (copy_to_user
- (arg, pcmdioctlfld,
- sizeof(struct CMD_IOCTL_FIELD)) != 0) {
- retvalue = -EFAULT;
- }
- }
+ } else
+ pcmdioctlfld->cmdioctl.ReturnCode =
+ ARCMSR_IOCTL_RETURNCODE_ERROR;
+ spin_unlock_irqrestore(&pACB->qbuffer_lockunlock, flag);
+ if (copy_to_user(arg, pcmdioctlfld,
+ sizeof(struct CMD_IOCTL_FIELD)))
+ retvalue = -EFAULT;
+ pci_free_consistent(pACB->pPCI_DEV, 1032, ver_addr,
+ buf_handle);
break;
+ }
+ case ARCMSR_IOCTL_CLEAR_RQBUFFER:
+ {
+ unsigned long flag;
+ uint8_t *pQbuffer = pACB->rqbuffer;
+
+ if (pACB->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
+ pACB->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
+ /* signature, let IOP331 know data has been read */
+ writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK,
+ &pACB->pmu->inbound_doorbell);
+ }
+ pACB->acb_flags |= ACB_F_IOCTL_RQBUFFER_CLEARED;
+ spin_lock_irqsave(&pACB->qbuffer_lockunlock, flag);
+ pACB->rqbuf_firstindex = 0;
+ pACB->rqbuf_lastindex = 0;
+ memset(pQbuffer, 0, ARCMSR_MAX_QBUFFER);
+ spin_unlock_irqrestore(&pACB->qbuffer_lockunlock, flag);
+ /* report success */
+ pcmdioctlfld->cmdioctl.ReturnCode = ARCMSR_IOCTL_RETURNCODE_OK;
+ if (copy_to_user(arg, pcmdioctlfld,
+ sizeof(struct CMD_IOCTL_FIELD)))
+ retvalue = -EFAULT;
+ break;
+ }
case ARCMSR_IOCTL_CLEAR_WQBUFFER:
- {
- unsigned long flag;
- uint8_t *pQbuffer = pACB->wqbuffer;
-
- if (pACB->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
- pACB->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
- writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK, &pACB->pmu->inbound_doorbell); /*signature, let IOP331 know data has been readed */
- }
- pACB->acb_flags |= ACB_F_IOCTL_WQBUFFER_CLEARED;
- spin_lock_irqsave(&pACB->qbuffer_lockunlock, flag);
- pACB->wqbuf_firstindex = 0;
- pACB->wqbuf_lastindex = 0;
- memset(pQbuffer, 0, ARCMSR_MAX_QBUFFER);
- spin_unlock_irqrestore(&pACB->qbuffer_lockunlock, flag);
- /*report success */
- pcmdioctlfld->cmdioctl.ReturnCode =
- ARCMSR_IOCTL_RETURNCODE_OK;
- if (copy_to_user
- (arg, pcmdioctlfld,
- sizeof(struct CMD_IOCTL_FIELD)) != 0) {
- retvalue = -EFAULT;
- }
- }
+ {
+ unsigned long flag;
+ uint8_t *pQbuffer = pACB->wqbuffer;
+
+ if (pACB->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
+ pACB->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
+ /* signature, let IOP331 know data has been read */
+ writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK,
+ &pACB->pmu->inbound_doorbell);
+ }
+ pACB->acb_flags |= ACB_F_IOCTL_WQBUFFER_CLEARED;
+ spin_lock_irqsave(&pACB->qbuffer_lockunlock, flag);
+ pACB->wqbuf_firstindex = 0;
+ pACB->wqbuf_lastindex = 0;
+ memset(pQbuffer, 0, ARCMSR_MAX_QBUFFER);
+ spin_unlock_irqrestore(&pACB->qbuffer_lockunlock, flag);
+ /* report success */
+ pcmdioctlfld->cmdioctl.ReturnCode = ARCMSR_IOCTL_RETURNCODE_OK;
+ if (copy_to_user(arg, pcmdioctlfld,
+ sizeof(struct CMD_IOCTL_FIELD)))
+ retvalue = -EFAULT;
break;
+ }
case ARCMSR_IOCTL_CLEAR_ALLQBUFFER:
- {
- unsigned long flag;
- uint8_t *pQbuffer;
-
- if (pACB->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
- pACB->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
- writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK, &pACB->pmu->inbound_doorbell); /*signature, let IOP331 know data has been readed */
- }
- pACB->acb_flags |=
- (ACB_F_IOCTL_WQBUFFER_CLEARED |
- ACB_F_IOCTL_RQBUFFER_CLEARED);
- spin_lock_irqsave(&pACB->qbuffer_lockunlock, flag);
- pACB->rqbuf_firstindex = 0;
- pACB->rqbuf_lastindex = 0;
- pACB->wqbuf_firstindex = 0;
- pACB->wqbuf_lastindex = 0;
- pQbuffer = pACB->rqbuffer;
- memset(pQbuffer, 0, sizeof(struct QBUFFER));
- pQbuffer = pACB->wqbuffer;
- memset(pQbuffer, 0, sizeof(struct QBUFFER));
- spin_unlock_irqrestore(&pACB->qbuffer_lockunlock, flag);
- /*report success */
- pcmdioctlfld->cmdioctl.ReturnCode =
- ARCMSR_IOCTL_RETURNCODE_OK;
- if (copy_to_user
- (arg, pcmdioctlfld,
- sizeof(struct CMD_IOCTL_FIELD)) != 0) {
- retvalue = -EFAULT;
- }
- }
+ {
+ unsigned long flag;
+ uint8_t *pQbuffer;
+
+ if (pACB->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
+ pACB->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
+ /* signature, let IOP331 know data has been read */
+ writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK,
+ &pACB->pmu->inbound_doorbell);
+ }
+ pACB->acb_flags |= (ACB_F_IOCTL_WQBUFFER_CLEARED |
+ ACB_F_IOCTL_RQBUFFER_CLEARED);
+ spin_lock_irqsave(&pACB->qbuffer_lockunlock, flag);
+ pACB->rqbuf_firstindex = 0;
+ pACB->rqbuf_lastindex = 0;
+ pACB->wqbuf_firstindex = 0;
+ pACB->wqbuf_lastindex = 0;
+ pQbuffer = pACB->rqbuffer;
+ memset(pQbuffer, 0, sizeof(struct QBUFFER));
+ pQbuffer = pACB->wqbuffer;
+ memset(pQbuffer, 0, sizeof(struct QBUFFER));
+ spin_unlock_irqrestore(&pACB->qbuffer_lockunlock, flag);
+ /* report success */
+ pcmdioctlfld->cmdioctl.ReturnCode = ARCMSR_IOCTL_RETURNCODE_OK;
+ if (copy_to_user(arg, pcmdioctlfld,
+ sizeof(struct CMD_IOCTL_FIELD)))
+ retvalue = -EFAULT;
break;
+ }
case ARCMSR_IOCTL_RETURN_CODE_3F:
- {
- pcmdioctlfld->cmdioctl.ReturnCode =
- ARCMSR_IOCTL_RETURNCODE_3F;
- if (copy_to_user
- (arg, pcmdioctlfld,
- sizeof(struct CMD_IOCTL_FIELD)) != 0) {
- retvalue = -EFAULT;
- }
- }
+ pcmdioctlfld->cmdioctl.ReturnCode = ARCMSR_IOCTL_RETURNCODE_3F;
+ if (copy_to_user(arg, pcmdioctlfld,
+ sizeof(struct CMD_IOCTL_FIELD)))
+ retvalue = -EFAULT;
break;
case ARCMSR_IOCTL_SAY_HELLO:
- {
- int8_t *hello_string = "Hello! I am ARCMSR";
+ {
+ int8_t *hello_string = "Hello! I am ARCMSR";

- memcpy(pcmdioctlfld->ioctldatabuffer, hello_string,
- (int16_t) strlen(hello_string));
- pcmdioctlfld->cmdioctl.ReturnCode =
- ARCMSR_IOCTL_RETURNCODE_OK;
- if (copy_to_user
- (arg, pcmdioctlfld,
- sizeof(struct CMD_IOCTL_FIELD)) != 0) {
- retvalue = -EFAULT;
- }
- }
+ memcpy(pcmdioctlfld->ioctldatabuffer, hello_string,
+ (int16_t) strlen(hello_string));
+ pcmdioctlfld->cmdioctl.ReturnCode = ARCMSR_IOCTL_RETURNCODE_OK;
+ if (copy_to_user(arg, pcmdioctlfld,
+ sizeof(struct CMD_IOCTL_FIELD)))
+ retvalue = -EFAULT;
break;
+ }
case ARCMSR_IOCTL_SAY_GOODBYE:
- {
- arcmsr_iop_parking(pACB);
- }
+ arcmsr_iop_parking(pACB);
break;
case ARCMSR_IOCTL_FLUSH_ADAPTER_CACHE:
- {
- arcmsr_flush_adapter_cache(pACB);
- if (arcmsr_wait_msgint_ready(pACB)) {
- printk
- ("arcmsr%d ioctl flush cache wait 'flush adapter cache' timeout \n",
- pACB->adapter_index);
- }
+ arcmsr_flush_adapter_cache(pACB);
+ if (arcmsr_wait_msgint_ready(pACB)) {
+ printk
+ ("arcmsr%d ioctl flush cache wait 'flush adapter cache' timeout \n",
+ pACB->adapter_index);
}
break;
default:
retvalue = -EFAULT;
}
- ioctl_out:
+ioctl_out:
pci_free_consistent(pACB->pPCI_DEV, sizeof(struct CMD_IOCTL_FIELD),
pcmdioctlfld, cmd_handle);
return retvalue;
@@ -1516,20 +1533,21 @@ static int arcmsr_iop_ioctlcmd(struct AC

/*
************************************************************************
-** arcmsr_ioctl
+** arcmsr_ioctl
** Performs ioctl requests not satified by the upper levels.
** copy_from_user(to, from, n)
** copy_to_user(to, from, n)
**
-** The scsi_device struct contains what we know about each given scsi
-** device.
+** The scsi_device struct contains what we know about each given scsi device.
**
** FIXME(eric) - one of the great regrets that I have is that I failed to define
-** these structure elements as something like sdev_foo instead of foo. This would
+** these structure elements as something like sdev_foo instead of foo.
+** This would
** make it so much easier to grep through sources and so forth. I propose that
** all new elements that get added to these structures follow this convention.
-** As time goes on and as people have the stomach for it, it should be possible to
-** go back and retrofit at least some of the elements here with with the prefix.
+** As time goes on and as people have the stomach for it, it should be possible
+** to go back and retrofit at least some of the elements here with with the
+** prefix.
**
**
**struct scsi_device {
@@ -1539,60 +1557,60 @@ static int arcmsr_iop_ioctlcmd(struct AC
** %% struct private is a way of marking it in a sort of C++ type of way.
** %%
**
-** struct scsi_device *next; %% Used for linked list %%
-** struct scsi_device *prev; %% Used for linked list %%
-** wait_queue_head_t scpnt_wait; %% Used to wait if device is busy %%
+** struct scsi_device *next; %% Used for linked list %%
+** struct scsi_device *prev; %% Used for linked list %%
+** wait_queue_head_t scpnt_wait; %% Used to wait if device is busy %%
** struct Scsi_Host *host;
** request_queue_t request_queue;
-** atomic_t device_active; %% commands checked out for device %%
-** volatile unsigned short device_busy; %% commands actually active on low-level %%
-** int (*scsi_init_io_fn) (struct scsi_cmnd *); %% Used to initialize new request %%
-** struct scsi_cmnd *device_queue; %% queue of SCSI Command structures %%
+** atomic_t device_active; %% commands checked out for device %%
+** volatile unsigned short device_busy; %% commands actually active on low-level %%
+** int (*scsi_init_io_fn) (struct scsi_cmnd *); %% Used to initialize new request %%
+** struct scsi_cmnd *device_queue; %% queue of SCSI Command structures %%
**
** %% public: %%
**
** unsigned int id, lun, channel;
-** unsigned int manufacturer; %% Manufacturer of device, for using vendor-specific cmd's %%
-** unsigned sector_size; %% size in bytes %%
-** int attached; %% # of high level drivers attached to this %%
-** int access_count; %% Count of open channels/mounts %%
-** void *hostdata; %% available to low-level driver %%
-** devfs_handle_t de; %% directory for the device %%
+** unsigned int manufacturer; %% Manufacturer of device, for using vendor-specific cmd's %%
+** unsigned sector_size; %% size in bytes %%
+** int attached; %% # of high level drivers attached to this %%
+** int access_count; %% Count of open channels/mounts %%
+** void *hostdata; %% available to low-level driver %%
+** devfs_handle_t de; %% directory for the device %%
** char type;
** char scsi_level;
** char vendor[8], model[16], rev[4];
-** unsigned char current_tag; %% current tag %%
-** unsigned char sync_min_period; %% Not less than this period %%
-** unsigned char sync_max_offset; %% Not greater than this offset %%
-** unsigned char queue_depth; %% How deep a queue to use %%
+** unsigned char current_tag; %% current tag %%
+** unsigned char sync_min_period; %% Not less than this period %%
+** unsigned char sync_max_offset; %% Not greater than this offset %%
+** unsigned char queue_depth; %% How deep a queue to use %%
** unsigned online:1;
** unsigned writeable:1;
** unsigned removable:1;
** unsigned random:1;
** unsigned has_cmdblocks:1;
-** unsigned changed:1; %% Data invalid due to media change %%
-** unsigned busy:1; %% Used to prevent races %%
-** unsigned lockable:1; %% Able to prevent media removal %%
-** unsigned borken:1; %% Tell the Seagate driver to be painfully slow on this device %%
-** unsigned tagged_supported:1; %% Supports SCSI-II tagged queuing %%
-** unsigned tagged_queue:1; %% SCSI-II tagged queuing enabled %%
-** unsigned disconnect:1; %% can disconnect %%
-** unsigned soft_reset:1; %% Uses soft reset option %%
-** unsigned sync:1; %% Negotiate for sync transfers %%
-** unsigned wide:1; %% Negotiate for WIDE transfers %%
-** unsigned single_lun:1; %% Indicates we should only allow I/O to one of the luns for the device at a time. %%
-** unsigned was_reset:1; %% There was a bus reset on the bus for this device %%
-** unsigned expecting_cc_ua:1; %% Expecting a CHECK_CONDITION/UNIT_ATTN because we did a bus reset. %%
-** unsigned device_blocked:1; %% Device returned QUEUE_FULL. %%
-** unsigned ten:1; %% support ten byte read / write %%
-** unsigned remap:1; %% support remapping %%
-** unsigned starved:1; %% unable to process commands because host busy %%
-** int allow_revalidate; %% Flag to allow revalidate to succeed in sd_open
+** unsigned changed:1; %% Data invalid due to media change %%
+** unsigned busy:1; %% Used to prevent races %%
+** unsigned lockable:1; %% Able to prevent media removal %%
+** unsigned borken:1; %% Tell the Seagate driver to be painfully slow on this device %%
+** unsigned tagged_supported:1; %% Supports SCSI-II tagged queuing %%
+** unsigned tagged_queue:1; %% SCSI-II tagged queuing enabled %%
+** unsigned disconnect:1; %% can disconnect %%
+** unsigned soft_reset:1; %% Uses soft reset option %%
+** unsigned sync:1; %% Negotiate for sync transfers %%
+** unsigned wide:1; %% Negotiate for WIDE transfers %%
+** unsigned single_lun:1; %% Indicates we should only allow I/O to one of the luns for the device at a time. %%
+** unsigned was_reset:1; %% There was a bus reset on the bus for this device %%
+** unsigned expecting_cc_ua:1; %% Expecting a CHECK_CONDITION/UNIT_ATTN because we did a bus reset. %%
+** unsigned device_blocked:1; %% Device returned QUEUE_FULL. %%
+** unsigned ten:1; %% support ten byte read / write %%
+** unsigned remap:1; %% support remapping %%
+** unsigned starved:1; %% unable to process commands because host busy %%
+** int allow_revalidate; %% Flag to allow revalidate to succeed in sd_open
**};
**
************************************************************************
*/
-static int arcmsr_ioctl(struct scsi_device *dev, int ioctl_cmd, void *arg)
+static int arcmsr_ioctl(struct scsi_device *dev, int ioctl_cmd, void __user *arg)
{
struct ACB *pACB;
struct HCBARC *pHCBARC = &arcmsr_host_control_block;
@@ -1610,6 +1628,7 @@ static int arcmsr_ioctl(struct scsi_devi
return -ENXIO;
if (!arg)
return -EINVAL;
+
return arcmsr_iop_ioctlcmd(pACB, ioctl_cmd, arg);
}

@@ -1643,10 +1662,10 @@ static struct CCB *arcmsr_get_freeccb(st
** struct scsi_cmnd {
** int sc_magic;
** // private: //
-** //
-** // This information is private to the scsi mid-layer. Wrapping it in a
-** // struct private is a way of marking it in a sort of C++ type of way.
-** //
+** //
+** // This information is private to the scsi mid-layer. Wrapping it in a
+** // struct private is a way of marking it in a sort of C++ type of way.
+** //
** struct Scsi_Host *host;
** unsigned short state;
** unsigned short owner;
@@ -1658,19 +1677,19 @@ static struct CCB *arcmsr_get_freeccb(st
** int eh_state; // Used for state tracking in error handlr
** void (*done) (struct scsi_cmnd *);
** // Mid-level done function
-** //
-** // A SCSI Command is assigned a nonzero serial_number when internal_cmnd
-** // passes it to the driver's queue command function. The serial_number
-** // is cleared when scsi_done is entered indicating that the command has
-** // been completed. If a timeout occurs, the serial number at the moment
-** // of timeout is copied into serial_number_at_timeout. By subsequently
-** // comparing the serial_number and serial_number_at_timeout fields
-** // during abort or reset processing, we can detect whether the command
-** // has already completed. This also detects cases where the command has
-** // completed and the SCSI Command structure has already being reused
-** // for another command, so that we can avoid incorrectly aborting or
-** // resetting the new command.
-** //
+** //
+** // A SCSI Command is assigned a nonzero serial_number when internal_cmnd
+** // passes it to the driver's queue command function. The serial_number
+** // is cleared when scsi_done is entered indicating that the command has
+** // been completed. If a timeout occurs, the serial number at the moment
+** // of timeout is copied into serial_number_at_timeout. By subsequently
+** // comparing the serial_number and serial_number_at_timeout fields
+** // during abort or reset processing, we can detect whether the command
+** // has already completed. This also detects cases where the command has
+** // completed and the SCSI Command structure has already being reused
+** // for another command, so that we can avoid incorrectly aborting or
+** // resetting the new command.
+** //
**
** unsigned long serial_number;
** unsigned long serial_number_at_timeout;
@@ -1681,10 +1700,10 @@ static struct CCB *arcmsr_get_freeccb(st
** int timeout_total;
** int timeout;
**
-** //
-** // We handle the timeout differently if it happens when a reset,
-** // abort, etc are in process.
-** //
+** //
+** // We handle the timeout differently if it happens when a reset,
+** // abort, etc are in process.
+** //
** unsigned volatile char internal_timeout;
** struct scsi_cmnd *bh_next;
** // To enumerate the commands waiting to be processed.
@@ -1698,7 +1717,7 @@ static struct CCB *arcmsr_get_freeccb(st
** unsigned char old_cmd_len;
** unsigned char sc_data_direction;
** unsigned char sc_old_data_direction;
-** // These elements define the operation we are about to perform
+** // These elements define the operation we are about to perform
** unsigned char cmnd[MAX_COMMAND_SIZE];
** unsigned request_bufflen;
** // Actual request size
@@ -1707,7 +1726,7 @@ static struct CCB *arcmsr_get_freeccb(st
** // Used to time out the command.
** void *request_buffer;
** // Actual requested buffer
-** // These elements define the operation we ultimately want to perform
+** // These elements define the operation we ultimately want to perform
** unsigned char data_cmnd[MAX_COMMAND_SIZE];
** unsigned short old_use_sg;
** // We save use_sg here when requesting sense info
@@ -1727,7 +1746,7 @@ static struct CCB *arcmsr_get_freeccb(st
** // save underflow here when reusing the command for error handling
**
** unsigned transfersize;
-** // How much we are guaranteed to transfer with each SCSI transfer
+** // How much we are guaranteed to transfer with each SCSI transfer
** // (ie, between disconnect/reconnects. Probably==sector size
** int resid;
** // Number of bytes requested to be transferred
@@ -1737,26 +1756,26 @@ static struct CCB *arcmsr_get_freeccb(st
** unsigned char sense_buffer[SCSI_SENSE_BUFFERSIZE];
** // obtained by REQUEST SENSE when CHECK CONDITION is received on original command (auto-sense)
** unsigned flags;
-** // Used to indicate that a command which has timed out also
-** // completed normally. Typically the completion function will
-** // do nothing but set this flag in this instance because the
-** // timeout handler is already running.
+** // Used to indicate that a command which has timed out also
+** // completed normally. Typically the completion function will
+** // do nothing but set this flag in this instance because the
+** // timeout handler is already running.
** unsigned done_late:1;
-** // Low-level done function - can be used by low-level driver to point
-** // to completion function. Not used by mid/upper level code.
+** // Low-level done function - can be used by low-level driver to point
+** // to completion function. Not used by mid/upper level code.
** void (*scsi_done) (struct scsi_cmnd *);
-** // The following fields can be written to by the host specific code.
-** // Everything else should be left alone.
+** // The following fields can be written to by the host specific code.
+** // Everything else should be left alone.
** Scsi_Pointer SCp;
** // Scratchpad used by some host adapters
** unsigned char *host_scribble;
** // The host adapter is allowed to
-** // call scsi_malloc and get some memory
-** // and hang it here. The host adapter
-** // is also expected to call scsi_free
-** // to release this memory. (The memory
-** // obtained by scsi_malloc is guaranteed
-** // to be at an address < 16Mb).
+** // call scsi_malloc and get some memory
+** // and hang it here. The host adapter
+** // is also expected to call scsi_free
+** // to release this memory. (The memory
+** // obtained by scsi_malloc is guaranteed
+** // to be at an address < 16Mb).
** int result;
** // Status code from lower level driver
** unsigned char tag;
@@ -1796,7 +1815,9 @@ static int arcmsr_queue_command(struct s
cmd->scsi_done = done;
cmd->host_scribble = NULL;
cmd->result = 0;
- if (cmd->cmnd[0] == SYNCHRONIZE_CACHE) { /* 0x35 avoid synchronizing disk cache cmd after .remove : arcmsr_device_remove (linux bug) */
+ if (cmd->cmnd[0] == SYNCHRONIZE_CACHE) {
+ /* 0x35 avoid synchronizing disk cache cmd after .remove :
+ arcmsr_device_remove (linux bug) */
if (pACB->devstate[target][lun] == ARECA_RAID_GONE)
cmd->result = (DID_NO_CONNECT << 16);
cmd->scsi_done(cmd);
@@ -1827,16 +1848,18 @@ static int arcmsr_queue_command(struct s
if (atomic_read(&pACB->ccboutstandingcount) <
ARCMSR_MAX_OUTSTANDING_CMD) {
/*
- ******************************************************************
- ** and we can make sure there were no pending ccb in this duration
- ******************************************************************
+ **************************************************
+ ** and we can make sure there were no pending ccb
+ ** in this duration
+ **************************************************
*/
arcmsr_post_ccb(pACB, pCCB);
} else {
/*
- ******************************************************************
- ** Q of ccbwaitexec will be post out when any outstanding command complete
- ******************************************************************
+ **************************************************
+ ** Q of ccbwaitexec will be post out when any
+ ** outstanding command complete
+ **************************************************
*/
arcmsr_queue_wait2go_ccb(pACB, pCCB);
}
@@ -1895,10 +1918,14 @@ static void arcmsr_get_firmware_spec(str
printk
("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
}
- pACB->firm_request_len = readl(&pACB->pmu->message_rbuffer[1]); /*firm_request_len,1,04-07 */
- pACB->firm_numbers_queue = readl(&pACB->pmu->message_rbuffer[2]); /*firm_numbers_queue,2,08-11 */
- pACB->firm_sdram_size = readl(&pACB->pmu->message_rbuffer[3]); /*firm_sdram_size,3,12-15 */
- pACB->firm_ide_channels = readl(&pACB->pmu->message_rbuffer[4]); /*firm_ide_channels,4,16-19 */
+ /* firm_request_len,1,04-07 */
+ pACB->firm_request_len = readl(&pACB->pmu->message_rbuffer[1]);
+ /* firm_numbers_queue,2,08-11 */
+ pACB->firm_numbers_queue = readl(&pACB->pmu->message_rbuffer[2]);
+ /* firm_sdram_size,3,12-15 */
+ pACB->firm_sdram_size = readl(&pACB->pmu->message_rbuffer[3]);
+ /* firm_ide_channels,4,16-19 */
+ pACB->firm_ide_channels = readl(&pACB->pmu->message_rbuffer[4]);
}

/*
@@ -1920,20 +1947,21 @@ static void arcmsr_start_adapter_bgrb(st
static void arcmsr_polling_ccbdone(struct ACB *pACB, struct CCB *poll_ccb)
{
struct CCB *pCCB;
- uint32_t flag_ccb, outbound_intstatus, poll_ccb_done = 0, poll_count =
- 0;
+ uint32_t flag_ccb, outbound_intstatus, poll_ccb_done = 0,
+ poll_count = 0;
int id, lun;

- polling_ccb_retry:
+polling_ccb_retry:
poll_count++;
outbound_intstatus =
readl(&pACB->pmu->outbound_intstatus) & pACB->outbound_int_enable;
- writel(outbound_intstatus, &pACB->pmu->outbound_intstatus); /*clear interrupt */
+ /* clear interrupt */
+ writel(outbound_intstatus, &pACB->pmu->outbound_intstatus);
while (1) {
if ((flag_ccb =
readl(&pACB->pmu->outbound_queueport)) == 0xFFFFFFFF) {
if (poll_ccb_done)
- break; /*chip FIFO no ccb for completion already */
+ break; /* chip FIFO no ccb for completion already */
else {
msleep(25);
if (poll_count > 100)
@@ -1942,7 +1970,8 @@ static void arcmsr_polling_ccbdone(struc
}
}
/* check if command done with no error */
- pCCB = (struct CCB *)(pACB->vir2phy_offset + (flag_ccb << 5)); /*frame must be 32 bytes aligned */
+ /* frame must be 32 bytes aligned */
+ pCCB = (struct CCB *)(pACB->vir2phy_offset + (flag_ccb << 5));
if ((pCCB->pACB != pACB)
|| (pCCB->startdone != ARCMSR_CCB_START)) {
if ((pCCB->startdone == ARCMSR_CCB_ABORTED)
@@ -1999,18 +2028,20 @@ static void arcmsr_polling_ccbdone(struc
}
break;
default:
- /* error occur Q all error ccb to errorccbpending Q */
+ /* error occur Q all error ccb to
+ * errorccbpending Q */
printk
("arcmsr%d scsi id=%d lun=%d polling and getting command error done, but got unknow DeviceStatus=0x%x \n",
pACB->adapter_index, id, lun,
pCCB->arcmsr_cdb.DeviceStatus);
pACB->devstate[id][lun] = ARECA_RAID_GONE;
- pCCB->pcmd->result = DID_BAD_TARGET << 16; /*unknow error or crc error just for retry */
+ /* unknown error or crc error just for retry */
+ pCCB->pcmd->result = DID_BAD_TARGET << 16;
arcmsr_ccb_complete(pCCB);
break;
}
}
- } /*drain reply FIFO */
+ } /* drain reply FIFO */
}

/*
@@ -2025,9 +2056,10 @@ static void arcmsr_iop_init(struct ACB *
do {
firmware_state = readl(&pACB->pmu->outbound_msgaddr1);
} while ((firmware_state & ARCMSR_OUTBOUND_MESG1_FIRMWARE_OK) == 0);
- intmask_org = readl(&pACB->pmu->outbound_intmask); /*change "disable iop interrupt" to arcmsr_initialize */
+ /* change "disable iop interrupt" to arcmsr_initialize */
+ intmask_org = readl(&pACB->pmu->outbound_intmask);
arcmsr_get_firmware_spec(pACB);
- /*start background rebuild */
+ /* start background rebuild */
arcmsr_start_adapter_bgrb(pACB);
if (arcmsr_wait_msgint_ready(pACB)) {
printk
@@ -2037,11 +2069,13 @@ static void arcmsr_iop_init(struct ACB *
/* clear Qbuffer if door bell ringed */
outbound_doorbell = readl(&pACB->pmu->outbound_doorbell);
if (outbound_doorbell & ARCMSR_OUTBOUND_IOP331_DATA_WRITE_OK) {
- writel(outbound_doorbell, &pACB->pmu->outbound_doorbell); /*clear interrupt */
+ /* clear interrupt */
+ writel(outbound_doorbell, &pACB->pmu->outbound_doorbell);
writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK,
&pACB->pmu->inbound_doorbell);
}
- /* enable outbound Post Queue, outbound message0, outbound doorbell Interrupt */
+ /* enable outbound Post Queue, outbound message0, outbound
+ * doorbell Interrupt */
mask =
~(ARCMSR_MU_OUTBOUND_POSTQUEUE_INTMASKENABLE |
ARCMSR_MU_OUTBOUND_DOORBELL_INTMASKENABLE |
@@ -2077,8 +2111,8 @@ static int arcmsr_bus_reset(struct scsi_
}

/*
-*****************************************************************************************
-*****************************************************************************************
+***************************************************************************
+***************************************************************************
*/
static int arcmsr_seek_cmd2abort(struct scsi_cmnd *pabortcmd)
{
@@ -2089,13 +2123,14 @@ static int arcmsr_seek_cmd2abort(struct

pACB->num_aborts++;
/*
- *****************************************************************************
- ** It is the upper layer do abort command this lock just prior to calling us.
+ ******************************************************************
+ ** It is the upper layer do abort command this lock just prior to
+ ** calling us.
** First determine if we currently own this command.
** Start by searching the device queue. If not found
** at all, and the system wanted us to just abort the
** command return success.
- *****************************************************************************
+ ******************************************************************
*/
if (atomic_read(&pACB->ccboutstandingcount) != 0) {
for (i = 0; i < ARCMSR_MAX_FREECCB_NUM; i++) {
@@ -2140,7 +2175,8 @@ static int arcmsr_seek_cmd2abort(struct
}
}
return SUCCESS;
- abort_outstanding_cmd:
+
+abort_outstanding_cmd:
/* disable all outbound interrupt */
intmask_org = readl(&pACB->pmu->outbound_intmask);
writel(intmask_org | ARCMSR_MU_OUTBOUND_ALL_INTMASKENABLE,
@@ -2158,8 +2194,8 @@ static int arcmsr_seek_cmd2abort(struct
}

/*
-*****************************************************************************************
-*****************************************************************************************
+***************************************************************************
+***************************************************************************
*/
static int arcmsr_cmd_abort(struct scsi_cmnd *cmd)
{
@@ -2185,46 +2221,46 @@ static int arcmsr_cmd_abort(struct scsi_
*********************************************************************
** arcmsr_info()
**struct pci_dev {
-** struct list_head global_list; ## node in list of all PCI devices ##
+** struct list_head global_list; ## node in list of all PCI devices ##
** struct list_head bus_list; ## node in per-bus list ##
-** struct pci_bus *bus; ## bus this device is on ##
-** struct pci_bus *subordinate; ## bus this device bridges to ##
-** void *sysdata; ## hook for sys-specific extension ##
+** struct pci_bus *bus; ## bus this device is on ##
+** struct pci_bus *subordinate; ## bus this device bridges to ##
+** void *sysdata; ## hook for sys-specific extension ##
** struct proc_dir_entry *procent; ## device entry in /proc/bus/pci ##
-** unsigned int devfn; ## encoded device & function index ##
+** unsigned int devfn; ## encoded device & function index ##
** unsigned short vendor;
** unsigned short device;
** unsigned short subsystem_vendor;
** unsigned short subsystem_device;
-** unsigned int class; ## 3 bytes: (base,sub,prog-if) ##
-** u8 hdr_type; ## PCI header type (`multi' flag masked out) ##
-** u8 rom_base_reg; ## which config register controls the ROM ##
+** unsigned int class; ## 3 bytes: (base,sub,prog-if) ##
+** u8 hdr_type; ## PCI header type (`multi' flag masked out) ##
+** u8 rom_base_reg; ## which config register controls the ROM ##
**
** struct pci_driver *driver; ## which driver has allocated this device ##
-** void *driver_data; ## data private to the driver ##
-** u64 dma_mask; ## Mask of the bits of bus address this device implements. Normally this is
-** ## 0xffffffff. You only need to change this if your device has broken DMA
-** ## or supports 64-bit transfers.
+** void *driver_data; ## data private to the driver ##
+** u64 dma_mask; ## Mask of the bits of bus address this device implements. Normally this is
+** ## 0xffffffff. You only need to change this if your device has broken DMA
+** ## or supports 64-bit transfers.
** u32 current_state; ## Current operating state. In ACPI-speak, this is D0-D3, D0 being fully functional, and D3 being off. ##
** unsigned short vendor_compatible[DEVICE_COUNT_COMPATIBLE]; ## device is compatible with these IDs ##
** unsigned short device_compatible[DEVICE_COUNT_COMPATIBLE];
-** ##
-** ##Instead of touching interrupt line and base address registers
-** ##directly, use the values stored here. They might be different!
-** ##
+** ##
+** ##Instead of touching interrupt line and base address registers
+** ##directly, use the values stored here. They might be different!
+** ##
** unsigned int irq;
** struct resource resource[DEVICE_COUNT_RESOURCE]; ## I/O and memory regions + expansion ROMs ##
** struct resource dma_resource[DEVICE_COUNT_DMA];
** struct resource irq_resource[DEVICE_COUNT_IRQ];
-** char name[90]; ## device name ##
-** char slot_name[8]; ## slot name ##
-** u32 saved_state[16]; ## for saving the config space before suspend ##
-** int active; ## ISAPnP: device is active ##
-** int ro; ## ISAPnP: read only ##
-** unsigned short regs; ## ISAPnP: supported registers ##
-** ## These fields are used by common fixups ##
-** unsigned short transparent:1; ## Transparent PCI bridge ##
-** int (*prepare)(struct pci_dev *dev); ## ISAPnP hooks ##
+** char name[90]; ## device name ##
+** char slot_name[8]; ## slot name ##
+** u32 saved_state[16]; ## for saving the config space before suspend ##
+** int active; ## ISAPnP: device is active ##
+** int ro; ## ISAPnP: read only ##
+** unsigned short regs; ## ISAPnP: supported registers ##
+** ## These fields are used by common fixups ##
+** unsigned short transparent:1; ## Transparent PCI bridge ##
+** int (*prepare)(struct pci_dev *dev); ## ISAPnP hooks ##
** int (*activate)(struct pci_dev *dev);
** int (*deactivate)(struct pci_dev *dev);
**};
@@ -2239,77 +2275,58 @@ static const char *arcmsr_info(struct Sc

pACB = (struct ACB *)host->hostdata;
device_id = pACB->pPCI_DEV->device;
+
switch (device_id) {
case PCIDeviceIDARC1110:
- {
- sprintf(buf,
- "ARECA ARC1110 PCI-X 4 PORTS SATA RAID CONTROLLER\n %s",
- ARCMSR_DRIVER_VERSION);
- break;
- }
+ sprintf(buf,
+ "ARECA ARC1110 PCI-X 4 PORTS SATA RAID CONTROLLER\n %s",
+ ARCMSR_DRIVER_VERSION);
+ break;
case PCIDeviceIDARC1120:
- {
- sprintf(buf,
- "ARECA ARC1120 PCI-X 8 PORTS SATA RAID CONTROLLER (RAID6-ENGINE Inside)\n %s",
- ARCMSR_DRIVER_VERSION);
- break;
- }
+ sprintf(buf,
+ "ARECA ARC1120 PCI-X 8 PORTS SATA RAID CONTROLLER (RAID6-ENGINE Inside)\n %s",
+ ARCMSR_DRIVER_VERSION);
+ break;
case PCIDeviceIDARC1130:
- {
- sprintf(buf,
- "ARECA ARC1130 PCI-X 12 PORTS SATA RAID CONTROLLER (RAID6-ENGINE Inside)\n %s",
- ARCMSR_DRIVER_VERSION);
- break;
- }
+ sprintf(buf,
+ "ARECA ARC1130 PCI-X 12 PORTS SATA RAID CONTROLLER (RAID6-ENGINE Inside)\n %s",
+ ARCMSR_DRIVER_VERSION);
+ break;
case PCIDeviceIDARC1160:
- {
- sprintf(buf,
- "ARECA ARC1160 PCI-X 16 PORTS SATA RAID CONTROLLER (RAID6-ENGINE Inside)\n %s",
- ARCMSR_DRIVER_VERSION);
- break;
- }
+ sprintf(buf,
+ "ARECA ARC1160 PCI-X 16 PORTS SATA RAID CONTROLLER (RAID6-ENGINE Inside)\n %s",
+ ARCMSR_DRIVER_VERSION);
+ break;
case PCIDeviceIDARC1170:
- {
- sprintf(buf,
- "ARECA ARC1170 PCI-X 24 PORTS SATA RAID CONTROLLER (RAID6-ENGINE Inside)\n %s",
- ARCMSR_DRIVER_VERSION);
- break;
- }
+ sprintf(buf,
+ "ARECA ARC1170 PCI-X 24 PORTS SATA RAID CONTROLLER (RAID6-ENGINE Inside)\n %s",
+ ARCMSR_DRIVER_VERSION);
+ break;
case PCIDeviceIDARC1210:
- {
- sprintf(buf,
- "ARECA ARC1210 PCI-EXPRESS 4 PORTS SATA RAID CONTROLLER\n %s",
- ARCMSR_DRIVER_VERSION);
- break;
- }
+ sprintf(buf,
+ "ARECA ARC1210 PCI-EXPRESS 4 PORTS SATA RAID CONTROLLER\n %s",
+ ARCMSR_DRIVER_VERSION);
+ break;
case PCIDeviceIDARC1220:
- {
- sprintf(buf,
- "ARECA ARC1220 PCI-EXPRESS 8 PORTS SATA RAID CONTROLLER (RAID6-ENGINE Inside)\n %s",
- ARCMSR_DRIVER_VERSION);
- break;
- }
+ sprintf(buf,
+ "ARECA ARC1220 PCI-EXPRESS 8 PORTS SATA RAID CONTROLLER (RAID6-ENGINE Inside)\n %s",
+ ARCMSR_DRIVER_VERSION);
+ break;
case PCIDeviceIDARC1230:
- {
- sprintf(buf,
- "ARECA ARC1230 PCI-EXPRESS 12 PORTS SATA RAID CONTROLLER (RAID6-ENGINE Inside)\n %s",
- ARCMSR_DRIVER_VERSION);
- break;
- }
+ sprintf(buf,
+ "ARECA ARC1230 PCI-EXPRESS 12 PORTS SATA RAID CONTROLLER (RAID6-ENGINE Inside)\n %s",
+ ARCMSR_DRIVER_VERSION);
+ break;
case PCIDeviceIDARC1260:
- {
- sprintf(buf,
- "ARECA ARC1260 PCI-EXPRESS 16 PORTS SATA RAID CONTROLLER (RAID6-ENGINE Inside)\n %s",
- ARCMSR_DRIVER_VERSION);
- break;
- }
+ sprintf(buf,
+ "ARECA ARC1260 PCI-EXPRESS 16 PORTS SATA RAID CONTROLLER (RAID6-ENGINE Inside)\n %s",
+ ARCMSR_DRIVER_VERSION);
+ break;
case PCIDeviceIDARC1270:
- {
- sprintf(buf,
- "ARECA ARC1270 PCI-EXPRESS 24 PORTS SATA RAID CONTROLLER (RAID6-ENGINE Inside)\n %s",
- ARCMSR_DRIVER_VERSION);
- break;
- }
+ sprintf(buf,
+ "ARECA ARC1270 PCI-EXPRESS 24 PORTS SATA RAID CONTROLLER (RAID6-ENGINE Inside)\n %s",
+ ARCMSR_DRIVER_VERSION);
+ break;
}
return buf;
}
@@ -2349,7 +2366,7 @@ static int arcmsr_initialize(struct ACB
pACB->acb_flags &= ~ACB_F_SCSISTOPADAPTER;
pACB->irq = pPCI_DEV->irq;
/*
- *******************************************************************************
+ ******************************************************************
** Allocate the PCCB memory
******************************************************
** Using large dma-coherent buffers
@@ -2396,7 +2413,8 @@ static int arcmsr_initialize(struct ACB
pACB->dma_coherent_handle = dma_coherent_handle;
memset(dma_coherent, 0,
ARCMSR_MAX_FREECCB_NUM * sizeof(struct CCB) + 0x20);
- if (((unsigned long)dma_coherent & 0x1F) != 0) { /*ccb address must 32 (0x20) boundary */
+ if (((unsigned long)dma_coherent & 0x1F) != 0) {
+ /* ccb address must 32 (0x20) boundary */
dma_coherent =
dma_coherent + (0x20 -
((unsigned long)dma_coherent & 0x1F));
@@ -2494,7 +2512,7 @@ static void arcmsr_pcidev_disattach(stru
("arcmsr%d pcidev disattach wait 'abort all outstanding command' timeout \n",
pACB->adapter_index);
}
- /*clear all outbound posted Q */
+ /* clear all outbound posted Q */
for (i = 0; i < ARCMSR_MAX_OUTSTANDING_CMD; i++) {
readl(&pACB->pmu->outbound_queueport);
}
@@ -2511,7 +2529,8 @@ static void arcmsr_pcidev_disattach(stru
writel(intmask_org & mask, &pACB->pmu->outbound_intmask);
atomic_set(&pACB->ccboutstandingcount, 0);
}
- if (atomic_read(&pACB->ccbwait2gocount) != 0) { /*remove first wait2go ccb and abort it */
+ if (atomic_read(&pACB->ccbwait2gocount) != 0) {
+ /* remove first wait2go ccb and abort it */
for (i = 0; i < ARCMSR_MAX_OUTSTANDING_CMD; i++) {
pCCB = pACB->pccbwait2go[i];
if (pCCB) {
@@ -2544,9 +2563,9 @@ static int arcmsr_halt_notify(struct not
int i;

if ((event != SYS_RESTART) && (event != SYS_HALT)
- && (event != SYS_POWER_OFF)) {
+ && (event != SYS_POWER_OFF))
return NOTIFY_DONE;
- }
+
for (i = 0; i < ARCMSR_MAX_ADAPTER; i++) {
pACB = pHCBARC->pACB[i];
if (!pACB)
@@ -2631,7 +2650,7 @@ static int arcmsr_release(struct Scsi_Ho
/* Issue a blocking(interrupts disabled) command to the card */
arcmsr_pcidev_disattach(pACB);
scsi_unregister(host);
- /*if this is last pACB */
+ /* if this is last pACB */
for (i = 0; i < ARCMSR_MAX_ADAPTER; i++) {
if (pHCBARC->pACB[i])
return 0; /* this is not last adapter's release */

2006-01-02 17:04:49

by Matthew Wilcox

[permalink] [raw]
Subject: Re: [PATCH 2/2] Areca RAID driver (arcmsr) cleanups

On Fri, Dec 30, 2005 at 09:21:58PM -0800, Randy.Dunlap wrote:
> /*
> -**********************************************************************************
> -**********************************************************************************
> +***************************************************************************
> +***************************************************************************
> */

I'd be inclined to remove these useless comment blocks altogether ...

> - /* allocate scsi host information (includes out adapter) scsi_host_alloc==scsi_register */
> + /* allocate scsi host information (includes our adapter)
> + * scsi_host_alloc==scsi_register */
> if ((host =
> scsi_host_alloc(&arcmsr_scsi_host_template,
> sizeof(struct ACB))) == 0) {

host = scsi_host_alloc(...)
if (!host) { ...

> ************************************************************
> - ** We do not allow muti ioctls to the driver at the same duration.
> + ** We do not allow multi ioctls to the driver at the same duration.

s/duration/time/. And how do they prevent that?

2006-01-04 09:19:11

by Andrew Morton

[permalink] [raw]
Subject: Re: ETA for Areca RAID driver (arcmsr) in mainline?

"Randy.Dunlap" <[email protected]> wrote:
>
> Here's a start on some cleanups and a list of general issues.
> I'm not addressing SCSI or MM/DMA API issues, if there are any.
>
> 0. some Kconfig and Makefile cleanups
> 1. fix arcmsr_device_id_table[] inits;
> 2. fix return (value); -- don't use parenethese
> 3. fix one-line-ifs-with-braces -- remove braces
> 4. struct _XYZ & typedef XYZ, PXYZ -- convert to struct XYZ only
> 5. check NULL usage
> 6. no "return;" at end of func; -- removed
> 7. return -ENXIO instead of ENXIO;
>
> Patch for above items is below.
>
> More issues, not yet patched:
>
> 8. check sparse warnings, stack usage, init/exit sections;
> 9. don't use // comments;
> 10. use printk levels
> 11. pPCI_DEV: bad naming (throughout driver; don't use mixed case)
> 12. some comments are unreadable (non-ASCII ?)
> 13. uintNN_t int types: use kernel types except for userspace interfaces
> 14. use kernel-doc
> 15. try to fit source files into 80 columns

Unfortunately I've gone and applied a huge driver update from Erich, so
none of this applies any more.

A recut would be appreciated. Please include your additional suggestions:

16. Tab size in Linux kernel is 8 (not less).
17. Don't put changelog comments in source files. That's what
SCMs are for (source code manager tools).
18. Put arcmsr.txt in Documentation/scsi/, not in scsi/arcmsr/.
19. Maybe use sysfs (/sys) instead of /proc.

In the updated changelog, thanks.

2006-01-07 05:18:05

by Randy Dunlap

[permalink] [raw]
Subject: [PATCH] Areca RAID driver (arcmsr) cleanups


> Unfortunately I've gone and applied a huge driver update from Erich, so
> none of this applies any more.
>
> A recut would be appreciated. Please include your additional suggestions:
> In the updated changelog, thanks.

The recut is huge -- too large to mail (> 260 KB).

http://www.xenotime.net/linux/patches/arcmsr-rollup.patch

---
~Randy