Last active
August 29, 2015 14:07
-
-
Save ptrxyz/2d3c7ee10ea158cfa496 to your computer and use it in GitHub Desktop.
Ralink Rt5390 kernel 3.15 and 3.8 patches (taken from http://gridlox.net/diff/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Makefile b/Makefile | |
index 533ea7c..9fb31d5 100644 | |
--- a/Makefile | |
+++ b/Makefile | |
@@ -189,11 +189,14 @@ CROSS_COMPILE = mips-wrs-linux-gnu- | |
endif | |
ifeq ($(PLATFORM),PC) | |
+ifndef KERN_VER | |
+KERN_VER = $(shell uname -r) | |
+endif | |
# Linux 2.6 | |
-LINUX_SRC = /lib/modules/$(shell uname -r)/build | |
+LINUX_SRC = /lib/modules/$(KERN_VER)/build | |
# Linux 2.4 Change to your local setting | |
#LINUX_SRC = /usr/src/linux-2.4 | |
-LINUX_SRC_MODULE = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless/ | |
+LINUX_SRC_MODULE = /lib/modules/$(KERN_VER)/kernel/drivers/net/wireless/ | |
CROSS_COMPILE = | |
endif | |
diff --git a/include/os/rt_linux.h b/include/os/rt_linux.h | |
index 8fe2b16..389456c 100644 | |
--- a/include/os/rt_linux.h | |
+++ b/include/os/rt_linux.h | |
@@ -6,7 +6,7 @@ | |
* Taiwan, R.O.C. | |
* | |
* (c) Copyright 2002-2010, Ralink Technology, Inc. | |
- * | |
+ * Portions © 2013-2014 Jesse Crews <jcrews at gridlox dot net> | |
* 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 * | |
@@ -278,8 +278,13 @@ typedef struct file* RTMP_OS_FD; | |
typedef struct _OS_FS_INFO_ | |
{ | |
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) | |
int fsuid; | |
int fsgid; | |
+#else | |
+ kuid_t fsuid; | |
+ kgid_t fsgid; | |
+#endif | |
mm_segment_t fs; | |
} OS_FS_INFO; | |
@@ -996,15 +1001,15 @@ void linux_pci_unmap_single(void *handle, ra_dma_addr_t dma_addr, size_t size, i | |
(RTPKT_TO_OSPKT(_pkt)->len) = (_len) | |
#define GET_OS_PKT_DATATAIL(_pkt) \ | |
- (RTPKT_TO_OSPKT(_pkt)->tail) | |
+ ((unsigned char*)skb_tail_pointer(RTPKT_TO_OSPKT(_pkt))) | |
#define SET_OS_PKT_DATATAIL(_pkt, _start, _len) \ | |
- ((RTPKT_TO_OSPKT(_pkt))->tail) = (PUCHAR)((_start) + (_len)) | |
+ (skb_set_tail_pointer((RTPKT_TO_OSPKT(_pkt)), (_len))) | |
#define GET_OS_PKT_HEAD(_pkt) \ | |
(RTPKT_TO_OSPKT(_pkt)->head) | |
#define GET_OS_PKT_END(_pkt) \ | |
- (RTPKT_TO_OSPKT(_pkt)->end) | |
+ ((unsigned char*)skb_end_pointer(RTPKT_TO_OSPKT(_pkt))) | |
#define GET_OS_PKT_NETDEV(_pkt) \ | |
(RTPKT_TO_OSPKT(_pkt)->dev) | |
diff --git a/os/linux/Makefile.4 b/os/linux/Makefile.4 | |
index 2db303c..8564ce2 100644 | |
--- a/os/linux/Makefile.4 | |
+++ b/os/linux/Makefile.4 | |
@@ -9,6 +9,9 @@ DAT_FILE_NAME = RT$(MODULE_DAT)STA.dat | |
endif | |
#endif // CONFIG_STA_SUPPORT // | |
+ifndef KERN_VER | |
+KERN_VER = $(shell uname -r) | |
+endif | |
OBJ := $(MOD_NAME).o | |
@@ -280,12 +283,12 @@ install: | |
cp $(RT28xx_DIR)/$(DAT_FILE_NAME) $(DAT_PATH)/. | |
install -d $(LINUX_SRC_MODULE) | |
install -m 644 -c $(addsuffix .o,$(MOD_NAME)) $(LINUX_SRC_MODULE) | |
- /sbin/depmod -a ${shell uname -r} | |
+ /sbin/depmod -a ${KERN_VER} | |
uninstall: | |
# rm -rf $(DAT_PATH) | |
rm -rf $(addprefix $(LINUX_SRC_MODULE),$(addsuffix .o,$(MOD_NAME))) | |
- /sbin/depmod -a ${shell uname -r} | |
+ /sbin/depmod -a ${KERN_VER} | |
# Declare the contents of the .PHONY variable as phony. We keep that | |
# information in a variable so we can use it in if_changed and friends. | |
diff --git a/os/linux/Makefile.4.netif b/os/linux/Makefile.4.netif | |
index c8cc93c..c35e5cc 100644 | |
--- a/os/linux/Makefile.4.netif | |
+++ b/os/linux/Makefile.4.netif | |
@@ -8,6 +8,10 @@ endif | |
#endif // CONFIG_STA_SUPPORT // | |
+ifndef KERN_VER | |
+KERN_VER = $(shell uname -r) | |
+endif | |
+ | |
OBJ := $(MOD_NAME).o | |
@@ -94,11 +98,11 @@ endif | |
install: | |
install -d $(LINUX_SRC_MODULE) | |
install -m 644 -c $(addsuffix .o,$(MOD_NAME)) $(LINUX_SRC_MODULE) | |
- /sbin/depmod -a ${shell uname -r} | |
+ /sbin/depmod -a ${KERN_VER} | |
uninstall: | |
rm -rf $(addprefix $(LINUX_SRC_MODULE),$(addsuffix .o,$(MOD_NAME))) | |
- /sbin/depmod -a ${shell uname -r} | |
+ /sbin/depmod -a ${KERN_VER} | |
# Declare the contents of the .PHONY variable as phony. We keep that | |
# # information in a variable so we can use it in if_changed and friends. | |
diff --git a/os/linux/Makefile.4.util b/os/linux/Makefile.4.util | |
index 69e401c..77904e0 100644 | |
--- a/os/linux/Makefile.4.util | |
+++ b/os/linux/Makefile.4.util | |
@@ -7,6 +7,9 @@ MOD_NAME = rtutil$(MODULE)sta | |
endif | |
#endif // CONFIG_STA_SUPPORT // | |
+ifndef KERN_VER | |
+KERN_VER = $(shell uname -r) | |
+endif | |
OBJ := $(MOD_NAME).o | |
@@ -65,11 +68,11 @@ endif | |
install: | |
install -d $(LINUX_SRC_MODULE) | |
install -m 644 -c $(addsuffix .o,$(MOD_NAME)) $(LINUX_SRC_MODULE) | |
- /sbin/depmod -a ${shell uname -r} | |
+ /sbin/depmod -a ${KERN_VER} | |
uninstall: | |
rm -rf $(addprefix $(LINUX_SRC_MODULE),$(addsuffix .o,$(MOD_NAME))) | |
- /sbin/depmod -a ${shell uname -r} | |
+ /sbin/depmod -a ${KERN_VER} | |
# Declare the contents of the .PHONY variable as phony. We keep that | |
# # information in a variable so we can use it in if_changed and friends. | |
diff --git a/os/linux/Makefile.6 b/os/linux/Makefile.6 | |
index 28c5530..339c941 100644 | |
--- a/os/linux/Makefile.6 | |
+++ b/os/linux/Makefile.6 | |
@@ -9,6 +9,9 @@ DAT_FILE_NAME = RT$(CHIPSET_DAT)STA.dat | |
endif | |
#endif // CONFIG_STA_SUPPORT // | |
+ifndef KERN_VER | |
+KERN_VER = $(shell uname -r) | |
+endif | |
obj-m := $(MOD_NAME).o | |
@@ -297,12 +300,12 @@ install: | |
cp $(RT28xx_DIR)/$(DAT_FILE_NAME) $(DAT_PATH)/. | |
install -d $(LINUX_SRC_MODULE) | |
install -m 644 -c $(addsuffix .ko,$(MOD_NAME)) $(LINUX_SRC_MODULE) | |
- /sbin/depmod -a ${shell uname -r} | |
+ /sbin/depmod -a ${KERN_VER} | |
uninstall: | |
# rm -rf $(DAT_PATH) | |
rm -rf $(addprefix $(LINUX_SRC_MODULE),$(addsuffix .ko,$(MOD_NAME))) | |
- /sbin/depmod -a ${shell uname -r} | |
+ /sbin/depmod -a ${KERN_VER} | |
# Declare the contents of the .PHONY variable as phony. We keep that | |
# information in a variable so we can use it in if_changed and friends. | |
diff --git a/os/linux/Makefile.6.netif b/os/linux/Makefile.6.netif | |
index 968165d..1a92a39 100644 | |
--- a/os/linux/Makefile.6.netif | |
+++ b/os/linux/Makefile.6.netif | |
@@ -7,6 +7,9 @@ MOD_NAME = rtnet$(MODULE)sta | |
endif | |
#endif // CONFIG_STA_SUPPORT // | |
+ifndef KERN_VER | |
+KERN_VER = $(shell uname -r) | |
+endif | |
obj-m := $(MOD_NAME).o | |
@@ -90,8 +93,8 @@ endif | |
install: | |
install -d $(LINUX_SRC_MODULE) | |
install -m 644 -c $(addsuffix .ko,$(MOD_NAME)) $(LINUX_SRC_MODULE) | |
- /sbin/depmod -a ${shell uname -r} | |
+ /sbin/depmod -a ${KERN_VER} | |
uninstall: | |
rm -rf $(addprefix $(LINUX_SRC_MODULE),$(addsuffix .ko,$(MOD_NAME))) | |
- /sbin/depmod -a ${shell uname -r} | |
+ /sbin/depmod -a ${KERN_VER} | |
diff --git a/os/linux/Makefile.6.util b/os/linux/Makefile.6.util | |
index 7510db6..e43fe5f 100644 | |
--- a/os/linux/Makefile.6.util | |
+++ b/os/linux/Makefile.6.util | |
@@ -7,6 +7,9 @@ MOD_NAME = rtutil$(MODULE)sta | |
endif | |
#endif // CONFIG_STA_SUPPORT // | |
+ifndef KERN_VER | |
+KERN_VER = $(shell uname -r) | |
+endif | |
obj-m := $(MOD_NAME).o | |
@@ -50,8 +53,8 @@ endif | |
install: | |
install -d $(LINUX_SRC_MODULE) | |
install -m 644 -c $(addsuffix .ko,$(MOD_NAME)) $(LINUX_SRC_MODULE) | |
- /sbin/depmod -a ${shell uname -r} | |
+ /sbin/depmod -a ${KERN_VER} | |
uninstall: | |
rm -rf $(addprefix $(LINUX_SRC_MODULE),$(addsuffix .ko,$(MOD_NAME))) | |
- /sbin/depmod -a ${shell uname -r} | |
\ No newline at end of file | |
+ /sbin/depmod -a ${KERN_VER} | |
diff --git a/os/linux/pci_main_dev.c b/os/linux/pci_main_dev.c | |
index ebd3e57..400538b 100644 | |
--- a/os/linux/pci_main_dev.c | |
+++ b/os/linux/pci_main_dev.c | |
@@ -6,7 +6,7 @@ | |
* Taiwan, R.O.C. | |
* | |
* (c) Copyright 2002-2010, Ralink Technology, Inc. | |
- * | |
+ * Portions © 2013-2014, Jesse Crews <jcrews at gridlox dot net> | |
* 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 * | |
@@ -39,8 +39,14 @@ | |
/*extern int rt28xx_close(IN struct net_device *net_dev); */ | |
/*extern int rt28xx_open(struct net_device *net_dev); */ | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) | |
+static VOID rt2860_remove_one(struct pci_dev *pci_dev); | |
+static INT rt2860_probe(struct pci_dev *pci_dev, const struct pci_device_id *ent); | |
+#else | |
static VOID __devexit rt2860_remove_one(struct pci_dev *pci_dev); | |
static INT __devinit rt2860_probe(struct pci_dev *pci_dev, const struct pci_device_id *ent); | |
+#endif | |
+ | |
static void __exit rt2860_cleanup_module(void); | |
static int __init rt2860_init_module(void); | |
@@ -59,7 +65,11 @@ static int rt2860_resume(struct pci_dev *pci_dev); | |
/* */ | |
/* Ralink PCI device table, include all supported chipsets */ | |
/* */ | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) | |
+static struct pci_device_id rt2860_pci_tbl[] = | |
+#else | |
static struct pci_device_id rt2860_pci_tbl[] __devinitdata = | |
+#endif | |
{ | |
#ifdef RT5592 | |
{PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC5592_PCIe_DEVICE_ID)}, | |
@@ -86,11 +96,13 @@ static struct pci_driver rt2860_driver = | |
name: RTMP_DRV_NAME, | |
id_table: rt2860_pci_tbl, | |
probe: rt2860_probe, | |
-#if LINUX_VERSION_CODE >= 0x20412 | |
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0) /* 3.8 check */ | |
+#if LINUX_VERSION_CODE >= 0x20412 | |
remove: __devexit_p(rt2860_remove_one), | |
#else | |
remove: __devexit(rt2860_remove_one), | |
#endif | |
+#endif /* 3.8 check */ | |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | |
#ifdef CONFIG_PM | |
@@ -291,7 +303,11 @@ module_exit(rt2860_cleanup_module); | |
/* */ | |
/* PCI device probe & initialization function */ | |
/* */ | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) | |
+static INT rt2860_probe( | |
+#else | |
static INT __devinit rt2860_probe( | |
+#endif | |
IN struct pci_dev *pci_dev, | |
IN const struct pci_device_id *pci_id) | |
{ | |
@@ -461,8 +477,11 @@ err_out: | |
return -ENODEV; /* probe fail */ | |
} | |
- | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) | |
+static VOID rt2860_remove_one( | |
+#else | |
static VOID __devexit rt2860_remove_one( | |
+#endif | |
IN struct pci_dev *pci_dev) | |
{ | |
PNET_DEV net_dev = pci_get_drvdata(pci_dev); | |
diff --git a/os/linux/rt_linux.c b/os/linux/rt_linux.c | |
index e7c8084..9dfebff 100644 | |
--- a/os/linux/rt_linux.c | |
+++ b/os/linux/rt_linux.c | |
@@ -6,7 +6,7 @@ | |
* Taiwan, R.O.C. | |
* | |
* (c) Copyright 2002-2010, Ralink Technology, Inc. | |
- * | |
+ * Portions © Jesse Crews <jcrews at gridlox dot net> | |
* 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 * | |
@@ -502,9 +502,9 @@ PNDIS_PACKET duplicate_pkt( | |
MEM_DBG_PKT_ALLOC_INC(skb); | |
skb_reserve(skb, 2); | |
- NdisMoveMemory(skb->tail, pHeader802_3, HdrLen); | |
+ NdisMoveMemory((unsigned char*)skb_tail_pointer(skb), pHeader802_3, HdrLen); | |
skb_put(skb, HdrLen); | |
- NdisMoveMemory(skb->tail, pData, DataSize); | |
+ NdisMoveMemory((unsigned char*)skb_tail_pointer(skb), pData, DataSize); | |
skb_put(skb, DataSize); | |
skb->dev = pNetDev; /*get_netdev_from_bssid(pAd, FromWhichBSSID); */ | |
pPacket = OSPKT_TO_RTPKT(skb); | |
@@ -656,7 +656,7 @@ PNDIS_PACKET ClonePacket( | |
pClonedPkt->dev = pRxPkt->dev; | |
pClonedPkt->data = pData; | |
pClonedPkt->len = DataSize; | |
- pClonedPkt->tail = pClonedPkt->data + pClonedPkt->len; | |
+ skb_set_tail_pointer(pClonedPkt, DataSize); | |
ASSERT(DataSize < 1530); | |
} | |
return pClonedPkt; | |
@@ -702,7 +702,7 @@ void wlan_802_11_to_802_3_packet( | |
pOSPkt->dev = pNetDev; | |
pOSPkt->data = pData; | |
pOSPkt->len = DataSize; | |
- pOSPkt->tail = pOSPkt->data + pOSPkt->len; | |
+ skb_set_tail_pointer(pOSPkt, DataSize); | |
/* */ | |
/* copy 802.3 header */ | |
@@ -4933,7 +4933,7 @@ Note: | |
*/ | |
VOID RtmpOsPktTailAdjust(IN PNDIS_PACKET pNetPkt, | |
IN UINT removedTagLen) { | |
- OS_PKT_TAIL_ADJUST(pNetPkt, removedTagLen); | |
+ skb_set_tail_pointer(pNetPkt, pNetPkt->len - removedTagLen) | |
} | |
/* | |
diff --git a/sta/sta_cfg.c b/sta/sta_cfg.c | |
index 6e66010..310ff52 100644 | |
--- a/sta/sta_cfg.c | |
+++ b/sta/sta_cfg.c | |
@@ -6,6 +6,7 @@ | |
* Taiwan, R.O.C. | |
* | |
* (c) Copyright 2002-2010, Ralink Technology, Inc. | |
+ * Portions © 2013-2014 Jesse Crews <jcrews at gridlox dot net> | |
* | |
* 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 * | |
@@ -4893,7 +4894,7 @@ VOID RTMPIoctlShow( | |
wrq->u.data.length = strlen(extra) + 1; /* 1: size of '\0' */ | |
break; | |
case SHOW_DRVIER_VERION: | |
- snprintf(extra, size, "Driver version-%s, %s %s\n", STA_DRIVER_VERSION, __DATE__, __TIME__ ); | |
+ snprintf(extra, size, "Driver version-%s, \n", STA_DRIVER_VERSION); | |
wrq->u.data.length = strlen(extra) + 1; /* 1: size of '\0' */ | |
break; | |
#ifdef DOT11_N_SUPPORT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Makefile b/Makefile | |
index 533ea7c..9fb31d5 100644 | |
--- a/Makefile | |
+++ b/Makefile | |
@@ -189,11 +189,14 @@ CROSS_COMPILE = mips-wrs-linux-gnu- | |
endif | |
ifeq ($(PLATFORM),PC) | |
+ifndef KERN_VER | |
+KERN_VER = $(shell uname -r) | |
+endif | |
# Linux 2.6 | |
-LINUX_SRC = /lib/modules/$(shell uname -r)/build | |
+LINUX_SRC = /lib/modules/$(KERN_VER)/build | |
# Linux 2.4 Change to your local setting | |
#LINUX_SRC = /usr/src/linux-2.4 | |
-LINUX_SRC_MODULE = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless/ | |
+LINUX_SRC_MODULE = /lib/modules/$(KERN_VER)/kernel/drivers/net/wireless/ | |
CROSS_COMPILE = | |
endif | |
diff --git a/include/os/rt_linux.h b/include/os/rt_linux.h | |
index 8fe2b16..389456c 100644 | |
--- a/include/os/rt_linux.h | |
+++ b/include/os/rt_linux.h | |
@@ -6,7 +6,7 @@ | |
* Taiwan, R.O.C. | |
* | |
* (c) Copyright 2002-2010, Ralink Technology, Inc. | |
- * | |
+ * Portions © 2013-2014 Jesse Crews <jcrews at gridlox dot net> | |
* 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 * | |
@@ -278,8 +278,13 @@ typedef struct file* RTMP_OS_FD; | |
typedef struct _OS_FS_INFO_ | |
{ | |
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) | |
int fsuid; | |
int fsgid; | |
+#else | |
+ kuid_t fsuid; | |
+ kgid_t fsgid; | |
+#endif | |
mm_segment_t fs; | |
} OS_FS_INFO; | |
@@ -996,15 +1001,15 @@ void linux_pci_unmap_single(void *handle, ra_dma_addr_t dma_addr, size_t size, i | |
(RTPKT_TO_OSPKT(_pkt)->len) = (_len) | |
#define GET_OS_PKT_DATATAIL(_pkt) \ | |
- (RTPKT_TO_OSPKT(_pkt)->tail) | |
+ ((unsigned char*)skb_tail_pointer(RTPKT_TO_OSPKT(_pkt))) | |
#define SET_OS_PKT_DATATAIL(_pkt, _start, _len) \ | |
- ((RTPKT_TO_OSPKT(_pkt))->tail) = (PUCHAR)((_start) + (_len)) | |
+ (skb_set_tail_pointer((RTPKT_TO_OSPKT(_pkt)), (_len))) | |
#define GET_OS_PKT_HEAD(_pkt) \ | |
(RTPKT_TO_OSPKT(_pkt)->head) | |
#define GET_OS_PKT_END(_pkt) \ | |
- (RTPKT_TO_OSPKT(_pkt)->end) | |
+ ((unsigned char*)skb_end_pointer(RTPKT_TO_OSPKT(_pkt))) | |
#define GET_OS_PKT_NETDEV(_pkt) \ | |
(RTPKT_TO_OSPKT(_pkt)->dev) | |
diff --git a/os/linux/Makefile.4 b/os/linux/Makefile.4 | |
index 2db303c..8564ce2 100644 | |
--- a/os/linux/Makefile.4 | |
+++ b/os/linux/Makefile.4 | |
@@ -9,6 +9,9 @@ DAT_FILE_NAME = RT$(MODULE_DAT)STA.dat | |
endif | |
#endif // CONFIG_STA_SUPPORT // | |
+ifndef KERN_VER | |
+KERN_VER = $(shell uname -r) | |
+endif | |
OBJ := $(MOD_NAME).o | |
@@ -280,12 +283,12 @@ install: | |
cp $(RT28xx_DIR)/$(DAT_FILE_NAME) $(DAT_PATH)/. | |
install -d $(LINUX_SRC_MODULE) | |
install -m 644 -c $(addsuffix .o,$(MOD_NAME)) $(LINUX_SRC_MODULE) | |
- /sbin/depmod -a ${shell uname -r} | |
+ /sbin/depmod -a ${KERN_VER} | |
uninstall: | |
# rm -rf $(DAT_PATH) | |
rm -rf $(addprefix $(LINUX_SRC_MODULE),$(addsuffix .o,$(MOD_NAME))) | |
- /sbin/depmod -a ${shell uname -r} | |
+ /sbin/depmod -a ${KERN_VER} | |
# Declare the contents of the .PHONY variable as phony. We keep that | |
# information in a variable so we can use it in if_changed and friends. | |
diff --git a/os/linux/Makefile.4.netif b/os/linux/Makefile.4.netif | |
index c8cc93c..c35e5cc 100644 | |
--- a/os/linux/Makefile.4.netif | |
+++ b/os/linux/Makefile.4.netif | |
@@ -8,6 +8,10 @@ endif | |
#endif // CONFIG_STA_SUPPORT // | |
+ifndef KERN_VER | |
+KERN_VER = $(shell uname -r) | |
+endif | |
+ | |
OBJ := $(MOD_NAME).o | |
@@ -94,11 +98,11 @@ endif | |
install: | |
install -d $(LINUX_SRC_MODULE) | |
install -m 644 -c $(addsuffix .o,$(MOD_NAME)) $(LINUX_SRC_MODULE) | |
- /sbin/depmod -a ${shell uname -r} | |
+ /sbin/depmod -a ${KERN_VER} | |
uninstall: | |
rm -rf $(addprefix $(LINUX_SRC_MODULE),$(addsuffix .o,$(MOD_NAME))) | |
- /sbin/depmod -a ${shell uname -r} | |
+ /sbin/depmod -a ${KERN_VER} | |
# Declare the contents of the .PHONY variable as phony. We keep that | |
# # information in a variable so we can use it in if_changed and friends. | |
diff --git a/os/linux/Makefile.4.util b/os/linux/Makefile.4.util | |
index 69e401c..77904e0 100644 | |
--- a/os/linux/Makefile.4.util | |
+++ b/os/linux/Makefile.4.util | |
@@ -7,6 +7,9 @@ MOD_NAME = rtutil$(MODULE)sta | |
endif | |
#endif // CONFIG_STA_SUPPORT // | |
+ifndef KERN_VER | |
+KERN_VER = $(shell uname -r) | |
+endif | |
OBJ := $(MOD_NAME).o | |
@@ -65,11 +68,11 @@ endif | |
install: | |
install -d $(LINUX_SRC_MODULE) | |
install -m 644 -c $(addsuffix .o,$(MOD_NAME)) $(LINUX_SRC_MODULE) | |
- /sbin/depmod -a ${shell uname -r} | |
+ /sbin/depmod -a ${KERN_VER} | |
uninstall: | |
rm -rf $(addprefix $(LINUX_SRC_MODULE),$(addsuffix .o,$(MOD_NAME))) | |
- /sbin/depmod -a ${shell uname -r} | |
+ /sbin/depmod -a ${KERN_VER} | |
# Declare the contents of the .PHONY variable as phony. We keep that | |
# # information in a variable so we can use it in if_changed and friends. | |
diff --git a/os/linux/Makefile.6 b/os/linux/Makefile.6 | |
index 28c5530..339c941 100644 | |
--- a/os/linux/Makefile.6 | |
+++ b/os/linux/Makefile.6 | |
@@ -9,6 +9,9 @@ DAT_FILE_NAME = RT$(CHIPSET_DAT)STA.dat | |
endif | |
#endif // CONFIG_STA_SUPPORT // | |
+ifndef KERN_VER | |
+KERN_VER = $(shell uname -r) | |
+endif | |
obj-m := $(MOD_NAME).o | |
@@ -297,12 +300,12 @@ install: | |
cp $(RT28xx_DIR)/$(DAT_FILE_NAME) $(DAT_PATH)/. | |
install -d $(LINUX_SRC_MODULE) | |
install -m 644 -c $(addsuffix .ko,$(MOD_NAME)) $(LINUX_SRC_MODULE) | |
- /sbin/depmod -a ${shell uname -r} | |
+ /sbin/depmod -a ${KERN_VER} | |
uninstall: | |
# rm -rf $(DAT_PATH) | |
rm -rf $(addprefix $(LINUX_SRC_MODULE),$(addsuffix .ko,$(MOD_NAME))) | |
- /sbin/depmod -a ${shell uname -r} | |
+ /sbin/depmod -a ${KERN_VER} | |
# Declare the contents of the .PHONY variable as phony. We keep that | |
# information in a variable so we can use it in if_changed and friends. | |
diff --git a/os/linux/Makefile.6.netif b/os/linux/Makefile.6.netif | |
index 968165d..1a92a39 100644 | |
--- a/os/linux/Makefile.6.netif | |
+++ b/os/linux/Makefile.6.netif | |
@@ -7,6 +7,9 @@ MOD_NAME = rtnet$(MODULE)sta | |
endif | |
#endif // CONFIG_STA_SUPPORT // | |
+ifndef KERN_VER | |
+KERN_VER = $(shell uname -r) | |
+endif | |
obj-m := $(MOD_NAME).o | |
@@ -90,8 +93,8 @@ endif | |
install: | |
install -d $(LINUX_SRC_MODULE) | |
install -m 644 -c $(addsuffix .ko,$(MOD_NAME)) $(LINUX_SRC_MODULE) | |
- /sbin/depmod -a ${shell uname -r} | |
+ /sbin/depmod -a ${KERN_VER} | |
uninstall: | |
rm -rf $(addprefix $(LINUX_SRC_MODULE),$(addsuffix .ko,$(MOD_NAME))) | |
- /sbin/depmod -a ${shell uname -r} | |
+ /sbin/depmod -a ${KERN_VER} | |
diff --git a/os/linux/Makefile.6.util b/os/linux/Makefile.6.util | |
index 7510db6..e43fe5f 100644 | |
--- a/os/linux/Makefile.6.util | |
+++ b/os/linux/Makefile.6.util | |
@@ -7,6 +7,9 @@ MOD_NAME = rtutil$(MODULE)sta | |
endif | |
#endif // CONFIG_STA_SUPPORT // | |
+ifndef KERN_VER | |
+KERN_VER = $(shell uname -r) | |
+endif | |
obj-m := $(MOD_NAME).o | |
@@ -50,8 +53,8 @@ endif | |
install: | |
install -d $(LINUX_SRC_MODULE) | |
install -m 644 -c $(addsuffix .ko,$(MOD_NAME)) $(LINUX_SRC_MODULE) | |
- /sbin/depmod -a ${shell uname -r} | |
+ /sbin/depmod -a ${KERN_VER} | |
uninstall: | |
rm -rf $(addprefix $(LINUX_SRC_MODULE),$(addsuffix .ko,$(MOD_NAME))) | |
- /sbin/depmod -a ${shell uname -r} | |
\ No newline at end of file | |
+ /sbin/depmod -a ${KERN_VER} | |
diff --git a/os/linux/pci_main_dev.c b/os/linux/pci_main_dev.c | |
index ebd3e57..400538b 100644 | |
--- a/os/linux/pci_main_dev.c | |
+++ b/os/linux/pci_main_dev.c | |
@@ -6,7 +6,7 @@ | |
* Taiwan, R.O.C. | |
* | |
* (c) Copyright 2002-2010, Ralink Technology, Inc. | |
- * | |
+ * Portions © 2013-2014, Jesse Crews <jcrews at gridlox dot net> | |
* 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 * | |
@@ -39,8 +39,14 @@ | |
/*extern int rt28xx_close(IN struct net_device *net_dev); */ | |
/*extern int rt28xx_open(struct net_device *net_dev); */ | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) | |
+static VOID rt2860_remove_one(struct pci_dev *pci_dev); | |
+static INT rt2860_probe(struct pci_dev *pci_dev, const struct pci_device_id *ent); | |
+#else | |
static VOID __devexit rt2860_remove_one(struct pci_dev *pci_dev); | |
static INT __devinit rt2860_probe(struct pci_dev *pci_dev, const struct pci_device_id *ent); | |
+#endif | |
+ | |
static void __exit rt2860_cleanup_module(void); | |
static int __init rt2860_init_module(void); | |
@@ -59,7 +65,11 @@ static int rt2860_resume(struct pci_dev *pci_dev); | |
/* */ | |
/* Ralink PCI device table, include all supported chipsets */ | |
/* */ | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) | |
+static struct pci_device_id rt2860_pci_tbl[] = | |
+#else | |
static struct pci_device_id rt2860_pci_tbl[] __devinitdata = | |
+#endif | |
{ | |
#ifdef RT5592 | |
{PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC5592_PCIe_DEVICE_ID)}, | |
@@ -86,11 +96,13 @@ static struct pci_driver rt2860_driver = | |
name: RTMP_DRV_NAME, | |
id_table: rt2860_pci_tbl, | |
probe: rt2860_probe, | |
-#if LINUX_VERSION_CODE >= 0x20412 | |
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0) /* 3.8 check */ | |
+#if LINUX_VERSION_CODE >= 0x20412 | |
remove: __devexit_p(rt2860_remove_one), | |
#else | |
remove: __devexit(rt2860_remove_one), | |
#endif | |
+#endif /* 3.8 check */ | |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | |
#ifdef CONFIG_PM | |
@@ -291,7 +303,11 @@ module_exit(rt2860_cleanup_module); | |
/* */ | |
/* PCI device probe & initialization function */ | |
/* */ | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) | |
+static INT rt2860_probe( | |
+#else | |
static INT __devinit rt2860_probe( | |
+#endif | |
IN struct pci_dev *pci_dev, | |
IN const struct pci_device_id *pci_id) | |
{ | |
@@ -461,8 +477,11 @@ err_out: | |
return -ENODEV; /* probe fail */ | |
} | |
- | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) | |
+static VOID rt2860_remove_one( | |
+#else | |
static VOID __devexit rt2860_remove_one( | |
+#endif | |
IN struct pci_dev *pci_dev) | |
{ | |
PNET_DEV net_dev = pci_get_drvdata(pci_dev); | |
diff --git a/os/linux/rt_linux.c b/os/linux/rt_linux.c | |
index e7c8084..9dfebff 100644 | |
--- a/os/linux/rt_linux.c | |
+++ b/os/linux/rt_linux.c | |
@@ -6,7 +6,7 @@ | |
* Taiwan, R.O.C. | |
* | |
* (c) Copyright 2002-2010, Ralink Technology, Inc. | |
- * | |
+ * Portions © Jesse Crews <jcrews at gridlox dot net> | |
* 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 * | |
@@ -502,9 +502,9 @@ PNDIS_PACKET duplicate_pkt( | |
MEM_DBG_PKT_ALLOC_INC(skb); | |
skb_reserve(skb, 2); | |
- NdisMoveMemory(skb->tail, pHeader802_3, HdrLen); | |
+ NdisMoveMemory((unsigned char*)skb_tail_pointer(skb), pHeader802_3, HdrLen); | |
skb_put(skb, HdrLen); | |
- NdisMoveMemory(skb->tail, pData, DataSize); | |
+ NdisMoveMemory((unsigned char*)skb_tail_pointer(skb), pData, DataSize); | |
skb_put(skb, DataSize); | |
skb->dev = pNetDev; /*get_netdev_from_bssid(pAd, FromWhichBSSID); */ | |
pPacket = OSPKT_TO_RTPKT(skb); | |
@@ -656,7 +656,7 @@ PNDIS_PACKET ClonePacket( | |
pClonedPkt->dev = pRxPkt->dev; | |
pClonedPkt->data = pData; | |
pClonedPkt->len = DataSize; | |
- pClonedPkt->tail = pClonedPkt->data + pClonedPkt->len; | |
+ skb_set_tail_pointer(pClonedPkt, DataSize); | |
ASSERT(DataSize < 1530); | |
} | |
return pClonedPkt; | |
@@ -702,7 +702,7 @@ void wlan_802_11_to_802_3_packet( | |
pOSPkt->dev = pNetDev; | |
pOSPkt->data = pData; | |
pOSPkt->len = DataSize; | |
- pOSPkt->tail = pOSPkt->data + pOSPkt->len; | |
+ skb_set_tail_pointer(pOSPkt, DataSize); | |
/* */ | |
/* copy 802.3 header */ | |
@@ -4933,7 +4933,7 @@ Note: | |
*/ | |
VOID RtmpOsPktTailAdjust(IN PNDIS_PACKET pNetPkt, | |
IN UINT removedTagLen) { | |
- OS_PKT_TAIL_ADJUST(pNetPkt, removedTagLen); | |
+ skb_set_tail_pointer(pNetPkt, pNetPkt->len - removedTagLen) | |
} | |
/* | |
diff --git a/sta/sta_cfg.c b/sta/sta_cfg.c | |
index 6e66010..310ff52 100644 | |
--- a/sta/sta_cfg.c | |
+++ b/sta/sta_cfg.c | |
@@ -6,6 +6,7 @@ | |
* Taiwan, R.O.C. | |
* | |
* (c) Copyright 2002-2010, Ralink Technology, Inc. | |
+ * Portions © 2013-2014 Jesse Crews <jcrews at gridlox dot net> | |
* | |
* 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 * | |
@@ -4893,7 +4894,7 @@ VOID RTMPIoctlShow( | |
wrq->u.data.length = strlen(extra) + 1; /* 1: size of '\0' */ | |
break; | |
case SHOW_DRVIER_VERION: | |
- snprintf(extra, size, "Driver version-%s, %s %s\n", STA_DRIVER_VERSION, __DATE__, __TIME__ ); | |
+ snprintf(extra, size, "Driver version-%s, \n", STA_DRIVER_VERSION); | |
wrq->u.data.length = strlen(extra) + 1; /* 1: size of '\0' */ | |
break; | |
#ifdef DOT11_N_SUPPORT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment