[PATCH] Staging: rtl8712: Fixed brace and comment style issue

2016-06-27 Thread Anuradha Weeraman
Fixed issues with coding style.

Signed-off-by: Anuradha Weeraman 
---
 drivers/staging/rtl8712/xmit_linux.c | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8712/xmit_linux.c 
b/drivers/staging/rtl8712/xmit_linux.c
index 695f9b9..1e86133 100644
--- a/drivers/staging/rtl8712/xmit_linux.c
+++ b/drivers/staging/rtl8712/xmit_linux.c
@@ -91,7 +91,8 @@ void r8712_set_qos(struct pkt_file *ppktfile, struct 
pkt_attrib *pattrib)
} else {
/* "When priority processing of data frames is supported,
 * a STA's SME should send EAPOL-Key frames at the highest
-* priority." */
+* priority."
+*/
 
if (pattrib->ether_type == 0x888e)
UserPriority = 7;
@@ -162,16 +163,16 @@ int r8712_xmit_entry(_pkt *pkt, struct  net_device 
*pnetdev)
struct _adapter *padapter = netdev_priv(pnetdev);
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
 
-   if (!r8712_if_up(padapter)) {
+   if (!r8712_if_up(padapter))
goto _xmit_entry_drop;
-   }
+
pxmitframe = r8712_alloc_xmitframe(pxmitpriv);
-   if (!pxmitframe) {
+   if (!pxmitframe)
goto _xmit_entry_drop;
-   }
-   if ((!r8712_update_attrib(padapter, pkt, &pxmitframe->attrib))) {
+
+   if ((!r8712_update_attrib(padapter, pkt, &pxmitframe->attrib)))
goto _xmit_entry_drop;
-   }
+
padapter->ledpriv.LedControlHandler(padapter, LED_CTL_TX);
pxmitframe->pkt = pkt;
if (r8712_pre_xmit(padapter, pxmitframe)) {
-- 
2.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: comedi: das16.c: Fixed a comment coding style issue

2016-06-27 Thread Ian Abbott

On 27/06/16 00:46, Pedro Ignacio Nieto wrote:

Fixed bad formated multi-line comment

Signed-off-by: Pedro Ignacio Nieto 
---
 drivers/staging/comedi/drivers/das16.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/das16.c 
b/drivers/staging/comedi/drivers/das16.c
index fd8e0b7..b01f358 100644
--- a/drivers/staging/comedi/drivers/das16.c
+++ b/drivers/staging/comedi/drivers/das16.c
@@ -428,8 +428,10 @@ static const struct das16_board das16_boards[] = {
},
 };

-/* Period for timer interrupt in jiffies.  It's a function
- * to deal with possibility of dynamic HZ patches  */
+/*
+ * Period for timer interrupt in jiffies.  It's a function
+ * to deal with possibility of dynamic HZ patches
+ */
 static inline int timer_period(void)
 {
return HZ / 20;



The patch is fine now, but unfortunately, it's already been fixed by 
commit 55cc6164eecf in linux-next ("Staging: comedi: Block comment issue 
fixed for das16.c").


--
-=( Ian Abbott @ MEV Ltd.E-mail:  )=-
-=(  Web: http://www.mev.co.uk/  )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3] staging: wilc1000: fix error handling in wilc_debugfs_init()

2016-06-27 Thread Luis de Bethencourt
We can just ignore the return value from debugfs_create_dir() and
debugfs_create_file(). The second one already interanlly checks the dentry
created by the first before creating the file.

debugfs was written so it would be easy to use, no need for error checking.

Signed-off-by: Luis de Bethencourt 
Suggested-by: Greg Kroah-Hartman 
---
 drivers/staging/wilc1000/wilc_debugfs.c | 29 +
 1 file changed, 5 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_debugfs.c 
b/drivers/staging/wilc1000/wilc_debugfs.c
index fcbc95d..b052628 100644
--- a/drivers/staging/wilc1000/wilc_debugfs.c
+++ b/drivers/staging/wilc1000/wilc_debugfs.c
@@ -102,35 +102,16 @@ static struct wilc_debugfs_info_t debugfs_info[] = {
 static int __init wilc_debugfs_init(void)
 {
int i;
-
-   struct dentry *debugfs_files;
struct wilc_debugfs_info_t *info;
 
wilc_dir = debugfs_create_dir("wilc_wifi", NULL);
-   if (wilc_dir ==  ERR_PTR(-ENODEV)) {
-   /* it's not error. the debugfs is just not being enabled. */
-   printk("ERR, kernel has built without debugfs support\n");
-   return 0;
-   }
-
-   if (!wilc_dir) {
-   printk("ERR, debugfs create dir\n");
-   return -1;
-   }
-
for (i = 0; i < ARRAY_SIZE(debugfs_info); i++) {
info = &debugfs_info[i];
-   debugfs_files = debugfs_create_file(info->name,
-   info->perm,
-   wilc_dir,
-   &info->data,
-   &info->fops);
-
-   if (!debugfs_files) {
-   printk("ERR fail to create the debugfs file, %s\n", 
info->name);
-   debugfs_remove_recursive(wilc_dir);
-   return -1;
-   }
+   debugfs_create_file(info->name,
+   info->perm,
+   wilc_dir,
+   &info->data,
+   &info->fops);
}
return 0;
 }
-- 
2.6.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/2] staging: most: core: fix core issues

2016-06-27 Thread Christian Gromm
This patch set is needed to fix core related issues.

Christian Gromm (2):
  staging: most: core: remove debug print
  staging: most: core: rename device struct of core module

 drivers/staging/most/mostcore/core.c | 19 +++
 1 file changed, 7 insertions(+), 12 deletions(-)

-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 1/2] staging: wilc1000: fix error handling in wilc_debugfs_init()

2016-06-27 Thread Luis de Bethencourt
On 25/06/16 23:16, Greg KH wrote:
> On Sat, Jun 25, 2016 at 10:43:33PM +0100, Luis de Bethencourt wrote:
>> On 25/06/16 22:36, Greg KH wrote:
>>> On Thu, Jun 23, 2016 at 01:36:17PM +0100, Luis de Bethencourt wrote:
 The common format to check if a function returned an error pointer is to
 use PTR_ERR(). Instead of ERR_PTR() which is used to return said errors.

 Signed-off-by: Luis de Bethencourt 
 Reviewed-by: Julian Calaby 
 ---
  drivers/staging/wilc1000/wilc_debugfs.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/drivers/staging/wilc1000/wilc_debugfs.c 
 b/drivers/staging/wilc1000/wilc_debugfs.c
 index fcbc95d..48797dc 100644
 --- a/drivers/staging/wilc1000/wilc_debugfs.c
 +++ b/drivers/staging/wilc1000/wilc_debugfs.c
 @@ -107,7 +107,7 @@ static int __init wilc_debugfs_init(void)
struct wilc_debugfs_info_t *info;
  
wilc_dir = debugfs_create_dir("wilc_wifi", NULL);
 -  if (wilc_dir ==  ERR_PTR(-ENODEV)) {
 +  if (PTR_ERR(wilc_dir) == -ENODEV) {
/* it's not error. the debugfs is just not being enabled. */
printk("ERR, kernel has built without debugfs support\n");
return 0;
>>>
>>> No, the best way to do this is to just ignore the return value, you
>>> don't care about it.  It can be passed back into any debugfs calls just
>>> fine.
>>>
>>> So don't check the value and all is good, debugfs was written in a way
>>> to make it _easy_ to use, no need for fancy error checking at all with
>>> it.
>>>
>>> thanks,
>>>
>>> greg k-h
>>>
>>
>> Thanks for the review Greg.
>>
>> Just to make sure. You are proposing I just drop the 3 if checks? [0]
>>
>> If that's what you mean I will send a patch as soon as you confirm :)
>>
>> Happy hacking,
>> Luis
>>
>>
>>
>> [0] Making the function look like this:
>> static int __init wilc_debugfs_init(void)
>> {
>> int i;
>>
>> struct dentry *debugfs_files;
>> struct wilc_debugfs_info_t *info;
>>
>> wilc_dir = debugfs_create_dir("wilc_wifi", NULL);
>> for (i = 0; i < ARRAY_SIZE(debugfs_info); i++) {
>> info = &debugfs_info[i];
>> debugfs_files = debugfs_create_file(info->name,
>> info->perm,
>> wilc_dir,
>> &info->data,
>> &info->fops);
> 
> Why even assign anything to debugfs_files?
> 

Sorry Greg.

I was just confirming I understood your suggestion, and pasted that
without cleaning the code.

Thanks for review and idea!
Luis
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/2] staging: most: core: remove debug print

2016-06-27 Thread Christian Gromm
This patch removes the debug print in case an HDM ran out of rx buffers.
This is not needed since the status is reflected in the sysfs
channel_starving flag. Additionally, it prevents the system form slowing
down.

Signed-off-by: Christian Gromm 
Signed-off-by: Andrey Shvetsov 
---
 drivers/staging/most/mostcore/core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/most/mostcore/core.c 
b/drivers/staging/most/mostcore/core.c
index 7c619fe..cb4c6de 100644
--- a/drivers/staging/most/mostcore/core.c
+++ b/drivers/staging/most/mostcore/core.c
@@ -1468,10 +1468,8 @@ static void most_read_completion(struct mbo *mbo)
return;
}
 
-   if (atomic_sub_and_test(1, &c->mbo_nq_level)) {
-   pr_info("WARN: rx device out of buffers\n");
+   if (atomic_sub_and_test(1, &c->mbo_nq_level))
c->is_starving = 1;
-   }
 
if (c->aim0.refs && c->aim0.ptr->rx_completion &&
c->aim0.ptr->rx_completion(mbo) == 0)
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2] staging: most: core: rename device struct of core module

2016-06-27 Thread Christian Gromm
This patch gives the struct device variable of the core a more meaningful
name.

Signed-off-by: Christian Gromm 
Signed-off-by: Andrey Shvetsov 
---
 drivers/staging/most/mostcore/core.c | 15 ++-
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/most/mostcore/core.c 
b/drivers/staging/most/mostcore/core.c
index cb4c6de..b03cdc9 100644
--- a/drivers/staging/most/mostcore/core.c
+++ b/drivers/staging/most/mostcore/core.c
@@ -33,7 +33,7 @@
 #define STRING_SIZE80
 
 static struct class *most_class;
-static struct device *class_glue_dir;
+static struct device *core_dev;
 static struct ida mdev_id;
 static int dummy_num_buffers;
 
@@ -1877,22 +1877,19 @@ static int __init most_init(void)
goto exit_class;
}
 
-   class_glue_dir =
-   device_create(most_class, NULL, 0, NULL, "mostcore");
-   if (IS_ERR(class_glue_dir)) {
-   err = PTR_ERR(class_glue_dir);
+   core_dev = device_create(most_class, NULL, 0, NULL, "mostcore");
+   if (IS_ERR(core_dev)) {
+   err = PTR_ERR(core_dev);
goto exit_driver;
}
 
-   most_aim_kset =
-   kset_create_and_add("aims", NULL, &class_glue_dir->kobj);
+   most_aim_kset = kset_create_and_add("aims", NULL, &core_dev->kobj);
if (!most_aim_kset) {
err = -ENOMEM;
goto exit_class_container;
}
 
-   most_inst_kset =
-   kset_create_and_add("devices", NULL, &class_glue_dir->kobj);
+   most_inst_kset = kset_create_and_add("devices", NULL, &core_dev->kobj);
if (!most_inst_kset) {
err = -ENOMEM;
goto exit_driver_kset;
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3] MAINTAINERS: remove unreachable people that have left Atmel

2016-06-27 Thread Luis de Bethencourt
When sending an email regarding a patch to wilc1000, you get the following
automatic replies:
"Sung_hoon Cho is no longer with Atmel Corporation."
"Kang_hee Park is no longer with Atmel Corporation."
"Dong_ho Shin is no longer with Atmel Corporation."
"Bo_moon Kim is no longer with Atmel Corporation."
"Min_su Kim is no longer with Atmel Corporation."
"Jun_hyuk Lee is no longer with Atmel Corporation."

Removing this entry since none of the maintainers are reachable.

Signed-off-by: Luis de Bethencourt 
---

Hi,

This is unfortunate, but Greg recommended we drop the whole entry for now [0].

If nobody with more experience volunteers, I am happy to continue cleaning and
supporting this driver. This hardware is used by people in the Raspberry Pi
community, which is why I think it is worth it [1].

I am going to contact Atmel and see if they can provide me with a more complete
datasheet than they one in their website [2]. Since I would need this, plus the
hardware, before I can commit to anything.

Hopefully somebody from Atmel steps up since they are the experts.

Thanks,
Luis



[0] https://lkml.org/lkml/2016/6/26/202
[1] https://hackaday.io/project/9759-yet-another-pizero-wi-fi-hat
[2] http://www.atmel.com/Images/Atmel-42491-WILC1000B-MUT_Datasheet.pdf

 MAINTAINERS | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 2d059dd..8bd968f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11075,17 +11075,6 @@ M: Forest Bond 
 S: Odd Fixes
 F: drivers/staging/vt665?/
 
-STAGING - WILC1000 WIFI DRIVER
-M: Johnny Kim 
-M: Austin Shin 
-M: Chris Park 
-M: Tony Cho 
-M: Glen Lee 
-M: Leo Kim 
-L: linux-wirel...@vger.kernel.org
-S: Supported
-F: drivers/staging/wilc1000/
-
 STAGING - XGI Z7,Z9,Z11 PCI DISPLAY DRIVER
 M: Arnaud Patard 
 S: Odd Fixes
-- 
2.6.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/2]staging:vt6656:dpc.c:Fix parantheses alignment

2016-06-27 Thread Rithvik Patibandla
This patch fixes "Alignment should match open parantheses" check
thrown by checkpatch.pl

Signed-off-by: Rithvik Patibandla 
---
 drivers/staging/vt6656/dpc.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c
index 6019aac..2de6982 100644
--- a/drivers/staging/vt6656/dpc.c
+++ b/drivers/staging/vt6656/dpc.c
@@ -34,7 +34,7 @@
 #include "rf.h"
 
 int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
-   unsigned long bytes_received)
+   unsigned long bytes_received)
 {
struct ieee80211_hw *hw = priv->hw;
struct ieee80211_supported_band *sband;
@@ -87,10 +87,10 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb 
*ptr_rcb,
 
/*Fix hardware bug => PLCP_Length error */
if (((bytes_received - (*pay_load_len)) > 27) ||
-   ((bytes_received - (*pay_load_len)) < 24) ||
-   (bytes_received < (*pay_load_len))) {
+   ((bytes_received - (*pay_load_len)) < 24) ||
+   (bytes_received < (*pay_load_len))) {
dev_dbg(&priv->usb->dev, "Wrong PLCP Length %x\n",
-   *pay_load_len);
+   *pay_load_len);
return false;
}
 
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2]staging:vt6656:dpc.c:Fix spaces

