Skip to contentSkip to conversation

more STAGING patches for 2.6.28

PATCH New Greg KH 3 participants 49 messages Oct 22, 2008 – Oct 23, 2008

Subsystems (2)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 more STAGING patches for 2.6.28

Here are some more staging patches against your 2.6 git tree.

These should fix up all of the known build warnings, so that I don't get a bunch of patches that do the same thing from different people, as well as a lot of other cleanups and 2 more new drivers.

Please pull from:
master.kernel.org:/pub/scm/linux/kernel/git/gregkh/staging-2.6.git/

These have all been in the past few -next releases with no known build errors.

Patches will be sent as a follow-on to this message to lkml for people to see.

thanks,

greg k-h

 drivers/staging/Kconfig                   |    4 +
 drivers/staging/Makefile                  |    2 +
 drivers/staging/at76_usb/at76_usb.c       |    4 +-
 drivers/staging/echo/bit_operations.h     |  205 ++---
 drivers/staging/echo/echo.c               |  847 +++++++++---------
 drivers/staging/echo/echo.h               |   58 +--
 drivers/staging/echo/fir.h                |  376 +++-----
 drivers/staging/echo/mmx.h                |   29 +-
 drivers/staging/echo/oslec.h              |   86 ++
 drivers/staging/et131x/et1310_phy.c       |    2 -
 drivers/staging/et131x/et131x_debug.c     |    1 -
 drivers/staging/et131x/et131x_initpci.c   |    1 -
 drivers/staging/go7007/go7007-driver.c    |    1 -
 drivers/staging/go7007/go7007-fw.c        |    1 -
 drivers/staging/go7007/go7007-i2c.c       |    1 -
 drivers/staging/go7007/go7007-usb.c       |    1 -
 drivers/staging/go7007/snd-go7007.c       |    1 -
 drivers/staging/go7007/wis-ov7640.c       |    1 -
 drivers/staging/go7007/wis-saa7113.c      |    1 -
 drivers/staging/go7007/wis-saa7115.c      |    1 -
 drivers/staging/go7007/wis-sony-tuner.c   |    1 -
 drivers/staging/go7007/wis-tw2804.c       |    1 -
 drivers/staging/go7007/wis-tw9903.c       |    1 -
 drivers/staging/go7007/wis-uda1342.c      |    1 -
 drivers/staging/me4000/me4000.c           |  908 +++++++++----------
 drivers/staging/me4000/me4000.h           |  194 +++--
 drivers/staging/pcc-acpi/Kconfig          |   11 +
 drivers/staging/pcc-acpi/Makefile         |    1 +
 drivers/staging/pcc-acpi/TODO             |    7 +
 drivers/staging/pcc-acpi/pcc-acpi.c       | 1111 ++++++++++++++++++++++
 drivers/staging/poch/Kconfig              |    6 +
 drivers/staging/poch/Makefile             |    1 +
 drivers/staging/poch/README               |    7 +
 drivers/staging/poch/poch.c               | 1425 +++++++++++++++++++++++++++++
 drivers/staging/poch/poch.h               |   29 +
 drivers/staging/slicoss/slicoss.c         |   18 +-
 drivers/staging/sxg/README                |    1 +
 drivers/staging/sxg/sxg.c                 | 1379 ++++++++++++++--------------
 drivers/staging/sxg/sxg_os.h              |   41 +-
 drivers/staging/sxg/sxgdbg.h              |    2 +-
 drivers/staging/sxg/sxghif.h              |  410 ++++-----
 drivers/staging/sxg/sxghw.h               |  404 ++++----
 drivers/staging/sxg/sxgphycode.h          |   12 +-
 drivers/staging/usbip/usbip_common.c      |    2 +-
 drivers/staging/usbip/vhci_rx.c           |    2 +-
 drivers/staging/winbond/Kconfig           |    2 +-
 drivers/staging/winbond/README            |    1 +
 drivers/staging/winbond/bss_f.h           |    6 +-
 drivers/staging/winbond/ds_tkip.h         |    6 +-
 drivers/staging/winbond/linux/common.h    |   17 +-
 drivers/staging/winbond/linux/wb35reg.c   |   63 +-
 drivers/staging/winbond/linux/wb35reg_f.h |   12 +-
 drivers/staging/winbond/linux/wb35reg_s.h |    4 +-
 drivers/staging/winbond/linux/wb35rx.c    |  175 ++--
 drivers/staging/winbond/linux/wb35rx_s.h  |    2 +-
 drivers/staging/winbond/linux/wb35tx.c    |  138 ++--
 drivers/staging/winbond/linux/wb35tx_f.h  |    2 +-
 drivers/staging/winbond/linux/wbusb.c     |  259 +++---
 drivers/staging/winbond/mds.c             |   30 +-
 drivers/staging/winbond/mds_f.h           |    6 +-
 drivers/staging/winbond/mds_s.h           |    8 +-
 drivers/staging/winbond/mlme_s.h          |    4 +-
 drivers/staging/winbond/mlmetxrx.c        |    4 +-
 drivers/staging/winbond/mlmetxrx_f.h      |    4 +-
 drivers/staging/winbond/reg.c             |   24 +-
 drivers/staging/winbond/sme_api.c         |    1 +
 drivers/staging/winbond/sme_api.h         |    2 +-
 drivers/staging/winbond/wbhal.c           |   32 +-
 drivers/staging/winbond/wbhal_f.h         |   28 +-
 drivers/staging/winbond/wbhal_s.h         |    4 +-
 drivers/staging/winbond/wblinux.c         |  208 +++---
 drivers/staging/winbond/wblinux_s.h       |    4 +-
 drivers/staging/wlan-ng/Kconfig           |    2 +-
 drivers/staging/wlan-ng/hfa384x.h         |    2 +-
 drivers/staging/wlan-ng/p80211wep.c       |    1 -
 drivers/staging/wlan-ng/prism2mib.c       |    2 -
 drivers/staging/wlan-ng/wlan_compat.h     |    8 +-
 77 files changed, 5566 insertions(+), 3093 deletions(-)
 create mode 100644 drivers/staging/echo/oslec.h
 create mode 100644 drivers/staging/pcc-acpi/Kconfig
 create mode 100644 drivers/staging/pcc-acpi/Makefile
 create mode 100644 drivers/staging/pcc-acpi/TODO
 create mode 100644 drivers/staging/pcc-acpi/pcc-acpi.c
 create mode 100644 drivers/staging/poch/Kconfig
 create mode 100644 drivers/staging/poch/Makefile
 create mode 100644 drivers/staging/poch/README
 create mode 100644 drivers/staging/poch/poch.c
 create mode 100644 drivers/staging/poch/poch.h

---------------

Diego Calleja (1):
Staging: Fix leak in drivers/staging/at76_usb.c

Geert Uytterhoeven (1):
Staging: W35UND should depend on USB

Greg Kroah-Hartman (8):
Staging: document 4k stack problem for winbond driver
Staging: wlan-ng: fix build error if wireless networking is not enabled
Staging: pcc-acpi: update to latest version
Staging: sxg: fix up unused function warnings
Staging: sxg: fix compiler warnings.
Staging: wbusb: fix a bunch of compiler warnings
Staging: me4000: remove some compiler warnings
Staging: usbip: fix build warning on 64bit kernels

Harvey Harrison (2):
Staging: sxg: replace __FUNCTION__ with __func__
Staging: remove remaining uses of __FUNCTION__

Hiroshi Miura (1):
Staging: add pcc-acpi driver

Huang Weiyi (6):
Staging: SLICOSS: remove duplicated #include's
Staging: et131x: remove duplicated #include's
Staging: wlan-ng: prism2: remove duplicated #include
staging: wlan-ng: prism2: remove more duplicated #include
Staging: go7007: remove unused #include <version.h>
Staging: SLICOSS: remove unused #include <version.h>

J.R. Mauro (3):
Staging: Clean up sxg driver
Staging: Lindent the echo driver
Staging: sxg: clean up C99 comments

Lior Dotan (3):
Staging: Fixes for me4000 pci data collection driver
Staging: PCC-ACPI: Fix all checkpatch errors
Staging: SLICOSS: Free multicast list at driver exit

Mariusz Kozlowski (2):
staging: fix potential build error in slicoss driver
staging: balance parenthesis in wlan-ng headers

Pekka Enberg (8):
Staging: w35und: remove some typedefs
Staging: echo: fix kmalloc()/kfree() uses
Staging: echo: remove dead code
Staging: echo: remove __cplusplus macro magic
Staging: echo: remove annoying "end of function" markers
Staging: w35und: remove spinlock wrappers
Staging: w35und: use gotos for error handling
Staging: w35und: module init cleanup

Stephen Rothwell (1):
linux-next: build failure

Tzafrir Cohen (5):
Staging: echo: A separate oslec.h for external interface
Staging: echo: Export interface functions. Add module headers.
Staging: echo: Replace echo_can_state_t with struct echo_can_state
Staging: echo: Changed preffix from echo_can_ to oslec_
Staging: echo: Replace __BLACKFIN__ASM__ with __bfin__

Vijay Kumar (1):
Staging: add poch driver

#1 lore raw

PATCH 1/42 Staging: add pcc-acpi driver

From: Hiroshi Miura <[email protected]>

Adds the pcc-acpi driver to the staging tree.

From: Hiroshi Miura <[email protected]>

---
 drivers/staging/Kconfig             |    2 +
 drivers/staging/Makefile            |    1 +
 drivers/staging/pcc-acpi/Kconfig    |   11 +
 drivers/staging/pcc-acpi/Makefile   |    1 +
 drivers/staging/pcc-acpi/TODO       |    7 +
 drivers/staging/pcc-acpi/pcc-acpi.c |  974 +++++++++++++++++++++++++++++++++++
 6 files changed, 996 insertions(+), 0 deletions(-)
 create mode 100644 drivers/staging/pcc-acpi/Kconfig
 create mode 100644 drivers/staging/pcc-acpi/Makefile
 create mode 100644 drivers/staging/pcc-acpi/TODO
 create mode 100644 drivers/staging/pcc-acpi/pcc-acpi.c
drivers/staging/Kconfig +2 -0
index 2a79dec..65a86b7 100644
@@ -43,4 +43,6 @@ source "drivers/staging/echo/Kconfig"
 
 source "drivers/staging/at76_usb/Kconfig"
 
+source "drivers/staging/pcc-acpi/Kconfig"
+
 endif # STAGING
drivers/staging/Makefile +1 -0
index 325bca4..e5c4a38 100644
@@ -13,3 +13,4 @@ obj-$(CONFIG_W35UND)		+= winbond/
 obj-$(CONFIG_PRISM2_USB)	+= wlan-ng/
 obj-$(CONFIG_ECHO)		+= echo/
 obj-$(CONFIG_USB_ATMEL)		+= at76_usb/
+obj-$(CONFIG_PCC_ACPI)		+= pcc-acpi/
drivers/staging/pcc-acpi/Kconfig new file +11 -0
new file mode 100644
index 0000000..6720d40
@@ -0,0 +1,11 @@
+config PCC_ACPI
+	tristate "Panasonic ACPI Hotkey support"
+	depends on ACPI
+	default n
+	---help---
+	  This driver provides support for Panasonic hotkeys through the
+	  ACPI interface.  This works for the Panasonic R1 (N variant),
+	  R2, R3, T2, W2, and Y2 laptops.
+
+	  To compile this driver as a module, choose M here. The module
+	  will be called pcc-acpi.
drivers/staging/pcc-acpi/Makefile new file +1 -0
new file mode 100644
index 0000000..f93b29e
@@ -0,0 +1 @@
+obj-$(CONFIG_PCC_ACPI)		+= pcc-acpi.o
drivers/staging/pcc-acpi/TODO new file +7 -0
new file mode 100644
index 0000000..fab2409
@@ -0,0 +1,7 @@
+TODO:
+	- Lindent fixes
+	- checkpatch.pl fixes
+	- verify that the acpi interface is correct
+	- remove /proc dependancy if needed (not sure yet.)
+
+Please send any patches for this driver to Greg Kroah-Hartman <[email protected]>
drivers/staging/pcc-acpi/pcc-acpi.c new file +974 -0

974 lines not on this page · raw message

Signature · 1 line
1.6.0.2
reviewer NAK
#2 lore raw

Re: [PATCH 01/42] Staging: add pcc-acpi driver

NAK.
this was already relplaced by the panasonic driver in the acpi tree.

Greg,
If it has the word "acpi" in it, please check with me before putting something in the staging tree, for I'd prefer to stage such things in the acpi tree.

thanks,
-Len

Quoted 19 lines · Greg Kroah-Hartman

From: Hiroshi Miura <[email protected]>

Adds the pcc-acpi driver to the staging tree.

From: Hiroshi Miura <[email protected]>

---
 drivers/staging/Kconfig             |    2 +
 drivers/staging/Makefile            |    1 +
 drivers/staging/pcc-acpi/Kconfig    |   11 +
 drivers/staging/pcc-acpi/Makefile   |    1 +
 drivers/staging/pcc-acpi/TODO       |    7 +
 drivers/staging/pcc-acpi/pcc-acpi.c |  974 +++++++++++++++++++++++++++++++++++
 6 files changed, 996 insertions(+), 0 deletions(-)
 create mode 100644 drivers/staging/pcc-acpi/Kconfig
 create mode 100644 drivers/staging/pcc-acpi/Makefile
 create mode 100644 drivers/staging/pcc-acpi/TODO
 create mode 100644 drivers/staging/pcc-acpi/pcc-acpi.c
#3 lore raw

Re: [PATCH 01/42] Staging: add pcc-acpi driver

Quoted 2 lines · Len Brown

NAK.
this was already relplaced by the panasonic driver in the acpi tree.

Is this in 2.6.27, or was it a 2.6.28 addition? For some reason, I had reports from openSUSE users that 2.6.27 still didn't work properly and needed this driver.

How about the new "pcc-acpi-cdrom" driver hack? Hiroshi, is that needed still with the 2.6.27 kernel?

Quoted 4 lines

Greg,
If it has the word "acpi" in it, please check with me before putting something in the staging tree, for I'd prefer to stage such things in the acpi tree.

Ok, I didn't know you wanted "uncleaned" drivers in your tree, I'll remember this for the future :)

thanks,

greg k-h

reviewer
#4 lore raw

Re: [PATCH 01/42] Staging: add pcc-acpi driver

Quoted 10 lines · Greg KH
Quoted 2 lines · Len Brown

NAK.
this was already relplaced by the panasonic driver in the acpi tree.

Is this in 2.6.27, or was it a 2.6.28 addition? For some reason, I had reports from openSUSE users that 2.6.27 still didn't work properly and needed this driver.

How about the new "pcc-acpi-cdrom" driver hack? Hiroshi, is that needed still with the 2.6.27 kernel?

drivers/misc/panasonic-laptop.c is staged for 2.6.28:

http://git.kernel.org/?p=linux/kernel/git/lenb/linux-acpi-2.6.git;a=history;f=drivers/misc/panasonic-laptop.c;h=a2cb598d8ab54a98000d1f31f7c2407924399a5e;hb=test

Quoted 7 lines
Quoted 4 lines

Greg,
If it has the word "acpi" in it, please check with me before putting something in the staging tree, for I'd prefer to stage such things in the acpi tree.

Ok, I didn't know you wanted "uncleaned" drivers in your tree, I'll remember this for the future :)

AFAICK, the driver that was checked into staging tree was based on an older version of the driver already staged in the acpi tree. I think that the staging tree isn't helping us in this scenario.

thanks,
-Len

#5 lore raw

Re: [PATCH 01/42] Staging: add pcc-acpi driver

Quoted 12 lines · Len Brown
Quoted 8 lines · Greg KH
Quoted 2 lines · Len Brown

NAK.
this was already relplaced by the panasonic driver in the acpi tree.

Is this in 2.6.27, or was it a 2.6.28 addition? For some reason, I had reports from openSUSE users that 2.6.27 still didn't work properly and needed this driver.

Quoted 6 lines
Quoted 2 lines

How about the new "pcc-acpi-cdrom" driver hack? Hiroshi, is that needed still with the 2.6.27 kernel?

drivers/misc/panasonic-laptop.c is staged for 2.6.28:

http://git.kernel.org/?p=linux/kernel/git/lenb/linux-acpi-2.6.git;a=history;f=drivers/misc/panasonic-laptop.c;h=a2cb598d8ab54a98000d1f31f7c2407924399a5e;hb=test

Hm, we didn't get the acpi merge with Linus yet for .28? No wonder I missed this, sorry about it.

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

Greg,
If it has the word "acpi" in it, please check with me before putting something in the staging tree, for I'd prefer to stage such things in the acpi tree.

Quoted 7 lines
Quoted 2 lines

Ok, I didn't know you wanted "uncleaned" drivers in your tree, I'll remember this for the future :)

AFAICK, the driver that was checked into staging tree was based on an older version of the driver already staged in the acpi tree. I think that the staging tree isn't helping us in this scenario.

Fair enough, I'll drop it from my tree, thanks for paying attention and letting me know.

greg k-h

reviewer
#6 lore raw

PATCH 1/1 delete pcc_acpi

In reply to Len Brown

Hi Linus,

please pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git release

this old driver errantly went upstream with the staging stuff, but should not have.

This will update the files shown below.

thanks!

-Len

ps. individual patches are available on [email protected]
and a consolidated plain patch is available here:
ftp://ftp.kernel.org/pub/linux/kernel/people/lenb/acpi/patches/release/2.6.27/acpi-release-20080926-2.6.27.diff.gz

 drivers/staging/Kconfig             |    2 -
 drivers/staging/Makefile            |    1 -
 drivers/staging/pcc-acpi/Kconfig    |   11 -
 drivers/staging/pcc-acpi/Makefile   |    1 -
 drivers/staging/pcc-acpi/TODO       |    7 -
 drivers/staging/pcc-acpi/pcc-acpi.c | 1111 -----------------------------------
 6 files changed, 0 insertions(+), 1133 deletions(-)
 delete mode 100644 drivers/staging/pcc-acpi/Kconfig
 delete mode 100644 drivers/staging/pcc-acpi/Makefile
 delete mode 100644 drivers/staging/pcc-acpi/TODO
 delete mode 100644 drivers/staging/pcc-acpi/pcc-acpi.c

through these commits:

Len Brown (1):
staging: pcc_acpi: delete obsolete driver

with this log:

commit 0d64cf8eba6de467f56bc43c4d8e28b0e3e335c5

Author: Len Brown <[email protected]>
Date:   Thu Oct 23 15:14:52 2008 -0400

staging: pcc_acpi: delete obsolete driver

pcc_acpi is based on an old version
of drivers/misc/panasonic-laptop.c

#7 lore raw

Re: [GIT PATCH] delete pcc_acpi

Quoted 10 lines · Len Brown

Hi Linus,

please pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git release

this old driver errantly went upstream with the staging stuff, but should not have.

This will update the files shown below.

I ack this pull, thanks, I didn't see this driver already in Len's tree when I added it to the staging tree, my apologies.

thanks,

greg k-h

#8 lore raw

PATCH 2/42 Staging: W35UND should depend on USB

In reply to Greg KH

From: Geert Uytterhoeven <[email protected]>

W35UND should depend on USB

---
 drivers/staging/winbond/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/winbond/Kconfig +1 -1
index 10d72be..425219e 100644
@@ -1,6 +1,6 @@
 config W35UND
 	tristate "Winbond driver"
-	depends on MAC80211 && WLAN_80211 && EXPERIMENTAL && !4KSTACKS
+	depends on MAC80211 && WLAN_80211 && USB && EXPERIMENTAL && !4KSTACKS
 	default n
 	---help---
 	  This is highly experimental driver for winbond wifi card on some Kohjinsha notebooks
Signature · 1 line
1.6.0.2
#9 lore raw

PATCH 3/42 linux-next: build failure

In reply to Greg KH

From: Stephen Rothwell <[email protected]>

sxghif.h has code that explicitly will not build fo other architecures.

---
 drivers/staging/sxg/README |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/staging/sxg/README +1 -0
index 4d1ddbe..d514d18 100644
@@ -7,6 +7,7 @@ TODO:
 	- remove wrappers
 	- checkpatch.pl cleanups
 	- new functionality that the card needs
+	- remove reliance on x86
 
 Please send patches to:
         Greg Kroah-Hartman <[email protected]>
Signature · 1 line
1.6.0.2
#10 lore raw

PATCH 4/42 Staging: document 4k stack problem for winbond driver

In reply to Greg KH

As noticed by Arjan

Cc Arjan van de Ven <[email protected]>
Cc Pavel Machek <[email protected]>
---
 drivers/staging/winbond/README |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/staging/winbond/README +1 -0
index 707b6b3..cb944e4 100644
@@ -5,6 +5,7 @@ TODO:
 	- remove typedefs
 	- remove unused ioctls
 	- use cfg80211 for regulatory stuff
+	- fix 4k stack problems
 
 Please send patches to Greg Kroah-Hartman <[email protected]> and
 Pavel Machek <[email protected]>
Signature · 1 line
1.6.0.2
#11 lore raw

PATCH 5/42 Staging: Fix leak in drivers/staging/at76_usb.c

In reply to Greg KH

From: Diego Calleja <[email protected]>

Fix leak in at76_usb as reported in:
http://bugzilla.kernel.org/show_bug.cgi?id=11778

---
 drivers/staging/at76_usb/at76_usb.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/staging/at76_usb/at76_usb.c +3 -1
index 52df0c6..174e2be 100644
@@ -2319,9 +2319,11 @@ static int at76_iw_handler_get_scan(struct net_device *netdev,
 	if (!iwe)
 		return -ENOMEM;
 
-	if (priv->scan_state != SCAN_COMPLETED)
+	if (priv->scan_state != SCAN_COMPLETED) {
 		/* scan not yet finished */
+		kfree(iwe);
 		return -EAGAIN;
+	}
 
 	spin_lock_irqsave(&priv->bss_list_spinlock, flags);
 
Signature · 1 line
1.6.0.2
#12 lore raw

PATCH 6/42 staging: fix potential build error in slicoss driver

In reply to Greg KH

From: Mariusz Kozlowski <[email protected]>

This hides under DEBUG_REGISTER_TRACE so probably
not visible to many people.

---
 drivers/staging/slicoss/slicoss.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/staging/slicoss/slicoss.c +0 -1
index b61ac4b..47b0ae1 100644
@@ -275,7 +275,6 @@ static void slic_dbg_register_trace(struct adapter *adapter,
 			  card->reg_value[i], card->reg_valueh[i]);
 	}
 }
-}
 #endif
 
 static void slic_init_adapter(struct net_device *netdev,
Signature · 1 line
1.6.0.2
#13 lore raw

PATCH 7/42 staging: balance parenthesis in wlan-ng headers

In reply to Greg KH

From: Mariusz Kozlowski <[email protected]>

Balance parenthesis in HFA384x_CMD_QOS_GET macro.

---
 drivers/staging/wlan-ng/hfa384x.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/wlan-ng/hfa384x.h +1 -1
index a205463..0dfb8ce 100644
@@ -824,7 +824,7 @@ PD Record codes
 #define		HFA384x_CMD_MACPORT_SET(value)		((UINT16)HFA384x_CMD_AINFO_SET(value))
 #define		HFA384x_CMD_ISRECL(value)		((UINT16)(HFA384x_CMD_AINFO_GET((UINT16)(value) & HFA384x_CMD_RECL)))
 #define		HFA384x_CMD_RECL_SET(value)		((UINT16)HFA384x_CMD_AINFO_SET(value))
-#define		HFA384x_CMD_QOS_GET(value)		((UINT16((((UINT16)(value))&((UINT16)0x3000)) >> 12))
+#define		HFA384x_CMD_QOS_GET(value)		((UINT16)((((UINT16)(value))&((UINT16)0x3000)) >> 12))
 #define		HFA384x_CMD_QOS_SET(value)		((UINT16)((((UINT16)(value)) << 12) & 0x3000))
 #define		HFA384x_CMD_ISWRITE(value)		((UINT16)(HFA384x_CMD_AINFO_GET((UINT16)(value) & HFA384x_CMD_WRITE)))
 #define		HFA384x_CMD_WRITE_SET(value)		((UINT16)HFA384x_CMD_AINFO_SET((UINT16)value))
Signature · 1 line
1.6.0.2
#14 lore raw

PATCH 8/42 Staging: Fixes for me4000 pci data collection driver

In reply to Greg KH

From: Lior Dotan <[email protected]>

Following Andrew Morton's review for this patch I made a patch that fixes most of the remarks.
I've converted the sleep_on_timeout to wait_event_timeout but I probably not in the right way.
Also I don't know what's the problem with the calls for get_user() so I left them untouched.

---
 drivers/staging/me4000/me4000.c |  896 +++++++++++++++++++--------------------
 drivers/staging/me4000/me4000.h |  194 +++++----
 2 files changed, 545 insertions(+), 545 deletions(-)
drivers/staging/me4000/me4000.c +442 -454
index 862dd7f..75c268c 100644
@@ -25,24 +25,21 @@
 #include <linux/sched.h>
 #include <linux/interrupt.h>
 #include <linux/pci.h>
-#include <asm/io.h>
-#include <asm/system.h>
-#include <asm/uaccess.h>
 #include <linux/errno.h>
 #include <linux/delay.h>
-#include <linux/fs.h>
 #include <linux/mm.h>
 #include <linux/unistd.h>
 #include <linux/list.h>
 #include <linux/proc_fs.h>
-
+#include <linux/types.h>
 #include <linux/poll.h>
 #include <linux/vmalloc.h>
+#include <linux/slab.h>
 #include <asm/pgtable.h>
 #include <asm/uaccess.h>
-#include <linux/types.h>
-
-#include <linux/slab.h>
+#include <asm/io.h>
+#include <asm/system.h>
+#include <asm/uaccess.h>
 
 /* Include-File for the Meilhaus ME-4000 I/O board */
 #include "me4000.h"
@@ -57,14 +54,14 @@ MODULE_SUPPORTED_DEVICE("Meilhaus ME-4000 Multi I/O boards");
 MODULE_LICENSE("GPL");
 
 /* Board specific data are kept in a global list */
-LIST_HEAD(me4000_board_info_list);
+static LIST_HEAD(me4000_board_info_list);
 
 /* Major Device Numbers. 0 means to get it automatically from the System */
-static int me4000_ao_major_driver_no = 0;
-static int me4000_ai_major_driver_no = 0;
-static int me4000_dio_major_driver_no = 0;
-static int me4000_cnt_major_driver_no = 0;
-static int me4000_ext_int_major_driver_no = 0;
+static int me4000_ao_major_driver_no;
+static int me4000_ai_major_driver_no;
+static int me4000_dio_major_driver_no;
+static int me4000_cnt_major_driver_no;
+static int me4000_ext_int_major_driver_no;
 
 /* Let the user specify a custom major driver number */
 module_param(me4000_ao_major_driver_no, int, 0);
@@ -88,36 +85,22 @@ MODULE_PARM_DESC(me4000_ext_int_major_driver_no,
 		 "Major driver number for external interrupt (default 0)");
 
 /*-----------------------------------------------------------------------------
-  Module stuff
-  ---------------------------------------------------------------------------*/
-int init_module(void);
-void cleanup_module(void);
-
-/*-----------------------------------------------------------------------------
   Board detection and initialization
   ---------------------------------------------------------------------------*/
 static int me4000_probe(struct pci_dev *dev, const struct pci_device_id *id);
-static int me4000_xilinx_download(me4000_info_t *);
-static int me4000_reset_board(me4000_info_t *);
+static int me4000_xilinx_download(struct me4000_info *);
+static int me4000_reset_board(struct me4000_info *);
 
 static void clear_board_info_list(void);
-static int get_registers(struct pci_dev *dev, me4000_info_t * info);
-static int init_board_info(struct pci_dev *dev, me4000_info_t * board_info);
-static int alloc_ao_contexts(me4000_info_t * info);
-static void release_ao_contexts(me4000_info_t * board_info);
-static int alloc_ai_context(me4000_info_t * info);
-static int alloc_dio_context(me4000_info_t * info);
-static int alloc_cnt_context(me4000_info_t * info);
-static int alloc_ext_int_context(me4000_info_t * info);
-
+static void release_ao_contexts(struct me4000_info *board_info);
 /*-----------------------------------------------------------------------------
   Stuff used by all device parts
   ---------------------------------------------------------------------------*/
 static int me4000_open(struct inode *, struct file *);
 static int me4000_release(struct inode *, struct file *);
 
-static int me4000_get_user_info(me4000_user_info_t *,
-				me4000_info_t * board_info);
+static int me4000_get_user_info(struct me4000_user_info *,
+				struct me4000_info *board_info);
 static int me4000_read_procmem(char *, char **, off_t, int, int *, void *);
 
 /*-----------------------------------------------------------------------------
@@ -140,40 +123,42 @@ static int me4000_ao_ioctl_cont(struct inode *, struct file *, unsigned int,
 static unsigned int me4000_ao_poll_cont(struct file *, poll_table *);
 static int me4000_ao_fsync_cont(struct file *, struct dentry *, int);
 
-static int me4000_ao_start(unsigned long *, me4000_ao_context_t *);
-static int me4000_ao_stop(me4000_ao_context_t *);
-static int me4000_ao_immediate_stop(me4000_ao_context_t *);
-static int me4000_ao_timer_set_divisor(u32 *, me4000_ao_context_t *);
-static int me4000_ao_preload(me4000_ao_context_t *);
-static int me4000_ao_preload_update(me4000_ao_context_t *);
-static int me4000_ao_ex_trig_set_edge(int *, me4000_ao_context_t *);
-static int me4000_ao_ex_trig_enable(me4000_ao_context_t *);
-static int me4000_ao_ex_trig_disable(me4000_ao_context_t *);
-static int me4000_ao_prepare(me4000_ao_context_t * ao_info);
-static int me4000_ao_reset(me4000_ao_context_t * ao_info);
-static int me4000_ao_enable_do(me4000_ao_context_t *);
-static int me4000_ao_disable_do(me4000_ao_context_t *);
-static int me4000_ao_fsm_state(int *, me4000_ao_context_t *);
-
-static int me4000_ao_simultaneous_ex_trig(me4000_ao_context_t * ao_context);
-static int me4000_ao_simultaneous_sw(me4000_ao_context_t * ao_context);
-static int me4000_ao_simultaneous_disable(me4000_ao_context_t * ao_context);
-static int me4000_ao_simultaneous_update(me4000_ao_channel_list_t * channels,
-					 me4000_ao_context_t * ao_context);
-
-static int me4000_ao_synchronous_ex_trig(me4000_ao_context_t * ao_context);
-static int me4000_ao_synchronous_sw(me4000_ao_context_t * ao_context);
-static int me4000_ao_synchronous_disable(me4000_ao_context_t * ao_context);
+static int me4000_ao_start(unsigned long *, struct me4000_ao_context *);
+static int me4000_ao_stop(struct me4000_ao_context *);
+static int me4000_ao_immediate_stop(struct me4000_ao_context *);
+static int me4000_ao_timer_set_divisor(u32 *, struct me4000_ao_context *);
+static int me4000_ao_preload(struct me4000_ao_context *);
+static int me4000_ao_preload_update(struct me4000_ao_context *);
+static int me4000_ao_ex_trig_set_edge(int *, struct me4000_ao_context *);
+static int me4000_ao_ex_trig_enable(struct me4000_ao_context *);
+static int me4000_ao_ex_trig_disable(struct me4000_ao_context *);
+static int me4000_ao_prepare(struct me4000_ao_context *ao_info);
+static int me4000_ao_reset(struct me4000_ao_context *ao_info);
+static int me4000_ao_enable_do(struct me4000_ao_context *);
+static int me4000_ao_disable_do(struct me4000_ao_context *);
+static int me4000_ao_fsm_state(int *, struct me4000_ao_context *);
+
+static int me4000_ao_simultaneous_ex_trig(struct me4000_ao_context *ao_context);
+static int me4000_ao_simultaneous_sw(struct me4000_ao_context *ao_context);
+static int me4000_ao_simultaneous_disable(struct me4000_ao_context *ao_context);
+static int me4000_ao_simultaneous_update(
+					struct me4000_ao_channel_list *channels,
+					struct me4000_ao_context *ao_context);
+
+static int me4000_ao_synchronous_ex_trig(struct me4000_ao_context *ao_context);
+static int me4000_ao_synchronous_sw(struct me4000_ao_context *ao_context);
+static int me4000_ao_synchronous_disable(struct me4000_ao_context *ao_context);
 
 static int me4000_ao_ex_trig_timeout(unsigned long *arg,
-				     me4000_ao_context_t * ao_context);
+				     struct me4000_ao_context *ao_context);
 static int me4000_ao_get_free_buffer(unsigned long *arg,
-				     me4000_ao_context_t * ao_context);
+				     struct me4000_ao_context *ao_context);
 
 /*-----------------------------------------------------------------------------
   Analog input stuff
   ---------------------------------------------------------------------------*/
-static int me4000_ai_single(me4000_ai_single_t *, me4000_ai_context_t *);
+static int me4000_ai_single(struct me4000_ai_single *,
+				struct me4000_ai_context *);
 static int me4000_ai_ioctl_sing(struct inode *, struct file *, unsigned int,
 				unsigned long);
 
@@ -186,68 +171,69 @@ static int me4000_ai_fasync(int fd, struct file *file_p, int mode);
 static int me4000_ai_ioctl_ext(struct inode *, struct file *, unsigned int,
 			       unsigned long);
 
-static int me4000_ai_prepare(me4000_ai_context_t * ai_context);
-static int me4000_ai_reset(me4000_ai_context_t * ai_context);
-static int me4000_ai_config(me4000_ai_config_t *, me4000_ai_context_t *);
-static int me4000_ai_start(me4000_ai_context_t *);
-static int me4000_ai_start_ex(unsigned long *, me4000_ai_context_t *);
-static int me4000_ai_stop(me4000_ai_context_t *);
-static int me4000_ai_immediate_stop(me4000_ai_context_t *);
-static int me4000_ai_ex_trig_enable(me4000_ai_context_t *);
-static int me4000_ai_ex_trig_disable(me4000_ai_context_t *);
-static int me4000_ai_ex_trig_setup(me4000_ai_trigger_t *,
-				   me4000_ai_context_t *);
-static int me4000_ai_sc_setup(me4000_ai_sc_t * arg,
-			      me4000_ai_context_t * ai_context);
-static int me4000_ai_offset_enable(me4000_ai_context_t * ai_context);
-static int me4000_ai_offset_disable(me4000_ai_context_t * ai_context);
-static int me4000_ai_fullscale_enable(me4000_ai_context_t * ai_context);
-static int me4000_ai_fullscale_disable(me4000_ai_context_t * ai_context);
-static int me4000_ai_fsm_state(int *arg, me4000_ai_context_t * ai_context);
+static int me4000_ai_prepare(struct me4000_ai_context *ai_context);
+static int me4000_ai_reset(struct me4000_ai_context *ai_context);
+static int me4000_ai_config(struct me4000_ai_config *,
+				struct me4000_ai_context *);
+static int me4000_ai_start(struct me4000_ai_context *);
+static int me4000_ai_start_ex(unsigned long *, struct me4000_ai_context *);
+static int me4000_ai_stop(struct me4000_ai_context *);
+static int me4000_ai_immediate_stop(struct me4000_ai_context *);
+static int me4000_ai_ex_trig_enable(struct me4000_ai_context *);
+static int me4000_ai_ex_trig_disable(struct me4000_ai_context *);
+static int me4000_ai_ex_trig_setup(struct me4000_ai_trigger *,
+				   struct me4000_ai_context *);
+static int me4000_ai_sc_setup(struct me4000_ai_sc *arg,
+			      struct me4000_ai_context *ai_context);
+static int me4000_ai_offset_enable(struct me4000_ai_context *ai_context);
+static int me4000_ai_offset_disable(struct me4000_ai_context *ai_context);
+static int me4000_ai_fullscale_enable(struct me4000_ai_context *ai_context);
+static int me4000_ai_fullscale_disable(struct me4000_ai_context *ai_context);
+static int me4000_ai_fsm_state(int *arg, struct me4000_ai_context *ai_context);
 static int me4000_ai_get_count_buffer(unsigned long *arg,
-				      me4000_ai_context_t * ai_context);
+				      struct me4000_ai_context *ai_context);
 
 /*-----------------------------------------------------------------------------
   EEPROM stuff
   ---------------------------------------------------------------------------*/
-static int me4000_eeprom_read(me4000_eeprom_t * arg,
-			      me4000_ai_context_t * ai_context);
-static int me4000_eeprom_write(me4000_eeprom_t * arg,
-			       me4000_ai_context_t * ai_context);
-static unsigned short eeprom_read_cmd(me4000_ai_context_t * ai_context,
-				      unsigned long cmd, int length);
-static int eeprom_write_cmd(me4000_ai_context_t * ai_context, unsigned long cmd,
-			    int length);
+static int me4000_eeprom_read(struct me4000_eeprom *arg,
+			      struct me4000_ai_context *ai_context);
+static int me4000_eeprom_write(struct me4000_eeprom *arg,
+			       struct me4000_ai_context *ai_context);
 
 /*-----------------------------------------------------------------------------
   Digital I/O stuff
   ---------------------------------------------------------------------------*/
 static int me4000_dio_ioctl(struct inode *, struct file *, unsigned int,
 			    unsigned long);
-static int me4000_dio_config(me4000_dio_config_t *, me4000_dio_context_t *);
-static int me4000_dio_get_byte(me4000_dio_byte_t *, me4000_dio_context_t *);
-static int me4000_dio_set_byte(me4000_dio_byte_t *, me4000_dio_context_t *);
-static int me4000_dio_reset(me4000_dio_context_t *);
+static int me4000_dio_config(struct me4000_dio_config *,
+				struct me4000_dio_context *);
+static int me4000_dio_get_byte(struct me4000_dio_byte *,
+				struct me4000_dio_context *);
+static int me4000_dio_set_byte(struct me4000_dio_byte *,
+				struct me4000_dio_context *);
+static int me4000_dio_reset(struct me4000_dio_context *);
 
 /*-----------------------------------------------------------------------------
   Counter stuff
   ---------------------------------------------------------------------------*/
 static int me4000_cnt_ioctl(struct inode *, struct file *, unsigned int,
 			    unsigned long);
-static int me4000_cnt_config(me4000_cnt_config_t *, me4000_cnt_context_t *);
-static int me4000_cnt_read(me4000_cnt_t *, me4000_cnt_context_t *);
-static int me4000_cnt_write(me4000_cnt_t *, me4000_cnt_context_t *);
-static int me4000_cnt_reset(me4000_cnt_context_t *);
+static int me4000_cnt_config(struct me4000_cnt_config *,
+				struct me4000_cnt_context *);
+static int me4000_cnt_read(struct me4000_cnt *, struct me4000_cnt_context *);
+static int me4000_cnt_write(struct me4000_cnt *, struct me4000_cnt_context *);
+static int me4000_cnt_reset(struct me4000_cnt_context *);
 
 /*-----------------------------------------------------------------------------
   External interrupt routines
   ---------------------------------------------------------------------------*/
 static int me4000_ext_int_ioctl(struct inode *, struct file *, unsigned int,
 				unsigned long);
-static int me4000_ext_int_enable(me4000_ext_int_context_t *);
-static int me4000_ext_int_disable(me4000_ext_int_context_t *);
+static int me4000_ext_int_enable(struct me4000_ext_int_context *);
+static int me4000_ext_int_disable(struct me4000_ext_int_context *);
 static int me4000_ext_int_count(unsigned long *arg,
-				me4000_ext_int_context_t * ext_int_context);
+				struct me4000_ext_int_context *ext_int_context);
 static int me4000_ext_int_fasync(int fd, struct file *file_ptr, int mode);
 
 /*-----------------------------------------------------------------------------
@@ -260,27 +246,18 @@ static irqreturn_t me4000_ext_int_isr(int, void *);
 /*-----------------------------------------------------------------------------
   Inline functions
   ---------------------------------------------------------------------------*/
-static int inline me4000_buf_count(me4000_circ_buf_t, int);
-static int inline me4000_buf_space(me4000_circ_buf_t, int);
-static int inline me4000_space_to_end(me4000_circ_buf_t, int);
-static int inline me4000_values_to_end(me4000_circ_buf_t, int);
-
-static void inline me4000_outb(unsigned char value, unsigned long port);
-static void inline me4000_outl(unsigned long value, unsigned long port);
-static unsigned long inline me4000_inl(unsigned long port);
-static unsigned char inline me4000_inb(unsigned long port);
 
-static int me4000_buf_count(me4000_circ_buf_t buf, int size)
+static int inline me4000_buf_count(struct me4000_circ_buf buf, int size)
 {
 	return ((buf.head - buf.tail) & (size - 1));
 }
 
-static int me4000_buf_space(me4000_circ_buf_t buf, int size)
+static int inline me4000_buf_space(struct me4000_circ_buf buf, int size)
 {
 	return ((buf.tail - (buf.head + 1)) & (size - 1));
 }
 
-static int me4000_values_to_end(me4000_circ_buf_t buf, int size)
+static int inline me4000_values_to_end(struct me4000_circ_buf buf, int size)
 {
 	int end;
 	int n;
@@ -289,7 +266,7 @@ static int me4000_values_to_end(me4000_circ_buf_t buf, int size)
 	return (n < end) ? n : end;
 }
 
-static int me4000_space_to_end(me4000_circ_buf_t buf, int size)
+static int inline me4000_space_to_end(struct me4000_circ_buf buf, int size)
 {
 	int end;
 	int n;
@@ -299,19 +276,19 @@ static int me4000_space_to_end(me4000_circ_buf_t buf, int size)
 	return (n <= end) ? n : (end + 1);
 }
 
-static void me4000_outb(unsigned char value, unsigned long port)
+static void inline me4000_outb(unsigned char value, unsigned long port)
 {
 	PORT_PDEBUG("--> 0x%02X port 0x%04lX\n", value, port);
 	outb(value, port);
 }
 
-static void me4000_outl(unsigned long value, unsigned long port)
+static void inline me4000_outl(unsigned long value, unsigned long port)
 {
 	PORT_PDEBUG("--> 0x%08lX port 0x%04lX\n", value, port);
 	outl(value, port);
 }
 
-static unsigned long me4000_inl(unsigned long port)
+static unsigned long inline me4000_inl(unsigned long port)
 {
 	unsigned long value;
 	value = inl(port);
@@ -319,7 +296,7 @@ static unsigned long me4000_inl(unsigned long port)
 	return value;
 }
 
-static unsigned char me4000_inb(unsigned long port)
+static unsigned char inline me4000_inb(unsigned long port)
 {
 	unsigned char value;
 	value = inb(port);
@@ -327,102 +304,102 @@ static unsigned char me4000_inb(unsigned long port)
 	return value;
 }
 
-struct pci_driver me4000_driver = {
+static struct pci_driver me4000_driver = {
 	.name = ME4000_NAME,
 	.id_table = me4000_pci_table,
 	.probe = me4000_probe
 };
 
 static struct file_operations me4000_ao_fops_sing = {
-      owner:THIS_MODULE,
-      write:me4000_ao_write_sing,
-      ioctl:me4000_ao_ioctl_sing,
-      open:me4000_open,
-      release:me4000_release,
+      .owner = THIS_MODULE,
+      .write = me4000_ao_write_sing,
+      .ioctl = me4000_ao_ioctl_sing,
+      .open = me4000_open,
+      .release = me4000_release,
 };
 
 static struct file_operations me4000_ao_fops_wrap = {
-      owner:THIS_MODULE,
-      write:me4000_ao_write_wrap,
-      ioctl:me4000_ao_ioctl_wrap,
-      open:me4000_open,
-      release:me4000_release,
+      .owner = THIS_MODULE,
+      .write = me4000_ao_write_wrap,
+      .ioctl = me4000_ao_ioctl_wrap,
+      .open = me4000_open,
+      .release = me4000_release,
 };
 
 static struct file_operations me4000_ao_fops_cont = {
-      owner:THIS_MODULE,
-      write:me4000_ao_write_cont,
-      poll:me4000_ao_poll_cont,
-      ioctl:me4000_ao_ioctl_cont,
-      open:me4000_open,
-      release:me4000_release,
-      fsync:me4000_ao_fsync_cont,
+      .owner = THIS_MODULE,
+      .write = me4000_ao_write_cont,
+      .poll = me4000_ao_poll_cont,
+      .ioctl = me4000_ao_ioctl_cont,
+      .open = me4000_open,
+      .release = me4000_release,
+      .fsync = me4000_ao_fsync_cont,
 };
 
 static struct file_operations me4000_ai_fops_sing = {
-      owner:THIS_MODULE,
-      ioctl:me4000_ai_ioctl_sing,
-      open:me4000_open,
-      release:me4000_release,
+      .owner = THIS_MODULE,
+      .ioctl = me4000_ai_ioctl_sing,
+      .open = me4000_open,
+      .release = me4000_release,
 };
 
 static struct file_operations me4000_ai_fops_cont_sw = {
-      owner:THIS_MODULE,
-      read:me4000_ai_read,
-      poll:me4000_ai_poll,
-      ioctl:me4000_ai_ioctl_sw,
-      open:me4000_open,
-      release:me4000_release,
-      fasync:me4000_ai_fasync,
+      .owner = THIS_MODULE,
+      .read = me4000_ai_read,
+      .poll = me4000_ai_poll,
+      .ioctl = me4000_ai_ioctl_sw,
+      .open = me4000_open,
+      .release = me4000_release,
+      .fasync = me4000_ai_fasync,
 };
 
 static struct file_operations me4000_ai_fops_cont_et = {
-      owner:THIS_MODULE,
-      read:me4000_ai_read,
-      poll:me4000_ai_poll,
-      ioctl:me4000_ai_ioctl_ext,
-      open:me4000_open,
-      release:me4000_release,
+      .owner = THIS_MODULE,
+      .read = me4000_ai_read,
+      .poll = me4000_ai_poll,
+      .ioctl = me4000_ai_ioctl_ext,
+      .open = me4000_open,
+      .release = me4000_release,
 };
 
 static struct file_operations me4000_ai_fops_cont_et_value = {
-      owner:THIS_MODULE,
-      read:me4000_ai_read,
-      poll:me4000_ai_poll,
-      ioctl:me4000_ai_ioctl_ext,
-      open:me4000_open,
-      release:me4000_release,
+      .owner = THIS_MODULE,
+      .read = me4000_ai_read,
+      .poll = me4000_ai_poll,
+      .ioctl = me4000_ai_ioctl_ext,
+      .open = me4000_open,
+      .release = me4000_release,
 };
 
 static struct file_operations me4000_ai_fops_cont_et_chanlist = {
-      owner:THIS_MODULE,
-      read:me4000_ai_read,
-      poll:me4000_ai_poll,
-      ioctl:me4000_ai_ioctl_ext,
-      open:me4000_open,
-      release:me4000_release,
+      .owner = THIS_MODULE,
+      .read = me4000_ai_read,
+      .poll = me4000_ai_poll,
+      .ioctl = me4000_ai_ioctl_ext,
+      .open = me4000_open,
+      .release = me4000_release,
 };
 
 static struct file_operations me4000_dio_fops = {
-      owner:THIS_MODULE,
-      ioctl:me4000_dio_ioctl,
-      open:me4000_open,
-      release:me4000_release,
+      .owner = THIS_MODULE,
+      .ioctl = me4000_dio_ioctl,
+      .open = me4000_open,
+      .release = me4000_release,
 };
 
 static struct file_operations me4000_cnt_fops = {
-      owner:THIS_MODULE,
-      ioctl:me4000_cnt_ioctl,
-      open:me4000_open,
-      release:me4000_release,
+      .owner = THIS_MODULE,
+      .ioctl = me4000_cnt_ioctl,
+      .open = me4000_open,
+      .release = me4000_release,
 };
 
 static struct file_operations me4000_ext_int_fops = {
-      owner:THIS_MODULE,
-      ioctl:me4000_ext_int_ioctl,
-      open:me4000_open,
-      release:me4000_release,
-      fasync:me4000_ext_int_fasync,
+      .owner = THIS_MODULE,
+      .ioctl = me4000_ext_int_ioctl,
+      .open = me4000_open,
+      .release = me4000_release,
+      .fasync = me4000_ext_int_fasync,
 };
 
 static struct file_operations *me4000_ao_fops_array[] = {
@@ -439,9 +416,9 @@ static struct file_operations *me4000_ai_fops_array[] = {
 	&me4000_ai_fops_cont_et_chanlist,	// work through one channel list by external trigger
 };
 
-int __init me4000_init_module(void)
+static int __init me4000_init_module(void)
 {
-	int result = 0;
+	int result;
 
 	CALL_PDEBUG("init_module() is executed\n");
 
@@ -533,26 +510,26 @@ int __init me4000_init_module(void)
 
 	return 0;
 
-      INIT_ERROR_7:
+INIT_ERROR_7:
 	unregister_chrdev(me4000_ext_int_major_driver_no, ME4000_EXT_INT_NAME);
 
-      INIT_ERROR_6:
+INIT_ERROR_6:
 	unregister_chrdev(me4000_cnt_major_driver_no, ME4000_CNT_NAME);
 
-      INIT_ERROR_5:
+INIT_ERROR_5:
 	unregister_chrdev(me4000_dio_major_driver_no, ME4000_DIO_NAME);
 
-      INIT_ERROR_4:
+INIT_ERROR_4:
 	unregister_chrdev(me4000_ai_major_driver_no, ME4000_AI_NAME);
 
-      INIT_ERROR_3:
+INIT_ERROR_3:
 	unregister_chrdev(me4000_ao_major_driver_no, ME4000_AO_NAME);
 
-      INIT_ERROR_2:
+INIT_ERROR_2:
 	pci_unregister_driver(&me4000_driver);
 	clear_board_info_list();
 
-      INIT_ERROR_1:
+INIT_ERROR_1:
 	return result;
 }
 
@@ -562,18 +539,18 @@ static void clear_board_info_list(void)
 {
 	struct list_head *board_p;
 	struct list_head *dac_p;
-	me4000_info_t *board_info;
-	me4000_ao_context_t *ao_context;
+	struct me4000_info *board_info;
+	struct me4000_ao_context *ao_context;
 
 	/* Clear context lists */
 	for (board_p = me4000_board_info_list.next;
 	     board_p != &me4000_board_info_list; board_p = board_p->next) {
-		board_info = list_entry(board_p, me4000_info_t, list);
+		board_info = list_entry(board_p, struct me4000_info, list);
 		/* Clear analog output context list */
 		while (!list_empty(&board_info->ao_context_list)) {
 			dac_p = board_info->ao_context_list.next;
 			ao_context =
-			    list_entry(dac_p, me4000_ao_context_t, list);
+			    list_entry(dac_p, struct me4000_ao_context, list);
 			me4000_ao_reset(ao_context);
 			free_irq(ao_context->irq, ao_context);
 			if (ao_context->circ_buf.buf)
@@ -600,14 +577,14 @@ static void clear_board_info_list(void)
 	/* Clear the board info list */
 	while (!list_empty(&me4000_board_info_list)) {
 		board_p = me4000_board_info_list.next;
-		board_info = list_entry(board_p, me4000_info_t, list);
+		board_info = list_entry(board_p, struct me4000_info, list);
 		pci_release_regions(board_info->pci_dev_p);
 		list_del(board_p);
 		kfree(board_info);
 	}
 }
 
-static int get_registers(struct pci_dev *dev, me4000_info_t * board_info)
+static int get_registers(struct pci_dev *dev, struct me4000_info *board_info)
 {
 
 	/*--------------------------- plx regbase ---------------------------------*/
@@ -667,20 +644,20 @@ static int get_registers(struct pci_dev *dev, me4000_info_t * board_info)
 }
 
 static int init_board_info(struct pci_dev *pci_dev_p,
-			   me4000_info_t * board_info)
+			   struct me4000_info *board_info)
 {
 	int i;
 	int result;
 	struct list_head *board_p;
 	board_info->pci_dev_p = pci_dev_p;
 
-	for (i = 0; i < ME4000_BOARD_VERSIONS; i++) {
+	for (i = 0; i < ARRAY_SIZE(me4000_boards); i++) {
 		if (me4000_boards[i].device_id == pci_dev_p->device) {
 			board_info->board_p = &me4000_boards[i];
 			break;
 		}
 	}
-	if (i == ME4000_BOARD_VERSIONS) {
+	if (i == ARRAY_SIZE(me4000_boards)) {
 		printk(KERN_ERR
 		       "ME4000:init_board_info():Device ID not valid\n");
 		return -ENODEV;
@@ -755,21 +732,21 @@ static int init_board_info(struct pci_dev *pci_dev_p,
 	return 0;
 }
 
-static int alloc_ao_contexts(me4000_info_t * info)
+static int alloc_ao_contexts(struct me4000_info *info)
 {
 	int i;
 	int err;
-	me4000_ao_context_t *ao_context;
+	struct me4000_ao_context *ao_context;
 
 	for (i = 0; i < info->board_p->ao.count; i++) {
-		ao_context = kmalloc(sizeof(me4000_ao_context_t), GFP_KERNEL);
+		ao_context = kzalloc(sizeof(struct me4000_ao_context),
+								GFP_KERNEL);
 		if (!ao_context) {
 			printk(KERN_ERR
 			       "alloc_ao_contexts():Can't get memory for ao context\n");
 			release_ao_contexts(info);
 			return -ENOMEM;
 		}
-		memset(ao_context, 0, sizeof(me4000_ao_context_t));
 
 		spin_lock_init(&ao_context->use_lock);
 		spin_lock_init(&ao_context->int_lock);
@@ -780,15 +757,13 @@ static int alloc_ao_contexts(me4000_info_t * info)
 		if (info->board_p->ao.fifo_count) {
 			/* Allocate circular buffer */
 			ao_context->circ_buf.buf =
-			    kmalloc(ME4000_AO_BUFFER_SIZE, GFP_KERNEL);
+			    kzalloc(ME4000_AO_BUFFER_SIZE, GFP_KERNEL);
 			if (!ao_context->circ_buf.buf) {
 				printk(KERN_ERR
 				       "alloc_ao_contexts():Can't get circular buffer\n");
 				release_ao_contexts(info);
 				return -ENOMEM;
 			}
-			memset(ao_context->circ_buf.buf, 0,
-			       ME4000_AO_BUFFER_SIZE);
 
 			/* Clear the circular buffer */
 			ao_context->circ_buf.head = 0;
@@ -872,9 +847,8 @@ static int alloc_ao_contexts(me4000_info_t * info)
 					ME4000_NAME, ao_context);
 			if (err) {
 				printk(KERN_ERR
-				       "alloc_ao_contexts():Can't get interrupt line");
-				if (ao_context->circ_buf.buf)
-					kfree(ao_context->circ_buf.buf);
+				       "%s:Can't get interrupt line", __func__);
+				kfree(ao_context->circ_buf.buf);
 				kfree(ao_context);
 				release_ao_contexts(info);
 				return -ENODEV;
@@ -888,35 +862,34 @@ static int alloc_ao_contexts(me4000_info_t * info)
 	return 0;
 }
 
-static void release_ao_contexts(me4000_info_t * board_info)
+static void release_ao_contexts(struct me4000_info *board_info)
 {
 	struct list_head *dac_p;
-	me4000_ao_context_t *ao_context;
+	struct me4000_ao_context *ao_context;
 
 	/* Clear analog output context list */
 	while (!list_empty(&board_info->ao_context_list)) {
 		dac_p = board_info->ao_context_list.next;
-		ao_context = list_entry(dac_p, me4000_ao_context_t, list);
+		ao_context = list_entry(dac_p, struct me4000_ao_context, list);
 		free_irq(ao_context->irq, ao_context);
-		if (ao_context->circ_buf.buf)
-			kfree(ao_context->circ_buf.buf);
+		kfree(ao_context->circ_buf.buf);
 		list_del(dac_p);
 		kfree(ao_context);
 	}
 }
 
-static int alloc_ai_context(me4000_info_t * info)
+static int alloc_ai_context(struct me4000_info *info)
 {
-	me4000_ai_context_t *ai_context;
+	struct me4000_ai_context *ai_context;
 
 	if (info->board_p->ai.count) {
-		ai_context = kmalloc(sizeof(me4000_ai_context_t), GFP_KERNEL);
+		ai_context = kzalloc(sizeof(struct me4000_ai_context),
+								GFP_KERNEL);
 		if (!ai_context) {
 			printk(KERN_ERR
 			       "ME4000:alloc_ai_context():Can't get memory for ai context\n");
 			return -ENOMEM;
 		}
-		memset(ai_context, 0, sizeof(me4000_ai_context_t));
 
 		info->ai_context = ai_context;
 
@@ -958,18 +931,18 @@ static int alloc_ai_context(me4000_info_t * info)
 	return 0;
 }
 
-static int alloc_dio_context(me4000_info_t * info)
+static int alloc_dio_context(struct me4000_info *info)
 {
-	me4000_dio_context_t *dio_context;
+	struct me4000_dio_context *dio_context;
 
 	if (info->board_p->dio.count) {
-		dio_context = kmalloc(sizeof(me4000_dio_context_t), GFP_KERNEL);
+		dio_context = kzalloc(sizeof(struct me4000_dio_context),
+								GFP_KERNEL);
 		if (!dio_context) {
 			printk(KERN_ERR
 			       "ME4000:alloc_dio_context():Can't get memory for dio context\n");
 			return -ENOMEM;
 		}
-		memset(dio_context, 0, sizeof(me4000_dio_context_t));
 
 		info->dio_context = dio_context;
 
@@ -995,18 +968,18 @@ static int alloc_dio_context(me4000_info_t * info)
 	return 0;
 }
 
-static int alloc_cnt_context(me4000_info_t * info)
+static int alloc_cnt_context(struct me4000_info *info)
 {
-	me4000_cnt_context_t *cnt_context;
+	struct me4000_cnt_context *cnt_context;
 
 	if (info->board_p->cnt.count) {
-		cnt_context = kmalloc(sizeof(me4000_cnt_context_t), GFP_KERNEL);
+		cnt_context = kzalloc(sizeof(struct me4000_cnt_context),
+								GFP_KERNEL);
 		if (!cnt_context) {
 			printk(KERN_ERR
 			       "ME4000:alloc_cnt_context():Can't get memory for cnt context\n");
 			return -ENOMEM;
 		}
-		memset(cnt_context, 0, sizeof(me4000_cnt_context_t));
 
 		info->cnt_context = cnt_context;
 
@@ -1026,19 +999,18 @@ static int alloc_cnt_context(me4000_info_t * info)
 	return 0;
 }
 
-static int alloc_ext_int_context(me4000_info_t * info)
+static int alloc_ext_int_context(struct me4000_info *info)
 {
-	me4000_ext_int_context_t *ext_int_context;
+	struct me4000_ext_int_context *ext_int_context;
 
 	if (info->board_p->cnt.count) {
 		ext_int_context =
-		    kmalloc(sizeof(me4000_ext_int_context_t), GFP_KERNEL);
+		    kzalloc(sizeof(struct me4000_ext_int_context), GFP_KERNEL);
 		if (!ext_int_context) {
 			printk(KERN_ERR
 			       "ME4000:alloc_ext_int_context():Can't get memory for cnt context\n");
 			return -ENOMEM;
 		}
-		memset(ext_int_context, 0, sizeof(me4000_ext_int_context_t));
 
 		info->ext_int_context = ext_int_context;
 
@@ -1060,19 +1032,18 @@ static int alloc_ext_int_context(me4000_info_t * info)
 static int me4000_probe(struct pci_dev *dev, const struct pci_device_id *id)
 {
 	int result = 0;
-	me4000_info_t *board_info;
+	struct me4000_info *board_info;
 
 	CALL_PDEBUG("me4000_probe() is executed\n");
 
 	/* Allocate structure for board context */
-	board_info = kmalloc(sizeof(me4000_info_t), GFP_KERNEL);
+	board_info = kzalloc(sizeof(struct me4000_info), GFP_KERNEL);
 	if (!board_info) {
 		printk(KERN_ERR
 		       "ME4000:Can't get memory for board info structure\n");
 		result = -ENOMEM;
 		goto PROBE_ERROR_1;
 	}
-	memset(board_info, 0, sizeof(me4000_info_t));
 
 	/* Add to global linked list */
 	list_add_tail(&board_info->list, &me4000_board_info_list);
@@ -1080,70 +1051,70 @@ static int me4000_probe(struct pci_dev *dev, const struct pci_device_id *id)
 	/* Get the PCI base registers */
 	result = get_registers(dev, board_info);
 	if (result) {
-		printk(KERN_ERR "me4000_probe():Cannot get registers\n");
+		printk(KERN_ERR "%s:Cannot get registers\n", __func__);
 		goto PROBE_ERROR_2;
 	}
 
 	/* Enable the device */
 	result = pci_enable_device(dev);
 	if (result < 0) {
-		printk(KERN_ERR "me4000_probe():Cannot enable PCI device\n");
+		printk(KERN_ERR "%s:Cannot enable PCI device\n", __func__);
 		goto PROBE_ERROR_2;
 	}
 
 	/* Request the PCI register regions */
 	result = pci_request_regions(dev, ME4000_NAME);
 	if (result < 0) {
-		printk(KERN_ERR "me4000_probe():Cannot request I/O regions\n");
+		printk(KERN_ERR "%s:Cannot request I/O regions\n", __func__);
 		goto PROBE_ERROR_2;
 	}
 
 	/* Initialize board info */
 	result = init_board_info(dev, board_info);
 	if (result) {
-		printk(KERN_ERR "me4000_probe():Cannot init baord info\n");
+		printk(KERN_ERR "%s:Cannot init baord info\n", __func__);
 		goto PROBE_ERROR_3;
 	}
 
 	/* Download the xilinx firmware */
 	result = me4000_xilinx_download(board_info);
 	if (result) {
-		printk(KERN_ERR "me4000_probe:Can't download firmware\n");
+		printk(KERN_ERR "%s:Can't download firmware\n", __func__);
 		goto PROBE_ERROR_3;
 	}
 
 	/* Make a hardware reset */
 	result = me4000_reset_board(board_info);
 	if (result) {
-		printk(KERN_ERR "me4000_probe:Can't reset board\n");
+		printk(KERN_ERR "%s :Can't reset board\n", __func__);
 		goto PROBE_ERROR_3;
 	}
 
 	/* Allocate analog output context structures */
 	result = alloc_ao_contexts(board_info);
 	if (result) {
-		printk(KERN_ERR "me4000_probe():Cannot allocate ao contexts\n");
+		printk(KERN_ERR "%s:Cannot allocate ao contexts\n", __func__);
 		goto PROBE_ERROR_3;
 	}
 
 	/* Allocate analog input context */
 	result = alloc_ai_context(board_info);
 	if (result) {
-		printk(KERN_ERR "me4000_probe():Cannot allocate ai context\n");
+		printk(KERN_ERR "%s:Cannot allocate ai context\n", __func__);
 		goto PROBE_ERROR_4;
 	}
 
 	/* Allocate digital I/O context */
 	result = alloc_dio_context(board_info);
 	if (result) {
-		printk(KERN_ERR "me4000_probe():Cannot allocate dio context\n");
+		printk(KERN_ERR "%s:Cannot allocate dio context\n", __func__);
 		goto PROBE_ERROR_5;
 	}
 
 	/* Allocate counter context */
 	result = alloc_cnt_context(board_info);
 	if (result) {
-		printk(KERN_ERR "me4000_probe():Cannot allocate cnt context\n");
+		printk(KERN_ERR "%s:Cannot allocate cnt context\n", __func__);
 		goto PROBE_ERROR_6;
 	}
 
@@ -1151,36 +1122,36 @@ static int me4000_probe(struct pci_dev *dev, const struct pci_device_id *id)
 	result = alloc_ext_int_context(board_info);
 	if (result) {
 		printk(KERN_ERR
-		       "me4000_probe():Cannot allocate ext_int context\n");
+		       "%s:Cannot allocate ext_int context\n", __func__);
 		goto PROBE_ERROR_7;
 	}
 
 	return 0;
 
-      PROBE_ERROR_7:
+PROBE_ERROR_7:
 	kfree(board_info->cnt_context);
 
-      PROBE_ERROR_6:
+PROBE_ERROR_6:
 	kfree(board_info->dio_context);
 
-      PROBE_ERROR_5:
+PROBE_ERROR_5:
 	kfree(board_info->ai_context);
 
-      PROBE_ERROR_4:
+PROBE_ERROR_4:
 	release_ao_contexts(board_info);
 
-      PROBE_ERROR_3:
+PROBE_ERROR_3:
 	pci_release_regions(dev);
 
-      PROBE_ERROR_2:
+PROBE_ERROR_2:
 	list_del(&board_info->list);
 	kfree(board_info);
 
-      PROBE_ERROR_1:
+PROBE_ERROR_1:
 	return result;
 }
 
-static int me4000_xilinx_download(me4000_info_t * info)
+static int me4000_xilinx_download(struct me4000_info *info)
 {
 	int size = 0;
 	u32 value = 0;
@@ -1211,7 +1182,7 @@ static int me4000_xilinx_download(me4000_info_t * info)
 	/* Wait until /INIT pin is set */
 	udelay(20);
 	if (!inl(info->plx_regbase + PLX_INTCSR) & 0x20) {
-		printk(KERN_ERR "me4000_xilinx_download():Can't init Xilinx\n");
+		printk(KERN_ERR "%s:Can't init Xilinx\n", __func__);
 		return -EIO;
 	}
 
@@ -1232,7 +1203,7 @@ static int me4000_xilinx_download(me4000_info_t * info)
 		/* Check if BUSY flag is low */
 		if (inl(info->plx_regbase + PLX_ICR) & 0x20) {
 			printk(KERN_ERR
-			       "me4000_xilinx_download():Xilinx is still busy (idx = %d)\n",
+			       "%s:Xilinx is still busy (idx = %d)\n", __func__,
 			       idx);
 			return -EIO;
 		}
@@ -1246,9 +1217,9 @@ static int me4000_xilinx_download(me4000_info_t * info)
 		PDEBUG("me4000_xilinx_download():Download was successful\n");
 	} else {
 		printk(KERN_ERR
-		       "ME4000:me4000_xilinx_download():DONE flag is not set\n");
+		       "ME4000:%s:DONE flag is not set\n", __func__);
 		printk(KERN_ERR
-		       "ME4000:me4000_xilinx_download():Download not succesful\n");
+		       "ME4000:%s:Download not succesful\n", __func__);
 		return -EIO;
 	}
 
@@ -1260,7 +1231,7 @@ static int me4000_xilinx_download(me4000_info_t * info)
 	return 0;
 }
 
-static int me4000_reset_board(me4000_info_t * info)
+static int me4000_reset_board(struct me4000_info *info)
 {
 	unsigned long icr;
 
@@ -1314,12 +1285,12 @@ static int me4000_open(struct inode *inode_p, struct file *file_p)
 	int err = 0;
 	int i;
 	struct list_head *ptr;
-	me4000_info_t *board_info = NULL;
-	me4000_ao_context_t *ao_context = NULL;
-	me4000_ai_context_t *ai_context = NULL;
-	me4000_dio_context_t *dio_context = NULL;
-	me4000_cnt_context_t *cnt_context = NULL;
-	me4000_ext_int_context_t *ext_int_context = NULL;
+	struct me4000_info *board_info = NULL;
+	struct me4000_ao_context *ao_context = NULL;
+	struct me4000_ai_context *ai_context = NULL;
+	struct me4000_dio_context *dio_context = NULL;
+	struct me4000_cnt_context *cnt_context = NULL;
+	struct me4000_ext_int_context *ext_int_context = NULL;
 
 	CALL_PDEBUG("me4000_open() is executed\n");
 
@@ -1335,7 +1306,7 @@ static int me4000_open(struct inode *inode_p, struct file *file_p)
 		/* Search for the board context */
 		for (ptr = me4000_board_info_list.next, i = 0;
 		     ptr != &me4000_board_info_list; ptr = ptr->next, i++) {
-			board_info = list_entry(ptr, me4000_info_t, list);
+			board_info = list_entry(ptr, struct me4000_info, list);
 			if (i == board)
 				break;
 		}
@@ -1351,7 +1322,8 @@ static int me4000_open(struct inode *inode_p, struct file *file_p)
 		for (ptr = board_info->ao_context_list.next, i = 0;
 		     ptr != &board_info->ao_context_list;
 		     ptr = ptr->next, i++) {
-			ao_context = list_entry(ptr, me4000_ao_context_t, list);
+			ao_context = list_entry(ptr, struct me4000_ao_context,
+									list);
 			if (i == dev)
 				break;
 		}
@@ -1415,7 +1387,7 @@ static int me4000_open(struct inode *inode_p, struct file *file_p)
 		/* Search for the board context */
 		for (ptr = me4000_board_info_list.next, i = 0;
 		     ptr != &me4000_board_info_list; ptr = ptr->next, i++) {
-			board_info = list_entry(ptr, me4000_info_t, list);
+			board_info = list_entry(ptr, struct me4000_info, list);
 			if (i == board)
 				break;
 		}
@@ -1469,7 +1441,7 @@ static int me4000_open(struct inode *inode_p, struct file *file_p)
 		/* Search for the board context */
 		for (ptr = me4000_board_info_list.next;
 		     ptr != &me4000_board_info_list; ptr = ptr->next) {
-			board_info = list_entry(ptr, me4000_info_t, list);
+			board_info = list_entry(ptr, struct me4000_info, list);
 			if (board_info->board_count == board)
 				break;
 		}
@@ -1514,7 +1486,7 @@ static int me4000_open(struct inode *inode_p, struct file *file_p)
 		/* Search for the board context */
 		for (ptr = me4000_board_info_list.next;
 		     ptr != &me4000_board_info_list; ptr = ptr->next) {
-			board_info = list_entry(ptr, me4000_info_t, list);
+			board_info = list_entry(ptr, struct me4000_info, list);
 			if (board_info->board_count == board)
 				break;
 		}
@@ -1557,7 +1529,7 @@ static int me4000_open(struct inode *inode_p, struct file *file_p)
 		/* Search for the board context */
 		for (ptr = me4000_board_info_list.next;
 		     ptr != &me4000_board_info_list; ptr = ptr->next) {
-			board_info = list_entry(ptr, me4000_info_t, list);
+			board_info = list_entry(ptr, struct me4000_info, list);
 			if (board_info->board_count == board)
 				break;
 		}
@@ -1613,11 +1585,11 @@ static int me4000_open(struct inode *inode_p, struct file *file_p)
 
 static int me4000_release(struct inode *inode_p, struct file *file_p)
 {
-	me4000_ao_context_t *ao_context;
-	me4000_ai_context_t *ai_context;
-	me4000_dio_context_t *dio_context;
-	me4000_cnt_context_t *cnt_context;
-	me4000_ext_int_context_t *ext_int_context;
+	struct me4000_ao_context *ao_context;
+	struct me4000_ai_context *ai_context;
+	struct me4000_dio_context *dio_context;
+	struct me4000_cnt_context *cnt_context;
+	struct me4000_ext_int_context *ext_int_context;
 
 	CALL_PDEBUG("me4000_release() is executed\n");
 
@@ -1677,7 +1649,7 @@ static int me4000_release(struct inode *inode_p, struct file *file_p)
 
 /*------------------------------- Analog output stuff --------------------------------------*/
 
-static int me4000_ao_prepare(me4000_ao_context_t * ao_context)
+static int me4000_ao_prepare(struct me4000_ao_context *ao_context)
 {
 	unsigned long flags;
 
@@ -1756,7 +1728,7 @@ static int me4000_ao_prepare(me4000_ao_context_t * ao_context)
 	return 0;
 }
 
-static int me4000_ao_reset(me4000_ao_context_t * ao_context)
+static int me4000_ao_reset(struct me4000_ao_context *ao_context)
 {
 	u32 tmp;
 	wait_queue_head_t queue;
@@ -1777,9 +1749,10 @@ static int me4000_ao_reset(me4000_ao_context_t * ao_context)
 		tmp |= ME4000_AO_CTRL_BIT_IMMEDIATE_STOP;
 		me4000_outl(tmp, ao_context->ctrl_reg);
 
-		while (inl(ao_context->status_reg) & ME4000_AO_STATUS_BIT_FSM) {
-			sleep_on_timeout(&queue, 1);
-		}
+		wait_event_timeout(queue,
+			(inl(ao_context->status_reg) &
+				ME4000_AO_STATUS_BIT_FSM) == 0,
+			1);
 
 		/* Set to transparent mode */
 		me4000_ao_simultaneous_disable(ao_context);
@@ -1812,9 +1785,10 @@ static int me4000_ao_reset(me4000_ao_context_t * ao_context)
 		me4000_outl(tmp, ao_context->ctrl_reg);
 		spin_unlock_irqrestore(&ao_context->int_lock, flags);
 
-		while (inl(ao_context->status_reg) & ME4000_AO_STATUS_BIT_FSM) {
-			sleep_on_timeout(&queue, 1);
-		}
+		wait_event_timeout(queue,
+			(inl(ao_context->status_reg) &
+				ME4000_AO_STATUS_BIT_FSM) == 0,
+			1);
 
 		/* Clear the circular buffer */
 		ao_context->circ_buf.head = 0;
@@ -1853,9 +1827,9 @@ static int me4000_ao_reset(me4000_ao_context_t * ao_context)
 }
 
 static ssize_t me4000_ao_write_sing(struct file *filep, const char *buff,
-				    size_t cnt, loff_t * offp)
+				    size_t cnt, loff_t *offp)
 {
-	me4000_ao_context_t *ao_context = filep->private_data;
+	struct me4000_ao_context *ao_context = filep->private_data;
 	u32 value;
 	const u16 *buffer = (const u16 *)buff;
 
@@ -1863,13 +1837,13 @@ static ssize_t me4000_ao_write_sing(struct file *filep, const char *buff,
 
 	if (cnt != 2) {
 		printk(KERN_ERR
-		       "me4000_ao_write_sing():Write count is not 2\n");
+		       "%s:Write count is not 2\n", __func__);
 		return -EINVAL;
 	}
 
 	if (get_user(value, buffer)) {
 		printk(KERN_ERR
-		       "me4000_ao_write_sing():Cannot copy data from user\n");
+		       "%s:Cannot copy data from user\n", __func__);
 		return -EFAULT;
 	}
 
@@ -1879,9 +1853,9 @@ static ssize_t me4000_ao_write_sing(struct file *filep, const char *buff,
 }
 
 static ssize_t me4000_ao_write_wrap(struct file *filep, const char *buff,
-				    size_t cnt, loff_t * offp)
+				    size_t cnt, loff_t *offp)
 {
-	me4000_ao_context_t *ao_context = filep->private_data;
+	struct me4000_ao_context *ao_context = filep->private_data;
 	size_t i;
 	u32 value;
 	u32 tmp;
@@ -1893,13 +1867,13 @@ static ssize_t me4000_ao_write_wrap(struct file *filep, const char *buff,
 	/* Check if a conversion is already running */
 	if (inl(ao_context->status_reg) & ME4000_AO_STATUS_BIT_FSM) {
 		printk(KERN_ERR
-		       "ME4000:me4000_ao_write_wrap():There is already a conversion running\n");
+		       "%s:There is already a conversion running\n", __func__);
 		return -EBUSY;
 	}
 
 	if (count > ME4000_AO_FIFO_COUNT) {
 		printk(KERN_ERR
-		       "me4000_ao_write_wrap():Can't load more than %d values\n",
+		       "%s:Can't load more than %d values\n", __func__,
 		       ME4000_AO_FIFO_COUNT);
 		return -ENOSPC;
 	}
@@ -1914,7 +1888,7 @@ static ssize_t me4000_ao_write_wrap(struct file *filep, const char *buff,
 	for (i = 0; i < count; i++) {
 		if (get_user(value, buffer + i)) {
 			printk(KERN_ERR
-			       "me4000_ao_write_single():Cannot copy data from user\n");
+			       "%s:Cannot copy data from user\n", __func__);
 			return -EFAULT;
 		}
 		if (((ao_context->fifo_reg & 0xFF) == ME4000_AO_01_FIFO_REG)
@@ -1928,9 +1902,9 @@ static ssize_t me4000_ao_write_wrap(struct file *filep, const char *buff,
 }
 
 static ssize_t me4000_ao_write_cont(struct file *filep, const char *buff,
-				    size_t cnt, loff_t * offp)
+				    size_t cnt, loff_t *offp)
 {
-	me4000_ao_context_t *ao_context = filep->private_data;
+	struct me4000_ao_context *ao_context = filep->private_data;
 	const u16 *buffer = (const u16 *)buff;
 	size_t count = cnt / 2;
 	unsigned long flags;
@@ -2154,9 +2128,9 @@ static ssize_t me4000_ao_write_cont(struct file *filep, const char *buff,
 	return 2 * ret;
 }
 
-static unsigned int me4000_ao_poll_cont(struct file *file_p, poll_table * wait)
+static unsigned int me4000_ao_poll_cont(struct file *file_p, poll_table *wait)
 {
-	me4000_ao_context_t *ao_context;
+	struct me4000_ao_context *ao_context;
 	unsigned long mask = 0;
 
 	CALL_PDEBUG("me4000_ao_poll_cont() is executed\n");
@@ -2177,7 +2151,7 @@ static unsigned int me4000_ao_poll_cont(struct file *file_p, poll_table * wait)
 static int me4000_ao_fsync_cont(struct file *file_p, struct dentry *dentry_p,
 				int datasync)
 {
-	me4000_ao_context_t *ao_context;
+	struct me4000_ao_context *ao_context;
 	wait_queue_head_t queue;
 
 	CALL_PDEBUG("me4000_ao_fsync_cont() is executed\n");
@@ -2187,15 +2161,19 @@ static int me4000_ao_fsync_cont(struct file *file_p, struct dentry *dentry_p,
 
 	while (inl(ao_context->status_reg) & ME4000_AO_STATUS_BIT_FSM) {
 		interruptible_sleep_on_timeout(&queue, 1);
+			wait_event_interruptible_timeout(queue,
+			!(inl(ao_context->status_reg) & ME4000_AO_STATUS_BIT_FSM),
+			1);
 		if (ao_context->pipe_flag) {
 			printk(KERN_ERR
-			       "me4000_ao_fsync_cont():Broken pipe detected\n");
+			       "%s:Broken pipe detected\n", __func__);
 			return -EPIPE;
 		}
 
 		if (signal_pending(current)) {
 			printk(KERN_ERR
-			       "me4000_ao_fsync_cont():Wait on state machine interrupted\n");
+			       "%s:Wait on state machine interrupted\n",
+			       __func__);
 			return -EINTR;
 		}
 	}
@@ -2206,7 +2184,7 @@ static int me4000_ao_fsync_cont(struct file *file_p, struct dentry *dentry_p,
 static int me4000_ao_ioctl_sing(struct inode *inode_p, struct file *file_p,
 				unsigned int service, unsigned long arg)
 {
-	me4000_ao_context_t *ao_context;
+	struct me4000_ao_context *ao_context;
 
 	CALL_PDEBUG("me4000_ao_ioctl_sing() is executed\n");
 
@@ -2229,7 +2207,7 @@ static int me4000_ao_ioctl_sing(struct inode *inode_p, struct file *file_p,
 	case ME4000_AO_PRELOAD_UPDATE:
 		return me4000_ao_preload_update(ao_context);
 	case ME4000_GET_USER_INFO:
-		return me4000_get_user_info((me4000_user_info_t *) arg,
+		return me4000_get_user_info((struct me4000_user_info *)arg,
 					    ao_context->board_info);
 	case ME4000_AO_SIMULTANEOUS_EX_TRIG:
 		return me4000_ao_simultaneous_ex_trig(ao_context);
@@ -2239,8 +2217,9 @@ static int me4000_ao_ioctl_sing(struct inode *inode_p, struct file *file_p,
 		return me4000_ao_simultaneous_disable(ao_context);
 	case ME4000_AO_SIMULTANEOUS_UPDATE:
 		return
-		    me4000_ao_simultaneous_update((me4000_ao_channel_list_t *)
-						  arg, ao_context);
+		    me4000_ao_simultaneous_update(
+		    		(struct me4000_ao_channel_list *)arg,
+				ao_context);
 	case ME4000_AO_EX_TRIG_TIMEOUT:
 		return me4000_ao_ex_trig_timeout((unsigned long *)arg,
 						 ao_context);
@@ -2258,7 +2237,7 @@ static int me4000_ao_ioctl_sing(struct inode *inode_p, struct file *file_p,
 static int me4000_ao_ioctl_wrap(struct inode *inode_p, struct file *file_p,
 				unsigned int service, unsigned long arg)
 {
-	me4000_ao_context_t *ao_context;
+	struct me4000_ao_context *ao_context;
 
 	CALL_PDEBUG("me4000_ao_ioctl_wrap() is executed\n");
 
@@ -2287,7 +2266,7 @@ static int me4000_ao_ioctl_wrap(struct inode *inode_p, struct file *file_p,
 	case ME4000_AO_EX_TRIG_DISABLE:
 		return me4000_ao_ex_trig_disable(ao_context);
 	case ME4000_GET_USER_INFO:
-		return me4000_get_user_info((me4000_user_info_t *) arg,
+		return me4000_get_user_info((struct me4000_user_info *)arg,
 					    ao_context->board_info);
 	case ME4000_AO_FSM_STATE:
 		return me4000_ao_fsm_state((int *)arg, ao_context);
@@ -2310,7 +2289,7 @@ static int me4000_ao_ioctl_wrap(struct inode *inode_p, struct file *file_p,
 static int me4000_ao_ioctl_cont(struct inode *inode_p, struct file *file_p,
 				unsigned int service, unsigned long arg)
 {
-	me4000_ao_context_t *ao_context;
+	struct me4000_ao_context *ao_context;
 
 	CALL_PDEBUG("me4000_ao_ioctl_cont() is executed\n");
 
@@ -2345,7 +2324,7 @@ static int me4000_ao_ioctl_cont(struct inode *inode_p, struct file *file_p,
 	case ME4000_AO_FSM_STATE:
 		return me4000_ao_fsm_state((int *)arg, ao_context);
 	case ME4000_GET_USER_INFO:
-		return me4000_get_user_info((me4000_user_info_t *) arg,
+		return me4000_get_user_info((struct me4000_user_info *)arg,
 					    ao_context->board_info);
 	case ME4000_AO_SYNCHRONOUS_EX_TRIG:
 		return me4000_ao_synchronous_ex_trig(ao_context);
@@ -2362,7 +2341,8 @@ static int me4000_ao_ioctl_cont(struct inode *inode_p, struct file *file_p,
 	return 0;
 }
 
-static int me4000_ao_start(unsigned long *arg, me4000_ao_context_t * ao_context)
+static int me4000_ao_start(unsigned long *arg,
+			   struct me4000_ao_context *ao_context)
 {
 	u32 tmp;
 	wait_queue_head_t queue;
@@ -2412,7 +2392,7 @@ static int me4000_ao_start(unsigned long *arg, me4000_ao_context_t * ao_context)
 	return 0;
 }
 
-static int me4000_ao_stop(me4000_ao_context_t * ao_context)
+static int me4000_ao_stop(struct me4000_ao_context *ao_context)
 {
 	u32 tmp;
 	wait_queue_head_t queue;
@@ -2445,7 +2425,7 @@ static int me4000_ao_stop(me4000_ao_context_t * ao_context)
 	return 0;
 }
 
-static int me4000_ao_immediate_stop(me4000_ao_context_t * ao_context)
+static int me4000_ao_immediate_stop(struct me4000_ao_context *ao_context)
 {
 	u32 tmp;
 	wait_queue_head_t queue;
@@ -2477,8 +2457,8 @@ static int me4000_ao_immediate_stop(me4000_ao_context_t * ao_context)
 	return 0;
 }
 
-static int me4000_ao_timer_set_divisor(u32 * arg,
-				       me4000_ao_context_t * ao_context)
+static int me4000_ao_timer_set_divisor(u32 *arg,
+				       struct me4000_ao_context *ao_context)
 {
 	u32 divisor;
 	u32 tmp;
@@ -2518,7 +2498,7 @@ static int me4000_ao_timer_set_divisor(u32 * arg,
 }
 
 static int me4000_ao_ex_trig_set_edge(int *arg,
-				      me4000_ao_context_t * ao_context)
+				      struct me4000_ao_context *ao_context)
 {
 	int mode;
 	u32 tmp;
@@ -2569,7 +2549,7 @@ static int me4000_ao_ex_trig_set_edge(int *arg,
 	return 0;
 }
 
-static int me4000_ao_ex_trig_enable(me4000_ao_context_t * ao_context)
+static int me4000_ao_ex_trig_enable(struct me4000_ao_context *ao_context)
 {
 	u32 tmp;
 	unsigned long flags;
@@ -2593,7 +2573,7 @@ static int me4000_ao_ex_trig_enable(me4000_ao_context_t * ao_context)
 	return 0;
 }
 
-static int me4000_ao_ex_trig_disable(me4000_ao_context_t * ao_context)
+static int me4000_ao_ex_trig_disable(struct me4000_ao_context *ao_context)
 {
 	u32 tmp;
 	unsigned long flags;
@@ -2617,7 +2597,7 @@ static int me4000_ao_ex_trig_disable(me4000_ao_context_t * ao_context)
 	return 0;
 }
 
-static int me4000_ao_simultaneous_disable(me4000_ao_context_t * ao_context)
+static int me4000_ao_simultaneous_disable(struct me4000_ao_context *ao_context)
 {
 	u32 tmp;
 
@@ -2643,7 +2623,7 @@ static int me4000_ao_simultaneous_disable(me4000_ao_context_t * ao_context)
 	return 0;
 }
 
-static int me4000_ao_simultaneous_ex_trig(me4000_ao_context_t * ao_context)
+static int me4000_ao_simultaneous_ex_trig(struct me4000_ao_context *ao_context)
 {
 	u32 tmp;
 
@@ -2659,7 +2639,7 @@ static int me4000_ao_simultaneous_ex_trig(me4000_ao_context_t * ao_context)
 	return 0;
 }
 
-static int me4000_ao_simultaneous_sw(me4000_ao_context_t * ao_context)
+static int me4000_ao_simultaneous_sw(struct me4000_ao_context *ao_context)
 {
 	u32 tmp;
 
@@ -2675,13 +2655,13 @@ static int me4000_ao_simultaneous_sw(me4000_ao_context_t * ao_context)
 	return 0;
 }
 
-static int me4000_ao_preload(me4000_ao_context_t * ao_context)
+static int me4000_ao_preload(struct me4000_ao_context *ao_context)
 {
 	CALL_PDEBUG("me4000_ao_preload() is executed\n");
 	return me4000_ao_simultaneous_sw(ao_context);
 }
 
-static int me4000_ao_preload_update(me4000_ao_context_t * ao_context)
+static int me4000_ao_preload_update(struct me4000_ao_context *ao_context)
 {
 	u32 tmp;
 	u32 ctrl;
@@ -2705,10 +2685,12 @@ static int me4000_ao_preload_update(me4000_ao_context_t * ao_context)
 			if (!
 			    (tmp &
 			     (0x1 <<
-			      (((me4000_ao_context_t *) entry)->index + 16)))) {
+			      (((struct me4000_ao_context *)entry)->index
+			      					      + 16)))) {
 				tmp &=
 				    ~(0x1 <<
-				      (((me4000_ao_context_t *) entry)->index));
+				      (((struct me4000_ao_context *)entry)->
+				      					index));
 			}
 		}
 	}
@@ -2718,18 +2700,19 @@ static int me4000_ao_preload_update(me4000_ao_context_t * ao_context)
 	return 0;
 }
 
-static int me4000_ao_simultaneous_update(me4000_ao_channel_list_t * arg,
-					 me4000_ao_context_t * ao_context)
+static int me4000_ao_simultaneous_update(struct me4000_ao_channel_list *arg,
+					 struct me4000_ao_context *ao_context)
 {
 	int err;
 	int i;
 	u32 tmp;
-	me4000_ao_channel_list_t channels;
+	struct me4000_ao_channel_list channels;
 
 	CALL_PDEBUG("me4000_ao_simultaneous_update() is executed\n");
 
 	/* Copy data from user */
-	err = copy_from_user(&channels, arg, sizeof(me4000_ao_channel_list_t));
+	err = copy_from_user(&channels, arg,
+			sizeof(struct me4000_ao_channel_list));
 	if (err) {
 		printk(KERN_ERR
 		       "ME4000:me4000_ao_simultaneous_update():Can't copy command\n");
@@ -2737,13 +2720,12 @@ static int me4000_ao_simultaneous_update(me4000_ao_channel_list_t * arg,
 	}
 
 	channels.list =
-	    kmalloc(sizeof(unsigned long) * channels.count, GFP_KERNEL);
+	    kzalloc(sizeof(unsigned long) * channels.count, GFP_KERNEL);
 	if (!channels.list) {
 		printk(KERN_ERR
 		       "ME4000:me4000_ao_simultaneous_update():Can't get buffer\n");
 		return -ENOMEM;
 	}
-	memset(channels.list, 0, sizeof(unsigned long) * channels.count);
 
 	/* Copy channel list from user */
 	err =
@@ -2777,7 +2759,7 @@ static int me4000_ao_simultaneous_update(me4000_ao_channel_list_t * arg,
 	return 0;
 }
 
-static int me4000_ao_synchronous_ex_trig(me4000_ao_context_t * ao_context)
+static int me4000_ao_synchronous_ex_trig(struct me4000_ao_context *ao_context)
 {
 	u32 tmp;
 	unsigned long flags;
@@ -2813,7 +2795,7 @@ static int me4000_ao_synchronous_ex_trig(me4000_ao_context_t * ao_context)
 	return 0;
 }
 
-static int me4000_ao_synchronous_sw(me4000_ao_context_t * ao_context)
+static int me4000_ao_synchronous_sw(struct me4000_ao_context *ao_context)
 {
 	u32 tmp;
 	unsigned long flags;
@@ -2848,13 +2830,13 @@ static int me4000_ao_synchronous_sw(me4000_ao_context_t * ao_context)
 	return 0;
 }
 
-static int me4000_ao_synchronous_disable(me4000_ao_context_t * ao_context)
+static int me4000_ao_synchronous_disable(struct me4000_ao_context *ao_context)
 {
 	return me4000_ao_simultaneous_disable(ao_context);
 }
 
 static int me4000_ao_get_free_buffer(unsigned long *arg,
-				     me4000_ao_context_t * ao_context)
+				     struct me4000_ao_context *ao_context)
 {
 	unsigned long c;
 	int err;
@@ -2864,7 +2846,7 @@ static int me4000_ao_get_free_buffer(unsigned long *arg,
 	err = copy_to_user(arg, &c, sizeof(unsigned long));
 	if (err) {
 		printk(KERN_ERR
-		       "ME4000:me4000_ao_get_free_buffer():Can't copy to user space\n");
+		       "%s:Can't copy to user space\n", __func__);
 		return -EFAULT;
 	}
 
@@ -2872,7 +2854,7 @@ static int me4000_ao_get_free_buffer(unsigned long *arg,
 }
 
 static int me4000_ao_ex_trig_timeout(unsigned long *arg,
-				     me4000_ao_context_t * ao_context)
+				     struct me4000_ao_context *ao_context)
 {
 	u32 tmp;
 	wait_queue_head_t queue;
@@ -2928,7 +2910,7 @@ static int me4000_ao_ex_trig_timeout(unsigned long *arg,
 	return 0;
 }
 
-static int me4000_ao_enable_do(me4000_ao_context_t * ao_context)
+static int me4000_ao_enable_do(struct me4000_ao_context *ao_context)
 {
 	u32 tmp;
 	unsigned long flags;
@@ -2959,7 +2941,7 @@ static int me4000_ao_enable_do(me4000_ao_context_t * ao_context)
 	return 0;
 }
 
-static int me4000_ao_disable_do(me4000_ao_context_t * ao_context)
+static int me4000_ao_disable_do(struct me4000_ao_context *ao_context)
 {
 	u32 tmp;
 	unsigned long flags;
@@ -2989,7 +2971,7 @@ static int me4000_ao_disable_do(me4000_ao_context_t * ao_context)
 	return 0;
 }
 
-static int me4000_ao_fsm_state(int *arg, me4000_ao_context_t * ao_context)
+static int me4000_ao_fsm_state(int *arg, struct me4000_ao_context *ao_context)
 {
 	unsigned long tmp;
 
@@ -3012,9 +2994,9 @@ static int me4000_ao_fsm_state(int *arg, me4000_ao_context_t * ao_context)
 	return 0;
 }
 
-/*------------------------------- Analog input stuff --------------------------------------*/
+/*------------------------- Analog input stuff -------------------------------*/
 
-static int me4000_ai_prepare(me4000_ai_context_t * ai_context)
+static int me4000_ai_prepare(struct me4000_ai_context *ai_context)
 {
 	wait_queue_head_t queue;
 	int err;
@@ -3057,14 +3039,13 @@ static int me4000_ai_prepare(me4000_ai_context_t * ai_context)
 
 		/* Allocate circular buffer */
 		ai_context->circ_buf.buf =
-		    kmalloc(ME4000_AI_BUFFER_SIZE, GFP_KERNEL);
+		    kzalloc(ME4000_AI_BUFFER_SIZE, GFP_KERNEL);
 		if (!ai_context->circ_buf.buf) {
 			printk(KERN_ERR
 			       "ME4000:me4000_ai_prepare():Can't get circular buffer\n");
 			free_irq(ai_context->irq, ai_context);
 			return -ENOMEM;
 		}
-		memset(ai_context->circ_buf.buf, 0, ME4000_AI_BUFFER_SIZE);
 
 		/* Clear the circular buffer */
 		ai_context->circ_buf.head = 0;
@@ -3074,7 +3055,7 @@ static int me4000_ai_prepare(me4000_ai_context_t * ai_context)
 	return 0;
 }
 
-static int me4000_ai_reset(me4000_ai_context_t * ai_context)
+static int me4000_ai_reset(struct me4000_ai_context *ai_context)
 {
 	wait_queue_head_t queue;
 	u32 tmp;
@@ -3139,7 +3120,7 @@ static int me4000_ai_reset(me4000_ai_context_t * ai_context)
 static int me4000_ai_ioctl_sing(struct inode *inode_p, struct file *file_p,
 				unsigned int service, unsigned long arg)
 {
-	me4000_ai_context_t *ai_context;
+	struct me4000_ai_context *ai_context;
 
 	CALL_PDEBUG("me4000_ai_ioctl_sing() is executed\n");
 
@@ -3157,16 +3138,17 @@ static int me4000_ai_ioctl_sing(struct inode *inode_p, struct file *file_p,
 
 	switch (service) {
 	case ME4000_AI_SINGLE:
-		return me4000_ai_single((me4000_ai_single_t *) arg, ai_context);
+		return me4000_ai_single((struct me4000_ai_single *)arg,
+								ai_context);
 	case ME4000_AI_EX_TRIG_ENABLE:
 		return me4000_ai_ex_trig_enable(ai_context);
 	case ME4000_AI_EX_TRIG_DISABLE:
 		return me4000_ai_ex_trig_disable(ai_context);
 	case ME4000_AI_EX_TRIG_SETUP:
-		return me4000_ai_ex_trig_setup((me4000_ai_trigger_t *) arg,
+		return me4000_ai_ex_trig_setup((struct me4000_ai_trigger *)arg,
 					       ai_context);
 	case ME4000_GET_USER_INFO:
-		return me4000_get_user_info((me4000_user_info_t *) arg,
+		return me4000_get_user_info((struct me4000_user_info *)arg,
 					    ai_context->board_info);
 	case ME4000_AI_OFFSET_ENABLE:
 		return me4000_ai_offset_enable(ai_context);
@@ -3177,9 +3159,11 @@ static int me4000_ai_ioctl_sing(struct inode *inode_p, struct file *file_p,
 	case ME4000_AI_FULLSCALE_DISABLE:
 		return me4000_ai_fullscale_disable(ai_context);
 	case ME4000_AI_EEPROM_READ:
-		return me4000_eeprom_read((me4000_eeprom_t *) arg, ai_context);
+		return me4000_eeprom_read((struct me4000_eeprom *)arg,
+								ai_context);
 	case ME4000_AI_EEPROM_WRITE:
-		return me4000_eeprom_write((me4000_eeprom_t *) arg, ai_context);
+		return me4000_eeprom_write((struct me4000_eeprom *)arg,
+								ai_context);
 	default:
 		printk(KERN_ERR
 		       "me4000_ai_ioctl_sing():Invalid service number\n");
@@ -3188,10 +3172,10 @@ static int me4000_ai_ioctl_sing(struct inode *inode_p, struct file *file_p,
 	return 0;
 }
 
-static int me4000_ai_single(me4000_ai_single_t * arg,
-			    me4000_ai_context_t * ai_context)
+static int me4000_ai_single(struct me4000_ai_single *arg,
+			    struct me4000_ai_context *ai_context)
 {
-	me4000_ai_single_t cmd;
+	struct me4000_ai_single cmd;
 	int err;
 	u32 tmp;
 	wait_queue_head_t queue;
@@ -3202,7 +3186,7 @@ static int me4000_ai_single(me4000_ai_single_t * arg,
 	init_waitqueue_head(&queue);
 
 	/* Copy data from user */
-	err = copy_from_user(&cmd, arg, sizeof(me4000_ai_single_t));
+	err = copy_from_user(&cmd, arg, sizeof(struct me4000_ai_single));
 	if (err) {
 		printk(KERN_ERR
 		       "ME4000:me4000_ai_single():Can't copy from user space\n");
@@ -3301,7 +3285,7 @@ static int me4000_ai_single(me4000_ai_single_t * arg,
 	cmd.value = me4000_inl(ai_context->data_reg) & 0xFFFF;
 
 	/* Copy result back to user */
-	err = copy_to_user(arg, &cmd, sizeof(me4000_ai_single_t));
+	err = copy_to_user(arg, &cmd, sizeof(struct me4000_ai_single));
 	if (err) {
 		printk(KERN_ERR
 		       "ME4000:me4000_ai_single():Can't copy to user space\n");
@@ -3314,7 +3298,7 @@ static int me4000_ai_single(me4000_ai_single_t * arg,
 static int me4000_ai_ioctl_sw(struct inode *inode_p, struct file *file_p,
 			      unsigned int service, unsigned long arg)
 {
-	me4000_ai_context_t *ai_context;
+	struct me4000_ai_context *ai_context;
 
 	CALL_PDEBUG("me4000_ai_ioctl_sw() is executed\n");
 
@@ -3332,9 +3316,11 @@ static int me4000_ai_ioctl_sw(struct inode *inode_p, struct file *file_p,
 
 	switch (service) {
 	case ME4000_AI_SC_SETUP:
-		return me4000_ai_sc_setup((me4000_ai_sc_t *) arg, ai_context);
+		return me4000_ai_sc_setup((struct me4000_ai_sc *)arg,
+								ai_context);
 	case ME4000_AI_CONFIG:
-		return me4000_ai_config((me4000_ai_config_t *) arg, ai_context);
+		return me4000_ai_config((struct me4000_ai_config *)arg,
+								ai_context);
 	case ME4000_AI_START:
 		return me4000_ai_start(ai_context);
 	case ME4000_AI_STOP:
@@ -3344,19 +3330,20 @@ static int me4000_ai_ioctl_sw(struct inode *inode_p, struct file *file_p,
 	case ME4000_AI_FSM_STATE:
 		return me4000_ai_fsm_state((int *)arg, ai_context);
 	case ME4000_GET_USER_INFO:
-		return me4000_get_user_info((me4000_user_info_t *) arg,
+		return me4000_get_user_info((struct me4000_user_info *)arg,
 					    ai_context->board_info);
 	case ME4000_AI_EEPROM_READ:
-		return me4000_eeprom_read((me4000_eeprom_t *) arg, ai_context);
+		return me4000_eeprom_read((struct me4000_eeprom *)arg,
+								ai_context);
 	case ME4000_AI_EEPROM_WRITE:
-		return me4000_eeprom_write((me4000_eeprom_t *) arg, ai_context);
+		return me4000_eeprom_write((struct me4000_eeprom *)arg,
+								ai_context);
 	case ME4000_AI_GET_COUNT_BUFFER:
 		return me4000_ai_get_count_buffer((unsigned long *)arg,
 						  ai_context);
 	default:
 		printk(KERN_ERR
-		       "ME4000:me4000_ai_ioctl_sw():Invalid service number %d\n",
-		       service);
+		       "%s:Invalid service number %d\n", __func__, service);
 		return -ENOTTY;
 	}
 	return 0;
@@ -3365,7 +3352,7 @@ static int me4000_ai_ioctl_sw(struct inode *inode_p, struct file *file_p,
 static int me4000_ai_ioctl_ext(struct inode *inode_p, struct file *file_p,
 			       unsigned int service, unsigned long arg)
 {
-	me4000_ai_context_t *ai_context;
+	struct me4000_ai_context *ai_context;
 
 	CALL_PDEBUG("me4000_ai_ioctl_ext() is executed\n");
 
@@ -3383,9 +3370,11 @@ static int me4000_ai_ioctl_ext(struct inode *inode_p, struct file *file_p,
 
 	switch (service) {
 	case ME4000_AI_SC_SETUP:
-		return me4000_ai_sc_setup((me4000_ai_sc_t *) arg, ai_context);
+		return me4000_ai_sc_setup((struct me4000_ai_sc *)arg,
+								ai_context);
 	case ME4000_AI_CONFIG:
-		return me4000_ai_config((me4000_ai_config_t *) arg, ai_context);
+		return me4000_ai_config((struct me4000_ai_config *)arg,
+								ai_context);
 	case ME4000_AI_START:
 		return me4000_ai_start_ex((unsigned long *)arg, ai_context);
 	case ME4000_AI_STOP:
@@ -3397,20 +3386,19 @@ static int me4000_ai_ioctl_ext(struct inode *inode_p, struct file *file_p,
 	case ME4000_AI_EX_TRIG_DISABLE:
 		return me4000_ai_ex_trig_disable(ai_context);
 	case ME4000_AI_EX_TRIG_SETUP:
-		return me4000_ai_ex_trig_setup((me4000_ai_trigger_t *) arg,
+		return me4000_ai_ex_trig_setup((struct me4000_ai_trigger *)arg,
 					       ai_context);
 	case ME4000_AI_FSM_STATE:
 		return me4000_ai_fsm_state((int *)arg, ai_context);
 	case ME4000_GET_USER_INFO:
-		return me4000_get_user_info((me4000_user_info_t *) arg,
+		return me4000_get_user_info((struct me4000_user_info *)arg,
 					    ai_context->board_info);
 	case ME4000_AI_GET_COUNT_BUFFER:
 		return me4000_ai_get_count_buffer((unsigned long *)arg,
 						  ai_context);
 	default:
 		printk(KERN_ERR
-		       "ME4000:me4000_ai_ioctl_ext():Invalid service number %d\n",
-		       service);
+		       "%s:Invalid service number %d\n", __func__ , service);
 		return -ENOTTY;
 	}
 	return 0;
@@ -3418,7 +3406,7 @@ static int me4000_ai_ioctl_ext(struct inode *inode_p, struct file *file_p,
 
 static int me4000_ai_fasync(int fd, struct file *file_p, int mode)
 {
-	me4000_ai_context_t *ai_context;
+	struct me4000_ai_context *ai_context;
 
 	CALL_PDEBUG("me4000_ao_fasync_cont() is executed\n");
 
@@ -3426,10 +3414,10 @@ static int me4000_ai_fasync(int fd, struct file *file_p, int mode)
 	return fasync_helper(fd, file_p, mode, &ai_context->fasync_p);
 }
 
-static int me4000_ai_config(me4000_ai_config_t * arg,
-			    me4000_ai_context_t * ai_context)
+static int me4000_ai_config(struct me4000_ai_config *arg,
+			    struct me4000_ai_context *ai_context)
 {
-	me4000_ai_config_t cmd;
+	struct me4000_ai_config cmd;
 	u32 *list = NULL;
 	u32 mode;
 	int i;
@@ -3451,7 +3439,7 @@ static int me4000_ai_config(me4000_ai_config_t * arg,
 	}
 
 	/* Copy data from user */
-	err = copy_from_user(&cmd, arg, sizeof(me4000_ai_config_t));
+	err = copy_from_user(&cmd, arg, sizeof(struct me4000_ai_config));
 	if (err) {
 		printk(KERN_ERR
 		       "ME4000:me4000_ai_config():Can't copy from user space\n");
@@ -3671,7 +3659,7 @@ static int me4000_ai_config(me4000_ai_config_t * arg,
 
 	return 0;
 
-      AI_CONFIG_ERR:
+AI_CONFIG_ERR:
 
 	/* Reset the timers */
 	ai_context->chan_timer = 66;
@@ -3699,7 +3687,7 @@ static int me4000_ai_config(me4000_ai_config_t * arg,
 
 }
 
-static int ai_common_start(me4000_ai_context_t * ai_context)
+static int ai_common_start(struct me4000_ai_context *ai_context)
 {
 	u32 tmp;
 	CALL_PDEBUG("ai_common_start() is executed\n");
@@ -3762,7 +3750,7 @@ static int ai_common_start(me4000_ai_context_t * ai_context)
 	return 0;
 }
 
-static int me4000_ai_start(me4000_ai_context_t * ai_context)
+static int me4000_ai_start(struct me4000_ai_context *ai_context)
 {
 	int err;
 	CALL_PDEBUG("me4000_ai_start() is executed\n");
@@ -3779,7 +3767,7 @@ static int me4000_ai_start(me4000_ai_context_t * ai_context)
 }
 
 static int me4000_ai_start_ex(unsigned long *arg,
-			      me4000_ai_context_t * ai_context)
+			      struct me4000_ai_context *ai_context)
 {
 	int err;
 	wait_queue_head_t queue;
@@ -3834,7 +3822,7 @@ static int me4000_ai_start_ex(unsigned long *arg,
 	return 0;
 }
 
-static int me4000_ai_stop(me4000_ai_context_t * ai_context)
+static int me4000_ai_stop(struct me4000_ai_context *ai_context)
 {
 	wait_queue_head_t queue;
 	u32 tmp;
@@ -3871,7 +3859,7 @@ static int me4000_ai_stop(me4000_ai_context_t * ai_context)
 	return 0;
 }
 
-static int me4000_ai_immediate_stop(me4000_ai_context_t * ai_context)
+static int me4000_ai_immediate_stop(struct me4000_ai_context *ai_context)
 {
 	wait_queue_head_t queue;
 	u32 tmp;
@@ -3908,7 +3896,7 @@ static int me4000_ai_immediate_stop(me4000_ai_context_t * ai_context)
 	return 0;
 }
 
-static int me4000_ai_ex_trig_enable(me4000_ai_context_t * ai_context)
+static int me4000_ai_ex_trig_enable(struct me4000_ai_context *ai_context)
 {
 	u32 tmp;
 	unsigned long flags;
@@ -3924,7 +3912,7 @@ static int me4000_ai_ex_trig_enable(me4000_ai_context_t * ai_context)
 	return 0;
 }
 
-static int me4000_ai_ex_trig_disable(me4000_ai_context_t * ai_context)
+static int me4000_ai_ex_trig_disable(struct me4000_ai_context *ai_context)
 {
 	u32 tmp;
 	unsigned long flags;
@@ -3940,10 +3928,10 @@ static int me4000_ai_ex_trig_disable(me4000_ai_context_t * ai_context)
 	return 0;
 }
 
-static int me4000_ai_ex_trig_setup(me4000_ai_trigger_t * arg,
-				   me4000_ai_context_t * ai_context)
+static int me4000_ai_ex_trig_setup(struct me4000_ai_trigger *arg,
+				   struct me4000_ai_context *ai_context)
 {
-	me4000_ai_trigger_t cmd;
+	struct me4000_ai_trigger cmd;
 	int err;
 	u32 tmp;
 	unsigned long flags;
@@ -3951,7 +3939,7 @@ static int me4000_ai_ex_trig_setup(me4000_ai_trigger_t * arg,
 	CALL_PDEBUG("me4000_ai_ex_trig_setup() is executed\n");
 
 	/* Copy data from user */
-	err = copy_from_user(&cmd, arg, sizeof(me4000_ai_trigger_t));
+	err = copy_from_user(&cmd, arg, sizeof(struct me4000_ai_trigger));
 	if (err) {
 		printk(KERN_ERR
 		       "ME4000:me4000_ai_ex_trig_setup():Can't copy from user space\n");
@@ -4000,16 +3988,16 @@ static int me4000_ai_ex_trig_setup(me4000_ai_trigger_t * arg,
 	return 0;
 }
 
-static int me4000_ai_sc_setup(me4000_ai_sc_t * arg,
-			      me4000_ai_context_t * ai_context)
+static int me4000_ai_sc_setup(struct me4000_ai_sc *arg,
+			      struct me4000_ai_context *ai_context)
 {
-	me4000_ai_sc_t cmd;
+	struct me4000_ai_sc cmd;
 	int err;
 
 	CALL_PDEBUG("me4000_ai_sc_setup() is executed\n");
 
 	/* Copy data from user */
-	err = copy_from_user(&cmd, arg, sizeof(me4000_ai_sc_t));
+	err = copy_from_user(&cmd, arg, sizeof(struct me4000_ai_sc));
 	if (err) {
 		printk(KERN_ERR
 		       "ME4000:me4000_ai_sc_setup():Can't copy from user space\n");
@@ -4023,9 +4011,9 @@ static int me4000_ai_sc_setup(me4000_ai_sc_t * arg,
 }
 
 static ssize_t me4000_ai_read(struct file *filep, char *buff, size_t cnt,
-			      loff_t * offp)
+			      loff_t *offp)
 {
-	me4000_ai_context_t *ai_context = filep->private_data;
+	struct me4000_ai_context *ai_context = filep->private_data;
 	s16 *buffer = (s16 *) buff;
 	size_t count = cnt / 2;
 	unsigned long flags;
@@ -4150,9 +4138,9 @@ static ssize_t me4000_ai_read(struct file *filep, char *buff, size_t cnt,
 	return ret * 2;
 }
 
-static unsigned int me4000_ai_poll(struct file *file_p, poll_table * wait)
+static unsigned int me4000_ai_poll(struct file *file_p, poll_table *wait)
 {
-	me4000_ai_context_t *ai_context;
+	struct me4000_ai_context *ai_context;
 	unsigned long mask = 0;
 
 	CALL_PDEBUG("me4000_ai_poll() is executed\n");
@@ -4171,7 +4159,7 @@ static unsigned int me4000_ai_poll(struct file *file_p, poll_table * wait)
 	return mask;
 }
 
-static int me4000_ai_offset_enable(me4000_ai_context_t * ai_context)
+static int me4000_ai_offset_enable(struct me4000_ai_context *ai_context)
 {
 	unsigned long tmp;
 
@@ -4184,7 +4172,7 @@ static int me4000_ai_offset_enable(me4000_ai_context_t * ai_context)
 	return 0;
 }
 
-static int me4000_ai_offset_disable(me4000_ai_context_t * ai_context)
+static int me4000_ai_offset_disable(struct me4000_ai_context *ai_context)
 {
 	unsigned long tmp;
 
@@ -4197,7 +4185,7 @@ static int me4000_ai_offset_disable(me4000_ai_context_t * ai_context)
 	return 0;
 }
 
-static int me4000_ai_fullscale_enable(me4000_ai_context_t * ai_context)
+static int me4000_ai_fullscale_enable(struct me4000_ai_context *ai_context)
 {
 	unsigned long tmp;
 
@@ -4210,7 +4198,7 @@ static int me4000_ai_fullscale_enable(me4000_ai_context_t * ai_context)
 	return 0;
 }
 
-static int me4000_ai_fullscale_disable(me4000_ai_context_t * ai_context)
+static int me4000_ai_fullscale_disable(struct me4000_ai_context *ai_context)
 {
 	unsigned long tmp;
 
@@ -4223,7 +4211,7 @@ static int me4000_ai_fullscale_disable(me4000_ai_context_t * ai_context)
 	return 0;
 }
 
-static int me4000_ai_fsm_state(int *arg, me4000_ai_context_t * ai_context)
+static int me4000_ai_fsm_state(int *arg, struct me4000_ai_context *ai_context)
 {
 	unsigned long tmp;
 
@@ -4242,7 +4230,7 @@ static int me4000_ai_fsm_state(int *arg, me4000_ai_context_t * ai_context)
 }
 
 static int me4000_ai_get_count_buffer(unsigned long *arg,
-				      me4000_ai_context_t * ai_context)
+				      struct me4000_ai_context *ai_context)
 {
 	unsigned long c;
 	int err;
@@ -4252,7 +4240,7 @@ static int me4000_ai_get_count_buffer(unsigned long *arg,
 	err = copy_to_user(arg, &c, sizeof(unsigned long));
 	if (err) {
 		printk(KERN_ERR
-		       "ME4000:me4000_ai_get_count_buffer():Can't copy to user space\n");
+		       "%s:Can't copy to user space\n", __func__);
 		return -EFAULT;
 	}
 
@@ -4261,7 +4249,7 @@ static int me4000_ai_get_count_buffer(unsigned long *arg,
 
 /*---------------------------------- EEPROM stuff ---------------------------*/
 
-static int eeprom_write_cmd(me4000_ai_context_t * ai_context, unsigned long cmd,
+static int eeprom_write_cmd(struct me4000_ai_context *ai_context, unsigned long cmd,
 			    int length)
 {
 	int i;
@@ -4318,7 +4306,7 @@ static int eeprom_write_cmd(me4000_ai_context_t * ai_context, unsigned long cmd,
 	return 0;
 }
 
-static unsigned short eeprom_read_cmd(me4000_ai_context_t * ai_context,
+static unsigned short eeprom_read_cmd(struct me4000_ai_context *ai_context,
 				      unsigned long cmd, int length)
 {
 	int i;
@@ -4397,11 +4385,11 @@ static unsigned short eeprom_read_cmd(me4000_ai_context_t * ai_context,
 	return id;
 }
 
-static int me4000_eeprom_write(me4000_eeprom_t * arg,
-			       me4000_ai_context_t * ai_context)
+static int me4000_eeprom_write(struct me4000_eeprom *arg,
+			       struct me4000_ai_context *ai_context)
 {
 	int err;
-	me4000_eeprom_t setup;
+	struct me4000_eeprom setup;
 	unsigned long cmd;
 	unsigned long date_high;
 	unsigned long date_low;
@@ -4594,12 +4582,12 @@ static int me4000_eeprom_write(me4000_eeprom_t * arg,
 	return 0;
 }
 
-static int me4000_eeprom_read(me4000_eeprom_t * arg,
-			      me4000_ai_context_t * ai_context)
+static int me4000_eeprom_read(struct me4000_eeprom *arg,
+			      struct me4000_ai_context *ai_context)
 {
 	int err;
 	unsigned long cmd;
-	me4000_eeprom_t setup;
+	struct me4000_eeprom setup;
 
 	CALL_PDEBUG("me4000_eeprom_read() is executed\n");
 
@@ -4687,7 +4675,7 @@ static int me4000_eeprom_read(me4000_eeprom_t * arg,
 static int me4000_dio_ioctl(struct inode *inode_p, struct file *file_p,
 			    unsigned int service, unsigned long arg)
 {
-	me4000_dio_context_t *dio_context;
+	struct me4000_dio_context *dio_context;
 
 	CALL_PDEBUG("me4000_dio_ioctl() is executed\n");
 
@@ -4704,13 +4692,13 @@ static int me4000_dio_ioctl(struct inode *inode_p, struct file *file_p,
 
 	switch (service) {
 	case ME4000_DIO_CONFIG:
-		return me4000_dio_config((me4000_dio_config_t *) arg,
+		return me4000_dio_config((struct me4000_dio_config *)arg,
 					 dio_context);
 	case ME4000_DIO_SET_BYTE:
-		return me4000_dio_set_byte((me4000_dio_byte_t *) arg,
+		return me4000_dio_set_byte((struct me4000_dio_byte *)arg,
 					   dio_context);
 	case ME4000_DIO_GET_BYTE:
-		return me4000_dio_get_byte((me4000_dio_byte_t *) arg,
+		return me4000_dio_get_byte((struct me4000_dio_byte *)arg,
 					   dio_context);
 	case ME4000_DIO_RESET:
 		return me4000_dio_reset(dio_context);
@@ -4723,17 +4711,17 @@ static int me4000_dio_ioctl(struct inode *inode_p, struct file *file_p,
 	return 0;
 }
 
-static int me4000_dio_config(me4000_dio_config_t * arg,
-			     me4000_dio_context_t * dio_context)
+static int me4000_dio_config(struct me4000_dio_config *arg,
+			     struct me4000_dio_context *dio_context)
 {
-	me4000_dio_config_t cmd;
+	struct me4000_dio_config cmd;
 	u32 tmp;
 	int err;
 
 	CALL_PDEBUG("me4000_dio_config() is executed\n");
 
 	/* Copy data from user */
-	err = copy_from_user(&cmd, arg, sizeof(me4000_dio_config_t));
+	err = copy_from_user(&cmd, arg, sizeof(struct me4000_dio_config));
 	if (err) {
 		printk(KERN_ERR
 		       "ME4000:me4000_dio_config():Can't copy from user space\n");
@@ -4964,16 +4952,16 @@ static int me4000_dio_config(me4000_dio_config_t * arg,
 	return 0;
 }
 
-static int me4000_dio_set_byte(me4000_dio_byte_t * arg,
-			       me4000_dio_context_t * dio_context)
+static int me4000_dio_set_byte(struct me4000_dio_byte *arg,
+			       struct me4000_dio_context *dio_context)
 {
-	me4000_dio_byte_t cmd;
+	struct me4000_dio_byte cmd;
 	int err;
 
 	CALL_PDEBUG("me4000_dio_set_byte() is executed\n");
 
 	/* Copy data from user */
-	err = copy_from_user(&cmd, arg, sizeof(me4000_dio_byte_t));
+	err = copy_from_user(&cmd, arg, sizeof(struct me4000_dio_byte));
 	if (err) {
 		printk(KERN_ERR
 		       "ME4000:me4000_dio_set_byte():Can't copy from user space\n");
@@ -5030,16 +5018,16 @@ static int me4000_dio_set_byte(me4000_dio_byte_t * arg,
 	return 0;
 }
 
-static int me4000_dio_get_byte(me4000_dio_byte_t * arg,
-			       me4000_dio_context_t * dio_context)
+static int me4000_dio_get_byte(struct me4000_dio_byte *arg,
+			       struct me4000_dio_context *dio_context)
 {
-	me4000_dio_byte_t cmd;
+	struct me4000_dio_byte cmd;
 	int err;
 
 	CALL_PDEBUG("me4000_dio_get_byte() is executed\n");
 
 	/* Copy data from user */
-	err = copy_from_user(&cmd, arg, sizeof(me4000_dio_byte_t));
+	err = copy_from_user(&cmd, arg, sizeof(struct me4000_dio_byte));
 	if (err) {
 		printk(KERN_ERR
 		       "ME4000:me4000_dio_get_byte():Can't copy from user space\n");
@@ -5070,7 +5058,7 @@ static int me4000_dio_get_byte(me4000_dio_byte_t * arg,
 	}
 
 	/* Copy result back to user */
-	err = copy_to_user(arg, &cmd, sizeof(me4000_dio_byte_t));
+	err = copy_to_user(arg, &cmd, sizeof(struct me4000_dio_byte));
 	if (err) {
 		printk(KERN_ERR
 		       "ME4000:me4000_dio_get_byte():Can't copy to user space\n");
@@ -5080,7 +5068,7 @@ static int me4000_dio_get_byte(me4000_dio_byte_t * arg,
 	return 0;
 }
 
-static int me4000_dio_reset(me4000_dio_context_t * dio_context)
+static int me4000_dio_reset(struct me4000_dio_context *dio_context)
 {
 	CALL_PDEBUG("me4000_dio_reset() is executed\n");
 
@@ -5101,7 +5089,7 @@ static int me4000_dio_reset(me4000_dio_context_t * dio_context)
 static int me4000_cnt_ioctl(struct inode *inode_p, struct file *file_p,
 			    unsigned int service, unsigned long arg)
 {
-	me4000_cnt_context_t *cnt_context;
+	struct me4000_cnt_context *cnt_context;
 
 	CALL_PDEBUG("me4000_cnt_ioctl() is executed\n");
 
@@ -5118,11 +5106,11 @@ static int me4000_cnt_ioctl(struct inode *inode_p, struct file *file_p,
 
 	switch (service) {
 	case ME4000_CNT_READ:
-		return me4000_cnt_read((me4000_cnt_t *) arg, cnt_context);
+		return me4000_cnt_read((struct me4000_cnt *)arg, cnt_context);
 	case ME4000_CNT_WRITE:
-		return me4000_cnt_write((me4000_cnt_t *) arg, cnt_context);
+		return me4000_cnt_write((struct me4000_cnt *)arg, cnt_context);
 	case ME4000_CNT_CONFIG:
-		return me4000_cnt_config((me4000_cnt_config_t *) arg,
+		return me4000_cnt_config((struct me4000_cnt_config *)arg,
 					 cnt_context);
 	case ME4000_CNT_RESET:
 		return me4000_cnt_reset(cnt_context);
@@ -5135,10 +5123,10 @@ static int me4000_cnt_ioctl(struct inode *inode_p, struct file *file_p,
 	return 0;
 }
 
-static int me4000_cnt_config(me4000_cnt_config_t * arg,
-			     me4000_cnt_context_t * cnt_context)
+static int me4000_cnt_config(struct me4000_cnt_config *arg,
+			     struct me4000_cnt_context *cnt_context)
 {
-	me4000_cnt_config_t cmd;
+	struct me4000_cnt_config cmd;
 	u8 counter;
 	u8 mode;
 	int err;
@@ -5146,7 +5134,7 @@ static int me4000_cnt_config(me4000_cnt_config_t * arg,
 	CALL_PDEBUG("me4000_cnt_config() is executed\n");
 
 	/* Copy data from user */
-	err = copy_from_user(&cmd, arg, sizeof(me4000_cnt_config_t));
+	err = copy_from_user(&cmd, arg, sizeof(struct me4000_cnt_config));
 	if (err) {
 		printk(KERN_ERR
 		       "ME4000:me4000_cnt_config():Can't copy from user space\n");
@@ -5204,17 +5192,17 @@ static int me4000_cnt_config(me4000_cnt_config_t * arg,
 	return 0;
 }
 
-static int me4000_cnt_read(me4000_cnt_t * arg,
-			   me4000_cnt_context_t * cnt_context)
+static int me4000_cnt_read(struct me4000_cnt *arg,
+			   struct me4000_cnt_context *cnt_context)
 {
-	me4000_cnt_t cmd;
+	struct me4000_cnt cmd;
 	u8 tmp;
 	int err;
 
 	CALL_PDEBUG("me4000_cnt_read() is executed\n");
 
 	/* Copy data from user */
-	err = copy_from_user(&cmd, arg, sizeof(me4000_cnt_t));
+	err = copy_from_user(&cmd, arg, sizeof(struct me4000_cnt));
 	if (err) {
 		printk(KERN_ERR
 		       "ME4000:me4000_cnt_read():Can't copy from user space\n");
@@ -5249,7 +5237,7 @@ static int me4000_cnt_read(me4000_cnt_t * arg,
 	}
 
 	/* Copy result back to user */
-	err = copy_to_user(arg, &cmd, sizeof(me4000_cnt_t));
+	err = copy_to_user(arg, &cmd, sizeof(struct me4000_cnt));
 	if (err) {
 		printk(KERN_ERR
 		       "ME4000:me4000_cnt_read():Can't copy to user space\n");
@@ -5259,17 +5247,17 @@ static int me4000_cnt_read(me4000_cnt_t * arg,
 	return 0;
 }
 
-static int me4000_cnt_write(me4000_cnt_t * arg,
-			    me4000_cnt_context_t * cnt_context)
+static int me4000_cnt_write(struct me4000_cnt *arg,
+			    struct me4000_cnt_context *cnt_context)
 {
-	me4000_cnt_t cmd;
+	struct me4000_cnt cmd;
 	u8 tmp;
 	int err;
 
 	CALL_PDEBUG("me4000_cnt_write() is executed\n");
 
 	/* Copy data from user */
-	err = copy_from_user(&cmd, arg, sizeof(me4000_cnt_t));
+	err = copy_from_user(&cmd, arg, sizeof(struct me4000_cnt));
 	if (err) {
 		printk(KERN_ERR
 		       "ME4000:me4000_cnt_write():Can't copy from user space\n");
@@ -5306,7 +5294,7 @@ static int me4000_cnt_write(me4000_cnt_t * arg,
 	return 0;
 }
 
-static int me4000_cnt_reset(me4000_cnt_context_t * cnt_context)
+static int me4000_cnt_reset(struct me4000_cnt_context *cnt_context)
 {
 	CALL_PDEBUG("me4000_cnt_reset() is executed\n");
 
@@ -5333,7 +5321,7 @@ static int me4000_cnt_reset(me4000_cnt_context_t * cnt_context)
 static int me4000_ext_int_ioctl(struct inode *inode_p, struct file *file_p,
 				unsigned int service, unsigned long arg)
 {
-	me4000_ext_int_context_t *ext_int_context;
+	struct me4000_ext_int_context *ext_int_context;
 
 	CALL_PDEBUG("me4000_ext_int_ioctl() is executed\n");
 
@@ -5366,7 +5354,7 @@ static int me4000_ext_int_ioctl(struct inode *inode_p, struct file *file_p,
 	return 0;
 }
 
-static int me4000_ext_int_enable(me4000_ext_int_context_t * ext_int_context)
+static int me4000_ext_int_enable(struct me4000_ext_int_context *ext_int_context)
 {
 	unsigned long tmp;
 
@@ -5379,7 +5367,7 @@ static int me4000_ext_int_enable(me4000_ext_int_context_t * ext_int_context)
 	return 0;
 }
 
-static int me4000_ext_int_disable(me4000_ext_int_context_t * ext_int_context)
+static int me4000_ext_int_disable(struct me4000_ext_int_context *ext_int_context)
 {
 	unsigned long tmp;
 
@@ -5393,7 +5381,7 @@ static int me4000_ext_int_disable(me4000_ext_int_context_t * ext_int_context)
 }
 
 static int me4000_ext_int_count(unsigned long *arg,
-				me4000_ext_int_context_t * ext_int_context)
+				struct me4000_ext_int_context *ext_int_context)
 {
 
 	CALL_PDEBUG("me4000_ext_int_count() is executed\n");
@@ -5404,10 +5392,10 @@ static int me4000_ext_int_count(unsigned long *arg,
 
 /*------------------------------------ General stuff ------------------------------------*/
 
-static int me4000_get_user_info(me4000_user_info_t * arg,
-				me4000_info_t * board_info)
+static int me4000_get_user_info(struct me4000_user_info *arg,
+				struct me4000_info *board_info)
 {
-	me4000_user_info_t user_info;
+	struct me4000_user_info user_info;
 
 	CALL_PDEBUG("me4000_get_user_info() is executed\n");
 
@@ -5437,7 +5425,7 @@ static int me4000_get_user_info(me4000_user_info_t * arg,
 
 	user_info.cnt_count = board_info->board_p->cnt.count;
 
-	if (copy_to_user(arg, &user_info, sizeof(me4000_user_info_t)))
+	if (copy_to_user(arg, &user_info, sizeof(struct me4000_user_info)))
 		return -EFAULT;
 
 	return 0;
@@ -5448,7 +5436,7 @@ static int me4000_get_user_info(me4000_user_info_t * arg,
 static int me4000_ext_int_fasync(int fd, struct file *file_ptr, int mode)
 {
 	int result = 0;
-	me4000_ext_int_context_t *ext_int_context;
+	struct me4000_ext_int_context *ext_int_context;
 
 	CALL_PDEBUG("me4000_ext_int_fasync() is executed\n");
 
@@ -5465,7 +5453,7 @@ static irqreturn_t me4000_ao_isr(int irq, void *dev_id)
 {
 	u32 tmp;
 	u32 value;
-	me4000_ao_context_t *ao_context;
+	struct me4000_ao_context *ao_context;
 	int i;
 	int c = 0;
 	int c1 = 0;
@@ -5589,7 +5577,7 @@ static irqreturn_t me4000_ao_isr(int irq, void *dev_id)
 static irqreturn_t me4000_ai_isr(int irq, void *dev_id)
 {
 	u32 tmp;
-	me4000_ai_context_t *ai_context;
+	struct me4000_ai_context *ai_context;
 	int i;
 	int c = 0;
 	int c1 = 0;
@@ -5933,7 +5921,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id)
 
 static irqreturn_t me4000_ext_int_isr(int irq, void *dev_id)
 {
-	me4000_ext_int_context_t *ext_int_context;
+	struct me4000_ext_int_context *ext_int_context;
 	unsigned long tmp;
 
 	ISR_PDEBUG("me4000_ext_int_isr() is executed\n");
@@ -5969,10 +5957,10 @@ static irqreturn_t me4000_ext_int_isr(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-void __exit me4000_module_exit(void)
+static void __exit me4000_module_exit(void)
 {
 	struct list_head *board_p;
-	me4000_info_t *board_info;
+	struct me4000_info *board_info;
 
 	CALL_PDEBUG("cleanup_module() is executed\n");
 
@@ -5993,7 +5981,7 @@ void __exit me4000_module_exit(void)
 	/* Reset the boards */
 	for (board_p = me4000_board_info_list.next;
 	     board_p != &me4000_board_info_list; board_p = board_p->next) {
-		board_info = list_entry(board_p, me4000_info_t, list);
+		board_info = list_entry(board_p, struct me4000_info, list);
 		me4000_reset_board(board_info);
 	}
 
@@ -6007,7 +5995,7 @@ static int me4000_read_procmem(char *buf, char **start, off_t offset, int count,
 {
 	int len = 0;
 	int limit = count - 1000;
-	me4000_info_t *board_info;
+	struct me4000_info *board_info;
 	struct list_head *ptr;
 
 	len += sprintf(buf + len, "\nME4000 DRIVER VERSION %X.%X.%X\n\n",
@@ -6019,7 +6007,7 @@ static int me4000_read_procmem(char *buf, char **start, off_t offset, int count,
 	for (ptr = me4000_board_info_list.next;
 	     (ptr != &me4000_board_info_list) && (len < limit);
 	     ptr = ptr->next) {
-		board_info = list_entry(ptr, me4000_info_t, list);
+		board_info = list_entry(ptr, struct me4000_info, list);
 
 		len +=
 		    sprintf(buf + len, "Board number %d:\n",
drivers/staging/me4000/me4000.h +103 -91

431 lines not on this page · raw message

Signature · 1 line
1.6.0.2
#15 lore raw

PATCH 9/42 Staging: SLICOSS: remove duplicated #include's

In reply to Greg KH

From: Huang Weiyi <[email protected]>

Removed duplicated #include's in drivers/staging/slicoss/slicoss.c.
linux/delay.h
linux/etherdevice.h
linux/init.h
linux/netdevice.h
linux/pci.h
linux/skbuff.h
linux/slab.h
linux/string.h

---
 drivers/staging/slicoss/slicoss.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)
drivers/staging/slicoss/slicoss.c +0 -8
index 47b0ae1..69f3ea2 100644
@@ -96,17 +96,9 @@
 #include <linux/moduleparam.h>
 
 #include <linux/types.h>
-#include <linux/slab.h>
-#include <linux/delay.h>
-#include <linux/init.h>
-#include <linux/pci.h>
 #include <linux/dma-mapping.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
 #include <linux/mii.h>
 #include <linux/if_vlan.h>
-#include <linux/skbuff.h>
-#include <linux/string.h>
 #include <asm/unaligned.h>
 
 #include <linux/ethtool.h>
Signature · 1 line
1.6.0.2
#16 lore raw

PATCH 10/42 Staging: et131x: remove duplicated #include's

In reply to Greg KH

From: Huang Weiyi <[email protected]>

Removed duplicated #include's in file(s) below,
- drivers/staging/et131x/et1310_phy.c

      et1310_jagcore.h
      linux/delay.h
 - drivers/staging/et131x/et131x_debug.c
      et1310_jagcore.h
 - drivers/staging/et131x/et131x_initpci.c
      et1310_jagcore.h
---
 drivers/staging/et131x/et1310_phy.c     |    2 --
 drivers/staging/et131x/et131x_debug.c   |    1 -
 drivers/staging/et131x/et131x_initpci.c |    1 -
 3 files changed, 0 insertions(+), 4 deletions(-)
drivers/staging/et131x/et1310_phy.c +0 -2
index 6c4fa54..9dd6dfd 100644
@@ -84,7 +84,6 @@
 #include <linux/if_arp.h>
 #include <linux/ioport.h>
 #include <linux/random.h>
-#include <linux/delay.h>
 
 #include "et1310_phy.h"
 #include "et1310_pm.h"
@@ -95,7 +94,6 @@
 #include "et131x_initpci.h"
 
 #include "et1310_address_map.h"
-#include "et1310_jagcore.h"
 #include "et1310_tx.h"
 #include "et1310_rx.h"
 #include "et1310_mac.h"
drivers/staging/et131x/et131x_debug.c +0 -1
index 9ee5bce..d1dd46e 100644
@@ -97,7 +97,6 @@
 #include "et131x_isr.h"
 
 #include "et1310_address_map.h"
-#include "et1310_jagcore.h"
 #include "et1310_tx.h"
 #include "et1310_rx.h"
 #include "et1310_mac.h"
drivers/staging/et131x/et131x_initpci.c +0 -1
index 4c6f171..a18c499 100644
@@ -97,7 +97,6 @@
 #include "et131x_isr.h"
 
 #include "et1310_address_map.h"
-#include "et1310_jagcore.h"
 #include "et1310_tx.h"
 #include "et1310_rx.h"
 #include "et1310_mac.h"
Signature · 1 line
1.6.0.2
#17 lore raw

PATCH 11/42 Staging: wlan-ng: prism2: remove duplicated #include

In reply to Greg KH

From: Huang Weiyi <[email protected]>

Removed duplicated #include "wlan_compat.h" in
drivers/staging/wlan-ng/prism2mib.c.

---
 drivers/staging/wlan-ng/prism2mib.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/staging/wlan-ng/prism2mib.c +0 -2
index 268fd9b..eac06f7 100644
@@ -90,8 +90,6 @@
 #include <linux/usb.h>
 //#endif
 
-#include "wlan_compat.h"
-
 /*================================================================*/
 /* Project Includes */
 
Signature · 1 line
1.6.0.2
#18 lore raw

PATCH 12/42 staging: wlan-ng: prism2: remove more duplicated #include

In reply to Greg KH

From: Huang Weiyi <[email protected]>

Removed duplicated #include "version.h" in
drivers/staging/wlan-ng/p80211wep.c.

---
 drivers/staging/wlan-ng/p80211wep.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/staging/wlan-ng/p80211wep.c +0 -1
index 53fe298..11a50c7 100644
@@ -64,7 +64,6 @@
 /*================================================================*/
 /* Project Includes */
 
-#include "version.h"
 #include "p80211hdr.h"
 #include "p80211types.h"
 #include "p80211msg.h"
Signature · 1 line
1.6.0.2
#19 lore raw

PATCH 13/42 Staging: go7007: remove unused #include <version.h>

In reply to Greg KH

From: Huang Weiyi <[email protected]>

The file(s) below do not use LINUX_VERSION_CODE nor KERNEL_VERSION.
drivers/staging/go7007/go7007-driver.c drivers/staging/go7007/go7007-fw.c drivers/staging/go7007/go7007-i2c.c drivers/staging/go7007/go7007-usb.c drivers/staging/go7007/snd-go7007.c drivers/staging/go7007/wis-ov7640.c drivers/staging/go7007/wis-saa7113.c drivers/staging/go7007/wis-saa7115.c drivers/staging/go7007/wis-sony-tuner.c drivers/staging/go7007/wis-tw2804.c drivers/staging/go7007/wis-tw9903.c drivers/staging/go7007/wis-uda1342.c

This patch removes the said #include <version.h>.

---
 drivers/staging/go7007/go7007-driver.c  |    1 -
 drivers/staging/go7007/go7007-fw.c      |    1 -
 drivers/staging/go7007/go7007-i2c.c     |    1 -
 drivers/staging/go7007/go7007-usb.c     |    1 -
 drivers/staging/go7007/snd-go7007.c     |    1 -
 drivers/staging/go7007/wis-ov7640.c     |    1 -
 drivers/staging/go7007/wis-saa7113.c    |    1 -
 drivers/staging/go7007/wis-saa7115.c    |    1 -
 drivers/staging/go7007/wis-sony-tuner.c |    1 -
 drivers/staging/go7007/wis-tw2804.c     |    1 -
 drivers/staging/go7007/wis-tw9903.c     |    1 -
 drivers/staging/go7007/wis-uda1342.c    |    1 -
 12 files changed, 0 insertions(+), 12 deletions(-)
drivers/staging/go7007/go7007-driver.c +0 -1
index 81ae4b0..e4ead96 100644
@@ -16,7 +16,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/version.h>
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/sched.h>
drivers/staging/go7007/go7007-fw.c +0 -1
index c2aea10..a0e17b0 100644
@@ -26,7 +26,6 @@
 
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/version.h>
 #include <linux/time.h>
 #include <linux/mm.h>
 #include <linux/device.h>
drivers/staging/go7007/go7007-i2c.c +0 -1
index 10baae3..cd55b76 100644
@@ -15,7 +15,6 @@
  * Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
  */
 
-#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/delay.h>
drivers/staging/go7007/go7007-usb.c +0 -1
index d4ed6d2..3f5ee34 100644
@@ -16,7 +16,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/version.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/wait.h>
drivers/staging/go7007/snd-go7007.c +0 -1
index 382740c..a7de401 100644
@@ -17,7 +17,6 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/version.h>
 #include <linux/moduleparam.h>
 #include <linux/init.h>
 #include <linux/spinlock.h>
drivers/staging/go7007/wis-ov7640.c +0 -1
index f5f11e9..2f9efca 100644
@@ -17,7 +17,6 @@
 
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/version.h>
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
 
drivers/staging/go7007/wis-saa7113.c +0 -1
index c1aff1b..1168972 100644
@@ -17,7 +17,6 @@
 
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/version.h>
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
 #include <linux/ioctl.h>
drivers/staging/go7007/wis-saa7115.c +0 -1
index 5c94c88..59417a7 100644
@@ -17,7 +17,6 @@
 
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/version.h>
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
 #include <linux/ioctl.h>
drivers/staging/go7007/wis-sony-tuner.c +0 -1
index 5997fb4..5a91ee4 100644
@@ -17,7 +17,6 @@
 
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/version.h>
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
 #include <media/tuner.h>
drivers/staging/go7007/wis-tw2804.c +0 -1
index 27fe4d0..57b8f2b 100644
@@ -17,7 +17,6 @@
 
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/version.h>
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
 #include <linux/ioctl.h>
drivers/staging/go7007/wis-tw9903.c +0 -1
index d8e4196..40627b2 100644
@@ -17,7 +17,6 @@
 
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/version.h>
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
 #include <linux/ioctl.h>
drivers/staging/go7007/wis-uda1342.c +0 -1
index a0894e3..555645c 100644
@@ -17,7 +17,6 @@
 
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/version.h>
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
 #include <media/tvaudio.h>
Signature · 1 line
1.6.0.2
#20 lore raw

PATCH 14/42 Staging: SLICOSS: remove unused #include <version.h>

In reply to Greg KH

From: Huang Weiyi <[email protected]>

The file(s) below do not use LINUX_VERSION_CODE nor KERNEL_VERSION.
drivers/staging/slicoss/slicoss.c

This patch removes the said #include <version.h>.

---
 drivers/staging/slicoss/slicoss.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/staging/slicoss/slicoss.c +0 -1
index 69f3ea2..6ef9274 100644
@@ -54,7 +54,6 @@
  *       IS-NIC driver.
  */
 
-#include <linux/version.h>
 
 #define SLIC_DUMP_ENABLED               0
 #define KLUDGE_FOR_4GB_BOUNDARY         1
Signature · 1 line
1.6.0.2
#21 lore raw

PATCH 15/42 Staging: w35und: remove some typedefs

In reply to Greg KH

From: Pekka Enberg <[email protected]>

This patch removes some obfuscating typedefs from the driver code.

---
 drivers/staging/winbond/bss_f.h           |    6 ++--
 drivers/staging/winbond/ds_tkip.h         |    6 ++--
 drivers/staging/winbond/linux/common.h    |   10 +--------
 drivers/staging/winbond/linux/wb35reg.c   |   26 +++++++++++-----------
 drivers/staging/winbond/linux/wb35reg_f.h |   12 +++++-----
 drivers/staging/winbond/linux/wb35reg_s.h |    2 +-
 drivers/staging/winbond/linux/wb35rx.c    |   16 +++++++-------
 drivers/staging/winbond/linux/wb35rx_s.h  |    2 +-
 drivers/staging/winbond/linux/wb35tx.c    |    8 +++---
 drivers/staging/winbond/linux/wb35tx_f.h  |    2 +-
 drivers/staging/winbond/linux/wbusb.c     |    4 +-
 drivers/staging/winbond/mds.c             |   28 +++++++++++++-----------
 drivers/staging/winbond/mds_f.h           |    6 ++--
 drivers/staging/winbond/mds_s.h           |    8 +++---
 drivers/staging/winbond/mlme_s.h          |    2 +-
 drivers/staging/winbond/mlmetxrx.c        |    4 +-
 drivers/staging/winbond/mlmetxrx_f.h      |    4 +-
 drivers/staging/winbond/reg.c             |   24 ++++++++++----------
 drivers/staging/winbond/sme_api.h         |    2 +-
 drivers/staging/winbond/wbhal.c           |   32 ++++++++++++++--------------
 drivers/staging/winbond/wbhal_f.h         |   28 ++++++++++++------------
 drivers/staging/winbond/wbhal_s.h         |    4 +-
 drivers/staging/winbond/wblinux.c         |    7 +++--
 23 files changed, 119 insertions(+), 124 deletions(-)
drivers/staging/winbond/bss_f.h +3 -3
index c957bc9..0131831 100644
@@ -24,7 +24,7 @@ void DesiredRate2InfoElement(PWB32_ADAPTER Adapter, u8	*addr, u16 *iFildOffset,
 							 u8 *pBasicRateSet, u8 BasicRateCount,
 							 u8 *pOperationRateSet, u8 OperationRateCount);
 void BSSAddIBSSdata(PWB32_ADAPTER Adapter, PWB_BSSDESCRIPTION psDesData);
-unsigned char boCmpMacAddr( PUCHAR, PUCHAR );
+unsigned char boCmpMacAddr( u8 *, u8 *);
 unsigned char boCmpSSID(struct SSID_Element *psSSID1, struct SSID_Element *psSSID2);
 u16 wBSSfindSSID(PWB32_ADAPTER Adapter, struct SSID_Element *psSsid);
 u16 wRoamingQuery(PWB32_ADAPTER Adapter);
@@ -42,11 +42,11 @@ void RateReSortForSRate(PWB32_ADAPTER Adapter, u8 *RateArray, u8 num);
 void Assemble_IE(PWB32_ADAPTER Adapter, u16 wBssIdx);
 void SetMaxTxRate(PWB32_ADAPTER Adapter);
 
-void CreateWpaIE(PWB32_ADAPTER Adapter, u16* iFildOffset, PUCHAR msg, struct  Management_Frame* msgHeader,
+void CreateWpaIE(PWB32_ADAPTER Adapter, u16* iFildOffset, u8 *msg, struct  Management_Frame* msgHeader,
 				 struct Association_Request_Frame_Body* msgBody, u16 iMSindex); //added by WS 05/14/05
 
 #ifdef _WPA2_
-void CreateRsnIE(PWB32_ADAPTER Adapter, u16* iFildOffset, PUCHAR msg, struct  Management_Frame* msgHeader,
+void CreateRsnIE(PWB32_ADAPTER Adapter, u16* iFildOffset, u8 *msg, struct  Management_Frame* msgHeader,
 				 struct Association_Request_Frame_Body* msgBody, u16 iMSindex);//added by WS 05/14/05
 
 u16 SearchPmkid(PWB32_ADAPTER Adapter, struct  Management_Frame* msgHeader,
drivers/staging/winbond/ds_tkip.h +3 -3
index 29e5055..6841d66 100644
@@ -25,9 +25,9 @@ typedef struct tkip
 	s32		bytes_in_M;	// # bytes in M
 } tkip_t;
 
-//void _append_data( PUCHAR pData, u16 size, tkip_t *p );
-void Mds_MicGet(  void* Adapter,  void* pRxLayer1,  PUCHAR pKey,  PUCHAR pMic );
-void Mds_MicFill(  void* Adapter,  void* pDes,  PUCHAR XmitBufAddress );
+//void _append_data( u8 *pData, u16 size, tkip_t *p );
+void Mds_MicGet(  void* Adapter,  void* pRxLayer1,  u8 *pKey,  u8 *pMic );
+void Mds_MicFill(  void* Adapter,  void* pDes,  u8 *XmitBufAddress );
 
 
 
drivers/staging/winbond/linux/common.h +1 -9
index 6b00bad..c8f14b7 100644
@@ -39,14 +39,6 @@
 // Common type definition
 //===============================================================
 
-typedef u8*            PUCHAR;
-typedef s8*            PCHAR;
-typedef u8*            PBOOLEAN;
-typedef u16*           PUSHORT;
-typedef u32*           PULONG;
-typedef s16*   PSHORT;
-
-
 //===========================================
 #define IGNORE      2
 #define	SUCCESS     1
@@ -110,7 +102,7 @@ typedef struct urb * PURB;
 #define OS_ATOMIC_READ( _A, _V )	_V
 #define OS_ATOMIC_INC( _A, _V )		EncapAtomicInc( _A, (void*)_V )
 #define OS_ATOMIC_DEC( _A, _V )		EncapAtomicDec( _A, (void*)_V )
-#define OS_MEMORY_CLEAR( _A, _S )	memset( (PUCHAR)_A,0,_S)
+#define OS_MEMORY_CLEAR( _A, _S )	memset( (u8 *)_A,0,_S)
 #define OS_MEMORY_COMPARE( _A, _B, _S )	(memcmp(_A,_B,_S)? 0 : 1) // Definition is reverse with Ndis 1: the same 0: different
 
 
drivers/staging/winbond/linux/wb35reg.c +13 -13
index 2c0b454..5c28ec9 100644
@@ -10,7 +10,7 @@ extern void phy_calibration_winbond(hw_data_t *phw_data, u32 frequency);
 // Flag : AUTO_INCREMENT - RegisterNo will auto increment 4
 //		  NO_INCREMENT - Function will write data into the same register
 unsigned char
-Wb35Reg_BurstWrite(phw_data_t pHwData, u16 RegisterNo, PULONG pRegisterData, u8 NumberOfData, u8 Flag)
+Wb35Reg_BurstWrite(phw_data_t pHwData, u16 RegisterNo, u32 * pRegisterData, u8 NumberOfData, u8 Flag)
 {
 	PWB35REG pWb35Reg = &pHwData->Wb35Reg;
 	PURB		pUrb = NULL;
@@ -30,13 +30,13 @@ Wb35Reg_BurstWrite(phw_data_t pHwData, u16 RegisterNo, PULONG pRegisterData, u8
 	if( pUrb && pRegQueue ) {
 		pRegQueue->DIRECT = 2;// burst write register
 		pRegQueue->INDEX = RegisterNo;
-		pRegQueue->pBuffer = (PULONG)((PUCHAR)pRegQueue + sizeof(REG_QUEUE));
+		pRegQueue->pBuffer = (u32 *)((u8 *)pRegQueue + sizeof(REG_QUEUE));
 		memcpy( pRegQueue->pBuffer, pRegisterData, DataSize );
 		//the function for reversing register data from little endian to big endian
 		for( i=0; i<NumberOfData ; i++ )
 			pRegQueue->pBuffer[i] = cpu_to_le32( pRegQueue->pBuffer[i] );
 
-		dr = (struct usb_ctrlrequest *)((PUCHAR)pRegQueue + sizeof(REG_QUEUE) + DataSize);
+		dr = (struct usb_ctrlrequest *)((u8 *)pRegQueue + sizeof(REG_QUEUE) + DataSize);
 		dr->bRequestType = USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE;
 		dr->bRequest = 0x04; // USB or vendor-defined request code, burst mode
 		dr->wValue = cpu_to_le16( Flag ); // 0: Register number auto-increment, 1: No auto increment
@@ -181,7 +181,7 @@ Wb35Reg_Write(  phw_data_t pHwData,  u16 RegisterNo,  u32 RegisterValue )
 		pRegQueue->INDEX = RegisterNo;
 		pRegQueue->VALUE = cpu_to_le32(RegisterValue);
 		pRegQueue->RESERVED_VALID = FALSE;
-		dr = (struct usb_ctrlrequest *)((PUCHAR)pRegQueue + sizeof(REG_QUEUE));
+		dr = (struct usb_ctrlrequest *)((u8 *)pRegQueue + sizeof(REG_QUEUE));
 		dr->bRequestType = USB_TYPE_VENDOR|USB_DIR_OUT |USB_RECIP_DEVICE;
 		dr->bRequest = 0x03; // USB or vendor-defined request code, burst mode
 		dr->wValue = cpu_to_le16(0x0);
@@ -220,7 +220,7 @@ Wb35Reg_Write(  phw_data_t pHwData,  u16 RegisterNo,  u32 RegisterValue )
 // FALSE : register not support
 unsigned char
 Wb35Reg_WriteWithCallbackValue( phw_data_t pHwData, u16 RegisterNo, u32 RegisterValue,
-				PCHAR pValue, s8 Len)
+				s8 *pValue, s8 Len)
 {
 	PWB35REG	pWb35Reg = &pHwData->Wb35Reg;
 	struct usb_ctrlrequest *dr;
@@ -243,7 +243,7 @@ Wb35Reg_WriteWithCallbackValue( phw_data_t pHwData, u16 RegisterNo, u32 Register
 		//NOTE : Users must guarantee the size of value will not exceed the buffer size.
 		memcpy(pRegQueue->RESERVED, pValue, Len);
 		pRegQueue->RESERVED_VALID = TRUE;
-		dr = (struct usb_ctrlrequest *)((PUCHAR)pRegQueue + sizeof(REG_QUEUE));
+		dr = (struct usb_ctrlrequest *)((u8 *)pRegQueue + sizeof(REG_QUEUE));
 		dr->bRequestType = USB_TYPE_VENDOR|USB_DIR_OUT |USB_RECIP_DEVICE;
 		dr->bRequest = 0x03; // USB or vendor-defined request code, burst mode
 		dr->wValue = cpu_to_le16(0x0);
@@ -278,10 +278,10 @@ Wb35Reg_WriteWithCallbackValue( phw_data_t pHwData, u16 RegisterNo, u32 Register
 // FALSE : register not support
 // pRegisterValue : It must be a resident buffer due to asynchronous read register.
 unsigned char
-Wb35Reg_ReadSync(  phw_data_t pHwData,  u16 RegisterNo,   PULONG pRegisterValue )
+Wb35Reg_ReadSync(  phw_data_t pHwData,  u16 RegisterNo,   u32 * pRegisterValue )
 {
 	PWB35REG pWb35Reg = &pHwData->Wb35Reg;
-	PULONG	pltmp = pRegisterValue;
+	u32 *	pltmp = pRegisterValue;
 	int ret = -1;
 
 	// Module shutdown
@@ -327,7 +327,7 @@ Wb35Reg_ReadSync(  phw_data_t pHwData,  u16 RegisterNo,   PULONG pRegisterValue
 // FALSE : register not support
 // pRegisterValue : It must be a resident buffer due to asynchronous read register.
 unsigned char
-Wb35Reg_Read(phw_data_t pHwData, u16 RegisterNo,  PULONG pRegisterValue )
+Wb35Reg_Read(phw_data_t pHwData, u16 RegisterNo,  u32 * pRegisterValue )
 {
 	PWB35REG	pWb35Reg = &pHwData->Wb35Reg;
 	struct usb_ctrlrequest * dr;
@@ -348,7 +348,7 @@ Wb35Reg_Read(phw_data_t pHwData, u16 RegisterNo,  PULONG pRegisterValue )
 		pRegQueue->DIRECT = 0;// read register
 		pRegQueue->INDEX = RegisterNo;
 		pRegQueue->pBuffer = pRegisterValue;
-		dr = (struct usb_ctrlrequest *)((PUCHAR)pRegQueue + sizeof(REG_QUEUE));
+		dr = (struct usb_ctrlrequest *)((u8 *)pRegQueue + sizeof(REG_QUEUE));
 		dr->bRequestType = USB_TYPE_VENDOR|USB_RECIP_DEVICE|USB_DIR_IN;
 		dr->bRequest = 0x01; // USB or vendor-defined request code, burst mode
 		dr->wValue = cpu_to_le16(0x0);
@@ -399,7 +399,7 @@ Wb35Reg_EP0VM(phw_data_t pHwData )
 	PWB35REG	pWb35Reg = &pHwData->Wb35Reg;
 	PURB		pUrb;
 	struct usb_ctrlrequest *dr;
-	PULONG		pBuffer;
+	u32 *		pBuffer;
 	int			ret = -1;
 	PREG_QUEUE	pRegQueue;
 
@@ -429,7 +429,7 @@ Wb35Reg_EP0VM(phw_data_t pHwData )
 
 	usb_fill_control_urb( pUrb, pHwData->WbUsb.udev,
 			      REG_DIRECTION(pHwData->WbUsb.udev,pRegQueue),
-			      (PUCHAR)dr,pBuffer,cpu_to_le16(dr->wLength),
+			      (u8 *)dr,pBuffer,cpu_to_le16(dr->wLength),
 			      Wb35Reg_EP0VM_complete, (void*)pHwData);
 
 	pWb35Reg->EP0vm_state = VM_RUNNING;
@@ -655,7 +655,7 @@ unsigned char Wb35Reg_initial(phw_data_t pHwData)
 //    version in _GENREQ.ASM of the DWB NE1000/2000 driver.
 //==================================================================================
 u32
-CardComputeCrc(PUCHAR Buffer, u32 Length)
+CardComputeCrc(u8 * Buffer, u32 Length)
 {
     u32 Crc, Carry;
     u32  i, j;
drivers/staging/winbond/linux/wb35reg_f.h +6 -6
index 38e2906..3006cfe 100644
@@ -29,16 +29,16 @@ void EEPROMTxVgaAdjust(  phw_data_t pHwData ); // 20060619.5 Add
 
 void Wb35Reg_destroy(  phw_data_t pHwData );
 
-unsigned char Wb35Reg_Read(  phw_data_t pHwData,  u16 RegisterNo,   PULONG pRegisterValue );
-unsigned char Wb35Reg_ReadSync(  phw_data_t pHwData,  u16 RegisterNo,   PULONG pRegisterValue );
+unsigned char Wb35Reg_Read(  phw_data_t pHwData,  u16 RegisterNo,   u32 * pRegisterValue );
+unsigned char Wb35Reg_ReadSync(  phw_data_t pHwData,  u16 RegisterNo,   u32 * pRegisterValue );
 unsigned char Wb35Reg_Write(  phw_data_t pHwData,  u16 RegisterNo,  u32 RegisterValue );
 unsigned char Wb35Reg_WriteSync(  phw_data_t pHwData,  u16 RegisterNo,  u32 RegisterValue );
 unsigned char Wb35Reg_WriteWithCallbackValue(  phw_data_t pHwData,
 								 u16 RegisterNo,
 								 u32 RegisterValue,
-								 PCHAR pValue,
-								 s8	Len);
-unsigned char Wb35Reg_BurstWrite(  phw_data_t pHwData,  u16 RegisterNo,  PULONG pRegisterData,  u8 NumberOfData,  u8 Flag );
+								 s8 *pValue,
+								 s8 Len);
+unsigned char Wb35Reg_BurstWrite(  phw_data_t pHwData,  u16 RegisterNo,  u32 * pRegisterData,  u8 NumberOfData,  u8 Flag );
 
 void Wb35Reg_EP0VM(  phw_data_t pHwData );
 void Wb35Reg_EP0VM_start(  phw_data_t pHwData );
@@ -47,7 +47,7 @@ void Wb35Reg_EP0VM_complete(  PURB pUrb );
 u32 BitReverse( u32 dwData, u32 DataLength);
 
 void CardGetMulticastBit(   u8 Address[MAC_ADDR_LENGTH],  u8 *Byte,  u8 *Value );
-u32 CardComputeCrc(  PUCHAR Buffer,  u32 Length );
+u32 CardComputeCrc(  u8 * Buffer,  u32 Length );
 
 void Wb35Reg_phy_calibration(  phw_data_t pHwData );
 void Wb35Reg_Update(  phw_data_t pHwData,  u16 RegisterNo,  u32 RegisterValue );
drivers/staging/winbond/linux/wb35reg_s.h +1 -1
index a7595b1..9b76301 100644
@@ -75,7 +75,7 @@ typedef struct _REG_QUEUE
 	union
 	{
 		u32	VALUE;
-		PULONG	pBuffer;
+		u32 *	pBuffer;
 	};
 	u8	RESERVED[4];// space reserved for communication
 
drivers/staging/winbond/linux/wb35rx.c +8 -8
index 26157eb..c5c3317 100644
@@ -27,7 +27,7 @@ void Wb35Rx_start(phw_data_t pHwData)
 void Wb35Rx(  phw_data_t pHwData )
 {
 	PWB35RX	pWb35Rx = &pHwData->Wb35Rx;
-	PUCHAR	pRxBufferAddress;
+	u8 *	pRxBufferAddress;
 	PURB	pUrb = (PURB)pWb35Rx->RxUrb;
 	int	retv;
 	u32	RxBufferId;
@@ -89,7 +89,7 @@ void Wb35Rx_Complete(PURB pUrb)
 {
 	phw_data_t	pHwData = pUrb->context;
 	PWB35RX		pWb35Rx = &pHwData->Wb35Rx;
-	PUCHAR		pRxBufferAddress;
+	u8 *		pRxBufferAddress;
 	u32		SizeCheck;
 	u16		BulkLength;
 	u32		RxBufferId;
@@ -116,7 +116,7 @@ void Wb35Rx_Complete(PURB pUrb)
 
 		// Start to process the data only in successful condition
 		pWb35Rx->RxOwner[ RxBufferId ] = 0; // Set the owner to driver
-		R00.value = le32_to_cpu(*(PULONG)pRxBufferAddress);
+		R00.value = le32_to_cpu(*(u32 *)pRxBufferAddress);
 
 		// The URB is completed, check the result
 		if (pWb35Rx->EP3VM_status != 0) {
@@ -223,7 +223,7 @@ void Wb35Rx_reset_descriptor(  phw_data_t pHwData )
 
 void Wb35Rx_adjust(PDESCRIPTOR pRxDes)
 {
-	PULONG	pRxBufferAddress;
+	u32 *	pRxBufferAddress;
 	u32	DecryptionMethod;
 	u32	i;
 	u16	BufferSize;
@@ -264,7 +264,7 @@ u16 Wb35Rx_indicate(phw_data_t pHwData)
 {
 	DESCRIPTOR	RxDes;
 	PWB35RX	pWb35Rx = &pHwData->Wb35Rx;
-	PUCHAR		pRxBufferAddress;
+	u8 *		pRxBufferAddress;
 	u16		PacketSize;
 	u16		stmp, BufferSize, stmp2 = 0;
 	u32		RxBufferId;
@@ -283,13 +283,13 @@ u16 Wb35Rx_indicate(phw_data_t pHwData)
 
 		// Parse the bulkin buffer
 		while (BufferSize >= 4) {
-			if ((cpu_to_le32(*(PULONG)pRxBufferAddress) & 0x0fffffff) == RX_END_TAG) //Is ending? 921002.9.a
+			if ((cpu_to_le32(*(u32 *)pRxBufferAddress) & 0x0fffffff) == RX_END_TAG) //Is ending? 921002.9.a
 				break;
 
 			// Get the R00 R01 first
-			RxDes.R00.value = le32_to_cpu(*(PULONG)pRxBufferAddress);
+			RxDes.R00.value = le32_to_cpu(*(u32 *)pRxBufferAddress);
 			PacketSize = (u16)RxDes.R00.R00_receive_byte_count;
-			RxDes.R01.value = le32_to_cpu(*((PULONG)(pRxBufferAddress+4)));
+			RxDes.R01.value = le32_to_cpu(*((u32 *)(pRxBufferAddress+4)));
 			// For new DMA 4k
 			if ((PacketSize & 0x03) > 0)
 				PacketSize -= 4;
drivers/staging/winbond/linux/wb35rx_s.h +1 -1
index 53b831f..b90c269 100644
@@ -41,7 +41,7 @@ typedef struct _WB35RX
 	u32		Ep3ErrorCount2; // 20060625.1 Usbd for Rx DMA error count
 
 	int		EP3VM_status;
-	PUCHAR	pDRx;
+	u8 *	pDRx;
 
 } WB35RX, *PWB35RX;
 
drivers/staging/winbond/linux/wb35tx.c +4 -4
index cf19c3b..bcb014a 100644
@@ -12,7 +12,7 @@
 
 
 unsigned char
-Wb35Tx_get_tx_buffer(phw_data_t pHwData, PUCHAR *pBuffer )
+Wb35Tx_get_tx_buffer(phw_data_t pHwData, u8 **pBuffer)
 {
 	PWB35TX pWb35Tx = &pHwData->Wb35Tx;
 
@@ -37,7 +37,7 @@ void Wb35Tx(phw_data_t pHwData)
 {
 	PWB35TX		pWb35Tx = &pHwData->Wb35Tx;
 	PADAPTER	Adapter = pHwData->Adapter;
-	PUCHAR		pTxBufferAddress;
+	u8		*pTxBufferAddress;
 	PMDS		pMds = &Adapter->Mds;
 	struct urb *	pUrb = (struct urb *)pWb35Tx->Tx4Urb;
 	int         	retv;
@@ -225,7 +225,7 @@ void Wb35Tx_EP2VM(phw_data_t pHwData)
 {
 	PWB35TX pWb35Tx = &pHwData->Wb35Tx;
 	struct urb *	pUrb = (struct urb *)pWb35Tx->Tx2Urb;
-	PULONG	pltmp = (PULONG)pWb35Tx->EP2_buf;
+	u32 *	pltmp = (u32 *)pWb35Tx->EP2_buf;
 	int		retv;
 
 	do {
@@ -266,7 +266,7 @@ void Wb35Tx_EP2VM_complete(struct urb * pUrb)
 	T02_DESCRIPTOR	T02, TSTATUS;
 	PADAPTER	Adapter = (PADAPTER)pHwData->Adapter;
 	PWB35TX		pWb35Tx = &pHwData->Wb35Tx;
-	PULONG		pltmp = (PULONG)pWb35Tx->EP2_buf;
+	u32 *		pltmp = (u32 *)pWb35Tx->EP2_buf;
 	u32		i;
 	u16		InterruptInLength;
 
drivers/staging/winbond/linux/wb35tx_f.h +1 -1
index 7705a84..107b129 100644
@@ -3,7 +3,7 @@
 //====================================
 unsigned char Wb35Tx_initial(	 phw_data_t pHwData );
 void Wb35Tx_destroy(  phw_data_t pHwData );
-unsigned char Wb35Tx_get_tx_buffer(  phw_data_t pHwData,  PUCHAR *pBuffer );
+unsigned char Wb35Tx_get_tx_buffer(  phw_data_t pHwData,  u8 **pBuffer );
 
 void Wb35Tx_EP2VM(  phw_data_t pHwData );
 void Wb35Tx_EP2VM_start(  phw_data_t pHwData );
drivers/staging/winbond/linux/wbusb.c +2 -2
index cbad5fb..ee9f471 100644
@@ -136,7 +136,7 @@ static int wbsoft_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf)
 	hal_set_current_channel(&my_adapter->sHwData, ch);
 	hal_set_beacon_period(&my_adapter->sHwData, conf->beacon_int);
 //	hal_set_cap_info(&my_adapter->sHwData, ?? );
-// hal_set_ssid(phw_data_t pHwData,  PUCHAR pssid,  u8 ssid_len); ??
+// hal_set_ssid(phw_data_t pHwData,  u8 * pssid,  u8 ssid_len); ??
 	hal_set_accept_broadcast(&my_adapter->sHwData, 1);
 	hal_set_accept_promiscuous(&my_adapter->sHwData,  1);
 	hal_set_accept_multicast(&my_adapter->sHwData,  1);
@@ -148,7 +148,7 @@ static int wbsoft_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf)
 
 //	hal_start_bss(&my_adapter->sHwData, WLAN_BSSTYPE_INFRASTRUCTURE);	??
 
-//void hal_set_rates(phw_data_t pHwData, PUCHAR pbss_rates,
+//void hal_set_rates(phw_data_t pHwData, u8 * pbss_rates,
 //		   u8 length, unsigned char basic_rate_set)
 
 	return 0;
drivers/staging/winbond/mds.c +15 -13
index 8ce6389..400397c 100644
@@ -40,7 +40,7 @@ Mds_Tx(PADAPTER Adapter)
 	PMDS		pMds = &Adapter->Mds;
 	DESCRIPTOR	TxDes;
 	PDESCRIPTOR	pTxDes = &TxDes;
-	PUCHAR		XmitBufAddress;
+	u8		*XmitBufAddress;
 	u16		XmitBufSize, PacketSize, stmp, CurrentSize, FragmentThreshold;
 	u8		FillIndex, TxDesIndex, FragmentCount, FillCount;
 	unsigned char	BufferFilled = FALSE, MICAdd = 0;
@@ -90,7 +90,7 @@ Mds_Tx(PADAPTER Adapter)
 			BufferFilled = TRUE;
 
 			/* Leaves first u8 intact */
-			memset((PUCHAR)pTxDes + 1, 0, sizeof(DESCRIPTOR) - 1);
+			memset((u8 *)pTxDes + 1, 0, sizeof(DESCRIPTOR) - 1);
 
 			TxDesIndex = pMds->TxDesIndex;//Get the current ID
 			pTxDes->Descriptor_ID = TxDesIndex;
@@ -229,10 +229,10 @@ Mds_SendComplete(PADAPTER Adapter, PT02_DESCRIPTOR pT02)
 }
 
 void
-Mds_HeaderCopy(PADAPTER Adapter, PDESCRIPTOR pDes, PUCHAR TargetBuffer)
+Mds_HeaderCopy(PADAPTER Adapter, PDESCRIPTOR pDes, u8 *TargetBuffer)
 {
 	PMDS	pMds = &Adapter->Mds;
-	PUCHAR	src_buffer = pDes->buffer_address[0];//931130.5.g
+	u8	*src_buffer = pDes->buffer_address[0];//931130.5.g
 	PT00_DESCRIPTOR	pT00;
 	PT01_DESCRIPTOR	pT01;
 	u16	stmp;
@@ -276,7 +276,7 @@ Mds_HeaderCopy(PADAPTER Adapter, PDESCRIPTOR pDes, PUCHAR TargetBuffer)
 	//
 	// Set tx rate
 	//
-	stmp = *(PUSHORT)(TargetBuffer+30); // 2n alignment address
+	stmp = *(u16 *)(TargetBuffer+30); // 2n alignment address
 
 	//Use basic rate
 	ctmp1 = ctmpf = CURRENT_TX_RATE_FOR_MNG;
@@ -326,11 +326,13 @@ Mds_HeaderCopy(PADAPTER Adapter, PDESCRIPTOR pDes, PUCHAR TargetBuffer)
 
 // The function return the 4n size of usb pk
 u16
-Mds_BodyCopy(PADAPTER Adapter, PDESCRIPTOR pDes, PUCHAR TargetBuffer)
+Mds_BodyCopy(PADAPTER Adapter, PDESCRIPTOR pDes, u8 *TargetBuffer)
 {
 	PT00_DESCRIPTOR	pT00;
 	PMDS	pMds = &Adapter->Mds;
-	PUCHAR	buffer, src_buffer, pctmp;
+	u8	*buffer;
+	u8	*src_buffer;
+	u8	*pctmp;
 	u16	Size = 0;
 	u16	SizeLeft, CopySize, CopyLeft, stmp;
 	u8	buf_index, FragmentCount = 0;
@@ -354,7 +356,7 @@ Mds_BodyCopy(PADAPTER Adapter, PDESCRIPTOR pDes, PUCHAR TargetBuffer)
 		SizeLeft -= CopySize;
 
 		// 1 Byte operation
-		pctmp = (PUCHAR)( buffer + 8 + DOT_11_SEQUENCE_OFFSET );
+		pctmp = (u8 *)( buffer + 8 + DOT_11_SEQUENCE_OFFSET );
 		*pctmp &= 0xf0;
 		*pctmp |= FragmentCount;//931130.5.m
 		if( !FragmentCount )
@@ -379,7 +381,7 @@ Mds_BodyCopy(PADAPTER Adapter, PDESCRIPTOR pDes, PUCHAR TargetBuffer)
 				buf_index++;
 				buf_index %= MAX_DESCRIPTOR_BUFFER_INDEX;
 			} else {
-				PUCHAR	pctmp = pDes->buffer_address[buf_index];
+				u8	*pctmp = pDes->buffer_address[buf_index];
 				pctmp += CopySize;
 				pDes->buffer_address[buf_index] = pctmp;
 				pDes->buffer_size[buf_index] -= CopySize;
@@ -419,7 +421,7 @@ Mds_BodyCopy(PADAPTER Adapter, PDESCRIPTOR pDes, PUCHAR TargetBuffer)
 
 	pT00->T00_last_mpdu = 1;
 	pT00->T00_IsLastMpdu = 1;
-	buffer = (PUCHAR)pT00 + 8; // +8 for USB hdr
+	buffer = (u8 *)pT00 + 8; // +8 for USB hdr
 	buffer[1] &= ~0x04; // Clear more frag bit of 802.11 frame control
 	pDes->FragmentCount = FragmentCount; // Update the correct fragment number
 	return Size;
@@ -427,7 +429,7 @@ Mds_BodyCopy(PADAPTER Adapter, PDESCRIPTOR pDes, PUCHAR TargetBuffer)
 
 
 void
-Mds_DurationSet(  PADAPTER Adapter,  PDESCRIPTOR pDes,  PUCHAR buffer )
+Mds_DurationSet(  PADAPTER Adapter,  PDESCRIPTOR pDes,  u8 *buffer )
 {
 	PT00_DESCRIPTOR	pT00;
 	PT01_DESCRIPTOR	pT01;
@@ -574,7 +576,7 @@ Mds_DurationSet(  PADAPTER Adapter,  PDESCRIPTOR pDes,  PUCHAR buffer )
 							DEFAULT_SIFSTIME*3 );
 			}
 
-			((PUSHORT)buffer)[5] = cpu_to_le16(Duration);// 4 USHOR for skip 8B USB, 2USHORT=FC + Duration
+			((u16 *)buffer)[5] = cpu_to_le16(Duration);// 4 USHOR for skip 8B USB, 2USHORT=FC + Duration
 
 			//----20061009 add by anson's endian
 			pNextT00->value = cpu_to_le32(pNextT00->value);
@@ -615,7 +617,7 @@ Mds_DurationSet(  PADAPTER Adapter,  PDESCRIPTOR pDes,  PUCHAR buffer )
 		}
 	}
 
-	((PUSHORT)buffer)[5] = cpu_to_le16(Duration);// 4 USHOR for skip 8B USB, 2USHORT=FC + Duration
+	((u16 *)buffer)[5] = cpu_to_le16(Duration);// 4 USHOR for skip 8B USB, 2USHORT=FC + Duration
 	pT00->value = cpu_to_le32(pT00->value);
 	pT01->value = cpu_to_le32(pT01->value);
 	//--end 20061009 add
drivers/staging/winbond/mds_f.h +3 -3
index 651188b..7a682d4 100644
@@ -1,9 +1,9 @@
 unsigned char Mds_initial(  PADAPTER Adapter );
 void Mds_Destroy(  PADAPTER Adapter );
 void Mds_Tx(  PADAPTER Adapter );
-void Mds_HeaderCopy(  PADAPTER Adapter,  PDESCRIPTOR pDes,  PUCHAR TargetBuffer );
-u16 Mds_BodyCopy(  PADAPTER Adapter,  PDESCRIPTOR pDes,  PUCHAR TargetBuffer );
-void Mds_DurationSet(  PADAPTER Adapter,  PDESCRIPTOR pDes,  PUCHAR TargetBuffer );
+void Mds_HeaderCopy(  PADAPTER Adapter,  PDESCRIPTOR pDes,  u8 *TargetBuffer );
+u16 Mds_BodyCopy(  PADAPTER Adapter,  PDESCRIPTOR pDes,  u8 *TargetBuffer );
+void Mds_DurationSet(  PADAPTER Adapter,  PDESCRIPTOR pDes,  u8 *TargetBuffer );
 void Mds_SendComplete(  PADAPTER Adapter,  PT02_DESCRIPTOR pT02 );
 void Mds_MpduProcess(  PADAPTER Adapter,  PDESCRIPTOR pRxDes );
 void Mds_reset_descriptor(  PADAPTER Adapter );
drivers/staging/winbond/mds_s.h +4 -4
index 4738279..9df2e09 100644
@@ -86,7 +86,7 @@ typedef struct _MDS
 {
 	// For Tx usage
 	u8	TxOwner[ ((MAX_USB_TX_BUFFER_NUMBER + 3) & ~0x03) ];
-	PUCHAR	pTxBuffer;
+	u8	*pTxBuffer;
 	u16	TxBufferSize[ ((MAX_USB_TX_BUFFER_NUMBER + 1) & ~0x01) ];
 	u8	TxDesFrom[ ((MAX_USB_TX_DESCRIPTOR + 3) & ~0x03) ];//931130.4.u // 1: MLME 2: NDIS control 3: NDIS data
 	u8	TxCountInBuffer[ ((MAX_USB_TX_DESCRIPTOR + 3) & ~0x03) ]; // 20060928
@@ -103,7 +103,7 @@ typedef struct _MDS
 	u16	TxResult[ ((MAX_USB_TX_DESCRIPTOR + 1) & ~0x01) ];//Collect the sending result of Mpdu
 
 	u8	MicRedundant[8]; // For tmp use
-	PUCHAR	MicWriteAddress[2]; //The start address to fill the Mic, use 2 point due to Mic maybe fragment
+	u8	*MicWriteAddress[2]; //The start address to fill the Mic, use 2 point due to Mic maybe fragment
 
 	u16	MicWriteSize[2]; //931130.4.x
 
@@ -144,7 +144,7 @@ typedef struct _MDS
 
 typedef struct _RxBuffer
 {
-    PUCHAR  pBufferAddress;     // Pointer the received data buffer.
+    u8 * pBufferAddress;     // Pointer the received data buffer.
 	u16	BufferSize;
 	u8	RESERVED;
 	u8	BufferIndex;// Only 1 byte
@@ -176,7 +176,7 @@ typedef struct _RXLAYER1
 	/////////////////////////////////////////////////////////////////////////////////////////////
 	// For brand-new Rx system
 	u8	ReservedBuffer[ 2400 ];//If Buffer ID is reserved one, it must copy the data into this area
-	PUCHAR	ReservedBufferPoint;// Point to the next availabe address of reserved buffer
+	u8	*ReservedBufferPoint;// Point to the next availabe address of reserved buffer
 
 }RXLAYER1, * PRXLAYER1;
 
drivers/staging/winbond/mlme_s.h +1 -1
index 58094f6..6ec818b 100644
@@ -125,7 +125,7 @@
 typedef struct _MLME_FRAME
 {
 	//NDIS_PACKET		MLME_Packet;
-	PCHAR			pMMPDU;
+	s8 *			pMMPDU;
 	u16			len;
 	u8			DataType;
 	u8			IsInUsed;
drivers/staging/winbond/mlmetxrx.c +2 -2
index 46b091e..e8533b8 100644
@@ -113,13 +113,13 @@ MLME_GetNextPacket(PADAPTER Adapter, PDESCRIPTOR pDes)
 	pDes->Type = Adapter->sMlmeFrame.DataType;
 }
 
-void MLMEfreeMMPDUBuffer(PWB32_ADAPTER Adapter, PCHAR pData)
+void MLMEfreeMMPDUBuffer(PWB32_ADAPTER Adapter, s8 *pData)
 {
 	int i;
 
 	// Reclaim the data buffer
 	for (i = 0; i < MAX_NUM_TX_MMPDU; i++) {
-		if (pData == (PCHAR)&(Adapter->sMlmeFrame.TxMMPDU[i]))
+		if (pData == (s8 *)&(Adapter->sMlmeFrame.TxMMPDU[i]))
 			break;
 	}
 	if (Adapter->sMlmeFrame.TxMMPDUInUse[i])
drivers/staging/winbond/mlmetxrx_f.h +2 -2
index d74e225..24cd5f3 100644
@@ -20,7 +20,7 @@ MLMEGetMMPDUBuffer(
      PWB32_ADAPTER    Adapter
    );
 
-void MLMEfreeMMPDUBuffer( PWB32_ADAPTER Adapter,  PCHAR pData);
+void MLMEfreeMMPDUBuffer( PWB32_ADAPTER Adapter,  s8 * pData);
 
 void MLME_GetNextPacket(  PADAPTER Adapter,  PDESCRIPTOR pDes );
 u8 MLMESendFrame( PWB32_ADAPTER Adapter,
@@ -42,7 +42,7 @@ MLMERcvFrame(
 void
 MLMEReturnPacket(
      PWB32_ADAPTER    Adapter,
-     PUCHAR           pRxBufer
+     u8 *          pRxBufer
    );
 #ifdef _IBSS_BEACON_SEQ_STICK_
 s8 SendBCNullData(PWB32_ADAPTER Adapter, u16 wIdx);
drivers/staging/winbond/reg.c +12 -12
index b475c7a..57af5b8 100644
@@ -922,16 +922,16 @@ Uxx_ReadEthernetAddress(  phw_data_t pHwData )
 	// Only unplug and plug again can make hardware read EEPROM again. 20060727
 	Wb35Reg_WriteSync( pHwData, 0x03b4, 0x08000000 ); // Start EEPROM access + Read + address(0x0d)
 	Wb35Reg_ReadSync( pHwData, 0x03b4, &ltmp );
-	*(PUSHORT)pHwData->PermanentMacAddress = cpu_to_le16((u16)ltmp); //20060926 anson's endian
+	*(u16 *)pHwData->PermanentMacAddress = cpu_to_le16((u16)ltmp); //20060926 anson's endian
 	Wb35Reg_WriteSync( pHwData, 0x03b4, 0x08010000 ); // Start EEPROM access + Read + address(0x0d)
 	Wb35Reg_ReadSync( pHwData, 0x03b4, &ltmp );
-	*(PUSHORT)(pHwData->PermanentMacAddress + 2) = cpu_to_le16((u16)ltmp); //20060926 anson's endian
+	*(u16 *)(pHwData->PermanentMacAddress + 2) = cpu_to_le16((u16)ltmp); //20060926 anson's endian
 	Wb35Reg_WriteSync( pHwData, 0x03b4, 0x08020000 ); // Start EEPROM access + Read + address(0x0d)
 	Wb35Reg_ReadSync( pHwData, 0x03b4, &ltmp );
-	*(PUSHORT)(pHwData->PermanentMacAddress + 4) = cpu_to_le16((u16)ltmp); //20060926 anson's endian
-	*(PUSHORT)(pHwData->PermanentMacAddress + 6) = 0;
-	Wb35Reg_WriteSync( pHwData, 0x03e8, cpu_to_le32(*(PULONG)pHwData->PermanentMacAddress) ); //20060926 anson's endian
-	Wb35Reg_WriteSync( pHwData, 0x03ec, cpu_to_le32(*(PULONG)(pHwData->PermanentMacAddress+4)) ); //20060926 anson's endian
+	*(u16 *)(pHwData->PermanentMacAddress + 4) = cpu_to_le16((u16)ltmp); //20060926 anson's endian
+	*(u16 *)(pHwData->PermanentMacAddress + 6) = 0;
+	Wb35Reg_WriteSync( pHwData, 0x03e8, cpu_to_le32(*(u32 *)pHwData->PermanentMacAddress) ); //20060926 anson's endian
+	Wb35Reg_WriteSync( pHwData, 0x03ec, cpu_to_le32(*(u32 *)(pHwData->PermanentMacAddress+4)) ); //20060926 anson's endian
 }
 
 
@@ -1038,7 +1038,7 @@ void
 RFSynthesizer_initial(phw_data_t pHwData)
 {
 	u32	altmp[32];
-	PULONG	pltmp = altmp;
+	u32 *	pltmp = altmp;
 	u32	ltmp;
 	u8	number=0x00; // The number of register vale
 	u8	i;
@@ -2358,11 +2358,11 @@ void Mxx_initial(  phw_data_t pHwData )
 	pltmp[2] = pWb35Reg->M2C_MacControl;
 
 	// M30 BSSID
-	pltmp[3] = *(PULONG)pHwData->bssid;
+	pltmp[3] = *(u32 *)pHwData->bssid;
 
 	// M34
 	pHwData->AID = DEFAULT_AID;
-	tmp = *(PUSHORT)(pHwData->bssid+4);
+	tmp = *(u16 *)(pHwData->bssid+4);
 	tmp |= DEFAULT_AID << 16;
 	pltmp[4] = tmp;
 
@@ -2428,7 +2428,7 @@ void GetTxVgaFromEEPROM(  phw_data_t pHwData )
 {
 	u32		i, j, ltmp;
 	u16		Value[MAX_TXVGA_EEPROM];
-	PUCHAR		pctmp;
+	u8		*pctmp;
 	u8		ctmp=0;
 
 	// Get the entire TxVga setting in EEPROM
@@ -2441,7 +2441,7 @@ void GetTxVgaFromEEPROM(  phw_data_t pHwData )
 	}
 
 	// Adjust the filed which fills with reserved value.
-	pctmp = (PUCHAR)Value;
+	pctmp = (u8 *)Value;
 	for( i=0; i<(MAX_TXVGA_EEPROM*2); i++ )
 	{
 		if( pctmp[i] != 0xff )
@@ -2480,7 +2480,7 @@ void GetTxVgaFromEEPROM(  phw_data_t pHwData )
 // This function will use default TxVgaSettingInEEPROM data to calculate new TxVga.
 void EEPROMTxVgaAdjust(  phw_data_t pHwData ) // 20060619.5 Add
 {
-	PUCHAR		pTxVga = pHwData->TxVgaSettingInEEPROM;
+	u8	*	pTxVga = pHwData->TxVgaSettingInEEPROM;
 	s16		i, stmp;
 
 	//-- 2.4G -- 20060704.2 Request from Tiger
drivers/staging/winbond/sme_api.h +1 -1
index 016b225..745eb37 100644
@@ -208,7 +208,7 @@ s8 sme_set_tx_antenna(void *pcore_data, u32 TxAntenna);
 s8 sme_set_IBSS_chan(void *pcore_data, ChanInfo chan);
 
 //20061108 WPS
-s8 sme_set_IE_append(void *pcore_data, PUCHAR buffer, u16 buf_len);
+s8 sme_set_IE_append(void *pcore_data, u8 *buffer, u16 buf_len);
 
 
 
drivers/staging/winbond/wbhal.c +16 -16
index daf4422..5d68ece 100644
@@ -1,13 +1,13 @@
 #include "os_common.h"
 
-void hal_get_ethernet_address( phw_data_t pHwData, PUCHAR current_address )
+void hal_get_ethernet_address( phw_data_t pHwData, u8 *current_address )
 {
 	if( pHwData->SurpriseRemove ) return;
 
 	memcpy( current_address, pHwData->CurrentMacAddress, ETH_LENGTH_OF_ADDRESS );
 }
 
-void hal_set_ethernet_address( phw_data_t pHwData, PUCHAR current_address )
+void hal_set_ethernet_address( phw_data_t pHwData, u8 *current_address )
 {
 	u32 ltmp[2];
 
@@ -15,13 +15,13 @@ void hal_set_ethernet_address( phw_data_t pHwData, PUCHAR current_address )
 
 	memcpy( pHwData->CurrentMacAddress, current_address, ETH_LENGTH_OF_ADDRESS );
 
-	ltmp[0]= cpu_to_le32( *(PULONG)pHwData->CurrentMacAddress );
-	ltmp[1]= cpu_to_le32( *(PULONG)(pHwData->CurrentMacAddress + 4) ) & 0xffff;
+	ltmp[0]= cpu_to_le32( *(u32 *)pHwData->CurrentMacAddress );
+	ltmp[1]= cpu_to_le32( *(u32 *)(pHwData->CurrentMacAddress + 4) ) & 0xffff;
 
 	Wb35Reg_BurstWrite( pHwData, 0x03e8, ltmp, 2, AUTO_INCREMENT );
 }
 
-void hal_get_permanent_address( phw_data_t pHwData, PUCHAR pethernet_address )
+void hal_get_permanent_address( phw_data_t pHwData, u8 *pethernet_address )
 {
 	if( pHwData->SurpriseRemove ) return;
 
@@ -89,7 +89,7 @@ void hal_halt(phw_data_t pHwData, void *ppa_data)
 }
 
 //---------------------------------------------------------------------------------------------------
-void hal_set_rates(phw_data_t pHwData, PUCHAR pbss_rates,
+void hal_set_rates(phw_data_t pHwData, u8 *pbss_rates,
 		   u8 length, unsigned char basic_rate_set)
 {
 	PWB35REG	pWb35Reg = &pHwData->Wb35Reg;
@@ -158,13 +158,13 @@ void hal_set_rates(phw_data_t pHwData, PUCHAR pbss_rates,
 	// Fill data into support rate until buffer full
 	//---20060926 add by anson's endian
 	for (i=0; i<4; i++)
-		*(PULONG)(SupportedRate+(i<<2)) = cpu_to_le32( *(PULONG)(SupportedRate+(i<<2)) );
+		*(u32 *)(SupportedRate+(i<<2)) = cpu_to_le32( *(u32 *)(SupportedRate+(i<<2)) );
 	//--- end 20060926 add by anson's endian
-	Wb35Reg_BurstWrite( pHwData,0x087c, (PULONG)SupportedRate, 4, AUTO_INCREMENT );
-	pWb35Reg->M7C_MacControl = ((PULONG)SupportedRate)[0];
-	pWb35Reg->M80_MacControl = ((PULONG)SupportedRate)[1];
-	pWb35Reg->M84_MacControl = ((PULONG)SupportedRate)[2];
-	pWb35Reg->M88_MacControl = ((PULONG)SupportedRate)[3];
+	Wb35Reg_BurstWrite( pHwData,0x087c, (u32 *)SupportedRate, 4, AUTO_INCREMENT );
+	pWb35Reg->M7C_MacControl = ((u32 *)SupportedRate)[0];
+	pWb35Reg->M80_MacControl = ((u32 *)SupportedRate)[1];
+	pWb35Reg->M84_MacControl = ((u32 *)SupportedRate)[2];
+	pWb35Reg->M88_MacControl = ((u32 *)SupportedRate)[3];
 
 	// Fill length
 	tmp = Count1<<28 | Count2<<24;
@@ -206,7 +206,7 @@ void hal_set_current_channel_ex(  phw_data_t pHwData,  ChanInfo channel )
 	pWb35Reg->M28_MacControl &= ~0xff; // Clean channel information field
 	pWb35Reg->M28_MacControl |= channel.ChanNo;
 	Wb35Reg_WriteWithCallbackValue( pHwData, 0x0828, pWb35Reg->M28_MacControl,
-					(PCHAR)&channel, sizeof(ChanInfo));
+					(s8 *)&channel, sizeof(ChanInfo));
 }
 //---------------------------------------------------------------------------------------------------
 void hal_set_current_channel(  phw_data_t pHwData,  ChanInfo channel )
@@ -277,7 +277,7 @@ void hal_set_accept_beacon(  phw_data_t pHwData,  u8 enable )
 	Wb35Reg_Write( pHwData, 0x0800, pWb35Reg->M00_MacControl );
 }
 //---------------------------------------------------------------------------------------------------
-void hal_set_multicast_address( phw_data_t pHwData, PUCHAR address, u8 number )
+void hal_set_multicast_address( phw_data_t pHwData, u8 *address, u8 number )
 {
 	PWB35REG	pWb35Reg = &pHwData->Wb35Reg;
 	u8		Byte, Bit;
@@ -297,7 +297,7 @@ void hal_set_multicast_address( phw_data_t pHwData, PUCHAR address, u8 number )
 	}
 
 	// Updating register
-	Wb35Reg_BurstWrite( pHwData, 0x0804, (PULONG)pWb35Reg->Multicast, 2, AUTO_INCREMENT );
+	Wb35Reg_BurstWrite( pHwData, 0x0804, (u32 *)pWb35Reg->Multicast, 2, AUTO_INCREMENT );
 }
 //---------------------------------------------------------------------------------------------------
 u8 hal_get_accept_beacon(  phw_data_t pHwData )
@@ -806,7 +806,7 @@ u8 hal_get_hw_radio_off(  phw_data_t pHwData )
 	}
 }
 
-unsigned char hal_get_dxx_reg(  phw_data_t pHwData,  u16 number,  PULONG pValue )
+unsigned char hal_get_dxx_reg(  phw_data_t pHwData,  u16 number,  u32 * pValue )
 {
 	if( number < 0x1000 )
 		number += 0x1000;
drivers/staging/winbond/wbhal_f.h +14 -14
index fe25f97..ea9531a 100644
@@ -16,23 +16,23 @@
 //====================================================================================
 // Function declaration
 //====================================================================================
-void hal_remove_mapping_key(  phw_data_t pHwData,  PUCHAR pmac_addr );
+void hal_remove_mapping_key(  phw_data_t pHwData,  u8 *pmac_addr );
 void hal_remove_default_key(  phw_data_t pHwData,  u32 index );
-unsigned char hal_set_mapping_key(  phw_data_t Adapter,  PUCHAR pmac_addr,  u8 null_key,  u8 wep_on,  PUCHAR ptx_tsc,  PUCHAR prx_tsc,  u8 key_type,  u8 key_len,  PUCHAR pkey_data );
-unsigned char hal_set_default_key(  phw_data_t Adapter,  u8 index,  u8 null_key,  u8 wep_on,  PUCHAR ptx_tsc,  PUCHAR prx_tsc,  u8 key_type,  u8 key_len,  PUCHAR pkey_data );
+unsigned char hal_set_mapping_key(  phw_data_t Adapter,  u8 *pmac_addr,  u8 null_key,  u8 wep_on,  u8 *ptx_tsc,  u8 *prx_tsc,  u8 key_type,  u8 key_len,  u8 *pkey_data );
+unsigned char hal_set_default_key(  phw_data_t Adapter,  u8 index,  u8 null_key,  u8 wep_on,  u8 *ptx_tsc,  u8 *prx_tsc,  u8 key_type,  u8 key_len,  u8 *pkey_data );
 void hal_clear_all_default_key(  phw_data_t pHwData );
 void hal_clear_all_group_key(  phw_data_t pHwData );
 void hal_clear_all_mapping_key(  phw_data_t pHwData );
 void hal_clear_all_key(  phw_data_t pHwData );
-void hal_get_ethernet_address(  phw_data_t pHwData,  PUCHAR current_address );
-void hal_set_ethernet_address(  phw_data_t pHwData,  PUCHAR current_address );
-void hal_get_permanent_address(  phw_data_t pHwData,  PUCHAR pethernet_address );
+void hal_get_ethernet_address(  phw_data_t pHwData,  u8 *current_address );
+void hal_set_ethernet_address(  phw_data_t pHwData,  u8 *current_address );
+void hal_get_permanent_address(  phw_data_t pHwData,  u8 *pethernet_address );
 unsigned char hal_init_hardware(  phw_data_t pHwData,  PADAPTER Adapter );
 void hal_set_power_save_mode(  phw_data_t pHwData,  unsigned char power_save,  unsigned char wakeup,  unsigned char dtim );
-void hal_get_power_save_mode(  phw_data_t pHwData,   PBOOLEAN pin_pwr_save );
+void hal_get_power_save_mode(  phw_data_t pHwData,   u8 *pin_pwr_save );
 void hal_set_slot_time(  phw_data_t pHwData,  u8 type );
 #define hal_set_atim_window( _A, _ATM )
-void hal_set_rates(  phw_data_t pHwData,  PUCHAR pbss_rates,  u8 length,  unsigned char basic_rate_set );
+void hal_set_rates(  phw_data_t pHwData,  u8 *pbss_rates,  u8 length,  unsigned char basic_rate_set );
 #define hal_set_basic_rates( _A, _R, _L ) hal_set_rates( _A, _R, _L, TRUE )
 #define hal_set_op_rates( _A, _R, _L ) hal_set_rates( _A, _R, _L, FALSE )
 void hal_start_bss(  phw_data_t pHwData,  u8 mac_op_mode );
@@ -40,19 +40,19 @@ void hal_join_request(  phw_data_t pHwData,  u8 bss_type ); // 0:BSS STA 1:IBSS
 void hal_stop_sync_bss(  phw_data_t pHwData );
 void hal_resume_sync_bss(  phw_data_t pHwData);
 void hal_set_aid(  phw_data_t pHwData,  u16 aid );
-void hal_set_bssid(  phw_data_t pHwData,  PUCHAR pbssid );
-void hal_get_bssid(  phw_data_t pHwData,  PUCHAR pbssid );
+void hal_set_bssid(  phw_data_t pHwData,  u8 *pbssid );
+void hal_get_bssid(  phw_data_t pHwData,  u8 *pbssid );
 void hal_set_beacon_period(  phw_data_t pHwData,  u16 beacon_period );
 void hal_set_listen_interval(  phw_data_t pHwData,  u16 listen_interval );
 void hal_set_cap_info(  phw_data_t pHwData,  u16 capability_info );
-void hal_set_ssid(  phw_data_t pHwData,  PUCHAR pssid,  u8 ssid_len );
+void hal_set_ssid(  phw_data_t pHwData,  u8 *pssid,  u8 ssid_len );
 void hal_set_current_channel(  phw_data_t pHwData,  ChanInfo channel );
 void hal_set_current_channel_ex(  phw_data_t pHwData,  ChanInfo channel );
 void hal_get_current_channel(  phw_data_t pHwData,  ChanInfo *channel );
 void hal_set_accept_broadcast(  phw_data_t pHwData,  u8 enable );
 void hal_set_accept_multicast(  phw_data_t pHwData,  u8 enable );
 void hal_set_accept_beacon(  phw_data_t pHwData,  u8 enable );
-void hal_set_multicast_address(  phw_data_t pHwData,  PUCHAR address,  u8 number );
+void hal_set_multicast_address(  phw_data_t pHwData,  u8 *address,  u8 number );
 u8 hal_get_accept_beacon(  phw_data_t pHwData );
 void hal_stop(  phw_data_t pHwData );
 void hal_halt(  phw_data_t pHwData, void *ppa_data );
@@ -97,7 +97,7 @@ void hal_surprise_remove(  phw_data_t pHwData );
 
 
 void hal_rate_change(  phw_data_t pHwData ); // Notify the HAL rate is changing 20060613.1
-unsigned char hal_get_dxx_reg(  phw_data_t pHwData,  u16 number,  PULONG pValue );
+unsigned char hal_get_dxx_reg(  phw_data_t pHwData,  u16 number,  u32 * pValue );
 unsigned char hal_set_dxx_reg(  phw_data_t pHwData,  u16 number,  u32 value );
 #define hal_get_time_count( _P )	(_P->time_count/10)	// return 100ms count
 #define hal_detect_error( _P )		(_P->WbUsb.DetectCount)
@@ -116,7 +116,7 @@ unsigned char	hal_idle(  phw_data_t pHwData );
 #define pa_stall_execution( _A )	//OS_SLEEP( 1 )
 #define hw_get_cxx_reg( _A, _B, _C )
 #define hw_set_cxx_reg( _A, _B, _C )
-#define hw_get_dxx_reg( _A, _B, _C )	hal_get_dxx_reg( _A, _B, (PULONG)_C )
+#define hw_get_dxx_reg( _A, _B, _C )	hal_get_dxx_reg( _A, _B, (u32 *)_C )
 #define hw_set_dxx_reg( _A, _B, _C )	hal_set_dxx_reg( _A, _B, (u32)_C )
 
 
drivers/staging/winbond/wbhal_s.h +2 -2
index 5b862ff..2ee3f0f 100644
@@ -461,7 +461,7 @@ typedef struct _HW_DATA_T
 	//=====================================================================
 	// Definition for 802.11
 	//=====================================================================
-	PUCHAR	bssid_pointer; // Used by hal_get_bssid for return value
+	u8	*bssid_pointer; // Used by hal_get_bssid for return value
 	u8	bssid[8];// Only 6 byte will be used. 8 byte is required for read buffer
 	u8	ssid[32];// maximum ssid length is 32 byte
 
@@ -486,7 +486,7 @@ typedef struct _HW_DATA_T
 	u32	CurrentRadioSw; // 20060320.2 0:On 1:Off
 	u32	CurrentRadioHw; // 20060825 0:On 1:Off
 
-	PUCHAR	power_save_point;  // Used by hal_get_power_save_mode for return value
+	u8	*power_save_point;  // Used by hal_get_power_save_mode for return value
 	u8	cwmin;
 	u8	desired_power_save;
 	u8	dtim;// Is running dtim
drivers/staging/winbond/wblinux.c +4 -3
index 2eade5a..51dad95 100644
@@ -25,7 +25,7 @@ EncapAtomicInc(PADAPTER Adapter, void* pAtomic)
 {
 	PWBLINUX pWbLinux = &Adapter->WbLinux;
 	u32	ltmp;
-	PULONG	pltmp = (PULONG)pAtomic;
+	u32 *	pltmp = (u32 *)pAtomic;
 	OS_SPIN_LOCK_ACQUIRED( &pWbLinux->AtomicSpinLock );
 	(*pltmp)++;
 	ltmp = (*pltmp);
@@ -38,7 +38,7 @@ EncapAtomicDec(PADAPTER Adapter, void* pAtomic)
 {
 	PWBLINUX pWbLinux = &Adapter->WbLinux;
 	u32	ltmp;
-	PULONG	pltmp = (PULONG)pAtomic;
+	u32 *	pltmp = (u32 *)pAtomic;
 	OS_SPIN_LOCK_ACQUIRED( &pWbLinux->AtomicSpinLock );
 	(*pltmp)--;
 	ltmp = (*pltmp);
@@ -142,7 +142,8 @@ unsigned char
 WbWLanInitialize(PADAPTER Adapter)
 {
 	phw_data_t	pHwData;
-	PUCHAR		pMacAddr, pMacAddr2;
+	u8		*pMacAddr;
+	u8		*pMacAddr2;
 	u32		InitStep = 0;
 	u8		EEPROM_region;
 	u8		HwRadioOff;
Signature · 1 line
1.6.0.2
#22 lore raw

PATCH 16/42 Staging: sxg: replace __FUNCTION__ with __func__

In reply to Greg KH

From: Harvey Harrison <[email protected]>

__FUNCTION__ is gcc-specific, use __func__

---
 drivers/staging/sxg/sxg.c    |  206 +++++++++++++++++++++---------------------
 drivers/staging/sxg/sxgdbg.h |    2 +-
 2 files changed, 104 insertions(+), 104 deletions(-)
drivers/staging/sxg/sxg.c +103 -103
index 6ccbee8..d8772e5 100644
@@ -202,7 +202,7 @@ static void sxg_init_driver(void)
 {
 	if (sxg_first_init) {
 		DBG_ERROR("sxg: %s sxg_first_init set jiffies[%lx]\n",
-			  __FUNCTION__, jiffies);
+			  __func__, jiffies);
 		sxg_first_init = 0;
 		spin_lock_init(&sxg_global.driver_lock);
 	}
@@ -259,7 +259,7 @@ static bool sxg_download_microcode(p_adapter_t adapter, SXG_UCODE_SEL UcodeSel)
 
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "DnldUcod",
 		  adapter, 0, 0, 0);
-	DBG_ERROR("sxg: %s ENTER\n", __FUNCTION__);
+	DBG_ERROR("sxg: %s ENTER\n", __func__);
 
 	switch (UcodeSel) {
 	case SXG_UCODE_SAHARA:	// Sahara operational ucode
@@ -345,7 +345,7 @@ static bool sxg_download_microcode(p_adapter_t adapter, SXG_UCODE_SEL UcodeSel)
 			READ_REG(HwRegs->UcodeAddr, ValueRead);
 			if (ValueRead & MICROCODE_ADDRESS_PARITY) {
 				DBG_ERROR("sxg: %s PARITY ERROR\n",
-					  __FUNCTION__);
+					  __func__);
 
 				return (FALSE);	// Parity error
 			}
@@ -354,19 +354,19 @@ static bool sxg_download_microcode(p_adapter_t adapter, SXG_UCODE_SEL UcodeSel)
 			READ_REG(HwRegs->UcodeDataLow, ValueRead);
 			if (ValueRead != *Instruction) {
 				DBG_ERROR("sxg: %s MISCOMPARE LOW\n",
-					  __FUNCTION__);
+					  __func__);
 				return (FALSE);	// Miscompare
 			}
 			READ_REG(HwRegs->UcodeDataMiddle, ValueRead);
 			if (ValueRead != *(Instruction + 1)) {
 				DBG_ERROR("sxg: %s MISCOMPARE MIDDLE\n",
-					  __FUNCTION__);
+					  __func__);
 				return (FALSE);	// Miscompare
 			}
 			READ_REG(HwRegs->UcodeDataHigh, ValueRead);
 			if (ValueRead != *(Instruction + 2)) {
 				DBG_ERROR("sxg: %s MISCOMPARE HIGH\n",
-					  __FUNCTION__);
+					  __func__);
 				return (FALSE);	// Miscompare
 			}
 			// Advance 3 u32S to start of next instruction
@@ -383,12 +383,12 @@ static bool sxg_download_microcode(p_adapter_t adapter, SXG_UCODE_SEL UcodeSel)
 		udelay(50);
 		READ_REG(adapter->UcodeRegs[0].CardUp, ValueRead);
 		if (ValueRead == 0xCAFE) {
-			DBG_ERROR("sxg: %s BOO YA 0xCAFE\n", __FUNCTION__);
+			DBG_ERROR("sxg: %s BOO YA 0xCAFE\n", __func__);
 			break;
 		}
 	}
 	if (i == 10000) {
-		DBG_ERROR("sxg: %s TIMEOUT\n", __FUNCTION__);
+		DBG_ERROR("sxg: %s TIMEOUT\n", __func__);
 
 		return (FALSE);	// Timeout
 	}
@@ -401,7 +401,7 @@ static bool sxg_download_microcode(p_adapter_t adapter, SXG_UCODE_SEL UcodeSel)
 
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "XDnldUcd",
 		  adapter, 0, 0, 0);
-	DBG_ERROR("sxg: %s EXIT\n", __FUNCTION__);
+	DBG_ERROR("sxg: %s EXIT\n", __func__);
 
 	return (TRUE);
 }
@@ -423,7 +423,7 @@ static int sxg_allocate_resources(p_adapter_t adapter)
 //      PSXG_XMT_RING                                   XmtRing;
 //      PSXG_RCV_RING                                   RcvRing;
 
-	DBG_ERROR("%s ENTER\n", __FUNCTION__);
+	DBG_ERROR("%s ENTER\n", __func__);
 
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "AllocRes",
 		  adapter, 0, 0, 0);
@@ -433,7 +433,7 @@ static int sxg_allocate_resources(p_adapter_t adapter)
 	RssIds = SXG_RSS_CPU_COUNT(adapter);
 	IsrCount = adapter->MsiEnabled ? RssIds : 1;
 
-	DBG_ERROR("%s Setup the spinlocks\n", __FUNCTION__);
+	DBG_ERROR("%s Setup the spinlocks\n", __func__);
 
 	// Allocate spinlocks and initialize listheads first.
 	spin_lock_init(&adapter->RcvQLock);
@@ -442,7 +442,7 @@ static int sxg_allocate_resources(p_adapter_t adapter)
 	spin_lock_init(&adapter->Bit64RegLock);
 	spin_lock_init(&adapter->AdapterLock);
 
-	DBG_ERROR("%s Setup the lists\n", __FUNCTION__);
+	DBG_ERROR("%s Setup the lists\n", __func__);
 
 	InitializeListHead(&adapter->FreeRcvBuffers);
 	InitializeListHead(&adapter->FreeRcvBlocks);
@@ -459,7 +459,7 @@ static int sxg_allocate_resources(p_adapter_t adapter)
 	// fails.  If we hit a minimum, fail.
 
 	for (;;) {
-		DBG_ERROR("%s Allocate XmtRings size[%lx]\n", __FUNCTION__,
+		DBG_ERROR("%s Allocate XmtRings size[%lx]\n", __func__,
 			  (sizeof(SXG_XMT_RING) * 1));
 
 		// Start with big items first - receive and transmit rings.  At the moment
@@ -469,20 +469,20 @@ static int sxg_allocate_resources(p_adapter_t adapter)
 							 sizeof(SXG_XMT_RING) *
 							 1,
 							 &adapter->PXmtRings);
-		DBG_ERROR("%s XmtRings[%p]\n", __FUNCTION__, adapter->XmtRings);
+		DBG_ERROR("%s XmtRings[%p]\n", __func__, adapter->XmtRings);
 
 		if (!adapter->XmtRings) {
 			goto per_tcb_allocation_failed;
 		}
 		memset(adapter->XmtRings, 0, sizeof(SXG_XMT_RING) * 1);
 
-		DBG_ERROR("%s Allocate RcvRings size[%lx]\n", __FUNCTION__,
+		DBG_ERROR("%s Allocate RcvRings size[%lx]\n", __func__,
 			  (sizeof(SXG_RCV_RING) * 1));
 		adapter->RcvRings =
 		    pci_alloc_consistent(adapter->pcidev,
 					 sizeof(SXG_RCV_RING) * 1,
 					 &adapter->PRcvRings);
-		DBG_ERROR("%s RcvRings[%p]\n", __FUNCTION__, adapter->RcvRings);
+		DBG_ERROR("%s RcvRings[%p]\n", __func__, adapter->RcvRings);
 		if (!adapter->RcvRings) {
 			goto per_tcb_allocation_failed;
 		}
@@ -508,7 +508,7 @@ static int sxg_allocate_resources(p_adapter_t adapter)
 		// Loop around and try again....
 	}
 
-	DBG_ERROR("%s Initialize RCV ZERO and XMT ZERO rings\n", __FUNCTION__);
+	DBG_ERROR("%s Initialize RCV ZERO and XMT ZERO rings\n", __func__);
 	// Initialize rcv zero and xmt zero rings
 	SXG_INITIALIZE_RING(adapter->RcvRingZeroInfo, SXG_RCV_RING_SIZE);
 	SXG_INITIALIZE_RING(adapter->XmtRingZeroInfo, SXG_XMT_RING_SIZE);
@@ -537,7 +537,7 @@ static int sxg_allocate_resources(p_adapter_t adapter)
 		return (STATUS_RESOURCES);
 	}
 
-	DBG_ERROR("%s Allocate EventRings size[%lx]\n", __FUNCTION__,
+	DBG_ERROR("%s Allocate EventRings size[%lx]\n", __func__,
 		  (sizeof(SXG_EVENT_RING) * RssIds));
 
 	// Allocate event queues.
@@ -555,7 +555,7 @@ static int sxg_allocate_resources(p_adapter_t adapter)
 	}
 	memset(adapter->EventRings, 0, sizeof(SXG_EVENT_RING) * RssIds);
 
-	DBG_ERROR("%s Allocate ISR size[%x]\n", __FUNCTION__, IsrCount);
+	DBG_ERROR("%s Allocate ISR size[%x]\n", __func__, IsrCount);
 	// Allocate ISR
 	adapter->Isr = pci_alloc_consistent(adapter->pcidev,
 					    IsrCount, &adapter->PIsr);
@@ -569,7 +569,7 @@ static int sxg_allocate_resources(p_adapter_t adapter)
 	memset(adapter->Isr, 0, sizeof(u32) * IsrCount);
 
 	DBG_ERROR("%s Allocate shared XMT ring zero index location size[%lx]\n",
-		  __FUNCTION__, sizeof(u32));
+		  __func__, sizeof(u32));
 
 	// Allocate shared XMT ring zero index location
 	adapter->XmtRingZeroIndex = pci_alloc_consistent(adapter->pcidev,
@@ -587,7 +587,7 @@ static int sxg_allocate_resources(p_adapter_t adapter)
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "XAlcResS",
 		  adapter, SXG_MAX_ENTRIES, 0, 0);
 
-	DBG_ERROR("%s EXIT\n", __FUNCTION__);
+	DBG_ERROR("%s EXIT\n", __func__);
 	return (STATUS_SUCCESS);
 }
 
@@ -606,7 +606,7 @@ static void sxg_config_pci(struct pci_dev *pcidev)
 	u16 new_command;
 
 	pci_read_config_word(pcidev, PCI_COMMAND, &pci_command);
-	DBG_ERROR("sxg: %s  PCI command[%4.4x]\n", __FUNCTION__, pci_command);
+	DBG_ERROR("sxg: %s  PCI command[%4.4x]\n", __func__, pci_command);
 	// Set the command register
 	new_command = pci_command | (PCI_COMMAND_MEMORY |	// Memory Space Enable
 				     PCI_COMMAND_MASTER |	// Bus master enable
@@ -616,7 +616,7 @@ static void sxg_config_pci(struct pci_dev *pcidev)
 				     PCI_COMMAND_FAST_BACK);	// Fast back-to-back
 	if (pci_command != new_command) {
 		DBG_ERROR("%s -- Updating PCI COMMAND register %4.4x->%4.4x.\n",
-			  __FUNCTION__, pci_command, new_command);
+			  __func__, pci_command, new_command);
 		pci_write_config_word(pcidev, PCI_COMMAND, new_command);
 	}
 }
@@ -634,7 +634,7 @@ static int sxg_entry_probe(struct pci_dev *pcidev,
 	ulong mmio_len = 0;
 
 	DBG_ERROR("sxg: %s 2.6 VERSION ENTER jiffies[%lx] cpu %d\n",
-		  __FUNCTION__, jiffies, smp_processor_id());
+		  __func__, jiffies, smp_processor_id());
 
 	// Initialize trace buffer
 #ifdef ATKDBG
@@ -701,11 +701,11 @@ static int sxg_entry_probe(struct pci_dev *pcidev,
 		  mmio_start, mmio_len);
 
 	memmapped_ioaddr = ioremap(mmio_start, mmio_len);
-	DBG_ERROR("sxg: %s MEMMAPPED_IOADDR [%p]\n", __FUNCTION__,
+	DBG_ERROR("sxg: %s MEMMAPPED_IOADDR [%p]\n", __func__,
 		  memmapped_ioaddr);
 	if (!memmapped_ioaddr) {
 		DBG_ERROR("%s cannot remap MMIO region %lx @ %lx\n",
-			  __FUNCTION__, mmio_len, mmio_start);
+			  __func__, mmio_len, mmio_start);
 		goto err_out_free_mmio_region;
 	}
 
@@ -727,7 +727,7 @@ static int sxg_entry_probe(struct pci_dev *pcidev,
 		  memmapped_ioaddr);
 	if (!memmapped_ioaddr) {
 		DBG_ERROR("%s cannot remap MMIO region %lx @ %lx\n",
-			  __FUNCTION__, mmio_len, mmio_start);
+			  __func__, mmio_len, mmio_start);
 		goto err_out_free_mmio_region;
 	}
 
@@ -762,13 +762,13 @@ static int sxg_entry_probe(struct pci_dev *pcidev,
 //        goto sxg_init_bad;
 //    }
 
-	DBG_ERROR("sxg: %s ENTER sxg_config_pci\n", __FUNCTION__);
+	DBG_ERROR("sxg: %s ENTER sxg_config_pci\n", __func__);
 	sxg_config_pci(pcidev);
-	DBG_ERROR("sxg: %s EXIT sxg_config_pci\n", __FUNCTION__);
+	DBG_ERROR("sxg: %s EXIT sxg_config_pci\n", __func__);
 
-	DBG_ERROR("sxg: %s ENTER sxg_init_driver\n", __FUNCTION__);
+	DBG_ERROR("sxg: %s ENTER sxg_init_driver\n", __func__);
 	sxg_init_driver();
-	DBG_ERROR("sxg: %s EXIT sxg_init_driver\n", __FUNCTION__);
+	DBG_ERROR("sxg: %s EXIT sxg_init_driver\n", __func__);
 
 	adapter->vendid = pci_tbl_entry->vendor;
 	adapter->devid = pci_tbl_entry->device;
@@ -785,18 +785,18 @@ static int sxg_entry_probe(struct pci_dev *pcidev,
 	adapter->cardindex = adapter->port;
 
 	// Allocate memory and other resources
-	DBG_ERROR("sxg: %s ENTER sxg_allocate_resources\n", __FUNCTION__);
+	DBG_ERROR("sxg: %s ENTER sxg_allocate_resources\n", __func__);
 	status = sxg_allocate_resources(adapter);
 	DBG_ERROR("sxg: %s EXIT sxg_allocate_resources status %x\n",
-		  __FUNCTION__, status);
+		  __func__, status);
 	if (status != STATUS_SUCCESS) {
 		goto err_out_unmap;
 	}
 
-	DBG_ERROR("sxg: %s ENTER sxg_download_microcode\n", __FUNCTION__);
+	DBG_ERROR("sxg: %s ENTER sxg_download_microcode\n", __func__);
 	if (sxg_download_microcode(adapter, SXG_UCODE_SAHARA)) {
 		DBG_ERROR("sxg: %s ENTER sxg_adapter_set_hwaddr\n",
-			  __FUNCTION__);
+			  __func__);
 		sxg_adapter_set_hwaddr(adapter);
 	} else {
 		adapter->state = ADAPT_FAIL;
@@ -836,7 +836,7 @@ static int sxg_entry_probe(struct pci_dev *pcidev,
 	ASSERT(status == FALSE);
 //      sxg_free_adapter(adapter);
 
-	DBG_ERROR("sxg: %s EXIT status[%x] jiffies[%lx] cpu %d\n", __FUNCTION__,
+	DBG_ERROR("sxg: %s EXIT status[%x] jiffies[%lx] cpu %d\n", __func__,
 		  status, jiffies, smp_processor_id());
 	return status;
 
@@ -848,7 +848,7 @@ static int sxg_entry_probe(struct pci_dev *pcidev,
 
       err_out_exit_sxg_probe:
 
-	DBG_ERROR("%s EXIT jiffies[%lx] cpu %d\n", __FUNCTION__, jiffies,
+	DBG_ERROR("%s EXIT jiffies[%lx] cpu %d\n", __func__, jiffies,
 		  smp_processor_id());
 
 	return -ENODEV;
@@ -1067,7 +1067,7 @@ static int sxg_process_isr(p_adapter_t adapter, u32 MessageId)
 	if (Isr & SXG_ISR_ERR) {
 		if (Isr & SXG_ISR_PDQF) {
 			adapter->Stats.PdqFull++;
-			DBG_ERROR("%s: SXG_ISR_ERR  PDQF!!\n", __FUNCTION__);
+			DBG_ERROR("%s: SXG_ISR_ERR  PDQF!!\n", __func__);
 		}
 		// No host buffer
 		if (Isr & SXG_ISR_RMISS) {
@@ -1080,7 +1080,7 @@ static int sxg_process_isr(p_adapter_t adapter, u32 MessageId)
 			adapter->Stats.RcvNoBuffer++;
 			if (adapter->Stats.RcvNoBuffer < 5) {
 				DBG_ERROR("%s: SXG_ISR_ERR  RMISS!!\n",
-					  __FUNCTION__);
+					  __func__);
 			}
 		}
 		// Card crash
@@ -1091,7 +1091,7 @@ static int sxg_process_isr(p_adapter_t adapter, u32 MessageId)
 					    SXG_ISR_CPU_SHIFT);
 			adapter->CrashLocation = (ushort) (Isr & SXG_ISR_CRASH);
 			adapter->Dead = TRUE;
-			DBG_ERROR("%s: ISR_DEAD %x, CPU: %d\n", __FUNCTION__,
+			DBG_ERROR("%s: ISR_DEAD %x, CPU: %d\n", __func__,
 				  adapter->CrashLocation, adapter->CrashCpu);
 		}
 		// Event ring full
@@ -1102,13 +1102,13 @@ static int sxg_process_isr(p_adapter_t adapter, u32 MessageId)
 			// and/or reduce/remove interrupt aggregation.
 			adapter->Stats.EventRingFull++;
 			DBG_ERROR("%s: SXG_ISR_ERR  EVENT RING FULL!!\n",
-				  __FUNCTION__);
+				  __func__);
 		}
 		// Transmit drop - no DRAM buffers or XMT error
 		if (Isr & SXG_ISR_XDROP) {
 			adapter->Stats.XmtDrops++;
 			adapter->Stats.XmtErrors++;
-			DBG_ERROR("%s: SXG_ISR_ERR  XDROP!!\n", __FUNCTION__);
+			DBG_ERROR("%s: SXG_ISR_ERR  XDROP!!\n", __func__);
 		}
 	}
 	// Slowpath send completions
@@ -1218,7 +1218,7 @@ static u32 sxg_process_event_queue(p_adapter_t adapter, u32 RssId)
 			break;
 		default:
 			DBG_ERROR("%s: ERROR  Invalid EventCode %d\n",
-				  __FUNCTION__, Event->Code);
+				  __func__, Event->Code);
 //                      ASSERT(0);
 		}
 		// See if we need to restock card receive buffers.
@@ -1606,7 +1606,7 @@ static int sxg_register_interrupt(p_adapter_t adapter)
 
 		DBG_ERROR
 		    ("sxg: %s AllocAdaptRsrcs adapter[%p] dev->irq[%x] %x\n",
-		     __FUNCTION__, adapter, adapter->netdev->irq, NR_IRQS);
+		     __func__, adapter, adapter->netdev->irq, NR_IRQS);
 
 		spin_unlock_irqrestore(&sxg_global.driver_lock,
 				       sxg_global.flags);
@@ -1629,14 +1629,14 @@ static int sxg_register_interrupt(p_adapter_t adapter)
 		adapter->MsiEnabled = FALSE;
 		adapter->RssEnabled = FALSE;
 		DBG_ERROR("sxg: %s AllocAdaptRsrcs adapter[%p] dev->irq[%x]\n",
-			  __FUNCTION__, adapter, adapter->netdev->irq);
+			  __func__, adapter, adapter->netdev->irq);
 	}
 	return (STATUS_SUCCESS);
 }
 
 static void sxg_deregister_interrupt(p_adapter_t adapter)
 {
-	DBG_ERROR("sxg: %s ENTER adapter[%p]\n", __FUNCTION__, adapter);
+	DBG_ERROR("sxg: %s ENTER adapter[%p]\n", __func__, adapter);
 #if XXXTODO
 	slic_init_cleanup(adapter);
 #endif
@@ -1651,7 +1651,7 @@ static void sxg_deregister_interrupt(p_adapter_t adapter)
 	adapter->rcv_broadcasts = 0;
 	adapter->rcv_multicasts = 0;
 	adapter->rcv_unicasts = 0;
-	DBG_ERROR("sxg: %s EXIT\n", __FUNCTION__);
+	DBG_ERROR("sxg: %s EXIT\n", __func__);
 }
 
 /*
@@ -1666,7 +1666,7 @@ static int sxg_if_init(p_adapter_t adapter)
 	int status = 0;
 
 	DBG_ERROR("sxg: %s (%s) ENTER states[%d:%d:%d] flags[%x]\n",
-		  __FUNCTION__, adapter->netdev->name,
+		  __func__, adapter->netdev->name,
 		  adapter->queues_initialized, adapter->state,
 		  adapter->linkstate, dev->flags);
 
@@ -1680,7 +1680,7 @@ static int sxg_if_init(p_adapter_t adapter)
 	adapter->devflags_prev = dev->flags;
 	adapter->macopts = MAC_DIRECTED;
 	if (dev->flags) {
-		DBG_ERROR("sxg: %s (%s) Set MAC options: ", __FUNCTION__,
+		DBG_ERROR("sxg: %s (%s) Set MAC options: ", __func__,
 			  adapter->netdev->name);
 		if (dev->flags & IFF_BROADCAST) {
 			adapter->macopts |= MAC_BCAST;
@@ -1713,7 +1713,7 @@ static int sxg_if_init(p_adapter_t adapter)
 	/*
 	 *    clear any pending events, then enable interrupts
 	 */
-	DBG_ERROR("sxg: %s ENABLE interrupts(slic)\n", __FUNCTION__);
+	DBG_ERROR("sxg: %s ENABLE interrupts(slic)\n", __func__);
 
 	return (STATUS_SUCCESS);
 }
@@ -1724,11 +1724,11 @@ static int sxg_entry_open(p_net_device dev)
 	int status;
 
 	ASSERT(adapter);
-	DBG_ERROR("sxg: %s adapter->activated[%d]\n", __FUNCTION__,
+	DBG_ERROR("sxg: %s adapter->activated[%d]\n", __func__,
 		  adapter->activated);
 	DBG_ERROR
 	    ("sxg: %s (%s): [jiffies[%lx] cpu %d] dev[%p] adapt[%p] port[%d]\n",
-	     __FUNCTION__, adapter->netdev->name, jiffies, smp_processor_id(),
+	     __func__, adapter->netdev->name, jiffies, smp_processor_id(),
 	     adapter->netdev, adapter, adapter->port);
 
 	netif_stop_queue(adapter->netdev);
@@ -1739,15 +1739,15 @@ static int sxg_entry_open(p_net_device dev)
 		adapter->activated = 1;
 	}
 	// Initialize the adapter
-	DBG_ERROR("sxg: %s ENTER sxg_initialize_adapter\n", __FUNCTION__);
+	DBG_ERROR("sxg: %s ENTER sxg_initialize_adapter\n", __func__);
 	status = sxg_initialize_adapter(adapter);
 	DBG_ERROR("sxg: %s EXIT sxg_initialize_adapter status[%x]\n",
-		  __FUNCTION__, status);
+		  __func__, status);
 
 	if (status == STATUS_SUCCESS) {
-		DBG_ERROR("sxg: %s ENTER sxg_if_init\n", __FUNCTION__);
+		DBG_ERROR("sxg: %s ENTER sxg_if_init\n", __func__);
 		status = sxg_if_init(adapter);
-		DBG_ERROR("sxg: %s EXIT sxg_if_init status[%x]\n", __FUNCTION__,
+		DBG_ERROR("sxg: %s EXIT sxg_if_init status[%x]\n", __func__,
 			  status);
 	}
 
@@ -1760,12 +1760,12 @@ static int sxg_entry_open(p_net_device dev)
 				       sxg_global.flags);
 		return (status);
 	}
-	DBG_ERROR("sxg: %s ENABLE ALL INTERRUPTS\n", __FUNCTION__);
+	DBG_ERROR("sxg: %s ENABLE ALL INTERRUPTS\n", __func__);
 
 	// Enable interrupts
 	SXG_ENABLE_ALL_INTERRUPTS(adapter);
 
-	DBG_ERROR("sxg: %s EXIT\n", __FUNCTION__);
+	DBG_ERROR("sxg: %s EXIT\n", __func__);
 
 	spin_unlock_irqrestore(&sxg_global.driver_lock, sxg_global.flags);
 	return STATUS_SUCCESS;
@@ -1779,27 +1779,27 @@ static void __devexit sxg_entry_remove(struct pci_dev *pcidev)
 	p_adapter_t adapter = (p_adapter_t) netdev_priv(dev);
 
 	ASSERT(adapter);
-	DBG_ERROR("sxg: %s ENTER dev[%p] adapter[%p]\n", __FUNCTION__, dev,
+	DBG_ERROR("sxg: %s ENTER dev[%p] adapter[%p]\n", __func__, dev,
 		  adapter);
 	sxg_deregister_interrupt(adapter);
 	sxg_unmap_mmio_space(adapter);
-	DBG_ERROR("sxg: %s unregister_netdev\n", __FUNCTION__);
+	DBG_ERROR("sxg: %s unregister_netdev\n", __func__);
 	unregister_netdev(dev);
 
 	mmio_start = pci_resource_start(pcidev, 0);
 	mmio_len = pci_resource_len(pcidev, 0);
 
-	DBG_ERROR("sxg: %s rel_region(0) start[%x] len[%x]\n", __FUNCTION__,
+	DBG_ERROR("sxg: %s rel_region(0) start[%x] len[%x]\n", __func__,
 		  mmio_start, mmio_len);
 	release_mem_region(mmio_start, mmio_len);
 
-	DBG_ERROR("sxg: %s iounmap dev->base_addr[%x]\n", __FUNCTION__,
+	DBG_ERROR("sxg: %s iounmap dev->base_addr[%x]\n", __func__,
 		  (unsigned int)dev->base_addr);
 	iounmap((char *)dev->base_addr);
 
-	DBG_ERROR("sxg: %s deallocate device\n", __FUNCTION__);
+	DBG_ERROR("sxg: %s deallocate device\n", __func__);
 	kfree(dev);
-	DBG_ERROR("sxg: %s EXIT\n", __FUNCTION__);
+	DBG_ERROR("sxg: %s EXIT\n", __func__);
 }
 
 static int sxg_entry_halt(p_net_device dev)
@@ -1807,17 +1807,17 @@ static int sxg_entry_halt(p_net_device dev)
 	p_adapter_t adapter = (p_adapter_t) netdev_priv(dev);
 
 	spin_lock_irqsave(&sxg_global.driver_lock, sxg_global.flags);
-	DBG_ERROR("sxg: %s (%s) ENTER\n", __FUNCTION__, dev->name);
+	DBG_ERROR("sxg: %s (%s) ENTER\n", __func__, dev->name);
 
 	netif_stop_queue(adapter->netdev);
 	adapter->state = ADAPT_DOWN;
 	adapter->linkstate = LINK_DOWN;
 	adapter->devflags_prev = 0;
 	DBG_ERROR("sxg: %s (%s) set adapter[%p] state to ADAPT_DOWN(%d)\n",
-		  __FUNCTION__, dev->name, adapter, adapter->state);
+		  __func__, dev->name, adapter, adapter->state);
 
-	DBG_ERROR("sxg: %s (%s) EXIT\n", __FUNCTION__, dev->name);
-	DBG_ERROR("sxg: %s EXIT\n", __FUNCTION__);
+	DBG_ERROR("sxg: %s (%s) EXIT\n", __func__, dev->name);
+	DBG_ERROR("sxg: %s EXIT\n", __func__);
 	spin_unlock_irqrestore(&sxg_global.driver_lock, sxg_global.flags);
 	return (STATUS_SUCCESS);
 }
@@ -1825,7 +1825,7 @@ static int sxg_entry_halt(p_net_device dev)
 static int sxg_ioctl(p_net_device dev, struct ifreq *rq, int cmd)
 {
 	ASSERT(rq);
-//      DBG_ERROR("sxg: %s cmd[%x] rq[%p] dev[%p]\n", __FUNCTION__, cmd, rq, dev);
+//      DBG_ERROR("sxg: %s cmd[%x] rq[%p] dev[%p]\n", __func__, cmd, rq, dev);
 	switch (cmd) {
 	case SIOCSLICSETINTAGG:
 		{
@@ -1841,12 +1841,12 @@ static int sxg_ioctl(p_net_device dev, struct ifreq *rq, int cmd)
 			intagg = data[0];
 			printk(KERN_EMERG
 			       "%s: set interrupt aggregation to %d\n",
-			       __FUNCTION__, intagg);
+			       __func__, intagg);
 			return 0;
 		}
 
 	default:
-//              DBG_ERROR("sxg: %s UNSUPPORTED[%x]\n", __FUNCTION__, cmd);
+//              DBG_ERROR("sxg: %s UNSUPPORTED[%x]\n", __func__, cmd);
 		return -EOPNOTSUPP;
 	}
 	return 0;
@@ -1870,7 +1870,7 @@ static int sxg_send_packets(struct sk_buff *skb, p_net_device dev)
 	p_adapter_t adapter = (p_adapter_t) netdev_priv(dev);
 	u32 status = STATUS_SUCCESS;
 
-	DBG_ERROR("sxg: %s ENTER sxg_send_packets skb[%p]\n", __FUNCTION__,
+	DBG_ERROR("sxg: %s ENTER sxg_send_packets skb[%p]\n", __func__,
 		  skb);
 	// Check the adapter state
 	switch (adapter->State) {
@@ -1914,7 +1914,7 @@ static int sxg_send_packets(struct sk_buff *skb, p_net_device dev)
 		adapter->stats.tx_dropped++;
 #endif
 	}
-	DBG_ERROR("sxg: %s EXIT sxg_send_packets status[%x]\n", __FUNCTION__,
+	DBG_ERROR("sxg: %s EXIT sxg_send_packets status[%x]\n", __func__,
 		  status);
 
       xmit_done:
@@ -2279,7 +2279,7 @@ static int sxg_phy_init(p_adapter_t adapter)
 	PPHY_UCODE p;
 	int status;
 
-	DBG_ERROR("ENTER %s\n", __FUNCTION__);
+	DBG_ERROR("ENTER %s\n", __func__);
 
 	// Read a register to identify the PHY type
 	status = sxg_read_mdio_reg(adapter, MIIM_DEV_PHY_PMA,	// PHY PMA/PMD module
@@ -2307,7 +2307,7 @@ static int sxg_phy_init(p_adapter_t adapter)
 			}
 		}
 	}
-	DBG_ERROR("EXIT %s\n", __FUNCTION__);
+	DBG_ERROR("EXIT %s\n", __func__);
 
 	return (STATUS_SUCCESS);
 }
@@ -2330,7 +2330,7 @@ static void sxg_link_event(p_adapter_t adapter)
 
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "LinkEvnt",
 		  adapter, 0, 0, 0);
-	DBG_ERROR("ENTER %s\n", __FUNCTION__);
+	DBG_ERROR("ENTER %s\n", __func__);
 
 	// Check the Link Status register.  We should have a Link Alarm.
 	READ_REG(HwRegs->LinkStatus, Value);
@@ -2365,7 +2365,7 @@ static void sxg_link_event(p_adapter_t adapter)
 		DBG_ERROR("SXG: Link Status == 0x%08X.\n", Value);
 //              ASSERT(0);
 	}
-	DBG_ERROR("EXIT %s\n", __FUNCTION__);
+	DBG_ERROR("EXIT %s\n", __func__);
 
 }
 
@@ -2383,7 +2383,7 @@ static SXG_LINK_STATE sxg_get_link_state(p_adapter_t adapter)
 	int status;
 	u32 Value;
 
-	DBG_ERROR("ENTER %s\n", __FUNCTION__);
+	DBG_ERROR("ENTER %s\n", __func__);
 
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "GetLink",
 		  adapter, 0, 0, 0);
@@ -2421,7 +2421,7 @@ static SXG_LINK_STATE sxg_get_link_state(p_adapter_t adapter)
 		return (SXG_LINK_DOWN);
 
 	// All 3 bits are true, so the link is up
-	DBG_ERROR("EXIT %s\n", __FUNCTION__);
+	DBG_ERROR("EXIT %s\n", __func__);
 
 	return (SXG_LINK_UP);
 
@@ -2437,11 +2437,11 @@ static void sxg_indicate_link_state(p_adapter_t adapter,
 {
 	if (adapter->LinkState == SXG_LINK_UP) {
 		DBG_ERROR("%s: LINK now UP, call netif_start_queue\n",
-			  __FUNCTION__);
+			  __func__);
 		netif_start_queue(adapter->netdev);
 	} else {
 		DBG_ERROR("%s: LINK now DOWN, call netif_stop_queue\n",
-			  __FUNCTION__);
+			  __func__);
 		netif_stop_queue(adapter->netdev);
 	}
 }
@@ -2464,7 +2464,7 @@ static void sxg_link_state(p_adapter_t adapter, SXG_LINK_STATE LinkState)
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_IMPORTANT, "LnkINDCT",
 		  adapter, LinkState, adapter->LinkState, adapter->State);
 
-	DBG_ERROR("ENTER %s\n", __FUNCTION__);
+	DBG_ERROR("ENTER %s\n", __func__);
 
 	// Hold the adapter lock during this routine.  Maybe move
 	// the lock to the caller.
@@ -2472,7 +2472,7 @@ static void sxg_link_state(p_adapter_t adapter, SXG_LINK_STATE LinkState)
 	if (LinkState == adapter->LinkState) {
 		// Nothing changed..
 		spin_unlock(&adapter->AdapterLock);
-		DBG_ERROR("EXIT #0 %s\n", __FUNCTION__);
+		DBG_ERROR("EXIT #0 %s\n", __func__);
 		return;
 	}
 	// Save the adapter state
@@ -2480,7 +2480,7 @@ static void sxg_link_state(p_adapter_t adapter, SXG_LINK_STATE LinkState)
 
 	// Drop the lock and indicate link state
 	spin_unlock(&adapter->AdapterLock);
-	DBG_ERROR("EXIT #1 %s\n", __FUNCTION__);
+	DBG_ERROR("EXIT #1 %s\n", __func__);
 
 	sxg_indicate_link_state(adapter, LinkState);
 }
@@ -2507,7 +2507,7 @@ static int sxg_write_mdio_reg(p_adapter_t adapter,
 	u32 ValueRead;
 	u32 Timeout;
 
-//  DBG_ERROR("ENTER %s\n", __FUNCTION__);
+//  DBG_ERROR("ENTER %s\n", __func__);
 
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "WrtMDIO",
 		  adapter, 0, 0, 0);
@@ -2570,7 +2570,7 @@ static int sxg_write_mdio_reg(p_adapter_t adapter,
 		}
 	} while (ValueRead & AXGMAC_AMIIM_INDC_BUSY);
 
-//  DBG_ERROR("EXIT %s\n", __FUNCTION__);
+//  DBG_ERROR("EXIT %s\n", __func__);
 
 	return (STATUS_SUCCESS);
 }
@@ -2599,7 +2599,7 @@ static int sxg_read_mdio_reg(p_adapter_t adapter,
 
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "WrtMDIO",
 		  adapter, 0, 0, 0);
-//  DBG_ERROR("ENTER %s\n", __FUNCTION__);
+//  DBG_ERROR("ENTER %s\n", __func__);
 
 	// Ensure values don't exceed field width
 	DevAddr &= 0x001F;	// 5-bit field
@@ -2662,7 +2662,7 @@ static int sxg_read_mdio_reg(p_adapter_t adapter,
 	READ_REG(HwRegs->MacAmiimField, *pValue);
 	*pValue &= 0xFFFF;	// data is in the lower 16 bits
 
-//  DBG_ERROR("EXIT %s\n", __FUNCTION__);
+//  DBG_ERROR("EXIT %s\n", __func__);
 
 	return (STATUS_SUCCESS);
 }
@@ -2809,7 +2809,7 @@ static void sxg_mcast_set_list(p_net_device dev)
 	}
 
 	DBG_ERROR("%s a->devflags_prev[%x] dev->flags[%x] status[%x]\n",
-		  __FUNCTION__, adapter->devflags_prev, dev->flags, status);
+		  __func__, adapter->devflags_prev, dev->flags, status);
 	if (adapter->devflags_prev != dev->flags) {
 		adapter->macopts = MAC_DIRECTED;
 		if (dev->flags) {
@@ -2828,7 +2828,7 @@ static void sxg_mcast_set_list(p_net_device dev)
 		}
 		adapter->devflags_prev = dev->flags;
 		DBG_ERROR("%s call sxg_config_set adapter->macopts[%x]\n",
-			  __FUNCTION__, adapter->macopts);
+			  __func__, adapter->macopts);
 		sxg_config_set(adapter, TRUE);
 	} else {
 		if (status == STATUS_SUCCESS) {
@@ -2843,7 +2843,7 @@ static void sxg_mcast_set_mask(p_adapter_t adapter)
 {
 	PSXG_UCODE_REGS sxg_regs = adapter->UcodeRegs;
 
-	DBG_ERROR("%s ENTER (%s) macopts[%x] mask[%llx]\n", __FUNCTION__,
+	DBG_ERROR("%s ENTER (%s) macopts[%x] mask[%llx]\n", __func__,
 		  adapter->netdev->name, (unsigned int)adapter->MacFilter,
 		  adapter->MulticastMask);
 
@@ -2852,17 +2852,17 @@ static void sxg_mcast_set_mask(p_adapter_t adapter)
 		 * mode as well as ALLMCAST mode.  It saves the Microcode from having
 		 * to keep state about the MAC configuration.
 		 */
-//              DBG_ERROR("sxg: %s macopts = MAC_ALLMCAST | MAC_PROMISC\n      SLUT MODE!!!\n",__FUNCTION__);
+//              DBG_ERROR("sxg: %s macopts = MAC_ALLMCAST | MAC_PROMISC\n      SLUT MODE!!!\n",__func__);
 		WRITE_REG(sxg_regs->McastLow, 0xFFFFFFFF, FLUSH);
 		WRITE_REG(sxg_regs->McastHigh, 0xFFFFFFFF, FLUSH);
-//        DBG_ERROR("%s (%s) WRITE to slic_regs slic_mcastlow&high 0xFFFFFFFF\n",__FUNCTION__, adapter->netdev->name);
+//        DBG_ERROR("%s (%s) WRITE to slic_regs slic_mcastlow&high 0xFFFFFFFF\n",__func__, adapter->netdev->name);
 
 	} else {
 		/* Commit our multicast mast to the SLIC by writing to the multicast
 		 * address mask registers
 		 */
 		DBG_ERROR("%s (%s) WRITE mcastlow[%lx] mcasthigh[%lx]\n",
-			  __FUNCTION__, adapter->netdev->name,
+			  __func__, adapter->netdev->name,
 			  ((ulong) (adapter->MulticastMask & 0xFFFFFFFF)),
 			  ((ulong)
 			   ((adapter->MulticastMask >> 32) & 0xFFFFFFFF)));
@@ -3200,7 +3200,7 @@ static void sxg_allocate_rcvblock_complete(p_adapter_t adapter,
 		pci_free_consistent(adapter->pcidev,
 				    Length, RcvBlock, PhysicalAddress);
 	}
-	DBG_ERROR("%s: OUT OF RESOURCES\n", __FUNCTION__);
+	DBG_ERROR("%s: OUT OF RESOURCES\n", __func__);
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_IMPORTANT, "RcvAFail",
 		  adapter, adapter->FreeRcvBufferCount,
 		  adapter->FreeRcvBlockCount, adapter->AllRcvBlockCount);
@@ -3244,13 +3244,13 @@ static unsigned char temp_mac_address[6] =
 
 static void sxg_adapter_set_hwaddr(p_adapter_t adapter)
 {
-//  DBG_ERROR ("%s ENTER card->config_set[%x] port[%d] physport[%d] funct#[%d]\n", __FUNCTION__,
+//  DBG_ERROR ("%s ENTER card->config_set[%x] port[%d] physport[%d] funct#[%d]\n", __func__,
 //             card->config_set, adapter->port, adapter->physport, adapter->functionnumber);
 //
 //  sxg_dbg_macaddrs(adapter);
 
 	memcpy(adapter->macaddr, temp_mac_address, sizeof(SXG_CONFIG_MAC));
-//      DBG_ERROR ("%s AFTER copying from config.macinfo into currmacaddr\n", __FUNCTION__);
+//      DBG_ERROR ("%s AFTER copying from config.macinfo into currmacaddr\n", __func__);
 //      sxg_dbg_macaddrs(adapter);
 	if (!(adapter->currmacaddr[0] ||
 	      adapter->currmacaddr[1] ||
@@ -3262,7 +3262,7 @@ static void sxg_adapter_set_hwaddr(p_adapter_t adapter)
 	if (adapter->netdev) {
 		memcpy(adapter->netdev->dev_addr, adapter->currmacaddr, 6);
 	}
-//  DBG_ERROR ("%s EXIT port %d\n", __FUNCTION__, adapter->port);
+//  DBG_ERROR ("%s EXIT port %d\n", __func__, adapter->port);
 	sxg_dbg_macaddrs(adapter);
 
 }
@@ -3273,7 +3273,7 @@ static int sxg_mac_set_address(p_net_device dev, void *ptr)
 	p_adapter_t adapter = (p_adapter_t) netdev_priv(dev);
 	struct sockaddr *addr = ptr;
 
-	DBG_ERROR("%s ENTER (%s)\n", __FUNCTION__, adapter->netdev->name);
+	DBG_ERROR("%s ENTER (%s)\n", __func__, adapter->netdev->name);
 
 	if (netif_running(dev)) {
 		return -EBUSY;
@@ -3282,14 +3282,14 @@ static int sxg_mac_set_address(p_net_device dev, void *ptr)
 		return -EBUSY;
 	}
 	DBG_ERROR("sxg: %s (%s) curr %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
-		  __FUNCTION__, adapter->netdev->name, adapter->currmacaddr[0],
+		  __func__, adapter->netdev->name, adapter->currmacaddr[0],
 		  adapter->currmacaddr[1], adapter->currmacaddr[2],
 		  adapter->currmacaddr[3], adapter->currmacaddr[4],
 		  adapter->currmacaddr[5]);
 	memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
 	memcpy(adapter->currmacaddr, addr->sa_data, dev->addr_len);
 	DBG_ERROR("sxg: %s (%s) new %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
-		  __FUNCTION__, adapter->netdev->name, adapter->currmacaddr[0],
+		  __func__, adapter->netdev->name, adapter->currmacaddr[0],
 		  adapter->currmacaddr[1], adapter->currmacaddr[2],
 		  adapter->currmacaddr[3], adapter->currmacaddr[4],
 		  adapter->currmacaddr[5]);
@@ -3383,9 +3383,9 @@ static int sxg_initialize_adapter(p_adapter_t adapter)
 		  SXG_RCV_TCP_CSUM_ENABLED | SXG_RCV_IP_CSUM_ENABLED, TRUE);
 
 	// Initialize the MAC, XAUI
-	DBG_ERROR("sxg: %s ENTER sxg_initialize_link\n", __FUNCTION__);
+	DBG_ERROR("sxg: %s ENTER sxg_initialize_link\n", __func__);
 	status = sxg_initialize_link(adapter);
-	DBG_ERROR("sxg: %s EXIT sxg_initialize_link status[%x]\n", __FUNCTION__,
+	DBG_ERROR("sxg: %s EXIT sxg_initialize_link status[%x]\n", __func__,
 		  status);
 	if (status != STATUS_SUCCESS) {
 		return (status);
drivers/staging/sxg/sxgdbg.h +1 -1
index cfb6c7c..4522b8d 100644
@@ -58,7 +58,7 @@
     {                                                                             \
         if (!(a)) {                                                               \
             DBG_ERROR("ASSERT() Failure: file %s, function %s  line %d\n",\
-                __FILE__, __FUNCTION__, __LINE__);                                \
+                __FILE__, __func__, __LINE__);                                \
         }                                                                         \
     }
 #endif
Signature · 1 line
1.6.0.2
#23 lore raw

PATCH 17/42 Staging: echo: A separate oslec.h for external interface

In reply to Greg KH

From: Tzafrir Cohen <[email protected]>

Split out the external interface to a separate file called oslec.h .

Give the struct a name while we're at it.

---
 drivers/staging/echo/echo.h  |   53 +------------------------
 drivers/staging/echo/oslec.h |   86 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 89 insertions(+), 50 deletions(-)
 create mode 100644 drivers/staging/echo/oslec.h
drivers/staging/echo/echo.h +3 -50
index 7a91b43..5c8b515 100644
@@ -118,21 +118,13 @@ a minor burden.
 */
 
 #include "fir.h"
-
-/* Mask bits for the adaption mode */
-#define ECHO_CAN_USE_ADAPTION	0x01
-#define ECHO_CAN_USE_NLP	0x02
-#define ECHO_CAN_USE_CNG	0x04
-#define ECHO_CAN_USE_CLIP	0x08
-#define ECHO_CAN_USE_TX_HPF	0x10
-#define ECHO_CAN_USE_RX_HPF	0x20
-#define ECHO_CAN_DISABLE	0x40
+#include "oslec.h"
 
 /*!
     G.168 echo canceller descriptor. This defines the working state for a line
     echo canceller.
 */
-typedef struct
+struct echo_can_state
 {
 	int16_t tx,rx;
 	int16_t clean;
@@ -176,45 +168,6 @@ typedef struct
 
 	/* snapshot sample of coeffs used for development */
 	int16_t *snapshot;
-} echo_can_state_t;
-
-/*! Create a voice echo canceller context.
-    \param len The length of the canceller, in samples.
-    \return The new canceller context, or NULL if the canceller could not be created.
-*/
-echo_can_state_t *echo_can_create(int len, int adaption_mode);
-
-/*! Free a voice echo canceller context.
-    \param ec The echo canceller context.
-*/
-void echo_can_free(echo_can_state_t *ec);
-
-/*! Flush (reinitialise) a voice echo canceller context.
-    \param ec The echo canceller context.
-*/
-void echo_can_flush(echo_can_state_t *ec);
-
-/*! Set the adaption mode of a voice echo canceller context.
-    \param ec The echo canceller context.
-    \param adapt The mode.
-*/
-void echo_can_adaption_mode(echo_can_state_t *ec, int adaption_mode);
-
-void echo_can_snapshot(echo_can_state_t *ec);
-
-/*! Process a sample through a voice echo canceller.
-    \param ec The echo canceller context.
-    \param tx The transmitted audio sample.
-    \param rx The received audio sample.
-    \return The clean (echo cancelled) received sample.
-*/
-int16_t echo_can_update(echo_can_state_t *ec, int16_t tx, int16_t rx);
-
-/*! Process to high pass filter the tx signal.
-    \param ec The echo canceller context.
-    \param tx The transmitted auio sample.
-    \return The HP filtered transmit sample, send this to your D/A.
-*/
-int16_t echo_can_hpf_tx(echo_can_state_t *ec, int16_t tx);
+};
 
 #endif	/* __ECHO_H */
drivers/staging/echo/oslec.h new file +86 -0

86 lines not on this page · raw message

Signature · 1 line
1.6.0.2
#24 lore raw

PATCH 18/42 Staging: echo: Export interface functions. Add module headers.

In reply to Greg KH

From: Tzafrir Cohen <[email protected]>

---
 drivers/staging/echo/echo.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
drivers/staging/echo/echo.c +12 -1
index 4a281b1..0a03eed 100644
@@ -289,6 +289,7 @@ echo_can_state_t *echo_can_create(int len, int adaption_mode)
 
     return  ec;
 }
+EXPORT_SYMBOL_GPL(echo_can_create);
 /*- End of function --------------------------------------------------------*/
 
 void echo_can_free(echo_can_state_t *ec)
@@ -302,12 +303,14 @@ void echo_can_free(echo_can_state_t *ec)
 	kfree(ec->snapshot);
 	kfree(ec);
 }
+EXPORT_SYMBOL_GPL(echo_can_free);
 /*- End of function --------------------------------------------------------*/
 
 void echo_can_adaption_mode(echo_can_state_t *ec, int adaption_mode)
 {
     ec->adaption_mode = adaption_mode;
 }
+EXPORT_SYMBOL_GPL(echo_can_adaption_mode);
 /*- End of function --------------------------------------------------------*/
 
 void echo_can_flush(echo_can_state_t *ec)
@@ -334,11 +337,13 @@ void echo_can_flush(echo_can_state_t *ec)
     ec->curr_pos = ec->taps - 1;
     ec->Pstates = 0;
 }
+EXPORT_SYMBOL_GPL(echo_can_flush);
 /*- End of function --------------------------------------------------------*/
 
 void echo_can_snapshot(echo_can_state_t *ec) {
     memcpy(ec->snapshot, ec->fir_taps16[0], ec->taps*sizeof(int16_t));
 }
+EXPORT_SYMBOL_GPL(echo_can_snapshot);
 /*- End of function --------------------------------------------------------*/
 
 /* Dual Path Echo Canceller ------------------------------------------------*/
@@ -584,7 +589,7 @@ int16_t echo_can_update(echo_can_state_t *ec, int16_t tx, int16_t rx)
 
     return (int16_t) ec->clean_nlp << 1;
 }
-
+EXPORT_SYMBOL_GPL(echo_can_update);
 /*- End of function --------------------------------------------------------*/
 
 /* This function is seperated from the echo canceller is it is usually called
@@ -630,3 +635,9 @@ int16_t echo_can_hpf_tx(echo_can_state_t *ec, int16_t tx) {
 
     return tx;
 }
+EXPORT_SYMBOL_GPL(echo_can_hpf_tx);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("David Rowe");
+MODULE_DESCRIPTION("Open Source Line Echo Canceller");
+MODULE_VERSION("0.3.0");
Signature · 1 line
1.6.0.2
#25 lore raw

PATCH 19/42 Staging: echo: Replace echo_can_state_t with struct echo_can_state

In reply to Greg KH

From: Tzafrir Cohen <[email protected]>

---
 drivers/staging/echo/echo.c  |   20 ++++++++++----------
 drivers/staging/echo/oslec.h |   16 ++++++++--------
 2 files changed, 18 insertions(+), 18 deletions(-)
drivers/staging/echo/echo.c +10 -10
index 0a03eed..a408b62 100644
@@ -128,7 +128,7 @@
 
 
 #ifdef __BLACKFIN_ASM__
-static void __inline__ lms_adapt_bg(echo_can_state_t *ec, int clean, int shift)
+static void __inline__ lms_adapt_bg(struct echo_can_state *ec, int clean, int shift)
 {
     int i, j;
     int offset1;
@@ -200,7 +200,7 @@ static void __inline__ lms_adapt_bg(echo_can_state_t *ec, int clean, int shift)
 */
 
 #else
-static __inline__ void lms_adapt_bg(echo_can_state_t *ec, int clean, int shift)
+static __inline__ void lms_adapt_bg(struct echo_can_state *ec, int clean, int shift)
 {
     int i;
 
@@ -234,9 +234,9 @@ static __inline__ void lms_adapt_bg(echo_can_state_t *ec, int clean, int shift)
 
 /*- End of function --------------------------------------------------------*/
 
-echo_can_state_t *echo_can_create(int len, int adaption_mode)
+struct echo_can_state *echo_can_create(int len, int adaption_mode)
 {
-    echo_can_state_t *ec;
+    struct echo_can_state *ec;
     int i;
     int j;
 
@@ -292,7 +292,7 @@ echo_can_state_t *echo_can_create(int len, int adaption_mode)
 EXPORT_SYMBOL_GPL(echo_can_create);
 /*- End of function --------------------------------------------------------*/
 
-void echo_can_free(echo_can_state_t *ec)
+void echo_can_free(struct echo_can_state *ec)
 {
 	int i;
 
@@ -306,14 +306,14 @@ void echo_can_free(echo_can_state_t *ec)
 EXPORT_SYMBOL_GPL(echo_can_free);
 /*- End of function --------------------------------------------------------*/
 
-void echo_can_adaption_mode(echo_can_state_t *ec, int adaption_mode)
+void echo_can_adaption_mode(struct echo_can_state *ec, int adaption_mode)
 {
     ec->adaption_mode = adaption_mode;
 }
 EXPORT_SYMBOL_GPL(echo_can_adaption_mode);
 /*- End of function --------------------------------------------------------*/
 
-void echo_can_flush(echo_can_state_t *ec)
+void echo_can_flush(struct echo_can_state *ec)
 {
     int i;
 
@@ -340,7 +340,7 @@ void echo_can_flush(echo_can_state_t *ec)
 EXPORT_SYMBOL_GPL(echo_can_flush);
 /*- End of function --------------------------------------------------------*/
 
-void echo_can_snapshot(echo_can_state_t *ec) {
+void echo_can_snapshot(struct echo_can_state *ec) {
     memcpy(ec->snapshot, ec->fir_taps16[0], ec->taps*sizeof(int16_t));
 }
 EXPORT_SYMBOL_GPL(echo_can_snapshot);
@@ -348,7 +348,7 @@ EXPORT_SYMBOL_GPL(echo_can_snapshot);
 
 /* Dual Path Echo Canceller ------------------------------------------------*/
 
-int16_t echo_can_update(echo_can_state_t *ec, int16_t tx, int16_t rx)
+int16_t echo_can_update(struct echo_can_state *ec, int16_t tx, int16_t rx)
 {
     int32_t echo_value;
     int clean_bg;
@@ -613,7 +613,7 @@ EXPORT_SYMBOL_GPL(echo_can_update);
    precision, which noise shapes things, giving very clean DC removal.
 */
 
-int16_t echo_can_hpf_tx(echo_can_state_t *ec, int16_t tx) {
+int16_t echo_can_hpf_tx(struct echo_can_state *ec, int16_t tx) {
     int tmp, tmp1;
 
     if (ec->adaption_mode & ECHO_CAN_USE_TX_HPF) {
drivers/staging/echo/oslec.h +8 -8
index 913fc51..8227013 100644
@@ -42,31 +42,31 @@
     G.168 echo canceller descriptor. This defines the working state for a line
     echo canceller.
 */
-typedef struct echo_can_state echo_can_state_t;
+struct echo_can_state;
 
 /*! Create a voice echo canceller context.
     \param len The length of the canceller, in samples.
     \return The new canceller context, or NULL if the canceller could not be created.
 */
-echo_can_state_t *echo_can_create(int len, int adaption_mode);
+struct echo_can_state *echo_can_create(int len, int adaption_mode);
 
 /*! Free a voice echo canceller context.
     \param ec The echo canceller context.
 */
-void echo_can_free(echo_can_state_t *ec);
+void echo_can_free(struct echo_can_state *ec);
 
 /*! Flush (reinitialise) a voice echo canceller context.
     \param ec The echo canceller context.
 */
-void echo_can_flush(echo_can_state_t *ec);
+void echo_can_flush(struct echo_can_state *ec);
 
 /*! Set the adaption mode of a voice echo canceller context.
     \param ec The echo canceller context.
     \param adapt The mode.
 */
-void echo_can_adaption_mode(echo_can_state_t *ec, int adaption_mode);
+void echo_can_adaption_mode(struct echo_can_state *ec, int adaption_mode);
 
-void echo_can_snapshot(echo_can_state_t *ec);
+void echo_can_snapshot(struct echo_can_state *ec);
 
 /*! Process a sample through a voice echo canceller.
     \param ec The echo canceller context.
@@ -74,13 +74,13 @@ void echo_can_snapshot(echo_can_state_t *ec);
     \param rx The received audio sample.
     \return The clean (echo cancelled) received sample.
 */
-int16_t echo_can_update(echo_can_state_t *ec, int16_t tx, int16_t rx);
+int16_t echo_can_update(struct echo_can_state *ec, int16_t tx, int16_t rx);
 
 /*! Process to high pass filter the tx signal.
     \param ec The echo canceller context.
     \param tx The transmitted auio sample.
     \return The HP filtered transmit sample, send this to your D/A.
 */
-int16_t echo_can_hpf_tx(echo_can_state_t *ec, int16_t tx);
+int16_t echo_can_hpf_tx(struct echo_can_state *ec, int16_t tx);
 
 #endif	/* __OSLEC_H */
Signature · 1 line
1.6.0.2
#26 lore raw

PATCH 20/42 Staging: echo: Changed preffix from echo_can_ to oslec_

In reply to Greg KH

From: Tzafrir Cohen <[email protected]>

---
 drivers/staging/echo/echo.c  |   36 ++++++++++++++++++------------------
 drivers/staging/echo/echo.h  |    2 +-
 drivers/staging/echo/oslec.h |   16 ++++++++--------
 3 files changed, 27 insertions(+), 27 deletions(-)
drivers/staging/echo/echo.c +18 -18
index a408b62..13792ef 100644
@@ -128,7 +128,7 @@
 
 
 #ifdef __BLACKFIN_ASM__
-static void __inline__ lms_adapt_bg(struct echo_can_state *ec, int clean, int shift)
+static void __inline__ lms_adapt_bg(struct oslec_state *ec, int clean, int shift)
 {
     int i, j;
     int offset1;
@@ -200,7 +200,7 @@ static void __inline__ lms_adapt_bg(struct echo_can_state *ec, int clean, int sh
 */
 
 #else
-static __inline__ void lms_adapt_bg(struct echo_can_state *ec, int clean, int shift)
+static __inline__ void lms_adapt_bg(struct oslec_state *ec, int clean, int shift)
 {
     int i;
 
@@ -234,9 +234,9 @@ static __inline__ void lms_adapt_bg(struct echo_can_state *ec, int clean, int sh
 
 /*- End of function --------------------------------------------------------*/
 
-struct echo_can_state *echo_can_create(int len, int adaption_mode)
+struct oslec_state *oslec_create(int len, int adaption_mode)
 {
-    struct echo_can_state *ec;
+    struct oslec_state *ec;
     int i;
     int j;
 
@@ -273,7 +273,7 @@ struct echo_can_state *echo_can_create(int len, int adaption_mode)
     }
 
     ec->cng_level = 1000;
-    echo_can_adaption_mode(ec, adaption_mode);
+    oslec_adaption_mode(ec, adaption_mode);
 
     ec->snapshot = (int16_t*)malloc(ec->taps*sizeof(int16_t));
     memset(ec->snapshot, 0, sizeof(int16_t)*ec->taps);
@@ -289,10 +289,10 @@ struct echo_can_state *echo_can_create(int len, int adaption_mode)
 
     return  ec;
 }
-EXPORT_SYMBOL_GPL(echo_can_create);
+EXPORT_SYMBOL_GPL(oslec_create);
 /*- End of function --------------------------------------------------------*/
 
-void echo_can_free(struct echo_can_state *ec)
+void oslec_free(struct oslec_state *ec)
 {
 	int i;
 
@@ -303,17 +303,17 @@ void echo_can_free(struct echo_can_state *ec)
 	kfree(ec->snapshot);
 	kfree(ec);
 }
-EXPORT_SYMBOL_GPL(echo_can_free);
+EXPORT_SYMBOL_GPL(oslec_free);
 /*- End of function --------------------------------------------------------*/
 
-void echo_can_adaption_mode(struct echo_can_state *ec, int adaption_mode)
+void oslec_adaption_mode(struct oslec_state *ec, int adaption_mode)
 {
     ec->adaption_mode = adaption_mode;
 }
-EXPORT_SYMBOL_GPL(echo_can_adaption_mode);
+EXPORT_SYMBOL_GPL(oslec_adaption_mode);
 /*- End of function --------------------------------------------------------*/
 
-void echo_can_flush(struct echo_can_state *ec)
+void oslec_flush(struct oslec_state *ec)
 {
     int i;
 
@@ -337,18 +337,18 @@ void echo_can_flush(struct echo_can_state *ec)
     ec->curr_pos = ec->taps - 1;
     ec->Pstates = 0;
 }
-EXPORT_SYMBOL_GPL(echo_can_flush);
+EXPORT_SYMBOL_GPL(oslec_flush);
 /*- End of function --------------------------------------------------------*/
 
-void echo_can_snapshot(struct echo_can_state *ec) {
+void oslec_snapshot(struct oslec_state *ec) {
     memcpy(ec->snapshot, ec->fir_taps16[0], ec->taps*sizeof(int16_t));
 }
-EXPORT_SYMBOL_GPL(echo_can_snapshot);
+EXPORT_SYMBOL_GPL(oslec_snapshot);
 /*- End of function --------------------------------------------------------*/
 
 /* Dual Path Echo Canceller ------------------------------------------------*/
 
-int16_t echo_can_update(struct echo_can_state *ec, int16_t tx, int16_t rx)
+int16_t oslec_update(struct oslec_state *ec, int16_t tx, int16_t rx)
 {
     int32_t echo_value;
     int clean_bg;
@@ -589,7 +589,7 @@ int16_t echo_can_update(struct echo_can_state *ec, int16_t tx, int16_t rx)
 
     return (int16_t) ec->clean_nlp << 1;
 }
-EXPORT_SYMBOL_GPL(echo_can_update);
+EXPORT_SYMBOL_GPL(oslec_update);
 /*- End of function --------------------------------------------------------*/
 
 /* This function is seperated from the echo canceller is it is usually called
@@ -613,7 +613,7 @@ EXPORT_SYMBOL_GPL(echo_can_update);
    precision, which noise shapes things, giving very clean DC removal.
 */
 
-int16_t echo_can_hpf_tx(struct echo_can_state *ec, int16_t tx) {
+int16_t oslec_hpf_tx(struct oslec_state *ec, int16_t tx) {
     int tmp, tmp1;
 
     if (ec->adaption_mode & ECHO_CAN_USE_TX_HPF) {
@@ -635,7 +635,7 @@ int16_t echo_can_hpf_tx(struct echo_can_state *ec, int16_t tx) {
 
     return tx;
 }
-EXPORT_SYMBOL_GPL(echo_can_hpf_tx);
+EXPORT_SYMBOL_GPL(oslec_hpf_tx);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("David Rowe");
drivers/staging/echo/echo.h +1 -1
index 5c8b515..2a1d1d8 100644
@@ -124,7 +124,7 @@ a minor burden.
     G.168 echo canceller descriptor. This defines the working state for a line
     echo canceller.
 */
-struct echo_can_state
+struct oslec_state
 {
 	int16_t tx,rx;
 	int16_t clean;
drivers/staging/echo/oslec.h +8 -8
index 8227013..e41de61 100644
@@ -42,31 +42,31 @@
     G.168 echo canceller descriptor. This defines the working state for a line
     echo canceller.
 */
-struct echo_can_state;
+struct oslec_state;
 
 /*! Create a voice echo canceller context.
     \param len The length of the canceller, in samples.
     \return The new canceller context, or NULL if the canceller could not be created.
 */
-struct echo_can_state *echo_can_create(int len, int adaption_mode);
+struct oslec_state *oslec_create(int len, int adaption_mode);
 
 /*! Free a voice echo canceller context.
     \param ec The echo canceller context.
 */
-void echo_can_free(struct echo_can_state *ec);
+void oslec_free(struct oslec_state *ec);
 
 /*! Flush (reinitialise) a voice echo canceller context.
     \param ec The echo canceller context.
 */
-void echo_can_flush(struct echo_can_state *ec);
+void oslec_flush(struct oslec_state *ec);
 
 /*! Set the adaption mode of a voice echo canceller context.
     \param ec The echo canceller context.
     \param adapt The mode.
 */
-void echo_can_adaption_mode(struct echo_can_state *ec, int adaption_mode);
+void oslec_adaption_mode(struct oslec_state *ec, int adaption_mode);
 
-void echo_can_snapshot(struct echo_can_state *ec);
+void oslec_snapshot(struct oslec_state *ec);
 
 /*! Process a sample through a voice echo canceller.
     \param ec The echo canceller context.
@@ -74,13 +74,13 @@ void echo_can_snapshot(struct echo_can_state *ec);
     \param rx The received audio sample.
     \return The clean (echo cancelled) received sample.
 */
-int16_t echo_can_update(struct echo_can_state *ec, int16_t tx, int16_t rx);
+int16_t oslec_update(struct oslec_state *ec, int16_t tx, int16_t rx);
 
 /*! Process to high pass filter the tx signal.
     \param ec The echo canceller context.
     \param tx The transmitted auio sample.
     \return The HP filtered transmit sample, send this to your D/A.
 */
-int16_t echo_can_hpf_tx(struct echo_can_state *ec, int16_t tx);
+int16_t oslec_hpf_tx(struct oslec_state *ec, int16_t tx);
 
 #endif	/* __OSLEC_H */
Signature · 1 line
1.6.0.2
#27 lore raw

PATCH 21/42 Staging: echo: Replace __BLACKFIN__ASM__ with __bfin__

In reply to Greg KH

From: Tzafrir Cohen <[email protected]>

---
 drivers/staging/echo/echo.c |    2 +-
 drivers/staging/echo/fir.h  |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/echo/echo.c +1 -1
index 13792ef..140f3f0 100644
@@ -127,7 +127,7 @@
 /* adapting coeffs using the traditional stochastic descent (N)LMS algorithm */
 
 
-#ifdef __BLACKFIN_ASM__
+#ifdef __bfin__
 static void __inline__ lms_adapt_bg(struct oslec_state *ec, int clean, int shift)
 {
     int i, j;
drivers/staging/echo/fir.h +4 -4
index e1bfc49..277d20e 100644
@@ -116,7 +116,7 @@ static __inline__ const int16_t *fir16_create(fir16_state_t *fir,
 	fir->taps = taps;
 	fir->curr_pos = taps - 1;
 	fir->coeffs = coeffs;
-#if defined(USE_MMX)  ||  defined(USE_SSE2) || defined(__BLACKFIN_ASM__)
+#if defined(USE_MMX)  ||  defined(USE_SSE2) || defined(__bfin__)
 	if ((fir->history = malloc(2*taps*sizeof(int16_t))))
 		memset(fir->history, 0, 2*taps*sizeof(int16_t));
 #else
@@ -129,7 +129,7 @@ static __inline__ const int16_t *fir16_create(fir16_state_t *fir,
 
 static __inline__ void fir16_flush(fir16_state_t *fir)
 {
-#if defined(USE_MMX)  ||  defined(USE_SSE2) || defined(__BLACKFIN_ASM__)
+#if defined(USE_MMX)  ||  defined(USE_SSE2) || defined(__bfin__)
     memset(fir->history, 0, 2*fir->taps*sizeof(int16_t));
 #else
     memset(fir->history, 0, fir->taps*sizeof(int16_t));
@@ -143,7 +143,7 @@ static __inline__ void fir16_free(fir16_state_t *fir)
 }
 /*- End of function --------------------------------------------------------*/
 
-#ifdef __BLACKFIN_ASM__
+#ifdef __bfin__
 static inline int32_t dot_asm(short *x, short *y, int len)
 {
    int dot;
@@ -242,7 +242,7 @@ static __inline__ int16_t fir16(fir16_state_t *fir, int16_t sample)
     psrldq_i2r(4, xmm0);
     paddd_r2r(xmm0, xmm4);
     movd_r2m(xmm4, y);
-#elif defined(__BLACKFIN_ASM__)
+#elif defined(__bfin__)
     fir->history[fir->curr_pos] = sample;
     fir->history[fir->curr_pos + fir->taps] = sample;
     y = dot_asm((int16_t*)fir->coeffs, &fir->history[fir->curr_pos], fir->taps);
Signature · 1 line
1.6.0.2
#28 lore raw

PATCH 22/42 Staging: echo: fix kmalloc()/kfree() uses

In reply to Greg KH

From: Pekka Enberg <[email protected]>

This patch removes the malloc()/free() macro wrappers and converts call-sites to use kcalloc() and kzalloc() where appropriate. I also fixed up out-of-memory error handling in couple of places where it was broken.

---
 drivers/staging/echo/echo.c |   36 +++++++++++++++++-------------------
 drivers/staging/echo/fir.h  |   14 +++++---------
 2 files changed, 22 insertions(+), 28 deletions(-)
drivers/staging/echo/echo.c +17 -19
index 140f3f0..a2d3078 100644
@@ -109,8 +109,6 @@
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
-#define malloc(a) kmalloc((a), GFP_KERNEL)
-#define free(a) kfree(a)
 
 #include "bit_operations.h"
 #include "echo.h"
@@ -238,27 +236,19 @@ struct oslec_state *oslec_create(int len, int adaption_mode)
 {
     struct oslec_state *ec;
     int i;
-    int j;
 
-    ec = kmalloc(sizeof(*ec), GFP_KERNEL);
-    if (ec == NULL)
-        return  NULL;
-    memset(ec, 0, sizeof(*ec));
+    ec = kzalloc(sizeof(*ec), GFP_KERNEL);
+    if (!ec)
+        return NULL;
 
     ec->taps = len;
     ec->log2taps = top_bit(len);
     ec->curr_pos = ec->taps - 1;
 
-    for (i = 0;  i < 2;  i++)
-    {
-        if ((ec->fir_taps16[i] = (int16_t *) malloc((ec->taps)*sizeof(int16_t))) == NULL)
-        {
-            for (j = 0;  j < i;  j++)
-                kfree(ec->fir_taps16[j]);
-            kfree(ec);
-            return  NULL;
-        }
-        memset(ec->fir_taps16[i], 0, (ec->taps)*sizeof(int16_t));
+    for (i = 0; i < 2; i++) {
+        ec->fir_taps16[i] = kcalloc(ec->taps, sizeof(int16_t), GFP_KERNEL);
+        if (!ec->fir_taps16[i])
+	    goto error_oom;
     }
 
     fir16_create(&ec->fir_state,
@@ -275,8 +265,9 @@ struct oslec_state *oslec_create(int len, int adaption_mode)
     ec->cng_level = 1000;
     oslec_adaption_mode(ec, adaption_mode);
 
-    ec->snapshot = (int16_t*)malloc(ec->taps*sizeof(int16_t));
-    memset(ec->snapshot, 0, sizeof(int16_t)*ec->taps);
+    ec->snapshot = kcalloc(ec->taps, sizeof(int16_t), GFP_KERNEL);
+    if (!ec->snapshot)
+        goto error_oom;
 
     ec->cond_met = 0;
     ec->Pstates = 0;
@@ -288,6 +279,13 @@ struct oslec_state *oslec_create(int len, int adaption_mode)
     ec->Lbgn_upper_acc = ec->Lbgn_upper << 13;
 
     return  ec;
+
+error_oom:
+    for (i = 0; i < 2; i++)
+        kfree(ec->fir_taps16[i]);
+
+    kfree(ec);
+    return NULL;
 }
 EXPORT_SYMBOL_GPL(oslec_create);
 /*- End of function --------------------------------------------------------*/
drivers/staging/echo/fir.h +5 -9
index 277d20e..c29e1e2 100644
@@ -117,11 +117,9 @@ static __inline__ const int16_t *fir16_create(fir16_state_t *fir,
 	fir->curr_pos = taps - 1;
 	fir->coeffs = coeffs;
 #if defined(USE_MMX)  ||  defined(USE_SSE2) || defined(__bfin__)
-	if ((fir->history = malloc(2*taps*sizeof(int16_t))))
-		memset(fir->history, 0, 2*taps*sizeof(int16_t));
+	fir->history = kcalloc(2*taps, sizeof(int16_t), GFP_KERNEL);
 #else
-	if ((fir->history = (int16_t *) malloc(taps*sizeof(int16_t))))
-		memset(fir->history, 0, taps*sizeof(int16_t));
+	fir->history = kcalloc(taps, sizeof(int16_t), GFP_KERNEL);
 #endif
 	return fir->history;
 }
@@ -139,7 +137,7 @@ static __inline__ void fir16_flush(fir16_state_t *fir)
 
 static __inline__ void fir16_free(fir16_state_t *fir)
 {
-	free(fir->history);
+	kfree(fir->history);
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -275,9 +273,7 @@ static __inline__ const int16_t *fir32_create(fir32_state_t *fir,
     fir->taps = taps;
     fir->curr_pos = taps - 1;
     fir->coeffs = coeffs;
-    fir->history = (int16_t *) malloc(taps*sizeof(int16_t));
-    if (fir->history)
-    	memset(fir->history, '\0', taps*sizeof(int16_t));
+    fir->history = kcalloc(taps, sizeof(int16_t), GFP_KERNEL);
     return fir->history;
 }
 /*- End of function --------------------------------------------------------*/
@@ -290,7 +286,7 @@ static __inline__ void fir32_flush(fir32_state_t *fir)
 
 static __inline__ void fir32_free(fir32_state_t *fir)
 {
-    free(fir->history);
+    kfree(fir->history);
 }
 /*- End of function --------------------------------------------------------*/
 
Signature · 1 line
1.6.0.2
#29 lore raw

PATCH 23/42 Staging: echo: remove dead code

In reply to Greg KH

From: Pekka Enberg <[email protected]>

This patch removes dead code that is wrapped in #ifndef __KERNEL__.

---
 drivers/staging/echo/fir.h |   45 --------------------------------------------
 1 files changed, 0 insertions(+), 45 deletions(-)
drivers/staging/echo/fir.h +0 -45
index c29e1e2..19c20cd 100644
@@ -312,51 +312,6 @@ static __inline__ int16_t fir32(fir32_state_t *fir, int16_t sample)
 }
 /*- End of function --------------------------------------------------------*/
 
-#ifndef __KERNEL__
-static __inline__ const float *fir_float_create(fir_float_state_t *fir,
-                                                const float *coeffs,
-    	    	    	                        int taps)
-{
-    fir->taps = taps;
-    fir->curr_pos = taps - 1;
-    fir->coeffs = coeffs;
-    fir->history = (float *) malloc(taps*sizeof(float));
-    if (fir->history)
-        memset(fir->history, '\0', taps*sizeof(float));
-    return fir->history;
-}
-/*- End of function --------------------------------------------------------*/
-
-static __inline__ void fir_float_free(fir_float_state_t *fir)
-{
-    free(fir->history);
-}
-/*- End of function --------------------------------------------------------*/
-
-static __inline__ int16_t fir_float(fir_float_state_t *fir, int16_t sample)
-{
-    int i;
-    float y;
-    int offset1;
-    int offset2;
-
-    fir->history[fir->curr_pos] = sample;
-
-    offset2 = fir->curr_pos;
-    offset1 = fir->taps - offset2;
-    y = 0;
-    for (i = fir->taps - 1;  i >= offset1;  i--)
-        y += fir->coeffs[i]*fir->history[i - offset1];
-    for (  ;  i >= 0;  i--)
-        y += fir->coeffs[i]*fir->history[i + offset2];
-    if (fir->curr_pos <= 0)
-    	fir->curr_pos = fir->taps;
-    fir->curr_pos--;
-    return  (int16_t) y;
-}
-/*- End of function --------------------------------------------------------*/
-#endif
-
 #ifdef __cplusplus
 }
 #endif
Signature · 1 line
1.6.0.2
#30 lore raw

PATCH 24/42 Staging: echo: remove __cplusplus macro magic

In reply to Greg KH

From: Pekka Enberg <[email protected]>

The kernel is written in C, so remove the __cplusplus macro magic from the driver.

---
 drivers/staging/echo/bit_operations.h |    8 --------
 drivers/staging/echo/fir.h            |    8 --------
 2 files changed, 0 insertions(+), 16 deletions(-)
drivers/staging/echo/bit_operations.h +0 -8
index b32f4bf..04b55d2 100644
@@ -30,10 +30,6 @@
 #if !defined(_BIT_OPERATIONS_H_)
 #define _BIT_OPERATIONS_H_
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #if defined(__i386__)  ||  defined(__x86_64__)
 /*! \brief Find the bit position of the highest set bit in a word
     \param bits The word to be searched
@@ -245,9 +241,5 @@ static __inline__ int parity32(uint32_t x)
 }
 /*- End of function --------------------------------------------------------*/
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif
 /*- End of file ------------------------------------------------------------*/
drivers/staging/echo/fir.h +0 -8
index 19c20cd..d1df33c 100644
@@ -105,10 +105,6 @@ typedef struct
 	float *history;
 } fir_float_state_t;
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 static __inline__ const int16_t *fir16_create(fir16_state_t *fir,
                                               const int16_t *coeffs,
                                               int taps)
@@ -312,9 +308,5 @@ static __inline__ int16_t fir32(fir32_state_t *fir, int16_t sample)
 }
 /*- End of function --------------------------------------------------------*/
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif
 /*- End of file ------------------------------------------------------------*/
Signature · 1 line
1.6.0.2
#31 lore raw

PATCH 25/42 Staging: echo: remove annoying "end of function" markers

In reply to Greg KH

From: Pekka Enberg <[email protected]>

This patch removes the very noisy "end of function" markers that are very annoying when reading the driver code.

---
 drivers/staging/echo/bit_operations.h |   10 ----------
 drivers/staging/echo/echo.c           |    7 -------
 drivers/staging/echo/fir.h            |    9 ---------
 3 files changed, 0 insertions(+), 26 deletions(-)
drivers/staging/echo/bit_operations.h +0 -10
index 04b55d2..abcd7a2 100644
@@ -45,7 +45,6 @@ static __inline__ int top_bit(unsigned int bits)
              : [bits] "rm" (bits));
     return res;
 }
-/*- End of function --------------------------------------------------------*/
 
 /*! \brief Find the bit position of the lowest set bit in a word
     \param bits The word to be searched
@@ -61,7 +60,6 @@ static __inline__ int bottom_bit(unsigned int bits)
              : [bits] "rm" (bits));
     return res;
 }
-/*- End of function --------------------------------------------------------*/
 #else
 static __inline__ int top_bit(unsigned int bits)
 {
@@ -97,7 +95,6 @@ static __inline__ int top_bit(unsigned int bits)
     }
     return i;
 }
-/*- End of function --------------------------------------------------------*/
 
 static __inline__ int bottom_bit(unsigned int bits)
 {
@@ -133,7 +130,6 @@ static __inline__ int bottom_bit(unsigned int bits)
     }
     return i;
 }
-/*- End of function --------------------------------------------------------*/
 #endif
 
 /*! \brief Bit reverse a byte.
@@ -151,7 +147,6 @@ static __inline__ uint8_t bit_reverse8(uint8_t x)
     return ((x & 0xAA) >> 1) | ((x & 0x55) << 1);
 #endif
 }
-/*- End of function --------------------------------------------------------*/
 
 /*! \brief Bit reverse a 16 bit word.
     \param data The word to be reversed.
@@ -191,7 +186,6 @@ static __inline__ uint32_t least_significant_one32(uint32_t x)
 {
     return (x & (-(int32_t) x));
 }
-/*- End of function --------------------------------------------------------*/
 
 /*! \brief Find the most significant one in a word, and return a word
            with just that bit set.
@@ -206,7 +200,6 @@ static __inline__ uint32_t most_significant_one32(uint32_t x)
     return (x ^ (x >> 1));
 #endif
 }
-/*- End of function --------------------------------------------------------*/
 
 /*! \brief Find the parity of a byte.
     \param x The byte to be checked.
@@ -216,7 +209,6 @@ static __inline__ int parity8(uint8_t x)
     x = (x ^ (x >> 4)) & 0x0F;
     return (0x6996 >> x) & 1;
 }
-/*- End of function --------------------------------------------------------*/
 
 /*! \brief Find the parity of a 16 bit word.
     \param x The word to be checked.
@@ -227,7 +219,6 @@ static __inline__ int parity16(uint16_t x)
     x = (x ^ (x >> 4)) & 0x0F;
     return (0x6996 >> x) & 1;
 }
-/*- End of function --------------------------------------------------------*/
 
 /*! \brief Find the parity of a 32 bit word.
     \param x The word to be checked.
@@ -239,7 +230,6 @@ static __inline__ int parity32(uint32_t x)
     x = (x ^ (x >> 4)) & 0x0F;
     return (0x6996 >> x) & 1;
 }
-/*- End of function --------------------------------------------------------*/
 
 #endif
 /*- End of file ------------------------------------------------------------*/
drivers/staging/echo/echo.c +0 -7
index a2d3078..ad18a95 100644
@@ -230,7 +230,6 @@ static __inline__ void lms_adapt_bg(struct oslec_state *ec, int clean, int shift
 }
 #endif
 
-/*- End of function --------------------------------------------------------*/
 
 struct oslec_state *oslec_create(int len, int adaption_mode)
 {
@@ -288,7 +287,6 @@ error_oom:
     return NULL;
 }
 EXPORT_SYMBOL_GPL(oslec_create);
-/*- End of function --------------------------------------------------------*/
 
 void oslec_free(struct oslec_state *ec)
 {
@@ -302,14 +300,12 @@ void oslec_free(struct oslec_state *ec)
 	kfree(ec);
 }
 EXPORT_SYMBOL_GPL(oslec_free);
-/*- End of function --------------------------------------------------------*/
 
 void oslec_adaption_mode(struct oslec_state *ec, int adaption_mode)
 {
     ec->adaption_mode = adaption_mode;
 }
 EXPORT_SYMBOL_GPL(oslec_adaption_mode);
-/*- End of function --------------------------------------------------------*/
 
 void oslec_flush(struct oslec_state *ec)
 {
@@ -336,13 +332,11 @@ void oslec_flush(struct oslec_state *ec)
     ec->Pstates = 0;
 }
 EXPORT_SYMBOL_GPL(oslec_flush);
-/*- End of function --------------------------------------------------------*/
 
 void oslec_snapshot(struct oslec_state *ec) {
     memcpy(ec->snapshot, ec->fir_taps16[0], ec->taps*sizeof(int16_t));
 }
 EXPORT_SYMBOL_GPL(oslec_snapshot);
-/*- End of function --------------------------------------------------------*/
 
 /* Dual Path Echo Canceller ------------------------------------------------*/
 
@@ -588,7 +582,6 @@ int16_t oslec_update(struct oslec_state *ec, int16_t tx, int16_t rx)
     return (int16_t) ec->clean_nlp << 1;
 }
 EXPORT_SYMBOL_GPL(oslec_update);
-/*- End of function --------------------------------------------------------*/
 
 /* This function is seperated from the echo canceller is it is usually called
    as part of the tx process.  See rx HP (DC blocking) filter above, it's
drivers/staging/echo/fir.h +0 -9
index d1df33c..e760471 100644
@@ -119,7 +119,6 @@ static __inline__ const int16_t *fir16_create(fir16_state_t *fir,
 #endif
 	return fir->history;
 }
-/*- End of function --------------------------------------------------------*/
 
 static __inline__ void fir16_flush(fir16_state_t *fir)
 {
@@ -129,13 +128,11 @@ static __inline__ void fir16_flush(fir16_state_t *fir)
     memset(fir->history, 0, fir->taps*sizeof(int16_t));
 #endif
 }
-/*- End of function --------------------------------------------------------*/
 
 static __inline__ void fir16_free(fir16_state_t *fir)
 {
 	kfree(fir->history);
 }
-/*- End of function --------------------------------------------------------*/
 
 #ifdef __bfin__
 static inline int32_t dot_asm(short *x, short *y, int len)
@@ -165,7 +162,6 @@ static inline int32_t dot_asm(short *x, short *y, int len)
    return dot;
 }
 #endif
-/*- End of function --------------------------------------------------------*/
 
 static __inline__ int16_t fir16(fir16_state_t *fir, int16_t sample)
 {
@@ -260,7 +256,6 @@ static __inline__ int16_t fir16(fir16_state_t *fir, int16_t sample)
     fir->curr_pos--;
     return (int16_t) (y >> 15);
 }
-/*- End of function --------------------------------------------------------*/
 
 static __inline__ const int16_t *fir32_create(fir32_state_t *fir,
                                               const int32_t *coeffs,
@@ -272,19 +267,16 @@ static __inline__ const int16_t *fir32_create(fir32_state_t *fir,
     fir->history = kcalloc(taps, sizeof(int16_t), GFP_KERNEL);
     return fir->history;
 }
-/*- End of function --------------------------------------------------------*/
 
 static __inline__ void fir32_flush(fir32_state_t *fir)
 {
     memset(fir->history, 0, fir->taps*sizeof(int16_t));
 }
-/*- End of function --------------------------------------------------------*/
 
 static __inline__ void fir32_free(fir32_state_t *fir)
 {
     kfree(fir->history);
 }
-/*- End of function --------------------------------------------------------*/
 
 static __inline__ int16_t fir32(fir32_state_t *fir, int16_t sample)
 {
@@ -306,7 +298,6 @@ static __inline__ int16_t fir32(fir32_state_t *fir, int16_t sample)
     fir->curr_pos--;
     return (int16_t) (y >> 15);
 }
-/*- End of function --------------------------------------------------------*/
 
 #endif
 /*- End of file ------------------------------------------------------------*/
Signature · 1 line
1.6.0.2
#32 lore raw

PATCH 26/42 Staging: wlan-ng: fix build error if wireless networking is not enabled

In reply to Greg KH

Thanks to Ingo for pointing this out.

---
 drivers/staging/wlan-ng/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/wlan-ng/Kconfig +1 -1
index 10b1f0f..2425d86 100644
@@ -1,6 +1,6 @@
 config PRISM2_USB
 	tristate "Prism2.5 USB driver"
-	depends on USB
+	depends on WLAN_80211 && USB
 	default n
 	---help---
 	  This is the wlan-ng prism 2.5 USB driver for a wide range of
Signature · 1 line
1.6.0.2
#33 lore raw

PATCH 27/42 Staging: add poch driver

In reply to Greg KH

From: Vijay Kumar <[email protected]>

This is the first cut at a driver for the Redrapids Pocket Change CardBus devices.

Receiving data seems to work properly, but overflows happen on transmit. Still needs more hardware debugging to work properly.

(cleaned up to use proper driver core api functions by Greg)

From: Vijay Kumar <[email protected]>

Cc Alexey Zaytsev <[email protected]>
Cc Jaya Kumar <[email protected]>
Cc Ken Sienski <[email protected]>
---
 drivers/staging/Kconfig       |    2 +
 drivers/staging/Makefile      |    1 +
 drivers/staging/poch/Kconfig  |    6 +
 drivers/staging/poch/Makefile |    1 +
 drivers/staging/poch/README   |    7 +
 drivers/staging/poch/poch.c   | 1425 +++++++++++++++++++++++++++++++++++++++++
 drivers/staging/poch/poch.h   |   29 +
 7 files changed, 1471 insertions(+), 0 deletions(-)
 create mode 100644 drivers/staging/poch/Kconfig
 create mode 100644 drivers/staging/poch/Makefile
 create mode 100644 drivers/staging/poch/README
 create mode 100644 drivers/staging/poch/poch.c
 create mode 100644 drivers/staging/poch/poch.h
drivers/staging/Kconfig +2 -0
index 65a86b7..c4eff44 100644
@@ -45,4 +45,6 @@ source "drivers/staging/at76_usb/Kconfig"
 
 source "drivers/staging/pcc-acpi/Kconfig"
 
+source "drivers/staging/poch/Kconfig"
+
 endif # STAGING
drivers/staging/Makefile +1 -0
index e5c4a38..7cb8701 100644
@@ -14,3 +14,4 @@ obj-$(CONFIG_PRISM2_USB)	+= wlan-ng/
 obj-$(CONFIG_ECHO)		+= echo/
 obj-$(CONFIG_USB_ATMEL)		+= at76_usb/
 obj-$(CONFIG_PCC_ACPI)		+= pcc-acpi/
+obj-$(CONFIG_POCH)		+= poch/
drivers/staging/poch/Kconfig new file +6 -0
new file mode 100644
index 0000000..b3b33b9
@@ -0,0 +1,6 @@
+config POCH
+	tristate "Redrapids Pocket Change CardBus support"
+	depends on PCI && UIO
+	default N
+	---help---
+	  Enable support for Redrapids Pocket Change CardBus devices.
drivers/staging/poch/Makefile new file +1 -0
new file mode 100644
index 0000000..d2b9680
@@ -0,0 +1 @@
+obj-$(CONFIG_POCH)		+= poch.o
drivers/staging/poch/README new file +7 -0
new file mode 100644
index 0000000..f65e979
@@ -0,0 +1,7 @@
+TODO:
+	- fix transmit overflows
+	- audit userspace interfaces
+	- get reserved major/minor if needed
+
+Please send patches to Greg Kroah-Hartman <[email protected]> and
+Vijay Kumar <[email protected]> and Jaya Kumar <[email protected]>
drivers/staging/poch/poch.c new file +1425 -0

1,425 lines not on this page · raw message

drivers/staging/poch/poch.h new file +29 -0
new file mode 100644
index 0000000..51a2d14
@@ -0,0 +1,29 @@
+/*
+ * User-space DMA and UIO based Redrapids Pocket Change CardBus driver
+ *
+ * Copyright 2008 Vijay Kumar <[email protected]>
+ *
+ * Part of userspace API. Should be moved to a header file in
+ * include/linux for final version.
+ *
+ */
+struct poch_cbuf_header {
+	__s32 group_size_bytes;
+	__s32 group_count;
+	__s32 group_offsets[0];
+};
+
+struct poch_counters {
+	__u32 fifo_empty;
+	__u32 fifo_overflow;
+	__u32 pll_unlock;
+};
+
+#define POCH_IOC_NUM			'9'
+
+#define POCH_IOC_TRANSFER_START		_IO(POCH_IOC_NUM, 0)
+#define POCH_IOC_TRANSFER_STOP		_IO(POCH_IOC_NUM, 1)
+#define POCH_IOC_GET_COUNTERS		_IOR(POCH_IOC_NUM, 2, \
+					     struct poch_counters)
+#define POCH_IOC_SYNC_GROUP_FOR_USER	_IO(POCH_IOC_NUM, 3)
+#define POCH_IOC_SYNC_GROUP_FOR_DEVICE	_IO(POCH_IOC_NUM, 4)
Signature · 1 line
1.6.0.2
#34 lore raw

PATCH 28/42 Staging: remove remaining uses of __FUNCTION__

In reply to Greg KH

From: Harvey Harrison <[email protected]>

__FUNCTION__ is gcc-specific, use __func__

---
 drivers/staging/usbip/usbip_common.c  |    2 +-
 drivers/staging/wlan-ng/wlan_compat.h |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/usbip/usbip_common.c +1 -1
index e64918f..72e2092 100644
@@ -221,7 +221,7 @@ static void usbip_dump_request_type(__u8 rt)
 static void usbip_dump_usb_ctrlrequest(struct usb_ctrlrequest *cmd)
 {
 	if (!cmd) {
-		printk("      %s : null pointer\n", __FUNCTION__);
+		printk("      %s : null pointer\n", __func__);
 		return;
 	}
 
drivers/staging/wlan-ng/wlan_compat.h +4 -4
index 1702657..59dfa8f 100644
@@ -245,11 +245,11 @@ typedef int64_t		INT64;
 #  define preempt_count() (0UL)
 #endif
 
-#define WLAN_LOG_ERROR(x,args...) printk(KERN_ERR "%s: " x , __FUNCTION__ , ##args);
+#define WLAN_LOG_ERROR(x,args...) printk(KERN_ERR "%s: " x , __func__ , ##args);
 
-#define WLAN_LOG_WARNING(x,args...) printk(KERN_WARNING "%s: " x , __FUNCTION__ , ##args);
+#define WLAN_LOG_WARNING(x,args...) printk(KERN_WARNING "%s: " x , __func__ , ##args);
 
-#define WLAN_LOG_NOTICE(x,args...) printk(KERN_NOTICE "%s: " x , __FUNCTION__ , ##args);
+#define WLAN_LOG_NOTICE(x,args...) printk(KERN_NOTICE "%s: " x , __func__ , ##args);
 
 #define WLAN_LOG_INFO(args... ) printk(KERN_INFO args)
 
@@ -265,7 +265,7 @@ typedef int64_t		INT64;
 	#define DBFENTER { if ( WLAN_DBVAR >= 5 ){ WLAN_LOG_DEBUG(3,"---->\n"); } }
 	#define DBFEXIT  { if ( WLAN_DBVAR >= 5 ){ WLAN_LOG_DEBUG(3,"<----\n"); } }
 
-	#define WLAN_LOG_DEBUG(l,x,args...) if ( WLAN_DBVAR >= (l)) printk(KERN_DEBUG "%s(%lu): " x ,  __FUNCTION__, (preempt_count() & PREEMPT_MASK), ##args );
+	#define WLAN_LOG_DEBUG(l,x,args...) if ( WLAN_DBVAR >= (l)) printk(KERN_DEBUG "%s(%lu): " x ,  __func__, (preempt_count() & PREEMPT_MASK), ##args );
 #else
 	#define WLAN_ASSERT(c)
 	#define WLAN_HEX_DUMP( l, s, p, n)
Signature · 1 line
1.6.0.2
#35 lore raw

PATCH 29/42 Staging: Clean up sxg driver

In reply to Greg KH

From: J.R. Mauro <[email protected]>

Lindent the rest of the files in drivers/staging/sxg

Signed off by: J.R. Mauro <[email protected]>

---
 drivers/staging/sxg/sxg_os.h     |   41 ++---
 drivers/staging/sxg/sxghif.h     |  410 +++++++++++++++++++-------------------
 drivers/staging/sxg/sxghw.h      |  284 +++++++++++++-------------
 drivers/staging/sxg/sxgphycode.h |   12 +-
 4 files changed, 368 insertions(+), 379 deletions(-)
drivers/staging/sxg/sxg_os.h +17 -24
index 26fb0ff..0118268 100644
@@ -44,7 +44,6 @@
 #define FALSE	(0)
 #define TRUE	(1)
 
-
 typedef struct _LIST_ENTRY {
 	struct _LIST_ENTRY *nle_flink;
 	struct _LIST_ENTRY *nle_blink;
@@ -69,35 +68,32 @@ typedef struct _LIST_ENTRY {
 
 /* These two have to be inlined since they return things. */
 
-static __inline PLIST_ENTRY
-RemoveHeadList(list_entry *l)
+static __inline PLIST_ENTRY RemoveHeadList(list_entry * l)
 {
-        list_entry              *f;
-        list_entry              *e;
+	list_entry *f;
+	list_entry *e;
 
-        e = l->nle_flink;
-        f = e->nle_flink;
-        l->nle_flink = f;
-        f->nle_blink = l;
+	e = l->nle_flink;
+	f = e->nle_flink;
+	l->nle_flink = f;
+	f->nle_blink = l;
 
-        return (e);
+	return (e);
 }
 
-static __inline PLIST_ENTRY
-RemoveTailList(list_entry *l)
+static __inline PLIST_ENTRY RemoveTailList(list_entry * l)
 {
-        list_entry              *b;
-        list_entry              *e;
+	list_entry *b;
+	list_entry *e;
 
-        e = l->nle_blink;
-        b = e->nle_blink;
-        l->nle_blink = b;
-        b->nle_flink = l;
+	e = l->nle_blink;
+	b = e->nle_blink;
+	l->nle_blink = b;
+	b->nle_flink = l;
 
-        return (e);
+	return (e);
 }
 
-
 #define InsertTailList(l, e)                    \
         do {                                    \
                 list_entry              *b;     \
@@ -120,7 +116,6 @@ RemoveTailList(list_entry *l)
                 (l)->nle_flink = (e);           \
         } while (0)
 
-
 #define ATK_DEBUG  1
 
 #if ATK_DEBUG
@@ -133,7 +128,6 @@ RemoveTailList(list_entry *l)
 #define SLIC_TIMESTAMP(value)
 #endif
 
-
 /******************  SXG DEFINES  *****************************************/
 
 #ifdef  ATKDBG
@@ -150,5 +144,4 @@ RemoveTailList(list_entry *l)
 #define WRITE_REG64(a,reg,value,cpu)                sxg_reg64_write((a),(&reg),(value),(cpu))
 #define READ_REG(reg,value)   (value) = readl((void __iomem *)(&reg))
 
-#endif  /* _SLIC_OS_SPECIFIC_H_  */
-
+#endif /* _SLIC_OS_SPECIFIC_H_  */
drivers/staging/sxg/sxghif.h +203 -207

636 lines not on this page · raw message

drivers/staging/sxg/sxghw.h +142 -142

472 lines not on this page · raw message

drivers/staging/sxg/sxgphycode.h +6 -6
index 26b36c8..8dbaeda 100644
@@ -34,7 +34,7 @@ static PHY_UCODE PhyUcode[] = {
 	 */
 	/* Addr, Data */
 	{0xc017, 0xfeb0},	/* flip RX_LOS polarity (mandatory */
-				/*  patch for SFP+ applications) */
+	/*  patch for SFP+ applications) */
 	{0xC001, 0x0428},	/* flip RX serial polarity */
 
 	{0xc013, 0xf341},	/* invert lxmit clock (mandatory patch) */
@@ -43,7 +43,7 @@ static PHY_UCODE PhyUcode[] = {
 	{0xc210, 0x8000},	/* reset datapath (mandatory patch) */
 	{0xc210, 0x0000},	/* reset datapath (mandatory patch) */
 	{0x0000, 0x0032},	/* wait for 50ms for datapath reset to */
-				/* complete. (mandatory patch) */
+	/* complete. (mandatory patch) */
 
 	/* Configure the LED's */
 	{0xc214, 0x0099},	/* configure the LED drivers */
@@ -52,15 +52,15 @@ static PHY_UCODE PhyUcode[] = {
 
 	/* Transceiver-specific MDIO Patches: */
 	{0xc010, 0x448a},	/* (bit 14) mask out high BER input from the */
-				/* LOS signal in 1.000A */
-				/* (mandatory patch for SR code)*/
+	/* LOS signal in 1.000A */
+	/* (mandatory patch for SR code) */
 	{0xc003, 0x0181},	/* (bit 7) enable the CDR inc setting in */
-				/* 1.C005 (mandatory patch for SR code) */
+	/* 1.C005 (mandatory patch for SR code) */
 
 	/* Transceiver-specific Microcontroller Initialization: */
 	{0xc04a, 0x5200},	/* activate microcontroller and pause */
 	{0x0000, 0x0032},	/* wait 50ms for microcontroller before */
-				/* writing in code. */
+	/* writing in code. */
 
 	/* code block starts here: */
 	{0xcc00, 0x2009},
Signature · 1 line
1.6.0.2
#36 lore raw

PATCH 30/42 Staging: pcc-acpi: update to latest version

In reply to Greg KH

Import the changes from the upstream driver into this version to keep things up to date.

---
 drivers/staging/pcc-acpi/pcc-acpi.c |  540 ++++++++++++++++++++---------------
 1 files changed, 309 insertions(+), 231 deletions(-)
drivers/staging/pcc-acpi/pcc-acpi.c +309 -231
index ffda32a..e44181e 100644
@@ -94,20 +94,21 @@
  *
  */
 
-#define ACPI_PCC_VERSION	"0.9"
+#define ACPI_PCC_VERSION	"0.9+hy"
 
-#include <linux/version.h>
+#include <acpi/acpi_bus.h>
+#include <acpi/acpi_drivers.h>
+#include <asm/uaccess.h>
+#include <linux/ctype.h>
+#include <linux/init.h>
+#include <linux/input.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/init.h>
-#include <linux/types.h>
 #include <linux/proc_fs.h>
-#include <linux/ctype.h>
 #include <linux/seq_file.h>
-#include <asm/uaccess.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
-#include <linux/input.h>
+#include <linux/slab.h>
+#include <linux/types.h>
+#include <linux/version.h>
 
 
 /*************************************************************************
@@ -152,10 +153,10 @@ static int _open_func_name_(struct inode *inode, struct file *file) \
 #endif
 
 #define _COMPONENT		ACPI_HOTKEY_COMPONENT
-ACPI_MODULE_NAME("pcc_acpi")
+ACPI_MODULE_NAME("pcc_acpi");
 
-MODULE_AUTHOR("Hiroshi Miura");
-MODULE_DESCRIPTION("ACPI HotKey driver for Panasonic Lets Note laptops");
+MODULE_AUTHOR("Hiroshi Miura, Hiroshi Yokota");
+MODULE_DESCRIPTION("ACPI HotKey driver for Panasonic Let's Note laptops");
 MODULE_LICENSE("GPL");
 
 #define LOGPREFIX "pcc_acpi: "
@@ -182,7 +183,7 @@ MODULE_LICENSE("GPL");
  * definitions for /proc/ interface
  *
  *******************************************************************/
-#define ACPI_PCC_DRIVER_NAME	"PCC Extra Driver"
+#define ACPI_PCC_DRIVER_NAME	"pcc_acpi"
 #define ACPI_PCC_DEVICE_NAME	"PCCExtra"
 #define ACPI_PCC_CLASS		"pcc"
 #define PROC_PCC		ACPI_PCC_CLASS
@@ -196,6 +197,12 @@ MODULE_LICENSE("GPL");
 
 #define PROC_STR_MAX_LEN  8
 
+#define BUS_PCC_HOTKEY BUS_I8042 /*0x1a*/ /* FIXME: BUS_I8042? */
+
+/* Fn+F4/F5 confricts with Shift+F1/F2  */
+/* This hack avoids key number confrict */
+#define PCC_KEYINPUT_MODE (0)
+
 /* LCD_TYPEs: 0 = Normal, 1 = Semi-transparent
    ENV_STATEs: Normal temp=0x01, High temp=0x81, N/A=0x00
 */
@@ -209,27 +216,32 @@ enum SINF_BITS { SINF_NUM_BATTERIES = 0,
 		 SINF_STICKY_KEY = 0x80,
 };
 
-static int acpi_pcc_hotkey_add(struct acpi_device *device);
-static int acpi_pcc_hotkey_remove(struct acpi_device *device, int type);
-static int acpi_pcc_hotkey_resume(struct acpi_device *device);
-
-static const struct acpi_device_id pcc_device_ids[] = {
+static struct acpi_device_id pcc_device_ids[] = {
 	{"MAT0012", 0},
 	{"MAT0013", 0},
 	{"MAT0018", 0},
 	{"MAT0019", 0},
-	{"", 0},
+	{"",	    0},
 };
 MODULE_DEVICE_TABLE(acpi, pcc_device_ids);
 
+
+static int __devinit acpi_pcc_hotkey_add(struct acpi_device *device);
+static int __devexit acpi_pcc_hotkey_remove(struct acpi_device *device, int type);
+static int acpi_pcc_hotkey_resume(struct acpi_device *device);
+
+
 static struct acpi_driver acpi_pcc_driver = {
 	.name =		ACPI_PCC_DRIVER_NAME,
 	.class =	ACPI_PCC_CLASS,
 	.ids =		pcc_device_ids,
 	.ops =		{
 				.add =		acpi_pcc_hotkey_add,
-				.remove =	acpi_pcc_hotkey_remove,
+				.remove =	__devexit_p(acpi_pcc_hotkey_remove),
+#ifdef CONFIG_PM
+				/*.suspend =      acpi_pcc_hotkey_suspend,*/
 				.resume =       acpi_pcc_hotkey_resume,
+#endif
 			},
 };
 
@@ -248,9 +260,12 @@ struct pcc_keyinput {
 	int key_mode;
 };
 
-/* --------------------------------------------------------------------------
+/* *************************************************************************
+   Hotkey driver core
+   ************************************************************************* */
+/* -------------------------------------------------------------------------
                            method access functions
-   -------------------------------------------------------------------------- */
+   ------------------------------------------------------------------------- */
 static int acpi_pcc_write_sset(struct acpi_hotkey *hotkey, int func, int val)
 {
 	union acpi_object in_objs[] = {
@@ -263,13 +278,13 @@ static int acpi_pcc_write_sset(struct acpi_hotkey *hotkey, int func, int val)
 		.count   = ARRAY_SIZE(in_objs),
 		.pointer = in_objs,
 	};
-	acpi_status status = AE_OK;
+	acpi_status status;
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_write_sset");
 
 	status = acpi_evaluate_object(hotkey->handle, METHOD_HKEY_SSET, &params, NULL);
 
-	return_VALUE(status == AE_OK);
+	return_VALUE(status == AE_OK ? AE_OK : AE_ERROR);
 }
 
 static inline int acpi_pcc_get_sqty(struct acpi_device *device)
@@ -301,19 +316,20 @@ static int acpi_pcc_retrieve_biosdata(struct acpi_hotkey *hotkey, u32* sinf)
 	status = acpi_evaluate_object(hotkey->handle, METHOD_HKEY_SINF, 0 , &buffer);
 	if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "evaluation error HKEY.SINF\n"));
-		return_VALUE(0);
+		status = AE_ERROR;
+		return_VALUE(status);
 	}
 
 	hkey = buffer.pointer;
 	if (!hkey || (hkey->type != ACPI_TYPE_PACKAGE)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid HKEY.SINF\n"));
-		goto end;
+		goto free_buffer;
 	}
 
 	if (hotkey->num_sifr < hkey->package.count) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "SQTY reports bad SINF length\n"));
 		status = AE_ERROR;
-		goto end;
+		goto free_buffer;
 	}
 
 	for (i = 0; i < hkey->package.count; i++) {
@@ -322,59 +338,54 @@ static int acpi_pcc_retrieve_biosdata(struct acpi_hotkey *hotkey, u32* sinf)
 			sinf[i] = element->integer.value;
 		} else {
 			ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid HKEY.SINF data\n"));
+			status = AE_ERROR;
+			break;
 		}
 	}
 	sinf[hkey->package.count] = -1;
 
-end:
+ free_buffer:
 	kfree(buffer.pointer);
-	return_VALUE(status == AE_OK);
+	return_VALUE(status == AE_OK ? AE_OK : AE_ERROR);
 }
 
 static int acpi_pcc_read_sinf_field(struct seq_file *seq, int field)
 {
 	struct acpi_hotkey *hotkey = (struct acpi_hotkey *) seq->private;
-	u32* sinf = kmalloc(sizeof(u32) * (hotkey->num_sifr + 1), GFP_KERNEL);
+	u32 sinf[hotkey->num_sifr + 1];
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_read_sinf_field");
 
-	if (!sinf) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Couldn't allocate %li bytes\n",
-		       sizeof(u32) * hotkey->num_sifr));
-		return_VALUE(0);
-	}
-
-	if (acpi_pcc_retrieve_biosdata(hotkey, sinf)) {
+	if (ACPI_SUCCESS(acpi_pcc_retrieve_biosdata(hotkey, sinf))) {
 		seq_printf(seq, "%u\n",	sinf[field]);
 	} else {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Couldn't retrieve BIOS data\n"));
 	}
 
-	kfree(sinf);
-	return_VALUE(0);
+	return_VALUE(AE_OK);
 }
 
-/* --------------------------------------------------------------------------
+/* -------------------------------------------------------------------------
                        user interface functions
-   -------------------------------------------------------------------------- */
+   ------------------------------------------------------------------------- */
 /* read methods */
 /* Sinf read methods */
 #define PCC_SINF_READ_F(_name_, FUNC) \
 static int _name_  (struct seq_file *seq, void *offset) \
 { \
-	return acpi_pcc_read_sinf_field(seq, (FUNC)); \
+	return_VALUE(ACPI_SUCCESS(acpi_pcc_read_sinf_field(seq, (FUNC)))  ? 0 : -EINVAL); \
 }
 
-PCC_SINF_READ_F(acpi_pcc_numbatteries_show,      SINF_NUM_BATTERIES);
-PCC_SINF_READ_F(acpi_pcc_lcdtype_show,           SINF_LCD_TYPE);
+PCC_SINF_READ_F(acpi_pcc_numbatteries_show,	 SINF_NUM_BATTERIES);
+PCC_SINF_READ_F(acpi_pcc_lcdtype_show,		 SINF_LCD_TYPE);
 PCC_SINF_READ_F(acpi_pcc_ac_brightness_max_show, SINF_AC_MAX_BRIGHT);
 PCC_SINF_READ_F(acpi_pcc_ac_brightness_min_show, SINF_AC_MIN_BRIGHT);
-PCC_SINF_READ_F(acpi_pcc_ac_brightness_show,     SINF_AC_CUR_BRIGHT);
+PCC_SINF_READ_F(acpi_pcc_ac_brightness_show,	 SINF_AC_CUR_BRIGHT);
 PCC_SINF_READ_F(acpi_pcc_dc_brightness_max_show, SINF_DC_MAX_BRIGHT);
 PCC_SINF_READ_F(acpi_pcc_dc_brightness_min_show, SINF_DC_MIN_BRIGHT);
-PCC_SINF_READ_F(acpi_pcc_dc_brightness_show,     SINF_DC_CUR_BRIGHT);
-PCC_SINF_READ_F(acpi_pcc_brightness_show,        SINF_AC_CUR_BRIGHT);
-PCC_SINF_READ_F(acpi_pcc_mute_show,              SINF_MUTE);
+PCC_SINF_READ_F(acpi_pcc_dc_brightness_show,	 SINF_DC_CUR_BRIGHT);
+PCC_SINF_READ_F(acpi_pcc_brightness_show,	 SINF_AC_CUR_BRIGHT);
+PCC_SINF_READ_F(acpi_pcc_mute_show,		 SINF_MUTE);
 
 static int acpi_pcc_sticky_key_show(struct seq_file *seq, void *offset)
 {
@@ -383,7 +394,7 @@ static int acpi_pcc_sticky_key_show(struct seq_file *seq, void *offset)
 	ACPI_FUNCTION_TRACE("acpi_pcc_sticky_key_show");
 
 	if (!hotkey || !hotkey->device) {
-		return_VALUE(0);
+		return_VALUE(-EINVAL);
 	}
 
 	seq_printf(seq, "%d\n", hotkey->sticky_mode);
@@ -410,8 +421,9 @@ static int acpi_pcc_version_show(struct seq_file *seq, void *offset)
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_version_show");
 
-	if (!hotkey || !hotkey->device)
-		return 0;
+	if (!hotkey || !hotkey->device) {
+		return_VALUE(-EINVAL);
+	}
 
 	seq_printf(seq, "%s version %s\n", ACPI_PCC_DRIVER_NAME, ACPI_PCC_VERSION);
 	seq_printf(seq, "%li functions\n", hotkey->num_sifr);
@@ -421,27 +433,28 @@ static int acpi_pcc_version_show(struct seq_file *seq, void *offset)
 
 /* write methods */
 static ssize_t acpi_pcc_write_single_flag (struct file *file,
-                                           const char __user *buffer,
-                                           size_t count,
-                                           int sinf_func)
+					   const char __user *buffer,
+					   size_t count,
+					   int sinf_func)
 {
 	struct seq_file		*seq = file->private_data;
 	struct acpi_hotkey	*hotkey = seq->private;
 	char			write_string[PROC_STR_MAX_LEN];
-	u32 			val;
+	u32			val;
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_write_single_flag");
 
 	if (!hotkey || (count > sizeof(write_string) - 1)) {
 		return_VALUE(-EINVAL);
-        }
+	}
 
 	if (copy_from_user(write_string, buffer, count)) {
 		return_VALUE(-EFAULT);
-        }
+	}
 	write_string[count] = '\0';
 
-	if (sscanf(write_string, "%i", &val) == 1 && (val == 0 || val == 1)) {
+	if ((sscanf(write_string, "%3i", &val) == 1) &&
+	    (val == 0 || val == 1)) {
 		acpi_pcc_write_sset(hotkey, sinf_func, val);
 	}
 
@@ -457,53 +470,51 @@ static unsigned long acpi_pcc_write_brightness(struct file *file, const char __u
 	struct acpi_hotkey	*hotkey = (struct acpi_hotkey *)seq->private;
 	char			write_string[PROC_STR_MAX_LEN];
 	u32 bright;
-	u32* sinf = kmalloc(sizeof(u32) * (hotkey->num_sifr + 1), GFP_KERNEL);
+	u32 sinf[hotkey->num_sifr + 1];
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_write_brightness");
 
-	if (!hotkey || (count > sizeof(write_string) - 1))
+	if (!hotkey || (count > sizeof(write_string) - 1)) {
 		return_VALUE(-EINVAL);
-
-	if (!sinf) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Couldn't allocate %li bytes\n",
-		       sizeof(u32) * hotkey->num_sifr));
-		return_VALUE(-EFAULT);
 	}
 
-	if (copy_from_user(write_string, buffer, count))
+	if (copy_from_user(write_string, buffer, count)) {
 		return_VALUE(-EFAULT);
+	}
 
 	write_string[count] = '\0';
 
-	if (!acpi_pcc_retrieve_biosdata(hotkey, sinf)) {
+	if (ACPI_FAILURE(acpi_pcc_retrieve_biosdata(hotkey, sinf))) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Couldn't retrieve BIOS data\n"));
 		goto end;
 	}
 
-	if (sscanf(write_string, "%i", &bright) == 1 &&
-		bright >= sinf[min_index] && bright <= sinf[max_index]) {
-			acpi_pcc_write_sset(hotkey, cur_index, bright);
+	if ((sscanf(write_string, "%4i", &bright) == 1) &&
+	    (bright >= sinf[min_index]                ) &&
+	    (bright <= sinf[max_index]                )) {
+		acpi_pcc_write_sset(hotkey, cur_index, bright);
 	}
 
 end:
-	kfree(sinf);
 	return_VALUE(count);
 }
 
 static ssize_t acpi_pcc_write_ac_brightness(struct file *file, const char __user *buffer,
 					 size_t count, loff_t *ppos)
 {
-	return acpi_pcc_write_brightness(file, buffer, count, SINF_AC_MIN_BRIGHT,
-					 SINF_AC_MAX_BRIGHT,
-					 SINF_AC_CUR_BRIGHT);
+	return_VALUE(acpi_pcc_write_brightness(file, buffer, count,
+					       SINF_AC_MIN_BRIGHT,
+					       SINF_AC_MAX_BRIGHT,
+					       SINF_AC_CUR_BRIGHT));
 }
 
 static ssize_t acpi_pcc_write_dc_brightness(struct file *file, const char __user *buffer,
 					 size_t count, loff_t *ppos)
 {
-	return acpi_pcc_write_brightness(file, buffer, count, SINF_DC_MIN_BRIGHT,
-					 SINF_DC_MAX_BRIGHT,
-					 SINF_DC_CUR_BRIGHT);
+	return_VALUE(acpi_pcc_write_brightness(file, buffer, count,
+					       SINF_DC_MIN_BRIGHT,
+					       SINF_DC_MAX_BRIGHT,
+					       SINF_DC_CUR_BRIGHT));
 }
 
 static ssize_t acpi_pcc_write_no_brightness(struct file *file, const char __user *buffer,
@@ -518,14 +529,36 @@ static ssize_t acpi_pcc_write_mute (struct file *file,
 				    const char __user *buffer,
 				    size_t count, loff_t *ppos)
 {
-	return acpi_pcc_write_single_flag(file, buffer, count, SINF_MUTE);
+	return_VALUE(acpi_pcc_write_single_flag(file, buffer, count, SINF_MUTE));
 }
 
 static ssize_t acpi_pcc_write_sticky_key (struct file *file,
 					  const char __user *buffer,
 					  size_t count, loff_t *ppos)
 {
-	return acpi_pcc_write_single_flag(file, buffer, count, SINF_STICKY_KEY);
+	struct seq_file     *seq = (struct seq_file *)file->private_data;
+	struct acpi_hotkey  *hotkey = (struct acpi_hotkey *)seq->private;
+	char                 write_string[PROC_STR_MAX_LEN];
+	int                  mode;
+
+	ACPI_FUNCTION_TRACE("acpi_pcc_write_sticky_key");
+
+	if (!hotkey || (count > sizeof(write_string) - 1)) {
+		return_VALUE(-EINVAL);
+	}
+
+	if (copy_from_user(write_string, buffer, count)) {
+		return_VALUE(-EFAULT);
+	}
+	write_string[count] = '\0';
+
+	if ((sscanf(write_string, "%3i", &mode) == 1) &&
+	    (mode == 0 || mode == 1)) {
+		acpi_pcc_write_sset(hotkey, SINF_STICKY_KEY, mode);
+		hotkey->sticky_mode = mode;
+	}
+
+	return_VALUE(count);
 }
 
 static ssize_t acpi_pcc_write_keyinput(struct file *file, const char __user *buffer,
@@ -539,25 +572,28 @@ static ssize_t acpi_pcc_write_keyinput(struct file *file, const char __user *buf
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_write_keyinput");
 
-	if (!hotkey || (count > sizeof(write_string) - 1))
+	if (!hotkey || (count > (sizeof(write_string) - 1))) {
 		return_VALUE(-EINVAL);
+	}
 
-	if (copy_from_user(write_string, buffer, count))
+	if (copy_from_user(write_string, buffer, count)) {
 		return_VALUE(-EFAULT);
+	}
 
 	write_string[count] = '\0';
 
-	if (sscanf(write_string, "%i", &key_mode) == 1 && (key_mode == 0 || key_mode == 1)) {
-		keyinput = (struct pcc_keyinput *)input_get_drvdata(hotkey->input_dev);
+	if ((sscanf(write_string, "%4i", &key_mode) == 1) &&
+	    (key_mode == 0 || key_mode == 1)) {
+		keyinput = input_get_drvdata(hotkey->input_dev);
 		keyinput->key_mode = key_mode;
 	}
 
 	return_VALUE(count);
 }
 
-/* --------------------------------------------------------------------------
+/* -------------------------------------------------------------------------
                             hotkey driver
-   -------------------------------------------------------------------------- */
+   ------------------------------------------------------------------------- */
 static void acpi_pcc_generete_keyinput(struct acpi_hotkey *hotkey)
 {
 	struct input_dev    *hotk_input_dev = hotkey->input_dev;
@@ -640,38 +676,38 @@ void acpi_pcc_hotkey_notify(acpi_handle handle, u32 event, void *data)
 	return_VOID;
 }
 
-/* --------------------------------------------------------------------------
-                              FS Interface (/proc)
-   -------------------------------------------------------------------------- */
+/* *************************************************************************
+   FS Interface (/proc)
+   ************************************************************************* */
 /* oepn proc file fs*/
-SEQ_OPEN_FS(acpi_pcc_dc_brightness_open_fs, acpi_pcc_dc_brightness_show);
-SEQ_OPEN_FS(acpi_pcc_numbatteries_open_fs,  acpi_pcc_numbatteries_show);
-SEQ_OPEN_FS(acpi_pcc_lcdtype_open_fs,  acpi_pcc_lcdtype_show);
+SEQ_OPEN_FS(acpi_pcc_dc_brightness_open_fs,	acpi_pcc_dc_brightness_show);
+SEQ_OPEN_FS(acpi_pcc_numbatteries_open_fs,	acpi_pcc_numbatteries_show);
+SEQ_OPEN_FS(acpi_pcc_lcdtype_open_fs,		acpi_pcc_lcdtype_show);
 SEQ_OPEN_FS(acpi_pcc_ac_brightness_max_open_fs, acpi_pcc_ac_brightness_max_show);
-SEQ_OPEN_FS(acpi_pcc_ac_brightness_min_open_fs,  acpi_pcc_ac_brightness_min_show);
-SEQ_OPEN_FS(acpi_pcc_ac_brightness_open_fs, acpi_pcc_ac_brightness_show);
+SEQ_OPEN_FS(acpi_pcc_ac_brightness_min_open_fs, acpi_pcc_ac_brightness_min_show);
+SEQ_OPEN_FS(acpi_pcc_ac_brightness_open_fs,	acpi_pcc_ac_brightness_show);
 SEQ_OPEN_FS(acpi_pcc_dc_brightness_max_open_fs, acpi_pcc_dc_brightness_max_show);
 SEQ_OPEN_FS(acpi_pcc_dc_brightness_min_open_fs, acpi_pcc_dc_brightness_min_show);
-SEQ_OPEN_FS(acpi_pcc_brightness_open_fs,  acpi_pcc_brightness_show);
-SEQ_OPEN_FS(acpi_pcc_mute_open_fs, acpi_pcc_mute_show);
-SEQ_OPEN_FS(acpi_pcc_version_open_fs, acpi_pcc_version_show);
-SEQ_OPEN_FS(acpi_pcc_keyinput_open_fs, acpi_pcc_keyinput_show);
-SEQ_OPEN_FS(acpi_pcc_sticky_key_open_fs, acpi_pcc_sticky_key_show);
+SEQ_OPEN_FS(acpi_pcc_brightness_open_fs,	acpi_pcc_brightness_show);
+SEQ_OPEN_FS(acpi_pcc_mute_open_fs,		acpi_pcc_mute_show);
+SEQ_OPEN_FS(acpi_pcc_version_open_fs,		acpi_pcc_version_show);
+SEQ_OPEN_FS(acpi_pcc_keyinput_open_fs,		acpi_pcc_keyinput_show);
+SEQ_OPEN_FS(acpi_pcc_sticky_key_open_fs,	acpi_pcc_sticky_key_show);
 
 typedef struct file_operations fops_t;
-static fops_t acpi_pcc_numbatteries_fops = SEQ_FILEOPS_R (acpi_pcc_numbatteries_open_fs);
-static fops_t acpi_pcc_lcdtype_fops = SEQ_FILEOPS_R (acpi_pcc_lcdtype_open_fs);
-static fops_t acpi_pcc_mute_fops = SEQ_FILEOPS_RW(acpi_pcc_mute_open_fs, acpi_pcc_write_mute);
-static fops_t acpi_pcc_ac_brightness_fops = SEQ_FILEOPS_RW(acpi_pcc_ac_brightness_open_fs, acpi_pcc_write_ac_brightness);
-static fops_t acpi_pcc_ac_brightness_max_fops = SEQ_FILEOPS_R(acpi_pcc_ac_brightness_max_open_fs);
-static fops_t acpi_pcc_ac_brightness_min_fops = SEQ_FILEOPS_R(acpi_pcc_ac_brightness_min_open_fs);
-static fops_t acpi_pcc_dc_brightness_fops = SEQ_FILEOPS_RW(acpi_pcc_dc_brightness_open_fs, acpi_pcc_write_dc_brightness);
-static fops_t acpi_pcc_dc_brightness_max_fops = SEQ_FILEOPS_R(acpi_pcc_dc_brightness_max_open_fs);
-static fops_t acpi_pcc_dc_brightness_min_fops = SEQ_FILEOPS_R(acpi_pcc_dc_brightness_min_open_fs);
-static fops_t acpi_pcc_brightness_fops = SEQ_FILEOPS_RW(acpi_pcc_brightness_open_fs, acpi_pcc_write_no_brightness);
-static fops_t acpi_pcc_sticky_key_fops = SEQ_FILEOPS_RW(acpi_pcc_sticky_key_open_fs, acpi_pcc_write_sticky_key);
-static fops_t acpi_pcc_keyinput_fops = SEQ_FILEOPS_RW(acpi_pcc_keyinput_open_fs, acpi_pcc_write_keyinput);
-static fops_t acpi_pcc_version_fops = SEQ_FILEOPS_R (acpi_pcc_version_open_fs);
+static fops_t acpi_pcc_numbatteries_fops      = SEQ_FILEOPS_R (acpi_pcc_numbatteries_open_fs);
+static fops_t acpi_pcc_lcdtype_fops           = SEQ_FILEOPS_R (acpi_pcc_lcdtype_open_fs);
+static fops_t acpi_pcc_mute_fops              = SEQ_FILEOPS_RW(acpi_pcc_mute_open_fs, acpi_pcc_write_mute);
+static fops_t acpi_pcc_ac_brightness_fops     = SEQ_FILEOPS_RW(acpi_pcc_ac_brightness_open_fs, acpi_pcc_write_ac_brightness);
+static fops_t acpi_pcc_ac_brightness_max_fops = SEQ_FILEOPS_R (acpi_pcc_ac_brightness_max_open_fs);
+static fops_t acpi_pcc_ac_brightness_min_fops = SEQ_FILEOPS_R (acpi_pcc_ac_brightness_min_open_fs);
+static fops_t acpi_pcc_dc_brightness_fops     = SEQ_FILEOPS_RW(acpi_pcc_dc_brightness_open_fs, acpi_pcc_write_dc_brightness);
+static fops_t acpi_pcc_dc_brightness_max_fops = SEQ_FILEOPS_R (acpi_pcc_dc_brightness_max_open_fs);
+static fops_t acpi_pcc_dc_brightness_min_fops = SEQ_FILEOPS_R (acpi_pcc_dc_brightness_min_open_fs);
+static fops_t acpi_pcc_brightness_fops        = SEQ_FILEOPS_RW(acpi_pcc_brightness_open_fs, acpi_pcc_write_no_brightness);
+static fops_t acpi_pcc_sticky_key_fops        = SEQ_FILEOPS_RW(acpi_pcc_sticky_key_open_fs, acpi_pcc_write_sticky_key);
+static fops_t acpi_pcc_keyinput_fops          = SEQ_FILEOPS_RW(acpi_pcc_keyinput_open_fs, acpi_pcc_write_keyinput);
+static fops_t acpi_pcc_version_fops           = SEQ_FILEOPS_R (acpi_pcc_version_open_fs);
 
 typedef struct _ProcItem
 {
@@ -681,37 +717,35 @@ typedef struct _ProcItem
 } ProcItem;
 
 /* Note: These functions map *exactly* to the SINF/SSET functions */
-ProcItem pcc_proc_items_sifr[] =
-{
-	{ "num_batteries",      &acpi_pcc_numbatteries_fops,     S_IRUGO },
-	{ "lcd_type",           &acpi_pcc_lcdtype_fops,          S_IRUGO },
+ProcItem acpi_pcc_proc_items_sifr[] = {
+	{ "num_batteries",	&acpi_pcc_numbatteries_fops,	 S_IRUGO },
+	{ "lcd_type",		&acpi_pcc_lcdtype_fops,		 S_IRUGO },
 	{ "ac_brightness_max" , &acpi_pcc_ac_brightness_max_fops,S_IRUGO },
 	{ "ac_brightness_min" , &acpi_pcc_ac_brightness_min_fops,S_IRUGO },
-	{ "ac_brightness" ,     &acpi_pcc_ac_brightness_fops,    S_IFREG | S_IRUGO | S_IWUSR },
+	{ "ac_brightness" ,	&acpi_pcc_ac_brightness_fops,	 S_IFREG | S_IRUGO | S_IWUSR },
 	{ "dc_brightness_max" , &acpi_pcc_dc_brightness_max_fops,S_IRUGO },
 	{ "dc_brightness_min" , &acpi_pcc_dc_brightness_min_fops,S_IRUGO },
-	{ "dc_brightness" ,     &acpi_pcc_dc_brightness_fops,    S_IFREG | S_IRUGO | S_IWUSR },
-	{ "brightness" ,        &acpi_pcc_brightness_fops,    S_IFREG | S_IRUGO | S_IWUSR },
-	{ "mute",               &acpi_pcc_mute_fops,             S_IFREG | S_IRUGO | S_IWUSR },
+	{ "dc_brightness" ,	&acpi_pcc_dc_brightness_fops,	 S_IFREG | S_IRUGO | S_IWUSR },
+	{ "brightness" ,	&acpi_pcc_brightness_fops,    S_IFREG | S_IRUGO | S_IWUSR },
+	{ "mute",		&acpi_pcc_mute_fops,		 S_IFREG | S_IRUGO | S_IWUSR },
 	{ NULL, NULL, 0 },
 };
 
-ProcItem pcc_proc_items[] =
-{
+ProcItem acpi_pcc_proc_items[] = {
 	{ "sticky_key",		&acpi_pcc_sticky_key_fops,	 S_IFREG | S_IRUGO | S_IWUSR },
-	{ "keyinput",           &acpi_pcc_keyinput_fops,         S_IFREG | S_IRUGO | S_IWUSR },
-	{ "version",            &acpi_pcc_version_fops,          S_IRUGO },
+	{ "keyinput",		&acpi_pcc_keyinput_fops,	 S_IFREG | S_IRUGO | S_IWUSR },
+	{ "version",		&acpi_pcc_version_fops,		 S_IRUGO },
 	{ NULL, NULL, 0 },
 };
 
-static int acpi_pcc_add_device(struct acpi_device *device,
-                                      ProcItem *proc_items,
-                                      int num)
+static int __devinit acpi_pcc_add_device(struct acpi_device *device,
+					 ProcItem *proc_items,
+					 int num)
 {
+	struct acpi_hotkey *hotkey = (struct acpi_hotkey*)acpi_driver_data(device);
 	struct proc_dir_entry* proc;
 	ProcItem* item;
 	int i;
-	struct acpi_hotkey *hotkey = (struct acpi_hotkey*)acpi_driver_data(device);
 
 	for (item = proc_items, i = 0; item->name && i < num; ++item, ++i) {
 		proc = create_proc_entry(item->name, item->flag, hotkey->proc_dir_entry);
@@ -724,16 +758,16 @@ static int acpi_pcc_add_device(struct acpi_device *device,
 				item--;
 				remove_proc_entry(item->name, hotkey->proc_dir_entry);
 			}
-			return -ENODEV;
+			return_VALUE(-ENODEV);
 		}
 	}
-	return 0;
+	return_VALUE(0);
 }
 
-static int acpi_pcc_proc_init(struct acpi_device *device)
+static int __devinit acpi_pcc_proc_init(struct acpi_device *device)
 {
-	struct proc_dir_entry* acpi_pcc_dir;
-	struct acpi_hotkey *hotkey = (struct acpi_hotkey*)acpi_driver_data(device);
+	struct proc_dir_entry *acpi_pcc_dir;
+	struct acpi_hotkey    *hotkey = (struct acpi_hotkey*)acpi_driver_data(device);
 	acpi_status status;
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_proc_init");
@@ -748,8 +782,8 @@ static int acpi_pcc_proc_init(struct acpi_device *device)
 	acpi_pcc_dir->owner = THIS_MODULE;
 	hotkey->proc_dir_entry = acpi_pcc_dir;
 
-	status =  acpi_pcc_add_device(device, pcc_proc_items_sifr, hotkey->num_sifr);
-	status |= acpi_pcc_add_device(device, pcc_proc_items, sizeof(pcc_proc_items)/sizeof(ProcItem));
+	status =  acpi_pcc_add_device(device, acpi_pcc_proc_items_sifr, hotkey->num_sifr);
+	status |= acpi_pcc_add_device(device, acpi_pcc_proc_items,      ARRAY_SIZE(acpi_pcc_proc_items));
 	if (unlikely(status)) {
 		remove_proc_entry(PROC_PCC, acpi_root_dir);
 		hotkey->proc_dir_entry = NULL;
@@ -759,9 +793,9 @@ static int acpi_pcc_proc_init(struct acpi_device *device)
 	return_VALUE(status);
 }
 
-static void acpi_pcc_remove_device(struct acpi_device *device,
-                                          ProcItem *proc_items,
-                                          int num)
+static void __devexit acpi_pcc_remove_device(struct acpi_device *device,
+					     ProcItem *proc_items,
+					     int num)
 {
 	struct acpi_hotkey *hotkey = (struct acpi_hotkey*)acpi_driver_data(device);
 	ProcItem* item;
@@ -771,131 +805,165 @@ static void acpi_pcc_remove_device(struct acpi_device *device,
 		remove_proc_entry(item->name, hotkey->proc_dir_entry);
 	}
 
-	return;
+	return_VOID;
+}
+
+/* *************************************************************************
+   Power Management
+   ************************************************************************* */
+#ifdef CONFIG_PM
+static int acpi_pcc_hotkey_resume(struct acpi_device *device)
+{
+	struct acpi_hotkey *hotkey = acpi_driver_data(device);
+	acpi_status	    status = AE_OK;
+
+	ACPI_FUNCTION_TRACE("acpi_pcc_hotkey_resume");
+
+	if (device == NULL || hotkey == NULL) { return_VALUE(-EINVAL); }
+
+	if (hotkey->num_sifr != 0) {
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Sticky mode restore: %d\n", hotkey->sticky_mode));
+
+		status = acpi_pcc_write_sset(hotkey, SINF_STICKY_KEY, hotkey->sticky_mode);
+	}
+	if (status != AE_OK) { return_VALUE(-EINVAL); }
+
+	return_VALUE(0);
 }
+#endif
 
-/* --------------------------------------------------------------------------
-                             input init
-   -------------------------------------------------------------------------- */
-static int acpi_pcc_init_input(struct acpi_hotkey *hotkey)
+/* *************************************************************************
+   Module init/remove
+   ************************************************************************* */
+/* -------------------------------------------------------------------------
+   input
+   ------------------------------------------------------------------------- */
+static int __devinit acpi_pcc_init_input(struct acpi_hotkey *hotkey)
 {
-	struct input_dev *hotk_input_dev;
+	struct input_dev    *hotk_input_dev;
 	struct pcc_keyinput *pcc_keyinput;
+	int error;
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_init_input");
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)
 	hotk_input_dev = input_allocate_device();
-	if (!hotk_input_dev) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Couldn't allocate input device for hotkey"));
-		return_VALUE(-ENOMEM);
-	}
-#else
-	hotk_input_dev = kcalloc(1, sizeof(struct input_dev),GFP_KERNEL);
 	if (hotk_input_dev == NULL) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Couldn't allocate mem for hotkey"));
-		return_VALUE(-ENOMEM);
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Couldn't allocate input device for hotkey"));
+		goto err_input;
 	}
-#endif
 
-	pcc_keyinput = kcalloc(1,sizeof(struct pcc_keyinput),GFP_KERNEL);
+	pcc_keyinput = kcalloc(1, sizeof(struct pcc_keyinput), GFP_KERNEL);
 
 	if (pcc_keyinput == NULL) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Couldn't allocate mem for hotkey"));
-		input_unregister_device(hotk_input_dev);
-		return_VALUE(-ENOMEM);
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Couldn't allocate mem for private data"));
+		goto err_pcc;
 	}
 
 	hotk_input_dev->evbit[0] = BIT(EV_KEY);
 
 	set_bit(KEY_BRIGHTNESSDOWN, hotk_input_dev->keybit);
-	set_bit(KEY_BRIGHTNESSUP, hotk_input_dev->keybit);
-	set_bit(KEY_MUTE, hotk_input_dev->keybit);
-	set_bit(KEY_VOLUMEDOWN, hotk_input_dev->keybit);
-	set_bit(KEY_VOLUMEUP, hotk_input_dev->keybit);
-	set_bit(KEY_SLEEP, hotk_input_dev->keybit);
-	set_bit(KEY_BATT, hotk_input_dev->keybit);
-	set_bit(KEY_SUSPEND, hotk_input_dev->keybit);
-
-	hotk_input_dev->name = ACPI_PCC_DRIVER_NAME;
-	hotk_input_dev->phys = ACPI_PCC_INPUT_PHYS;
-	hotk_input_dev->id.bustype = 0x1a; /* XXX FIXME: BUS_I8042? */
-	hotk_input_dev->id.vendor = 0x0001;
+	set_bit(KEY_BRIGHTNESSUP,   hotk_input_dev->keybit);
+	set_bit(KEY_MUTE,	    hotk_input_dev->keybit);
+	set_bit(KEY_VOLUMEDOWN,	    hotk_input_dev->keybit);
+	set_bit(KEY_VOLUMEUP,	    hotk_input_dev->keybit);
+	set_bit(KEY_SLEEP,	    hotk_input_dev->keybit);
+	set_bit(KEY_BATT,	    hotk_input_dev->keybit);
+	set_bit(KEY_SUSPEND,	    hotk_input_dev->keybit);
+
+	hotk_input_dev->name       = ACPI_PCC_DRIVER_NAME;
+	hotk_input_dev->phys       = ACPI_PCC_INPUT_PHYS;
+	hotk_input_dev->id.bustype = BUS_PCC_HOTKEY;
+	hotk_input_dev->id.vendor  = 0x0001;
 	hotk_input_dev->id.product = 0x0001;
 	hotk_input_dev->id.version = 0x0100;
 
-	pcc_keyinput->key_mode = 1; /* default on */
-	pcc_keyinput->hotkey = hotkey;
+	pcc_keyinput->key_mode = PCC_KEYINPUT_MODE;
+	pcc_keyinput->hotkey   = hotkey;
 
 	input_set_drvdata(hotk_input_dev, pcc_keyinput);
 
 	hotkey->input_dev = hotk_input_dev;
 
+	error = input_register_device(hotk_input_dev);
 
-	input_register_device(hotk_input_dev);
+	if (error) {
+		goto err_pcc;
+	}
 
 	return_VALUE(0);
-}
 
-/* --------------------------------------------------------------------------
-                         module init
-   -------------------------------------------------------------------------- */
+ err_pcc:
+	input_unregister_device(hotk_input_dev);
+ err_input:
+	return_VALUE(-ENOMEM);
+}
 
-static int acpi_pcc_hotkey_resume(struct acpi_device *device)
+static void __devexit acpi_pcc_remove_input(struct acpi_hotkey *hotkey)
 {
-	struct acpi_hotkey *hotkey = acpi_driver_data(device);
-	acpi_status	    status = AE_OK;
+	struct input_dev    *hotk_input_dev;
+	struct pcc_keyinput *pcc_keyinput;
 
-	ACPI_FUNCTION_TRACE("acpi_pcc_hotkey_resume");
+	ACPI_FUNCTION_TRACE("acpi_pcc_remove_input");
 
-	if (device == NULL || hotkey == NULL) { return_VALUE(-EINVAL); }
+	if (hotkey == NULL) {
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Can't free memory"));
+		return_VOID;
+	}
 
-	ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Sticky mode restore: %d\n", hotkey->sticky_mode));
+	hotk_input_dev = hotkey->input_dev;
+	pcc_keyinput   = input_get_drvdata(hotk_input_dev);
 
-	status = acpi_pcc_write_sset(hotkey, SINF_STICKY_KEY, hotkey->sticky_mode);
+	input_unregister_device(hotk_input_dev);
 
-	return_VALUE(status == AE_OK ? 0 : -EINVAL);
+	kfree(pcc_keyinput);
 }
 
-static int acpi_pcc_hotkey_add (struct acpi_device *device)
+/* -------------------------------------------------------------------------
+   ACPI
+   ------------------------------------------------------------------------- */
+static int __devinit acpi_pcc_hotkey_add (struct acpi_device *device)
 {
 	acpi_status		status = AE_OK;
 	struct acpi_hotkey	*hotkey = NULL;
-	int num_sifr, result;
+	int sifr_status, num_sifr, result;
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_hotkey_add");
 
-	if (!device) {
+	if (device == NULL) {
 		return_VALUE(-EINVAL);
 	}
 
-	num_sifr = acpi_pcc_get_sqty(device);
+	sifr_status = acpi_pcc_get_sqty(device);
 
-	if (num_sifr > 255) {
+	if (sifr_status > 255) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "num_sifr too large"));
 		return_VALUE(-ENODEV);
 	}
 
-	hotkey = kmalloc(sizeof(struct acpi_hotkey), GFP_KERNEL);
-	if (!hotkey) {
+	if (sifr_status < 0) {
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "not support SQTY"));
+		num_sifr = 0;
+	} else {
+		num_sifr = sifr_status;
+	}
+
+	hotkey = kcalloc(1, sizeof(struct acpi_hotkey), GFP_KERNEL);
+	if (hotkey == NULL) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Couldn't allocate mem for hotkey"));
 		return_VALUE(-ENOMEM);
 	}
 
-	memset(hotkey, 0, sizeof(struct acpi_hotkey));
-
-	hotkey->device = device;
-	hotkey->handle = device->handle;
+	hotkey->device   = device;
+	hotkey->handle   = device->handle;
 	hotkey->num_sifr = num_sifr;
 	acpi_driver_data(device) = hotkey;
-	strcpy(acpi_device_name(device), ACPI_PCC_DEVICE_NAME);
+	strcpy(acpi_device_name(device),  ACPI_PCC_DEVICE_NAME);
 	strcpy(acpi_device_class(device), ACPI_PCC_CLASS);
 
-	status = acpi_install_notify_handler (
-			hotkey->handle,
-			ACPI_DEVICE_NOTIFY,
-			acpi_pcc_hotkey_notify,
-			hotkey);
+	status = acpi_install_notify_handler(hotkey->handle,
+					     ACPI_DEVICE_NOTIFY,
+					     acpi_pcc_hotkey_notify,
+					     hotkey);
 
 	if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error installing notify handler\n"));
@@ -904,7 +972,7 @@ static int acpi_pcc_hotkey_add (struct acpi_device *device)
 	}
 
 	result = acpi_pcc_init_input(hotkey);
-	if (result) {
+	if (result != 0) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error installing keyinput handler\n"));
 		kfree(hotkey);
 		return_VALUE(result);
@@ -913,62 +981,72 @@ static int acpi_pcc_hotkey_add (struct acpi_device *device)
 	return_VALUE(acpi_pcc_proc_init(device));
 }
 
-static int __init acpi_pcc_init(void)
-{
-	int result = 0;
-
-	ACPI_FUNCTION_TRACE("acpi_pcc_init");
-
-	if (acpi_disabled) {
-		return_VALUE(-ENODEV);
-	}
-
-	result = acpi_bus_register_driver(&acpi_pcc_driver);
-	if (result < 0) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error registering hotkey driver\n"));
-		return_VALUE(-ENODEV);
-	}
-
-	return_VALUE(0);
-}
-
-module_init(acpi_pcc_init);
-
-static int acpi_pcc_hotkey_remove(struct acpi_device *device, int type)
+static int __devexit acpi_pcc_hotkey_remove(struct acpi_device *device, int type)
 {
 	acpi_status		status = AE_OK;
 	struct acpi_hotkey	*hotkey = acpi_driver_data(device);
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_hotkey_remove");
 
-	if (!device || !hotkey)
+	if (!device || !hotkey) {
 		return_VALUE(-EINVAL);
+	}
 
 	if (hotkey->proc_dir_entry) {
-		acpi_pcc_remove_device(device, pcc_proc_items_sifr, hotkey->num_sifr);
-		acpi_pcc_remove_device(device, pcc_proc_items, sizeof(pcc_proc_items)/sizeof(ProcItem));
+		acpi_pcc_remove_device(device, acpi_pcc_proc_items_sifr, hotkey->num_sifr);
+		acpi_pcc_remove_device(device, acpi_pcc_proc_items,      ARRAY_SIZE(acpi_pcc_proc_items));
 		remove_proc_entry(PROC_PCC, acpi_root_dir);
 	}
 
 	status = acpi_remove_notify_handler(hotkey->handle,
 		    ACPI_DEVICE_NOTIFY, acpi_pcc_hotkey_notify);
 
-	if (ACPI_FAILURE(status))
+	if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error removing notify handler\n"));
+	}
 
-	input_unregister_device(hotkey->input_dev);
-
-	kfree(hotkey);
+	acpi_pcc_remove_input(hotkey);
+	if (hotkey != NULL) {
+		kfree(hotkey);
+	}
 	return_VALUE(status == AE_OK);
 }
 
+/* *********************************************************************
+   Module entry point
+   ********************************************************************* */
+static int __init acpi_pcc_init(void)
+{
+	int result;
+
+	ACPI_FUNCTION_TRACE("acpi_pcc_init");
+
+	printk(KERN_INFO LOGPREFIX "loading...\n");
+
+	if (acpi_disabled) {
+		printk(KERN_INFO LOGPREFIX "ACPI disabled.\n");
+		return_VALUE(-ENODEV);
+	}
+
+	result = acpi_bus_register_driver(&acpi_pcc_driver);
+	if (result < 0) {
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error registering hotkey driver\n"));
+		return_VALUE(-ENODEV);
+	}
+
+	return_VALUE(result);
+}
+
 static void __exit acpi_pcc_exit(void)
 {
 	ACPI_FUNCTION_TRACE("acpi_pcc_exit");
 
+	printk(KERN_INFO LOGPREFIX "unloading...\n");
+
 	acpi_bus_unregister_driver(&acpi_pcc_driver);
 
 	return_VOID;
 }
 
+module_init(acpi_pcc_init);
 module_exit(acpi_pcc_exit);
Signature · 1 line
1.6.0.2
#37 lore raw

PATCH 31/42 Staging: PCC-ACPI: Fix all checkpatch errors

In reply to Greg KH

From: Lior Dotan <[email protected]>

Fix all complaints that checkpatch had regarding this patch

---
 drivers/staging/pcc-acpi/pcc-acpi.c |  429 ++++++++++++++++++++---------------
 1 files changed, 244 insertions(+), 185 deletions(-)
drivers/staging/pcc-acpi/pcc-acpi.c +244 -185
index e44181e..7715c31 100644
@@ -27,11 +27,13 @@
  * 	Nov.04, 2006	Hiroshi Miura <[email protected]>
  * 		-v0.9	remove warning about section reference.
  * 			remove acpi_os_free
- * 			add /proc/acpi/pcc/brightness interface to allow HAL to access.
+ * 			add /proc/acpi/pcc/brightness interface to
+ * 			allow HAL to access.
  * 			merge dbronaugh's enhancement
  * 			Aug.17, 2004 David Bronaugh (dbronaugh)
  *  				- Added screen brightness setting interface
- *				  Thanks to the FreeBSD crew (acpi_panasonic.c authors)
+ *				  Thanks to the FreeBSD crew
+ *				  (acpi_panasonic.c authors)
  * 				  for the ideas I needed to accomplish it
  *
  *	May.29, 2006	Hiroshi Miura <[email protected]>
@@ -41,13 +43,15 @@
  *			Hiroshi Yokota for providing solutions.
  *
  *	Oct.02, 2004	Hiroshi Miura <[email protected]>
- *		-v0.8.2	merge code of YOKOTA Hiroshi <[email protected]>.
+ *		-v0.8.2	merge code of YOKOTA Hiroshi
+ *			<[email protected]>.
  *			Add sticky key mode interface.
  *			Refactoring acpi_pcc_generete_keyinput().
  *
  *	Sep.15, 2004	Hiroshi Miura <[email protected]>
  *		-v0.8	Generate key input event on input subsystem.
- *			This is based on yet another driver written by Ryuta Nakanishi.
+ *			This is based on yet another driver
+ *			written by Ryuta Nakanishi.
  *
  *	Sep.10, 2004	Hiroshi Miura <[email protected]>
  *		-v0.7	Change proc interface functions using seq_file
@@ -57,7 +61,8 @@
  *		-v0.6.4 Fix a silly error with status checking
  *
  *	Aug.25, 2004	Hiroshi Miura <[email protected]>
- *		-v0.6.3 replace read_acpi_int by standard function acpi_evaluate_integer
+ *		-v0.6.3 replace read_acpi_int by standard
+ *			function acpi_evaluate_integer
  *			some clean up and make smart copyright notice.
  *			fix return value of pcc_acpi_get_key()
  *			fix checking return value of acpi_bus_register_driver()
@@ -96,19 +101,18 @@
 
 #define ACPI_PCC_VERSION	"0.9+hy"
 
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
-#include <asm/uaccess.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/types.h>
 #include <linux/ctype.h>
 #include <linux/init.h>
 #include <linux/input.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/slab.h>
-#include <linux/types.h>
-#include <linux/version.h>
+#include <linux/uaccess.h>
+#include <acpi/acpi_bus.h>
+#include <acpi/acpi_drivers.h>
 
 
 /*************************************************************************
@@ -207,12 +211,18 @@ MODULE_LICENSE("GPL");
    ENV_STATEs: Normal temp=0x01, High temp=0x81, N/A=0x00
 */
 enum SINF_BITS { SINF_NUM_BATTERIES = 0,
-                 SINF_LCD_TYPE,      /* 1 */
-		 SINF_AC_MAX_BRIGHT, SINF_AC_MIN_BRIGHT, SINF_AC_CUR_BRIGHT,  /* 2, 3, 4 */
-		             /* 4 = R1 only handle SINF_AC_CUR_BRIGHT as SINF_CUR_BRIGHT and don't know AC state */
-		 SINF_DC_MAX_BRIGHT, SINF_DC_MIN_BRIGHT, SINF_DC_CUR_BRIGHT,  /* 5, 6, 7 */
+		 SINF_LCD_TYPE,
+		 SINF_AC_MAX_BRIGHT,
+		 SINF_AC_MIN_BRIGHT,
+		 SINF_AC_CUR_BRIGHT,
+			     /* 4 = R1 only handle SINF_AC_CUR_BRIGHT
+			      * as SINF_CUR_BRIGHT and don't know AC state */
+		 SINF_DC_MAX_BRIGHT,
+		 SINF_DC_MIN_BRIGHT,
+		 SINF_DC_CUR_BRIGHT,
 		 SINF_MUTE,
-		 SINF_RESERVED,      SINF_ENV_STATE, /* 9, 10 */
+		 SINF_RESERVED,
+		 SINF_ENV_STATE, /* 10 */
 		 SINF_STICKY_KEY = 0x80,
 };
 
@@ -227,7 +237,8 @@ MODULE_DEVICE_TABLE(acpi, pcc_device_ids);
 
 
 static int __devinit acpi_pcc_hotkey_add(struct acpi_device *device);
-static int __devexit acpi_pcc_hotkey_remove(struct acpi_device *device, int type);
+static int __devexit acpi_pcc_hotkey_remove(struct acpi_device *device,
+					    int type);
 static int acpi_pcc_hotkey_resume(struct acpi_device *device);
 
 
@@ -236,11 +247,11 @@ static struct acpi_driver acpi_pcc_driver = {
 	.class =	ACPI_PCC_CLASS,
 	.ids =		pcc_device_ids,
 	.ops =		{
-				.add =		acpi_pcc_hotkey_add,
-				.remove =	__devexit_p(acpi_pcc_hotkey_remove),
+				.add = acpi_pcc_hotkey_add,
+				.remove = __devexit_p(acpi_pcc_hotkey_remove),
 #ifdef CONFIG_PM
-				/*.suspend =      acpi_pcc_hotkey_suspend,*/
-				.resume =       acpi_pcc_hotkey_resume,
+				/*.suspend = acpi_pcc_hotkey_suspend,*/
+				.resume = acpi_pcc_hotkey_resume,
 #endif
 			},
 };
@@ -264,7 +275,7 @@ struct pcc_keyinput {
    Hotkey driver core
    ************************************************************************* */
 /* -------------------------------------------------------------------------
-                           method access functions
+   method access functions
    ------------------------------------------------------------------------- */
 static int acpi_pcc_write_sset(struct acpi_hotkey *hotkey, int func, int val)
 {
@@ -282,7 +293,8 @@ static int acpi_pcc_write_sset(struct acpi_hotkey *hotkey, int func, int val)
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_write_sset");
 
-	status = acpi_evaluate_object(hotkey->handle, METHOD_HKEY_SSET, &params, NULL);
+	status = acpi_evaluate_object(hotkey->handle, METHOD_HKEY_SSET,
+								&params, NULL);
 
 	return_VALUE(status == AE_OK ? AE_OK : AE_ERROR);
 }
@@ -294,7 +306,8 @@ static inline int acpi_pcc_get_sqty(struct acpi_device *device)
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_get_sqty");
 
-	status = acpi_evaluate_integer(device->handle, METHOD_HKEY_SQTY, NULL, &s);
+	status = acpi_evaluate_integer(device->handle, METHOD_HKEY_SQTY,
+								NULL, &s);
 	if (ACPI_SUCCESS(status)) {
 		return_VALUE(s);
 	} else {
@@ -304,7 +317,7 @@ static inline int acpi_pcc_get_sqty(struct acpi_device *device)
 	}
 }
 
-static int acpi_pcc_retrieve_biosdata(struct acpi_hotkey *hotkey, u32* sinf)
+static int acpi_pcc_retrieve_biosdata(struct acpi_hotkey *hotkey, u32 *sinf)
 {
 	acpi_status status;
 	struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
@@ -313,9 +326,11 @@ static int acpi_pcc_retrieve_biosdata(struct acpi_hotkey *hotkey, u32* sinf)
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_retrieve_biosdata");
 
-	status = acpi_evaluate_object(hotkey->handle, METHOD_HKEY_SINF, 0 , &buffer);
+	status = acpi_evaluate_object(hotkey->handle, METHOD_HKEY_SINF, 0,
+				      &buffer);
 	if (ACPI_FAILURE(status)) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "evaluation error HKEY.SINF\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				 "evaluation error HKEY.SINF\n"));
 		status = AE_ERROR;
 		return_VALUE(status);
 	}
@@ -327,7 +342,8 @@ static int acpi_pcc_retrieve_biosdata(struct acpi_hotkey *hotkey, u32* sinf)
 	}
 
 	if (hotkey->num_sifr < hkey->package.count) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "SQTY reports bad SINF length\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				 "SQTY reports bad SINF length\n"));
 		status = AE_ERROR;
 		goto free_buffer;
 	}
@@ -337,7 +353,8 @@ static int acpi_pcc_retrieve_biosdata(struct acpi_hotkey *hotkey, u32* sinf)
 		if (likely(element->type == ACPI_TYPE_INTEGER)) {
 			sinf[i] = element->integer.value;
 		} else {
-			ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid HKEY.SINF data\n"));
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					 "Invalid HKEY.SINF data\n"));
 			status = AE_ERROR;
 			break;
 		}
@@ -356,24 +373,26 @@ static int acpi_pcc_read_sinf_field(struct seq_file *seq, int field)
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_read_sinf_field");
 
-	if (ACPI_SUCCESS(acpi_pcc_retrieve_biosdata(hotkey, sinf))) {
+	if (ACPI_SUCCESS(acpi_pcc_retrieve_biosdata(hotkey, sinf)))
 		seq_printf(seq, "%u\n",	sinf[field]);
-	} else {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Couldn't retrieve BIOS data\n"));
-	}
+	else
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				 "Couldn't retrieve BIOS data\n"));
 
 	return_VALUE(AE_OK);
 }
 
 /* -------------------------------------------------------------------------
-                       user interface functions
+   user interface functions
    ------------------------------------------------------------------------- */
 /* read methods */
 /* Sinf read methods */
 #define PCC_SINF_READ_F(_name_, FUNC) \
-static int _name_  (struct seq_file *seq, void *offset) \
+static int _name_(struct seq_file *seq, void *offset) \
 { \
-	return_VALUE(ACPI_SUCCESS(acpi_pcc_read_sinf_field(seq, (FUNC)))  ? 0 : -EINVAL); \
+	return_VALUE(ACPI_SUCCESS(acpi_pcc_read_sinf_field(seq,	\
+							  (FUNC))) \
+							  ? 0 : -EINVAL); \
 }
 
 PCC_SINF_READ_F(acpi_pcc_numbatteries_show,	 SINF_NUM_BATTERIES);
@@ -393,9 +412,8 @@ static int acpi_pcc_sticky_key_show(struct seq_file *seq, void *offset)
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_sticky_key_show");
 
-	if (!hotkey || !hotkey->device) {
+	if (!hotkey || !hotkey->device)
 		return_VALUE(-EINVAL);
-	}
 
 	seq_printf(seq, "%d\n", hotkey->sticky_mode);
 
@@ -404,7 +422,7 @@ static int acpi_pcc_sticky_key_show(struct seq_file *seq, void *offset)
 
 static int acpi_pcc_keyinput_show(struct seq_file *seq, void *offset)
 {
-	struct acpi_hotkey 	*hotkey = (struct acpi_hotkey *) seq->private;
+	struct acpi_hotkey 	*hotkey = seq->private;
 	struct input_dev 	*hotk_input_dev = hotkey->input_dev;
 	struct pcc_keyinput 	*keyinput = input_get_drvdata(hotk_input_dev);
 
@@ -417,25 +435,25 @@ static int acpi_pcc_keyinput_show(struct seq_file *seq, void *offset)
 
 static int acpi_pcc_version_show(struct seq_file *seq, void *offset)
 {
-	struct acpi_hotkey *hotkey = (struct acpi_hotkey *) seq->private;
+	struct acpi_hotkey *hotkey = seq->private;
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_version_show");
 
-	if (!hotkey || !hotkey->device) {
+	if (!hotkey || !hotkey->device)
 		return_VALUE(-EINVAL);
-	}
 
-	seq_printf(seq, "%s version %s\n", ACPI_PCC_DRIVER_NAME, ACPI_PCC_VERSION);
+	seq_printf(seq, "%s version %s\n", ACPI_PCC_DRIVER_NAME,
+		   ACPI_PCC_VERSION);
 	seq_printf(seq, "%li functions\n", hotkey->num_sifr);
 
 	return_VALUE(0);
 }
 
 /* write methods */
-static ssize_t acpi_pcc_write_single_flag (struct file *file,
-					   const char __user *buffer,
-					   size_t count,
-					   int sinf_func)
+static ssize_t acpi_pcc_write_single_flag(struct file *file,
+					  const char __user *buffer,
+					  size_t count,
+					  int sinf_func)
 {
 	struct seq_file		*seq = file->private_data;
 	struct acpi_hotkey	*hotkey = seq->private;
@@ -444,24 +462,23 @@ static ssize_t acpi_pcc_write_single_flag (struct file *file,
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_write_single_flag");
 
-	if (!hotkey || (count > sizeof(write_string) - 1)) {
+	if (!hotkey || (count > sizeof(write_string) - 1))
 		return_VALUE(-EINVAL);
-	}
 
-	if (copy_from_user(write_string, buffer, count)) {
+	if (copy_from_user(write_string, buffer, count))
 		return_VALUE(-EFAULT);
-	}
+
 	write_string[count] = '\0';
 
 	if ((sscanf(write_string, "%3i", &val) == 1) &&
-	    (val == 0 || val == 1)) {
+	    (val == 0 || val == 1))
 		acpi_pcc_write_sset(hotkey, sinf_func, val);
-	}
 
 	return_VALUE(count);
 }
 
-static unsigned long acpi_pcc_write_brightness(struct file *file, const char __user *buffer,
+static unsigned long acpi_pcc_write_brightness(struct file *file,
+					       const char __user *buffer,
 					       size_t count,
 					       int min_index, int max_index,
 					       int cur_index)
@@ -474,33 +491,32 @@ static unsigned long acpi_pcc_write_brightness(struct file *file, const char __u
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_write_brightness");
 
-	if (!hotkey || (count > sizeof(write_string) - 1)) {
+	if (!hotkey || (count > sizeof(write_string) - 1))
 		return_VALUE(-EINVAL);
-	}
 
-	if (copy_from_user(write_string, buffer, count)) {
+	if (copy_from_user(write_string, buffer, count))
 		return_VALUE(-EFAULT);
-	}
 
 	write_string[count] = '\0';
 
 	if (ACPI_FAILURE(acpi_pcc_retrieve_biosdata(hotkey, sinf))) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Couldn't retrieve BIOS data\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				 "Couldn't retrieve BIOS data\n"));
 		goto end;
 	}
 
 	if ((sscanf(write_string, "%4i", &bright) == 1) &&
-	    (bright >= sinf[min_index]                ) &&
-	    (bright <= sinf[max_index]                )) {
+	    (bright >= sinf[min_index]) &&
+	    (bright <= sinf[max_index]))
 		acpi_pcc_write_sset(hotkey, cur_index, bright);
-	}
 
 end:
 	return_VALUE(count);
 }
 
-static ssize_t acpi_pcc_write_ac_brightness(struct file *file, const char __user *buffer,
-					 size_t count, loff_t *ppos)
+static ssize_t acpi_pcc_write_ac_brightness(struct file *file,
+					    const char __user *buffer,
+					    size_t count, loff_t *ppos)
 {
 	return_VALUE(acpi_pcc_write_brightness(file, buffer, count,
 					       SINF_AC_MIN_BRIGHT,
@@ -508,8 +524,9 @@ static ssize_t acpi_pcc_write_ac_brightness(struct file *file, const char __user
 					       SINF_AC_CUR_BRIGHT));
 }
 
-static ssize_t acpi_pcc_write_dc_brightness(struct file *file, const char __user *buffer,
-					 size_t count, loff_t *ppos)
+static ssize_t acpi_pcc_write_dc_brightness(struct file *file,
+					    const char __user *buffer,
+					    size_t count, loff_t *ppos)
 {
 	return_VALUE(acpi_pcc_write_brightness(file, buffer, count,
 					       SINF_DC_MIN_BRIGHT,
@@ -517,24 +534,27 @@ static ssize_t acpi_pcc_write_dc_brightness(struct file *file, const char __user
 					       SINF_DC_CUR_BRIGHT));
 }
 
-static ssize_t acpi_pcc_write_no_brightness(struct file *file, const char __user *buffer,
-					 size_t count, loff_t *ppos)
+static ssize_t acpi_pcc_write_no_brightness(struct file *file,
+					    const char __user *buffer,
+					    size_t count, loff_t *ppos)
 {
-	return acpi_pcc_write_brightness(file, buffer, count, SINF_AC_MIN_BRIGHT,
+	return acpi_pcc_write_brightness(file, buffer, count,
+					 SINF_AC_MIN_BRIGHT,
 					 SINF_AC_MAX_BRIGHT,
 					 SINF_AC_CUR_BRIGHT);
 }
 
-static ssize_t acpi_pcc_write_mute (struct file *file,
-				    const char __user *buffer,
-				    size_t count, loff_t *ppos)
+static ssize_t acpi_pcc_write_mute(struct file *file,
+				   const char __user *buffer,
+				   size_t count, loff_t *ppos)
 {
-	return_VALUE(acpi_pcc_write_single_flag(file, buffer, count, SINF_MUTE));
+	return_VALUE(acpi_pcc_write_single_flag(file, buffer, count,
+						SINF_MUTE));
 }
 
-static ssize_t acpi_pcc_write_sticky_key (struct file *file,
-					  const char __user *buffer,
-					  size_t count, loff_t *ppos)
+static ssize_t acpi_pcc_write_sticky_key(struct file *file,
+					 const char __user *buffer,
+					 size_t count, loff_t *ppos)
 {
 	struct seq_file     *seq = (struct seq_file *)file->private_data;
 	struct acpi_hotkey  *hotkey = (struct acpi_hotkey *)seq->private;
@@ -543,13 +563,12 @@ static ssize_t acpi_pcc_write_sticky_key (struct file *file,
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_write_sticky_key");
 
-	if (!hotkey || (count > sizeof(write_string) - 1)) {
+	if (!hotkey || (count > sizeof(write_string) - 1))
 		return_VALUE(-EINVAL);
-	}
 
-	if (copy_from_user(write_string, buffer, count)) {
+	if (copy_from_user(write_string, buffer, count))
 		return_VALUE(-EFAULT);
-	}
+
 	write_string[count] = '\0';
 
 	if ((sscanf(write_string, "%3i", &mode) == 1) &&
@@ -561,8 +580,9 @@ static ssize_t acpi_pcc_write_sticky_key (struct file *file,
 	return_VALUE(count);
 }
 
-static ssize_t acpi_pcc_write_keyinput(struct file *file, const char __user *buffer,
-					 size_t count, loff_t *ppos)
+static ssize_t acpi_pcc_write_keyinput(struct file *file,
+				       const char __user *buffer,
+				       size_t count, loff_t *ppos)
 {
 	struct seq_file		*seq = (struct seq_file *)file->private_data;
 	struct acpi_hotkey	*hotkey = (struct acpi_hotkey *)seq->private;
@@ -572,13 +592,11 @@ static ssize_t acpi_pcc_write_keyinput(struct file *file, const char __user *buf
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_write_keyinput");
 
-	if (!hotkey || (count > (sizeof(write_string) - 1))) {
+	if (!hotkey || (count > (sizeof(write_string) - 1)))
 		return_VALUE(-EINVAL);
-	}
 
-	if (copy_from_user(write_string, buffer, count)) {
+	if (copy_from_user(write_string, buffer, count))
 		return_VALUE(-EFAULT);
-	}
 
 	write_string[count] = '\0';
 
@@ -592,7 +610,7 @@ static ssize_t acpi_pcc_write_keyinput(struct file *file, const char __user *buf
 }
 
 /* -------------------------------------------------------------------------
-                            hotkey driver
+   hotkey driver
    ------------------------------------------------------------------------- */
 static void acpi_pcc_generete_keyinput(struct acpi_hotkey *hotkey)
 {
@@ -604,7 +622,8 @@ static void acpi_pcc_generete_keyinput(struct acpi_hotkey *hotkey)
 		/*  0 */ -1,
 		/*  1 */ KEY_BRIGHTNESSDOWN,
 		/*  2 */ KEY_BRIGHTNESSUP,
-		/*  3 */ -1, /* vga/lcd switch event is not occur on hotkey driver. */
+		/*  3 */ -1, /* vga/lcd switch event is not occur on
+				hotkey driver. */
 		/*  4 */ KEY_MUTE,
 		/*  5 */ KEY_VOLUMEDOWN,
 		/*  6 */ KEY_VOLUMEUP,
@@ -616,11 +635,12 @@ static void acpi_pcc_generete_keyinput(struct acpi_hotkey *hotkey)
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_generete_keyinput");
 
-	if (keyinput->key_mode == 0) { return_VOID; }
+	if (keyinput->key_mode == 0)
+		return_VOID;
 
 	hkey_num = hinf & 0xf;
 
-	if ((       0 > hkey_num	   ) ||
+	if ((0 > hkey_num) ||
 	    (hkey_num > ARRAY_SIZE(key_map))) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
 				  "hotkey number out of range: %d\n",
@@ -645,12 +665,13 @@ static int acpi_pcc_hotkey_get_key(struct acpi_hotkey *hotkey)
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_hotkey_get_key");
 
-	status = acpi_evaluate_integer(hotkey->handle, METHOD_HKEY_QUERY, NULL, &result);
-	if (likely(ACPI_SUCCESS(status))) {
+	status = acpi_evaluate_integer(hotkey->handle, METHOD_HKEY_QUERY,
+								NULL, &result);
+	if (likely(ACPI_SUCCESS(status)))
 		hotkey->status = result;
-	} else {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "error getting hotkey status\n"));
-	}
+	else
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+			"error getting hotkey status\n"));
 
 	return_VALUE(status == AE_OK);
 }
@@ -661,11 +682,13 @@ void acpi_pcc_hotkey_notify(acpi_handle handle, u32 event, void *data)
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_hotkey_notify");
 
-	switch(event) {
+	switch (event) {
 	case HKEY_NOTIFY:
 		if (acpi_pcc_hotkey_get_key(hotkey)) {
-			/* generate event like '"pcc HKEY 00000080 00000084"' when Fn+F4 pressed */
-			acpi_bus_generate_proc_event(hotkey->device, event, hotkey->status);
+			/* generate event like '"pcc HKEY 00000080 00000084"'
+			 * when Fn+F4 pressed */
+			acpi_bus_generate_proc_event(hotkey->device, event,
+								hotkey->status);
 		}
 		acpi_pcc_generete_keyinput(hotkey);
 		break;
@@ -680,75 +703,96 @@ void acpi_pcc_hotkey_notify(acpi_handle handle, u32 event, void *data)
    FS Interface (/proc)
    ************************************************************************* */
 /* oepn proc file fs*/
-SEQ_OPEN_FS(acpi_pcc_dc_brightness_open_fs,	acpi_pcc_dc_brightness_show);
-SEQ_OPEN_FS(acpi_pcc_numbatteries_open_fs,	acpi_pcc_numbatteries_show);
-SEQ_OPEN_FS(acpi_pcc_lcdtype_open_fs,		acpi_pcc_lcdtype_show);
-SEQ_OPEN_FS(acpi_pcc_ac_brightness_max_open_fs, acpi_pcc_ac_brightness_max_show);
-SEQ_OPEN_FS(acpi_pcc_ac_brightness_min_open_fs, acpi_pcc_ac_brightness_min_show);
-SEQ_OPEN_FS(acpi_pcc_ac_brightness_open_fs,	acpi_pcc_ac_brightness_show);
-SEQ_OPEN_FS(acpi_pcc_dc_brightness_max_open_fs, acpi_pcc_dc_brightness_max_show);
-SEQ_OPEN_FS(acpi_pcc_dc_brightness_min_open_fs, acpi_pcc_dc_brightness_min_show);
-SEQ_OPEN_FS(acpi_pcc_brightness_open_fs,	acpi_pcc_brightness_show);
-SEQ_OPEN_FS(acpi_pcc_mute_open_fs,		acpi_pcc_mute_show);
-SEQ_OPEN_FS(acpi_pcc_version_open_fs,		acpi_pcc_version_show);
-SEQ_OPEN_FS(acpi_pcc_keyinput_open_fs,		acpi_pcc_keyinput_show);
-SEQ_OPEN_FS(acpi_pcc_sticky_key_open_fs,	acpi_pcc_sticky_key_show);
-
-typedef struct file_operations fops_t;
-static fops_t acpi_pcc_numbatteries_fops      = SEQ_FILEOPS_R (acpi_pcc_numbatteries_open_fs);
-static fops_t acpi_pcc_lcdtype_fops           = SEQ_FILEOPS_R (acpi_pcc_lcdtype_open_fs);
-static fops_t acpi_pcc_mute_fops              = SEQ_FILEOPS_RW(acpi_pcc_mute_open_fs, acpi_pcc_write_mute);
-static fops_t acpi_pcc_ac_brightness_fops     = SEQ_FILEOPS_RW(acpi_pcc_ac_brightness_open_fs, acpi_pcc_write_ac_brightness);
-static fops_t acpi_pcc_ac_brightness_max_fops = SEQ_FILEOPS_R (acpi_pcc_ac_brightness_max_open_fs);
-static fops_t acpi_pcc_ac_brightness_min_fops = SEQ_FILEOPS_R (acpi_pcc_ac_brightness_min_open_fs);
-static fops_t acpi_pcc_dc_brightness_fops     = SEQ_FILEOPS_RW(acpi_pcc_dc_brightness_open_fs, acpi_pcc_write_dc_brightness);
-static fops_t acpi_pcc_dc_brightness_max_fops = SEQ_FILEOPS_R (acpi_pcc_dc_brightness_max_open_fs);
-static fops_t acpi_pcc_dc_brightness_min_fops = SEQ_FILEOPS_R (acpi_pcc_dc_brightness_min_open_fs);
-static fops_t acpi_pcc_brightness_fops        = SEQ_FILEOPS_RW(acpi_pcc_brightness_open_fs, acpi_pcc_write_no_brightness);
-static fops_t acpi_pcc_sticky_key_fops        = SEQ_FILEOPS_RW(acpi_pcc_sticky_key_open_fs, acpi_pcc_write_sticky_key);
-static fops_t acpi_pcc_keyinput_fops          = SEQ_FILEOPS_RW(acpi_pcc_keyinput_open_fs, acpi_pcc_write_keyinput);
-static fops_t acpi_pcc_version_fops           = SEQ_FILEOPS_R (acpi_pcc_version_open_fs);
-
-typedef struct _ProcItem
-{
-	const char* name;
+SEQ_OPEN_FS(acpi_pcc_dc_brightness_open_fs, acpi_pcc_dc_brightness_show);
+SEQ_OPEN_FS(acpi_pcc_numbatteries_open_fs, acpi_pcc_numbatteries_show);
+SEQ_OPEN_FS(acpi_pcc_lcdtype_open_fs, acpi_pcc_lcdtype_show);
+SEQ_OPEN_FS(acpi_pcc_ac_brightness_max_open_fs,
+	    acpi_pcc_ac_brightness_max_show);
+SEQ_OPEN_FS(acpi_pcc_ac_brightness_min_open_fs,
+	    acpi_pcc_ac_brightness_min_show);
+SEQ_OPEN_FS(acpi_pcc_ac_brightness_open_fs, acpi_pcc_ac_brightness_show);
+SEQ_OPEN_FS(acpi_pcc_dc_brightness_max_open_fs,
+	    acpi_pcc_dc_brightness_max_show);
+SEQ_OPEN_FS(acpi_pcc_dc_brightness_min_open_fs,
+	    acpi_pcc_dc_brightness_min_show);
+SEQ_OPEN_FS(acpi_pcc_brightness_open_fs, acpi_pcc_brightness_show);
+SEQ_OPEN_FS(acpi_pcc_mute_open_fs, acpi_pcc_mute_show);
+SEQ_OPEN_FS(acpi_pcc_version_open_fs, acpi_pcc_version_show);
+SEQ_OPEN_FS(acpi_pcc_keyinput_open_fs, acpi_pcc_keyinput_show);
+SEQ_OPEN_FS(acpi_pcc_sticky_key_open_fs, acpi_pcc_sticky_key_show);
+
+static struct file_operations acpi_pcc_numbatteries_fops =
+	SEQ_FILEOPS_R(acpi_pcc_numbatteries_open_fs);
+static struct file_operations acpi_pcc_lcdtype_fops =
+	SEQ_FILEOPS_R(acpi_pcc_lcdtype_open_fs);
+static struct file_operations acpi_pcc_mute_fops =
+	SEQ_FILEOPS_RW(acpi_pcc_mute_open_fs, acpi_pcc_write_mute);
+static struct file_operations acpi_pcc_ac_brightness_fops =
+	SEQ_FILEOPS_RW(acpi_pcc_ac_brightness_open_fs,
+		       acpi_pcc_write_ac_brightness);
+static struct file_operations acpi_pcc_ac_brightness_max_fops =
+	SEQ_FILEOPS_R(acpi_pcc_ac_brightness_max_open_fs);
+static struct file_operations acpi_pcc_ac_brightness_min_fops =
+	SEQ_FILEOPS_R(acpi_pcc_ac_brightness_min_open_fs);
+static struct file_operations acpi_pcc_dc_brightness_fops =
+	SEQ_FILEOPS_RW(acpi_pcc_dc_brightness_open_fs,
+		       acpi_pcc_write_dc_brightness);
+static struct file_operations acpi_pcc_dc_brightness_max_fops =
+	SEQ_FILEOPS_R(acpi_pcc_dc_brightness_max_open_fs);
+static struct file_operations acpi_pcc_dc_brightness_min_fops =
+	SEQ_FILEOPS_R(acpi_pcc_dc_brightness_min_open_fs);
+static struct file_operations acpi_pcc_brightness_fops =
+	SEQ_FILEOPS_RW(acpi_pcc_brightness_open_fs,
+		       acpi_pcc_write_no_brightness);
+static struct file_operations acpi_pcc_sticky_key_fops =
+	SEQ_FILEOPS_RW(acpi_pcc_sticky_key_open_fs, acpi_pcc_write_sticky_key);
+static struct file_operations acpi_pcc_keyinput_fops =
+	SEQ_FILEOPS_RW(acpi_pcc_keyinput_open_fs, acpi_pcc_write_keyinput);
+static struct file_operations acpi_pcc_version_fops =
+	SEQ_FILEOPS_R(acpi_pcc_version_open_fs);
+
+struct proc_item {
+	const char *name;
 	struct file_operations *fops;
 	mode_t flag;
-} ProcItem;
+};
 
 /* Note: These functions map *exactly* to the SINF/SSET functions */
-ProcItem acpi_pcc_proc_items_sifr[] = {
-	{ "num_batteries",	&acpi_pcc_numbatteries_fops,	 S_IRUGO },
-	{ "lcd_type",		&acpi_pcc_lcdtype_fops,		 S_IRUGO },
-	{ "ac_brightness_max" , &acpi_pcc_ac_brightness_max_fops,S_IRUGO },
-	{ "ac_brightness_min" , &acpi_pcc_ac_brightness_min_fops,S_IRUGO },
-	{ "ac_brightness" ,	&acpi_pcc_ac_brightness_fops,	 S_IFREG | S_IRUGO | S_IWUSR },
-	{ "dc_brightness_max" , &acpi_pcc_dc_brightness_max_fops,S_IRUGO },
-	{ "dc_brightness_min" , &acpi_pcc_dc_brightness_min_fops,S_IRUGO },
-	{ "dc_brightness" ,	&acpi_pcc_dc_brightness_fops,	 S_IFREG | S_IRUGO | S_IWUSR },
-	{ "brightness" ,	&acpi_pcc_brightness_fops,    S_IFREG | S_IRUGO | S_IWUSR },
-	{ "mute",		&acpi_pcc_mute_fops,		 S_IFREG | S_IRUGO | S_IWUSR },
+struct proc_item acpi_pcc_proc_items_sifr[] = {
+	{ "num_batteries", &acpi_pcc_numbatteries_fops, S_IRUGO },
+	{ "lcd_type", &acpi_pcc_lcdtype_fops, S_IRUGO },
+	{ "ac_brightness_max", &acpi_pcc_ac_brightness_max_fops, S_IRUGO },
+	{ "ac_brightness_min", &acpi_pcc_ac_brightness_min_fops, S_IRUGO },
+	{ "ac_brightness", &acpi_pcc_ac_brightness_fops,
+		S_IFREG | S_IRUGO | S_IWUSR },
+	{ "dc_brightness_max", &acpi_pcc_dc_brightness_max_fops, S_IRUGO },
+	{ "dc_brightness_min", &acpi_pcc_dc_brightness_min_fops, S_IRUGO },
+	{ "dc_brightness", &acpi_pcc_dc_brightness_fops,
+		S_IFREG | S_IRUGO | S_IWUSR },
+	{ "brightness", &acpi_pcc_brightness_fops, S_IFREG | S_IRUGO | S_IWUSR},
+	{ "mute", &acpi_pcc_mute_fops, S_IFREG | S_IRUGO | S_IWUSR },
 	{ NULL, NULL, 0 },
 };
 
-ProcItem acpi_pcc_proc_items[] = {
-	{ "sticky_key",		&acpi_pcc_sticky_key_fops,	 S_IFREG | S_IRUGO | S_IWUSR },
-	{ "keyinput",		&acpi_pcc_keyinput_fops,	 S_IFREG | S_IRUGO | S_IWUSR },
-	{ "version",		&acpi_pcc_version_fops,		 S_IRUGO },
+struct proc_item acpi_pcc_proc_items[] = {
+	{ "sticky_key", &acpi_pcc_sticky_key_fops, S_IFREG | S_IRUGO | S_IWUSR},
+	{ "keyinput", &acpi_pcc_keyinput_fops, S_IFREG | S_IRUGO | S_IWUSR },
+	{ "version", &acpi_pcc_version_fops, S_IRUGO },
 	{ NULL, NULL, 0 },
 };
 
 static int __devinit acpi_pcc_add_device(struct acpi_device *device,
-					 ProcItem *proc_items,
+					 struct proc_item *proc_items,
 					 int num)
 {
-	struct acpi_hotkey *hotkey = (struct acpi_hotkey*)acpi_driver_data(device);
-	struct proc_dir_entry* proc;
-	ProcItem* item;
+	struct acpi_hotkey *hotkey = acpi_driver_data(device);
+	struct proc_dir_entry *proc;
+	struct proc_item *item;
 	int i;
 
 	for (item = proc_items, i = 0; item->name && i < num; ++item, ++i) {
-		proc = create_proc_entry(item->name, item->flag, hotkey->proc_dir_entry);
+		proc = create_proc_entry(item->name, item->flag,
+					 hotkey->proc_dir_entry);
 		if (likely(proc)) {
 			proc->proc_fops = item->fops;
 			proc->data = hotkey;
@@ -756,7 +800,8 @@ static int __devinit acpi_pcc_add_device(struct acpi_device *device,
 		} else {
 			while (i-- > 0) {
 				item--;
-				remove_proc_entry(item->name, hotkey->proc_dir_entry);
+				remove_proc_entry(item->name,
+					hotkey->proc_dir_entry);
 			}
 			return_VALUE(-ENODEV);
 		}
@@ -767,7 +812,7 @@ static int __devinit acpi_pcc_add_device(struct acpi_device *device,
 static int __devinit acpi_pcc_proc_init(struct acpi_device *device)
 {
 	struct proc_dir_entry *acpi_pcc_dir;
-	struct acpi_hotkey    *hotkey = (struct acpi_hotkey*)acpi_driver_data(device);
+	struct acpi_hotkey    *hotkey = acpi_driver_data(device);
 	acpi_status status;
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_proc_init");
@@ -775,15 +820,18 @@ static int __devinit acpi_pcc_proc_init(struct acpi_device *device)
 	acpi_pcc_dir = proc_mkdir(PROC_PCC, acpi_root_dir);
 
 	if (unlikely(!acpi_pcc_dir)) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Couldn't create dir in /proc\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				 "Couldn't create dir in /proc\n"));
 		return_VALUE(-ENODEV);
 	}
 
 	acpi_pcc_dir->owner = THIS_MODULE;
 	hotkey->proc_dir_entry = acpi_pcc_dir;
 
-	status =  acpi_pcc_add_device(device, acpi_pcc_proc_items_sifr, hotkey->num_sifr);
-	status |= acpi_pcc_add_device(device, acpi_pcc_proc_items,      ARRAY_SIZE(acpi_pcc_proc_items));
+	status =  acpi_pcc_add_device(device, acpi_pcc_proc_items_sifr,
+				      hotkey->num_sifr);
+	status |= acpi_pcc_add_device(device, acpi_pcc_proc_items,
+				      ARRAY_SIZE(acpi_pcc_proc_items));
 	if (unlikely(status)) {
 		remove_proc_entry(PROC_PCC, acpi_root_dir);
 		hotkey->proc_dir_entry = NULL;
@@ -794,14 +842,16 @@ static int __devinit acpi_pcc_proc_init(struct acpi_device *device)
 }
 
 static void __devexit acpi_pcc_remove_device(struct acpi_device *device,
-					     ProcItem *proc_items,
+					     struct proc_item *proc_items,
 					     int num)
 {
-	struct acpi_hotkey *hotkey = (struct acpi_hotkey*)acpi_driver_data(device);
-	ProcItem* item;
+	struct acpi_hotkey *hotkey = acpi_driver_data(device);
+	struct proc_item *item;
 	int i;
 
-	for (item = proc_items, i = 0; item->name != NULL && i < num; ++item, ++i) {
+	for (item = proc_items, i = 0;
+	     item->name != NULL && i < num;
+	     ++item, ++i) {
 		remove_proc_entry(item->name, hotkey->proc_dir_entry);
 	}
 
@@ -819,14 +869,18 @@ static int acpi_pcc_hotkey_resume(struct acpi_device *device)
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_hotkey_resume");
 
-	if (device == NULL || hotkey == NULL) { return_VALUE(-EINVAL); }
+	if (device == NULL || hotkey == NULL)
+		return_VALUE(-EINVAL);
 
 	if (hotkey->num_sifr != 0) {
-		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Sticky mode restore: %d\n", hotkey->sticky_mode));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Sticky mode restore: %d\n",
+				 hotkey->sticky_mode));
 
-		status = acpi_pcc_write_sset(hotkey, SINF_STICKY_KEY, hotkey->sticky_mode);
+		status = acpi_pcc_write_sset(hotkey, SINF_STICKY_KEY,
+					     hotkey->sticky_mode);
 	}
-	if (status != AE_OK) { return_VALUE(-EINVAL); }
+	if (status != AE_OK)
+		return_VALUE(-EINVAL);
 
 	return_VALUE(0);
 }
@@ -848,14 +902,16 @@ static int __devinit acpi_pcc_init_input(struct acpi_hotkey *hotkey)
 
 	hotk_input_dev = input_allocate_device();
 	if (hotk_input_dev == NULL) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Couldn't allocate input device for hotkey"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				 "Couldn't allocate input device for hotkey"));
 		goto err_input;
 	}
 
 	pcc_keyinput = kcalloc(1, sizeof(struct pcc_keyinput), GFP_KERNEL);
 
 	if (pcc_keyinput == NULL) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Couldn't allocate mem for private data"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				 "Couldn't allocate mem for private data"));
 		goto err_pcc;
 	}
 
@@ -886,9 +942,8 @@ static int __devinit acpi_pcc_init_input(struct acpi_hotkey *hotkey)
 
 	error = input_register_device(hotk_input_dev);
 
-	if (error) {
+	if (error)
 		goto err_pcc;
-	}
 
 	return_VALUE(0);
 
@@ -921,7 +976,7 @@ static void __devexit acpi_pcc_remove_input(struct acpi_hotkey *hotkey)
 /* -------------------------------------------------------------------------
    ACPI
    ------------------------------------------------------------------------- */
-static int __devinit acpi_pcc_hotkey_add (struct acpi_device *device)
+static int __devinit acpi_pcc_hotkey_add(struct acpi_device *device)
 {
 	acpi_status		status = AE_OK;
 	struct acpi_hotkey	*hotkey = NULL;
@@ -929,9 +984,8 @@ static int __devinit acpi_pcc_hotkey_add (struct acpi_device *device)
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_hotkey_add");
 
-	if (device == NULL) {
+	if (device == NULL)
 		return_VALUE(-EINVAL);
-	}
 
 	sifr_status = acpi_pcc_get_sqty(device);
 
@@ -949,7 +1003,8 @@ static int __devinit acpi_pcc_hotkey_add (struct acpi_device *device)
 
 	hotkey = kcalloc(1, sizeof(struct acpi_hotkey), GFP_KERNEL);
 	if (hotkey == NULL) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Couldn't allocate mem for hotkey"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				 "Couldn't allocate mem for hotkey"));
 		return_VALUE(-ENOMEM);
 	}
 
@@ -966,14 +1021,16 @@ static int __devinit acpi_pcc_hotkey_add (struct acpi_device *device)
 					     hotkey);
 
 	if (ACPI_FAILURE(status)) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error installing notify handler\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				 "Error installing notify handler\n"));
 		kfree(hotkey);
 		return_VALUE(-ENODEV);
 	}
 
 	result = acpi_pcc_init_input(hotkey);
 	if (result != 0) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error installing keyinput handler\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				 "Error installing keyinput handler\n"));
 		kfree(hotkey);
 		return_VALUE(result);
 	}
@@ -981,20 +1038,22 @@ static int __devinit acpi_pcc_hotkey_add (struct acpi_device *device)
 	return_VALUE(acpi_pcc_proc_init(device));
 }
 
-static int __devexit acpi_pcc_hotkey_remove(struct acpi_device *device, int type)
+static int __devexit acpi_pcc_hotkey_remove(struct acpi_device *device,
+					    int type)
 {
 	acpi_status		status = AE_OK;
 	struct acpi_hotkey	*hotkey = acpi_driver_data(device);
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_hotkey_remove");
 
-	if (!device || !hotkey) {
+	if (!device || !hotkey)
 		return_VALUE(-EINVAL);
-	}
 
 	if (hotkey->proc_dir_entry) {
-		acpi_pcc_remove_device(device, acpi_pcc_proc_items_sifr, hotkey->num_sifr);
-		acpi_pcc_remove_device(device, acpi_pcc_proc_items,      ARRAY_SIZE(acpi_pcc_proc_items));
+		acpi_pcc_remove_device(device, acpi_pcc_proc_items_sifr,
+				       hotkey->num_sifr);
+		acpi_pcc_remove_device(device, acpi_pcc_proc_items,
+				       ARRAY_SIZE(acpi_pcc_proc_items));
 		remove_proc_entry(PROC_PCC, acpi_root_dir);
 	}
 
@@ -1002,13 +1061,12 @@ static int __devexit acpi_pcc_hotkey_remove(struct acpi_device *device, int type
 		    ACPI_DEVICE_NOTIFY, acpi_pcc_hotkey_notify);
 
 	if (ACPI_FAILURE(status)) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error removing notify handler\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				 "Error removing notify handler\n"));
 	}
 
 	acpi_pcc_remove_input(hotkey);
-	if (hotkey != NULL) {
-		kfree(hotkey);
-	}
+	kfree(hotkey);
 	return_VALUE(status == AE_OK);
 }
 
@@ -1030,7 +1088,8 @@ static int __init acpi_pcc_init(void)
 
 	result = acpi_bus_register_driver(&acpi_pcc_driver);
 	if (result < 0) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error registering hotkey driver\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				 "Error registering hotkey driver\n"));
 		return_VALUE(-ENODEV);
 	}
 
Signature · 1 line
1.6.0.2
#38 lore raw

PATCH 32/42 Staging: SLICOSS: Free multicast list at driver exit

In reply to Greg KH

From: Lior Dotan <[email protected]>

The multicast address list is allocated in slic_mcast_add_list() but never freed.

---
 drivers/staging/slicoss/slicoss.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/staging/slicoss/slicoss.c +8 -0
index 6ef9274..8fa9490 100644
@@ -596,6 +596,7 @@ static void __devexit slic_entry_remove(struct pci_dev *pcidev)
 	uint mmio_len = 0;
 	struct adapter *adapter = (struct adapter *) netdev_priv(dev);
 	struct sliccard *card;
+	struct mcast_address *mcaddr, *mlist;
 
 	ASSERT(adapter);
 	DBG_MSG("slicoss: %s ENTER dev[%p] adapter[%p]\n", __func__, dev,
@@ -615,6 +616,13 @@ static void __devexit slic_entry_remove(struct pci_dev *pcidev)
 	DBG_MSG("slicoss: %s iounmap dev->base_addr[%x]\n", __func__,
 		(uint) dev->base_addr);
 	iounmap((void __iomem *)dev->base_addr);
+	/* free multicast addresses */
+	mlist = adapter->mcastaddrs;
+	while (mlist) {
+		mcaddr = mlist;
+		mlist = mlist->next;
+		kfree(mcaddr);
+	}
 	ASSERT(adapter->card);
 	card = adapter->card;
 	ASSERT(card->adapters_allocated);
Signature · 1 line
1.6.0.2
#39 lore raw

PATCH 33/42 Staging: Lindent the echo driver

In reply to Greg KH

From: J.R. Mauro <[email protected]>

Lindent drivers/staging/echo*

Signed-off by: J.R. Mauro <[email protected]>

---
 drivers/staging/echo/bit_operations.h |  187 ++++----
 drivers/staging/echo/echo.c           |  815 +++++++++++++++++----------------
 drivers/staging/echo/echo.h           |    7 +-
 drivers/staging/echo/fir.h            |  298 ++++++------
 drivers/staging/echo/mmx.h            |   29 +-
 drivers/staging/echo/oslec.h          |    2 +-
 6 files changed, 660 insertions(+), 678 deletions(-)
drivers/staging/echo/bit_operations.h +90 -97
index abcd7a2..cecdcf3 100644
@@ -36,14 +36,15 @@
     \return The bit number of the highest set bit, or -1 if the word is zero. */
 static __inline__ int top_bit(unsigned int bits)
 {
-    int res;
-
-    __asm__ (" xorl %[res],%[res];\n"
-             " decl %[res];\n"
-             " bsrl %[bits],%[res]\n"
-             : [res] "=&r" (res)
-             : [bits] "rm" (bits));
-    return res;
+	int res;
+
+	__asm__(" xorl %[res],%[res];\n"
+		" decl %[res];\n"
+		" bsrl %[bits],%[res]\n"
+		:[res] "=&r" (res)
+		:[bits] "rm"(bits)
+	);
+	return res;
 }
 
 /*! \brief Find the bit position of the lowest set bit in a word
@@ -51,84 +52,75 @@ static __inline__ int top_bit(unsigned int bits)
     \return The bit number of the lowest set bit, or -1 if the word is zero. */
 static __inline__ int bottom_bit(unsigned int bits)
 {
-    int res;
-
-    __asm__ (" xorl %[res],%[res];\n"
-             " decl %[res];\n"
-             " bsfl %[bits],%[res]\n"
-             : [res] "=&r" (res)
-             : [bits] "rm" (bits));
-    return res;
+	int res;
+
+	__asm__(" xorl %[res],%[res];\n"
+		" decl %[res];\n"
+		" bsfl %[bits],%[res]\n"
+		:[res] "=&r" (res)
+		:[bits] "rm"(bits)
+	);
+	return res;
 }
 #else
 static __inline__ int top_bit(unsigned int bits)
 {
-    int i;
-
-    if (bits == 0)
-        return -1;
-    i = 0;
-    if (bits & 0xFFFF0000)
-    {
-        bits &= 0xFFFF0000;
-        i += 16;
-    }
-    if (bits & 0xFF00FF00)
-    {
-        bits &= 0xFF00FF00;
-        i += 8;
-    }
-    if (bits & 0xF0F0F0F0)
-    {
-        bits &= 0xF0F0F0F0;
-        i += 4;
-    }
-    if (bits & 0xCCCCCCCC)
-    {
-        bits &= 0xCCCCCCCC;
-        i += 2;
-    }
-    if (bits & 0xAAAAAAAA)
-    {
-        bits &= 0xAAAAAAAA;
-        i += 1;
-    }
-    return i;
+	int i;
+
+	if (bits == 0)
+		return -1;
+	i = 0;
+	if (bits & 0xFFFF0000) {
+		bits &= 0xFFFF0000;
+		i += 16;
+	}
+	if (bits & 0xFF00FF00) {
+		bits &= 0xFF00FF00;
+		i += 8;
+	}
+	if (bits & 0xF0F0F0F0) {
+		bits &= 0xF0F0F0F0;
+		i += 4;
+	}
+	if (bits & 0xCCCCCCCC) {
+		bits &= 0xCCCCCCCC;
+		i += 2;
+	}
+	if (bits & 0xAAAAAAAA) {
+		bits &= 0xAAAAAAAA;
+		i += 1;
+	}
+	return i;
 }
 
 static __inline__ int bottom_bit(unsigned int bits)
 {
-    int i;
-
-    if (bits == 0)
-        return -1;
-    i = 32;
-    if (bits & 0x0000FFFF)
-    {
-        bits &= 0x0000FFFF;
-        i -= 16;
-    }
-    if (bits & 0x00FF00FF)
-    {
-        bits &= 0x00FF00FF;
-        i -= 8;
-    }
-    if (bits & 0x0F0F0F0F)
-    {
-        bits &= 0x0F0F0F0F;
-        i -= 4;
-    }
-    if (bits & 0x33333333)
-    {
-        bits &= 0x33333333;
-        i -= 2;
-    }
-    if (bits & 0x55555555)
-    {
-        bits &= 0x55555555;
-        i -= 1;
-    }
-    return i;
+	int i;
+
+	if (bits == 0)
+		return -1;
+	i = 32;
+	if (bits & 0x0000FFFF) {
+		bits &= 0x0000FFFF;
+		i -= 16;
+	}
+	if (bits & 0x00FF00FF) {
+		bits &= 0x00FF00FF;
+		i -= 8;
+	}
+	if (bits & 0x0F0F0F0F) {
+		bits &= 0x0F0F0F0F;
+		i -= 4;
+	}
+	if (bits & 0x33333333) {
+		bits &= 0x33333333;
+		i -= 2;
+	}
+	if (bits & 0x55555555) {
+		bits &= 0x55555555;
+		i -= 1;
+	}
+	return i;
 }
 #endif
 
@@ -138,13 +130,14 @@ static __inline__ int bottom_bit(unsigned int bits)
 static __inline__ uint8_t bit_reverse8(uint8_t x)
 {
 #if defined(__i386__)  ||  defined(__x86_64__)
-    /* If multiply is fast */
-    return ((x*0x0802U & 0x22110U) | (x*0x8020U & 0x88440U))*0x10101U >> 16;
+	/* If multiply is fast */
+	return ((x * 0x0802U & 0x22110U) | (x * 0x8020U & 0x88440U)) *
+	    0x10101U >> 16;
 #else
-    /* If multiply is slow, but we have a barrel shifter */
-    x = (x >> 4) | (x << 4);
-    x = ((x & 0xCC) >> 2) | ((x & 0x33) << 2);
-    return ((x & 0xAA) >> 1) | ((x & 0x55) << 1);
+	/* If multiply is slow, but we have a barrel shifter */
+	x = (x >> 4) | (x << 4);
+	x = ((x & 0xCC) >> 2) | ((x & 0x33) << 2);
+	return ((x & 0xAA) >> 1) | ((x & 0x55) << 1);
 #endif
 }
 
@@ -184,7 +177,7 @@ uint16_t make_mask16(uint16_t x);
     \return The word with the single set bit. */
 static __inline__ uint32_t least_significant_one32(uint32_t x)
 {
-    return (x & (-(int32_t) x));
+	return (x & (-(int32_t) x));
 }
 
 /*! \brief Find the most significant one in a word, and return a word
@@ -194,10 +187,10 @@ static __inline__ uint32_t least_significant_one32(uint32_t x)
 static __inline__ uint32_t most_significant_one32(uint32_t x)
 {
 #if defined(__i386__)  ||  defined(__x86_64__)
-    return 1 << top_bit(x);
+	return 1 << top_bit(x);
 #else
-    x = make_mask32(x);
-    return (x ^ (x >> 1));
+	x = make_mask32(x);
+	return (x ^ (x >> 1));
 #endif
 }
 
@@ -206,8 +199,8 @@ static __inline__ uint32_t most_significant_one32(uint32_t x)
     \return 1 for odd, or 0 for even. */
 static __inline__ int parity8(uint8_t x)
 {
-    x = (x ^ (x >> 4)) & 0x0F;
-    return (0x6996 >> x) & 1;
+	x = (x ^ (x >> 4)) & 0x0F;
+	return (0x6996 >> x) & 1;
 }
 
 /*! \brief Find the parity of a 16 bit word.
@@ -215,9 +208,9 @@ static __inline__ int parity8(uint8_t x)
     \return 1 for odd, or 0 for even. */
 static __inline__ int parity16(uint16_t x)
 {
-    x ^= (x >> 8);
-    x = (x ^ (x >> 4)) & 0x0F;
-    return (0x6996 >> x) & 1;
+	x ^= (x >> 8);
+	x = (x ^ (x >> 4)) & 0x0F;
+	return (0x6996 >> x) & 1;
 }
 
 /*! \brief Find the parity of a 32 bit word.
@@ -225,10 +218,10 @@ static __inline__ int parity16(uint16_t x)
     \return 1 for odd, or 0 for even. */
 static __inline__ int parity32(uint32_t x)
 {
-    x ^= (x >> 16);
-    x ^= (x >> 8);
-    x = (x ^ (x >> 4)) & 0x0F;
-    return (0x6996 >> x) & 1;
+	x ^= (x >> 16);
+	x ^= (x >> 8);
+	x = (x ^ (x >> 4)) & 0x0F;
+	return (0x6996 >> x) & 1;
 }
 
 #endif
drivers/staging/echo/echo.c +410 -405

906 lines not on this page · raw message

drivers/staging/echo/echo.h +3 -4
index 2a1d1d8..9fb9543 100644
@@ -124,9 +124,8 @@ a minor burden.
     G.168 echo canceller descriptor. This defines the working state for a line
     echo canceller.
 */
-struct oslec_state
-{
-	int16_t tx,rx;
+struct oslec_state {
+	int16_t tx, rx;
 	int16_t clean;
 	int16_t clean_nlp;
 
@@ -170,4 +169,4 @@ struct oslec_state
 	int16_t *snapshot;
 };
 
-#endif	/* __ECHO_H */
+#endif /* __ECHO_H */
drivers/staging/echo/fir.h +145 -153

366 lines not on this page · raw message

drivers/staging/echo/mmx.h +11 -18
index b5a3964..35412ef 100644
@@ -27,24 +27,23 @@
  * values by ULL, lest they be truncated by the compiler)
  */
 
-typedef        union {
-        long long               q;      /* Quadword (64-bit) value */
-        unsigned long long      uq;     /* Unsigned Quadword */
-        int                     d[2];   /* 2 Doubleword (32-bit) values */
-        unsigned int            ud[2];  /* 2 Unsigned Doubleword */
-        short                   w[4];   /* 4 Word (16-bit) values */
-        unsigned short          uw[4];  /* 4 Unsigned Word */
-        char                    b[8];   /* 8 Byte (8-bit) values */
-        unsigned char           ub[8];  /* 8 Unsigned Byte */
-        float                   s[2];   /* Single-precision (32-bit) value */
-} mmx_t;        /* On an 8-byte (64-bit) boundary */
+typedef union {
+	long long q;		/* Quadword (64-bit) value */
+	unsigned long long uq;	/* Unsigned Quadword */
+	int d[2];		/* 2 Doubleword (32-bit) values */
+	unsigned int ud[2];	/* 2 Unsigned Doubleword */
+	short w[4];		/* 4 Word (16-bit) values */
+	unsigned short uw[4];	/* 4 Unsigned Word */
+	char b[8];		/* 8 Byte (8-bit) values */
+	unsigned char ub[8];	/* 8 Unsigned Byte */
+	float s[2];		/* Single-precision (32-bit) value */
+} mmx_t;			/* On an 8-byte (64-bit) boundary */
 
 /* SSE registers */
 typedef union {
 	char b[16];
 } xmm_t;
 
-
 #define         mmx_i2r(op,imm,reg) \
         __asm__ __volatile__ (#op " %0, %%" #reg \
                               : /* nothing */ \
@@ -63,7 +62,6 @@ typedef union {
 #define         mmx_r2r(op,regs,regd) \
         __asm__ __volatile__ (#op " %" #regs ", %" #regd)
 
-
 #define         emms() __asm__ __volatile__ ("emms")
 
 #define         movd_m2r(var,reg)           mmx_m2r (movd, var, reg)
@@ -192,16 +190,13 @@ typedef union {
 #define         pxor_m2r(var,reg)           mmx_m2r (pxor, var, reg)
 #define         pxor_r2r(regs,regd)         mmx_r2r (pxor, regs, regd)
 
-
 /* 3DNOW extensions */
 
 #define         pavgusb_m2r(var,reg)        mmx_m2r (pavgusb, var, reg)
 #define         pavgusb_r2r(regs,regd)      mmx_r2r (pavgusb, regs, regd)
 
-
 /* AMD MMX extensions - also available in intel SSE */
 
-
 #define         mmx_m2ri(op,mem,reg,imm) \
         __asm__ __volatile__ (#op " %1, %0, %%" #reg \
                               : /* nothing */ \
@@ -216,7 +211,6 @@ typedef union {
                               : /* nothing */ \
                               : "m" (mem))
 
-
 #define         maskmovq(regs,maskreg)      mmx_r2ri (maskmovq, regs, maskreg)
 
 #define         movntq_r2m(mmreg,var)       mmx_r2m (movntq, mmreg, var)
@@ -284,5 +278,4 @@ typedef union {
 #define         punpcklqdq_r2r(regs,regd)   mmx_r2r (punpcklqdq, regs, regd)
 #define         punpckhqdq_r2r(regs,regd)   mmx_r2r (punpckhqdq, regs, regd)
 
-
 #endif /* AVCODEC_I386MMX_H */
drivers/staging/echo/oslec.h +1 -1
index e41de61..bad8523 100644
@@ -83,4 +83,4 @@ int16_t oslec_update(struct oslec_state *ec, int16_t tx, int16_t rx);
 */
 int16_t oslec_hpf_tx(struct oslec_state *ec, int16_t tx);
 
-#endif	/* __OSLEC_H */
+#endif /* __OSLEC_H */
Signature · 1 line
1.6.0.2
#40 lore raw

PATCH 34/42 Staging: sxg: clean up C99 comments

In reply to Greg KH

From: J.R. Mauro <[email protected]>

Change C99 comments to C89 comments

Some nested comments seem to have been missed and some blocks are redundantly commented, but at least most of the //'s are gone

Signed-off by: J.R. Mauro <[email protected]>

---
 drivers/staging/sxg/sxg.c   | 1040 +++++++++++++++++++++---------------------
 drivers/staging/sxg/sxghw.h |  120 +++---
 2 files changed, 580 insertions(+), 580 deletions(-)
drivers/staging/sxg/sxg.c +520 -520
index d8772e5..3b05acf 100644
@@ -223,7 +223,7 @@ static void sxg_dbg_macaddrs(p_adapter_t adapter)
 	return;
 }
 
-// SXG Globals
+/* SXG Globals */
 static SXG_DRIVER SxgDriver;
 
 #ifdef  ATKDBG
@@ -250,7 +250,7 @@ static bool sxg_download_microcode(p_adapter_t adapter, SXG_UCODE_SEL UcodeSel)
 	u32 ThisSectionSize;
 	u32 *Instruction = NULL;
 	u32 BaseAddress, AddressOffset, Address;
-//      u32                         Failure;
+/*      u32                         Failure; */
 	u32 ValueRead;
 	u32 i;
 	u32 numSections = 0;
@@ -262,7 +262,7 @@ static bool sxg_download_microcode(p_adapter_t adapter, SXG_UCODE_SEL UcodeSel)
 	DBG_ERROR("sxg: %s ENTER\n", __func__);
 
 	switch (UcodeSel) {
-	case SXG_UCODE_SAHARA:	// Sahara operational ucode
+	case SXG_UCODE_SAHARA:	/* Sahara operational ucode */
 		numSections = SNumSections;
 		for (i = 0; i < numSections; i++) {
 			sectionSize[i] = SSectionSize[i];
@@ -276,13 +276,13 @@ static bool sxg_download_microcode(p_adapter_t adapter, SXG_UCODE_SEL UcodeSel)
 	}
 
 	DBG_ERROR("sxg: RESET THE CARD\n");
-	// First, reset the card
+	/* First, reset the card */
 	WRITE_REG(HwRegs->Reset, 0xDEAD, FLUSH);
 
-	// Download each section of the microcode as specified in
-	// its download file.  The *download.c file is generated using
-	// the saharaobjtoc facility which converts the metastep .obj
-	// file to a .c file which contains a two dimentional array.
+	/* Download each section of the microcode as specified in */
+	/* its download file.  The *download.c file is generated using */
+	/* the saharaobjtoc facility which converts the metastep .obj */
+	/* file to a .c file which contains a two dimentional array. */
 	for (Section = 0; Section < numSections; Section++) {
 		DBG_ERROR("sxg: SECTION # %d\n", Section);
 		switch (UcodeSel) {
@@ -294,35 +294,35 @@ static bool sxg_download_microcode(p_adapter_t adapter, SXG_UCODE_SEL UcodeSel)
 			break;
 		}
 		BaseAddress = sectionStart[Section];
-		ThisSectionSize = sectionSize[Section] / 12;	// Size in instructions
+		ThisSectionSize = sectionSize[Section] / 12;	/* Size in instructions */
 		for (AddressOffset = 0; AddressOffset < ThisSectionSize;
 		     AddressOffset++) {
 			Address = BaseAddress + AddressOffset;
 			ASSERT((Address & ~MICROCODE_ADDRESS_MASK) == 0);
-			// Write instruction bits 31 - 0
+			/* Write instruction bits 31 - 0 */
 			WRITE_REG(HwRegs->UcodeDataLow, *Instruction, FLUSH);
-			// Write instruction bits 63-32
+			/* Write instruction bits 63-32 */
 			WRITE_REG(HwRegs->UcodeDataMiddle, *(Instruction + 1),
 				  FLUSH);
-			// Write instruction bits 95-64
+			/* Write instruction bits 95-64 */
 			WRITE_REG(HwRegs->UcodeDataHigh, *(Instruction + 2),
 				  FLUSH);
-			// Write instruction address with the WRITE bit set
+			/* Write instruction address with the WRITE bit set */
 			WRITE_REG(HwRegs->UcodeAddr,
 				  (Address | MICROCODE_ADDRESS_WRITE), FLUSH);
-			// Sahara bug in the ucode download logic - the write to DataLow
-			// for the next instruction could get corrupted.  To avoid this,
-			// write to DataLow again for this instruction (which may get
-			// corrupted, but it doesn't matter), then increment the address
-			// and write the data for the next instruction to DataLow.  That
-			// write should succeed.
+			/* Sahara bug in the ucode download logic - the write to DataLow */
+			/* for the next instruction could get corrupted.  To avoid this, */
+			/* write to DataLow again for this instruction (which may get */
+			/* corrupted, but it doesn't matter), then increment the address */
+			/* and write the data for the next instruction to DataLow.  That */
+			/* write should succeed. */
 			WRITE_REG(HwRegs->UcodeDataLow, *Instruction, TRUE);
-			// Advance 3 u32S to start of next instruction
+			/* Advance 3 u32S to start of next instruction */
 			Instruction += 3;
 		}
 	}
-	// Now repeat the entire operation reading the instruction back and
-	// checking for parity errors
+	/* Now repeat the entire operation reading the instruction back and */
+	/* checking for parity errors */
 	for (Section = 0; Section < numSections; Section++) {
 		DBG_ERROR("sxg: check SECTION # %d\n", Section);
 		switch (UcodeSel) {
@@ -334,51 +334,51 @@ static bool sxg_download_microcode(p_adapter_t adapter, SXG_UCODE_SEL UcodeSel)
 			break;
 		}
 		BaseAddress = sectionStart[Section];
-		ThisSectionSize = sectionSize[Section] / 12;	// Size in instructions
+		ThisSectionSize = sectionSize[Section] / 12;	/* Size in instructions */
 		for (AddressOffset = 0; AddressOffset < ThisSectionSize;
 		     AddressOffset++) {
 			Address = BaseAddress + AddressOffset;
-			// Write the address with the READ bit set
+			/* Write the address with the READ bit set */
 			WRITE_REG(HwRegs->UcodeAddr,
 				  (Address | MICROCODE_ADDRESS_READ), FLUSH);
-			// Read it back and check parity bit.
+			/* Read it back and check parity bit. */
 			READ_REG(HwRegs->UcodeAddr, ValueRead);
 			if (ValueRead & MICROCODE_ADDRESS_PARITY) {
 				DBG_ERROR("sxg: %s PARITY ERROR\n",
 					  __func__);
 
-				return (FALSE);	// Parity error
+				return (FALSE);	/* Parity error */
 			}
 			ASSERT((ValueRead & MICROCODE_ADDRESS_MASK) == Address);
-			// Read the instruction back and compare
+			/* Read the instruction back and compare */
 			READ_REG(HwRegs->UcodeDataLow, ValueRead);
 			if (ValueRead != *Instruction) {
 				DBG_ERROR("sxg: %s MISCOMPARE LOW\n",
 					  __func__);
-				return (FALSE);	// Miscompare
+				return (FALSE);	/* Miscompare */
 			}
 			READ_REG(HwRegs->UcodeDataMiddle, ValueRead);
 			if (ValueRead != *(Instruction + 1)) {
 				DBG_ERROR("sxg: %s MISCOMPARE MIDDLE\n",
 					  __func__);
-				return (FALSE);	// Miscompare
+				return (FALSE);	/* Miscompare */
 			}
 			READ_REG(HwRegs->UcodeDataHigh, ValueRead);
 			if (ValueRead != *(Instruction + 2)) {
 				DBG_ERROR("sxg: %s MISCOMPARE HIGH\n",
 					  __func__);
-				return (FALSE);	// Miscompare
+				return (FALSE);	/* Miscompare */
 			}
-			// Advance 3 u32S to start of next instruction
+			/* Advance 3 u32S to start of next instruction */
 			Instruction += 3;
 		}
 	}
 
-	// Everything OK, Go.
+	/* Everything OK, Go. */
 	WRITE_REG(HwRegs->UcodeAddr, MICROCODE_ADDRESS_GO, FLUSH);
 
-	// Poll the CardUp register to wait for microcode to initialize
-	// Give up after 10,000 attemps (500ms).
+	/* Poll the CardUp register to wait for microcode to initialize */
+	/* Give up after 10,000 attemps (500ms). */
 	for (i = 0; i < 10000; i++) {
 		udelay(50);
 		READ_REG(adapter->UcodeRegs[0].CardUp, ValueRead);
@@ -390,11 +390,11 @@ static bool sxg_download_microcode(p_adapter_t adapter, SXG_UCODE_SEL UcodeSel)
 	if (i == 10000) {
 		DBG_ERROR("sxg: %s TIMEOUT\n", __func__);
 
-		return (FALSE);	// Timeout
+		return (FALSE);	/* Timeout */
 	}
-	// Now write the LoadSync register.  This is used to
-	// synchronize with the card so it can scribble on the memory
-	// that contained 0xCAFE from the "CardUp" step above
+	/* Now write the LoadSync register.  This is used to */
+	/* synchronize with the card so it can scribble on the memory */
+	/* that contained 0xCAFE from the "CardUp" step above */
 	if (UcodeSel == SXG_UCODE_SAHARA) {
 		WRITE_REG(adapter->UcodeRegs[0].LoadSync, 0, FLUSH);
 	}
@@ -420,22 +420,22 @@ static int sxg_allocate_resources(p_adapter_t adapter)
 	int status;
 	u32 i;
 	u32 RssIds, IsrCount;
-//      PSXG_XMT_RING                                   XmtRing;
-//      PSXG_RCV_RING                                   RcvRing;
+/*      PSXG_XMT_RING                                   XmtRing; */
+/*      PSXG_RCV_RING                                   RcvRing; */
 
 	DBG_ERROR("%s ENTER\n", __func__);
 
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "AllocRes",
 		  adapter, 0, 0, 0);
 
-	// Windows tells us how many CPUs it plans to use for
-	// RSS
+	/* Windows tells us how many CPUs it plans to use for */
+	/* RSS */
 	RssIds = SXG_RSS_CPU_COUNT(adapter);
 	IsrCount = adapter->MsiEnabled ? RssIds : 1;
 
 	DBG_ERROR("%s Setup the spinlocks\n", __func__);
 
-	// Allocate spinlocks and initialize listheads first.
+	/* Allocate spinlocks and initialize listheads first. */
 	spin_lock_init(&adapter->RcvQLock);
 	spin_lock_init(&adapter->SglQLock);
 	spin_lock_init(&adapter->XmtZeroLock);
@@ -450,21 +450,21 @@ static int sxg_allocate_resources(p_adapter_t adapter)
 	InitializeListHead(&adapter->FreeSglBuffers);
 	InitializeListHead(&adapter->AllSglBuffers);
 
-	// Mark these basic allocations done.  This flags essentially
-	// tells the SxgFreeResources routine that it can grab spinlocks
-	// and reference listheads.
+	/* Mark these basic allocations done.  This flags essentially */
+	/* tells the SxgFreeResources routine that it can grab spinlocks */
+	/* and reference listheads. */
 	adapter->BasicAllocations = TRUE;
-	// Main allocation loop.  Start with the maximum supported by
-	// the microcode and back off if memory allocation
-	// fails.  If we hit a minimum, fail.
+	/* Main allocation loop.  Start with the maximum supported by */
+	/* the microcode and back off if memory allocation */
+	/* fails.  If we hit a minimum, fail. */
 
 	for (;;) {
 		DBG_ERROR("%s Allocate XmtRings size[%lx]\n", __func__,
 			  (sizeof(SXG_XMT_RING) * 1));
 
-		// Start with big items first - receive and transmit rings.  At the moment
-		// I'm going to keep the ring size fixed and adjust the number of
-		// TCBs if we fail.  Later we might consider reducing the ring size as well..
+		/* Start with big items first - receive and transmit rings.  At the moment */
+		/* I'm going to keep the ring size fixed and adjust the number of */
+		/* TCBs if we fail.  Later we might consider reducing the ring size as well.. */
 		adapter->XmtRings = pci_alloc_consistent(adapter->pcidev,
 							 sizeof(SXG_XMT_RING) *
 							 1,
@@ -490,7 +490,7 @@ static int sxg_allocate_resources(p_adapter_t adapter)
 		break;
 
 	      per_tcb_allocation_failed:
-		// an allocation failed.  Free any successful allocations.
+		/* an allocation failed.  Free any successful allocations. */
 		if (adapter->XmtRings) {
 			pci_free_consistent(adapter->pcidev,
 					    sizeof(SXG_XMT_RING) * 4096,
@@ -505,22 +505,22 @@ static int sxg_allocate_resources(p_adapter_t adapter)
 					    adapter->PRcvRings);
 			adapter->RcvRings = NULL;
 		}
-		// Loop around and try again....
+		/* Loop around and try again.... */
 	}
 
 	DBG_ERROR("%s Initialize RCV ZERO and XMT ZERO rings\n", __func__);
-	// Initialize rcv zero and xmt zero rings
+	/* Initialize rcv zero and xmt zero rings */
 	SXG_INITIALIZE_RING(adapter->RcvRingZeroInfo, SXG_RCV_RING_SIZE);
 	SXG_INITIALIZE_RING(adapter->XmtRingZeroInfo, SXG_XMT_RING_SIZE);
 
-	// Sanity check receive data structure format
+	/* Sanity check receive data structure format */
 	ASSERT((adapter->ReceiveBufferSize == SXG_RCV_DATA_BUFFER_SIZE) ||
 	       (adapter->ReceiveBufferSize == SXG_RCV_JUMBO_BUFFER_SIZE));
 	ASSERT(sizeof(SXG_RCV_DESCRIPTOR_BLOCK) ==
 	       SXG_RCV_DESCRIPTOR_BLOCK_SIZE);
 
-	// Allocate receive data buffers.  We allocate a block of buffers and
-	// a corresponding descriptor block at once.  See sxghw.h:SXG_RCV_BLOCK
+	/* Allocate receive data buffers.  We allocate a block of buffers and */
+	/* a corresponding descriptor block at once.  See sxghw.h:SXG_RCV_BLOCK */
 	for (i = 0; i < SXG_INITIAL_RCV_DATA_BUFFERS;
 	     i += SXG_RCV_DESCRIPTORS_PER_BLOCK) {
 		sxg_allocate_buffer_memory(adapter,
@@ -528,8 +528,8 @@ static int sxg_allocate_resources(p_adapter_t adapter)
 							      ReceiveBufferSize),
 					   SXG_BUFFER_TYPE_RCV);
 	}
-	// NBL resource allocation can fail in the 'AllocateComplete' routine, which
-	// doesn't return status.  Make sure we got the number of buffers we requested
+	/* NBL resource allocation can fail in the 'AllocateComplete' routine, which */
+	/* doesn't return status.  Make sure we got the number of buffers we requested */
 	if (adapter->FreeRcvBufferCount < SXG_INITIAL_RCV_DATA_BUFFERS) {
 		SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "XAResF6",
 			  adapter, adapter->FreeRcvBufferCount, SXG_MAX_ENTRIES,
@@ -540,14 +540,14 @@ static int sxg_allocate_resources(p_adapter_t adapter)
 	DBG_ERROR("%s Allocate EventRings size[%lx]\n", __func__,
 		  (sizeof(SXG_EVENT_RING) * RssIds));
 
-	// Allocate event queues.
+	/* Allocate event queues. */
 	adapter->EventRings = pci_alloc_consistent(adapter->pcidev,
 						   sizeof(SXG_EVENT_RING) *
 						   RssIds,
 						   &adapter->PEventRings);
 
 	if (!adapter->EventRings) {
-		// Caller will call SxgFreeAdapter to clean up above allocations
+		/* Caller will call SxgFreeAdapter to clean up above allocations */
 		SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "XAResF8",
 			  adapter, SXG_MAX_ENTRIES, 0, 0);
 		status = STATUS_RESOURCES;
@@ -556,11 +556,11 @@ static int sxg_allocate_resources(p_adapter_t adapter)
 	memset(adapter->EventRings, 0, sizeof(SXG_EVENT_RING) * RssIds);
 
 	DBG_ERROR("%s Allocate ISR size[%x]\n", __func__, IsrCount);
-	// Allocate ISR
+	/* Allocate ISR */
 	adapter->Isr = pci_alloc_consistent(adapter->pcidev,
 					    IsrCount, &adapter->PIsr);
 	if (!adapter->Isr) {
-		// Caller will call SxgFreeAdapter to clean up above allocations
+		/* Caller will call SxgFreeAdapter to clean up above allocations */
 		SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "XAResF9",
 			  adapter, SXG_MAX_ENTRIES, 0, 0);
 		status = STATUS_RESOURCES;
@@ -571,7 +571,7 @@ static int sxg_allocate_resources(p_adapter_t adapter)
 	DBG_ERROR("%s Allocate shared XMT ring zero index location size[%lx]\n",
 		  __func__, sizeof(u32));
 
-	// Allocate shared XMT ring zero index location
+	/* Allocate shared XMT ring zero index location */
 	adapter->XmtRingZeroIndex = pci_alloc_consistent(adapter->pcidev,
 							 sizeof(u32),
 							 &adapter->
@@ -607,13 +607,13 @@ static void sxg_config_pci(struct pci_dev *pcidev)
 
 	pci_read_config_word(pcidev, PCI_COMMAND, &pci_command);
 	DBG_ERROR("sxg: %s  PCI command[%4.4x]\n", __func__, pci_command);
-	// Set the command register
-	new_command = pci_command | (PCI_COMMAND_MEMORY |	// Memory Space Enable
-				     PCI_COMMAND_MASTER |	// Bus master enable
-				     PCI_COMMAND_INVALIDATE |	// Memory write and invalidate
-				     PCI_COMMAND_PARITY |	// Parity error response
-				     PCI_COMMAND_SERR |	// System ERR
-				     PCI_COMMAND_FAST_BACK);	// Fast back-to-back
+	/* Set the command register */
+	new_command = pci_command | (PCI_COMMAND_MEMORY |	/* Memory Space Enable */
+				     PCI_COMMAND_MASTER |	/* Bus master enable */
+				     PCI_COMMAND_INVALIDATE |	/* Memory write and invalidate */
+				     PCI_COMMAND_PARITY |	/* Parity error response */
+				     PCI_COMMAND_SERR |	/* System ERR */
+				     PCI_COMMAND_FAST_BACK);	/* Fast back-to-back */
 	if (pci_command != new_command) {
 		DBG_ERROR("%s -- Updating PCI COMMAND register %4.4x->%4.4x.\n",
 			  __func__, pci_command, new_command);
@@ -636,7 +636,7 @@ static int sxg_entry_probe(struct pci_dev *pcidev,
 	DBG_ERROR("sxg: %s 2.6 VERSION ENTER jiffies[%lx] cpu %d\n",
 		  __func__, jiffies, smp_processor_id());
 
-	// Initialize trace buffer
+	/* Initialize trace buffer */
 #ifdef ATKDBG
 	SxgTraceBuffer = &LSxgTraceBuffer;
 	SXG_TRACE_INIT(SxgTraceBuffer, TRACE_NOISY);
@@ -738,13 +738,13 @@ static int sxg_entry_probe(struct pci_dev *pcidev,
 	adapter->UcodeRegs = (void *)memmapped_ioaddr;
 
 	adapter->State = SXG_STATE_INITIALIZING;
-	// Maintain a list of all adapters anchored by
-	// the global SxgDriver structure.
+	/* Maintain a list of all adapters anchored by */
+	/* the global SxgDriver structure. */
 	adapter->Next = SxgDriver.Adapters;
 	SxgDriver.Adapters = adapter;
 	adapter->AdapterID = ++SxgDriver.AdapterID;
 
-	// Initialize CRC table used to determine multicast hash
+	/* Initialize CRC table used to determine multicast hash */
 	sxg_mcast_init_crc32();
 
 	adapter->JumboEnabled = FALSE;
@@ -757,10 +757,10 @@ static int sxg_entry_probe(struct pci_dev *pcidev,
 		adapter->ReceiveBufferSize = SXG_RCV_DATA_BUFFER_SIZE;
 	}
 
-//    status = SXG_READ_EEPROM(adapter);
-//    if (!status) {
-//        goto sxg_init_bad;
-//    }
+/*    status = SXG_READ_EEPROM(adapter); */
+/*    if (!status) { */
+/*        goto sxg_init_bad; */
+/*    } */
 
 	DBG_ERROR("sxg: %s ENTER sxg_config_pci\n", __func__);
 	sxg_config_pci(pcidev);
@@ -780,11 +780,11 @@ static int sxg_entry_probe(struct pci_dev *pcidev,
 	adapter->irq = pcidev->irq;
 	adapter->next_netdevice = head_netdevice;
 	head_netdevice = netdev;
-//      adapter->chipid = chip_idx;
-	adapter->port = 0;	//adapter->functionnumber;
+/*      adapter->chipid = chip_idx; */
+	adapter->port = 0;	/*adapter->functionnumber; */
 	adapter->cardindex = adapter->port;
 
-	// Allocate memory and other resources
+	/* Allocate memory and other resources */
 	DBG_ERROR("sxg: %s ENTER sxg_allocate_resources\n", __func__);
 	status = sxg_allocate_resources(adapter);
 	DBG_ERROR("sxg: %s EXIT sxg_allocate_resources status %x\n",
@@ -819,7 +819,7 @@ static int sxg_entry_probe(struct pci_dev *pcidev,
 #endif
 
 	strcpy(netdev->name, "eth%d");
-//  strcpy(netdev->name, pci_name(pcidev));
+/*  strcpy(netdev->name, pci_name(pcidev)); */
 	if ((err = register_netdev(netdev))) {
 		DBG_ERROR("Cannot register net device, aborting. %s\n",
 			  netdev->name);
@@ -832,9 +832,9 @@ static int sxg_entry_probe(struct pci_dev *pcidev,
 	     netdev->dev_addr[1], netdev->dev_addr[2], netdev->dev_addr[3],
 	     netdev->dev_addr[4], netdev->dev_addr[5]);
 
-//sxg_init_bad:
+/*sxg_init_bad: */
 	ASSERT(status == FALSE);
-//      sxg_free_adapter(adapter);
+/*      sxg_free_adapter(adapter); */
 
 	DBG_ERROR("sxg: %s EXIT status[%x] jiffies[%lx] cpu %d\n", __func__,
 		  status, jiffies, smp_processor_id());
@@ -874,12 +874,12 @@ static void sxg_disable_interrupt(p_adapter_t adapter)
 {
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "DisIntr",
 		  adapter, adapter->InterruptsEnabled, 0, 0);
-	// For now, RSS is disabled with line based interrupts
+	/* For now, RSS is disabled with line based interrupts */
 	ASSERT(adapter->RssEnabled == FALSE);
 	ASSERT(adapter->MsiEnabled == FALSE);
-	//
-	// Turn off interrupts by writing to the icr register.
-	//
+	/* */
+	/* Turn off interrupts by writing to the icr register. */
+	/* */
 	WRITE_REG(adapter->UcodeRegs[0].Icr, SXG_ICR(0, SXG_ICR_DISABLE), TRUE);
 
 	adapter->InterruptsEnabled = 0;
@@ -905,12 +905,12 @@ static void sxg_enable_interrupt(p_adapter_t adapter)
 {
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "EnIntr",
 		  adapter, adapter->InterruptsEnabled, 0, 0);
-	// For now, RSS is disabled with line based interrupts
+	/* For now, RSS is disabled with line based interrupts */
 	ASSERT(adapter->RssEnabled == FALSE);
 	ASSERT(adapter->MsiEnabled == FALSE);
-	//
-	// Turn on interrupts by writing to the icr register.
-	//
+	/* */
+	/* Turn on interrupts by writing to the icr register. */
+	/* */
 	WRITE_REG(adapter->UcodeRegs[0].Icr, SXG_ICR(0, SXG_ICR_ENABLE), TRUE);
 
 	adapter->InterruptsEnabled = 1;
@@ -935,29 +935,29 @@ static irqreturn_t sxg_isr(int irq, void *dev_id)
 {
 	p_net_device dev = (p_net_device) dev_id;
 	p_adapter_t adapter = (p_adapter_t) netdev_priv(dev);
-//      u32                 CpuMask = 0, i;
+/*      u32                 CpuMask = 0, i; */
 
 	adapter->Stats.NumInts++;
 	if (adapter->Isr[0] == 0) {
-		// The SLIC driver used to experience a number of spurious interrupts
-		// due to the delay associated with the masking of the interrupt
-		// (we'd bounce back in here).  If we see that again with Sahara,
-		// add a READ_REG of the Icr register after the WRITE_REG below.
+		/* The SLIC driver used to experience a number of spurious interrupts */
+		/* due to the delay associated with the masking of the interrupt */
+		/* (we'd bounce back in here).  If we see that again with Sahara, */
+		/* add a READ_REG of the Icr register after the WRITE_REG below. */
 		adapter->Stats.FalseInts++;
 		return IRQ_NONE;
 	}
-	//
-	// Move the Isr contents and clear the value in
-	// shared memory, and mask interrupts
-	//
+	/* */
+	/* Move the Isr contents and clear the value in */
+	/* shared memory, and mask interrupts */
+	/* */
 	adapter->IsrCopy[0] = adapter->Isr[0];
 	adapter->Isr[0] = 0;
 	WRITE_REG(adapter->UcodeRegs[0].Icr, SXG_ICR(0, SXG_ICR_MASK), TRUE);
-//      ASSERT(adapter->IsrDpcsPending == 0);
-#if XXXTODO			// RSS Stuff
-	// If RSS is enabled and the ISR specifies
-	// SXG_ISR_EVENT, then schedule DPC's
-	// based on event queues.
+/*      ASSERT(adapter->IsrDpcsPending == 0); */
+#if XXXTODO			/* RSS Stuff */
+	/* If RSS is enabled and the ISR specifies */
+	/* SXG_ISR_EVENT, then schedule DPC's */
+	/* based on event queues. */
 	if (adapter->RssEnabled && (adapter->IsrCopy[0] & SXG_ISR_EVENT)) {
 		for (i = 0;
 		     i < adapter->RssSystemInfo->ProcessorInfo.RssCpuCount;
@@ -973,8 +973,8 @@ static irqreturn_t sxg_isr(int irq, void *dev_id)
 			}
 		}
 	}
-	// Now, either schedule the CPUs specified by the CpuMask,
-	// or queue default
+	/* Now, either schedule the CPUs specified by the CpuMask, */
+	/* or queue default */
 	if (CpuMask) {
 		*QueueDefault = FALSE;
 	} else {
@@ -983,9 +983,9 @@ static irqreturn_t sxg_isr(int irq, void *dev_id)
 	}
 	*TargetCpus = CpuMask;
 #endif
-	//
-	//  There are no DPCs in Linux, so call the handler now
-	//
+	/* */
+	/*  There are no DPCs in Linux, so call the handler now */
+	/* */
 	sxg_handle_interrupt(adapter);
 
 	return IRQ_HANDLED;
@@ -993,7 +993,7 @@ static irqreturn_t sxg_isr(int irq, void *dev_id)
 
 static void sxg_handle_interrupt(p_adapter_t adapter)
 {
-//    unsigned char           RssId   = 0;
+/*    unsigned char           RssId   = 0; */
 	u32 NewIsr;
 
 	if (adapter->Stats.RcvNoBuffer < 5) {
@@ -1002,32 +1002,32 @@ static void sxg_handle_interrupt(p_adapter_t adapter)
 	}
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "HndlIntr",
 		  adapter, adapter->IsrCopy[0], 0, 0);
-	// For now, RSS is disabled with line based interrupts
+	/* For now, RSS is disabled with line based interrupts */
 	ASSERT(adapter->RssEnabled == FALSE);
 	ASSERT(adapter->MsiEnabled == FALSE);
 	ASSERT(adapter->IsrCopy[0]);
-/////////////////////////////
+/*/////////////////////////// */
 
-	// Always process the event queue.
+	/* Always process the event queue. */
 	sxg_process_event_queue(adapter,
 				(adapter->RssEnabled ? /*RssId */ 0 : 0));
 
-#if XXXTODO			// RSS stuff
+#if XXXTODO			/* RSS stuff */
 	if (--adapter->IsrDpcsPending) {
-		// We're done.
+		/* We're done. */
 		ASSERT(adapter->RssEnabled);
 		SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "DPCsPend",
 			  adapter, 0, 0, 0);
 		return;
 	}
 #endif
-	//
-	// Last (or only) DPC processes the ISR and clears the interrupt.
-	//
+	/* */
+	/* Last (or only) DPC processes the ISR and clears the interrupt. */
+	/* */
 	NewIsr = sxg_process_isr(adapter, 0);
-	//
-	// Reenable interrupts
-	//
+	/* */
+	/* Reenable interrupts */
+	/* */
 	adapter->IsrCopy[0] = 0;
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "ClearIsr",
 		  adapter, NewIsr, 0, 0);
@@ -1063,29 +1063,29 @@ static int sxg_process_isr(p_adapter_t adapter, u32 MessageId)
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "ProcIsr",
 		  adapter, Isr, 0, 0);
 
-	// Error
+	/* Error */
 	if (Isr & SXG_ISR_ERR) {
 		if (Isr & SXG_ISR_PDQF) {
 			adapter->Stats.PdqFull++;
 			DBG_ERROR("%s: SXG_ISR_ERR  PDQF!!\n", __func__);
 		}
-		// No host buffer
+		/* No host buffer */
 		if (Isr & SXG_ISR_RMISS) {
-			// There is a bunch of code in the SLIC driver which
-			// attempts to process more receive events per DPC
-			// if we start to fall behind.  We'll probably
-			// need to do something similar here, but hold
-			// off for now.  I don't want to make the code more
-			// complicated than strictly needed.
+			/* There is a bunch of code in the SLIC driver which */
+			/* attempts to process more receive events per DPC */
+			/* if we start to fall behind.  We'll probably */
+			/* need to do something similar here, but hold */
+			/* off for now.  I don't want to make the code more */
+			/* complicated than strictly needed. */
 			adapter->Stats.RcvNoBuffer++;
 			if (adapter->Stats.RcvNoBuffer < 5) {
 				DBG_ERROR("%s: SXG_ISR_ERR  RMISS!!\n",
 					  __func__);
 			}
 		}
-		// Card crash
+		/* Card crash */
 		if (Isr & SXG_ISR_DEAD) {
-			// Set aside the crash info and set the adapter state to RESET
+			/* Set aside the crash info and set the adapter state to RESET */
 			adapter->CrashCpu =
 			    (unsigned char)((Isr & SXG_ISR_CPU) >>
 					    SXG_ISR_CPU_SHIFT);
@@ -1094,44 +1094,44 @@ static int sxg_process_isr(p_adapter_t adapter, u32 MessageId)
 			DBG_ERROR("%s: ISR_DEAD %x, CPU: %d\n", __func__,
 				  adapter->CrashLocation, adapter->CrashCpu);
 		}
-		// Event ring full
+		/* Event ring full */
 		if (Isr & SXG_ISR_ERFULL) {
-			// Same issue as RMISS, really.  This means the
-			// host is falling behind the card.  Need to increase
-			// event ring size, process more events per interrupt,
-			// and/or reduce/remove interrupt aggregation.
+			/* Same issue as RMISS, really.  This means the */
+			/* host is falling behind the card.  Need to increase */
+			/* event ring size, process more events per interrupt, */
+			/* and/or reduce/remove interrupt aggregation. */
 			adapter->Stats.EventRingFull++;
 			DBG_ERROR("%s: SXG_ISR_ERR  EVENT RING FULL!!\n",
 				  __func__);
 		}
-		// Transmit drop - no DRAM buffers or XMT error
+		/* Transmit drop - no DRAM buffers or XMT error */
 		if (Isr & SXG_ISR_XDROP) {
 			adapter->Stats.XmtDrops++;
 			adapter->Stats.XmtErrors++;
 			DBG_ERROR("%s: SXG_ISR_ERR  XDROP!!\n", __func__);
 		}
 	}
-	// Slowpath send completions
+	/* Slowpath send completions */
 	if (Isr & SXG_ISR_SPSEND) {
 		sxg_complete_slow_send(adapter);
 	}
-	// Dump
+	/* Dump */
 	if (Isr & SXG_ISR_UPC) {
-		ASSERT(adapter->DumpCmdRunning);	// Maybe change when debug is added..
+		ASSERT(adapter->DumpCmdRunning);	/* Maybe change when debug is added.. */
 		adapter->DumpCmdRunning = FALSE;
 	}
-	// Link event
+	/* Link event */
 	if (Isr & SXG_ISR_LINK) {
 		sxg_link_event(adapter);
 	}
-	// Debug - breakpoint hit
+	/* Debug - breakpoint hit */
 	if (Isr & SXG_ISR_BREAK) {
-		// At the moment AGDB isn't written to support interactive
-		// debug sessions.  When it is, this interrupt will be used
-		// to signal AGDB that it has hit a breakpoint.  For now, ASSERT.
+		/* At the moment AGDB isn't written to support interactive */
+		/* debug sessions.  When it is, this interrupt will be used */
+		/* to signal AGDB that it has hit a breakpoint.  For now, ASSERT. */
 		ASSERT(0);
 	}
-	// Heartbeat response
+	/* Heartbeat response */
 	if (Isr & SXG_ISR_PING) {
 		adapter->PingOutstanding = FALSE;
 	}
@@ -1171,39 +1171,39 @@ static u32 sxg_process_event_queue(p_adapter_t adapter, u32 RssId)
 	       (adapter->State == SXG_STATE_PAUSING) ||
 	       (adapter->State == SXG_STATE_PAUSED) ||
 	       (adapter->State == SXG_STATE_HALTING));
-	// We may still have unprocessed events on the queue if
-	// the card crashed.  Don't process them.
+	/* We may still have unprocessed events on the queue if */
+	/* the card crashed.  Don't process them. */
 	if (adapter->Dead) {
 		return (0);
 	}
-	// In theory there should only be a single processor that
-	// accesses this queue, and only at interrupt-DPC time.  So
-	// we shouldn't need a lock for any of this.
+	/* In theory there should only be a single processor that */
+	/* accesses this queue, and only at interrupt-DPC time.  So */
+	/* we shouldn't need a lock for any of this. */
 	while (Event->Status & EVENT_STATUS_VALID) {
 		SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "Event",
 			  Event, Event->Code, Event->Status,
 			  adapter->NextEvent);
 		switch (Event->Code) {
 		case EVENT_CODE_BUFFERS:
-			ASSERT(!(Event->CommandIndex & 0xFF00));	// SXG_RING_INFO Head & Tail == unsigned char
-			//
+			ASSERT(!(Event->CommandIndex & 0xFF00));	/* SXG_RING_INFO Head & Tail == unsigned char */
+			/* */
 			sxg_complete_descriptor_blocks(adapter,
 						       Event->CommandIndex);
-			//
+			/* */
 			break;
 		case EVENT_CODE_SLOWRCV:
 			--adapter->RcvBuffersOnCard;
 			if ((skb = sxg_slow_receive(adapter, Event))) {
 				u32 rx_bytes;
 #ifdef LINUX_HANDLES_RCV_INDICATION_LISTS
-				// Add it to our indication list
+				/* Add it to our indication list */
 				SXG_ADD_RCV_PACKET(adapter, skb, prev_skb,
 						   IndicationList, num_skbs);
-				//  In Linux, we just pass up each skb to the protocol above at this point,
-				//  there is no capability of an indication list.
+				/*  In Linux, we just pass up each skb to the protocol above at this point, */
+				/*  there is no capability of an indication list. */
 #else
-// CHECK            skb_pull(skb, INIC_RCVBUF_HEADSIZE);
-				rx_bytes = Event->Length;	// (rcvbuf->length & IRHDDR_FLEN_MSK);
+/* CHECK            skb_pull(skb, INIC_RCVBUF_HEADSIZE); */
+				rx_bytes = Event->Length;	/* (rcvbuf->length & IRHDDR_FLEN_MSK); */
 				skb_put(skb, rx_bytes);
 				adapter->stats.rx_packets++;
 				adapter->stats.rx_bytes += rx_bytes;
@@ -1219,42 +1219,42 @@ static u32 sxg_process_event_queue(p_adapter_t adapter, u32 RssId)
 		default:
 			DBG_ERROR("%s: ERROR  Invalid EventCode %d\n",
 				  __func__, Event->Code);
-//                      ASSERT(0);
+/*                      ASSERT(0); */
 		}
-		// See if we need to restock card receive buffers.
-		// There are two things to note here:
-		//      First - This test is not SMP safe.  The
-		//              adapter->BuffersOnCard field is protected via atomic interlocked calls, but
-		//              we do not protect it with respect to these tests.  The only way to do that
-		//      is with a lock, and I don't want to grab a lock every time we adjust the
-		//      BuffersOnCard count.  Instead, we allow the buffer replenishment to be off
-		//      once in a while.  The worst that can happen is the card is given one
-		//      more-or-less descriptor block than the arbitrary value we've chosen.
-		//      No big deal
-		//      In short DO NOT ADD A LOCK HERE, OR WHERE RcvBuffersOnCard is adjusted.
-		//      Second - We expect this test to rarely evaluate to true.  We attempt to
-		//      refill descriptor blocks as they are returned to us
-		//      (sxg_complete_descriptor_blocks), so The only time this should evaluate
-		//      to true is when sxg_complete_descriptor_blocks failed to allocate
-		//              receive buffers.
+		/* See if we need to restock card receive buffers. */
+		/* There are two things to note here: */
+		/*      First - This test is not SMP safe.  The */
+		/*              adapter->BuffersOnCard field is protected via atomic interlocked calls, but */
+		/*              we do not protect it with respect to these tests.  The only way to do that */
+		/*      is with a lock, and I don't want to grab a lock every time we adjust the */
+		/*      BuffersOnCard count.  Instead, we allow the buffer replenishment to be off */
+		/*      once in a while.  The worst that can happen is the card is given one */
+		/*      more-or-less descriptor block than the arbitrary value we've chosen. */
+		/*      No big deal */
+		/*      In short DO NOT ADD A LOCK HERE, OR WHERE RcvBuffersOnCard is adjusted. */
+		/*      Second - We expect this test to rarely evaluate to true.  We attempt to */
+		/*      refill descriptor blocks as they are returned to us */
+		/*      (sxg_complete_descriptor_blocks), so The only time this should evaluate */
+		/*      to true is when sxg_complete_descriptor_blocks failed to allocate */
+		/*              receive buffers. */
 		if (adapter->RcvBuffersOnCard < SXG_RCV_DATA_BUFFERS) {
 			sxg_stock_rcv_buffers(adapter);
 		}
-		// It's more efficient to just set this to zero.
-		// But clearing the top bit saves potential debug info...
+		/* It's more efficient to just set this to zero. */
+		/* But clearing the top bit saves potential debug info... */
 		Event->Status &= ~EVENT_STATUS_VALID;
-		// Advanct to the next event
+		/* Advanct to the next event */
 		SXG_ADVANCE_INDEX(adapter->NextEvent[RssId], EVENT_RING_SIZE);
 		Event = &EventRing->Ring[adapter->NextEvent[RssId]];
 		EventsProcessed++;
 		if (EventsProcessed == EVENT_RING_BATCH) {
-			// Release a batch of events back to the card
+			/* Release a batch of events back to the card */
 			WRITE_REG(adapter->UcodeRegs[RssId].EventRelease,
 				  EVENT_RING_BATCH, FALSE);
 			EventsProcessed = 0;
-			// If we've processed our batch limit, break out of the
-			// loop and return SXG_ISR_EVENT to arrange for us to
-			// be called again
+			/* If we've processed our batch limit, break out of the */
+			/* loop and return SXG_ISR_EVENT to arrange for us to */
+			/* be called again */
 			if (Batches++ == EVENT_BATCH_LIMIT) {
 				SXG_TRACE(TRACE_SXG, SxgTraceBuffer,
 					  TRACE_NOISY, "EvtLimit", Batches,
@@ -1265,14 +1265,14 @@ static u32 sxg_process_event_queue(p_adapter_t adapter, u32 RssId)
 		}
 	}
 #ifdef LINUX_HANDLES_RCV_INDICATION_LISTS
-	//
-	// Indicate any received dumb-nic frames
-	//
+	/* */
+	/* Indicate any received dumb-nic frames */
+	/* */
 	SXG_INDICATE_PACKETS(adapter, IndicationList, num_skbs);
 #endif
-	//
-	// Release events back to the card.
-	//
+	/* */
+	/* Release events back to the card. */
+	/* */
 	if (EventsProcessed) {
 		WRITE_REG(adapter->UcodeRegs[RssId].EventRelease,
 			  EventsProcessed, FALSE);
@@ -1299,43 +1299,43 @@ static void sxg_complete_slow_send(p_adapter_t adapter)
 	u32 *ContextType;
 	PSXG_CMD XmtCmd;
 
-	// NOTE - This lock is dropped and regrabbed in this loop.
-	// This means two different processors can both be running
-	// through this loop. Be *very* careful.
+	/* NOTE - This lock is dropped and regrabbed in this loop. */
+	/* This means two different processors can both be running */
+	/* through this loop. Be *very* careful. */
 	spin_lock(&adapter->XmtZeroLock);
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "CmpSnds",
 		  adapter, XmtRingInfo->Head, XmtRingInfo->Tail, 0);
 
 	while (XmtRingInfo->Tail != *adapter->XmtRingZeroIndex) {
-		// Locate the current Cmd (ring descriptor entry), and
-		// associated SGL, and advance the tail
+		/* Locate the current Cmd (ring descriptor entry), and */
+		/* associated SGL, and advance the tail */
 		SXG_RETURN_CMD(XmtRing, XmtRingInfo, XmtCmd, ContextType);
 		ASSERT(ContextType);
 		SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "CmpSnd",
 			  XmtRingInfo->Head, XmtRingInfo->Tail, XmtCmd, 0);
-		// Clear the SGL field.
+		/* Clear the SGL field. */
 		XmtCmd->Sgl = 0;
 
 		switch (*ContextType) {
 		case SXG_SGL_DUMB:
 			{
 				struct sk_buff *skb;
-				// Dumb-nic send.  Command context is the dumb-nic SGL
+				/* Dumb-nic send.  Command context is the dumb-nic SGL */
 				skb = (struct sk_buff *)ContextType;
-				// Complete the send
+				/* Complete the send */
 				SXG_TRACE(TRACE_SXG, SxgTraceBuffer,
 					  TRACE_IMPORTANT, "DmSndCmp", skb, 0,
 					  0, 0);
 				ASSERT(adapter->Stats.XmtQLen);
-				adapter->Stats.XmtQLen--;	// within XmtZeroLock
+				adapter->Stats.XmtQLen--;	/* within XmtZeroLock */
 				adapter->Stats.XmtOk++;
-				// Now drop the lock and complete the send back to
-				// Microsoft.  We need to drop the lock because
-				// Microsoft can come back with a chimney send, which
-				// results in a double trip in SxgTcpOuput
+				/* Now drop the lock and complete the send back to */
+				/* Microsoft.  We need to drop the lock because */
+				/* Microsoft can come back with a chimney send, which */
+				/* results in a double trip in SxgTcpOuput */
 				spin_unlock(&adapter->XmtZeroLock);
 				SXG_COMPLETE_DUMB_SEND(adapter, skb);
-				// and reacquire..
+				/* and reacquire.. */
 				spin_lock(&adapter->XmtZeroLock);
 			}
 			break;
@@ -1371,7 +1371,7 @@ static struct sk_buff *sxg_slow_receive(p_adapter_t adapter, PSXG_EVENT Event)
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_IMPORTANT, "SlowRcv", Event,
 		  RcvDataBufferHdr, RcvDataBufferHdr->State,
 		  RcvDataBufferHdr->VirtualAddress);
-	// Drop rcv frames in non-running state
+	/* Drop rcv frames in non-running state */
 	switch (adapter->State) {
 	case SXG_STATE_RUNNING:
 		break;
@@ -1384,12 +1384,12 @@ static struct sk_buff *sxg_slow_receive(p_adapter_t adapter, PSXG_EVENT Event)
 		goto drop;
 	}
 
-	// Change buffer state to UPSTREAM
+	/* Change buffer state to UPSTREAM */
 	RcvDataBufferHdr->State = SXG_BUFFER_UPSTREAM;
 	if (Event->Status & EVENT_STATUS_RCVERR) {
 		SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "RcvError",
 			  Event, Event->Status, Event->HostHandle, 0);
-		// XXXTODO - Remove this print later
+		/* XXXTODO - Remove this print later */
 		DBG_ERROR("SXG: Receive error %x\n", *(u32 *)
 			  SXG_RECEIVE_DATA_LOCATION(RcvDataBufferHdr));
 		sxg_process_rcv_error(adapter, *(u32 *)
@@ -1397,8 +1397,8 @@ static struct sk_buff *sxg_slow_receive(p_adapter_t adapter, PSXG_EVENT Event)
 				      (RcvDataBufferHdr));
 		goto drop;
 	}
-#if XXXTODO			// VLAN stuff
-	// If there's a VLAN tag, extract it and validate it
+#if XXXTODO			/* VLAN stuff */
+	/* If there's a VLAN tag, extract it and validate it */
 	if (((p_ether_header) (SXG_RECEIVE_DATA_LOCATION(RcvDataBufferHdr)))->
 	    EtherType == ETHERTYPE_VLAN) {
 		if (SxgExtractVlanHeader(adapter, RcvDataBufferHdr, Event) !=
@@ -1411,9 +1411,9 @@ static struct sk_buff *sxg_slow_receive(p_adapter_t adapter, PSXG_EVENT Event)
 		}
 	}
 #endif
-	//
-	// Dumb-nic frame.  See if it passes our mac filter and update stats
-	//
+	/* */
+	/* Dumb-nic frame.  See if it passes our mac filter and update stats */
+	/* */
 	if (!sxg_mac_filter(adapter, (p_ether_header)
 			    SXG_RECEIVE_DATA_LOCATION(RcvDataBufferHdr),
 			    Event->Length)) {
@@ -1427,9 +1427,9 @@ static struct sk_buff *sxg_slow_receive(p_adapter_t adapter, PSXG_EVENT Event)
 
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_IMPORTANT, "DumbRcv",
 		  RcvDataBufferHdr, Packet, Event->Length, 0);
-	//
-	// Lastly adjust the receive packet length.
-	//
+	/* */
+	/* Lastly adjust the receive packet length. */
+	/* */
 	SXG_ADJUST_RCV_PACKET(Packet, RcvDataBufferHdr, Event);
 
 	return (Packet);
@@ -1541,7 +1541,7 @@ static bool sxg_mac_filter(p_adapter_t adapter, p_ether_header EtherHdr,
 
 	if (SXG_MULTICAST_PACKET(EtherHdr)) {
 		if (SXG_BROADCAST_PACKET(EtherHdr)) {
-			// broadcast
+			/* broadcast */
 			if (adapter->MacFilter & MAC_BCAST) {
 				adapter->Stats.DumbRcvBcastPkts++;
 				adapter->Stats.DumbRcvBcastBytes += length;
@@ -1550,7 +1550,7 @@ static bool sxg_mac_filter(p_adapter_t adapter, p_ether_header EtherHdr,
 				return (TRUE);
 			}
 		} else {
-			// multicast
+			/* multicast */
 			if (adapter->MacFilter & MAC_ALLMCAST) {
 				adapter->Stats.DumbRcvMcastPkts++;
 				adapter->Stats.DumbRcvMcastBytes += length;
@@ -1580,9 +1580,9 @@ static bool sxg_mac_filter(p_adapter_t adapter, p_ether_header EtherHdr,
 			}
 		}
 	} else if (adapter->MacFilter & MAC_DIRECTED) {
-		// Not broadcast or multicast.  Must be directed at us or
-		// the card is in promiscuous mode.  Either way, consider it
-		// ours if MAC_DIRECTED is set
+		/* Not broadcast or multicast.  Must be directed at us or */
+		/* the card is in promiscuous mode.  Either way, consider it */
+		/* ours if MAC_DIRECTED is set */
 		adapter->Stats.DumbRcvUcastPkts++;
 		adapter->Stats.DumbRcvUcastBytes += length;
 		adapter->Stats.DumbRcvPkts++;
@@ -1590,7 +1590,7 @@ static bool sxg_mac_filter(p_adapter_t adapter, p_ether_header EtherHdr,
 		return (TRUE);
 	}
 	if (adapter->MacFilter & MAC_PROMISC) {
-		// Whatever it is, keep it.
+		/* Whatever it is, keep it. */
 		adapter->Stats.DumbRcvPkts++;
 		adapter->Stats.DumbRcvBytes += length;
 		return (TRUE);
@@ -1625,7 +1625,7 @@ static int sxg_register_interrupt(p_adapter_t adapter)
 		}
 		adapter->intrregistered = 1;
 		adapter->IntRegistered = TRUE;
-		// Disable RSS with line-based interrupts
+		/* Disable RSS with line-based interrupts */
 		adapter->MsiEnabled = FALSE;
 		adapter->RssEnabled = FALSE;
 		DBG_ERROR("sxg: %s AllocAdaptRsrcs adapter[%p] dev->irq[%x]\n",
@@ -1738,7 +1738,7 @@ static int sxg_entry_open(p_net_device dev)
 		sxg_global.num_sxg_ports_active++;
 		adapter->activated = 1;
 	}
-	// Initialize the adapter
+	/* Initialize the adapter */
 	DBG_ERROR("sxg: %s ENTER sxg_initialize_adapter\n", __func__);
 	status = sxg_initialize_adapter(adapter);
 	DBG_ERROR("sxg: %s EXIT sxg_initialize_adapter status[%x]\n",
@@ -1762,7 +1762,7 @@ static int sxg_entry_open(p_net_device dev)
 	}
 	DBG_ERROR("sxg: %s ENABLE ALL INTERRUPTS\n", __func__);
 
-	// Enable interrupts
+	/* Enable interrupts */
 	SXG_ENABLE_ALL_INTERRUPTS(adapter);
 
 	DBG_ERROR("sxg: %s EXIT\n", __func__);
@@ -1825,11 +1825,11 @@ static int sxg_entry_halt(p_net_device dev)
 static int sxg_ioctl(p_net_device dev, struct ifreq *rq, int cmd)
 {
 	ASSERT(rq);
-//      DBG_ERROR("sxg: %s cmd[%x] rq[%p] dev[%p]\n", __func__, cmd, rq, dev);
+/*      DBG_ERROR("sxg: %s cmd[%x] rq[%p] dev[%p]\n", __func__, cmd, rq, dev); */
 	switch (cmd) {
 	case SIOCSLICSETINTAGG:
 		{
-//                      p_adapter_t adapter = (p_adapter_t) netdev_priv(dev);
+/*                      p_adapter_t adapter = (p_adapter_t) netdev_priv(dev); */
 			u32 data[7];
 			u32 intagg;
 
@@ -1846,7 +1846,7 @@ static int sxg_ioctl(p_net_device dev, struct ifreq *rq, int cmd)
 		}
 
 	default:
-//              DBG_ERROR("sxg: %s UNSUPPORTED[%x]\n", __func__, cmd);
+/*              DBG_ERROR("sxg: %s UNSUPPORTED[%x]\n", __func__, cmd); */
 		return -EOPNOTSUPP;
 	}
 	return 0;
@@ -1872,13 +1872,13 @@ static int sxg_send_packets(struct sk_buff *skb, p_net_device dev)
 
 	DBG_ERROR("sxg: %s ENTER sxg_send_packets skb[%p]\n", __func__,
 		  skb);
-	// Check the adapter state
+	/* Check the adapter state */
 	switch (adapter->State) {
 	case SXG_STATE_INITIALIZING:
 	case SXG_STATE_HALTED:
 	case SXG_STATE_SHUTDOWN:
-		ASSERT(0);	// unexpected
-		// fall through
+		ASSERT(0);	/* unexpected */
+		/* fall through */
 	case SXG_STATE_RESETTING:
 	case SXG_STATE_SLEEP:
 	case SXG_STATE_BOOTDIAG:
@@ -1898,17 +1898,17 @@ static int sxg_send_packets(struct sk_buff *skb, p_net_device dev)
 	if (status != STATUS_SUCCESS) {
 		goto xmit_fail;
 	}
-	// send a packet
+	/* send a packet */
 	status = sxg_transmit_packet(adapter, skb);
 	if (status == STATUS_SUCCESS) {
 		goto xmit_done;
 	}
 
       xmit_fail:
-	// reject & complete all the packets if they cant be sent
+	/* reject & complete all the packets if they cant be sent */
 	if (status != STATUS_SUCCESS) {
 #if XXXTODO
-//      sxg_send_packets_fail(adapter, skb, status);
+/*      sxg_send_packets_fail(adapter, skb, status); */
 #else
 		SXG_DROP_DUMB_SEND(adapter, skb);
 		adapter->stats.tx_dropped++;
@@ -1940,12 +1940,12 @@ static int sxg_transmit_packet(p_adapter_t adapter, struct sk_buff *skb)
 	void *SglBuffer;
 	u32 SglBufferLength;
 
-	// The vast majority of work is done in the shared
-	// sxg_dumb_sgl routine.
+	/* The vast majority of work is done in the shared */
+	/* sxg_dumb_sgl routine. */
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "DumbSend",
 		  adapter, skb, 0, 0);
 
-	// Allocate a SGL buffer
+	/* Allocate a SGL buffer */
 	SXG_GET_SGL_BUFFER(adapter, SxgSgl);
 	if (!SxgSgl) {
 		adapter->Stats.NoSglBuf++;
@@ -1963,9 +1963,9 @@ static int sxg_transmit_packet(p_adapter_t adapter, struct sk_buff *skb)
 	SxgSgl->DumbPacket = skb;
 	pSgl = NULL;
 
-	// Call the common sxg_dumb_sgl routine to complete the send.
+	/* Call the common sxg_dumb_sgl routine to complete the send. */
 	sxg_dumb_sgl(pSgl, SxgSgl);
-	// Return success   sxg_dumb_sgl (or something later) will complete it.
+	/* Return success   sxg_dumb_sgl (or something later) will complete it. */
 	return (STATUS_SUCCESS);
 }
 
@@ -1983,39 +1983,39 @@ static void sxg_dumb_sgl(PSCATTER_GATHER_LIST pSgl, PSXG_SCATTER_GATHER SxgSgl)
 {
 	p_adapter_t adapter = SxgSgl->adapter;
 	struct sk_buff *skb = SxgSgl->DumbPacket;
-	// For now, all dumb-nic sends go on RSS queue zero
+	/* For now, all dumb-nic sends go on RSS queue zero */
 	PSXG_XMT_RING XmtRing = &adapter->XmtRings[0];
 	PSXG_RING_INFO XmtRingInfo = &adapter->XmtRingZeroInfo;
 	PSXG_CMD XmtCmd = NULL;
-//      u32                         Index = 0;
+/*      u32                         Index = 0; */
 	u32 DataLength = skb->len;
-//  unsigned int                                BufLen;
-//      u32                         SglOffset;
+/*  unsigned int                                BufLen; */
+/*      u32                         SglOffset; */
 	u64 phys_addr;
 
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "DumbSgl",
 		  pSgl, SxgSgl, 0, 0);
 
-	// Set aside a pointer to the sgl
+	/* Set aside a pointer to the sgl */
 	SxgSgl->pSgl = pSgl;
 
-	// Sanity check that our SGL format is as we expect.
+	/* Sanity check that our SGL format is as we expect. */
 	ASSERT(sizeof(SXG_X64_SGE) == sizeof(SCATTER_GATHER_ELEMENT));
-	// Shouldn't be a vlan tag on this frame
+	/* Shouldn't be a vlan tag on this frame */
 	ASSERT(SxgSgl->VlanTag.VlanTci == 0);
 	ASSERT(SxgSgl->VlanTag.VlanTpid == 0);
 
-	// From here below we work with the SGL placed in our
-	// buffer.
+	/* From here below we work with the SGL placed in our */
+	/* buffer. */
 
 	SxgSgl->Sgl.NumberOfElements = 1;
 
-	// Grab the spinlock and acquire a command
+	/* Grab the spinlock and acquire a command */
 	spin_lock(&adapter->XmtZeroLock);
 	SXG_GET_CMD(XmtRing, XmtRingInfo, XmtCmd, SxgSgl);
 	if (XmtCmd == NULL) {
-		// Call sxg_complete_slow_send to see if we can
-		// free up any XmtRingZero entries and then try again
+		/* Call sxg_complete_slow_send to see if we can */
+		/* free up any XmtRingZero entries and then try again */
 		spin_unlock(&adapter->XmtZeroLock);
 		sxg_complete_slow_send(adapter);
 		spin_lock(&adapter->XmtZeroLock);
@@ -2027,10 +2027,10 @@ static void sxg_dumb_sgl(PSCATTER_GATHER_LIST pSgl, PSXG_SCATTER_GATHER SxgSgl)
 	}
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "DumbCmd",
 		  XmtCmd, XmtRingInfo->Head, XmtRingInfo->Tail, 0);
-	// Update stats
+	/* Update stats */
 	adapter->Stats.DumbXmtPkts++;
 	adapter->Stats.DumbXmtBytes += DataLength;
-#if XXXTODO			// Stats stuff
+#if XXXTODO			/* Stats stuff */
 	if (SXG_MULTICAST_PACKET(EtherHdr)) {
 		if (SXG_BROADCAST_PACKET(EtherHdr)) {
 			adapter->Stats.DumbXmtBcastPkts++;
@@ -2044,8 +2044,8 @@ static void sxg_dumb_sgl(PSCATTER_GATHER_LIST pSgl, PSXG_SCATTER_GATHER SxgSgl)
 		adapter->Stats.DumbXmtUcastBytes += DataLength;
 	}
 #endif
-	// Fill in the command
-	// Copy out the first SGE to the command and adjust for offset
+	/* Fill in the command */
+	/* Copy out the first SGE to the command and adjust for offset */
 	phys_addr =
 	    pci_map_single(adapter->pcidev, skb->data, skb->len,
 			   PCI_DMA_TODEVICE);
@@ -2053,54 +2053,54 @@ static void sxg_dumb_sgl(PSCATTER_GATHER_LIST pSgl, PSXG_SCATTER_GATHER SxgSgl)
 	XmtCmd->Buffer.FirstSgeAddress = XmtCmd->Buffer.FirstSgeAddress << 32;
 	XmtCmd->Buffer.FirstSgeAddress =
 	    XmtCmd->Buffer.FirstSgeAddress | SXG_GET_ADDR_LOW(phys_addr);
-//      XmtCmd->Buffer.FirstSgeAddress = SxgSgl->Sgl.Elements[Index].Address;
-//      XmtCmd->Buffer.FirstSgeAddress.LowPart += MdlOffset;
+/*      XmtCmd->Buffer.FirstSgeAddress = SxgSgl->Sgl.Elements[Index].Address; */
+/*      XmtCmd->Buffer.FirstSgeAddress.LowPart += MdlOffset; */
 	XmtCmd->Buffer.FirstSgeLength = DataLength;
-	// Set a pointer to the remaining SGL entries
-//      XmtCmd->Sgl = SxgSgl->PhysicalAddress;
-	// Advance the physical address of the SxgSgl structure to
-	// the second SGE
-//      SglOffset = (u32)((u32 *)(&SxgSgl->Sgl.Elements[Index+1]) -
-//                                              (u32 *)SxgSgl);
-//      XmtCmd->Sgl.LowPart += SglOffset;
+	/* Set a pointer to the remaining SGL entries */
+/*      XmtCmd->Sgl = SxgSgl->PhysicalAddress; */
+	/* Advance the physical address of the SxgSgl structure to */
+	/* the second SGE */
+/*      SglOffset = (u32)((u32 *)(&SxgSgl->Sgl.Elements[Index+1]) - */
+/*                                              (u32 *)SxgSgl); */
+/*      XmtCmd->Sgl.LowPart += SglOffset; */
 	XmtCmd->Buffer.SgeOffset = 0;
-	// Note - TotalLength might be overwritten with MSS below..
+	/* Note - TotalLength might be overwritten with MSS below.. */
 	XmtCmd->Buffer.TotalLength = DataLength;
-	XmtCmd->SgEntries = 1;	//(ushort)(SxgSgl->Sgl.NumberOfElements - Index);
+	XmtCmd->SgEntries = 1;	/*(ushort)(SxgSgl->Sgl.NumberOfElements - Index); */
 	XmtCmd->Flags = 0;
-	//
-	// Advance transmit cmd descripter by 1.
-	// NOTE - See comments in SxgTcpOutput where we write
-	// to the XmtCmd register regarding CPU ID values and/or
-	// multiple commands.
-	//
-	//
+	/* */
+	/* Advance transmit cmd descripter by 1. */
+	/* NOTE - See comments in SxgTcpOutput where we write */
+	/* to the XmtCmd register regarding CPU ID values and/or */
+	/* multiple commands. */
+	/* */
+	/* */
 	WRITE_REG(adapter->UcodeRegs[0].XmtCmd, 1, TRUE);
-	//
-	//
-	adapter->Stats.XmtQLen++;	// Stats within lock
+	/* */
+	/* */
+	adapter->Stats.XmtQLen++;	/* Stats within lock */
 	spin_unlock(&adapter->XmtZeroLock);
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "XDumSgl2",
 		  XmtCmd, pSgl, SxgSgl, 0);
 	return;
 
       abortcmd:
-	// NOTE - Only jump to this label AFTER grabbing the
-	// XmtZeroLock, and DO NOT DROP IT between the
-	// command allocation and the following abort.
+	/* NOTE - Only jump to this label AFTER grabbing the */
+	/* XmtZeroLock, and DO NOT DROP IT between the */
+	/* command allocation and the following abort. */
 	if (XmtCmd) {
 		SXG_ABORT_CMD(XmtRingInfo);
 	}
 	spin_unlock(&adapter->XmtZeroLock);
 
-// failsgl:
-	// Jump to this label if failure occurs before the
-	// XmtZeroLock is grabbed
+/* failsgl: */
+	/* Jump to this label if failure occurs before the */
+	/* XmtZeroLock is grabbed */
 	adapter->Stats.XmtErrors++;
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_IMPORTANT, "DumSGFal",
 		  pSgl, SxgSgl, XmtRingInfo->Head, XmtRingInfo->Tail);
 
-	SXG_COMPLETE_DUMB_SEND(adapter, SxgSgl->DumbPacket);	// SxgSgl->DumbPacket is the skb
+	SXG_COMPLETE_DUMB_SEND(adapter, SxgSgl->DumbPacket);	/* SxgSgl->DumbPacket is the skb */
 }
 
 /***************************************************************
@@ -2127,122 +2127,122 @@ static int sxg_initialize_link(p_adapter_t adapter)
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "InitLink",
 		  adapter, 0, 0, 0);
 
-	// Reset PHY and XGXS module
+	/* Reset PHY and XGXS module */
 	WRITE_REG(HwRegs->LinkStatus, LS_SERDES_POWER_DOWN, TRUE);
 
-	// Reset transmit configuration register
+	/* Reset transmit configuration register */
 	WRITE_REG(HwRegs->XmtConfig, XMT_CONFIG_RESET, TRUE);
 
-	// Reset receive configuration register
+	/* Reset receive configuration register */
 	WRITE_REG(HwRegs->RcvConfig, RCV_CONFIG_RESET, TRUE);
 
-	// Reset all MAC modules
+	/* Reset all MAC modules */
 	WRITE_REG(HwRegs->MacConfig0, AXGMAC_CFG0_SUB_RESET, TRUE);
 
-	// Link address 0
-	// XXXTODO - This assumes the MAC address (0a:0b:0c:0d:0e:0f)
-	// is stored with the first nibble (0a) in the byte 0
-	// of the Mac address.  Possibly reverse?
+	/* Link address 0 */
+	/* XXXTODO - This assumes the MAC address (0a:0b:0c:0d:0e:0f) */
+	/* is stored with the first nibble (0a) in the byte 0 */
+	/* of the Mac address.  Possibly reverse? */
 	Value = *(u32 *) adapter->MacAddr;
 	WRITE_REG(HwRegs->LinkAddress0Low, Value, TRUE);
-	// also write the MAC address to the MAC.  Endian is reversed.
+	/* also write the MAC address to the MAC.  Endian is reversed. */
 	WRITE_REG(HwRegs->MacAddressLow, ntohl(Value), TRUE);
 	Value = (*(u16 *) & adapter->MacAddr[4] & 0x0000FFFF);
 	WRITE_REG(HwRegs->LinkAddress0High, Value | LINK_ADDRESS_ENABLE, TRUE);
-	// endian swap for the MAC (put high bytes in bits [31:16], swapped)
+	/* endian swap for the MAC (put high bytes in bits [31:16], swapped) */
 	Value = ntohl(Value);
 	WRITE_REG(HwRegs->MacAddressHigh, Value, TRUE);
-	// Link address 1
+	/* Link address 1 */
 	WRITE_REG(HwRegs->LinkAddress1Low, 0, TRUE);
 	WRITE_REG(HwRegs->LinkAddress1High, 0, TRUE);
-	// Link address 2
+	/* Link address 2 */
 	WRITE_REG(HwRegs->LinkAddress2Low, 0, TRUE);
 	WRITE_REG(HwRegs->LinkAddress2High, 0, TRUE);
-	// Link address 3
+	/* Link address 3 */
 	WRITE_REG(HwRegs->LinkAddress3Low, 0, TRUE);
 	WRITE_REG(HwRegs->LinkAddress3High, 0, TRUE);
 
-	// Enable MAC modules
+	/* Enable MAC modules */
 	WRITE_REG(HwRegs->MacConfig0, 0, TRUE);
 
-	// Configure MAC
-	WRITE_REG(HwRegs->MacConfig1, (AXGMAC_CFG1_XMT_PAUSE |	// Allow sending of pause
-				       AXGMAC_CFG1_XMT_EN |	// Enable XMT
-				       AXGMAC_CFG1_RCV_PAUSE |	// Enable detection of pause
-				       AXGMAC_CFG1_RCV_EN |	// Enable receive
-				       AXGMAC_CFG1_SHORT_ASSERT |	// short frame detection
-				       AXGMAC_CFG1_CHECK_LEN |	// Verify frame length
-				       AXGMAC_CFG1_GEN_FCS |	// Generate FCS
-				       AXGMAC_CFG1_PAD_64),	// Pad frames to 64 bytes
+	/* Configure MAC */
+	WRITE_REG(HwRegs->MacConfig1, (AXGMAC_CFG1_XMT_PAUSE |	/* Allow sending of pause */
+				       AXGMAC_CFG1_XMT_EN |	/* Enable XMT */
+				       AXGMAC_CFG1_RCV_PAUSE |	/* Enable detection of pause */
+				       AXGMAC_CFG1_RCV_EN |	/* Enable receive */
+				       AXGMAC_CFG1_SHORT_ASSERT |	/* short frame detection */
+				       AXGMAC_CFG1_CHECK_LEN |	/* Verify frame length */
+				       AXGMAC_CFG1_GEN_FCS |	/* Generate FCS */
+				       AXGMAC_CFG1_PAD_64),	/* Pad frames to 64 bytes */
 		  TRUE);
 
-	// Set AXGMAC max frame length if jumbo.  Not needed for standard MTU
+	/* Set AXGMAC max frame length if jumbo.  Not needed for standard MTU */
 	if (adapter->JumboEnabled) {
 		WRITE_REG(HwRegs->MacMaxFrameLen, AXGMAC_MAXFRAME_JUMBO, TRUE);
 	}
-	// AMIIM Configuration Register -
-	// The value placed in the AXGMAC_AMIIM_CFG_HALF_CLOCK portion
-	// (bottom bits) of this register is used to determine the
-	// MDC frequency as specified in the A-XGMAC Design Document.
-	// This value must not be zero.  The following value (62 or 0x3E)
-	// is based on our MAC transmit clock frequency (MTCLK) of 312.5 MHz.
-	// Given a maximum MDIO clock frequency of 2.5 MHz (see the PHY spec),
-	// we get:  312.5/(2*(X+1)) < 2.5  ==> X = 62.
-	// This value happens to be the default value for this register,
-	// so we really don't have to do this.
+	/* AMIIM Configuration Register - */
+	/* The value placed in the AXGMAC_AMIIM_CFG_HALF_CLOCK portion */
+	/* (bottom bits) of this register is used to determine the */
+	/* MDC frequency as specified in the A-XGMAC Design Document. */
+	/* This value must not be zero.  The following value (62 or 0x3E) */
+	/* is based on our MAC transmit clock frequency (MTCLK) of 312.5 MHz. */
+	/* Given a maximum MDIO clock frequency of 2.5 MHz (see the PHY spec), */
+	/* we get:  312.5/(2*(X+1)) < 2.5  ==> X = 62. */
+	/* This value happens to be the default value for this register, */
+	/* so we really don't have to do this. */
 	WRITE_REG(HwRegs->MacAmiimConfig, 0x0000003E, TRUE);
 
-	// Power up and enable PHY and XAUI/XGXS/Serdes logic
+	/* Power up and enable PHY and XAUI/XGXS/Serdes logic */
 	WRITE_REG(HwRegs->LinkStatus,
 		  (LS_PHY_CLR_RESET |
 		   LS_XGXS_ENABLE |
 		   LS_XGXS_CTL | LS_PHY_CLK_EN | LS_ATTN_ALARM), TRUE);
 	DBG_ERROR("After Power Up and enable PHY in sxg_initialize_link\n");
 
-	// Per information given by Aeluros, wait 100 ms after removing reset.
-	// It's not enough to wait for the self-clearing reset bit in reg 0 to clear.
+	/* Per information given by Aeluros, wait 100 ms after removing reset. */
+	/* It's not enough to wait for the self-clearing reset bit in reg 0 to clear. */
 	mdelay(100);
 
-	// Verify the PHY has come up by checking that the Reset bit has cleared.
-	status = sxg_read_mdio_reg(adapter, MIIM_DEV_PHY_PMA,	// PHY PMA/PMD module
-				   PHY_PMA_CONTROL1,	// PMA/PMD control register
+	/* Verify the PHY has come up by checking that the Reset bit has cleared. */
+	status = sxg_read_mdio_reg(adapter, MIIM_DEV_PHY_PMA,	/* PHY PMA/PMD module */
+				   PHY_PMA_CONTROL1,	/* PMA/PMD control register */
 				   &Value);
 	if (status != STATUS_SUCCESS)
 		return (STATUS_FAILURE);
-	if (Value & PMA_CONTROL1_RESET)	// reset complete if bit is 0
+	if (Value & PMA_CONTROL1_RESET)	/* reset complete if bit is 0 */
 		return (STATUS_FAILURE);
 
-	// The SERDES should be initialized by now - confirm
+	/* The SERDES should be initialized by now - confirm */
 	READ_REG(HwRegs->LinkStatus, Value);
-	if (Value & LS_SERDES_DOWN)	// verify SERDES is initialized
+	if (Value & LS_SERDES_DOWN)	/* verify SERDES is initialized */
 		return (STATUS_FAILURE);
 
-	// The XAUI link should also be up - confirm
-	if (!(Value & LS_XAUI_LINK_UP))	// verify XAUI link is up
+	/* The XAUI link should also be up - confirm */
+	if (!(Value & LS_XAUI_LINK_UP))	/* verify XAUI link is up */
 		return (STATUS_FAILURE);
 
-	// Initialize the PHY
+	/* Initialize the PHY */
 	status = sxg_phy_init(adapter);
 	if (status != STATUS_SUCCESS)
 		return (STATUS_FAILURE);
 
-	// Enable the Link Alarm
-	status = sxg_write_mdio_reg(adapter, MIIM_DEV_PHY_PMA,	// PHY PMA/PMD module
-				    LASI_CONTROL,	// LASI control register
-				    LASI_CTL_LS_ALARM_ENABLE);	// enable link alarm bit
+	/* Enable the Link Alarm */
+	status = sxg_write_mdio_reg(adapter, MIIM_DEV_PHY_PMA,	/* PHY PMA/PMD module */
+				    LASI_CONTROL,	/* LASI control register */
+				    LASI_CTL_LS_ALARM_ENABLE);	/* enable link alarm bit */
 	if (status != STATUS_SUCCESS)
 		return (STATUS_FAILURE);
 
-	// XXXTODO - temporary - verify bit is set
-	status = sxg_read_mdio_reg(adapter, MIIM_DEV_PHY_PMA,	// PHY PMA/PMD module
-				   LASI_CONTROL,	// LASI control register
+	/* XXXTODO - temporary - verify bit is set */
+	status = sxg_read_mdio_reg(adapter, MIIM_DEV_PHY_PMA,	/* PHY PMA/PMD module */
+				   LASI_CONTROL,	/* LASI control register */
 				   &Value);
 	if (status != STATUS_SUCCESS)
 		return (STATUS_FAILURE);
 	if (!(Value & LASI_CTL_LS_ALARM_ENABLE)) {
 		DBG_ERROR("Error!  LASI Control Alarm Enable bit not set!\n");
 	}
-	// Enable receive
+	/* Enable receive */
 	MaxFrame = adapter->JumboEnabled ? JUMBOMAXFRAME : ETHERMAXFRAME;
 	ConfigData = (RCV_CONFIG_ENABLE |
 		      RCV_CONFIG_ENPARSE |
@@ -2256,7 +2256,7 @@ static int sxg_initialize_link(p_adapter_t adapter)
 
 	WRITE_REG(HwRegs->XmtConfig, XMT_CONFIG_ENABLE, TRUE);
 
-	// Mark the link as down.  We'll get a link event when it comes up.
+	/* Mark the link as down.  We'll get a link event when it comes up. */
 	sxg_link_state(adapter, SXG_LINK_DOWN);
 
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "XInitLnk",
@@ -2281,27 +2281,27 @@ static int sxg_phy_init(p_adapter_t adapter)
 
 	DBG_ERROR("ENTER %s\n", __func__);
 
-	// Read a register to identify the PHY type
-	status = sxg_read_mdio_reg(adapter, MIIM_DEV_PHY_PMA,	// PHY PMA/PMD module
-				   0xC205,	// PHY ID register (?)
-				   &Value);	//    XXXTODO - add def
+	/* Read a register to identify the PHY type */
+	status = sxg_read_mdio_reg(adapter, MIIM_DEV_PHY_PMA,	/* PHY PMA/PMD module */
+				   0xC205,	/* PHY ID register (?) */
+				   &Value);	/*    XXXTODO - add def */
 	if (status != STATUS_SUCCESS)
 		return (STATUS_FAILURE);
 
-	if (Value == 0x0012) {	// 0x0012 == AEL2005C PHY(?) - XXXTODO - add def
+	if (Value == 0x0012) {	/* 0x0012 == AEL2005C PHY(?) - XXXTODO - add def */
 		DBG_ERROR
 		    ("AEL2005C PHY detected.  Downloading PHY microcode.\n");
 
-		// Initialize AEL2005C PHY and download PHY microcode
+		/* Initialize AEL2005C PHY and download PHY microcode */
 		for (p = PhyUcode; p->Addr != 0xFFFF; p++) {
 			if (p->Addr == 0) {
-				// if address == 0, data == sleep time in ms
+				/* if address == 0, data == sleep time in ms */
 				mdelay(p->Data);
 			} else {
-				// write the given data to the specified address
-				status = sxg_write_mdio_reg(adapter, MIIM_DEV_PHY_PMA,	// PHY PMA/PMD module
-							    p->Addr,	// PHY address
-							    p->Data);	// PHY data
+				/* write the given data to the specified address */
+				status = sxg_write_mdio_reg(adapter, MIIM_DEV_PHY_PMA,	/* PHY PMA/PMD module */
+							    p->Addr,	/* PHY address */
+							    p->Data);	/* PHY data */
 				if (status != STATUS_SUCCESS)
 					return (STATUS_FAILURE);
 			}
@@ -2332,38 +2332,38 @@ static void sxg_link_event(p_adapter_t adapter)
 		  adapter, 0, 0, 0);
 	DBG_ERROR("ENTER %s\n", __func__);
 
-	// Check the Link Status register.  We should have a Link Alarm.
+	/* Check the Link Status register.  We should have a Link Alarm. */
 	READ_REG(HwRegs->LinkStatus, Value);
 	if (Value & LS_LINK_ALARM) {
-		// We got a Link Status alarm.  First, pause to let the
-		// link state settle (it can bounce a number of times)
+		/* We got a Link Status alarm.  First, pause to let the */
+		/* link state settle (it can bounce a number of times) */
 		mdelay(10);
 
-		// Now clear the alarm by reading the LASI status register.
-		status = sxg_read_mdio_reg(adapter, MIIM_DEV_PHY_PMA,	// PHY PMA/PMD module
-					   LASI_STATUS,	// LASI status register
+		/* Now clear the alarm by reading the LASI status register. */
+		status = sxg_read_mdio_reg(adapter, MIIM_DEV_PHY_PMA,	/* PHY PMA/PMD module */
+					   LASI_STATUS,	/* LASI status register */
 					   &Value);
 		if (status != STATUS_SUCCESS) {
 			DBG_ERROR("Error reading LASI Status MDIO register!\n");
 			sxg_link_state(adapter, SXG_LINK_DOWN);
-//                      ASSERT(0);
+/*                      ASSERT(0); */
 		}
 		ASSERT(Value & LASI_STATUS_LS_ALARM);
 
-		// Now get and set the link state
+		/* Now get and set the link state */
 		LinkState = sxg_get_link_state(adapter);
 		sxg_link_state(adapter, LinkState);
 		DBG_ERROR("SXG: Link Alarm occurred.  Link is %s\n",
 			  ((LinkState == SXG_LINK_UP) ? "UP" : "DOWN"));
 	} else {
-		// XXXTODO - Assuming Link Attention is only being generated for the
-		// Link Alarm pin (and not for a XAUI Link Status change), then it's
-		// impossible to get here.  Yet we've gotten here twice (under extreme
-		// conditions - bouncing the link up and down many times a second).
-		// Needs further investigation.
+		/* XXXTODO - Assuming Link Attention is only being generated for the */
+		/* Link Alarm pin (and not for a XAUI Link Status change), then it's */
+		/* impossible to get here.  Yet we've gotten here twice (under extreme */
+		/* conditions - bouncing the link up and down many times a second). */
+		/* Needs further investigation. */
 		DBG_ERROR("SXG: sxg_link_event: Can't get here!\n");
 		DBG_ERROR("SXG: Link Status == 0x%08X.\n", Value);
-//              ASSERT(0);
+/*              ASSERT(0); */
 	}
 	DBG_ERROR("EXIT %s\n", __func__);
 
@@ -2388,45 +2388,45 @@ static SXG_LINK_STATE sxg_get_link_state(p_adapter_t adapter)
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "GetLink",
 		  adapter, 0, 0, 0);
 
-	// Per the Xenpak spec (and the IEEE 10Gb spec?), the link is up if
-	// the following 3 bits (from 3 different MDIO registers) are all true.
-	status = sxg_read_mdio_reg(adapter, MIIM_DEV_PHY_PMA,	// PHY PMA/PMD module
-				   PHY_PMA_RCV_DET,	// PMA/PMD Receive Signal Detect register
+	/* Per the Xenpak spec (and the IEEE 10Gb spec?), the link is up if */
+	/* the following 3 bits (from 3 different MDIO registers) are all true. */
+	status = sxg_read_mdio_reg(adapter, MIIM_DEV_PHY_PMA,	/* PHY PMA/PMD module */
+				   PHY_PMA_RCV_DET,	/* PMA/PMD Receive Signal Detect register */
 				   &Value);
 	if (status != STATUS_SUCCESS)
 		goto bad;
 
-	// If PMA/PMD receive signal detect is 0, then the link is down
+	/* If PMA/PMD receive signal detect is 0, then the link is down */
 	if (!(Value & PMA_RCV_DETECT))
 		return (SXG_LINK_DOWN);
 
-	status = sxg_read_mdio_reg(adapter, MIIM_DEV_PHY_PCS,	// PHY PCS module
-				   PHY_PCS_10G_STATUS1,	// PCS 10GBASE-R Status 1 register
+	status = sxg_read_mdio_reg(adapter, MIIM_DEV_PHY_PCS,	/* PHY PCS module */
+				   PHY_PCS_10G_STATUS1,	/* PCS 10GBASE-R Status 1 register */
 				   &Value);
 	if (status != STATUS_SUCCESS)
 		goto bad;
 
-	// If PCS is not locked to receive blocks, then the link is down
+	/* If PCS is not locked to receive blocks, then the link is down */
 	if (!(Value & PCS_10B_BLOCK_LOCK))
 		return (SXG_LINK_DOWN);
 
-	status = sxg_read_mdio_reg(adapter, MIIM_DEV_PHY_XS,	// PHY XS module
-				   PHY_XS_LANE_STATUS,	// XS Lane Status register
+	status = sxg_read_mdio_reg(adapter, MIIM_DEV_PHY_XS,	/* PHY XS module */
+				   PHY_XS_LANE_STATUS,	/* XS Lane Status register */
 				   &Value);
 	if (status != STATUS_SUCCESS)
 		goto bad;
 
-	// If XS transmit lanes are not aligned, then the link is down
+	/* If XS transmit lanes are not aligned, then the link is down */
 	if (!(Value & XS_LANE_ALIGN))
 		return (SXG_LINK_DOWN);
 
-	// All 3 bits are true, so the link is up
+	/* All 3 bits are true, so the link is up */
 	DBG_ERROR("EXIT %s\n", __func__);
 
 	return (SXG_LINK_UP);
 
       bad:
-	// An error occurred reading an MDIO register.  This shouldn't happen.
+	/* An error occurred reading an MDIO register.  This shouldn't happen. */
 	DBG_ERROR("Error reading an MDIO register!\n");
 	ASSERT(0);
 	return (SXG_LINK_DOWN);
@@ -2466,19 +2466,19 @@ static void sxg_link_state(p_adapter_t adapter, SXG_LINK_STATE LinkState)
 
 	DBG_ERROR("ENTER %s\n", __func__);
 
-	// Hold the adapter lock during this routine.  Maybe move
-	// the lock to the caller.
+	/* Hold the adapter lock during this routine.  Maybe move */
+	/* the lock to the caller. */
 	spin_lock(&adapter->AdapterLock);
 	if (LinkState == adapter->LinkState) {
-		// Nothing changed..
+		/* Nothing changed.. */
 		spin_unlock(&adapter->AdapterLock);
 		DBG_ERROR("EXIT #0 %s\n", __func__);
 		return;
 	}
-	// Save the adapter state
+	/* Save the adapter state */
 	adapter->LinkState = LinkState;
 
-	// Drop the lock and indicate link state
+	/* Drop the lock and indicate link state */
 	spin_unlock(&adapter->AdapterLock);
 	DBG_ERROR("EXIT #1 %s\n", __func__);
 
@@ -2501,76 +2501,76 @@ static int sxg_write_mdio_reg(p_adapter_t adapter,
 			      u32 DevAddr, u32 RegAddr, u32 Value)
 {
 	PSXG_HW_REGS HwRegs = adapter->HwRegs;
-	u32 AddrOp;		// Address operation (written to MIIM field reg)
-	u32 WriteOp;		// Write operation (written to MIIM field reg)
-	u32 Cmd;		// Command (written to MIIM command reg)
+	u32 AddrOp;		/* Address operation (written to MIIM field reg) */
+	u32 WriteOp;		/* Write operation (written to MIIM field reg) */
+	u32 Cmd;		/* Command (written to MIIM command reg) */
 	u32 ValueRead;
 	u32 Timeout;
 
-//  DBG_ERROR("ENTER %s\n", __func__);
+/*  DBG_ERROR("ENTER %s\n", __func__); */
 
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "WrtMDIO",
 		  adapter, 0, 0, 0);
 
-	// Ensure values don't exceed field width
-	DevAddr &= 0x001F;	// 5-bit field
-	RegAddr &= 0xFFFF;	// 16-bit field
-	Value &= 0xFFFF;	// 16-bit field
+	/* Ensure values don't exceed field width */
+	DevAddr &= 0x001F;	/* 5-bit field */
+	RegAddr &= 0xFFFF;	/* 16-bit field */
+	Value &= 0xFFFF;	/* 16-bit field */
 
-	// Set MIIM field register bits for an MIIM address operation
+	/* Set MIIM field register bits for an MIIM address operation */
 	AddrOp = (MIIM_PORT_NUM << AXGMAC_AMIIM_FIELD_PORT_SHIFT) |
 	    (DevAddr << AXGMAC_AMIIM_FIELD_DEV_SHIFT) |
 	    (MIIM_TA_10GB << AXGMAC_AMIIM_FIELD_TA_SHIFT) |
 	    (MIIM_OP_ADDR << AXGMAC_AMIIM_FIELD_OP_SHIFT) | RegAddr;
 
-	// Set MIIM field register bits for an MIIM write operation
+	/* Set MIIM field register bits for an MIIM write operation */
 	WriteOp = (MIIM_PORT_NUM << AXGMAC_AMIIM_FIELD_PORT_SHIFT) |
 	    (DevAddr << AXGMAC_AMIIM_FIELD_DEV_SHIFT) |
 	    (MIIM_TA_10GB << AXGMAC_AMIIM_FIELD_TA_SHIFT) |
 	    (MIIM_OP_WRITE << AXGMAC_AMIIM_FIELD_OP_SHIFT) | Value;
 
-	// Set MIIM command register bits to execute an MIIM command
+	/* Set MIIM command register bits to execute an MIIM command */
 	Cmd = AXGMAC_AMIIM_CMD_START | AXGMAC_AMIIM_CMD_10G_OPERATION;
 
-	// Reset the command register command bit (in case it's not 0)
+	/* Reset the command register command bit (in case it's not 0) */
 	WRITE_REG(HwRegs->MacAmiimCmd, 0, TRUE);
 
-	// MIIM write to set the address of the specified MDIO register
+	/* MIIM write to set the address of the specified MDIO register */
 	WRITE_REG(HwRegs->MacAmiimField, AddrOp, TRUE);
 
-	// Write to MIIM Command Register to execute to address operation
+	/* Write to MIIM Command Register to execute to address operation */
 	WRITE_REG(HwRegs->MacAmiimCmd, Cmd, TRUE);
 
-	// Poll AMIIM Indicator register to wait for completion
+	/* Poll AMIIM Indicator register to wait for completion */
 	Timeout = SXG_LINK_TIMEOUT;
 	do {
-		udelay(100);	// Timeout in 100us units
+		udelay(100);	/* Timeout in 100us units */
 		READ_REG(HwRegs->MacAmiimIndicator, ValueRead);
 		if (--Timeout == 0) {
 			return (STATUS_FAILURE);
 		}
 	} while (ValueRead & AXGMAC_AMIIM_INDC_BUSY);
 
-	// Reset the command register command bit
+	/* Reset the command register command bit */
 	WRITE_REG(HwRegs->MacAmiimCmd, 0, TRUE);
 
-	// MIIM write to set up an MDIO write operation
+	/* MIIM write to set up an MDIO write operation */
 	WRITE_REG(HwRegs->MacAmiimField, WriteOp, TRUE);
 
-	// Write to MIIM Command Register to execute the write operation
+	/* Write to MIIM Command Register to execute the write operation */
 	WRITE_REG(HwRegs->MacAmiimCmd, Cmd, TRUE);
 
-	// Poll AMIIM Indicator register to wait for completion
+	/* Poll AMIIM Indicator register to wait for completion */
 	Timeout = SXG_LINK_TIMEOUT;
 	do {
-		udelay(100);	// Timeout in 100us units
+		udelay(100);	/* Timeout in 100us units */
 		READ_REG(HwRegs->MacAmiimIndicator, ValueRead);
 		if (--Timeout == 0) {
 			return (STATUS_FAILURE);
 		}
 	} while (ValueRead & AXGMAC_AMIIM_INDC_BUSY);
 
-//  DBG_ERROR("EXIT %s\n", __func__);
+/*  DBG_ERROR("EXIT %s\n", __func__); */
 
 	return (STATUS_SUCCESS);
 }
@@ -2591,78 +2591,78 @@ static int sxg_read_mdio_reg(p_adapter_t adapter,
 			     u32 DevAddr, u32 RegAddr, u32 *pValue)
 {
 	PSXG_HW_REGS HwRegs = adapter->HwRegs;
-	u32 AddrOp;		// Address operation (written to MIIM field reg)
-	u32 ReadOp;		// Read operation (written to MIIM field reg)
-	u32 Cmd;		// Command (written to MIIM command reg)
+	u32 AddrOp;		/* Address operation (written to MIIM field reg) */
+	u32 ReadOp;		/* Read operation (written to MIIM field reg) */
+	u32 Cmd;		/* Command (written to MIIM command reg) */
 	u32 ValueRead;
 	u32 Timeout;
 
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "WrtMDIO",
 		  adapter, 0, 0, 0);
-//  DBG_ERROR("ENTER %s\n", __func__);
+/*  DBG_ERROR("ENTER %s\n", __func__); */
 
-	// Ensure values don't exceed field width
-	DevAddr &= 0x001F;	// 5-bit field
-	RegAddr &= 0xFFFF;	// 16-bit field
+	/* Ensure values don't exceed field width */
+	DevAddr &= 0x001F;	/* 5-bit field */
+	RegAddr &= 0xFFFF;	/* 16-bit field */
 
-	// Set MIIM field register bits for an MIIM address operation
+	/* Set MIIM field register bits for an MIIM address operation */
 	AddrOp = (MIIM_PORT_NUM << AXGMAC_AMIIM_FIELD_PORT_SHIFT) |
 	    (DevAddr << AXGMAC_AMIIM_FIELD_DEV_SHIFT) |
 	    (MIIM_TA_10GB << AXGMAC_AMIIM_FIELD_TA_SHIFT) |
 	    (MIIM_OP_ADDR << AXGMAC_AMIIM_FIELD_OP_SHIFT) | RegAddr;
 
-	// Set MIIM field register bits for an MIIM read operation
+	/* Set MIIM field register bits for an MIIM read operation */
 	ReadOp = (MIIM_PORT_NUM << AXGMAC_AMIIM_FIELD_PORT_SHIFT) |
 	    (DevAddr << AXGMAC_AMIIM_FIELD_DEV_SHIFT) |
 	    (MIIM_TA_10GB << AXGMAC_AMIIM_FIELD_TA_SHIFT) |
 	    (MIIM_OP_READ << AXGMAC_AMIIM_FIELD_OP_SHIFT);
 
-	// Set MIIM command register bits to execute an MIIM command
+	/* Set MIIM command register bits to execute an MIIM command */
 	Cmd = AXGMAC_AMIIM_CMD_START | AXGMAC_AMIIM_CMD_10G_OPERATION;
 
-	// Reset the command register command bit (in case it's not 0)
+	/* Reset the command register command bit (in case it's not 0) */
 	WRITE_REG(HwRegs->MacAmiimCmd, 0, TRUE);
 
-	// MIIM write to set the address of the specified MDIO register
+	/* MIIM write to set the address of the specified MDIO register */
 	WRITE_REG(HwRegs->MacAmiimField, AddrOp, TRUE);
 
-	// Write to MIIM Command Register to execute to address operation
+	/* Write to MIIM Command Register to execute to address operation */
 	WRITE_REG(HwRegs->MacAmiimCmd, Cmd, TRUE);
 
-	// Poll AMIIM Indicator register to wait for completion
+	/* Poll AMIIM Indicator register to wait for completion */
 	Timeout = SXG_LINK_TIMEOUT;
 	do {
-		udelay(100);	// Timeout in 100us units
+		udelay(100);	/* Timeout in 100us units */
 		READ_REG(HwRegs->MacAmiimIndicator, ValueRead);
 		if (--Timeout == 0) {
 			return (STATUS_FAILURE);
 		}
 	} while (ValueRead & AXGMAC_AMIIM_INDC_BUSY);
 
-	// Reset the command register command bit
+	/* Reset the command register command bit */
 	WRITE_REG(HwRegs->MacAmiimCmd, 0, TRUE);
 
-	// MIIM write to set up an MDIO register read operation
+	/* MIIM write to set up an MDIO register read operation */
 	WRITE_REG(HwRegs->MacAmiimField, ReadOp, TRUE);
 
-	// Write to MIIM Command Register to execute the read operation
+	/* Write to MIIM Command Register to execute the read operation */
 	WRITE_REG(HwRegs->MacAmiimCmd, Cmd, TRUE);
 
-	// Poll AMIIM Indicator register to wait for completion
+	/* Poll AMIIM Indicator register to wait for completion */
 	Timeout = SXG_LINK_TIMEOUT;
 	do {
-		udelay(100);	// Timeout in 100us units
+		udelay(100);	/* Timeout in 100us units */
 		READ_REG(HwRegs->MacAmiimIndicator, ValueRead);
 		if (--Timeout == 0) {
 			return (STATUS_FAILURE);
 		}
 	} while (ValueRead & AXGMAC_AMIIM_INDC_BUSY);
 
-	// Read the MDIO register data back from the field register
+	/* Read the MDIO register data back from the field register */
 	READ_REG(HwRegs->MacAmiimField, *pValue);
-	*pValue &= 0xFFFF;	// data is in the lower 16 bits
+	*pValue &= 0xFFFF;	/* data is in the lower 16 bits */
 
-//  DBG_ERROR("EXIT %s\n", __func__);
+/*  DBG_ERROR("EXIT %s\n", __func__); */
 
 	return (STATUS_SUCCESS);
 }
@@ -2852,10 +2852,10 @@ static void sxg_mcast_set_mask(p_adapter_t adapter)
 		 * mode as well as ALLMCAST mode.  It saves the Microcode from having
 		 * to keep state about the MAC configuration.
 		 */
-//              DBG_ERROR("sxg: %s macopts = MAC_ALLMCAST | MAC_PROMISC\n      SLUT MODE!!!\n",__func__);
+/*              DBG_ERROR("sxg: %s macopts = MAC_ALLMCAST | MAC_PROMISC\n      SLUT MODE!!!\n",__func__); */
 		WRITE_REG(sxg_regs->McastLow, 0xFFFFFFFF, FLUSH);
 		WRITE_REG(sxg_regs->McastHigh, 0xFFFFFFFF, FLUSH);
-//        DBG_ERROR("%s (%s) WRITE to slic_regs slic_mcastlow&high 0xFFFFFFFF\n",__func__, adapter->netdev->name);
+/*        DBG_ERROR("%s (%s) WRITE to slic_regs slic_mcastlow&high 0xFFFFFFFF\n",__func__, adapter->netdev->name); */
 
 	} else {
 		/* Commit our multicast mast to the SLIC by writing to the multicast
@@ -2878,10 +2878,10 @@ static void sxg_mcast_set_mask(p_adapter_t adapter)
 static void sxg_unmap_mmio_space(p_adapter_t adapter)
 {
 #if LINUX_FREES_ADAPTER_RESOURCES
-//      if (adapter->Regs) {
-//              iounmap(adapter->Regs);
-//      }
-//      adapter->slic_regs = NULL;
+/*      if (adapter->Regs) { */
+/*              iounmap(adapter->Regs); */
+/*      } */
+/*      adapter->slic_regs = NULL; */
 #endif
 }
 
@@ -2909,8 +2909,8 @@ void SxgFreeResources(p_adapter_t adapter)
 	IsrCount = adapter->MsiEnabled ? RssIds : 1;
 
 	if (adapter->BasicAllocations == FALSE) {
-		// No allocations have been made, including spinlocks,
-		// or listhead initializations.  Return.
+		/* No allocations have been made, including spinlocks, */
+		/* or listhead initializations.  Return. */
 		return;
 	}
 
@@ -2920,7 +2920,7 @@ void SxgFreeResources(p_adapter_t adapter)
 	if (!(IsListEmpty(&adapter->AllSglBuffers))) {
 		SxgFreeSglBuffers(adapter);
 	}
-	// Free event queues.
+	/* Free event queues. */
 	if (adapter->EventRings) {
 		pci_free_consistent(adapter->pcidev,
 				    sizeof(SXG_EVENT_RING) * RssIds,
@@ -2947,17 +2947,17 @@ void SxgFreeResources(p_adapter_t adapter)
 	SXG_FREE_PACKET_POOL(adapter->PacketPoolHandle);
 	SXG_FREE_BUFFER_POOL(adapter->BufferPoolHandle);
 
-	// Unmap register spaces
+	/* Unmap register spaces */
 	SxgUnmapResources(adapter);
 
-	// Deregister DMA
+	/* Deregister DMA */
 	if (adapter->DmaHandle) {
 		SXG_DEREGISTER_DMA(adapter->DmaHandle);
 	}
-	// Deregister interrupt
+	/* Deregister interrupt */
 	SxgDeregisterInterrupt(adapter);
 
-	// Possibly free system info (5.2 only)
+	/* Possibly free system info (5.2 only) */
 	SXG_RELEASE_SYSTEM_INFO(adapter);
 
 	SxgDiagFreeResources(adapter);
@@ -3047,23 +3047,23 @@ static int sxg_allocate_buffer_memory(p_adapter_t adapter,
 
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "AllocMem",
 		  adapter, Size, BufferType, 0);
-	// Grab the adapter lock and check the state.
-	// If we're in anything other than INITIALIZING or
-	// RUNNING state, fail.  This is to prevent
-	// allocations in an improper driver state
+	/* Grab the adapter lock and check the state. */
+	/* If we're in anything other than INITIALIZING or */
+	/* RUNNING state, fail.  This is to prevent */
+	/* allocations in an improper driver state */
 	spin_lock(&adapter->AdapterLock);
 
-	// Increment the AllocationsPending count while holding
-	// the lock.  Pause processing relies on this
+	/* Increment the AllocationsPending count while holding */
+	/* the lock.  Pause processing relies on this */
 	++adapter->AllocationsPending;
 	spin_unlock(&adapter->AdapterLock);
 
-	// At initialization time allocate resources synchronously.
+	/* At initialization time allocate resources synchronously. */
 	Buffer = pci_alloc_consistent(adapter->pcidev, Size, &pBuffer);
 	if (Buffer == NULL) {
 		spin_lock(&adapter->AdapterLock);
-		// Decrement the AllocationsPending count while holding
-		// the lock.  Pause processing relies on this
+		/* Decrement the AllocationsPending count while holding */
+		/* the lock.  Pause processing relies on this */
 		--adapter->AllocationsPending;
 		spin_unlock(&adapter->AdapterLock);
 		SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "AlcMemF1",
@@ -3113,10 +3113,10 @@ static void sxg_allocate_rcvblock_complete(p_adapter_t adapter,
 	ASSERT((BufferSize == SXG_RCV_DATA_BUFFER_SIZE) ||
 	       (BufferSize == SXG_RCV_JUMBO_BUFFER_SIZE));
 	ASSERT(Length == SXG_RCV_BLOCK_SIZE(BufferSize));
-	// First, initialize the contained pool of receive data
-	// buffers.  This initialization requires NBL/NB/MDL allocations,
-	// If any of them fail, free the block and return without
-	// queueing the shared memory
+	/* First, initialize the contained pool of receive data */
+	/* buffers.  This initialization requires NBL/NB/MDL allocations, */
+	/* If any of them fail, free the block and return without */
+	/* queueing the shared memory */
 	RcvDataBuffer = RcvBlock;
 #if 0
 	for (i = 0, Paddr = *PhysicalAddress;
@@ -3126,14 +3126,14 @@ static void sxg_allocate_rcvblock_complete(p_adapter_t adapter,
 		for (i = 0, Paddr = PhysicalAddress;
 		     i < SXG_RCV_DESCRIPTORS_PER_BLOCK;
 		     i++, Paddr += BufferSize, RcvDataBuffer += BufferSize) {
-			//
+			/* */
 			RcvDataBufferHdr =
 			    (PSXG_RCV_DATA_BUFFER_HDR) (RcvDataBuffer +
 							SXG_RCV_DATA_BUFFER_HDR_OFFSET
 							(BufferSize));
 			RcvDataBufferHdr->VirtualAddress = RcvDataBuffer;
 			RcvDataBufferHdr->PhysicalAddress = Paddr;
-			RcvDataBufferHdr->State = SXG_BUFFER_UPSTREAM;	// For FREE macro assertion
+			RcvDataBufferHdr->State = SXG_BUFFER_UPSTREAM;	/* For FREE macro assertion */
 			RcvDataBufferHdr->Size =
 			    SXG_RCV_BUFFER_DATA_SIZE(BufferSize);
 
@@ -3143,8 +3143,8 @@ static void sxg_allocate_rcvblock_complete(p_adapter_t adapter,
 
 		}
 
-	// Place this entire block of memory on the AllRcvBlocks queue so it can be
-	// free later
+	/* Place this entire block of memory on the AllRcvBlocks queue so it can be */
+	/* free later */
 	RcvBlockHdr =
 	    (PSXG_RCV_BLOCK_HDR) ((unsigned char *)RcvBlock +
 				  SXG_RCV_BLOCK_HDR_OFFSET(BufferSize));
@@ -3155,7 +3155,7 @@ static void sxg_allocate_rcvblock_complete(p_adapter_t adapter,
 	InsertTailList(&adapter->AllRcvBlocks, &RcvBlockHdr->AllList);
 	spin_unlock(&adapter->RcvQLock);
 
-	// Now free the contained receive data buffers that we initialized above
+	/* Now free the contained receive data buffers that we initialized above */
 	RcvDataBuffer = RcvBlock;
 	for (i = 0, Paddr = PhysicalAddress;
 	     i < SXG_RCV_DESCRIPTORS_PER_BLOCK;
@@ -3168,7 +3168,7 @@ static void sxg_allocate_rcvblock_complete(p_adapter_t adapter,
 		spin_unlock(&adapter->RcvQLock);
 	}
 
-	// Locate the descriptor block and put it on a separate free queue
+	/* Locate the descriptor block and put it on a separate free queue */
 	RcvDescriptorBlock =
 	    (PSXG_RCV_DESCRIPTOR_BLOCK) ((unsigned char *)RcvBlock +
 					 SXG_RCV_DESCRIPTOR_BLOCK_OFFSET
@@ -3186,7 +3186,7 @@ static void sxg_allocate_rcvblock_complete(p_adapter_t adapter,
 		  adapter, RcvBlock, Length, 0);
 	return;
       fail:
-	// Free any allocated resources
+	/* Free any allocated resources */
 	if (RcvBlock) {
 		RcvDataBuffer = RcvBlock;
 		for (i = 0; i < SXG_RCV_DESCRIPTORS_PER_BLOCK;
@@ -3230,7 +3230,7 @@ static void sxg_allocate_sgl_buffer_complete(p_adapter_t adapter,
 	adapter->AllSglBufferCount++;
 	memset(SxgSgl, 0, sizeof(SXG_SCATTER_GATHER));
 	SxgSgl->PhysicalAddress = PhysicalAddress;	/* *PhysicalAddress; */
-	SxgSgl->adapter = adapter;	// Initialize backpointer once
+	SxgSgl->adapter = adapter;	/* Initialize backpointer once */
 	InsertTailList(&adapter->AllSglBuffers, &SxgSgl->AllList);
 	spin_unlock(&adapter->SglQLock);
 	SxgSgl->State = SXG_BUFFER_BUSY;
@@ -3244,14 +3244,14 @@ static unsigned char temp_mac_address[6] =
 
 static void sxg_adapter_set_hwaddr(p_adapter_t adapter)
 {
-//  DBG_ERROR ("%s ENTER card->config_set[%x] port[%d] physport[%d] funct#[%d]\n", __func__,
-//             card->config_set, adapter->port, adapter->physport, adapter->functionnumber);
-//
-//  sxg_dbg_macaddrs(adapter);
+/*  DBG_ERROR ("%s ENTER card->config_set[%x] port[%d] physport[%d] funct#[%d]\n", __func__, */
+/*             card->config_set, adapter->port, adapter->physport, adapter->functionnumber); */
+/* */
+/*  sxg_dbg_macaddrs(adapter); */
 
 	memcpy(adapter->macaddr, temp_mac_address, sizeof(SXG_CONFIG_MAC));
-//      DBG_ERROR ("%s AFTER copying from config.macinfo into currmacaddr\n", __func__);
-//      sxg_dbg_macaddrs(adapter);
+/*      DBG_ERROR ("%s AFTER copying from config.macinfo into currmacaddr\n", __func__); */
+/*      sxg_dbg_macaddrs(adapter); */
 	if (!(adapter->currmacaddr[0] ||
 	      adapter->currmacaddr[1] ||
 	      adapter->currmacaddr[2] ||
@@ -3262,7 +3262,7 @@ static void sxg_adapter_set_hwaddr(p_adapter_t adapter)
 	if (adapter->netdev) {
 		memcpy(adapter->netdev->dev_addr, adapter->currmacaddr, 6);
 	}
-//  DBG_ERROR ("%s EXIT port %d\n", __func__, adapter->port);
+/*  DBG_ERROR ("%s EXIT port %d\n", __func__, adapter->port); */
 	sxg_dbg_macaddrs(adapter);
 
 }
@@ -3321,68 +3321,68 @@ static int sxg_initialize_adapter(p_adapter_t adapter)
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "InitAdpt",
 		  adapter, 0, 0, 0);
 
-	RssIds = 1;		//  XXXTODO  SXG_RSS_CPU_COUNT(adapter);
+	RssIds = 1;		/*  XXXTODO  SXG_RSS_CPU_COUNT(adapter); */
 	IsrCount = adapter->MsiEnabled ? RssIds : 1;
 
-	// Sanity check SXG_UCODE_REGS structure definition to
-	// make sure the length is correct
+	/* Sanity check SXG_UCODE_REGS structure definition to */
+	/* make sure the length is correct */
 	ASSERT(sizeof(SXG_UCODE_REGS) == SXG_REGISTER_SIZE_PER_CPU);
 
-	// Disable interrupts
+	/* Disable interrupts */
 	SXG_DISABLE_ALL_INTERRUPTS(adapter);
 
-	// Set MTU
+	/* Set MTU */
 	ASSERT((adapter->FrameSize == ETHERMAXFRAME) ||
 	       (adapter->FrameSize == JUMBOMAXFRAME));
 	WRITE_REG(adapter->UcodeRegs[0].LinkMtu, adapter->FrameSize, TRUE);
 
-	// Set event ring base address and size
+	/* Set event ring base address and size */
 	WRITE_REG64(adapter,
 		    adapter->UcodeRegs[0].EventBase, adapter->PEventRings, 0);
 	WRITE_REG(adapter->UcodeRegs[0].EventSize, EVENT_RING_SIZE, TRUE);
 
-	// Per-ISR initialization
+	/* Per-ISR initialization */
 	for (i = 0; i < IsrCount; i++) {
 		u64 Addr;
-		// Set interrupt status pointer
+		/* Set interrupt status pointer */
 		Addr = adapter->PIsr + (i * sizeof(u32));
 		WRITE_REG64(adapter, adapter->UcodeRegs[i].Isp, Addr, i);
 	}
 
-	// XMT ring zero index
+	/* XMT ring zero index */
 	WRITE_REG64(adapter,
 		    adapter->UcodeRegs[0].SPSendIndex,
 		    adapter->PXmtRingZeroIndex, 0);
 
-	// Per-RSS initialization
+	/* Per-RSS initialization */
 	for (i = 0; i < RssIds; i++) {
-		// Release all event ring entries to the Microcode
+		/* Release all event ring entries to the Microcode */
 		WRITE_REG(adapter->UcodeRegs[i].EventRelease, EVENT_RING_SIZE,
 			  TRUE);
 	}
 
-	// Transmit ring base and size
+	/* Transmit ring base and size */
 	WRITE_REG64(adapter,
 		    adapter->UcodeRegs[0].XmtBase, adapter->PXmtRings, 0);
 	WRITE_REG(adapter->UcodeRegs[0].XmtSize, SXG_XMT_RING_SIZE, TRUE);
 
-	// Receive ring base and size
+	/* Receive ring base and size */
 	WRITE_REG64(adapter,
 		    adapter->UcodeRegs[0].RcvBase, adapter->PRcvRings, 0);
 	WRITE_REG(adapter->UcodeRegs[0].RcvSize, SXG_RCV_RING_SIZE, TRUE);
 
-	// Populate the card with receive buffers
+	/* Populate the card with receive buffers */
 	sxg_stock_rcv_buffers(adapter);
 
-	// Initialize checksum offload capabilities.  At the moment
-	// we always enable IP and TCP receive checksums on the card.
-	// Depending on the checksum configuration specified by the
-	// user, we can choose to report or ignore the checksum
-	// information provided by the card.
+	/* Initialize checksum offload capabilities.  At the moment */
+	/* we always enable IP and TCP receive checksums on the card. */
+	/* Depending on the checksum configuration specified by the */
+	/* user, we can choose to report or ignore the checksum */
+	/* information provided by the card. */
 	WRITE_REG(adapter->UcodeRegs[0].ReceiveChecksum,
 		  SXG_RCV_TCP_CSUM_ENABLED | SXG_RCV_IP_CSUM_ENABLED, TRUE);
 
-	// Initialize the MAC, XAUI
+	/* Initialize the MAC, XAUI */
 	DBG_ERROR("sxg: %s ENTER sxg_initialize_link\n", __func__);
 	status = sxg_initialize_link(adapter);
 	DBG_ERROR("sxg: %s EXIT sxg_initialize_link status[%x]\n", __func__,
@@ -3390,8 +3390,8 @@ static int sxg_initialize_adapter(p_adapter_t adapter)
 	if (status != STATUS_SUCCESS) {
 		return (status);
 	}
-	// Initialize Dead to FALSE.
-	// SlicCheckForHang or SlicDumpThread will take it from here.
+	/* Initialize Dead to FALSE. */
+	/* SlicCheckForHang or SlicDumpThread will take it from here. */
 	adapter->Dead = FALSE;
 	adapter->PingOutstanding = FALSE;
 
@@ -3428,14 +3428,14 @@ static int sxg_fill_descriptor_block(p_adapter_t adapter,
 
 	ASSERT(RcvDescriptorBlockHdr);
 
-	// If we don't have the resources to fill the descriptor block,
-	// return failure
+	/* If we don't have the resources to fill the descriptor block, */
+	/* return failure */
 	if ((adapter->FreeRcvBufferCount < SXG_RCV_DESCRIPTORS_PER_BLOCK) ||
 	    SXG_RING_FULL(RcvRingInfo)) {
 		adapter->Stats.NoMem++;
 		return (STATUS_FAILURE);
 	}
-	// Get a ring descriptor command
+	/* Get a ring descriptor command */
 	SXG_GET_CMD(RingZero,
 		    RcvRingInfo, RingDescriptorCmd, RcvDescriptorBlockHdr);
 	ASSERT(RingDescriptorCmd);
@@ -3443,7 +3443,7 @@ static int sxg_fill_descriptor_block(p_adapter_t adapter,
 	RcvDescriptorBlock =
 	    (PSXG_RCV_DESCRIPTOR_BLOCK) RcvDescriptorBlockHdr->VirtualAddress;
 
-	// Fill in the descriptor block
+	/* Fill in the descriptor block */
 	for (i = 0; i < SXG_RCV_DESCRIPTORS_PER_BLOCK; i++) {
 		SXG_GET_RCV_DATA_BUFFER(adapter, RcvDataBufferHdr);
 		ASSERT(RcvDataBufferHdr);
@@ -3454,13 +3454,13 @@ static int sxg_fill_descriptor_block(p_adapter_t adapter,
 		RcvDescriptorBlock->Descriptors[i].PhysicalAddress =
 		    RcvDataBufferHdr->PhysicalAddress;
 	}
-	// Add the descriptor block to receive descriptor ring 0
+	/* Add the descriptor block to receive descriptor ring 0 */
 	RingDescriptorCmd->Sgl = RcvDescriptorBlockHdr->PhysicalAddress;
 
-	// RcvBuffersOnCard is not protected via the receive lock (see
-	// sxg_process_event_queue) We don't want to grap a lock every time a
-	// buffer is returned to us, so we use atomic interlocked functions
-	// instead.
+	/* RcvBuffersOnCard is not protected via the receive lock (see */
+	/* sxg_process_event_queue) We don't want to grap a lock every time a */
+	/* buffer is returned to us, so we use atomic interlocked functions */
+	/* instead. */
 	adapter->RcvBuffersOnCard += SXG_RCV_DESCRIPTORS_PER_BLOCK;
 
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "DscBlk",
@@ -3490,10 +3490,10 @@ static void sxg_stock_rcv_buffers(p_adapter_t adapter)
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "StockBuf",
 		  adapter, adapter->RcvBuffersOnCard,
 		  adapter->FreeRcvBufferCount, adapter->AllRcvBlockCount);
-	// First, see if we've got less than our minimum threshold of
-	// receive buffers, there isn't an allocation in progress, and
-	// we haven't exceeded our maximum.. get another block of buffers
-	// None of this needs to be SMP safe.  It's round numbers.
+	/* First, see if we've got less than our minimum threshold of */
+	/* receive buffers, there isn't an allocation in progress, and */
+	/* we haven't exceeded our maximum.. get another block of buffers */
+	/* None of this needs to be SMP safe.  It's round numbers. */
 	if ((adapter->FreeRcvBufferCount < SXG_MIN_RCV_DATA_BUFFERS) &&
 	    (adapter->AllRcvBlockCount < SXG_MAX_RCV_BLOCKS) &&
 	    (adapter->AllocationsPending == 0)) {
@@ -3502,12 +3502,12 @@ static void sxg_stock_rcv_buffers(p_adapter_t adapter)
 							      ReceiveBufferSize),
 					   SXG_BUFFER_TYPE_RCV);
 	}
-	// Now grab the RcvQLock lock and proceed
+	/* Now grab the RcvQLock lock and proceed */
 	spin_lock(&adapter->RcvQLock);
 	while (adapter->RcvBuffersOnCard < SXG_RCV_DATA_BUFFERS) {
 		PLIST_ENTRY _ple;
 
-		// Get a descriptor block
+		/* Get a descriptor block */
 		RcvDescriptorBlockHdr = NULL;
 		if (adapter->FreeRcvBlockCount) {
 			_ple = RemoveHeadList(&adapter->FreeRcvBlocks);
@@ -3519,14 +3519,14 @@ static void sxg_stock_rcv_buffers(p_adapter_t adapter)
 		}
 
 		if (RcvDescriptorBlockHdr == NULL) {
-			// Bail out..
+			/* Bail out.. */
 			adapter->Stats.NoMem++;
 			break;
 		}
-		// Fill in the descriptor block and give it to the card
+		/* Fill in the descriptor block and give it to the card */
 		if (sxg_fill_descriptor_block(adapter, RcvDescriptorBlockHdr) ==
 		    STATUS_FAILURE) {
-			// Free the descriptor block
+			/* Free the descriptor block */
 			SXG_FREE_RCV_DESCRIPTOR_BLOCK(adapter,
 						      RcvDescriptorBlockHdr);
 			break;
@@ -3560,15 +3560,15 @@ static void sxg_complete_descriptor_blocks(p_adapter_t adapter,
 	SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "CmpRBlks",
 		  adapter, Index, RcvRingInfo->Head, RcvRingInfo->Tail);
 
-	// Now grab the RcvQLock lock and proceed
+	/* Now grab the RcvQLock lock and proceed */
 	spin_lock(&adapter->RcvQLock);
 	ASSERT(Index != RcvRingInfo->Tail);
 	while (RcvRingInfo->Tail != Index) {
-		//
-		// Locate the current Cmd (ring descriptor entry), and
-		// associated receive descriptor block, and advance
-		// the tail
-		//
+		/* */
+		/* Locate the current Cmd (ring descriptor entry), and */
+		/* associated receive descriptor block, and advance */
+		/* the tail */
+		/* */
 		SXG_RETURN_CMD(RingZero,
 			       RcvRingInfo,
 			       RingDescriptorCmd, RcvDescriptorBlockHdr);
@@ -3576,12 +3576,12 @@ static void sxg_complete_descriptor_blocks(p_adapter_t adapter,
 			  RcvRingInfo->Head, RcvRingInfo->Tail,
 			  RingDescriptorCmd, RcvDescriptorBlockHdr);
 
-		// Clear the SGL field
+		/* Clear the SGL field */
 		RingDescriptorCmd->Sgl = 0;
-		// Attempt to refill it and hand it right back to the
-		// card.  If we fail to refill it, free the descriptor block
-		// header.  The card will be restocked later via the
-		// RcvBuffersOnCard test
+		/* Attempt to refill it and hand it right back to the */
+		/* card.  If we fail to refill it, free the descriptor block */
+		/* header.  The card will be restocked later via the */
+		/* RcvBuffersOnCard test */
 		if (sxg_fill_descriptor_block(adapter, RcvDescriptorBlockHdr) ==
 		    STATUS_FAILURE) {
 			SXG_FREE_RCV_DESCRIPTOR_BLOCK(adapter,
drivers/staging/sxg/sxghw.h +60 -60

165 lines not on this page · raw message

Signature · 1 line
1.6.0.2
#41 lore raw

PATCH 35/42 Staging: sxg: fix up unused function warnings

In reply to Greg KH

These functions aren't used yet, so put them behind the proper #define so the compiler doesn't complain about them.

---
 drivers/staging/sxg/sxg.c |  155 +++++++++++++++++++++++----------------------
 1 files changed, 78 insertions(+), 77 deletions(-)
drivers/staging/sxg/sxg.c +78 -77
index 3b05acf..fe935e2 100644
@@ -112,12 +112,16 @@ static bool sxg_mac_filter(p_adapter_t adapter,
 static struct net_device_stats *sxg_get_stats(p_net_device dev);
 #endif
 
+#define XXXTODO 0
+
+#if XXXTODO
 static int sxg_mac_set_address(p_net_device dev, void *ptr);
+static void sxg_mcast_set_list(p_net_device dev);
+#endif
 
 static void sxg_adapter_set_hwaddr(p_adapter_t adapter);
 
 static void sxg_unmap_mmio_space(p_adapter_t adapter);
-static void sxg_mcast_set_mask(p_adapter_t adapter);
 
 static int sxg_initialize_adapter(p_adapter_t adapter);
 static void sxg_stock_rcv_buffers(p_adapter_t adapter);
@@ -132,9 +136,6 @@ static int sxg_write_mdio_reg(p_adapter_t adapter,
 			      u32 DevAddr, u32 RegAddr, u32 Value);
 static int sxg_read_mdio_reg(p_adapter_t adapter,
 			     u32 DevAddr, u32 RegAddr, u32 *pValue);
-static void sxg_mcast_set_list(p_net_device dev);
-
-#define XXXTODO 0
 
 static unsigned int sxg_first_init = 1;
 static char *sxg_banner =
@@ -2668,38 +2669,6 @@ static int sxg_read_mdio_reg(p_adapter_t adapter,
 }
 
 /*
- *  Allocate a mcast_address structure to hold the multicast address.
- *  Link it in.
- */
-static int sxg_mcast_add_list(p_adapter_t adapter, char *address)
-{
-	p_mcast_address_t mcaddr, mlist;
-	bool equaladdr;
-
-	/* Check to see if it already exists */
-	mlist = adapter->mcastaddrs;
-	while (mlist) {
-		ETHER_EQ_ADDR(mlist->address, address, equaladdr);
-		if (equaladdr) {
-			return (STATUS_SUCCESS);
-		}
-		mlist = mlist->next;
-	}
-
-	/* Doesn't already exist.  Allocate a structure to hold it */
-	mcaddr = kmalloc(sizeof(mcast_address_t), GFP_ATOMIC);
-	if (mcaddr == NULL)
-		return 1;
-
-	memcpy(mcaddr->address, address, 6);
-
-	mcaddr->next = adapter->mcastaddrs;
-	adapter->mcastaddrs = mcaddr;
-
-	return (STATUS_SUCCESS);
-}
-
-/*
  * Functions to obtain the CRC corresponding to the destination mac address.
  * This is a standard ethernet CRC in that it is a 32-bit, reflected CRC using
  * the polynomial:
@@ -2710,7 +2679,6 @@ static int sxg_mcast_add_list(p_adapter_t adapter, char *address)
  *
  */
 static u32 sxg_crc_table[256];	/* Table of CRC's for all possible byte values */
-static u32 sxg_crc_init;	/* Is table initialized                        */
 
 /*
  *  Contruct the CRC32 table
@@ -2737,6 +2705,8 @@ static void sxg_mcast_init_crc32(void)
 	}
 }
 
+#if XXXTODO
+static u32 sxg_crc_init;	/* Is table initialized */
 /*
  *  Return the MAC hast as described above.
  */
@@ -2765,6 +2735,74 @@ static unsigned char sxg_mcast_get_mac_hash(char *macaddr)
 	return (machash);
 }
 
+static void sxg_mcast_set_mask(p_adapter_t adapter)
+{
+	PSXG_UCODE_REGS sxg_regs = adapter->UcodeRegs;
+
+	DBG_ERROR("%s ENTER (%s) macopts[%x] mask[%llx]\n", __func__,
+		  adapter->netdev->name, (unsigned int)adapter->MacFilter,
+		  adapter->MulticastMask);
+
+	if (adapter->MacFilter & (MAC_ALLMCAST | MAC_PROMISC)) {
+		/* Turn on all multicast addresses. We have to do this for promiscuous
+		 * mode as well as ALLMCAST mode.  It saves the Microcode from having
+		 * to keep state about the MAC configuration.
+		 */
+/*              DBG_ERROR("sxg: %s macopts = MAC_ALLMCAST | MAC_PROMISC\n      SLUT MODE!!!\n",__func__); */
+		WRITE_REG(sxg_regs->McastLow, 0xFFFFFFFF, FLUSH);
+		WRITE_REG(sxg_regs->McastHigh, 0xFFFFFFFF, FLUSH);
+/*        DBG_ERROR("%s (%s) WRITE to slic_regs slic_mcastlow&high 0xFFFFFFFF\n",__func__, adapter->netdev->name); */
+
+	} else {
+		/* Commit our multicast mast to the SLIC by writing to the multicast
+		 * address mask registers
+		 */
+		DBG_ERROR("%s (%s) WRITE mcastlow[%lx] mcasthigh[%lx]\n",
+			  __func__, adapter->netdev->name,
+			  ((ulong) (adapter->MulticastMask & 0xFFFFFFFF)),
+			  ((ulong)
+			   ((adapter->MulticastMask >> 32) & 0xFFFFFFFF)));
+
+		WRITE_REG(sxg_regs->McastLow,
+			  (u32) (adapter->MulticastMask & 0xFFFFFFFF), FLUSH);
+		WRITE_REG(sxg_regs->McastHigh,
+			  (u32) ((adapter->
+				  MulticastMask >> 32) & 0xFFFFFFFF), FLUSH);
+	}
+}
+
+/*
+ *  Allocate a mcast_address structure to hold the multicast address.
+ *  Link it in.
+ */
+static int sxg_mcast_add_list(p_adapter_t adapter, char *address)
+{
+	p_mcast_address_t mcaddr, mlist;
+	bool equaladdr;
+
+	/* Check to see if it already exists */
+	mlist = adapter->mcastaddrs;
+	while (mlist) {
+		ETHER_EQ_ADDR(mlist->address, address, equaladdr);
+		if (equaladdr) {
+			return (STATUS_SUCCESS);
+		}
+		mlist = mlist->next;
+	}
+
+	/* Doesn't already exist.  Allocate a structure to hold it */
+	mcaddr = kmalloc(sizeof(mcast_address_t), GFP_ATOMIC);
+	if (mcaddr == NULL)
+		return 1;
+
+	memcpy(mcaddr->address, address, 6);
+
+	mcaddr->next = adapter->mcastaddrs;
+	adapter->mcastaddrs = mcaddr;
+
+	return (STATUS_SUCCESS);
+}
+
 static void sxg_mcast_set_bit(p_adapter_t adapter, char *address)
 {
 	unsigned char crcpoly;
@@ -2783,7 +2821,6 @@ static void sxg_mcast_set_bit(p_adapter_t adapter, char *address)
 
 static void sxg_mcast_set_list(p_net_device dev)
 {
-#if XXXTODO
 	p_adapter_t adapter = (p_adapter_t) netdev_priv(dev);
 	int status = STATUS_SUCCESS;
 	int i;
@@ -2835,45 +2872,9 @@ static void sxg_mcast_set_list(p_net_device dev)
 			sxg_mcast_set_mask(adapter);
 		}
 	}
-#endif
 	return;
 }
-
-static void sxg_mcast_set_mask(p_adapter_t adapter)
-{
-	PSXG_UCODE_REGS sxg_regs = adapter->UcodeRegs;
-
-	DBG_ERROR("%s ENTER (%s) macopts[%x] mask[%llx]\n", __func__,
-		  adapter->netdev->name, (unsigned int)adapter->MacFilter,
-		  adapter->MulticastMask);
-
-	if (adapter->MacFilter & (MAC_ALLMCAST | MAC_PROMISC)) {
-		/* Turn on all multicast addresses. We have to do this for promiscuous
-		 * mode as well as ALLMCAST mode.  It saves the Microcode from having
-		 * to keep state about the MAC configuration.
-		 */
-/*              DBG_ERROR("sxg: %s macopts = MAC_ALLMCAST | MAC_PROMISC\n      SLUT MODE!!!\n",__func__); */
-		WRITE_REG(sxg_regs->McastLow, 0xFFFFFFFF, FLUSH);
-		WRITE_REG(sxg_regs->McastHigh, 0xFFFFFFFF, FLUSH);
-/*        DBG_ERROR("%s (%s) WRITE to slic_regs slic_mcastlow&high 0xFFFFFFFF\n",__func__, adapter->netdev->name); */
-
-	} else {
-		/* Commit our multicast mast to the SLIC by writing to the multicast
-		 * address mask registers
-		 */
-		DBG_ERROR("%s (%s) WRITE mcastlow[%lx] mcasthigh[%lx]\n",
-			  __func__, adapter->netdev->name,
-			  ((ulong) (adapter->MulticastMask & 0xFFFFFFFF)),
-			  ((ulong)
-			   ((adapter->MulticastMask >> 32) & 0xFFFFFFFF)));
-
-		WRITE_REG(sxg_regs->McastLow,
-			  (u32) (adapter->MulticastMask & 0xFFFFFFFF), FLUSH);
-		WRITE_REG(sxg_regs->McastHigh,
-			  (u32) ((adapter->
-				  MulticastMask >> 32) & 0xFFFFFFFF), FLUSH);
-	}
-}
+#endif
 
 static void sxg_unmap_mmio_space(p_adapter_t adapter)
 {
@@ -3267,9 +3268,9 @@ static void sxg_adapter_set_hwaddr(p_adapter_t adapter)
 
 }
 
+#if XXXTODO
 static int sxg_mac_set_address(p_net_device dev, void *ptr)
 {
-#if XXXTODO
 	p_adapter_t adapter = (p_adapter_t) netdev_priv(dev);
 	struct sockaddr *addr = ptr;
 
@@ -3295,9 +3296,9 @@ static int sxg_mac_set_address(p_net_device dev, void *ptr)
 		  adapter->currmacaddr[5]);
 
 	sxg_config_set(adapter, TRUE);
-#endif
 	return 0;
 }
+#endif
 
 /*****************************************************************************/
 /*************  SXG DRIVER FUNCTIONS  (below) ********************************/
Signature · 1 line
1.6.0.2
#42 lore raw

PATCH 36/42 Staging: sxg: fix compiler warnings.

In reply to Greg KH

sizeof() isn't an unsigned long :(

---
 drivers/staging/sxg/sxg.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
drivers/staging/sxg/sxg.c +8 -8
index fe935e2..5272a18 100644
@@ -460,8 +460,8 @@ static int sxg_allocate_resources(p_adapter_t adapter)
 	/* fails.  If we hit a minimum, fail. */
 
 	for (;;) {
-		DBG_ERROR("%s Allocate XmtRings size[%lx]\n", __func__,
-			  (sizeof(SXG_XMT_RING) * 1));
+		DBG_ERROR("%s Allocate XmtRings size[%x]\n", __func__,
+			  (unsigned int)(sizeof(SXG_XMT_RING) * 1));
 
 		/* Start with big items first - receive and transmit rings.  At the moment */
 		/* I'm going to keep the ring size fixed and adjust the number of */
@@ -477,8 +477,8 @@ static int sxg_allocate_resources(p_adapter_t adapter)
 		}
 		memset(adapter->XmtRings, 0, sizeof(SXG_XMT_RING) * 1);
 
-		DBG_ERROR("%s Allocate RcvRings size[%lx]\n", __func__,
-			  (sizeof(SXG_RCV_RING) * 1));
+		DBG_ERROR("%s Allocate RcvRings size[%x]\n", __func__,
+			  (unsigned int)(sizeof(SXG_RCV_RING) * 1));
 		adapter->RcvRings =
 		    pci_alloc_consistent(adapter->pcidev,
 					 sizeof(SXG_RCV_RING) * 1,
@@ -538,8 +538,8 @@ static int sxg_allocate_resources(p_adapter_t adapter)
 		return (STATUS_RESOURCES);
 	}
 
-	DBG_ERROR("%s Allocate EventRings size[%lx]\n", __func__,
-		  (sizeof(SXG_EVENT_RING) * RssIds));
+	DBG_ERROR("%s Allocate EventRings size[%x]\n", __func__,
+		  (unsigned int)(sizeof(SXG_EVENT_RING) * RssIds));
 
 	/* Allocate event queues. */
 	adapter->EventRings = pci_alloc_consistent(adapter->pcidev,
@@ -569,8 +569,8 @@ static int sxg_allocate_resources(p_adapter_t adapter)
 	}
 	memset(adapter->Isr, 0, sizeof(u32) * IsrCount);
 
-	DBG_ERROR("%s Allocate shared XMT ring zero index location size[%lx]\n",
-		  __func__, sizeof(u32));
+	DBG_ERROR("%s Allocate shared XMT ring zero index location size[%x]\n",
+		  __func__, (unsigned int)sizeof(u32));
 
 	/* Allocate shared XMT ring zero index location */
 	adapter->XmtRingZeroIndex = pci_alloc_consistent(adapter->pcidev,
Signature · 1 line
1.6.0.2
#43 lore raw

PATCH 37/42 Staging: w35und: remove spinlock wrappers

In reply to Greg KH

From: Pekka Enberg <[email protected]>

This patch removes the OS_SPIN_LOCK and related wrappers from the driver code.

---
 drivers/staging/winbond/linux/common.h    |    7 -----
 drivers/staging/winbond/linux/wb35reg.c   |   37 +++++++++++++---------------
 drivers/staging/winbond/linux/wb35reg_s.h |    2 +-
 drivers/staging/winbond/mlme_s.h          |    2 +-
 drivers/staging/winbond/wblinux.c         |   13 ++++-----
 drivers/staging/winbond/wblinux_s.h       |    4 +-
 6 files changed, 27 insertions(+), 38 deletions(-)
drivers/staging/winbond/linux/common.h +0 -7
index c8f14b7..712a86c 100644
@@ -105,13 +105,6 @@ typedef struct urb * PURB;
 #define OS_MEMORY_CLEAR( _A, _S )	memset( (u8 *)_A,0,_S)
 #define OS_MEMORY_COMPARE( _A, _B, _S )	(memcmp(_A,_B,_S)? 0 : 1) // Definition is reverse with Ndis 1: the same 0: different
 
-
-#define OS_SPIN_LOCK				spinlock_t
-#define OS_SPIN_LOCK_ALLOCATE( _S )		spin_lock_init( _S );
-#define OS_SPIN_LOCK_FREE( _S )
-#define OS_SPIN_LOCK_ACQUIRED( _S )		spin_lock_irq( _S )
-#define OS_SPIN_LOCK_RELEASED( _S )		spin_unlock_irq( _S );
-
 #define OS_TIMER	struct timer_list
 #define OS_TIMER_INITIAL( _T, _F, _P )			\
 {							\
drivers/staging/winbond/linux/wb35reg.c +17 -20
index 5c28ec9..ebb6db5 100644
@@ -46,14 +46,14 @@ Wb35Reg_BurstWrite(phw_data_t pHwData, u16 RegisterNo, u32 * pRegisterData, u8 N
 		pRegQueue->pUsbReq = dr;
 		pRegQueue->pUrb = pUrb;
 
-		OS_SPIN_LOCK_ACQUIRED( &pWb35Reg->EP0VM_spin_lock );
+		spin_lock_irq( &pWb35Reg->EP0VM_spin_lock );
 		if (pWb35Reg->pRegFirst == NULL)
 			pWb35Reg->pRegFirst = pRegQueue;
 		else
 			pWb35Reg->pRegLast->Next = pRegQueue;
 		pWb35Reg->pRegLast = pRegQueue;
 
-		OS_SPIN_LOCK_RELEASED( &pWb35Reg->EP0VM_spin_lock );
+		spin_unlock_irq( &pWb35Reg->EP0VM_spin_lock );
 
 		// Start EP0VM
 		Wb35Reg_EP0VM_start(pHwData);
@@ -193,14 +193,14 @@ Wb35Reg_Write(  phw_data_t pHwData,  u16 RegisterNo,  u32 RegisterValue )
 		pRegQueue->pUsbReq = dr;
 		pRegQueue->pUrb = pUrb;
 
-		OS_SPIN_LOCK_ACQUIRED(&pWb35Reg->EP0VM_spin_lock );
+		spin_lock_irq(&pWb35Reg->EP0VM_spin_lock );
 		if (pWb35Reg->pRegFirst == NULL)
 			pWb35Reg->pRegFirst = pRegQueue;
 		else
 			pWb35Reg->pRegLast->Next = pRegQueue;
 		pWb35Reg->pRegLast = pRegQueue;
 
-		OS_SPIN_LOCK_RELEASED( &pWb35Reg->EP0VM_spin_lock );
+		spin_unlock_irq( &pWb35Reg->EP0VM_spin_lock );
 
 		// Start EP0VM
 		Wb35Reg_EP0VM_start(pHwData);
@@ -254,14 +254,14 @@ Wb35Reg_WriteWithCallbackValue( phw_data_t pHwData, u16 RegisterNo, u32 Register
 		pRegQueue->Next = NULL;
 		pRegQueue->pUsbReq = dr;
 		pRegQueue->pUrb = pUrb;
-		OS_SPIN_LOCK_ACQUIRED (&pWb35Reg->EP0VM_spin_lock );
+		spin_lock_irq (&pWb35Reg->EP0VM_spin_lock );
 		if( pWb35Reg->pRegFirst == NULL )
 			pWb35Reg->pRegFirst = pRegQueue;
 		else
 			pWb35Reg->pRegLast->Next = pRegQueue;
 		pWb35Reg->pRegLast = pRegQueue;
 
-		OS_SPIN_LOCK_RELEASED ( &pWb35Reg->EP0VM_spin_lock );
+		spin_unlock_irq ( &pWb35Reg->EP0VM_spin_lock );
 
 		// Start EP0VM
 		Wb35Reg_EP0VM_start(pHwData);
@@ -359,14 +359,14 @@ Wb35Reg_Read(phw_data_t pHwData, u16 RegisterNo,  u32 * pRegisterValue )
 		pRegQueue->Next = NULL;
 		pRegQueue->pUsbReq = dr;
 		pRegQueue->pUrb = pUrb;
-		OS_SPIN_LOCK_ACQUIRED ( &pWb35Reg->EP0VM_spin_lock );
+		spin_lock_irq ( &pWb35Reg->EP0VM_spin_lock );
 		if( pWb35Reg->pRegFirst == NULL )
 			pWb35Reg->pRegFirst = pRegQueue;
 		else
 			pWb35Reg->pRegLast->Next = pRegQueue;
 		pWb35Reg->pRegLast = pRegQueue;
 
-		OS_SPIN_LOCK_RELEASED( &pWb35Reg->EP0VM_spin_lock );
+		spin_unlock_irq( &pWb35Reg->EP0VM_spin_lock );
 
 		// Start EP0VM
 		Wb35Reg_EP0VM_start( pHwData );
@@ -411,9 +411,9 @@ Wb35Reg_EP0VM(phw_data_t pHwData )
 		goto cleanup;
 
 	// Get the register data and send to USB through Irp
-	OS_SPIN_LOCK_ACQUIRED( &pWb35Reg->EP0VM_spin_lock );
+	spin_lock_irq( &pWb35Reg->EP0VM_spin_lock );
 	pRegQueue = pWb35Reg->pRegFirst;
-	OS_SPIN_LOCK_RELEASED( &pWb35Reg->EP0VM_spin_lock );
+	spin_unlock_irq( &pWb35Reg->EP0VM_spin_lock );
 
 	if (!pRegQueue)
 		goto cleanup;
@@ -468,12 +468,12 @@ Wb35Reg_EP0VM_complete(PURB pUrb)
 		OS_ATOMIC_DEC( pHwData->Adapter, &pWb35Reg->RegFireCount );
 	} else {
 		// Complete to send, remove the URB from the first
-		OS_SPIN_LOCK_ACQUIRED( &pWb35Reg->EP0VM_spin_lock );
+		spin_lock_irq( &pWb35Reg->EP0VM_spin_lock );
 		pRegQueue = pWb35Reg->pRegFirst;
 		if (pRegQueue == pWb35Reg->pRegLast)
 			pWb35Reg->pRegLast = NULL;
 		pWb35Reg->pRegFirst = pWb35Reg->pRegFirst->Next;
-		OS_SPIN_LOCK_RELEASED( &pWb35Reg->EP0VM_spin_lock );
+		spin_unlock_irq( &pWb35Reg->EP0VM_spin_lock );
 
 		if (pWb35Reg->EP0VM_status) {
 #ifdef _PE_REG_DUMP_
@@ -513,7 +513,7 @@ Wb35Reg_destroy(phw_data_t pHwData)
 	OS_SLEEP(10000);  // Delay for waiting function enter 940623.1.b
 
 	// Release all the data in RegQueue
-	OS_SPIN_LOCK_ACQUIRED( &pWb35Reg->EP0VM_spin_lock );
+	spin_lock_irq( &pWb35Reg->EP0VM_spin_lock );
 	pRegQueue = pWb35Reg->pRegFirst;
 	while (pRegQueue) {
 		if (pRegQueue == pWb35Reg->pRegLast)
@@ -521,7 +521,7 @@ Wb35Reg_destroy(phw_data_t pHwData)
 		pWb35Reg->pRegFirst = pWb35Reg->pRegFirst->Next;
 
 		pUrb = pRegQueue->pUrb;
-		OS_SPIN_LOCK_RELEASED( &pWb35Reg->EP0VM_spin_lock );
+		spin_unlock_irq( &pWb35Reg->EP0VM_spin_lock );
 		if (pUrb) {
 			usb_free_urb(pUrb);
 			kfree(pRegQueue);
@@ -530,14 +530,11 @@ Wb35Reg_destroy(phw_data_t pHwData)
 			WBDEBUG(("EP0 queue release error\n"));
 			#endif
 		}
-		OS_SPIN_LOCK_ACQUIRED( &pWb35Reg->EP0VM_spin_lock );
+		spin_lock_irq( &pWb35Reg->EP0VM_spin_lock );
 
 		pRegQueue = pWb35Reg->pRegFirst;
 	}
-	OS_SPIN_LOCK_RELEASED( &pWb35Reg->EP0VM_spin_lock );
-
-	// Free resource
-	OS_SPIN_LOCK_FREE(  &pWb35Reg->EP0VM_spin_lock );
+	spin_unlock_irq( &pWb35Reg->EP0VM_spin_lock );
 }
 
 //====================================================================================
@@ -550,7 +547,7 @@ unsigned char Wb35Reg_initial(phw_data_t pHwData)
 	u32 SoftwareSet, VCO_trim, TxVga, Region_ScanInterval;
 
 	// Spin lock is acquired for read and write IRP command
-	OS_SPIN_LOCK_ALLOCATE( &pWb35Reg->EP0VM_spin_lock );
+	spin_lock_init( &pWb35Reg->EP0VM_spin_lock );
 
 	// Getting RF module type from EEPROM ------------------------------------
 	Wb35Reg_WriteSync( pHwData, 0x03b4, 0x080d0000 ); // Start EEPROM access + Read + address(0x0d)
drivers/staging/winbond/linux/wb35reg_s.h +1 -1
index 9b76301..8b35b93 100644
@@ -143,7 +143,7 @@ typedef struct _WB35REG
 	//-------------------
 	// VM
 	//-------------------
-	OS_SPIN_LOCK	EP0VM_spin_lock; // 4B
+	spinlock_t	EP0VM_spin_lock; // 4B
 	u32	        EP0VM_status;//$$
 	PREG_QUEUE	    pRegFirst;
 	PREG_QUEUE	    pRegLast;
drivers/staging/winbond/mlme_s.h +1 -1
index 6ec818b..039fd40 100644
@@ -130,7 +130,7 @@ typedef struct _MLME_FRAME
 	u8			DataType;
 	u8			IsInUsed;
 
-	OS_SPIN_LOCK	MLMESpinLock;
+	spinlock_t	MLMESpinLock;
 
     u8		TxMMPDU[MAX_NUM_TX_MMPDU][MAX_MMPDU_SIZE];
 	u8		TxMMPDUInUse[ (MAX_NUM_TX_MMPDU+3) & ~0x03 ];
drivers/staging/winbond/wblinux.c +6 -7
index 51dad95..186ad60 100644
@@ -26,10 +26,10 @@ EncapAtomicInc(PADAPTER Adapter, void* pAtomic)
 	PWBLINUX pWbLinux = &Adapter->WbLinux;
 	u32	ltmp;
 	u32 *	pltmp = (u32 *)pAtomic;
-	OS_SPIN_LOCK_ACQUIRED( &pWbLinux->AtomicSpinLock );
+	spin_lock_irq( &pWbLinux->AtomicSpinLock );
 	(*pltmp)++;
 	ltmp = (*pltmp);
-	OS_SPIN_LOCK_RELEASED( &pWbLinux->AtomicSpinLock );
+	spin_unlock_irq( &pWbLinux->AtomicSpinLock );
 	return ltmp;
 }
 
@@ -39,10 +39,10 @@ EncapAtomicDec(PADAPTER Adapter, void* pAtomic)
 	PWBLINUX pWbLinux = &Adapter->WbLinux;
 	u32	ltmp;
 	u32 *	pltmp = (u32 *)pAtomic;
-	OS_SPIN_LOCK_ACQUIRED( &pWbLinux->AtomicSpinLock );
+	spin_lock_irq( &pWbLinux->AtomicSpinLock );
 	(*pltmp)--;
 	ltmp = (*pltmp);
-	OS_SPIN_LOCK_RELEASED( &pWbLinux->AtomicSpinLock );
+	spin_unlock_irq( &pWbLinux->AtomicSpinLock );
 	return ltmp;
 }
 
@@ -51,8 +51,8 @@ WBLINUX_Initial(PADAPTER Adapter)
 {
 	PWBLINUX pWbLinux = &Adapter->WbLinux;
 
-	OS_SPIN_LOCK_ALLOCATE( &pWbLinux->SpinLock );
-	OS_SPIN_LOCK_ALLOCATE( &pWbLinux->AtomicSpinLock );
+	spin_lock_init( &pWbLinux->SpinLock );
+	spin_lock_init( &pWbLinux->AtomicSpinLock );
 	return TRUE;
 }
 
@@ -79,7 +79,6 @@ void
 WBLINUX_Destroy(PADAPTER Adapter)
 {
 	WBLINUX_stop( Adapter );
-	OS_SPIN_LOCK_FREE( &pWbNdis->SpinLock );
 #ifdef _PE_USB_INI_DUMP_
 	WBDEBUG(("[w35und] unregister_netdev!\n"));
 #endif
drivers/staging/winbond/wblinux_s.h +2 -2
index 97e9167..fd2bb43 100644
@@ -24,8 +24,8 @@
 
 typedef struct _WBLINUX
 {
-	OS_SPIN_LOCK	AtomicSpinLock;
-	OS_SPIN_LOCK	SpinLock;
+	spinlock_t	AtomicSpinLock;
+	spinlock_t	SpinLock;
 	u32	shutdown;
 
 	OS_ATOMIC	ThreadCount;
Signature · 1 line
1.6.0.2
#44 lore raw

PATCH 38/42 Staging: w35und: use gotos for error handling

In reply to Greg KH

From: Pekka Enberg <[email protected]>

The driver code uses do { } while (0) together with the break statement to emulate gotos for error handling. Fix that up by using the goto statement instead.

---
 drivers/staging/winbond/linux/wb35rx.c |  187 ++++++++++++++++----------------
 drivers/staging/winbond/linux/wb35tx.c |  130 +++++++++++------------
 drivers/staging/winbond/linux/wbusb.c  |  161 +++++++++++++--------------
 drivers/staging/winbond/wblinux.c      |  188 ++++++++++++++++----------------
 4 files changed, 326 insertions(+), 340 deletions(-)
drivers/staging/winbond/linux/wb35rx.c +79 -82
index c5c3317..b4b9f5f 100644
@@ -35,51 +35,50 @@ void Wb35Rx(  phw_data_t pHwData )
 	//
 	// Issuing URB
 	//
-	do {
-		if (pHwData->SurpriseRemove || pHwData->HwStop)
-			break;
+	if (pHwData->SurpriseRemove || pHwData->HwStop)
+		goto error;
 
-		if (pWb35Rx->rx_halt)
-			break;
+	if (pWb35Rx->rx_halt)
+		goto error;
 
-		// Get RxBuffer's ID
-		RxBufferId = pWb35Rx->RxBufferId;
-		if (!pWb35Rx->RxOwner[RxBufferId]) {
-			// It's impossible to run here.
-			#ifdef _PE_RX_DUMP_
-			WBDEBUG(("Rx driver fifo unavailable\n"));
-			#endif
-			break;
-		}
+	// Get RxBuffer's ID
+	RxBufferId = pWb35Rx->RxBufferId;
+	if (!pWb35Rx->RxOwner[RxBufferId]) {
+		// It's impossible to run here.
+		#ifdef _PE_RX_DUMP_
+		WBDEBUG(("Rx driver fifo unavailable\n"));
+		#endif
+		goto error;
+	}
 
-		// Update buffer point, then start to bulkin the data from USB
-		pWb35Rx->RxBufferId++;
-		pWb35Rx->RxBufferId %= MAX_USB_RX_BUFFER_NUMBER;
+	// Update buffer point, then start to bulkin the data from USB
+	pWb35Rx->RxBufferId++;
+	pWb35Rx->RxBufferId %= MAX_USB_RX_BUFFER_NUMBER;
 
-		pWb35Rx->CurrentRxBufferId = RxBufferId;
+	pWb35Rx->CurrentRxBufferId = RxBufferId;
 
-		if (1 != OS_MEMORY_ALLOC((void* *)&pWb35Rx->pDRx, MAX_USB_RX_BUFFER)) {
-			printk("w35und: Rx memory alloc failed\n");
-			break;
-		}
-		pRxBufferAddress = pWb35Rx->pDRx;
+	if (1 != OS_MEMORY_ALLOC((void* *)&pWb35Rx->pDRx, MAX_USB_RX_BUFFER)) {
+		printk("w35und: Rx memory alloc failed\n");
+		goto error;
+	}
+	pRxBufferAddress = pWb35Rx->pDRx;
 
-		usb_fill_bulk_urb(pUrb, pHwData->WbUsb.udev,
-				  usb_rcvbulkpipe(pHwData->WbUsb.udev, 3),
-				  pRxBufferAddress, MAX_USB_RX_BUFFER,
-				  Wb35Rx_Complete, pHwData);
+	usb_fill_bulk_urb(pUrb, pHwData->WbUsb.udev,
+			  usb_rcvbulkpipe(pHwData->WbUsb.udev, 3),
+			  pRxBufferAddress, MAX_USB_RX_BUFFER,
+			  Wb35Rx_Complete, pHwData);
 
-		pWb35Rx->EP3vm_state = VM_RUNNING;
+	pWb35Rx->EP3vm_state = VM_RUNNING;
 
-		retv = wb_usb_submit_urb(pUrb);
+	retv = wb_usb_submit_urb(pUrb);
 
-		if (retv != 0) {
-			printk("Rx URB sending error\n");
-			break;
-		}
-		return;
-	} while(FALSE);
+	if (retv != 0) {
+		printk("Rx URB sending error\n");
+		goto error;
+	}
+	return;
 
+error:
 	// VM stop
 	pWb35Rx->EP3vm_state = VM_STOP;
 	OS_ATOMIC_DEC( pHwData->Adapter, &pWb35Rx->RxFireCounter );
@@ -99,65 +98,63 @@ void Wb35Rx_Complete(PURB pUrb)
 	pWb35Rx->EP3vm_state = VM_COMPLETED;
 	pWb35Rx->EP3VM_status = pUrb->status;//Store the last result of Irp
 
-	do {
-		RxBufferId = pWb35Rx->CurrentRxBufferId;
+	RxBufferId = pWb35Rx->CurrentRxBufferId;
 
-		pRxBufferAddress = pWb35Rx->pDRx;
-		BulkLength = (u16)pUrb->actual_length;
+	pRxBufferAddress = pWb35Rx->pDRx;
+	BulkLength = (u16)pUrb->actual_length;
 
-		// The IRP is completed
-		pWb35Rx->EP3vm_state = VM_COMPLETED;
+	// The IRP is completed
+	pWb35Rx->EP3vm_state = VM_COMPLETED;
 
-		if (pHwData->SurpriseRemove || pHwData->HwStop) // Must be here, or RxBufferId is invalid
-			break;
+	if (pHwData->SurpriseRemove || pHwData->HwStop) // Must be here, or RxBufferId is invalid
+		goto error;
 
-		if (pWb35Rx->rx_halt)
-			break;
+	if (pWb35Rx->rx_halt)
+		goto error;
 
-		// Start to process the data only in successful condition
-		pWb35Rx->RxOwner[ RxBufferId ] = 0; // Set the owner to driver
-		R00.value = le32_to_cpu(*(u32 *)pRxBufferAddress);
+	// Start to process the data only in successful condition
+	pWb35Rx->RxOwner[ RxBufferId ] = 0; // Set the owner to driver
+	R00.value = le32_to_cpu(*(u32 *)pRxBufferAddress);
 
-		// The URB is completed, check the result
-		if (pWb35Rx->EP3VM_status != 0) {
-			#ifdef _PE_USB_STATE_DUMP_
-			WBDEBUG(("EP3 IoCompleteRoutine return error\n"));
-			DebugUsbdStatusInformation( pWb35Rx->EP3VM_status );
-			#endif
-			pWb35Rx->EP3vm_state = VM_STOP;
-			break;
-		}
+	// The URB is completed, check the result
+	if (pWb35Rx->EP3VM_status != 0) {
+		#ifdef _PE_USB_STATE_DUMP_
+		WBDEBUG(("EP3 IoCompleteRoutine return error\n"));
+		DebugUsbdStatusInformation( pWb35Rx->EP3VM_status );
+		#endif
+		pWb35Rx->EP3vm_state = VM_STOP;
+		goto error;
+	}
 
-		// 20060220 For recovering. check if operating in single USB mode
-		if (!HAL_USB_MODE_BURST(pHwData)) {
-			SizeCheck = R00.R00_receive_byte_count;  //20060926 anson's endian
-			if ((SizeCheck & 0x03) > 0)
-				SizeCheck -= 4;
-			SizeCheck = (SizeCheck + 3) & ~0x03;
-			SizeCheck += 12; // 8 + 4 badbeef
-			if ((BulkLength > 1600) ||
-				(SizeCheck > 1600) ||
-				(BulkLength != SizeCheck) ||
-				(BulkLength == 0)) { // Add for fail Urb
-				pWb35Rx->EP3vm_state = VM_STOP;
-				pWb35Rx->Ep3ErrorCount2++;
-			}
+	// 20060220 For recovering. check if operating in single USB mode
+	if (!HAL_USB_MODE_BURST(pHwData)) {
+		SizeCheck = R00.R00_receive_byte_count;  //20060926 anson's endian
+		if ((SizeCheck & 0x03) > 0)
+			SizeCheck -= 4;
+		SizeCheck = (SizeCheck + 3) & ~0x03;
+		SizeCheck += 12; // 8 + 4 badbeef
+		if ((BulkLength > 1600) ||
+			(SizeCheck > 1600) ||
+			(BulkLength != SizeCheck) ||
+			(BulkLength == 0)) { // Add for fail Urb
+			pWb35Rx->EP3vm_state = VM_STOP;
+			pWb35Rx->Ep3ErrorCount2++;
 		}
+	}
 
-		// Indicating the receiving data
-		pWb35Rx->ByteReceived += BulkLength;
-		pWb35Rx->RxBufferSize[ RxBufferId ] = BulkLength;
-
-		if (!pWb35Rx->RxOwner[ RxBufferId ])
-			Wb35Rx_indicate(pHwData);
+	// Indicating the receiving data
+	pWb35Rx->ByteReceived += BulkLength;
+	pWb35Rx->RxBufferSize[ RxBufferId ] = BulkLength;
 
-		kfree(pWb35Rx->pDRx);
-		// Do the next receive
-		Wb35Rx(pHwData);
-		return;
+	if (!pWb35Rx->RxOwner[ RxBufferId ])
+		Wb35Rx_indicate(pHwData);
 
-	} while(FALSE);
+	kfree(pWb35Rx->pDRx);
+	// Do the next receive
+	Wb35Rx(pHwData);
+	return;
 
+error:
 	pWb35Rx->RxOwner[ RxBufferId ] = 1; // Set the owner to hardware
 	OS_ATOMIC_DEC( pHwData->Adapter, &pWb35Rx->RxFireCounter );
 	pWb35Rx->EP3vm_state = VM_STOP;
drivers/staging/winbond/linux/wb35tx.c +62 -68

158 lines not on this page · raw message

drivers/staging/winbond/linux/wbusb.c +79 -82

193 lines not on this page · raw message

drivers/staging/winbond/wblinux.c +93 -95

207 lines not on this page · raw message

Signature · 1 line
1.6.0.2
#45 lore raw

PATCH 39/42 Staging: w35und: module init cleanup

In reply to Greg KH

From: Pekka Enberg <[email protected]>

This patch cleans up the module init functions a bit and removes the redundant device ID check from wb35_probe() function.

---
 drivers/staging/winbond/linux/wbusb.c |   87 ++++++++++++---------------------
 1 files changed, 31 insertions(+), 56 deletions(-)
drivers/staging/winbond/linux/wbusb.c +31 -56
index e09b272..fb216de 100644
@@ -6,36 +6,23 @@
 #include "sysdef.h"
 #include <net/mac80211.h>
 
-
-MODULE_AUTHOR( DRIVER_AUTHOR );
-MODULE_DESCRIPTION( DRIVER_DESC );
+MODULE_AUTHOR(DRIVER_AUTHOR);
+MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
 MODULE_VERSION("0.1");
 
-
-//============================================================
-// vendor ID and product ID can into here for others
-//============================================================
-static struct usb_device_id Id_Table[] =
-{
-  {USB_DEVICE( 0x0416, 0x0035 )},
-  {USB_DEVICE( 0x18E8, 0x6201 )},
-  {USB_DEVICE( 0x18E8, 0x6206 )},
-  {USB_DEVICE( 0x18E8, 0x6217 )},
-  {USB_DEVICE( 0x18E8, 0x6230 )},
-  {USB_DEVICE( 0x18E8, 0x6233 )},
-  {USB_DEVICE( 0x1131, 0x2035 )},
-  {  }
+static struct usb_device_id wb35_table[] __devinitdata = {
+	{USB_DEVICE(0x0416, 0x0035)},
+	{USB_DEVICE(0x18E8, 0x6201)},
+	{USB_DEVICE(0x18E8, 0x6206)},
+	{USB_DEVICE(0x18E8, 0x6217)},
+	{USB_DEVICE(0x18E8, 0x6230)},
+	{USB_DEVICE(0x18E8, 0x6233)},
+	{USB_DEVICE(0x1131, 0x2035)},
+	{}
 };
 
-MODULE_DEVICE_TABLE(usb, Id_Table);
-
-static struct usb_driver wb35_driver = {
-	.name =		"w35und",
-	.probe =	wb35_probe,
-	.disconnect = wb35_disconnect,
-	.id_table = Id_Table,
-};
+MODULE_DEVICE_TABLE(usb, wb35_table);
 
 static const struct ieee80211_rate wbsoft_rates[] = {
 	{ .bitrate = 10, .flags = IEEE80211_RATE_SHORT_PREAMBLE },
@@ -187,21 +174,6 @@ struct wbsoft_priv {
 };
 
 
-int __init wb35_init(void)
-{
-	printk("[w35und]driver init\n");
-	return usb_register(&wb35_driver);
-}
-
-void __exit wb35_exit(void)
-{
-	printk("[w35und]driver exit\n");
-	usb_deregister( &wb35_driver );
-}
-
-module_init(wb35_init);
-module_exit(wb35_exit);
-
 // Usb kernel subsystem will call this function when a new device is plugged into.
 int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id_table)
 {
@@ -210,7 +182,7 @@ int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id_table)
 	PWBUSB		pWbUsb;
         struct usb_host_interface *interface;
 	struct usb_endpoint_descriptor *endpoint;
-	int	i, ret = -1;
+	int	ret = -1;
 	u32	ltmp;
 	struct usb_device *udev = interface_to_usbdev(intf);
 
@@ -218,21 +190,6 @@ int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id_table)
 
 	printk("[w35und]wb35_probe ->\n");
 
-	for (i=0; i<(sizeof(Id_Table)/sizeof(struct usb_device_id)); i++ ) {
-		if ((udev->descriptor.idVendor == Id_Table[i].idVendor) &&
-			(udev->descriptor.idProduct == Id_Table[i].idProduct)) {
-			printk("[w35und]Found supported hardware\n");
-			break;
-		}
-	}
-
-	if ((i == (sizeof(Id_Table)/sizeof(struct usb_device_id)))) {
-		#ifdef _PE_USB_INI_DUMP_
-		WBDEBUG(("[w35und] This is not the one we are interested about\n"));
-		#endif
-		return -ENODEV;
-	}
-
 	// 20060630.2 Check the device if it already be opened
 	ret = usb_control_msg(udev, usb_rcvctrlpipe( udev, 0 ),
 			      0x01, USB_TYPE_VENDOR|USB_RECIP_DEVICE|USB_DIR_IN,
@@ -398,4 +355,22 @@ void wb35_disconnect(struct usb_interface *intf)
 
 }
 
+static struct usb_driver wb35_driver = {
+	.name		= "w35und",
+	.id_table	= wb35_table,
+	.probe		= wb35_probe,
+	.disconnect	= wb35_disconnect,
+};
+
+static int __init wb35_init(void)
+{
+	return usb_register(&wb35_driver);
+}
+
+static void __exit wb35_exit(void)
+{
+	usb_deregister(&wb35_driver);
+}
 
+module_init(wb35_init);
+module_exit(wb35_exit);
Signature · 1 line
1.6.0.2
#46 lore raw

PATCH 40/42 Staging: wbusb: fix a bunch of compiler warnings

In reply to Greg KH

First cut at removing some obvious compiler warnings.

---
 drivers/staging/winbond/linux/wbusb.c |   35 +++++++++++++++++++++-----------
 drivers/staging/winbond/mds.c         |    2 +-
 drivers/staging/winbond/sme_api.c     |    1 +
 3 files changed, 25 insertions(+), 13 deletions(-)
drivers/staging/winbond/linux/wbusb.c +23 -12
index fb216de..f4a7875 100644
@@ -19,16 +19,16 @@ static struct usb_device_id wb35_table[] __devinitdata = {
 	{USB_DEVICE(0x18E8, 0x6230)},
 	{USB_DEVICE(0x18E8, 0x6233)},
 	{USB_DEVICE(0x1131, 0x2035)},
-	{}
+	{ 0, }
 };
 
 MODULE_DEVICE_TABLE(usb, wb35_table);
 
-static const struct ieee80211_rate wbsoft_rates[] = {
+static struct ieee80211_rate wbsoft_rates[] = {
 	{ .bitrate = 10, .flags = IEEE80211_RATE_SHORT_PREAMBLE },
 };
 
-static const struct ieee80211_channel wbsoft_channels[] = {
+static struct ieee80211_channel wbsoft_channels[] = {
 	{ .center_freq = 2412},
 };
 
@@ -49,9 +49,22 @@ static void wbsoft_remove_interface(struct ieee80211_hw *dev,
 	printk("wbsoft_remove interface called\n");
 }
 
-static int wbsoft_nop(void)
+static void wbsoft_stop(struct ieee80211_hw *hw)
 {
-	printk("wbsoft_nop called\n");
+	printk(KERN_INFO "%s called\n", __func__);
+}
+
+static int wbsoft_get_stats(struct ieee80211_hw *hw,
+			    struct ieee80211_low_level_stats *stats)
+{
+	printk(KERN_INFO "%s called\n", __func__);
+	return 0;
+}
+
+static int wbsoft_get_tx_stats(struct ieee80211_hw *hw,
+			       struct ieee80211_tx_queue_stats *stats)
+{
+	printk(KERN_INFO "%s called\n", __func__);
 	return 0;
 }
 
@@ -92,8 +105,7 @@ static void wbsoft_configure_filter(struct ieee80211_hw *dev,
 	*total_flags = new_flags;
 }
 
-static int wbsoft_tx(struct ieee80211_hw *dev, struct sk_buff *skb,
-		      struct ieee80211_tx_control *control)
+static int wbsoft_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
 {
 	char *buffer = kmalloc(skb->len, GFP_ATOMIC);
 	printk("Sending frame %d bytes\n", skb->len);
@@ -158,14 +170,14 @@ static u64 wbsoft_get_tsf(struct ieee80211_hw *dev)
 static const struct ieee80211_ops wbsoft_ops = {
 	.tx			= wbsoft_tx,
 	.start			= wbsoft_start,		/* Start can be pretty much empty as we do WbWLanInitialize() during probe? */
-	.stop			= wbsoft_nop,
+	.stop			= wbsoft_stop,
 	.add_interface		= wbsoft_add_interface,
 	.remove_interface	= wbsoft_remove_interface,
 	.config			= wbsoft_config,
 	.config_interface	= wbsoft_config_interface,
 	.configure_filter	= wbsoft_configure_filter,
-	.get_stats		= wbsoft_nop,
-	.get_tx_stats		= wbsoft_nop,
+	.get_stats		= wbsoft_get_stats,
+	.get_tx_stats		= wbsoft_get_tx_stats,
 	.get_tsf		= wbsoft_get_tsf,
 // conf_tx: hal_set_cwmin()/hal_set_cwmax;
 };
@@ -224,6 +236,7 @@ int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id_table)
 	{
 		struct wbsoft_priv *priv;
 		struct ieee80211_hw *dev;
+		static struct ieee80211_supported_band band;
 		int res;
 
 		dev = ieee80211_alloc_hw(sizeof(*priv), &wbsoft_ops);
@@ -252,8 +265,6 @@ int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id_table)
 
 		dev->queues = 1;
 
-		static struct ieee80211_supported_band band;
-
 		band.channels = wbsoft_channels;
 		band.n_channels = ARRAY_SIZE(wbsoft_channels);
 		band.bitrates = wbsoft_rates;
drivers/staging/winbond/mds.c +1 -1
index 400397c..f1de813 100644
@@ -437,7 +437,7 @@ Mds_DurationSet(  PADAPTER Adapter,  PDESCRIPTOR pDes,  u8 *buffer )
 	u8	Rate, i;
 	unsigned char	CTS_on = FALSE, RTS_on = FALSE;
 	PT00_DESCRIPTOR pNextT00;
-	u16 BodyLen;
+	u16 BodyLen = 0;
 	unsigned char boGroupAddr = FALSE;
 
 
drivers/staging/winbond/sme_api.c +1 -0
index 40e93b7..31c9673 100644
@@ -10,4 +10,5 @@
 s8 sme_get_rssi(void *pcore_data, s32 *prssi)
 {
        BUG();
+       return 0;
 }
Signature · 1 line
1.6.0.2
#47 lore raw

PATCH 41/42 Staging: me4000: remove some compiler warnings

In reply to Greg KH
---
 drivers/staging/me4000/me4000.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/me4000/me4000.c +6 -6
index 75c268c..0b33773 100644
@@ -6017,14 +6017,14 @@ static int me4000_read_procmem(char *buf, char **start, off_t offset, int count,
 		    sprintf(buf + len, "PLX base register = 0x%lX\n",
 			    board_info->plx_regbase);
 		len +=
-		    sprintf(buf + len, "PLX base register size = 0x%lX\n",
-			    board_info->plx_regbase_size);
+		    sprintf(buf + len, "PLX base register size = 0x%X\n",
+			    (unsigned int)board_info->plx_regbase_size);
 		len +=
-		    sprintf(buf + len, "ME4000 base register = 0x%lX\n",
-			    board_info->me4000_regbase);
+		    sprintf(buf + len, "ME4000 base register = 0x%X\n",
+			    (unsigned int)board_info->me4000_regbase);
 		len +=
-		    sprintf(buf + len, "ME4000 base register size = 0x%lX\n",
-			    board_info->me4000_regbase_size);
+		    sprintf(buf + len, "ME4000 base register size = 0x%X\n",
+			    (unsigned int)board_info->me4000_regbase_size);
 		len +=
 		    sprintf(buf + len, "Serial number = 0x%X\n",
 			    board_info->serial_no);
Signature · 1 line
1.6.0.2
#48 lore raw

PATCH 42/42 Staging: usbip: fix build warning on 64bit kernels

In reply to Greg KH
---
 drivers/staging/usbip/vhci_rx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/usbip/vhci_rx.c +1 -1
index 933ccaf..58e3995 100644
@@ -202,7 +202,7 @@ static void vhci_rx_pdu(struct usbip_device *ud)
 	ret = usbip_xmit(0, ud->tcp_socket, (char *) &pdu, sizeof(pdu), 0);
 	if (ret != sizeof(pdu)) {
 		uerr("receiving pdu failed! size is %d, should be %d\n",
-				ret, sizeof(pdu));
+				ret, (unsigned int)sizeof(pdu));
 		usbip_event_add(ud, VDEV_EVENT_ERROR_TCP);
 		return;
 	}
Signature · 1 line
1.6.0.2