Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Staging: vt6656 ?

16 views
Skip to first unread message

Alexander Beregalov

unread,
Jun 9, 2009, 6:50:27 AM6/9/09
to
Hi Greg, Forest

Are you going to merge driver for VT6656 also?

I have a limited access to this hardware and can help to cleanup it.

http://www.viaarena.com/Driver/VT6656_Linux_src_v1.19_12_x86.zip
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Greg KH

unread,
Jun 9, 2009, 7:00:15 AM6/9/09
to
On Tue, Jun 09, 2009 at 02:31:30PM +0400, Alexander Beregalov wrote:
> Hi Greg, Forest
>
> Are you going to merge driver for VT6656 also?

If someone sends me some patches for it, sure, I will.

thanks,

greg k-h

Forest Bond

unread,
Jun 9, 2009, 7:50:07 AM6/9/09
to
Hi,

On Tue, Jun 09, 2009 at 03:51:01AM -0700, Greg KH wrote:
> On Tue, Jun 09, 2009 at 02:31:30PM +0400, Alexander Beregalov wrote:
> > Hi Greg, Forest
> >
> > Are you going to merge driver for VT6656 also?
>
> If someone sends me some patches for it, sure, I will.

I have patches almost ready. I'll send them by the end of next week at the
latest. Busy week here.

-Forest
--
Forest Bond
http://www.alittletooquiet.net
http://www.pytagsfs.org

signature.asc

Bartlomiej Zolnierkiewicz

unread,
Jun 28, 2009, 9:40:29 AM6/28/09
to

Hi,

On Tuesday 09 June 2009 13:33:43 Forest Bond wrote:
> Hi,
>
> On Tue, Jun 09, 2009 at 03:51:01AM -0700, Greg KH wrote:
> > On Tue, Jun 09, 2009 at 02:31:30PM +0400, Alexander Beregalov wrote:
> > > Hi Greg, Forest
> > >
> > > Are you going to merge driver for VT6656 also?
> >
> > If someone sends me some patches for it, sure, I will.
>
> I have patches almost ready. I'll send them by the end of next week at the
> latest. Busy week here.

Did I miss the patch? There are people already doing cleanups for VT6655
driver (which seems to share a great deal of code with VT6656 driver) so
it would greatly help to get VT6656 merged ASAP and merge the shared code
first to not duplicate efforts.

Also if you need some help with integrating the driver or hosting patches
in git tree at kernel.org before Greg picks them up [ he seems to be buried
alive by patches at the moment :) ] I'll be happy to help..

Thanks,
Bart

Forest Bond

unread,
Jun 28, 2009, 10:00:22 AM6/28/09
to
Hi,

On Sun, Jun 28, 2009 at 03:43:12PM +0200, Bartlomiej Zolnierkiewicz wrote:
>
> Hi,
>
> On Tuesday 09 June 2009 13:33:43 Forest Bond wrote:
> > Hi,
> >
> > On Tue, Jun 09, 2009 at 03:51:01AM -0700, Greg KH wrote:
> > > On Tue, Jun 09, 2009 at 02:31:30PM +0400, Alexander Beregalov wrote:
> > > > Hi Greg, Forest
> > > >
> > > > Are you going to merge driver for VT6656 also?
> > >
> > > If someone sends me some patches for it, sure, I will.
> >
> > I have patches almost ready. I'll send them by the end of next week at the
> > latest. Busy week here.
>
> Did I miss the patch? There are people already doing cleanups for VT6655
> driver (which seems to share a great deal of code with VT6656 driver) so
> it would greatly help to get VT6656 merged ASAP and merge the shared code
> first to not duplicate efforts.
>
> Also if you need some help with integrating the driver or hosting patches
> in git tree at kernel.org before Greg picks them up [ he seems to be buried
> alive by patches at the moment :) ] I'll be happy to help..

I sent it to Greg about two weeks ago. I assume it is in his queue somewhere.

Let me know if you think I ought to do something else with them.

Thanks,

signature.asc

Bartlomiej Zolnierkiewicz

unread,
Jun 28, 2009, 12:00:15 PM6/28/09
to
On Sunday 28 June 2009 15:57:31 Forest Bond wrote:
> Hi,
>
> On Sun, Jun 28, 2009 at 03:43:12PM +0200, Bartlomiej Zolnierkiewicz wrote:
> >
> > Hi,
> >
> > On Tuesday 09 June 2009 13:33:43 Forest Bond wrote:
> > > Hi,
> > >
> > > On Tue, Jun 09, 2009 at 03:51:01AM -0700, Greg KH wrote:
> > > > On Tue, Jun 09, 2009 at 02:31:30PM +0400, Alexander Beregalov wrote:
> > > > > Hi Greg, Forest
> > > > >
> > > > > Are you going to merge driver for VT6656 also?
> > > >
> > > > If someone sends me some patches for it, sure, I will.
> > >
> > > I have patches almost ready. I'll send them by the end of next week at the
> > > latest. Busy week here.
> >
> > Did I miss the patch? There are people already doing cleanups for VT6655
> > driver (which seems to share a great deal of code with VT6656 driver) so
> > it would greatly help to get VT6656 merged ASAP and merge the shared code
> > first to not duplicate efforts.
> >
> > Also if you need some help with integrating the driver or hosting patches
> > in git tree at kernel.org before Greg picks them up [ he seems to be buried
> > alive by patches at the moment :) ] I'll be happy to help..
>
> I sent it to Greg about two weeks ago. I assume it is in his queue somewhere.

There seems to be a lot of stuff in his queue.. ;)

> Let me know if you think I ought to do something else with them.

Please re-post with cc:ing linux-kernel so people looking for them (i.e. me)
can pick them up from the list if needed (please also cc: lkml on all patches
in the future, thanks!).

[ I'll later setup vt665x branch of my misc.git tree, merge your patches,
merge all outstanding vt6655 patches from Alexander and investigate a bit
more whether merge of vt665x drivers is feasible and what needs to be
done if so.. ]

Thanks.

Forest Bond

unread,
Jun 28, 2009, 12:50:07 PM6/28/09
to
Howdie,

On Sun, Jun 28, 2009 at 09:29:53AM -0700, Greg KH wrote:


> On Sun, Jun 28, 2009 at 09:57:31AM -0400, Forest Bond wrote:
> > I sent it to Greg about two weeks ago. I assume it is in his queue somewhere.
> >
> > Let me know if you think I ought to do something else with them.
>

> Yes, sorry, I am burried in patches right now. I hope to dig out this
> week...

No need to apologize. Your work is appreciated!

-Forest

signature.asc

Greg KH

unread,
Jun 28, 2009, 12:50:07 PM6/28/09
to
On Sun, Jun 28, 2009 at 09:57:31AM -0400, Forest Bond wrote:
> Hi,
>
> On Sun, Jun 28, 2009 at 03:43:12PM +0200, Bartlomiej Zolnierkiewicz wrote:
> >
> > Hi,
> >
> > On Tuesday 09 June 2009 13:33:43 Forest Bond wrote:
> > > Hi,
> > >
> > > On Tue, Jun 09, 2009 at 03:51:01AM -0700, Greg KH wrote:
> > > > On Tue, Jun 09, 2009 at 02:31:30PM +0400, Alexander Beregalov wrote:
> > > > > Hi Greg, Forest
> > > > >
> > > > > Are you going to merge driver for VT6656 also?
> > > >
> > > > If someone sends me some patches for it, sure, I will.
> > >
> > > I have patches almost ready. I'll send them by the end of next week at the
> > > latest. Busy week here.
> >
> > Did I miss the patch? There are people already doing cleanups for VT6655
> > driver (which seems to share a great deal of code with VT6656 driver) so
> > it would greatly help to get VT6656 merged ASAP and merge the shared code
> > first to not duplicate efforts.
> >
> > Also if you need some help with integrating the driver or hosting patches
> > in git tree at kernel.org before Greg picks them up [ he seems to be buried
> > alive by patches at the moment :) ] I'll be happy to help..
>
> I sent it to Greg about two weeks ago. I assume it is in his queue somewhere.
>
> Let me know if you think I ought to do something else with them.

Yes, sorry, I am burried in patches right now. I hope to dig out this
week...

All them are not lost, don't worry.

thanks,

greg k-h

Forest Bond

unread,
Jun 28, 2009, 12:50:15 PM6/28/09
to
Hi,

Okay. The first patch is quite large, so I will compress it.

> [ I'll later setup vt665x branch of my misc.git tree, merge your patches,
> merge all outstanding vt6655 patches from Alexander and investigate a bit
> more whether merge of vt665x drivers is feasible and what needs to be
> done if so.. ]

Good.

FYI, there is a known issue with the drivers as I've submitted them that causes
lock-ups. Please see the attached message for a suggested fix.

eml.txt
signature.asc

Forest Bond

unread,
Jun 28, 2009, 1:10:14 PM6/28/09
to
[Greg: This patch series does not differ from that which you already have.]

vt6656: use net_device_ops for management functions