2016-06-27 Thread Rithvik Patibandla
The following patch fixes two checks thrown by checkpatch.pl, "Spaces
preferred around '+'" and "No space is necessary after a cast"

Signed-off-by: Rithvik Patibandla 
---
 drivers/staging/vt6656/dpc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c
index 2de6982..c352c70 100644
--- a/drivers/staging/vt6656/dpc.c
+++ b/drivers/staging/vt6656/dpc.c
@@ -75,15 +75,15 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb 
*ptr_rcb,
 
skb_data = (u8 *)skb->data;
 
-   rx_sts = skb_data+4;
-   rx_rate = skb_data+5;
+   rx_sts = skb_data + 4;
+   rx_rate = skb_data + 5;
 
/* real Frame Size = USBframe_size -4WbkStatus - 4RxStatus */
/* -8TSF - 4RSR - 4SQ3 - ?Padding */
 
/* if SQ3 the range is 24~27, if no SQ3 the range is 20~23 */
 
-   pay_load_len = (u16 *) (skb_data + 6);
+   pay_load_len = (u16 *)(skb_data + 6);
 
/*Fix hardware bug => PLCP_Length error */
if (((bytes_received - (*pay_load_len)) > 27) ||
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] MAINTAINERS: Update maintainer entry for wilc1000

2016-06-27 Thread Nicolas Ferre
From: Aditya Shankar 

Take the maintenance of the Atmel WIFI staging driver wilc1000.
Former maintainers are no more with Atmel.

Reported-by: Loic Lefort 
Signed-off-by: Aditya Shankar 
Signed-off-by: Ganesh Krishna 
Signed-off-by: Nicolas Ferre 
---
Hi Luis, Greg, 

I'd like that we don't delete the entry for this wilc1000 driver
but change it with the patch below.
After the Microchip - Atmel merger, Aditya and Ganesh will take over the
maintenance of this driver and will continue the work that our former
colleagues started.

Thanks, bye.

 MAINTAINERS | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 51447a517095..9142e08ba8ae 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10931,12 +10931,8 @@ S: Odd Fixes
 F: drivers/staging/vt665?/
 
 STAGING - WILC1000 WIFI DRIVER
-M: Johnny Kim 
-M: Austin Shin 
-M: Chris Park 
-M: Tony Cho 
-M: Glen Lee 
-M: Leo Kim 
+M: Aditya Shankar 
+M: Ganesh Krishna 
 L: linux-wirel...@vger.kernel.org
 S: Supported
 F: drivers/staging/wilc1000/
-- 
2.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] MAINTAINERS: Update maintainer entry for wilc1000

2016-06-27 Thread Luis de Bethencourt
On 27/06/16 15:10, Nicolas Ferre wrote:
> From: Aditya Shankar 
> 
> Take the maintenance of the Atmel WIFI staging driver wilc1000.
> Former maintainers are no more with Atmel.
> 
> Reported-by: Loic Lefort 
> Signed-off-by: Aditya Shankar 
> Signed-off-by: Ganesh Krishna 
> Signed-off-by: Nicolas Ferre 
> ---
> Hi Luis, Greg, 
> 
> I'd like that we don't delete the entry for this wilc1000 driver
> but change it with the patch below.
> After the Microchip - Atmel merger, Aditya and Ganesh will take over the
> maintenance of this driver and will continue the work that our former
> colleagues started.
> 
> Thanks, bye.
> 

Nice :) This is good news

I am happy to help as well if I can get my hands on the hardware.

Acked-by: Luis de Bethencourt 

Thanks,
Luis


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH]staging:vt6656:dpc.h:fix parantheses alignment

2016-06-27 Thread Rithvik Patibandla
The following patch fixes "Alignment should match open parantheses"
check thrown by checkpatch.pl

Signed-off-by: Rithvik Patibandla 
---
 drivers/staging/vt6656/dpc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vt6656/dpc.h b/drivers/staging/vt6656/dpc.h
index 5a92bd8..ff1850c 100644
--- a/drivers/staging/vt6656/dpc.h
+++ b/drivers/staging/vt6656/dpc.h
@@ -29,6 +29,6 @@
 #include "device.h"
 
 int vnt_rx_data(struct vnt_private *, struct vnt_rcb *,
-   unsigned long bytes_received);
+   unsigned long bytes_received);
 
 #endif /* __RXTX_H__ */
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 00/10 V2] rtlwifi: Various clean-ups for the hwinfo routines

2016-06-27 Thread Larry Finger
The rtlwifi family of drivers use similar routines to extract hardware
information from EFUSE. This set of patches create a common routine to
extract this data, and converts most of the drivers to use this routine.

In addition, a complicated set of if ... else if ... else statements are
present in rtl8723ae. These are converted into switch statements that
are much easier to read.

The changes in the hwinfo routines was suggested by Arnd Bergmann.

All of this material is intended for kernel 4.8.

