Re: [PATCH v2 04/23] staging: rtl8192e: Remove unused enums

2015-07-15 Thread Mateusz Kulikowski


On July 15, 2015 8:34:02 AM GMT+02:00, Jakub Sitnicki  
wrote:
>On Tue, Jul 14, 2015 at 10:04 PM CEST, Mateusz Kulikowski
> wrote:
>> Remove ack_policy enum and some unused RTL_DEBUG enums.
>>
>> Signed-off-by: Mateusz Kulikowski 
>> ---
>
>[snip]
>
>> diff --git a/drivers/staging/rtl8192e/rtllib_debug.h
>b/drivers/staging/rtl8192e/rtllib_debug.h
>> index 42e88d6..2f47a7c 100644
>> --- a/drivers/staging/rtl8192e/rtllib_debug.h
>> +++ b/drivers/staging/rtl8192e/rtllib_debug.h
>> @@ -40,10 +40,7 @@ enum RTL_DEBUG {
>>  COMP_DBG= (1 << 1),
>>  COMP_INIT   = (1 << 2),
>>  COMP_RECV   = (1 << 3),
>> -COMP_SEND   = (1 << 4),
>> -COMP_CMD= (1 << 5),
>>  COMP_POWER  = (1 << 6),
>> -COMP_EPROM  = (1 << 7),
>>  COMP_SWBW   = (1 << 8),
>>  COMP_SEC= (1 << 9),
>>  COMP_LPS= (1 << 10),
>> @@ -58,15 +55,12 @@ enum RTL_DEBUG {
>>  COMP_CH = (1 << 19),
>>  COMP_RF = (1 << 20),
>>  COMP_FIRMWARE   = (1 << 21),
>> -COMP_HT = (1 << 22),
>>  COMP_RESET  = (1 << 23),
>>  COMP_CMDPKT = (1 << 24),
>>  COMP_SCAN   = (1 << 25),
>>  COMP_PS = (1 << 26),
>>  COMP_DOWN   = (1 << 27),
>>  COMP_INTR   = (1 << 28),
>> -COMP_LED= (1 << 29),
>> -COMP_MLME   = (1 << 30),
>>  COMP_ERR= (1 << 31)
>>  };
>
>Is it possible that this change will make future readers wonder why
>there are holes in the enum values, and hence hurts readability?

It should not. This enum is used as log categories for various parts of the 
driver.
Some of them were just never used.

IMO once driver is ready for unstagimg this enum should be removed and replaced 
wih dyn debug where it makes sense.

Regards,
Mateusz

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


[PATCH] staging: ft1000: ft1000-usb: remove unnecessary out of memory warning

2015-07-15 Thread CHANG FU CHIAO
fixes "Possible unnecessary 'out of memory' message"

Signed-off-by: CHANG FU CHIAO 
---
 drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c 
b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index e6b5976..9620970 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -842,7 +842,6 @@ static int ft1000_copy_up_pkt(struct urb *urb)
skb = dev_alloc_skb(len + 12 + 2);
 
if (skb == NULL) {
-   pr_debug("No Network buffers available\n");
info->stats.rx_errors++;
ft1000_submit_rx_urb(info);
return -1;
-- 
1.9.1

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


[PATCH v2 2/2] staging: sm7xxfb: usr fb_read and fb_write

2015-07-15 Thread Sudip Mukherjee
Now since the Big-Endian and Little-Endian based calculations are moved
into a macro we can make fb_read() and fb_write() common for both
Little-Endian and Big-Endian.

Signed-off-by: Sudip Mukherjee 
---
 drivers/staging/sm7xxfb/sm7xxfb.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c 
b/drivers/staging/sm7xxfb/sm7xxfb.c
index 106465c..07c2199 100644
--- a/drivers/staging/sm7xxfb/sm7xxfb.c
+++ b/drivers/staging/sm7xxfb/sm7xxfb.c
@@ -946,7 +946,6 @@ static int smtc_setcolreg(unsigned regno, unsigned red, 
unsigned green,
return 0;
 }
 
-#ifdef __BIG_ENDIAN
 static ssize_t smtcfb_read(struct fb_info *info, char __user *buf,
   size_t count, loff_t *ppos)
 {
@@ -1107,7 +1106,6 @@ static ssize_t smtcfb_write(struct fb_info *info, const 
char __user *buf,
 
return (cnt) ? cnt : err;
 }
-#endif /* ! __BIG_ENDIAN */
 
 static void sm7xx_set_timing(struct smtcfb_info *sfb)
 {
@@ -1303,10 +1301,8 @@ static struct fb_ops smtcfb_ops = {
.fb_fillrect  = cfb_fillrect,
.fb_imageblit = cfb_imageblit,
.fb_copyarea  = cfb_copyarea,
-#ifdef __BIG_ENDIAN
.fb_read  = smtcfb_read,
.fb_write = smtcfb_write,
-#endif
 };
 
 /*
-- 
1.8.1.2

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


[PATCH v2 1/2] staging: sm7xxfb: define new macros

2015-07-15 Thread Sudip Mukherjee
Define and use some new macros to work with different situations
based on little-endian and big-endian.

Signed-off-by: Sudip Mukherjee 
---

v2: fixed empty macro

 drivers/staging/sm7xxfb/sm7xx.h   | 19 
 drivers/staging/sm7xxfb/sm7xxfb.c | 48 ---
 2 files changed, 29 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/sm7xxfb/sm7xx.h b/drivers/staging/sm7xxfb/sm7xx.h
index 31a21bd..de134b0 100644
--- a/drivers/staging/sm7xxfb/sm7xx.h
+++ b/drivers/staging/sm7xxfb/sm7xx.h
@@ -95,3 +95,22 @@ struct modeinit {
unsigned char init_cr30_cr4d[SIZE_CR30_CR4D];
unsigned char init_cr90_cra7[SIZE_CR90_CRA7];
 };
+
+#ifdef __BIG_ENDIAN
+#define pal_rgb(r, g, b, val)  (((r & 0xf800) >> 8) | \
+   ((g & 0xe000) >> 13) | \
+   ((g & 0x1c00) << 3) | \
+   ((b & 0xf800) >> 3))
+#define big_addr   0x80
+#define mmio_addr  0x0080
+#define seqw17()   smtc_seqw(0x17, 0x30)
+#define big_pixel_depth(p, d)  {if (p == 24) {p = 32; d = 32; } }
+#define big_swap(p)((p & 0xff00ff00 >> 8) | (p & 0x00ff00ff << 8))
+#else
+#define pal_rgb(r, g, b, val)  val
+#define big_addr   0
+#define mmio_addr  0x00c0
+#define seqw17()   do { } while (0)
+#define big_pixel_depth(p, d)  do { } while (0)
+#define big_swap(p)p
+#endif
diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c 
b/drivers/staging/sm7xxfb/sm7xxfb.c
index 4dc9d5f..106465c 100644
--- a/drivers/staging/sm7xxfb/sm7xxfb.c
+++ b/drivers/staging/sm7xxfb/sm7xxfb.c
@@ -923,25 +923,14 @@ static int smtc_setcolreg(unsigned regno, unsigned red, 
unsigned green,
val = chan_to_field(red, &sfb->fb->var.red);
val |= chan_to_field(green, &sfb->fb->var.green);
val |= chan_to_field(blue, &sfb->fb->var.blue);
-#ifdef __BIG_ENDIAN
-   pal[regno] = ((red & 0xf800) >> 8) |
-((green & 0xe000) >> 13) |
-((green & 0x1c00) << 3) |
-((blue & 0xf800) >> 3);
-#else
-   pal[regno] = val;
-#endif
+   pal[regno] = pal_rgb(red, green, blue, val);
} else {
u32 *pal = sfb->fb->pseudo_palette;
 
val = chan_to_field(red, &sfb->fb->var.red);
val |= chan_to_field(green, &sfb->fb->var.green);
val |= chan_to_field(blue, &sfb->fb->var.blue);
-#ifdef __BIG_ENDIAN
-   val = (val & 0xff00ff00 >> 8) |
- (val & 0x00ff00ff << 8);
-#endif
-   pal[regno] = val;
+   pal[regno] = big_swap(val);
}
break;
 
@@ -1002,8 +991,7 @@ static ssize_t smtcfb_read(struct fb_info *info, char 
__user *buf,
dst = buffer;
for (i = c >> 2; i--;) {
*dst = fb_readl(src++);
-   *dst = (*dst & 0xff00ff00 >> 8) |
-  (*dst & 0x00ff00ff << 8);
+   *dst = big_swap(*dst);
dst++;
}
if (c & 3) {
@@ -1091,8 +1079,7 @@ static ssize_t smtcfb_write(struct fb_info *info, const 
char __user *buf,
}
 
for (i = c >> 2; i--;) {
-   fb_writel((*src & 0xff00ff00 >> 8) |
- (*src & 0x00ff00ff << 8), dst++);
+   fb_writel(big_swap(*src), dst++);
src++;
}
if (c & 3) {
@@ -1341,10 +1328,8 @@ static int smtc_map_smem(struct smtcfb_info *sfb,
 {
sfb->fb->fix.smem_start = pci_resource_start(pdev, 0);
 
-#ifdef __BIG_ENDIAN
if (sfb->fb->var.bits_per_pixel == 32)
-   sfb->fb->fix.smem_start += 0x80;
-#endif
+   sfb->fb->fix.smem_start += big_addr;
 
sfb->fb->fix.smem_len = smem_len;
 
@@ -1437,10 +1422,7 @@ static int smtcfb_pci_probe(struct pci_dev *pdev,
sfb->fb->var.bits_per_pixel = SCREEN_BPP;
}
 
-#ifdef __BIG_ENDIAN
-   if (sfb->fb->var.bits_per_pixel == 24)
-   sfb->fb->var.bits_per_pixel = (smtc_scr_info.lfb_depth = 32);
-#endif
+   big_pixel_depth(sfb->fb->var.bits_per_pixel, smtc_scr_info.lfb_depth);
/* Map address and memory detection */
mmio_base = pci_resource_start(pdev, 0);
pci_read_config_byte(pdev, PCI_REVISION_ID, &sfb->chip_rev_id);
@@ -1451,11 +1433,7 @@ static int smtcfb_pci_probe(struct pci_dev *pdev,
sfb->fb->fix.mmio_start = mmio_base + 0x0040;
sfb->fb->fix.mmio_len = 0x0040;
smem_size = SM712_VIDEOMEMORYSIZE;
-#ifdef __BIG_

Re: [PATCH v2] Staging: fbtft: Add support for the Ultrachip UC1611 LCD controller

2015-07-15 Thread Paul Bolle
On di, 2015-07-14 at 14:59 +0200, Henri Chain wrote:
> --- /dev/null
> +++ b/drivers/staging/fbtft/fb_uc1611.c

> +#define DRVNAME  "fb_uc1611"

> +MODULE_ALIAS("spi:" DRVNAME);
> +MODULE_ALIAS("platform:" DRVNAME);
> +MODULE_ALIAS("spi:uc1611");
> +MODULE_ALIAS("platform:uc1611");

Many of the drivers under drivers/staging/fbtft use a comparable set of
aliases. But I wonder if they are all needed (here, and in the other
drivers).

In this case I think I understand how the "fb_uc1611" .modalias (see
below) will eventually trigger a "MODALIAS=spi:fb_uc1611" uevent. And
that uevent will make userspace load the fb_uc1611.ko module, right?

But is there a similar way that "spi:uc1611" fits into the system?
Because I couldn't spot anything similar for "uc1611".

Likewise, "platform:fb_uc1611" and "platform:uc1611" require struct
platform_device's with "fb_uc1611" and "uc1611" .name's. But I couldn't
spot where platform_device's with those .name's are created. How do
these two aliases fit into the system?

> --- a/drivers/staging/fbtft/fbtft_device.c
> +++ b/drivers/staging/fbtft/fbtft_device.c

> + .name = "ew24ha0",
> + .spi = &(struct spi_board_info) {
> + .modalias = "fb_uc1611",
> + .max_speed_hz = 3200,
> + .mode = SPI_MODE_3,
> + .platform_data = &(struct fbtft_platform_data) {
> + .display = {
> + .buswidth = 8,
> + },
> + .gpios = (const struct fbtft_gpio []) {
> + { "dc", 24 },
> + {},
> + },
> + }
> + }
> + }, {
> + .name = "ew24ha0_9bit",
> + .spi = &(struct spi_board_info) {
> + .modalias = "fb_uc1611",
> + .max_speed_hz = 3200,
> + .mode = SPI_MODE_3,
> + .platform_data = &(struct fbtft_platform_data) {
> + .display = {
> + .buswidth = 9,
> + },
> + .gpios = (const struct fbtft_gpio []) {
> + {},
> + },
> + }
> + }
> + }, {

Thanks,


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


Re: [staging:staging-testing 134/169] drivers/staging/fbtft/fb_uc1611.c:105:24-28: duplicated argument to & or |

2015-07-15 Thread Julia Lawall
TThese look intentional, but maybe double check the first one, with the
code shown in this message.

julia

On Wed, 15 Jul 2015, kbuild test robot wrote:

> TO: Henri Chain 
> CC: "Greg Kroah-Hartman" 
> CC: de...@driverdev.osuosl.org
>
> tree:   git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
> staging-testing
> head:   bd1fb5388da0a37c053649ec4aa8e588ef39f958
> commit: a1560f9bec8b9275a751bd39a1db791d2c73d6e5 [134/169] Staging: fbtft: 
> Add support for the Ultrachip UC1611 LCD controller
> :: branch date: 2 hours ago
> :: commit date: 3 hours ago
>
> >> drivers/staging/fbtft/fb_uc1611.c:105:24-28: duplicated argument to & or |
>drivers/staging/fbtft/fb_uc1611.c:177:6-9: duplicated argument to & or |
>drivers/staging/fbtft/fb_uc1611.c:178:6-9: duplicated argument to & or |
>drivers/staging/fbtft/fb_uc1611.c:191:6-9: duplicated argument to & or |
>drivers/staging/fbtft/fb_uc1611.c:195:6-9: duplicated argument to & or |
>drivers/staging/fbtft/fb_uc1611.c:203:6-9: duplicated argument to & or |
>drivers/staging/fbtft/fb_uc1611.c:204:6-9: duplicated argument to & or |
>drivers/staging/fbtft/fb_uc1611.c:208:6-9: duplicated argument to & or |
>drivers/staging/fbtft/fb_uc1611.c:209:6-9: duplicated argument to & or |
>drivers/staging/fbtft/fb_uc1611.c:217:6-9: duplicated argument to & or |
>drivers/staging/fbtft/fb_uc1611.c:222:6-9: duplicated argument to & or |
>
> git remote add staging 
> git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
> git remote update staging
> git checkout a1560f9bec8b9275a751bd39a1db791d2c73d6e5
> vim +105 drivers/staging/fbtft/fb_uc1611.c
>
> a1560f9b Henri Chain 2015-07-14   89  write_reg(par, 0xE8 | (ratio & 
> 0x03));
> a1560f9b Henri Chain 2015-07-14   90
> a1560f9b Henri Chain 2015-07-14   91  /* Set bias gain and 
> potentiometer */
> a1560f9b Henri Chain 2015-07-14   92  write_reg(par, 0x81);
> a1560f9b Henri Chain 2015-07-14   93  write_reg(par, (gain & 0x03) << 
> 6 | (pot & 0x3F));
> a1560f9b Henri Chain 2015-07-14   94
> a1560f9b Henri Chain 2015-07-14   95  /* Set temperature compensation 
> */
> a1560f9b Henri Chain 2015-07-14   96  write_reg(par, 0x24 | (temp & 
> 0x03));
> a1560f9b Henri Chain 2015-07-14   97
> a1560f9b Henri Chain 2015-07-14   98  /* Set panel loading */
> a1560f9b Henri Chain 2015-07-14   99  write_reg(par, 0x28 | (load & 
> 0x03));
> a1560f9b Henri Chain 2015-07-14  100
> a1560f9b Henri Chain 2015-07-14  101  /* Set pump control */
> a1560f9b Henri Chain 2015-07-14  102  write_reg(par, 0x2C | (pump & 
> 0x03));
> a1560f9b Henri Chain 2015-07-14  103
> a1560f9b Henri Chain 2015-07-14  104  /* Set inverse display */
> a1560f9b Henri Chain 2015-07-14 @105  write_reg(par, 0xA6 | (0x01 & 
> 0x01));
> a1560f9b Henri Chain 2015-07-14  106
> a1560f9b Henri Chain 2015-07-14  107  /* Set 4-bit grayscale mode */
> a1560f9b Henri Chain 2015-07-14  108  write_reg(par, 0xD0 | (0x02 & 
> 0x03));
> a1560f9b Henri Chain 2015-07-14  109
> a1560f9b Henri Chain 2015-07-14  110  /* Set Display enable */
> a1560f9b Henri Chain 2015-07-14  111  write_reg(par, 0xA8 | 0x07);
> a1560f9b Henri Chain 2015-07-14  112
> a1560f9b Henri Chain 2015-07-14  113  return 0;
>
> ---
> 0-DAY kernel test infrastructureOpen Source Technology Center
> https://lists.01.org/pipermail/kbuild-all   Intel Corporation
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [staging:staging-testing 134/169] drivers/staging/fbtft/fb_uc1611.c:105:24-28: duplicated argument to & or |

2015-07-15 Thread Henri Chain
Yes they are all intentional, it was a way to make the logic more obvious
(argument on the right is bitmask).

Henri

On 07/15/2015 01:08 PM, Julia Lawall wrote:
> TThese look intentional, but maybe double check the first one, with the
> code shown in this message.
> 
> julia
> 
> On Wed, 15 Jul 2015, kbuild test robot wrote:
> 
>> TO: Henri Chain 
>> CC: "Greg Kroah-Hartman" 
>> CC: de...@driverdev.osuosl.org
>>
>> tree:   git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
>> staging-testing
>> head:   bd1fb5388da0a37c053649ec4aa8e588ef39f958
>> commit: a1560f9bec8b9275a751bd39a1db791d2c73d6e5 [134/169] Staging: fbtft: 
>> Add support for the Ultrachip UC1611 LCD controller
>> :: branch date: 2 hours ago
>> :: commit date: 3 hours ago
>>
 drivers/staging/fbtft/fb_uc1611.c:105:24-28: duplicated argument to & or |
>> drivers/staging/fbtft/fb_uc1611.c:177:6-9: duplicated argument to & or |
>> drivers/staging/fbtft/fb_uc1611.c:178:6-9: duplicated argument to & or |
>> drivers/staging/fbtft/fb_uc1611.c:191:6-9: duplicated argument to & or |
>> drivers/staging/fbtft/fb_uc1611.c:195:6-9: duplicated argument to & or |
>> drivers/staging/fbtft/fb_uc1611.c:203:6-9: duplicated argument to & or |
>> drivers/staging/fbtft/fb_uc1611.c:204:6-9: duplicated argument to & or |
>> drivers/staging/fbtft/fb_uc1611.c:208:6-9: duplicated argument to & or |
>> drivers/staging/fbtft/fb_uc1611.c:209:6-9: duplicated argument to & or |
>> drivers/staging/fbtft/fb_uc1611.c:217:6-9: duplicated argument to & or |
>> drivers/staging/fbtft/fb_uc1611.c:222:6-9: duplicated argument to & or |
>>
>> git remote add staging 
>> git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
>> git remote update staging
>> git checkout a1560f9bec8b9275a751bd39a1db791d2c73d6e5
>> vim +105 drivers/staging/fbtft/fb_uc1611.c
>>
>> a1560f9b Henri Chain 2015-07-14   89 write_reg(par, 0xE8 | (ratio & 
>> 0x03));
>> a1560f9b Henri Chain 2015-07-14   90
>> a1560f9b Henri Chain 2015-07-14   91 /* Set bias gain and 
>> potentiometer */
>> a1560f9b Henri Chain 2015-07-14   92 write_reg(par, 0x81);
>> a1560f9b Henri Chain 2015-07-14   93 write_reg(par, (gain & 0x03) << 
>> 6 | (pot & 0x3F));
>> a1560f9b Henri Chain 2015-07-14   94
>> a1560f9b Henri Chain 2015-07-14   95 /* Set temperature compensation 
>> */
>> a1560f9b Henri Chain 2015-07-14   96 write_reg(par, 0x24 | (temp & 
>> 0x03));
>> a1560f9b Henri Chain 2015-07-14   97
>> a1560f9b Henri Chain 2015-07-14   98 /* Set panel loading */
>> a1560f9b Henri Chain 2015-07-14   99 write_reg(par, 0x28 | (load & 
>> 0x03));
>> a1560f9b Henri Chain 2015-07-14  100
>> a1560f9b Henri Chain 2015-07-14  101 /* Set pump control */
>> a1560f9b Henri Chain 2015-07-14  102 write_reg(par, 0x2C | (pump & 
>> 0x03));
>> a1560f9b Henri Chain 2015-07-14  103
>> a1560f9b Henri Chain 2015-07-14  104 /* Set inverse display */
>> a1560f9b Henri Chain 2015-07-14 @105 write_reg(par, 0xA6 | (0x01 & 
>> 0x01));
>> a1560f9b Henri Chain 2015-07-14  106
>> a1560f9b Henri Chain 2015-07-14  107 /* Set 4-bit grayscale mode */
>> a1560f9b Henri Chain 2015-07-14  108 write_reg(par, 0xD0 | (0x02 & 
>> 0x03));
>> a1560f9b Henri Chain 2015-07-14  109
>> a1560f9b Henri Chain 2015-07-14  110 /* Set Display enable */
>> a1560f9b Henri Chain 2015-07-14  111 write_reg(par, 0xA8 | 0x07);
>> a1560f9b Henri Chain 2015-07-14  112
>> a1560f9b Henri Chain 2015-07-14  113 return 0;
>>
>> ---
>> 0-DAY kernel test infrastructureOpen Source Technology Center
>> https://lists.01.org/pipermail/kbuild-all   Intel Corporation
>>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: unisys: Add s-Par visorhba

2015-07-15 Thread Dan Carpenter
Since you are redoing this anyway...

On Mon, Jul 13, 2015 at 02:38:23PM -0400, Benjamin Romer wrote:
> + for (vdisk = &devdata->head; vdisk->next; vdisk = vdisk->next) {
> + if ((scsidev->channel == vdisk->channel) &&
> + (scsidev->id == vdisk->id) &&
> + (scsidev->lun == vdisk->lun)) {
> + if (atomic_read(&vdisk->error_count) <
> + VISORHBA_ERROR_COUNT)
> + atomic_inc(&vdisk->error_count);
> + else
> + atomic_set(&vdisk->ios_threshold,
> +IOS_ERROR_THRESHOLD);
> + }
> + }


We do this loop all the time, and we're hitting the 80 character
limit.  Make it a define.

#define for_each_vdisk_match(iter, list, match) \
for (iter = &list->head; iter->next; iter = iter->next) \
if (iter->channel == match->channel &&  \
iter->id == match->id &&\
iter->lun == match->lun)

Btw, avoid using too many parenthesis.  It makes the code harder to read
and it silences GCC's check for == vs = typos so it can lead to bugs.

Now the loop looks like:

for_each_vdisk_match(vdisk, devdata, scsidev) {
if (atomic_read(&vdisk->error_count) < VISORHBA_ERROR_COUNT)
atomic_inc(&vdisk->error_count);
else
atomic_set(&vdisk->ios_threshold, IOS_ERROR_THRESHOLD);

}

(Written in email client.  Caveat emptor.)

> +static int
> +visorhba_queue_command_lck(struct scsi_cmnd *scsicmd,
> +void (*visorhba_cmnd_done)(struct scsi_cmnd *))
> +{
> + struct scsi_device *scsidev = scsicmd->device;
> + int insert_location;
> + unsigned char op;
> + unsigned char *cdb = scsicmd->cmnd;
> + struct Scsi_Host *scsihost = scsidev->host;
> + struct uiscmdrsp *cmdrsp;
> + unsigned int i;
> + struct visorhba_devdata *devdata =
> + (struct visorhba_devdata *)scsihost->hostdata;
> + struct scatterlist *sg = NULL;
> + struct scatterlist *sglist = NULL;
> + int err = 0;
> +
> + if (devdata->serverdown || devdata->serverchangingstate)
> + return SCSI_MLQUEUE_DEVICE_BUSY;
> +
> + cmdrsp = kzalloc(sizeof(*cmdrsp), GFP_ATOMIC);
> + if (!cmdrsp)
> + return -ENOMEM;
> +
> + /* now saving everything we need from scsi_cmd into cmdrsp
> +  * before we queue cmdrsp set type to command - as opposed to
> +  * task mgmt
> +  */
> + cmdrsp->cmdtype = CMD_SCSI_TYPE;
> + /* save the pending insertion location. Deletion from pending
> +  * will return the scsicmd pointer for completion
> +  */
> + insert_location =
> + add_scsipending_entry(devdata, CMD_SCSI_TYPE, (void *)scsicmd);
> + if (insert_location != -1) {
> + cmdrsp->scsi.scsicmd = (void *)(uintptr_t)insert_location;
> + } else {
> + kfree(cmdrsp);

This kfree in the middle of the function is weird.

> + return SCSI_MLQUEUE_DEVICE_BUSY;
> + }

The Spar driver tends to have one error label on the end of each
function and it has had very buggy error handling...  I wrote a google
plus post on how to do error handling.

https://plus.google.com/106378716002406849458/posts/dnanfhQ4mHQ

Instead of trying to match the existing buggy style, just adopt normal
kernel style.

regards,
dan carpenter

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


[PATCH] staging/lustre/ldlm: Unregister ldlm namespace from sysfs on free

2015-07-15 Thread green
From: Oleg Drokin 

ldlm_namespace_sysfs_unregister needs to be called ldlm_namespace_free_post
so that we don't have this dangling object there after the namespace
has disappeared.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
index cdb6366..4bb3173 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
@@ -939,6 +939,7 @@ void ldlm_namespace_free_post(struct ldlm_namespace *ns)
ldlm_pool_fini(&ns->ns_pool);
 
ldlm_namespace_debugfs_unregister(ns);
+   ldlm_namespace_sysfs_unregister(ns);
cfs_hash_putref(ns->ns_rs_hash);
/* Namespace \a ns should be not on list at this time, otherwise
 * this will cause issues related to using freed \a ns in poold
-- 
2.1.0

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


RE: [PATCH] staging: unisys: Add s-Par visorhba

2015-07-15 Thread Kershner, David A


> -Original Message-
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Wednesday, July 15, 2015 8:16 AM
> To: Romer, Benjamin M
> Cc: gre...@linuxfoundation.org; driverdev-devel@linuxdriverproject.org;
> jes.soren...@redhat.com; *S-Par-Maintainer
> Subject: Re: [PATCH] staging: unisys: Add s-Par visorhba
> 
> Since you are redoing this anyway...
> 
> On Mon, Jul 13, 2015 at 02:38:23PM -0400, Benjamin Romer wrote:
> > +   for (vdisk = &devdata->head; vdisk->next; vdisk = vdisk->next) {
> > +   if ((scsidev->channel == vdisk->channel) &&
> > +   (scsidev->id == vdisk->id) &&
> > +   (scsidev->lun == vdisk->lun)) {
> > +   if (atomic_read(&vdisk->error_count) <
> > +   VISORHBA_ERROR_COUNT)
> > +   atomic_inc(&vdisk->error_count);
> > +   else
> > +   atomic_set(&vdisk->ios_threshold,
> > +  IOS_ERROR_THRESHOLD);
> > +   }
> > +   }
> 
> 
> We do this loop all the time, and we're hitting the 80 character
> limit.  Make it a define.
> 
> #define for_each_vdisk_match(iter, list, match) \
>   for (iter = &list->head; iter->next; iter = iter->next) \
>   if (iter->channel == match->channel &&  \
>   iter->id == match->id &&\
>   iter->lun == match->lun)
> 
> Btw, avoid using too many parenthesis.  It makes the code harder to read
> and it silences GCC's check for == vs = typos so it can lead to bugs.
> 
> Now the loop looks like:
> 
>   for_each_vdisk_match(vdisk, devdata, scsidev) {
>   if (atomic_read(&vdisk->error_count) <
> VISORHBA_ERROR_COUNT)
>   atomic_inc(&vdisk->error_count);
>   else
>   atomic_set(&vdisk->ios_threshold,
> IOS_ERROR_THRESHOLD);
> 
>   }
> 
> (Written in email client.  Caveat emptor.)

Thanks for the comments and I really like this idea. When I put it in the code, 
I get the following from checkpatch: 

ERROR: Macros with complex values should be enclosed in parentheses
#31: FILE: drivers/staging/unisys/visorhba/visorhba_main.c:157:
+#define for_each_vdisk_match(iter, list, match)  \
+   for (iter = &list->head; iter->next; iter = iter->next) \
+   if (iter->channel == match->channel &&\
+   iter->id == match->id &&  \
+   iter->lun == match->lun)

total: 1 errors, 0 warnings, 0 checks, 275 lines checked

Your patch has style problems, please review.

Any ideas what needs to be wrapped to resolved the checkpatch error?

> 
> > +static int
> > +visorhba_queue_command_lck(struct scsi_cmnd *scsicmd,
> > +  void (*visorhba_cmnd_done)(struct scsi_cmnd *))
> > +{
> > +   struct scsi_device *scsidev = scsicmd->device;
> > +   int insert_location;
> > +   unsigned char op;
> > +   unsigned char *cdb = scsicmd->cmnd;
> > +   struct Scsi_Host *scsihost = scsidev->host;
> > +   struct uiscmdrsp *cmdrsp;
> > +   unsigned int i;
> > +   struct visorhba_devdata *devdata =
> > +   (struct visorhba_devdata *)scsihost->hostdata;
> > +   struct scatterlist *sg = NULL;
> > +   struct scatterlist *sglist = NULL;
> > +   int err = 0;
> > +
> > +   if (devdata->serverdown || devdata->serverchangingstate)
> > +   return SCSI_MLQUEUE_DEVICE_BUSY;
> > +
> > +   cmdrsp = kzalloc(sizeof(*cmdrsp), GFP_ATOMIC);
> > +   if (!cmdrsp)
> > +   return -ENOMEM;
> > +
> > +   /* now saving everything we need from scsi_cmd into cmdrsp
> > +* before we queue cmdrsp set type to command - as opposed to
> > +* task mgmt
> > +*/
> > +   cmdrsp->cmdtype = CMD_SCSI_TYPE;
> > +   /* save the pending insertion location. Deletion from pending
> > +* will return the scsicmd pointer for completion
> > +*/
> > +   insert_location =
> > +   add_scsipending_entry(devdata, CMD_SCSI_TYPE, (void
> *)scsicmd);
> > +   if (insert_location != -1) {
> > +   cmdrsp->scsi.scsicmd = (void *)(uintptr_t)insert_location;
> > +   } else {
> > +   kfree(cmdrsp);
> 
> This kfree in the middle of the function is weird.
> 
> > +   return SCSI_MLQUEUE_DEVICE_BUSY;
> > +   }
> 
> The Spar driver tends to have one error label on the end of each
> function and it has had very buggy error handling...  I wrote a google
> plus post on how to do error handling.
> 
> https://plus.google.com/106378716002406849458/posts/dnanfhQ4mHQ
> 
> Instead of trying to match the existing buggy style, just adopt normal
> kernel style.
> 
> regards,
> dan carpenter

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


Re: [PATCH] staging: unisys: Add s-Par visorhba

2015-07-15 Thread Dan Carpenter
On Wed, Jul 15, 2015 at 04:53:24PM +, Kershner, David A wrote:
> ERROR: Macros with complex values should be enclosed in parentheses
> #31: FILE: drivers/staging/unisys/visorhba/visorhba_main.c:157:
> +#define for_each_vdisk_match(iter, list, match)  \
> +   for (iter = &list->head; iter->next; iter = iter->next) \
> +   if (iter->channel == match->channel &&\
> +   iter->id == match->id &&  \
> +   iter->lun == match->lun)
> 
> total: 1 errors, 0 warnings, 0 checks, 275 lines checked
> 
> Your patch has style problems, please review.
> 
> Any ideas what needs to be wrapped to resolved the checkpatch error?

It's a false positive, just ignore the warning.

regards,
dan carpenter

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


[PATCH] sm750fb: coding style fixes lines over 80 chars

2015-07-15 Thread Vinay Simha BN
scripts/checkpatch.pl kernel coding style fixes of WARNING

WARNING: line over 80 characters

Signed-off-by: Vinay Simha BN 
---
 drivers/staging/sm750fb/ddk750_display.h | 10 +-
 drivers/staging/sm750fb/ddk750_help.h|  6 --
 drivers/staging/sm750fb/ddk750_hwi2c.h   |  6 --
 drivers/staging/sm750fb/ddk750_power.h   |  6 +++---
 drivers/staging/sm750fb/ddk750_sii164.h  | 12 +++-
 drivers/staging/sm750fb/sm750.h  | 13 -
 drivers/staging/sm750fb/sm750_accel.h| 19 ---
 drivers/staging/sm750fb/sm750_help.h | 24 
 drivers/staging/sm750fb/sm750_hw.h   | 19 ---
 9 files changed, 71 insertions(+), 44 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_display.h 
b/drivers/staging/sm750fb/ddk750_display.h
index ae0f84c..eb36a08 100644
--- a/drivers/staging/sm750fb/ddk750_display.h
+++ b/drivers/staging/sm750fb/ddk750_display.h
@@ -111,19 +111,19 @@ typedef enum _disp_output_t
 
/* LCD1 show secondary and DSUB show primary */
LCD1_DSUB_DUAL_SWAP = PNL_2_SEC|SEC_TP_ON|PNL_SEQ_ON|
-   
CRT_2_PRI|PRI_TP_ON|DAC_ON,
+   CRT_2_PRI|PRI_TP_ON|DAC_ON,
 
LCD1_LCD2_PRI = PNL_2_PRI|PRI_TP_ON|PNL_SEQ_ON|
-   
CRT_2_PRI|SEC_TP_OFF|DPMS_OFF|DUAL_TFT_ON,
+   CRT_2_PRI|SEC_TP_OFF|DPMS_OFF|DUAL_TFT_ON,
 
LCD1_LCD2_SEC = PNL_2_SEC|SEC_TP_ON|PNL_SEQ_ON|
-   
CRT_2_SEC|PRI_TP_OFF|DPMS_OFF|DUAL_TFT_ON,
+   CRT_2_SEC|PRI_TP_OFF|DPMS_OFF|DUAL_TFT_ON,
 
LCD1_LCD2_DSUB_PRI = PNL_2_PRI|PRI_TP_ON|PNL_SEQ_ON|DAC_ON|
-   
CRT_2_PRI|SEC_TP_OFF|DPMS_ON|DUAL_TFT_ON,
+   CRT_2_PRI|SEC_TP_OFF|DPMS_ON|DUAL_TFT_ON,
 
LCD1_LCD2_DSUB_SEC = PNL_2_SEC|SEC_TP_ON|PNL_SEQ_ON|DAC_ON|
-   
CRT_2_SEC|PRI_TP_OFF|DPMS_ON|DUAL_TFT_ON,
+   CRT_2_SEC|PRI_TP_OFF|DPMS_ON|DUAL_TFT_ON,
 
 
 }
diff --git a/drivers/staging/sm750fb/ddk750_help.h 
b/drivers/staging/sm750fb/ddk750_help.h
index 4285b05..1cb6ea5 100644
--- a/drivers/staging/sm750fb/ddk750_help.h
+++ b/drivers/staging/sm750fb/ddk750_help.h
@@ -10,8 +10,10 @@
 
 
 #if 0
-/* if 718 big endian turned on,be aware that don't use this driver for general 
use,only for ppc big-endian */
-#warning "big endian on target cpu and enable nature big endian support of 718 
capability !"
+/* if 718 big endian turned on,be aware that don't use this driver for general
+use,only for ppc big-endian */
+#warning "big endian on target cpu and enable nature big endian support of 718
+   capability !"
 #define PEEK32(addr)   __raw_readl(mmio750 + addr)
 #define POKE32(addr, data) __raw_writel(data, mmio750 + addr)
 #else /* software control endianness */
diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.h 
b/drivers/staging/sm750fb/ddk750_hwi2c.h
index 0b830ba6..3d4e48b 100644
--- a/drivers/staging/sm750fb/ddk750_hwi2c.h
+++ b/drivers/staging/sm750fb/ddk750_hwi2c.h
@@ -5,6 +5,8 @@
 int hwI2CInit(unsigned char busSpeedMode);
 void hwI2CClose(void);
 
-unsigned char hwI2CReadReg(unsigned char deviceAddress, unsigned char 
registerIndex);
-int hwI2CWriteReg(unsigned char deviceAddress, unsigned char registerIndex, 
unsigned char data);
+unsigned char hwI2CReadReg(unsigned char deviceAddress,
+   unsigned char registerIndex);
+int hwI2CWriteReg(unsigned char deviceAddress, unsigned char registerIndex,
+   unsigned char data);
 #endif
diff --git a/drivers/staging/sm750fb/ddk750_power.h 
b/drivers/staging/sm750fb/ddk750_power.h
index 4e00955..c5fe37e 100644
--- a/drivers/staging/sm750fb/ddk750_power.h
+++ b/drivers/staging/sm750fb/ddk750_power.h
@@ -13,9 +13,9 @@ DPMS_t;
 #define setDAC(off) \
{   \
POKE32(MISC_CTRL, FIELD_VALUE(PEEK32(MISC_CTRL), \
-   
MISC_CTRL,  \
-   
DAC_POWER,  \
-   off));  
\
+   MISC_CTRL,  \
+   DAC_POWER,  \
+   off));  \
}
 
 void ddk750_setDPMS(DPMS_t);
diff --git a/drivers/staging/sm750fb/ddk750_sii164.h 
b/drivers/staging/sm750fb/ddk750_sii164.h
index 2b4c7d3..c57c799 100644
--- a/drivers/staging/sm750fb/ddk750_sii164.h
+++ b/drivers/staging/sm750fb/ddk750_sii164.h
@@ -6,10 +6,11 @@
 /* Hot Plug detection mode structure */
 typedef enum _sii164_hot_plug_mode_t
 {
-SII164_HOTPLUG_DISABLE = 0, /* Disable Hot Plug output bit (always 
high). */
-SII164_HOTPLUG_USE_MDI, /* Use Monitor Detect Int

Re: [PATCH] staging: unisys: Add s-Par visorhba

2015-07-15 Thread Jes Sorensen
"Kershner, David A"  writes:
>> -Original Message-
>> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
>> Sent: Wednesday, July 15, 2015 8:16 AM
>> To: Romer, Benjamin M
>> Cc: gre...@linuxfoundation.org; driverdev-devel@linuxdriverproject.org;
>> jes.soren...@redhat.com; *S-Par-Maintainer
>> Subject: Re: [PATCH] staging: unisys: Add s-Par visorhba
>> 
>> Since you are redoing this anyway...
>> 
>> On Mon, Jul 13, 2015 at 02:38:23PM -0400, Benjamin Romer wrote:
>> > +  for (vdisk = &devdata->head; vdisk->next; vdisk = vdisk->next) {
>> > +  if ((scsidev->channel == vdisk->channel) &&
>> > +  (scsidev->id == vdisk->id) &&
>> > +  (scsidev->lun == vdisk->lun)) {
>> > +  if (atomic_read(&vdisk->error_count) <
>> > +  VISORHBA_ERROR_COUNT)
>> > +  atomic_inc(&vdisk->error_count);
>> > +  else
>> > +  atomic_set(&vdisk->ios_threshold,
>> > + IOS_ERROR_THRESHOLD);
>> > +  }
>> > +  }
>> 
>> 
>> We do this loop all the time, and we're hitting the 80 character
>> limit.  Make it a define.
>> 
>> #define for_each_vdisk_match(iter, list, match) \
>>  for (iter = &list->head; iter->next; iter = iter->next) \
>>  if (iter->channel == match->channel &&  \
>>  iter->id == match->id &&\
>>  iter->lun == match->lun)
>> 
>> Btw, avoid using too many parenthesis.  It makes the code harder to read
>> and it silences GCC's check for == vs = typos so it can lead to bugs.
>> 
>> Now the loop looks like:
>> 
>>  for_each_vdisk_match(vdisk, devdata, scsidev) {
>>  if (atomic_read(&vdisk->error_count) <
>> VISORHBA_ERROR_COUNT)
>>  atomic_inc(&vdisk->error_count);
>>  else
>>  atomic_set(&vdisk->ios_threshold,
>> IOS_ERROR_THRESHOLD);
>> 
>>  }
>> 
>> (Written in email client.  Caveat emptor.)
>
> Thanks for the comments and I really like this idea. When I put it in the 
> code, 
> I get the following from checkpatch: 
>
> ERROR: Macros with complex values should be enclosed in parentheses
> #31: FILE: drivers/staging/unisys/visorhba/visorhba_main.c:157:
> +#define for_each_vdisk_match(iter, list, match)  \
> +   for (iter = &list->head; iter->next; iter = iter->next) \
> +   if (iter->channel == match->channel &&\
> +   iter->id == match->id &&  \
> +   iter->lun == match->lun)
>
> total: 1 errors, 0 warnings, 0 checks, 275 lines checked
>
> Your patch has style problems, please review.
>
> Any ideas what needs to be wrapped to resolved the checkpatch error?

Maybe this:

#define for_each_vdisk_match(iter, list, match)  \
   for (iter = &(list)->head; iter->next; iter = iter->next) \
   if (iter->channel == match->channel &&\
   iter->id == match->id &&  \
   iter->lun == match->lun)

My guess it's the &list->head that triggers the issue.

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


RE: [PATCH] Drivers: hv: vmbus: prevent new subchannel creation on device shutdown

2015-07-15 Thread KY Srinivasan


> -Original Message-
> From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com]
> Sent: Tuesday, July 14, 2015 9:03 AM
> To: Dexuan Cui
> Cc: de...@linuxdriverproject.org; KY Srinivasan; Haiyang Zhang; linux-
> ker...@vger.kernel.org
> Subject: Re: [PATCH] Drivers: hv: vmbus: prevent new subchannel creation
> on device shutdown
> 
> Dexuan Cui  writes:
> 
> >> -Original Message-
> >> From: Vitaly Kuznetsov
> >> Sent: Monday, July 13, 2015 20:19
> >> Subject: [PATCH] Drivers: hv: vmbus: prevent new subchannel creation on
> device
> >> shutdown
> >>
> >> When a new subchannel offer from host comes during device shutdown
> (e.g.
> >> when a netvsc/storvsc module is unloadedshortly after it was loaded) a
> >> crash can happen as vmbus_process_offer() is not anyhow serialized with
> >> vmbus_remove().
> >
> > How about vmbus_onoffer_rescind()?
> > It's not serialized with vmbus_remove() either, so I think there is an issue
> too?
> >
> > I remember when 'rmmod hv_netvsc', we get a rescind-offer message for
> > each subchannel.
> >
> 
> True, I think we have a race with rescind messages as well, we just
> never saw crashes for some reason. I'll think how we can make the fix
> more general.

In an earlier email I had outlined how I was planning to address original 
issue. I have a patch based on the logic
I had described - essentially put the burden on the probe call to ensure that 
the open (including sub-channels) is
complete before we return from probe. I will post this shortly.

Regards,

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


[PATCH] staging: rtl8188eu: core: find and remove code valid only for 5 HGz.

2015-07-15 Thread Sreenath Madasu
This one of the TODO tasks for staging rtl8188eu driver. I have removed
the code referring to channel > 14 for rtw_ap.c, rtw_ieee80211.c and
rtw_mlme.c files. Please review.

Signed-off-by: Sreenath Madasu 
---
 drivers/staging/rtl8188eu/core/rtw_ap.c| 31 +++---
 drivers/staging/rtl8188eu/core/rtw_ieee80211.c | 24 ++--
 drivers/staging/rtl8188eu/core/rtw_mlme.c  |  5 +
 3 files changed, 16 insertions(+), 44 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c 
b/drivers/staging/rtl8188eu/core/rtw_ap.c
index 293510e..1a32e7b 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ap.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
@@ -497,20 +497,12 @@ void add_RATid(struct adapter *padapter, struct sta_info 
*psta, u8 rssi_level)
shortGIrate = psta_ht->sgi;
}
 
-   if (pcur_network->Configuration.DSConfig > 14) {
-   /*  5G band */
-   if (tx_ra_bitmap & 0x000)
-   sta_band |= WIRELESS_11_5N | WIRELESS_11A;
-   else
-   sta_band |= WIRELESS_11A;
-   } else {
-   if (tx_ra_bitmap & 0x000)
-   sta_band |= WIRELESS_11_24N | WIRELESS_11G | 
WIRELESS_11B;
-   else if (tx_ra_bitmap & 0xff0)
-   sta_band |= WIRELESS_11G | WIRELESS_11B;
-   else
-   sta_band |= WIRELESS_11B;
-   }
+   if (tx_ra_bitmap & 0x000)
+   sta_band |= WIRELESS_11_24N | WIRELESS_11G | WIRELESS_11B;
+   else if (tx_ra_bitmap & 0xff0)
+   sta_band |= WIRELESS_11G | WIRELESS_11B;
+   else
+   sta_band |= WIRELESS_11B;
 
psta->wireless_mode = sta_band;
 
@@ -584,15 +576,8 @@ static void update_bmc_sta(struct adapter *padapter)
tx_ra_bitmap |= 
rtw_get_bit_value_from_ieee_value(psta->bssrateset[i]&0x7f);
}
 
-   if (pcur_network->Configuration.DSConfig > 14) {
-   /* force to A mode. 5G doesn't support CCK rates */
-   network_type = WIRELESS_11A;
-   tx_ra_bitmap = 0x150; /*  6, 12, 24 Mbps */
-   } else {
-   /* force to b mode */
-   network_type = WIRELESS_11B;
-   tx_ra_bitmap = 0xf;
-   }
+   network_type = WIRELESS_11B;
+   tx_ra_bitmap = 0xf;
 
raid = networktype_to_raid(network_type);
init_rate = get_highest_rate_idx(tx_ra_bitmap&0x0fff)&0x3f;
diff --git a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c 
b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
index 11b780d..f55dae1 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
@@ -113,19 +113,12 @@ uint  rtw_is_cckratesonly_included(u8 *rate)
 
 int rtw_check_network_type(unsigned char *rate, int ratelen, int channel)
 {
-   if (channel > 14) {
-   if ((rtw_is_cckrates_included(rate)) == true)
-   return WIRELESS_INVALID;
-   else
-   return WIRELESS_11A;
-   } else {  /*  could be pure B, pure G, or B/G */
-   if ((rtw_is_cckratesonly_included(rate)) == true)
-   return WIRELESS_11B;
-   else if ((rtw_is_cckrates_included(rate)) == true)
-   return  WIRELESS_11BG;
-   else
-   return WIRELESS_11G;
-   }
+   if ((rtw_is_cckratesonly_included(rate)) == true)
+   return WIRELESS_11B;
+   else if ((rtw_is_cckrates_included(rate)) == true)
+   return  WIRELESS_11BG;
+   else
+   return WIRELESS_11G;
 }
 
 u8 *rtw_set_fixed_ie(unsigned char *pbuf, unsigned int len, unsigned char 
*source,
@@ -404,10 +397,7 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv)
 
/* supported rates */
if (pregistrypriv->wireless_mode == WIRELESS_11ABGN) {
-   if (pdev_network->Configuration.DSConfig > 14)
-   wireless_mode = WIRELESS_11A_5N;
-   else
-   wireless_mode = WIRELESS_11BG_24N;
+   wireless_mode = WIRELESS_11BG_24N;
} else {
wireless_mode = pregistrypriv->wireless_mode;
}
diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme.c
index 0558451..15d91814 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
@@ -1872,10 +1872,7 @@ void rtw_update_registrypriv_dev_network(struct adapter 
*adapter)
pdev_network->NetworkTypeInUse = (Ndis802_11OFDM5);
break;
case WIRELESS_11ABGN:
-   if (pregistrypriv->channel > 14)
-   pdev_network->NetworkTypeInUse = (Nd