Signed-off-by: Forest Bond <for...@alittletooquiet.net>
---
drivers/staging/vt6656/hostap.c | 7 ++++++-
drivers/staging/vt6656/main_usb.c | 19 +++++++++++++------
2 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/vt6656/hostap.c b/drivers/staging/vt6656/hostap.c
index b6ca36a..223604d 100644
--- a/drivers/staging/vt6656/hostap.c
+++ b/drivers/staging/vt6656/hostap.c
@@ -117,7 +117,12 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)
apdev_priv = netdev_priv(pDevice->apdev);
*apdev_priv = *pDevice;
memcpy(pDevice->apdev->dev_addr, dev->dev_addr, ETH_ALEN);
- pDevice->apdev->hard_start_xmit = pDevice->tx_80211;
+
+ const struct net_device_ops apdev_netdev_ops = {
+ .ndo_start_xmit = pDevice->tx_80211,
+ };
+ pDevice->apdev->netdev_ops = &apdev_netdev_ops;
+
pDevice->apdev->type = ARPHRD_IEEE80211;

pDevice->apdev->base_addr = dev->base_addr;
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index 12a9ae0..228b3ec 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -837,6 +837,17 @@ static int vntwusb_resume(struct usb_interface *intf)
}
#endif

+
+static const struct net_device_ops device_netdev_ops = {
+ .ndo_open = device_open,
+ .ndo_stop = device_close,
+ .ndo_do_ioctl = device_ioctl,
+ .ndo_get_stats = device_get_stats,
+ .ndo_start_xmit = device_xmit,
+ .ndo_set_multicast_list = device_set_multi,
+};
+
+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)

static int
@@ -896,12 +907,8 @@ vntwusb_found1(struct usb_device *udev, UINT interface, const struct usb_device_
pDevice->tx_80211 = device_dma0_tx_80211;
pDevice->sMgmtObj.pAdapter = (PVOID)pDevice;

- netdev->open = device_open;
- netdev->hard_start_xmit = device_xmit;
- netdev->stop = device_close;
- netdev->get_stats = device_get_stats;
- netdev->set_multicast_list = device_set_multi;
- netdev->do_ioctl = device_ioctl;
+ netdev->netdev_ops = &device_netdev_ops;
+
#ifdef WIRELESS_EXT

//2007-0508-01<Add>by MikeLiu
--
1.5.6.3

signature.asc

Forest Bond

unread,
Jun 28, 2009, 1:10:13 PM6/28/09
to
[Greg: This patch series does not differ from that which you already have.]

Integrate drivers/staging/vt6656 into build system.

Signed-off-by: Forest Bond <for...@alittletooquiet.net>
---

drivers/staging/Kconfig | 2 +
drivers/staging/Makefile | 1 +
drivers/staging/vt6656/Kconfig | 5 +
drivers/staging/vt6656/Makefile | 243 ++++++--------------------------------
4 files changed, 47 insertions(+), 204 deletions(-)
create mode 100644 drivers/staging/vt6656/Kconfig

diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index cefb74f..53fafc0 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -127,5 +127,7 @@ source "drivers/staging/udlfb/Kconfig"

source "drivers/staging/octeon/Kconfig"

+source "drivers/staging/vt6656/Kconfig"
+
endif # !STAGING_EXCLUDE_BUILD
endif # STAGING
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index d110f6f..a1ce926 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -46,3 +46,4 @@ obj-$(CONFIG_USB_CPC) += cpc-usb/
obj-$(CONFIG_RDC_17F3101X) += pata_rdc/
obj-$(CONFIG_FB_UDL) += udlfb/
obj-$(CONFIG_OCTEON_ETHERNET) += octeon/
+obj-$(CONFIG_VT6656) += vt6656/
diff --git a/drivers/staging/vt6656/Kconfig b/drivers/staging/vt6656/Kconfig
new file mode 100644
index 0000000..f823a74
--- /dev/null
+++ b/drivers/staging/vt6656/Kconfig
@@ -0,0 +1,5 @@
+config VT6656
+ tristate "VIA Technologies VT6656 support"
+ ---help---
+ This is a vendor-written driver for VIA VT6656.
+
diff --git a/drivers/staging/vt6656/Makefile b/drivers/staging/vt6656/Makefile
index 7d20efe..4467bb1 100644
--- a/drivers/staging/vt6656/Makefile
+++ b/drivers/staging/vt6656/Makefile
@@ -1,204 +1,39 @@
-#
-# Build options:
-#
-#
-
-HOSTAP := 1
-
-
-KSP := /lib/modules/$(shell uname -r)/build \
- /usr/src/linux-$(shell uname -r) \
- /usr/src/linux-$(shell uname -r | sed 's/-.*//') \
- /usr/src/kernel-headers-$(shell uname -r) \
- /usr/src/kernel-source-$(shell uname -r) \
- /usr/src/linux-$(shell uname -r | sed 's/\([0-9]*\.[0-9]*\)\..*/\1/') \
- /usr/src/linux
-
-test_dir = $(shell [ -e $(dir)/include/linux ] && echo $(dir))
-KSP := $(foreach dir, $(KSP), $(test_dir))
-
-KSRC := $(firstword $(KSP))
-
-ifeq (,$(KSRC))
- $(error Linux kernel source not found)
-endif
-
-# check kernel version
-KVER := $(shell uname -r | cut -c1-3 | sed 's/2\.[56]/2\.6/')
-KERVER2=$(shell uname -r | cut -d. -f2)
-
-ifeq ($(KVER), 2.6)
-# 2.6 kernel
-TARGET = vntwusb.ko
-
-else
-TARGET = vntwusb.o
-
-endif
-
-INSTDIR := $(shell find /lib/modules/$(shell uname -r) -name $(TARGET) -printf "%h\n" | sort | head -1)
-ifeq (,$(INSTDIR))
- ifeq (,$(KERVER2))
- ifneq (,$(wildcard /lib/modules/$(shell uname -r)/kernel))
- INSTDIR := /lib/modules/$(shell uname -r)/kernel/drivers/net
- else
- INSTDIR := /lib/modules/$(shell uname -r)/net
- endif
- else
- ifneq ($(KERVER2),2)
- INSTDIR := /lib/modules/$(shell uname -r)/kernel/drivers/net
- else
- INSTDIR := /lib/modules/$(shell uname -r)/net
- endif
- endif
-endif
-
-
-SRC = main_usb.c card.c mac.c baseband.c wctl.c 80211mgr.c \
- wcmd.c wmgr.c bssdb.c wpa2.c rxtx.c dpc.c power.c datarate.c \
- mib.c rc4.c tether.c tcrc.c ioctl.c hostap.c wpa.c key.c \
- tkip.c michael.c rf.c iwctl.c wpactl.c aes_ccmp.c \
- usbpipe.c channel.c control.c firmware.c int.c
-
-
-ifeq ($(HOSTAP), 1)
-# CFLAGS += -DHOSTAP
- EXTRA_CFLAGS += -DHOSTAP
-endif
-
-
-#CFLAGS += -I$(PWD) -I$(PWD)/../include -I$(PWD)/include
-EXTRA_CFLAGS += -I$(PWD) -I$(PWD)/../include -I$(PWD)/include
-
-# build rule
-ifeq ($(KVER), 2.6)
-# 2.6 kernel
-
-ifndef KERNEL_CONF
-KERNEL_CONF= $(KSRC)/.config
-endif
-
-include ${KERNEL_CONF}
-
-obj-m += vntwusb.o
-
-vntwusb-objs := main_usb.o card.o mac.o baseband.o wctl.o 80211mgr.o \
- wcmd.o wmgr.o bssdb.o rxtx.o dpc.o power.o datarate.o \
- mib.o rc4.o tether.o tcrc.o ioctl.o hostap.o wpa.o key.o tkip.o \
- michael.o rf.o iwctl.o wpactl.o wpa2.o aes_ccmp.o \
- usbpipe.o channel.o control.o firmware.o int.o
-
-.c.o:
-# $(CC) $(CFLAGS) -o $@ $<
- $(CC) $(EXTRA_CFLAGS) -o $@ $<
-
-default:
- make -C $(KSRC) SUBDIRS=$(shell pwd) modules
-
-else
-
-# 2.2/2.4 kernel
-OBJS := main_usb.o card.o mac.o baseband.o wctl.o 80211mgr.o \
- wcmd.o wmgr.o bssdb.o rxtx.o dpc.o power.o datarate.o \
- mib.o rc4.o tether.o tcrc.o ioctl.o hostap.o wpa.o key.o tkip.o \
- michael.o rf.o iwctl.o wpactl.o wpa2.o aes_ccmp.o \
- usbpipe.o channel.o control.o
-
-VERSION_FILE := $(KSRC)/include/linux/version.h
-CONFIG_FILE := $(KSRC)/include/linux/config.h
-
-
-ifeq (,$(wildcard $(VERSION_FILE)))
- $(error Linux kernel source not configured - missing version.h)
-endif
-
-ifeq (,$(wildcard $(CONFIG_FILE)))
- $(error Linux kernel source not configured - missing config.h)
-endif
-
-ifneq (,$(findstring egcs-2.91.66, $(shell cat /proc/version)))
- CC := kgcc gcc cc
-else
- CC := gcc cc
-endif
-
-test_cc = $(shell which $(cc) > /dev/null 2>&1 && echo $(cc))
-CC := $(foreach cc, $(CC), $(test_cc))
-CC := $(firstword $(CC))
-
-#CFLAGS += -Wall -DLINUX -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -D__NO_VERSION__ -O2 -pipe
-#CFLAGS += -I$(KSRC)/include -Wstrict-prototypes -fomit-frame-pointer -fno-strict-aliasing
-#CFLAGS += $(shell [ -f $(KSRC)/include/linux/modversions.h ] && \
-# echo "-DMODVERSIONS -include $(KSRC)/include/linux/modversions.h")
-EXTRA_CFLAGS += -Wall -DLINUX -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -D__NO_VERSION__ -O2 -pipe
-EXTRA_CFLAGS += -I$(KSRC)/include -Wstrict-prototypes -fomit-frame-pointer -fno-strict-aliasing
-EXTRA_CFLAGS += $(shell [ -f $(KSRC)/include/linux/modversions.h ] && \
- echo "-DMODVERSIONS -include $(KSRC)/include/linux/modversions.h")
-
-.SILENT: $(TARGET) clean
-
-
-# look for SMP in config.h
-#SMP := $(shell $(CC) $(CFLAGS) -E -dM $(CONFIG_FILE) | \
-# grep CONFIG_SMP | awk '{ print $$3 }')
-SMP := $(shell $(CC) $(EXTRA_CFLAGS) -E -dM $(CONFIG_FILE) | \
- grep CONFIG_SMP | awk '{ print $$3 }')
-ifneq ($(SMP),1)
- SMP := 0
-endif
-
-
-ifeq ($(SMP), 1)
-# CFLAGS += -D__SMP__
- EXTRA_CFLAGS += -D__SMP__
-endif
-
-
-
-# check x86_64
-SUBARCH := $(shell uname -m)
-ifeq ($(SUBARCH),x86_64)
-# CFLAGS += -mcmodel=kernel -mno-red-zone
- EXTRA_CFLAGS += -mcmodel=kernel -mno-red-zone
-endif
-
-
-$(TARGET): $(filter-out $(TARGET), $(SRC:.c=.o))
- $(LD) -r $^ -o $@
- echo; echo
- echo "**************************************************"
- echo "Build options:"
- echo " VERSION $(KVER)"
- echo -n " SMP "
- if [ "$(SMP)" = "1" ]; \
- then echo "Enabled"; else echo "Disabled"; fi
-
-
-
-endif # ifeq ($(KVER),2.6)
-
-
-ifeq ($(KVER), 2.6)
-install: default
-else
-install: clean $(TARGET)
-endif
- mkdir -p $(MOD_ROOT)$(INSTDIR)
- install -m 644 -o root $(TARGET) $(MOD_ROOT)$(INSTDIR)
-
-ifeq (,$(MOD_ROOT))
- /sbin/depmod -a || true
-else
- /sbin/depmod -b $(MOD_ROOT) -a || true
-endif
-
-
-uninstall:
- rm -f $(INSTDIR)/$(TARGET)
- /sbin/depmod -a
-
-clean:
- rm -f $(TARGET) $(SRC:.c=.o) *~ *.o
- rm -f .*.o.d .*.o.cmd .*.ko.cmd *.mod.c *.mod.o
-
--include .depend.mak
+# TODO: all of these should be removed
+EXTRA_CFLAGS += -DLINUX -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -D__NO_VERSION__
+EXTRA_CFLAGS += -DHOSTAP
+
+vt6656-y += main_usb.o \
+ card.o \
+ mac.o \
+ baseband.o \
+ wctl.o \
+ 80211mgr.o \
+ wcmd.o\
+ wmgr.o \
+ bssdb.o \
+ wpa2.o \
+ rxtx.o \
+ dpc.o \
+ power.o \
+ datarate.o \
+ mib.o \
+ rc4.o \
+ tether.o \
+ tcrc.o \
+ ioctl.o \
+ hostap.o \
+ wpa.o \
+ key.o \
+ tkip.o \
+ michael.o \
+ rf.o \
+ iwctl.o \
+ wpactl.o \
+ aes_ccmp.o \
+ usbpipe.o \
+ channel.o \
+ control.o \
+ firmware.o \
+ int.o
+
+obj-$(CONFIG_VT6656) += vt6656.o

signature.asc

Forest Bond

unread,
Jun 28, 2009, 1:10:12 PM6/28/09
to
[Greg: This patch series does not differ from that which you already have.]

vt6656: replace call to info with printk call.

Signed-off-by: Forest Bond <for...@alittletooquiet.net>
---

drivers/staging/vt6656/main_usb.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index 228b3ec..722b739 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -2392,7 +2392,7 @@ static struct usb_driver vntwusb_driver = {

static int __init vntwusb_init_module(void)
{
- info(DEVICE_FULL_DRV_NAM " " DEVICE_VERSION);
+ printk(KERN_NOTICE DEVICE_FULL_DRV_NAM " " DEVICE_VERSION);
return usb_register(&vntwusb_driver);

signature.asc

Forest Bond

unread,
Jun 28, 2009, 1:10:13 PM6/28/09
to
[Greg: This patch series does not differ from that which you already have.]

drivers/staging/vt6656/main_usb.c: Drop obsolete fsuid/fsgid accesses.

Signed-off-by: Forest Bond <for...@alittletooquiet.net>
---

drivers/staging/vt6656/main_usb.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index 3368e83..f181d23 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -1655,15 +1655,17 @@ static UCHAR *Config_FileOperation(PSDevice pDevice) {
UCHAR *buffer=NULL;
struct file *filp=NULL;
mm_segment_t old_fs = get_fs();
- int oldfsuid=0,oldfsgid=0;
+ //int oldfsuid=0,oldfsgid=0;
int result=0;

set_fs (KERNEL_DS);
-//Make sure a caller can read or write power as root
- oldfsuid=current->fsuid;
- oldfsgid=current->fsgid;
+ /* Can't do this anymore, so we rely on correct filesystem permissions:
+ //Make sure a caller can read or write power as root
+ oldfsuid=current->fsuid;
+ oldfsgid=current->fsgid;
current->fsuid = 0;
current->fsgid = 0;
+ */

//open file
filp = filp_open(config_path, O_RDWR, 0);
@@ -1697,8 +1699,11 @@ error1:

error2:
set_fs (old_fs);
+
+ /*
current->fsuid=oldfsuid;
current->fsgid=oldfsgid;
+ */

if(result!=0) {
if(buffer)

signature.asc

Forest Bond

unread,
Jun 28, 2009, 1:10:14 PM6/28/09
to
[Greg: This patch series does not differ from that which you already have.]

Build vt6656.ko, not vntwusb.ko.

Signed-off-by: Forest Bond <for...@alittletooquiet.net>
---

drivers/staging/vt6656/device_cfg.h | 2 +-


1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/vt6656/device_cfg.h b/drivers/staging/vt6656/device_cfg.h
index c0492bd..f272c98 100644
--- a/drivers/staging/vt6656/device_cfg.h
+++ b/drivers/staging/vt6656/device_cfg.h
@@ -89,7 +89,7 @@ struct _version {
#define VCAM_SIZE 32
#define TX_QUEUE_NO 8

-#define DEVICE_NAME "vntwusb"
+#define DEVICE_NAME "vt6656"
#define DEVICE_FULL_DRV_NAM "VIA Networking Wireless LAN USB Driver"

#ifndef MAJOR_VERSION

signature.asc

Forest Bond

unread,
Jun 28, 2009, 1:10:11 PM6/28/09
to
[Greg: This patch series does not differ from that which you already have.]

Add includes to drivers/staging/vt6656. These came from the includes directory
in the upstream source archive. Trailing whitespace was stripped. This is
GPL-licensed code.

Signed-off-by: Forest Bond <for...@alittletooquiet.net>
---

drivers/staging/vt6656/device_cfg.h | 146 +++++++++++
drivers/staging/vt6656/iocmd.h | 478 +++++++++++++++++++++++++++++++++++
drivers/staging/vt6656/iowpa.h | 159 ++++++++++++
drivers/staging/vt6656/ttype.h | 11 +-
4 files changed, 791 insertions(+), 3 deletions(-)
create mode 100644 drivers/staging/vt6656/device_cfg.h
create mode 100644 drivers/staging/vt6656/iocmd.h
create mode 100644 drivers/staging/vt6656/iowpa.h

diff --git a/drivers/staging/vt6656/device_cfg.h b/drivers/staging/vt6656/device_cfg.h
new file mode 100644
index 0000000..c0492bd
--- /dev/null
+++ b/drivers/staging/vt6656/device_cfg.h
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * File: device_cfg.h
+ *
+ * Purpose: Driver configuration header
+ * Author: Lyndon Chen
+ *
+ * Date: Dec 9, 2005
+ *
+ */
+#ifndef __DEVICE_CONFIG_H
+#define __DEVICE_CONFIG_H
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
+#include <linux/config.h>
+#endif
+
+#include <linux/types.h>
+
+#if !defined(__TTYPE_H__)
+#include "ttype.h"
+#endif
+
+
+
+typedef __u8 UINT8, *PUINT8;
+typedef __u16 UINT16, *PUINT16;
+typedef __u32 UINT32, *PUINT32;
+
+
+#ifndef VOID
+#define VOID void
+#endif
+
+#ifndef CONST
+#define CONST const
+#endif
+
+#ifndef STATIC
+#define STATIC static
+#endif
+
+#ifndef DEF
+#define DEF
+#endif
+
+#ifndef IN
+#define IN
+#endif
+
+#ifndef OUT
+#define OUT
+#endif
+
+typedef
+struct _version {
+ UINT8 major;
+ UINT8 minor;
+ UINT8 build;
+} version_t, *pversion_t;
+
+#ifndef FALSE
+#define FALSE (0)
+#endif
+
+#ifndef TRUE
+#define TRUE (!(FALSE))
+#endif
+
+#define VID_TABLE_SIZE 64
+#define MCAST_TABLE_SIZE 64
+#define MCAM_SIZE 32
+#define VCAM_SIZE 32
+#define TX_QUEUE_NO 8
+
+#define DEVICE_NAME "vntwusb"
+#define DEVICE_FULL_DRV_NAM "VIA Networking Wireless LAN USB Driver"
+
+#ifndef MAJOR_VERSION
+#define MAJOR_VERSION 1
+#endif
+
+#ifndef MINOR_VERSION
+#define MINOR_VERSION 13
+#endif
+
+#ifndef DEVICE_VERSION
+#define DEVICE_VERSION "1.19_12"
+#endif
+
+//config file
+#include <linux/fs.h>
+#include <linux/fcntl.h>
+#ifndef CONFIG_PATH
+#define CONFIG_PATH "/etc/vntconfiguration.dat"
+#endif
+
+//Max: 2378=2312Payload + 30HD +4CRC + 2Padding + 4Len + 8TSF + 4RSR
+#define PKT_BUF_SZ 2390
+
+
+#define MALLOC(x,y) kmalloc((x),(y))
+#define FREE(x) kfree((x))
+#define MAX_UINTS 8
+#define OPTION_DEFAULT { [0 ... MAX_UINTS-1] = -1}
+
+
+
+typedef enum _chip_type{
+ VT3184=1
+} CHIP_TYPE, *PCHIP_TYPE;
+
+
+
+#ifdef VIAWET_DEBUG
+#define ASSERT(x) { \
+ if (!(x)) { \
+ printk(KERN_ERR "assertion %s failed: file %s line %d\n", #x,\
+ __FUNCTION__, __LINE__);\
+ *(int*) 0=0;\
+ }\
+}
+#define DBG_PORT80(value) outb(value, 0x80)
+#else
+#define ASSERT(x)
+#define DBG_PORT80(value)
+#endif
+
+
+#endif
diff --git a/drivers/staging/vt6656/iocmd.h b/drivers/staging/vt6656/iocmd.h
new file mode 100644
index 0000000..980031c
--- /dev/null
+++ b/drivers/staging/vt6656/iocmd.h
@@ -0,0 +1,478 @@
+/*
+ * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * File: iocmd.h
+ *
+ * Purpose: Handles the viawget ioctl private interface functions
+ *
+ * Author: Lyndon Chen
+ *
+ * Date: May 8, 2002
+ *
+ */
+
+#ifndef __IOCMD_H__
+#define __IOCMD_H__
+
+#if !defined(__TTYPE_H__)
+#include "ttype.h"
+#endif
+
+
+/*--------------------- Export Definitions -------------------------*/
+
+#if !defined(DEF)
+#define DEF
+#endif
+
+//typedef int BOOL;
+//typedef uint32_t u32;
+//typedef uint16_t u16;
+//typedef uint8_t u8;
+
+
+// ioctl Command code
+#define MAGIC_CODE 0x3142
+#define IOCTL_CMD_TEST (SIOCDEVPRIVATE + 0)
+#define IOCTL_CMD_SET (SIOCDEVPRIVATE + 1)
+#define IOCTL_CMD_HOSTAPD (SIOCDEVPRIVATE + 2)
+#define IOCTL_CMD_WPA (SIOCDEVPRIVATE + 3)
+
+
+typedef enum tagWMAC_CMD {
+
+ WLAN_CMD_BSS_SCAN,
+ WLAN_CMD_BSS_JOIN,
+ WLAN_CMD_DISASSOC,
+ WLAN_CMD_SET_WEP,
+ WLAN_CMD_GET_LINK,
+ WLAN_CMD_GET_LISTLEN,
+ WLAN_CMD_GET_LIST,
+ WLAN_CMD_GET_MIB,
+ WLAN_CMD_GET_STAT,
+ WLAN_CMD_STOP_MAC,
+ WLAN_CMD_START_MAC,
+ WLAN_CMD_AP_START,
+ WLAN_CMD_SET_HOSTAPD,
+ WLAN_CMD_SET_HOSTAPD_STA,
+ WLAN_CMD_SET_802_1X,
+ WLAN_CMD_SET_HOST_WEP,
+ WLAN_CMD_SET_WPA,
+ WLAN_CMD_GET_NODE_CNT,
+ WLAN_CMD_ZONETYPE_SET,
+ WLAN_CMD_GET_NODE_LIST
+
+} WMAC_CMD, DEF* PWMAC_CMD;
+
+typedef enum tagWZONETYPE {
+ ZoneType_USA=0,
+ ZoneType_Japan=1,
+ ZoneType_Europe=2
+}WZONETYPE;
+
+#define ADHOC 0
+#define INFRA 1
+#define BOTH 2
+#define AP 3
+
+#define ADHOC_STARTED 1
+#define ADHOC_JOINTED 2
+
+
+#define PHY80211a 0
+#define PHY80211b 1
+#define PHY80211g 2
+
+#define SSID_ID 0
+#define SSID_MAXLEN 32
+#define BSSID_LEN 6
+#define WEP_NKEYS 4
+#define WEP_KEYMAXLEN 29
+#define WEP_40BIT_LEN 5
+#define WEP_104BIT_LEN 13
+#define WEP_232BIT_LEN 16
+
+// Ioctl interface structure
+// Command structure
+//
+#pragma pack(1)
+typedef struct tagSCmdRequest {
+ U8 name[16];
+ void *data;
+ U16 wResult;
+ U16 wCmdCode;
+} SCmdRequest, *PSCmdRequest;
+
+//
+// Scan
+//
+
+typedef struct tagSCmdScan {
+
+ U8 ssid[SSID_MAXLEN + 2];
+
+} SCmdScan, *PSCmdScan;
+
+
+//
+// BSS Join
+//
+
+typedef struct tagSCmdBSSJoin {
+
+ U16 wBSSType;
+ U16 wBBPType;
+ U8 ssid[SSID_MAXLEN + 2];
+ U32 uChannel;
+ BOOL bPSEnable;
+ BOOL bShareKeyAuth;
+
+} SCmdBSSJoin, *PSCmdBSSJoin;
+
+//
+// Zonetype Setting
+//
+
+typedef struct tagSCmdZoneTypeSet {
+
+ BOOL bWrite;
+ WZONETYPE ZoneType;
+
+} SCmdZoneTypeSet, *PSCmdZoneTypeSet;
+
+#ifdef WPA_SM_Transtatus
+typedef struct tagSWPAResult {
+ char ifname[100];
+ U8 proto;
+ U8 key_mgmt;
+ U8 eap_type;
+ BOOL authenticated;
+} SWPAResult, *PSWPAResult;
+#endif
+
+typedef struct tagSCmdStartAP {
+
+ U16 wBSSType;
+ U16 wBBPType;
+ U8 ssid[SSID_MAXLEN + 2];
+ U32 uChannel;
+ U32 uBeaconInt;
+ BOOL bShareKeyAuth;
+ U8 byBasicRate;
+
+} SCmdStartAP, *PSCmdStartAP;
+
+
+typedef struct tagSCmdSetWEP {
+
+ BOOL bEnableWep;
+ U8 byKeyIndex;
+ U8 abyWepKey[WEP_NKEYS][WEP_KEYMAXLEN];
+ BOOL bWepKeyAvailable[WEP_NKEYS];
+ U32 auWepKeyLength[WEP_NKEYS];
+
+} SCmdSetWEP, *PSCmdSetWEP;
+
+
+
+typedef struct tagSBSSIDItem {
+
+ U32 uChannel;
+ U8 abyBSSID[BSSID_LEN];
+ U8 abySSID[SSID_MAXLEN + 1];
+ U16 wBeaconInterval;
+ U16 wCapInfo;
+ U8 byNetType;
+ BOOL bWEPOn;
+ U32 uRSSI;
+
+} SBSSIDItem;
+
+
+typedef struct tagSBSSIDList {
+
+ U32 uItem;
+ SBSSIDItem sBSSIDList[0];
+} SBSSIDList, *PSBSSIDList;
+
+
+typedef struct tagSNodeItem {
+ // STA info
+ U16 wAID;
+ U8 abyMACAddr[6];
+ U16 wTxDataRate;
+ U16 wInActiveCount;
+ U16 wEnQueueCnt;
+ U16 wFlags;
+ BOOL bPWBitOn;
+ U8 byKeyIndex;
+ U16 wWepKeyLength;
+ U8 abyWepKey[WEP_KEYMAXLEN];
+ // Auto rate fallback vars
+ BOOL bIsInFallback;
+ U32 uTxFailures;
+ U32 uTxAttempts;
+ U16 wFailureRatio;
+
+} SNodeItem;
+
+
+typedef struct tagSNodeList {
+
+ U32 uItem;
+ SNodeItem sNodeList[0];
+
+} SNodeList, *PSNodeList;
+
+
+typedef struct tagSCmdLinkStatus {
+
+ BOOL bLink;
+ U16 wBSSType;
+ U8 byState;
+ U8 abyBSSID[BSSID_LEN];
+ U8 abySSID[SSID_MAXLEN + 2];
+ U32 uChannel;
+ U32 uLinkRate;
+
+} SCmdLinkStatus, *PSCmdLinkStatus;
+
+//
+// 802.11 counter
+//
+typedef struct tagSDot11MIBCount {
+ U32 TransmittedFragmentCount;
+ U32 MulticastTransmittedFrameCount;
+ U32 FailedCount;
+ U32 RetryCount;
+ U32 MultipleRetryCount;
+ U32 RTSSuccessCount;
+ U32 RTSFailureCount;
+ U32 ACKFailureCount;
+ U32 FrameDuplicateCount;
+ U32 ReceivedFragmentCount;
+ U32 MulticastReceivedFrameCount;
+ U32 FCSErrorCount;
+} SDot11MIBCount, DEF* PSDot11MIBCount;
+
+
+
+//
+// statistic counter
+//
+typedef struct tagSStatMIBCount {
+ //
+ // ISR status count
+ //
+ U32 dwIsrTx0OK;
+ U32 dwIsrTx1OK;
+ U32 dwIsrBeaconTxOK;
+ U32 dwIsrRxOK;
+ U32 dwIsrTBTTInt;
+ U32 dwIsrSTIMERInt;
+ U32 dwIsrUnrecoverableError;
+ U32 dwIsrSoftInterrupt;
+ U32 dwIsrRxNoBuf;
+ /////////////////////////////////////
+
+ U32 dwIsrUnknown; // unknown interrupt count
+
+ // RSR status count
+ //
+ U32 dwRsrFrmAlgnErr;
+ U32 dwRsrErr;
+ U32 dwRsrCRCErr;
+ U32 dwRsrCRCOk;
+ U32 dwRsrBSSIDOk;
+ U32 dwRsrADDROk;
+ U32 dwRsrICVOk;
+ U32 dwNewRsrShortPreamble;
+ U32 dwRsrLong;
+ U32 dwRsrRunt;
+
+ U32 dwRsrRxControl;
+ U32 dwRsrRxData;
+ U32 dwRsrRxManage;
+
+ U32 dwRsrRxPacket;
+ U32 dwRsrRxOctet;
+ U32 dwRsrBroadcast;
+ U32 dwRsrMulticast;
+ U32 dwRsrDirected;
+ // 64-bit OID
+ U32 ullRsrOK;
+
+ // for some optional OIDs (64 bits) and DMI support
+ U32 ullRxBroadcastBytes;
+ U32 ullRxMulticastBytes;
+ U32 ullRxDirectedBytes;
+ U32 ullRxBroadcastFrames;
+ U32 ullRxMulticastFrames;
+ U32 ullRxDirectedFrames;
+
+ U32 dwRsrRxFragment;
+ U32 dwRsrRxFrmLen64;
+ U32 dwRsrRxFrmLen65_127;
+ U32 dwRsrRxFrmLen128_255;
+ U32 dwRsrRxFrmLen256_511;
+ U32 dwRsrRxFrmLen512_1023;
+ U32 dwRsrRxFrmLen1024_1518;
+
+ // TSR0,1 status count
+ //
+ U32 dwTsrTotalRetry[2]; // total collision retry count
+ U32 dwTsrOnceRetry[2]; // this packet only occur one collision
+ U32 dwTsrMoreThanOnceRetry[2]; // this packet occur more than one collision
+ U32 dwTsrRetry[2]; // this packet has ever occur collision,
+ // that is (dwTsrOnceCollision0 + dwTsrMoreThanOnceCollision0)
+ U32 dwTsrACKData[2];
+ U32 dwTsrErr[2];
+ U32 dwAllTsrOK[2];
+ U32 dwTsrRetryTimeout[2];
+ U32 dwTsrTransmitTimeout[2];
+
+ U32 dwTsrTxPacket[2];
+ U32 dwTsrTxOctet[2];
+ U32 dwTsrBroadcast[2];
+ U32 dwTsrMulticast[2];
+ U32 dwTsrDirected[2];
+
+ // RD/TD count
+ U32 dwCntRxFrmLength;
+ U32 dwCntTxBufLength;
+
+ U8 abyCntRxPattern[16];
+ U8 abyCntTxPattern[16];
+
+ // Software check....
+ U32 dwCntRxDataErr; // rx buffer data software compare CRC err count
+ U32 dwCntDecryptErr; // rx buffer data software compare CRC err count
+ U32 dwCntRxICVErr; // rx buffer data software compare CRC err count
+ U32 idxRxErrorDesc; // index for rx data error RD
+
+ // 64-bit OID
+ U32 ullTsrOK[2];
+
+ // for some optional OIDs (64 bits) and DMI support
+ U32 ullTxBroadcastFrames[2];
+ U32 ullTxMulticastFrames[2];
+ U32 ullTxDirectedFrames[2];
+ U32 ullTxBroadcastBytes[2];
+ U32 ullTxMulticastBytes[2];
+ U32 ullTxDirectedBytes[2];
+} SStatMIBCount, DEF* PSStatMIBCount;
+
+
+
+
+typedef struct tagSCmdValue {
+
+ U32 dwValue;
+
+} SCmdValue, *PSCmdValue;
+
+
+//
+// hostapd & viawget ioctl related
+//
+
+
+// VIAGWET_IOCTL_HOSTAPD ioctl() cmd:
+enum {
+ VIAWGET_HOSTAPD_FLUSH = 1,
+ VIAWGET_HOSTAPD_ADD_STA = 2,
+ VIAWGET_HOSTAPD_REMOVE_STA = 3,
+ VIAWGET_HOSTAPD_GET_INFO_STA = 4,
+ VIAWGET_HOSTAPD_SET_ENCRYPTION = 5,
+ VIAWGET_HOSTAPD_GET_ENCRYPTION = 6,
+ VIAWGET_HOSTAPD_SET_FLAGS_STA = 7,
+ VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR = 8,
+ VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT = 9,
+ VIAWGET_HOSTAPD_MLME = 10,
+ VIAWGET_HOSTAPD_SCAN_REQ = 11,
+ VIAWGET_HOSTAPD_STA_CLEAR_STATS = 12,
+};
+
+
+#define VIAWGET_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \
+((int) (&((struct viawget_hostapd_param *) 0)->u.generic_elem.data))
+
+// Maximum length for algorithm names (-1 for nul termination) used in ioctl()
+
+
+
+struct viawget_hostapd_param {
+ U32 cmd;
+ U8 sta_addr[6];
+ union {
+ struct {
+ U16 aid;
+ U16 capability;
+ U8 tx_supp_rates;
+ } add_sta;
+ struct {
+ U32 inactive_sec;
+ } get_info_sta;
+ struct {
+ U8 alg;
+ U32 flags;
+ U32 err;
+ U8 idx;
+ U8 seq[8];
+ U16 key_len;
+ U8 key[0];
+ } crypt;
+ struct {
+ U32 flags_and;
+ U32 flags_or;
+ } set_flags_sta;
+ struct {
+ U16 rid;
+ U16 len;
+ U8 data[0];
+ } rid;
+ struct {
+ U8 len;
+ U8 data[0];
+ } generic_elem;
+ struct {
+ U16 cmd;
+ U16 reason_code;
+ } mlme;
+ struct {
+ U8 ssid_len;
+ U8 ssid[32];
+ } scan_req;
+ } u;
+};
+
+
+
+/*--------------------- Export Classes ----------------------------*/
+
+/*--------------------- Export Variables --------------------------*/
+
+
+/*--------------------- Export Types ------------------------------*/
+
+
+/*--------------------- Export Functions --------------------------*/
+
+
+
+#endif //__IOCMD_H__
diff --git a/drivers/staging/vt6656/iowpa.h b/drivers/staging/vt6656/iowpa.h
new file mode 100644
index 0000000..05f391a
--- /dev/null
+++ b/drivers/staging/vt6656/iowpa.h
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * File: iowpa.h
+ *
+ * Purpose: Handles wpa supplicant ioctl interface
+ *
+ * Author: Lyndon Chen
+ *
+ * Date: May 8, 2002
+ *
+ */
+
+#ifndef __IOWPA_H__
+#define __IOWPA_H__
+
+
+/*--------------------- Export Definitions -------------------------*/
+
+
+#define WPA_IE_LEN 64
+
+
+//WPA related
+/*
+typedef enum { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP } wpa_alg;
+typedef enum { CIPHER_NONE, CIPHER_WEP40, CIPHER_TKIP, CIPHER_CCMP,
+ CIPHER_WEP104 } wpa_cipher;
+typedef enum { KEY_MGMT_802_1X, KEY_MGMT_PSK, KEY_MGMT_NONE,
+ KEY_MGMT_802_1X_NO_WPA, KEY_MGMT_WPA_NONE } wpa_key_mgmt;
+*/
+
+enum {
+ VIAWGET_SET_WPA = 1,
+ VIAWGET_SET_KEY = 2,
+ VIAWGET_SET_SCAN = 3,
+ VIAWGET_GET_SCAN = 4,
+ VIAWGET_GET_SSID = 5,
+ VIAWGET_GET_BSSID = 6,
+ VIAWGET_SET_DROP_UNENCRYPT = 7,
+ VIAWGET_SET_DEAUTHENTICATE = 8,
+ VIAWGET_SET_ASSOCIATE = 9,
+ VIAWGET_SET_DISASSOCIATE= 10
+};
+
+
+enum {
+ VIAWGET_ASSOC_MSG = 1,
+ VIAWGET_DISASSOC_MSG = 2,
+ VIAWGET_PTK_MIC_MSG = 3,
+ VIAWGET_GTK_MIC_MSG = 4,
+ VIAWGET_CCKM_ROAM_MSG = 5,
+ VIAWGET_DEVICECLOSE_MSG = 6
+};
+
+
+
+#pragma pack(1)
+typedef struct viawget_wpa_header {
+ u8 type;
+ u16 req_ie_len;
+ u16 resp_ie_len;
+} viawget_wpa_header;
+
+
+
+struct viawget_wpa_param {
+ u32 cmd;
+ u8 addr[6];
+ union {
+ struct {
+ u8 len;
+ u8 data[0];
+ } generic_elem;
+
+ struct {
+ u8 bssid[6];
+ u8 ssid[32];
+ u8 ssid_len;
+ u8 *wpa_ie;
+ u16 wpa_ie_len;
+ int pairwise_suite;
+ int group_suite;
+ int key_mgmt_suite;
+ int auth_alg;
+ int mode;
+ u8 roam_dbm; //DavidWang
+ } wpa_associate;
+
+ struct {
+ int alg_name;
+ u16 key_index;
+ u16 set_tx;
+ u8 *seq;
+ u16 seq_len;
+ u8 *key;
+ u16 key_len;
+ } wpa_key;
+
+ struct {
+ u8 ssid_len;
+ u8 ssid[32];
+ } scan_req;
+
+ struct {
+ u16 scan_count;
+ u8 *buf;
+ } scan_results;
+
+ } u;
+
+};
+
+#pragma pack(1)
+struct viawget_scan_result {
+ u8 bssid[6];
+ u8 ssid[32];
+ u16 ssid_len;
+ u8 wpa_ie[WPA_IE_LEN];
+ u16 wpa_ie_len;
+ u8 rsn_ie[WPA_IE_LEN];
+ u16 rsn_ie_len;
+ int freq; // MHz
+ int caps; // e.g. privacy
+ int qual; // signal quality
+ int noise;
+ int level;
+ int maxrate;
+};
+
+
+/*--------------------- Export Classes ----------------------------*/
+
+/*--------------------- Export Variables --------------------------*/
+
+
+/*--------------------- Export Types ------------------------------*/
+
+
+/*--------------------- Export Functions --------------------------*/
+
+
+
+#endif //__IOWPA_H__
diff --git a/drivers/staging/vt6656/ttype.h b/drivers/staging/vt6656/ttype.h
index c91a273..1e72f11 100644
--- a/drivers/staging/vt6656/ttype.h
+++ b/drivers/staging/vt6656/ttype.h
@@ -1,5 +1,6 @@
/*
- * File: ttype.h
+ * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
+ * All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,6 +16,8 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
+ * File: ttype.h
+ *
* Purpose: define basic common types and macros
*
* Author: Tevin Chen
@@ -50,18 +53,20 @@
#define OUT
#endif

-//2007-0115-04<Add>by MikeLiu
+//2007-0115-05<Add>by MikeLiu
#ifndef TxInSleep
#define TxInSleep
#endif

+//DavidWang
+

//2007-0814-01<Add>by MikeLiu
#ifndef Safe_Close
#define Safe_Close
#endif

-//2008-0131-01<Add>by MikeLiu
+//2008-0131-02<Add>by MikeLiu
#ifndef Adhoc_STA
#define Adhoc_STA
#endif

signature.asc

Forest Bond

unread,
Jun 28, 2009, 1:10:14 PM6/28/09
to
[Greg: This patch series does not differ from that which you already have.]

vt6656: Replace net_device->priv accesses with netdev_priv calls.

Signed-off-by: Forest Bond <for...@alittletooquiet.net>
---

drivers/staging/vt6656/hostap.c | 4 ++-
drivers/staging/vt6656/iwctl.c | 66 ++++++++++++++++++------------------
drivers/staging/vt6656/main_usb.c | 28 +++++++---------
drivers/staging/vt6656/wpactl.c | 6 ++-
4 files changed, 52 insertions(+), 52 deletions(-)

diff --git a/drivers/staging/vt6656/hostap.c b/drivers/staging/vt6656/hostap.c
index 78312f8..b6ca36a 100644
--- a/drivers/staging/vt6656/hostap.c
+++ b/drivers/staging/vt6656/hostap.c
@@ -103,6 +103,7 @@ static int msglevel =MSG_LEVEL_INFO;



static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)

{
+ PSDevice apdev_priv;
struct net_device *dev = pDevice->dev;
int ret;

@@ -113,7 +114,8 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)
return -ENOMEM;
memset(pDevice->apdev, 0, sizeof(struct net_device));

- pDevice->apdev->priv = pDevice;
+ apdev_priv = netdev_priv(pDevice->apdev);
+ *apdev_priv = *pDevice;


memcpy(pDevice->apdev->dev_addr, dev->dev_addr, ETH_ALEN);

pDevice->apdev->hard_start_xmit = pDevice->tx_80211;

pDevice->apdev->type = ARPHRD_IEEE80211;

diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c
index a2ca0e1..e6f8c18 100644
--- a/drivers/staging/vt6656/iwctl.c
+++ b/drivers/staging/vt6656/iwctl.c
@@ -113,7 +113,7 @@ static int msglevel =MSG_LEVEL_INFO;

struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev)
{
- PSDevice pDevice = dev->priv;
+ PSDevice pDevice = netdev_priv(dev);
long ldBm;

pDevice->wstats.status = pDevice->eOPMode;
@@ -172,7 +172,7 @@ static int iwctl_commit(struct net_device *dev,
//2008-0409-02, <Mark> by Einsn Liu
/*
#ifdef Safe_Close
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
if (!(pDevice->flags & DEVICE_FLAGS_OPENED))
return -EINVAL;
#endif
@@ -218,7 +218,7 @@ int iwctl_siwscan(struct net_device *dev,
struct iw_point *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
struct iw_scan_req *req = (struct iw_scan_req *)extra;
BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
@@ -299,7 +299,7 @@ int iwctl_giwscan(struct net_device *dev,
char *extra)
{
int ii, jj, kk;
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
PKnownBSS pBSS;
PWLAN_IE_SSID pItemSSID;
@@ -582,7 +582,7 @@ int iwctl_siwfreq(struct net_device *dev,
struct iw_freq *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
int rc = 0;

DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ \n");
@@ -625,7 +625,7 @@ int iwctl_giwfreq(struct net_device *dev,
struct iw_freq *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);

DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ \n");
@@ -655,7 +655,7 @@ int iwctl_siwmode(struct net_device *dev,
__u32 *wmode,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int rc = 0;

@@ -722,7 +722,7 @@ int iwctl_giwmode(struct net_device *dev,
__u32 *wmode,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);


@@ -764,7 +764,7 @@ int iwctl_giwrange(struct net_device *dev,
//2008-0409-02, <Mark> by Einsn Liu
/*
#ifdef Safe_Close
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
if (!(pDevice->flags & DEVICE_FLAGS_OPENED))
return -EINVAL;
#endif
@@ -883,7 +883,7 @@ int iwctl_siwap(struct net_device *dev,
struct sockaddr *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int rc = 0;
BYTE ZeroBSSID[WLAN_BSSID_LEN]={0x00,0x00,0x00,0x00,0x00,0x00};
@@ -934,7 +934,7 @@ int iwctl_giwap(struct net_device *dev,
struct sockaddr *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);


@@ -970,7 +970,7 @@ int iwctl_giwaplist(struct net_device *dev,
int ii,jj, rc = 0;
struct sockaddr sock[IW_MAX_AP];
struct iw_quality qual[IW_MAX_AP];
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);


@@ -1019,7 +1019,7 @@ int iwctl_siwessid(struct net_device *dev,
struct iw_point *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
PWLAN_IE_SSID pItemSSID;

@@ -1129,7 +1129,7 @@ int iwctl_giwessid(struct net_device *dev,
char *extra)
{

- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
PWLAN_IE_SSID pItemSSID;

@@ -1164,7 +1164,7 @@ int iwctl_siwrate(struct net_device *dev,
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
int rc = 0;
u8 brate = 0;
int i;
@@ -1246,7 +1246,7 @@ int iwctl_giwrate(struct net_device *dev,
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);

DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE \n");
@@ -1295,7 +1295,7 @@ int iwctl_siwrts(struct net_device *dev,
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
int rc = 0;

DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRTS \n");
@@ -1323,7 +1323,7 @@ int iwctl_giwrts(struct net_device *dev,
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);

DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS \n");
wrq->value = pDevice->wRTSThreshold;
@@ -1342,7 +1342,7 @@ int iwctl_siwfrag(struct net_device *dev,
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
int rc = 0;
int fthr = wrq->value;

@@ -1371,7 +1371,7 @@ int iwctl_giwfrag(struct net_device *dev,
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);

DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG \n");
wrq->value = pDevice->wFragmentationThreshold;
@@ -1391,7 +1391,7 @@ int iwctl_siwretry(struct net_device *dev,
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
int rc = 0;


@@ -1429,7 +1429,7 @@ int iwctl_giwretry(struct net_device *dev,
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY \n");
wrq->disabled = 0; // Can't be disabled

@@ -1460,7 +1460,7 @@ int iwctl_siwencode(struct net_device *dev,
struct iw_point *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
DWORD dwKeyIndex = (DWORD)(wrq->flags & IW_ENCODE_INDEX);
int ii,uu, rc = 0;
@@ -1570,7 +1570,7 @@ int iwctl_giwencode(struct net_device *dev,
struct iw_point *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int rc = 0;
char abyKey[WLAN_WEP232_KEYLEN];
@@ -1616,7 +1616,7 @@ int iwctl_giwencode(struct net_device *dev,
struct iw_point *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
char abyKey[WLAN_WEP232_KEYLEN];

@@ -1678,7 +1678,7 @@ int iwctl_siwpower(struct net_device *dev,
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int rc = 0;

@@ -1728,7 +1728,7 @@ int iwctl_giwpower(struct net_device *dev,
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int mode = pDevice->ePSMode;

@@ -1760,7 +1760,7 @@ int iwctl_giwsens(struct net_device *dev,
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
long ldBm;

DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS \n");
@@ -1786,7 +1786,7 @@ int iwctl_siwauth(struct net_device *dev,
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int ret=0;
static int wpa_version=0; //must be static to save the last value,einsn liu
@@ -1918,7 +1918,7 @@ int iwctl_siwgenie(struct net_device *dev,
struct iw_point *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int ret=0;

@@ -1951,7 +1951,7 @@ int iwctl_giwgenie(struct net_device *dev,
struct iw_point *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int ret=0;
int space = wrq->length;
@@ -1976,7 +1976,7 @@ int iwctl_siwencodeext(struct net_device *dev,
struct iw_point *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
struct iw_encode_ext *ext = (struct iw_encode_ext*)extra;
struct viawget_wpa_param *param=NULL;
@@ -2135,7 +2135,7 @@ int iwctl_siwmlme(struct net_device *dev,
struct iw_point *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
struct iw_mlme *mlme = (struct iw_mlme *)extra;
//u16 reason = cpu_to_le16(mlme->reason_code);
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index f181d23..12a9ae0 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -866,15 +866,8 @@ vntwusb_found1(struct usb_device *udev, UINT interface, const struct usb_device_
udev = usb_get_dev(udev);
#endif

- pDevice = kmalloc(sizeof(DEVICE_INFO), GFP_KERNEL);
- if (pDevice == NULL) {
- printk(KERN_ERR DEVICE_NAME ": allocate usb device failed \n");
- goto err_nomem;
- }
- memset(pDevice, 0, sizeof(DEVICE_INFO));
-
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
- netdev = alloc_etherdev(0);
+ netdev = alloc_etherdev(sizeof(DEVICE_INFO));
#else
netdev = init_etherdev(netdev, 0);
#endif
@@ -884,6 +877,10 @@ vntwusb_found1(struct usb_device *udev, UINT interface, const struct usb_device_
kfree(pDevice);
goto err_nomem;
}
+
+ pDevice = netdev_priv(netdev);
+ memset(pDevice, 0, sizeof(DEVICE_INFO));
+
pDevice->dev = netdev;
pDevice->usb = udev;

@@ -899,7 +896,6 @@ vntwusb_found1(struct usb_device *udev, UINT interface, const struct usb_device_


pDevice->tx_80211 = device_dma0_tx_80211;
pDevice->sMgmtObj.pAdapter = (PVOID)pDevice;

- netdev->priv = pDevice;
netdev->open = device_open;
netdev->hard_start_xmit = device_xmit;
netdev->stop = device_close;
@@ -1205,7 +1201,7 @@ BOOL device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF) {
/*-----------------------------------------------------------------*/

static int device_open(struct net_device *dev) {
- PSDevice pDevice=(PSDevice) dev->priv;
+ PSDevice pDevice=(PSDevice) netdev_priv(dev);

#ifdef WPA_SM_Transtatus
extern SWPAResult wpa_Result;
@@ -1348,7 +1344,7 @@ free_rx_tx:


static int device_close(struct net_device *dev) {
- PSDevice pDevice=(PSDevice) dev->priv;
+ PSDevice pDevice=(PSDevice) netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
@@ -1507,7 +1503,7 @@ device_release_WPADEV(pDevice);


static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev) {
- PSDevice pDevice=dev->priv;
+ PSDevice pDevice=netdev_priv(dev);
PBYTE pbMPDU;
UINT cbMPDULen = 0;

@@ -1535,7 +1531,7 @@ static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev) {


static int device_xmit(struct sk_buff *skb, struct net_device *dev) {
- PSDevice pDevice=dev->priv;
+ PSDevice pDevice=netdev_priv(dev);
struct net_device_stats* pStats = &pDevice->stats;


@@ -1768,7 +1764,7 @@ static int Read_config_file(PSDevice pDevice) {
}

static void device_set_multi(struct net_device *dev) {
- PSDevice pDevice = (PSDevice) dev->priv;
+ PSDevice pDevice = (PSDevice) netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
u32 mc_filter[2];
int ii;
@@ -1833,14 +1829,14 @@ static void device_set_multi(struct net_device *dev) {


static struct net_device_stats *device_get_stats(struct net_device *dev) {
- PSDevice pDevice=(PSDevice) dev->priv;
+ PSDevice pDevice=(PSDevice) netdev_priv(dev);

return &pDevice->stats;
}


static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {
- PSDevice pDevice = (PSDevice)dev->priv;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
PSCmdRequest pReq;
//BOOL bCommit = FALSE;
diff --git a/drivers/staging/vt6656/wpactl.c b/drivers/staging/vt6656/wpactl.c
index 9345459..37c2900 100644
--- a/drivers/staging/vt6656/wpactl.c
+++ b/drivers/staging/vt6656/wpactl.c
@@ -115,14 +115,16 @@ static void wpadev_setup(struct net_device *dev)

static int wpa_init_wpadev(PSDevice pDevice)
{
+ PSDevice wpadev_priv;
struct net_device *dev = pDevice->dev;
int ret=0;

- pDevice->wpadev = alloc_netdev(0, "vntwpa", wpadev_setup);
+ pDevice->wpadev = alloc_netdev(sizeof(PSDevice), "vntwpa", wpadev_setup);
if (pDevice->wpadev == NULL)
return -ENOMEM;

- pDevice->wpadev->priv = pDevice;
+ wpadev_priv = netdev_priv(pDevice->wpadev);
+ *wpadev_priv = *pDevice;
memcpy(pDevice->wpadev->dev_addr, dev->dev_addr, U_ETHER_ADDR_LEN);
pDevice->wpadev->base_addr = dev->base_addr;
pDevice->wpadev->irq = dev->irq;

signature.asc

Bartlomiej Zolnierkiewicz

unread,
Jul 2, 2009, 2:00:19 PM7/2/09
to

Hi,

The temporary tree is here:

git://git.kernel.org:/pub/scm/linux/kernel/git/bart/misc.git vt665x

and I'll happily apply patches to it till Greg digs out from under the
overdue patch queues.. :)

I also took a look at both drivers and unification is certainly possible
and desirable, though not as easy as I had hoped initially.. here is the
sketch of preliminary TODO for vt6655:

From: Bartlomiej Zolnierkiewicz <bzol...@gmail.com>
Subject: [PATCH] vt6655: add TODO

Cc: Forest Bond <for...@alittletooquiet.net>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzol...@gmail.com>
---
drivers/staging/vt6655/TODO | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)

Index: b/drivers/staging/vt6655/TODO
===================================================================
--- /dev/null
+++ b/drivers/staging/vt6655/TODO
@@ -0,0 +1,21 @@
+TODO:
+- remove __cplusplus ifdefs
+- prepare for merge with vt6656 driver:
+ - rename DEVICE_PRT() to DBG_PRT()
+ - share 80211*.h includes
+ - move code for channel mapping from card.c to channel.c
+ - split rf.c
+ - remove dead code
+ - abstract VT3253 chipset specific code
+- add common vt665x infrastructure
+- kill ttype.h
+- switch to use LIB80211
+- switch to use MAC80211
+- use kernel coding style
+- checkpatch.pl fixes
+- sparse fixes
+- integrate with drivers/net/wireless
+
+Please send any patches to Greg Kroah-Hartman <gr...@kroah.com>,
+Forest Bond <for...@alittletooquiet.net> and Bartlomiej Zolnierkiewicz
+<bzol...@gmail.com>.

and the corresponding one for vt6656:

From: Bartlomiej Zolnierkiewicz <bzol...@gmail.com>
Subject: [PATCH] vt6656: add TODO

Cc: Forest Bond <for...@alittletooquiet.net>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzol...@gmail.com>
---
drivers/staging/vt6656/TODO | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)

Index: b/drivers/staging/vt6656/TODO
===================================================================
--- /dev/null
+++ b/drivers/staging/vt6656/TODO
@@ -0,0 +1,20 @@
+TODO:
+- remove __cplusplus ifdefs
+- remove kernel version compatibility wrappers
+- remove support for older wireless extensions
+- prepare for merge with vt6655 driver:
+ - remove PRINT_K() macro
+ - split rf.c
+ - abstract VT3184 chipset specific code
+- add common vt665x infrastructure
+- kill ttype.h
+- switch to use LIB80211
+- switch to use MAC80211
+- use kernel coding style
+- checkpatch.pl fixes
+- sparse fixes
+- integrate with drivers/net/wireless
+
+Please send any patches to Greg Kroah-Hartman <gr...@kroah.com>,
+Forest Bond <for...@alittletooquiet.net> and Bartlomiej Zolnierkiewicz
+<bzol...@gmail.com>.

> FYI, there is a known issue with the drivers as I've submitted them that causes
> lock-ups. Please see the attached message for a suggested fix.

I think that all netdev_priv() changes should be reverted for now:

--- a/drivers/staging/vt6655/hostap.c
+++ b/drivers/staging/vt6655/hostap.c
@@ -100,6 +100,7 @@ static int msglevel =MSG_LEVEL_INFO;



static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)
{
+ PSDevice apdev_priv;
struct net_device *dev = pDevice->dev;
int ret;

@@ -124,12 +125,13 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)
dev->name, pDevice->apdev->name);

#else
- pDevice->apdev = (struct net_device *)kmalloc(sizeof(struct net_device), GFP_KERNEL);
+ pDevice->apdev = (struct net_device *)kmalloc(sizeof(struct net_device), GFP_KERNEL);
if (pDevice->apdev == NULL)


return -ENOMEM;
memset(pDevice->apdev, 0, sizeof(struct net_device));

- pDevice->apdev->priv = pDevice;
+ apdev_priv = netdev_priv(pDevice->apdev);
+ *apdev_priv = *pDevice;

We don't use alloc_netdev() for apdev allocation so by using netdev_priv()
later we are potentially accessing unrelated memory part.

--- a/drivers/staging/vt6655/wpactl.c
+++ b/drivers/staging/vt6655/wpactl.c
@@ -112,14 +112,17 @@ static void wpadev_setup(struct net_device *dev)



static int wpa_init_wpadev(PSDevice pDevice)
{
+ PSDevice wpadev_priv;
struct net_device *dev = pDevice->dev;
int ret=0;

- pDevice->wpadev = alloc_netdev(0, "vntwpa", wpadev_setup);
+ pDevice->wpadev = alloc_netdev(sizeof(PSDevice), "vntwpa", wpadev_setup);
if (pDevice->wpadev == NULL)
return -ENOMEM;

- pDevice->wpadev->priv = pDevice;
+ wpadev_priv = netdev_priv(pDevice->wpadev);
+ *wpadev_priv = *pDevice;

+


memcpy(pDevice->wpadev->dev_addr, dev->dev_addr, U_ETHER_ADDR_LEN);
pDevice->wpadev->base_addr = dev->base_addr;
pDevice->wpadev->irq = dev->irq;

This will copy the current state of pDevice to newly allocated private part
of ->apdev but later modifications to the original pDevice won't be seen if
we access it through netdev_priv(pDevice->apdev) instead of apdev->priv.

[ I don't know whether this is a problem currently but it looks suspicious. ]

Forest Bond

unread,
Jul 2, 2009, 2:30:11 PM7/2/09
to
Hi,

On Thu, Jul 02, 2009 at 07:45:49PM +0200, Bartlomiej Zolnierkiewicz wrote:
> On Sunday 28 June 2009 18:47:16 Forest Bond wrote:
> > On Sun, Jun 28, 2009 at 05:59:45PM +0200, Bartlomiej Zolnierkiewicz wrote:
> > > [ I'll later setup vt665x branch of my misc.git tree, merge your patches,
> > > merge all outstanding vt6655 patches from Alexander and investigate a bit
> > > more whether merge of vt665x drivers is feasible and what needs to be
> > > done if so.. ]
> >
> > Good.
>
> The temporary tree is here:
>
> git://git.kernel.org:/pub/scm/linux/kernel/git/bart/misc.git vt665x
>
> and I'll happily apply patches to it till Greg digs out from under the
> overdue patch queues.. :)

Thanks for doing this, Bartlomiej.

> > FYI, there is a known issue with the drivers as I've submitted them that causes
> > lock-ups. Please see the attached message for a suggested fix.
>
> I think that all netdev_priv() changes should be reverted for now:

I'm happy to defer to you on this. I don't really understand the code, to be
frank. However, if those changes are simply reverted, the driver will not
compile. I assume that you mean those areas should be removed?

> --- a/drivers/staging/vt6655/wpactl.c
> +++ b/drivers/staging/vt6655/wpactl.c
> @@ -112,14 +112,17 @@ static void wpadev_setup(struct net_device *dev)
>
> static int wpa_init_wpadev(PSDevice pDevice)
> {
> + PSDevice wpadev_priv;
> struct net_device *dev = pDevice->dev;
> int ret=0;
>
> - pDevice->wpadev = alloc_netdev(0, "vntwpa", wpadev_setup);
> + pDevice->wpadev = alloc_netdev(sizeof(PSDevice), "vntwpa", wpadev_setup);
> if (pDevice->wpadev == NULL)
> return -ENOMEM;
>
> - pDevice->wpadev->priv = pDevice;
> + wpadev_priv = netdev_priv(pDevice->wpadev);
> + *wpadev_priv = *pDevice;
> +
> memcpy(pDevice->wpadev->dev_addr, dev->dev_addr, U_ETHER_ADDR_LEN);
> pDevice->wpadev->base_addr = dev->base_addr;
> pDevice->wpadev->irq = dev->irq;
>
> This will copy the current state of pDevice to newly allocated private part
> of ->apdev but later modifications to the original pDevice won't be seen if
> we access it through netdev_priv(pDevice->apdev) instead of apdev->priv.
>
> [ I don't know whether this is a problem currently but it looks suspicious. ]

Agreed. I gave this a best effort, but was not very confident about the result.

Feel free to aggressively rework my changes if it seems appropriate.

signature.asc

Bartlomiej Zolnierkiewicz

unread,
Jul 6, 2009, 11:30:16 AM7/6/09
to
On Thursday 02 July 2009 20:22:08 Forest Bond wrote:
> Hi,
>
> On Thu, Jul 02, 2009 at 07:45:49PM +0200, Bartlomiej Zolnierkiewicz wrote:
> > On Sunday 28 June 2009 18:47:16 Forest Bond wrote:
> > > On Sun, Jun 28, 2009 at 05:59:45PM +0200, Bartlomiej Zolnierkiewicz wrote:
> > > > [ I'll later setup vt665x branch of my misc.git tree, merge your patches,
> > > > merge all outstanding vt6655 patches from Alexander and investigate a bit
> > > > more whether merge of vt665x drivers is feasible and what needs to be
> > > > done if so.. ]
> > >
> > > Good.
> >
> > The temporary tree is here:
> >
> > git://git.kernel.org:/pub/scm/linux/kernel/git/bart/misc.git vt665x
> >
> > and I'll happily apply patches to it till Greg digs out from under the
> > overdue patch queues.. :)
>
> Thanks for doing this, Bartlomiej.
>
> > > FYI, there is a known issue with the drivers as I've submitted them that causes
> > > lock-ups. Please see the attached message for a suggested fix.
> >
> > I think that all netdev_priv() changes should be reverted for now:
>
> I'm happy to defer to you on this. I don't really understand the code, to be
> frank. However, if those changes are simply reverted, the driver will not
> compile. I assume that you mean those areas should be removed?

Uh, you're right.. we need to use netdev_priv().

> > --- a/drivers/staging/vt6655/wpactl.c
> > +++ b/drivers/staging/vt6655/wpactl.c
> > @@ -112,14 +112,17 @@ static void wpadev_setup(struct net_device *dev)
> >
> > static int wpa_init_wpadev(PSDevice pDevice)
> > {
> > + PSDevice wpadev_priv;
> > struct net_device *dev = pDevice->dev;
> > int ret=0;
> >
> > - pDevice->wpadev = alloc_netdev(0, "vntwpa", wpadev_setup);
> > + pDevice->wpadev = alloc_netdev(sizeof(PSDevice), "vntwpa", wpadev_setup);
> > if (pDevice->wpadev == NULL)
> > return -ENOMEM;
> >
> > - pDevice->wpadev->priv = pDevice;
> > + wpadev_priv = netdev_priv(pDevice->wpadev);
> > + *wpadev_priv = *pDevice;
> > +
> > memcpy(pDevice->wpadev->dev_addr, dev->dev_addr, U_ETHER_ADDR_LEN);
> > pDevice->wpadev->base_addr = dev->base_addr;
> > pDevice->wpadev->irq = dev->irq;
> >
> > This will copy the current state of pDevice to newly allocated private part
> > of ->apdev but later modifications to the original pDevice won't be seen if
> > we access it through netdev_priv(pDevice->apdev) instead of apdev->priv.

[ it should be wpadev not apdev in the above description ]

> > [ I don't know whether this is a problem currently but it looks suspicious. ]
>
> Agreed. I gave this a best effort, but was not very confident about the result.

The code is puzzling (at best) -- I still don't know why do we need separate
netdev structure for hostap or wpactl functionality..

> Feel free to aggressively rework my changes if it seems appropriate.

I don't think there is a need for it and I would like to avoid that
since I'm also involved in other drivers/staging/ drivers (besides you
and Alexander are doing just fine :).

Seems like all we need to do to fix the problem is:

* fix code in hostap to also use alloc_netdev()

* bring back "manual" allocation of PSDevice structure

* use private netdev areas only to store the pointer to the single PSDevice
structure that we allocate "manually" (requires converting all netdev_priv()
instances to *netdev_priv() etc but the change should be straightforward).

0 new messages