Signed-off-by: Larry Finger 
---
V2 - Applied changes suggested by Joe Perches
 Fixed a bug found after V1 was submitted
 These patches require ("rtlwifi: Add missing newlines to RT_TRACE calls")
submitted by Joe Perches.

Larry Finger (10):
  rtlwifi: Create common routine to get hardware info
  rtlwifi: rtl8192ce: Convert driver to use common hardware info routine
  rtlwifi: rtl8192cu: Convert driver to use common hardware info routine
  rtlwifi: rtl8188ee: Convert driver to use common hardware info routine
  rtlwifi: rtl8192ee: Convert driver to use common hardware info routine
  rtlwifi: rtl8723ee: Convert driver to use common hardware info routine
  rtlwifi: rtl8723be: Convert driver to use common hardware info routine
  rtlwifi: rtl8821ae: Convert driver to use common hardware info routine
  rtlwifi: rtl8192de: Convert driver to use common hardware info routine
  rtlwifi: rtl8723ae: Clean up the hardware info routine

 drivers/net/wireless/realtek/rtlwifi/efuse.c   |  78 ++
 drivers/net/wireless/realtek/rtlwifi/efuse.h   |   2 +
 .../net/wireless/realtek/rtlwifi/rtl8188ee/hw.c|  76 +-
 .../net/wireless/realtek/rtlwifi/rtl8192ce/hw.c|  83 +-
 .../net/wireless/realtek/rtlwifi/rtl8192cu/hw.c|  61 ++---
 .../net/wireless/realtek/rtlwifi/rtl8192de/hw.c|  77 ++
 .../net/wireless/realtek/rtlwifi/rtl8192ee/hw.c|  73 +-
 .../net/wireless/realtek/rtlwifi/rtl8723ae/hw.c| 286 +
 .../net/wireless/realtek/rtlwifi/rtl8723be/hw.c|  74 +-
 .../net/wireless/realtek/rtlwifi/rtl8821ae/hw.c|  84 +-
 10 files changed, 288 insertions(+), 606 deletions(-)

-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 03/10] rtlwifi: rtl8192cu: Convert driver to use common hardware info routine

2016-06-27 Thread Larry Finger
The driver for RTL8192CU chips is converted to use the common routine
for getting the hardware information.

Reported-by: Arnd Bergmann 
Signed-off-by: Larry Finger 
Cc: Arnd Bergmann 
---
V2 - Fixes bug found after V1 was submitted.

This patch requires ("rtlwifi: Add missing newlines to RT_TRACE calls")
submitted by Joe Perches.
---
 .../net/wireless/realtek/rtlwifi/rtl8192cu/hw.c| 61 ++
 1 file changed, 15 insertions(+), 46 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c
index ae1129f..8789752 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c
@@ -347,56 +347,24 @@ static void _rtl92cu_read_adapter_info(struct 
ieee80211_hw *hw)
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
-   u16 i, usvalue;
-   u8 hwinfo[HWSET_MAX_SIZE] = {0};
-   u16 eeprom_id;
-
-   switch (rtlefuse->epromtype) {
-   case EEPROM_BOOT_EFUSE:
-   rtl_efuse_shadow_map_update(hw);
-   break;
-
-   case EEPROM_93C46:
-   RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
-"RTL819X Not boot from eeprom, check it !!\n");
+   int params[] = {RTL8190_EEPROM_ID, EEPROM_VID, EEPROM_DID,
+   EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR,
+   EEPROM_CHANNELPLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID,
+   0};
+   u8 *hwinfo;
+
+   hwinfo = kzalloc(HWSET_MAX_SIZE, GFP_KERNEL);
+   if (!hwinfo)
return;
 
-   default:
-   pr_warn("rtl92cu: no efuse data\n\n");
-   return;
-   }
-   memcpy(hwinfo, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], HWSET_MAX_SIZE);
-   RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_LOUD, "MAP",
- hwinfo, HWSET_MAX_SIZE);
-   eeprom_id = le16_to_cpu(*((__le16 *)&hwinfo[0]));
-   if (eeprom_id != RTL8190_EEPROM_ID) {
-   RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
-"EEPROM ID(%#x) is invalid!!\n", eeprom_id);
-   rtlefuse->autoload_failflag = true;
-   } else {
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n");
-   rtlefuse->autoload_failflag = false;
-   }
-   if (rtlefuse->autoload_failflag)
-   return;
-   for (i = 0; i < 6; i += 2) {
-   usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i];
-   *((u16 *) (&rtlefuse->dev_addr[i])) = usvalue;
-   }
-   pr_info("MAC address: %pM\n", rtlefuse->dev_addr);
+   if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params))
+   goto exit;
+
_rtl92cu_read_txpower_info_from_hwpg(hw,
   rtlefuse->autoload_failflag, hwinfo);
-   rtlefuse->eeprom_vid = le16_to_cpu(*(__le16 *)&hwinfo[EEPROM_VID]);
-   rtlefuse->eeprom_did = le16_to_cpu(*(__le16 *)&hwinfo[EEPROM_DID]);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, " VID = 0x%02x PID = 0x%02x\n",
-rtlefuse->eeprom_vid, rtlefuse->eeprom_did);
-   rtlefuse->eeprom_channelplan = hwinfo[EEPROM_CHANNELPLAN];
-   rtlefuse->eeprom_version =
-le16_to_cpu(*(__le16 *)&hwinfo[EEPROM_VERSION]);
+   _rtl92cu_read_board_type(hw, hwinfo);
+
rtlefuse->txpwr_fromeprom = true;
-   rtlefuse->eeprom_oemid = hwinfo[EEPROM_CUSTOMER_ID];
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "EEPROM Customer ID: 0x%2x\n",
-rtlefuse->eeprom_oemid);
if (rtlhal->oem_id == RT_CID_DEFAULT) {
switch (rtlefuse->eeprom_oemid) {
case EEPROM_CID_DEFAULT:
@@ -422,7 +390,8 @@ static void _rtl92cu_read_adapter_info(struct ieee80211_hw 
*hw)
break;
}
}
-   _rtl92cu_read_board_type(hw, hwinfo);
+exit:
+   kfree(hwinfo);
 }
 
 static void _rtl92cu_hal_customized_behavior(struct ieee80211_hw *hw)
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 06/10] rtlwifi: rtl8723ae: Convert driver to use common hardware info routine

2016-06-27 Thread Larry Finger
The driver for RTL8723AE chips is converted to use the common routine
for getting the hardware information.

Reported-by: Arnd Bergmann 
Signed-off-by: Larry Finger 
Cc: Arnd Bergmann 
---
V2 - Fixes bug found after V1 was submitted.

This patch requires ("rtlwifi: Add missing newlines to RT_TRACE calls")
submitted by Joe Perches.
---
 .../net/wireless/realtek/rtlwifi/rtl8723ae/hw.c| 76 --
 1 file changed, 11 insertions(+), 65 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c
index 0025e21..662c445 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c
@@ -1630,67 +1630,22 @@ static void _rtl8723e_read_adapter_info(struct 
ieee80211_hw *hw,
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
-   struct device *dev = &rtl_pcipriv(hw)->dev.pdev->dev;
-   u16 i, usvalue;
-   u8 hwinfo[HWSET_MAX_SIZE];
-   u16 eeprom_id;
+   int params[] = {RTL8190_EEPROM_ID, EEPROM_VID, EEPROM_DID,
+   EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR,
+   EEPROM_CHANNELPLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID,
+   COUNTRY_CODE_WORLD_WIDE_13};
+   u8 *hwinfo;
 
if (b_pseudo_test) {
/* need add */
return;
}
-   switch (rtlefuse->epromtype) {
-   case EEPROM_BOOT_EFUSE:
-   rtl_efuse_shadow_map_update(hw);
-
-   case EEPROM_93C46:
-   RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
-"RTL819X Not boot from eeprom, check it !!\n");
+   hwinfo = kzalloc(HWSET_MAX_SIZE, GFP_KERNEL);
+   if (!hwinfo)
return;
 
-   default:
-   dev_warn(dev, "no efuse data\n");
-   }
-   memcpy(hwinfo, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], HWSET_MAX_SIZE);
-
-   RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP\n",
- hwinfo, HWSET_MAX_SIZE);
-
-   eeprom_id = *((u16 *)&hwinfo[0]);
-   if (eeprom_id != RTL8190_EEPROM_ID) {
-   RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
-"EEPROM ID(%#x) is invalid!!\n", eeprom_id);
-   rtlefuse->autoload_failflag = true;
-   } else {
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n");
-   rtlefuse->autoload_failflag = false;
-   }
-
-   if (rtlefuse->autoload_failflag)
-   return;
-
-   rtlefuse->eeprom_vid = *(u16 *)&hwinfo[EEPROM_VID];
-   rtlefuse->eeprom_did = *(u16 *)&hwinfo[EEPROM_DID];
-   rtlefuse->eeprom_svid = *(u16 *)&hwinfo[EEPROM_SVID];
-   rtlefuse->eeprom_smid = *(u16 *)&hwinfo[EEPROM_SMID];
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROMId = 0x%4x\n", eeprom_id);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid);
-
-   for (i = 0; i < 6; i += 2) {
-   usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i];
-   *((u16 *)(&rtlefuse->dev_addr[i])) = usvalue;
-   }
-
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-"dev_addr: %pM\n", rtlefuse->dev_addr);
+   if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params))
+   goto exit;
 
_rtl8723e_read_txpower_info_from_hwpg(hw, rtlefuse->autoload_failflag,
  hwinfo);
@@ -1698,17 +1653,6 @@ static void _rtl8723e_read_adapter_info(struct 
ieee80211_hw *hw,
rtl8723e_read_bt_coexist_info_from_hwpg(hw,
rtlefuse->autoload_failflag, hwinfo);
 
-   rtlefuse->eeprom_channelplan = hwinfo[EEPROM_CHANNELPLAN];
-   rtlefuse->eeprom_version = *(u16 *)&hwinfo[EEPROM_VERSION];
-   rtlefuse->txpwr_fromeprom = true;
-   rtlefuse->eeprom_oemid = hwinfo[EEPROM_CUSTOMER_ID];
-
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid);
-
-   /* set channel paln to world wide 13 */
-   rtlefuse->channel_plan = COUNTRY_CODE_WORLD_WIDE_13;
-
if (rtlhal->oem_id == RT_CID_DEFAULT) {
switch (rtlefuse->eeprom_oemid) {
case EEPROM_CID_DEFAULT:
@@ -1836,6 +1780,8 @@ static void _rtl8723e_read_adapter_info(struct 
ieee80211_hw *hw,
 
}
}
+exit:
+   kfree(hwinfo);
 }
 
 static void _rtl8723e_hal_customized_behavior(struct ie

[PATCH v2 01/10] rtlwifi: Create common routine to get hardware info

2016-06-27 Thread Larry Finger
All of the rtlwifi family of drivers have a similar routine that acquires
the hardware info from efuse and initializes a number of variables in the
driver's private area. A common routine is created for all drivers to use.

Reported-by: Arnd Bergmann 
Signed-off-by: Larry Finger 
Cc: Arnd Bergmann 
---
V2 - Fixes bug found after V1 was submitted.
 Incorporates change suggested by Joe Perches

This patch requires ("rtlwifi: Add missing newlines to RT_TRACE calls")
submitted by Joe Perches.
---
 drivers/net/wireless/realtek/rtlwifi/efuse.c | 78 
 drivers/net/wireless/realtek/rtlwifi/efuse.h |  2 +
 2 files changed, 80 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtlwifi/efuse.c 
b/drivers/net/wireless/realtek/rtlwifi/efuse.c
index 0b4082c..7becfef 100644
--- a/drivers/net/wireless/realtek/rtlwifi/efuse.c
+++ b/drivers/net/wireless/realtek/rtlwifi/efuse.c
@@ -24,6 +24,7 @@
  */
 #include "wifi.h"
 #include "efuse.h"
+#include "pci.h"
 #include 
 
 static const u8 MAX_PGPKT_SIZE = 9;
@@ -1243,3 +1244,80 @@ static u8 efuse_calculate_word_cnts(u8 word_en)
return word_cnts;
 }
 
+int rtl_get_hwinfo(struct ieee80211_hw *hw, struct rtl_priv *rtlpriv,
+  int max_size, u8 *hwinfo, int *params)
+{
+   struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
+   struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw);
+   struct device *dev = &rtlpcipriv->dev.pdev->dev;
+   u16 eeprom_id;
+   u16 i, usvalue;
+
+   switch (rtlefuse->epromtype) {
+   case EEPROM_BOOT_EFUSE:
+   rtl_efuse_shadow_map_update(hw);
+   break;
+
+   case EEPROM_93C46:
+   RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
+"RTL8XXX did not boot from eeprom, check it !!\n");
+   return 1;
+
+   default:
+   dev_warn(dev, "no efuse data\n");
+   return 1;
+   }
+
+   memcpy(hwinfo, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], max_size);
+
+   RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP",
+ hwinfo, max_size);
+
+   eeprom_id = *((u16 *)&hwinfo[0]);
+   if (eeprom_id != params[0]) {
+   RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
+"EEPROM ID(%#x) is invalid!!\n", eeprom_id);
+   rtlefuse->autoload_failflag = true;
+   } else {
+   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n");
+   rtlefuse->autoload_failflag = false;
+   }
+
+   if (rtlefuse->autoload_failflag)
+   return 1;
+
+   rtlefuse->eeprom_vid = *(u16 *)&hwinfo[params[1]];
+   rtlefuse->eeprom_did = *(u16 *)&hwinfo[params[2]];
+   rtlefuse->eeprom_svid = *(u16 *)&hwinfo[params[3]];
+   rtlefuse->eeprom_smid = *(u16 *)&hwinfo[params[4]];
+   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
+"EEPROMId = 0x%4x\n", eeprom_id);
+   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
+"EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid);
+   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
+"EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did);
+   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
+"EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid);
+   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
+"EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid);
+
+   for (i = 0; i < 6; i += 2) {
+   usvalue = *(u16 *)&hwinfo[params[5] + i];
+   *((u16 *)(&rtlefuse->dev_addr[i])) = usvalue;
+   }
+   RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "%pM\n", rtlefuse->dev_addr);
+
+   rtlefuse->eeprom_channelplan = *&hwinfo[params[6]];
+   rtlefuse->eeprom_version = *(u16 *)&hwinfo[params[7]];
+   rtlefuse->txpwr_fromeprom = true;
+   rtlefuse->eeprom_oemid = *&hwinfo[params[8]];
+
+   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
+"EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid);
+
+   /* set channel plan to world wide 13 */
+   rtlefuse->channel_plan = params[9];
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(rtl_get_hwinfo);
diff --git a/drivers/net/wireless/realtek/rtlwifi/efuse.h 
b/drivers/net/wireless/realtek/rtlwifi/efuse.h
index be02e78..51aa121 100644
--- a/drivers/net/wireless/realtek/rtlwifi/efuse.h
+++ b/drivers/net/wireless/realtek/rtlwifi/efuse.h
@@ -109,5 +109,7 @@ bool efuse_shadow_update_chk(struct ieee80211_hw *hw);
 void rtl_efuse_shadow_map_update(struct ieee80211_hw *hw);
 void efuse_force_write_vendor_Id(struct ieee80211_hw *hw);
 void efuse_re_pg_section(struct ieee80211_hw *hw, u8 section_idx);
+int rtl_get_hwinfo(struct ieee80211_hw *hw, struct rtl_priv *rtlpriv,
+  int max_size, u8 *hwinfo, int *params);
 
 #endif
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/

[PATCH v2 02/10] rtlwifi: rtl8192ce: Convert driver to use common hardware info routine

2016-06-27 Thread Larry Finger
The driver for RTL8192CE chips is converted to use the common routine
for getting the hardware information.

Reported-by: Arnd Bergmann 
Signed-off-by: Larry Finger 
Cc: Arnd Bergmann 
---
V2 - Fixes bug found after V1 was submitted.

This patch requires ("rtlwifi: Add missing newlines to RT_TRACE calls")
submitted by Joe Perches.
---
 .../net/wireless/realtek/rtlwifi/rtl8192ce/hw.c| 83 --
 1 file changed, 12 insertions(+), 71 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c
index 809a021..2446079 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c
@@ -1680,65 +1680,18 @@ static void _rtl92ce_read_adapter_info(struct 
ieee80211_hw *hw)
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
-   struct device *dev = &rtl_pcipriv(hw)->dev.pdev->dev;
-   u16 i, usvalue;
-   u8 hwinfo[HWSET_MAX_SIZE];
-   u16 eeprom_id;
-
-   switch (rtlefuse->epromtype) {
-   case EEPROM_BOOT_EFUSE:
-   rtl_efuse_shadow_map_update(hw);
-   break;
-
-   case EEPROM_93C46:
-   RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
-"RTL819X Not boot from eeprom, check it !!\n");
-   return;
-
-   default:
-   dev_warn(dev, "no efuse data\n");
-   return;
-   }
-
-   memcpy(hwinfo, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], HWSET_MAX_SIZE);
-
-   RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP",
- hwinfo, HWSET_MAX_SIZE);
-
-   eeprom_id = *((u16 *)&hwinfo[0]);
-   if (eeprom_id != RTL8190_EEPROM_ID) {
-   RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
-"EEPROM ID(%#x) is invalid!!\n", eeprom_id);
-   rtlefuse->autoload_failflag = true;
-   } else {
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n");
-   rtlefuse->autoload_failflag = false;
-   }
-
-   if (rtlefuse->autoload_failflag)
+   int params[] = {RTL8190_EEPROM_ID, EEPROM_VID, EEPROM_DID,
+   EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR,
+   EEPROM_CHANNELPLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID,
+   COUNTRY_CODE_WORLD_WIDE_13};
+   u8 *hwinfo;
+
+   hwinfo = kzalloc(HWSET_MAX_SIZE, GFP_KERNEL);
+   if (!hwinfo)
return;
 
-   rtlefuse->eeprom_vid = *(u16 *)&hwinfo[EEPROM_VID];
-   rtlefuse->eeprom_did = *(u16 *)&hwinfo[EEPROM_DID];
-   rtlefuse->eeprom_svid = *(u16 *)&hwinfo[EEPROM_SVID];
-   rtlefuse->eeprom_smid = *(u16 *)&hwinfo[EEPROM_SMID];
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROMId = 0x%4x\n", eeprom_id);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid);
-
-   for (i = 0; i < 6; i += 2) {
-   usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i];
-   *((u16 *) (&rtlefuse->dev_addr[i])) = usvalue;
-   }
-
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "%pM\n", rtlefuse->dev_addr);
+   if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params))
+   goto exit;
 
_rtl92ce_read_txpower_info_from_hwpg(hw,
 rtlefuse->autoload_failflag,
@@ -1747,18 +1700,6 @@ static void _rtl92ce_read_adapter_info(struct 
ieee80211_hw *hw)
rtl8192ce_read_bt_coexist_info_from_hwpg(hw,
 rtlefuse->autoload_failflag,
 hwinfo);
-
-   rtlefuse->eeprom_channelplan = *&hwinfo[EEPROM_CHANNELPLAN];
-   rtlefuse->eeprom_version = *(u16 *)&hwinfo[EEPROM_VERSION];
-   rtlefuse->txpwr_fromeprom = true;
-   rtlefuse->eeprom_oemid = *&hwinfo[EEPROM_CUSTOMER_ID];
-
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid);
-
-   /* set channel paln to world wide 13 */
-   rtlefuse->channel_plan = COUNTRY_CODE_WORLD_WIDE_13;
-
if (rtlhal->oem_id == RT_CID_DEFAULT) {
switch (rtlefuse->eeprom_oemid) {
case EEPROM_CID_DEFAULT:
@@ -1782,10 +1723,10 @@ static void _rtl92ce_read_adapter_info(struct 
ieee80211_hw *hw)
default:
rtlhal->oem_id = RT_CID_DEFAULT;
break;
-
  

[PATCH v2 04/10] rtlwifi: rtl8188ee: Convert driver to use common hardware info routine

2016-06-27 Thread Larry Finger
The driver for RTL8188EE chips is converted to use the common routine
for getting the hardware information.

Reported-by: Arnd Bergmann 
Signed-off-by: Larry Finger 
Cc: Arnd Bergmann 
---
V2 - Fixes bug found after V1 was submitted.

This patch requires ("rtlwifi: Add missing newlines to RT_TRACE calls")
submitted by Joe Perches.
---
 .../net/wireless/realtek/rtlwifi/rtl8188ee/hw.c| 76 --
 1 file changed, 13 insertions(+), 63 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c
index cfdf6d8..4ab6201 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c
@@ -1835,76 +1835,24 @@ static void _rtl88ee_read_adapter_info(struct 
ieee80211_hw *hw)
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
-   u16 i, usvalue;
-   u8 hwinfo[HWSET_MAX_SIZE];
-   u16 eeprom_id;
-
-   switch (rtlefuse->epromtype) {
-   case EEPROM_BOOT_EFUSE:
-   rtl_efuse_shadow_map_update(hw);
-   break;
-
-   case EEPROM_93C46:
-   RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
-"RTL819X Not boot from eeprom, check it !!\n");
+   int params[] = {RTL8188E_EEPROM_ID, EEPROM_VID, EEPROM_DID,
+   EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR,
+   EEPROM_CHANNELPLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID,
+   COUNTRY_CODE_WORLD_WIDE_13};
+   u8 *hwinfo;
+
+   hwinfo = kzalloc(HWSET_MAX_SIZE, GFP_KERNEL);
+   if (!hwinfo)
return;
 
-   default:
-   RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
-"boot from neither eeprom nor efuse, check it !!\n");
-   return;
-   }
-   memcpy(hwinfo, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], HWSET_MAX_SIZE);
-
-   RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP\n",
- hwinfo, HWSET_MAX_SIZE);
-
-   eeprom_id = *((u16 *)&hwinfo[0]);
-   if (eeprom_id != RTL8188E_EEPROM_ID) {
-   RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
-"EEPROM ID(%#x) is invalid!!\n", eeprom_id);
-   rtlefuse->autoload_failflag = true;
-   } else {
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n");
-   rtlefuse->autoload_failflag = false;
-   }
+   if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params))
+   goto exit;
 
-   if (rtlefuse->autoload_failflag == true)
-   return;
-   /*VID DID SVID SDID*/
-   rtlefuse->eeprom_vid = *(u16 *)&hwinfo[EEPROM_VID];
-   rtlefuse->eeprom_did = *(u16 *)&hwinfo[EEPROM_DID];
-   rtlefuse->eeprom_svid = *(u16 *)&hwinfo[EEPROM_SVID];
-   rtlefuse->eeprom_smid = *(u16 *)&hwinfo[EEPROM_SMID];
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROMId = 0x%4x\n", eeprom_id);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid);
-   /*customer ID*/
-   rtlefuse->eeprom_oemid = hwinfo[EEPROM_CUSTOMER_ID];
if (rtlefuse->eeprom_oemid == 0xFF)
-   rtlefuse->eeprom_oemid =0;
+   rtlefuse->eeprom_oemid = 0;
 
RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
 "EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid);
-   /*EEPROM version*/
-   rtlefuse->eeprom_version = *(u16 *)&hwinfo[EEPROM_VERSION];
-   /*mac address*/
-   for (i = 0; i < 6; i += 2) {
-   usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i];
-   *((u16 *)(&rtlefuse->dev_addr[i])) = usvalue;
-   }
-
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-"dev_addr: %pM\n", rtlefuse->dev_addr);
-   /*channel plan */
-   rtlefuse->eeprom_channelplan = hwinfo[EEPROM_CHANNELPLAN];
/* set channel plan from efuse */
rtlefuse->channel_plan = rtlefuse->eeprom_channelplan;
/*tx power*/
@@ -1978,6 +1926,8 @@ static void _rtl88ee_read_adapter_info(struct 
ieee80211_hw *hw)
 
}
}
+exit:
+   kfree(hwinfo);
 }
 
 static void _rtl88ee_hal_customized_behavior(struct ieee80211_hw *hw)
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 08/10] rtlwifi: rtl8821ae: Convert driver to use common hardware info routine

2016-06-27 Thread Larry Finger
The driver for RTL8821AE chips is converted to use the common routine
for getting the hardware information.

Reported-by: Arnd Bergmann 
Signed-off-by: Larry Finger 
Cc: Arnd Bergmann 
---
V2 - Fixes bug found after V1 was submitted.

This patch requires ("rtlwifi: Add missing newlines to RT_TRACE calls")
submitted by Joe Perches.
---
 .../net/wireless/realtek/rtlwifi/rtl8821ae/hw.c| 84 +++---
 1 file changed, 11 insertions(+), 73 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
index ac8836b..0cddf1a 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
@@ -3101,86 +3101,22 @@ static void _rtl8821ae_read_adapter_info(struct 
ieee80211_hw *hw, bool b_pseudo_
struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
-   struct device *dev = &rtl_pcipriv(hw)->dev.pdev->dev;
-   u16 i, usvalue;
-   u8 hwinfo[HWSET_MAX_SIZE];
-   u16 eeprom_id;
+   int params[] = {RTL_EEPROM_ID, EEPROM_VID, EEPROM_DID,
+   EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR,
+   EEPROM_CHANNELPLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID,
+   COUNTRY_CODE_WORLD_WIDE_13};
+   u8 *hwinfo;
 
if (b_pseudo_test) {
;/* need add */
}
 
-   switch (rtlefuse->epromtype) {
-   case EEPROM_BOOT_EFUSE:
-   rtl_efuse_shadow_map_update(hw);
-   break;
-
-   case EEPROM_93C46:
-   RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
-"RTL819X Not boot from eeprom, check it !!\n");
-   return;
-
-   default:
-   dev_warn(dev, "no efuse data\n");
-   }
-   memcpy(hwinfo, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], HWSET_MAX_SIZE);
-
-   RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP\n",
- hwinfo, HWSET_MAX_SIZE);
-
-   eeprom_id = *((u16 *)&hwinfo[0]);
-   if (eeprom_id != RTL_EEPROM_ID) {
-   RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
-"EEPROM ID(%#x) is invalid!!\n", eeprom_id);
-   rtlefuse->autoload_failflag = true;
-   } else {
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n");
-   rtlefuse->autoload_failflag = false;
-   }
-
-   if (rtlefuse->autoload_failflag) {
-   RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
-"RTL8812AE autoload_failflag, check it !!\n");
+   hwinfo = kzalloc(HWSET_MAX_SIZE, GFP_KERNEL);
+   if (!hwinfo)
return;
-   }
-
-   rtlefuse->eeprom_version = *(u8 *)&hwinfo[EEPROM_VERSION];
-   if (rtlefuse->eeprom_version == 0xff)
-   rtlefuse->eeprom_version = 0;
-
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM version: 0x%2x\n", rtlefuse->eeprom_version);
-
-   rtlefuse->eeprom_vid = *(u16 *)&hwinfo[EEPROM_VID];
-   rtlefuse->eeprom_did = *(u16 *)&hwinfo[EEPROM_DID];
-   rtlefuse->eeprom_svid = *(u16 *)&hwinfo[EEPROM_SVID];
-   rtlefuse->eeprom_smid = *(u16 *)&hwinfo[EEPROM_SMID];
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROMId = 0x%4x\n", eeprom_id);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid);
-
-   /*customer ID*/
-   rtlefuse->eeprom_oemid = *(u8 *)&hwinfo[EEPROM_CUSTOMER_ID];
-   if (rtlefuse->eeprom_oemid == 0xFF)
-   rtlefuse->eeprom_oemid = 0;
-
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid);
-
-   for (i = 0; i < 6; i += 2) {
-   usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i];
-   *((u16 *)(&rtlefuse->dev_addr[i])) = usvalue;
-   }
 
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-"dev_addr: %pM\n", rtlefuse->dev_addr);
+   if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params))
+   goto exit;
 
_rtl8821ae_read_txpower_info_from_hwpg(hw, rtlefuse->autoload_failflag,
   hwinfo);
@@ -3280,6 +3216,8 @@ static void _rtl8821ae_read_adapter_info(struct 
ieee80211_hw *hw, bool b_pseudo_
break;
}
}
+exit:
+   kfree(hwinfo);
 }
 
 /*static void _rtl8821ae_hal_customized_behavior(struct ieee80211_hw *hw)
-

[PATCH v2 07/10] rtlwifi: rtl8723be: Convert driver to use common hardware info routine

2016-06-27 Thread Larry Finger
The driver for RTL8723BE chips is converted to use the common routine
for getting the hardware information.

Reported-by: Arnd Bergmann 
Signed-off-by: Larry Finger 
Cc: Arnd Bergmann 
---
V2 - Fixes bug found after V1 was submitted.

This patch requires ("rtlwifi: Add missing newlines to RT_TRACE calls")
submitted by Joe Perches.
---
 .../net/wireless/realtek/rtlwifi/rtl8723be/hw.c| 74 --
 1 file changed, 12 insertions(+), 62 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
index 63b0df6..cb68c719 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
@@ -2026,10 +2026,12 @@ static void _rtl8723be_read_adapter_info(struct 
ieee80211_hw *hw,
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
-   struct device *dev = &rtl_pcipriv(hw)->dev.pdev->dev;
-   u16 i, usvalue;
-   u8 hwinfo[HWSET_MAX_SIZE];
-   u16 eeprom_id;
+   int params[] = {RTL8723BE_EEPROM_ID, EEPROM_VID, EEPROM_DID,
+   EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR,
+   EEPROM_CHANNELPLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID,
+   COUNTRY_CODE_WORLD_WIDE_13};
+   u8 *hwinfo;
+   int i;
bool is_toshiba_smid1 = false;
bool is_toshiba_smid2 = false;
bool is_samsung_smid = false;
@@ -2057,58 +2059,12 @@ static void _rtl8723be_read_adapter_info(struct 
ieee80211_hw *hw,
return;
}
 
-   switch (rtlefuse->epromtype) {
-   case EEPROM_BOOT_EFUSE:
-   rtl_efuse_shadow_map_update(hw);
-   break;
-
-   case EEPROM_93C46:
-   RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
-"RTL819X Not boot from eeprom, check it !!\n");
+   hwinfo = kzalloc(HWSET_MAX_SIZE, GFP_KERNEL);
+   if (!hwinfo)
return;
 
-   default:
-   dev_warn(dev, "no efuse data\n");
-   return;
-   }
-   memcpy(hwinfo, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], HWSET_MAX_SIZE);
-   RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, ("MAP\n"),
- hwinfo, HWSET_MAX_SIZE);
-
-   eeprom_id = *((u16 *)&hwinfo[0]);
-   if (eeprom_id != RTL8723BE_EEPROM_ID) {
-   RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
-"EEPROM ID(%#x) is invalid!!\n", eeprom_id);
-   rtlefuse->autoload_failflag = true;
-   } else {
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n");
-   rtlefuse->autoload_failflag = false;
-   }
-
-   if (rtlefuse->autoload_failflag)
-   return;
-
-   rtlefuse->eeprom_vid = *(u16 *)&hwinfo[EEPROM_VID];
-   rtlefuse->eeprom_did = *(u16 *)&hwinfo[EEPROM_DID];
-   rtlefuse->eeprom_svid = *(u16 *)&hwinfo[EEPROM_SVID];
-   rtlefuse->eeprom_smid = *(u16 *)&hwinfo[EEPROM_SMID];
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROMId = 0x%4x\n", eeprom_id);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid);
-
-   for (i = 0; i < 6; i += 2) {
-   usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i];
-   *((u16 *)(&rtlefuse->dev_addr[i])) = usvalue;
-   }
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "dev_addr: %pM\n",
-rtlefuse->dev_addr);
+   if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params))
+   goto exit;
 
/*parse xtal*/
rtlefuse->crystalcap = hwinfo[EEPROM_XTAL_8723BE];
@@ -2122,14 +2078,6 @@ static void _rtl8723be_read_adapter_info(struct 
ieee80211_hw *hw,
 rtlefuse->autoload_failflag,
 hwinfo);
 
-   rtlefuse->eeprom_channelplan = hwinfo[EEPROM_CHANNELPLAN];
-   rtlefuse->eeprom_version = *(u16 *)&hwinfo[EEPROM_VERSION];
-   rtlefuse->txpwr_fromeprom = true;
-   rtlefuse->eeprom_oemid = hwinfo[EEPROM_CUSTOMER_ID];
-
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid);
-
/* set channel plan from efuse */
rtlefuse->channel_plan = rtlefuse->eeprom_channelplan;
 
@@ -2240,6 +2188,8 @@ static void _rtl8723be_read_adapter_info(struct 
ieee80211_hw *hw,
break;
}
}
+exit:
+   kfree

[PATCH v2 09/10] rtlwifi: rtl8192de: Convert driver to use common hardware info routine

2016-06-27 Thread Larry Finger
The driver for RTL8192DE chips is converted to use the common routine
for getting the hardware information.

Reported-by: Arnd Bergmann 
Signed-off-by: Larry Finger 
Cc: Arnd Bergmann 
---
V2 - Fixes bug found after V1 was submitted.

This patch requires ("rtlwifi: Add missing newlines to RT_TRACE calls")
submitted by Joe Perches.
---
 .../net/wireless/realtek/rtlwifi/rtl8192de/hw.c| 77 +-
 1 file changed, 15 insertions(+), 62 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c
index 8618c32..b0f6324 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c
@@ -1744,71 +1744,26 @@ static void _rtl92de_read_adapter_info(struct 
ieee80211_hw *hw)
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
-   struct device *dev = &rtl_pcipriv(hw)->dev.pdev->dev;
-   u16 i, usvalue;
-   u8 hwinfo[HWSET_MAX_SIZE];
-   u16 eeprom_id;
-   unsigned long flags;
+   int params[] = {RTL8190_EEPROM_ID, EEPROM_VID, EEPROM_DID,
+   EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR_MAC0_92D,
+   EEPROM_CHANNEL_PLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID,
+   COUNTRY_CODE_WORLD_WIDE_13};
+   int i;
+   u16 usvalue;
+   u8 *hwinfo;
 
-   switch (rtlefuse->epromtype) {
-   case EEPROM_BOOT_EFUSE:
-   spin_lock_irqsave(&globalmutex_for_power_and_efuse, flags);
-   rtl_efuse_shadow_map_update(hw);
-   _rtl92de_efuse_update_chip_version(hw);
-   spin_unlock_irqrestore(&globalmutex_for_power_and_efuse, flags);
-   break;
-   case EEPROM_93C46:
-   RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
-"RTL819X Not boot from eeprom, check it !!\n");
-   return;
-   default:
-   dev_warn(dev, "no efuse data\n");
+   hwinfo = kzalloc(HWSET_MAX_SIZE, GFP_KERNEL);
+   if (!hwinfo)
return;
-   }
-
-   memcpy(hwinfo, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], HWSET_MAX_SIZE);
-   RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP",
- hwinfo, HWSET_MAX_SIZE);
 
-   eeprom_id = *((u16 *)&hwinfo[0]);
-   if (eeprom_id != RTL8190_EEPROM_ID) {
-   RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
-"EEPROM ID(%#x) is invalid!!\n", eeprom_id);
-   rtlefuse->autoload_failflag = true;
-   } else {
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n");
-   rtlefuse->autoload_failflag = false;
-   }
-   if (rtlefuse->autoload_failflag) {
-   RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
-"RTL819X Not boot from eeprom, check it !!\n");
+   if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params))
return;
-   }
-   rtlefuse->eeprom_oemid = hwinfo[EEPROM_CUSTOMER_ID];
-   _rtl92de_read_macphymode_and_bandtype(hw, hwinfo);
 
-   /* VID, DID  SE 0xA-D */
-   rtlefuse->eeprom_vid = *(u16 *)&hwinfo[EEPROM_VID];
-   rtlefuse->eeprom_did = *(u16 *)&hwinfo[EEPROM_DID];
-   rtlefuse->eeprom_svid = *(u16 *)&hwinfo[EEPROM_SVID];
-   rtlefuse->eeprom_smid = *(u16 *)&hwinfo[EEPROM_SMID];
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "EEPROMId = 0x%4x\n", eeprom_id);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid);
+   _rtl92de_efuse_update_chip_version(hw);
+   _rtl92de_read_macphymode_and_bandtype(hw, hwinfo);
 
-   /* Read Permanent MAC address */
-   if (rtlhal->interfaceindex == 0) {
-   for (i = 0; i < 6; i += 2) {
-   usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR_MAC0_92D + i];
-   *((u16 *) (&rtlefuse->dev_addr[i])) = usvalue;
-   }
-   } else {
+   /* Read Permanent MAC address for 2nd interface */
+   if (rtlhal->interfaceindex != 0) {
for (i = 0; i < 6; i += 2) {
usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR_MAC1_92D + i];
*((u16 *) (&rtlefuse->dev_addr[i])) = usvalue;
@@ -1834,10 +1789,8 @@ static void _rtl92de_read_adapter_info(struct 
ieee80211_hw *hw)
rtlefuse->channel_plan = COUNTRY_CODE_FCC;
break;
}
-   rtlefuse->eeprom_version = *(u16 *)&hwinfo[EEPR

[PATCH v2 10/10] rtlwifi: rtl8723ae: Clean up the hardware info routine

2016-06-27 Thread Larry Finger
This driver contains some complicated if ... else if ... else
constructions.  These are replaced by switch statements to improve
readability.

Signed-off-by: Larry Finger 
---
V2 - Changes suggested by Joe Perches were incorporated

This patch requires ("rtlwifi: Add missing newlines to RT_TRACE calls")
submitted by Joe Perches.
---
 .../net/wireless/realtek/rtlwifi/rtl8723ae/hw.c| 230 +++--
 1 file changed, 116 insertions(+), 114 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c
index 662c445..132e879 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c
@@ -1653,132 +1653,134 @@ static void _rtl8723e_read_adapter_info(struct 
ieee80211_hw *hw,
rtl8723e_read_bt_coexist_info_from_hwpg(hw,
rtlefuse->autoload_failflag, hwinfo);
 
-   if (rtlhal->oem_id == RT_CID_DEFAULT) {
-   switch (rtlefuse->eeprom_oemid) {
-   case EEPROM_CID_DEFAULT:
-   if (rtlefuse->eeprom_did == 0x8176) {
-   if (CHK_SVID_SMID(0x10EC, 0x6151) ||
-   CHK_SVID_SMID(0x10EC, 0x6152) ||
-   CHK_SVID_SMID(0x10EC, 0x6154) ||
-   CHK_SVID_SMID(0x10EC, 0x6155) ||
-   CHK_SVID_SMID(0x10EC, 0x6177) ||
-   CHK_SVID_SMID(0x10EC, 0x6178) ||
-   CHK_SVID_SMID(0x10EC, 0x6179) ||
-   CHK_SVID_SMID(0x10EC, 0x6180) ||
-   CHK_SVID_SMID(0x10EC, 0x7151) ||
-   CHK_SVID_SMID(0x10EC, 0x7152) ||
-   CHK_SVID_SMID(0x10EC, 0x7154) ||
-   CHK_SVID_SMID(0x10EC, 0x7155) ||
-   CHK_SVID_SMID(0x10EC, 0x7177) ||
-   CHK_SVID_SMID(0x10EC, 0x7178) ||
-   CHK_SVID_SMID(0x10EC, 0x7179) ||
-   CHK_SVID_SMID(0x10EC, 0x7180) ||
-   CHK_SVID_SMID(0x10EC, 0x8151) ||
-   CHK_SVID_SMID(0x10EC, 0x8152) ||
-   CHK_SVID_SMID(0x10EC, 0x8154) ||
-   CHK_SVID_SMID(0x10EC, 0x8155) ||
-   CHK_SVID_SMID(0x10EC, 0x8181) ||
-   CHK_SVID_SMID(0x10EC, 0x8182) ||
-   CHK_SVID_SMID(0x10EC, 0x8184) ||
-   CHK_SVID_SMID(0x10EC, 0x8185) ||
-   CHK_SVID_SMID(0x10EC, 0x9151) ||
-   CHK_SVID_SMID(0x10EC, 0x9152) ||
-   CHK_SVID_SMID(0x10EC, 0x9154) ||
-   CHK_SVID_SMID(0x10EC, 0x9155) ||
-   CHK_SVID_SMID(0x10EC, 0x9181) ||
-   CHK_SVID_SMID(0x10EC, 0x9182) ||
-   CHK_SVID_SMID(0x10EC, 0x9184) ||
-   CHK_SVID_SMID(0x10EC, 0x9185))
+   if (rtlhal->oem_id != RT_CID_DEFAULT)
+   return;
+
+   switch (rtlefuse->eeprom_oemid) {
+   case EEPROM_CID_DEFAULT:
+   switch (rtlefuse->eeprom_did) {
+   case 0x8176:
+   switch (rtlefuse->eeprom_svid) {
+   case 0x10EC:
+   switch (rtlefuse->eeprom_smid) {
+   case 0x6151 ... 0x6152:
+   case 0x6154 ... 0x6155:
+   case 0x6177 ... 0x6180:
+   case 0x7151 ... 0x7152:
+   case 0x7154 ... 0x7155:
+   case 0x7177 ... 0x7180:
+   case 0x8151 ... 0x8152:
+   case 0x8154 ... 0x8155:
+   case 0x8181 ... 0x8182:
+   case 0x8184 ... 0x8185:
+   case 0x9151 ... 0x9152:
+   case 0x9154 ... 0x9155:
+   case 0x9181 ... 0x9182:
+   case 0x9184 ... 0x9185:
rtlhal->oem_id = RT_CID_TOSHIBA;
-   else if (rtlefuse->eeprom_svid == 0x1025)
-   rtlhal->oem_id = RT_CID_819X_ACER;
-   else if (CHK_SVID_SMID(0x10EC, 0x6191) ||
-CHK_SVID_SMID(0x10EC, 0x6192) ||
-CHK_SVID_SMID(0x10EC, 0x6193) ||
- 

[PATCH v2 05/10] rtlwifi: rtl8192ee: Convert driver to use common hardware info routine

2016-06-27 Thread Larry Finger
The driver for RTL8192EE chips is converted to use the common routine
for getting the hardware information.

Reported-by: Arnd Bergmann 
Signed-off-by: Larry Finger 
Cc: Arnd Bergmann 
---
V2 - Fixes bug found after V1 was submitted.

This patch requires ("rtlwifi: Add missing newlines to RT_TRACE calls")
submitted by Joe Perches.
---
 .../net/wireless/realtek/rtlwifi/rtl8192ee/hw.c| 73 --
 1 file changed, 12 insertions(+), 61 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c
index 9d1ecba..b07af8d 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c
@@ -2098,75 +2098,24 @@ static void _rtl92ee_read_adapter_info(struct 
ieee80211_hw *hw)
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
-   u16 i, usvalue;
-   u8 hwinfo[HWSET_MAX_SIZE];
-   u16 eeprom_id;
-
-   switch (rtlefuse->epromtype) {
-   case EEPROM_BOOT_EFUSE:
-   rtl_efuse_shadow_map_update(hw);
-   break;
-
-   case EEPROM_93C46:
-   RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
-"RTL819X Not boot from eeprom, check it !!\n");
-   return;
-
-   default:
-   RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
-"boot from neither eeprom nor efuse, check it !!\n");
+   int params[] = {RTL8192E_EEPROM_ID, EEPROM_VID, EEPROM_DID,
+   EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR,
+   EEPROM_CHANNELPLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID,
+   COUNTRY_CODE_WORLD_WIDE_13};
+   u8 *hwinfo;
+
+   hwinfo = kzalloc(HWSET_MAX_SIZE, GFP_KERNEL);
+   if (!hwinfo)
return;
-   }
-   memcpy(hwinfo, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], HWSET_MAX_SIZE);
 
-   RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP\n",
- hwinfo, HWSET_MAX_SIZE);
+   if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params))
+   goto exit;
 
-   eeprom_id = *((u16 *)&hwinfo[0]);
-   if (eeprom_id != RTL8192E_EEPROM_ID) {
-   RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
-"EEPROM ID(%#x) is invalid!!\n", eeprom_id);
-   rtlefuse->autoload_failflag = true;
-   } else {
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n");
-   rtlefuse->autoload_failflag = false;
-   }
-
-   if (rtlefuse->autoload_failflag)
-   return;
-   /*VID DID SVID SDID*/
-   rtlefuse->eeprom_vid = *(u16 *)&hwinfo[EEPROM_VID];
-   rtlefuse->eeprom_did = *(u16 *)&hwinfo[EEPROM_DID];
-   rtlefuse->eeprom_svid = *(u16 *)&hwinfo[EEPROM_SVID];
-   rtlefuse->eeprom_smid = *(u16 *)&hwinfo[EEPROM_SMID];
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "EEPROMId = 0x%4x\n", eeprom_id);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid);
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
-"EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid);
-   /*customer ID*/
-   rtlefuse->eeprom_oemid = *(u8 *)&hwinfo[EEPROM_CUSTOMER_ID];
if (rtlefuse->eeprom_oemid == 0xFF)
rtlefuse->eeprom_oemid = 0;
 
RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
 "EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid);
-   /*EEPROM version*/
-   rtlefuse->eeprom_version = *(u8 *)&hwinfo[EEPROM_VERSION];
-   /*mac address*/
-   for (i = 0; i < 6; i += 2) {
-   usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i];
-   *((u16 *)(&rtlefuse->dev_addr[i])) = usvalue;
-   }
-
-   RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
-"dev_addr: %pM\n", rtlefuse->dev_addr);
-   /*channel plan */
-   rtlefuse->eeprom_channelplan = *(u8 *)&hwinfo[EEPROM_CHANNELPLAN];
/* set channel plan from efuse */
rtlefuse->channel_plan = rtlefuse->eeprom_channelplan;
/*tx power*/
@@ -2208,6 +2157,8 @@ static void _rtl92ee_read_adapter_info(struct 
ieee80211_hw *hw)
break;
}
}
+exit:
+   kfree(hwinfo);
 }
 
 static void _rtl92ee_hal_customized_behavior(struct ieee80211_hw *hw)
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 01/10] rtlwifi: Create common routine to get hardware info

2016-06-27 Thread Arnd Bergmann
On Monday, June 27, 2016 10:52:29 AM CEST Larry Finger wrote:
> All of the rtlwifi family of drivers have a similar routine that acquires
> the hardware info from efuse and initializes a number of variables in the
> driver's private area. A common routine is created for all drivers to use.
> 
> Reported-by: Arnd Bergmann 
> Signed-off-by: Larry Finger 
> Cc: Arnd Bergmann 
> ---
> V2 - Fixes bug found after V1 was submitted.
>  Incorporates change suggested by Joe Perches
> 
> This patch requires ("rtlwifi: Add missing newlines to RT_TRACE calls")
> submitted by Joe Perches.
> 

Thanks for the follow-up on my suggestion!

The changes look good, though I'm not really qualified to say whether
they are correct.

Arnd

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


LORDS GLORY

2016-06-27 Thread Mrs. Caromel Isabella
Good day
Private Message to you,

Greetings to you in the name of our heavenly father. This mail might come
to you as a surprise and the temptation to ignore it could come into
your mind, but please, consider it as a Divine Wish of God and accept
it with a deep sense of humility. My Name is Isabella Caromel; I
escaped tsunami disaster some time ago which affected my spinal cord,
my ear drum and claim my entire family, my husband and two sons. It
might shock you to know that, I was eventually disabled as a result of
catastrophe that struck me. Perhaps I’m now on a wheelchair after all
form of treatment and to no avail. Because of my present condition I
finally decided to give a better life to the poor in the society,
since it has been determine medically that I have only about a few months
to live, according to medical experts.

It is my legacy to build charity organizations for the less privilege
since my health has finally confirmed deteriorated. In my present
condition this project cannot be executed by me alone due to my
ailment, so therefore I need your candid voluntarily support to
execute the project to make this dream a reality. I have decided to
invest my $10.6M USD to help the less privileged, therefore you are
chosen from my heart to help receive the funds from where it was kept
secretly to build charity organizations for the less privilege to have
some better life.

Please I will appreciate you if indicated interest to help
actualize this last dream. Therefore also include your contact
telephone/fax numbers, including personal details to be forwarded to the
deposited firm for onward communication on how to transfer the funds
to you. I will also provide you the legal documents that will enable
you claim the funds, and if you are willing and ready to assist,
please e-mail me at mrs.isabellacaro...@yahoo.com.hk without delay as
I need to hear from you soon.

Remain blessed,
Mrs. Isabella Caromel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 10/10] rtlwifi: rtl8723ae: Clean up the hardware info routine

2016-06-27 Thread Joe Perches
On Mon, 2016-06-27 at 10:52 -0500, Larry Finger wrote:
> This driver contains some complicated if ... else if ... else
> constructions.  These are replaced by switch statements to improve
> readability.
[]
> diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c 
> b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c
[]
> @@ -1653,132 +1653,134 @@ static void _rtl8723e_read_adapter_info(struct 
> ieee80211_hw *hw,
>   rtl8723e_read_bt_coexist_info_from_hwpg(hw,
>   rtlefuse->autoload_failflag, hwinfo);
>  
> - if (rtlhal->oem_id == RT_CID_DEFAULT) {
> - switch (rtlefuse->eeprom_oemid) {
> - case EEPROM_CID_DEFAULT:
> - if (rtlefuse->eeprom_did == 0x8176) {
> - if (CHK_SVID_SMID(0x10EC, 0x6151) ||
> - CHK_SVID_SMID(0x10EC, 0x6152) ||
> - CHK_SVID_SMID(0x10EC, 0x6154) ||
> - CHK_SVID_SMID(0x10EC, 0x6155) ||
> - CHK_SVID_SMID(0x10EC, 0x6177) ||
> - CHK_SVID_SMID(0x10EC, 0x6178) ||
> - CHK_SVID_SMID(0x10EC, 0x6179) ||
> - CHK_SVID_SMID(0x10EC, 0x6180) ||
> - CHK_SVID_SMID(0x10EC, 0x7151) ||
> - CHK_SVID_SMID(0x10EC, 0x7152) ||
> - CHK_SVID_SMID(0x10EC, 0x7154) ||
> - CHK_SVID_SMID(0x10EC, 0x7155) ||
> - CHK_SVID_SMID(0x10EC, 0x7177) ||
> - CHK_SVID_SMID(0x10EC, 0x7178) ||
> - CHK_SVID_SMID(0x10EC, 0x7179) ||
> - CHK_SVID_SMID(0x10EC, 0x7180) ||
> - CHK_SVID_SMID(0x10EC, 0x8151) ||
> - CHK_SVID_SMID(0x10EC, 0x8152) ||
> - CHK_SVID_SMID(0x10EC, 0x8154) ||
> - CHK_SVID_SMID(0x10EC, 0x8155) ||
> - CHK_SVID_SMID(0x10EC, 0x8181) ||
> - CHK_SVID_SMID(0x10EC, 0x8182) ||
> - CHK_SVID_SMID(0x10EC, 0x8184) ||
> - CHK_SVID_SMID(0x10EC, 0x8185) ||
> - CHK_SVID_SMID(0x10EC, 0x9151) ||
> - CHK_SVID_SMID(0x10EC, 0x9152) ||
> - CHK_SVID_SMID(0x10EC, 0x9154) ||
> - CHK_SVID_SMID(0x10EC, 0x9155) ||
> - CHK_SVID_SMID(0x10EC, 0x9181) ||
> - CHK_SVID_SMID(0x10EC, 0x9182) ||
> - CHK_SVID_SMID(0x10EC, 0x9184) ||
> - CHK_SVID_SMID(0x10EC, 0x9185))
> + if (rtlhal->oem_id != RT_CID_DEFAULT)
> + return;
> +
> + switch (rtlefuse->eeprom_oemid) {
> + case EEPROM_CID_DEFAULT:
> + switch (rtlefuse->eeprom_did) {
> + case 0x8176:
> + switch (rtlefuse->eeprom_svid) {
> + case 0x10EC:
> + switch (rtlefuse->eeprom_smid) {
> + case 0x6151 ... 0x6152:
> + case 0x6154 ... 0x6155:
> + case 0x6177 ... 0x6180:
> + case 0x7151 ... 0x7152:
> + case 0x7154 ... 0x7155:
> + case 0x7177 ... 0x7180:
> + case 0x8151 ... 0x8152:
> + case 0x8154 ... 0x8155:
> + case 0x8181 ... 0x8182:
> + case 0x8184 ... 0x8185:
> + case 0x9151 ... 0x9152:
> + case 0x9154 ... 0x9155:
> + case 0x9181 ... 0x9182:
> + case 0x9184 ... 0x9185:
>   rtlhal->oem_id = RT_CID_TOSHIBA;
> - else if (rtlefuse->eeprom_svid == 0x1025)
> - rtlhal->oem_id = RT_CID_819X_ACER;
> - else if (CHK_SVID_SMID(0x10EC, 0x6191) ||
> -  CHK_SVID_SMID(0x10EC, 0x6192) ||
> -  CHK_SVID_SMID(0x10EC, 0x6193) ||
> -  CHK_SVID_SMID(0x10EC, 0x7191) ||
> -  CHK_SVID_SMID(0x10EC, 0x7192) ||
> -  CHK_SVID_SMID(0x10EC, 0x7193) ||
> -  CHK_SVID_SMID(0x10EC, 0x8191) ||
> -  CHK_SVID_SMID(0x10EC, 0x8192) ||
> -  CHK_SVID_SMID(0x10EC,

Re: [PATCH v2 10/10] rtlwifi: rtl8723ae: Clean up the hardware info routine

2016-06-27 Thread Larry Finger

On 06/27/2016 04:23 PM, Joe Perches wrote:

On Mon, 2016-06-27 at 10:52 -0500, Larry Finger wrote:

This driver contains some complicated if ... else if ... else
constructions.  These are replaced by switch statements to improve
readability.

[]

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c

[]

@@ -1653,132 +1653,134 @@ static void _rtl8723e_read_adapter_info(struct 
ieee80211_hw *hw,
rtl8723e_read_bt_coexist_info_from_hwpg(hw,
rtlefuse->autoload_failflag, hwinfo);

-   if (rtlhal->oem_id == RT_CID_DEFAULT) {
-   switch (rtlefuse->eeprom_oemid) {
-   case EEPROM_CID_DEFAULT:
-   if (rtlefuse->eeprom_did == 0x8176) {
-   if (CHK_SVID_SMID(0x10EC, 0x6151) ||
-   CHK_SVID_SMID(0x10EC, 0x6152) ||
-   CHK_SVID_SMID(0x10EC, 0x6154) ||
-   CHK_SVID_SMID(0x10EC, 0x6155) ||
-   CHK_SVID_SMID(0x10EC, 0x6177) ||
-   CHK_SVID_SMID(0x10EC, 0x6178) ||
-   CHK_SVID_SMID(0x10EC, 0x6179) ||
-   CHK_SVID_SMID(0x10EC, 0x6180) ||
-   CHK_SVID_SMID(0x10EC, 0x7151) ||
-   CHK_SVID_SMID(0x10EC, 0x7152) ||
-   CHK_SVID_SMID(0x10EC, 0x7154) ||
-   CHK_SVID_SMID(0x10EC, 0x7155) ||
-   CHK_SVID_SMID(0x10EC, 0x7177) ||
-   CHK_SVID_SMID(0x10EC, 0x7178) ||
-   CHK_SVID_SMID(0x10EC, 0x7179) ||
-   CHK_SVID_SMID(0x10EC, 0x7180) ||
-   CHK_SVID_SMID(0x10EC, 0x8151) ||
-   CHK_SVID_SMID(0x10EC, 0x8152) ||
-   CHK_SVID_SMID(0x10EC, 0x8154) ||
-   CHK_SVID_SMID(0x10EC, 0x8155) ||
-   CHK_SVID_SMID(0x10EC, 0x8181) ||
-   CHK_SVID_SMID(0x10EC, 0x8182) ||
-   CHK_SVID_SMID(0x10EC, 0x8184) ||
-   CHK_SVID_SMID(0x10EC, 0x8185) ||
-   CHK_SVID_SMID(0x10EC, 0x9151) ||
-   CHK_SVID_SMID(0x10EC, 0x9152) ||
-   CHK_SVID_SMID(0x10EC, 0x9154) ||
-   CHK_SVID_SMID(0x10EC, 0x9155) ||
-   CHK_SVID_SMID(0x10EC, 0x9181) ||
-   CHK_SVID_SMID(0x10EC, 0x9182) ||
-   CHK_SVID_SMID(0x10EC, 0x9184) ||
-   CHK_SVID_SMID(0x10EC, 0x9185))
+   if (rtlhal->oem_id != RT_CID_DEFAULT)
+   return;
+
+   switch (rtlefuse->eeprom_oemid) {
+   case EEPROM_CID_DEFAULT:
+   switch (rtlefuse->eeprom_did) {
+   case 0x8176:
+   switch (rtlefuse->eeprom_svid) {
+   case 0x10EC:
+   switch (rtlefuse->eeprom_smid) {
+   case 0x6151 ... 0x6152:
+   case 0x6154 ... 0x6155:
+   case 0x6177 ... 0x6180:
+   case 0x7151 ... 0x7152:
+   case 0x7154 ... 0x7155:
+   case 0x7177 ... 0x7180:
+   case 0x8151 ... 0x8152:
+   case 0x8154 ... 0x8155:
+   case 0x8181 ... 0x8182:
+   case 0x8184 ... 0x8185:
+   case 0x9151 ... 0x9152:
+   case 0x9154 ... 0x9155:
+   case 0x9181 ... 0x9182:
+   case 0x9184 ... 0x9185:
rtlhal->oem_id = RT_CID_TOSHIBA;
-   else if (rtlefuse->eeprom_svid == 0x1025)
-   rtlhal->oem_id = RT_CID_819X_ACER;
-   else if (CHK_SVID_SMID(0x10EC, 0x6191) ||
-CHK_SVID_SMID(0x10EC, 0x6192) ||
-CHK_SVID_SMID(0x10EC, 0x6193) ||
-CHK_SVID_SMID(0x10EC, 0x7191) ||
-CHK_SVID_SMID(0x10EC, 0x7192) ||
-CHK_SVID_SMID(0x10EC, 0x7193) ||
-CHK_SVID_SMID(0x10EC, 0x8191) ||
-CHK_SVID_SMID(0x10EC, 0x8192) ||
-