Re: [PATCH v6 2/4] resource: Use list_head to link sibling resource

2018-07-07 Thread Baoquan He
Hi,

On 07/05/18 at 01:00am, kbuild test robot wrote:
> Hi Baoquan,
> 
> I love your patch! Yet something to improve:
> 
> [auto build test ERROR on linus/master]
> [also build test ERROR on v4.18-rc3 next-20180704]
> [if your patch is applied to the wrong git tree, please drop us a note to 
> help improve the system]

Thanks for telling. 

I cloned 0day-ci/linut to my local pc.
https://github.com/0day-ci/linux.git

However, I didn't find below branch. And tried to open it in web
broswer, also failed.


> url:
> https://github.com/0day-ci/linux/commits/Baoquan-He/resource-Use-list_head-to-link-sibling-resource/20180704-121402
> config: mips-rb532_defconfig (attached as .config)
> compiler: mipsel-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
> reproduce:
> wget 
> https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
> ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> GCC_VERSION=7.2.0 make.cross ARCH=mips 

I did find a old one which is for the old version 5 post.

[bhe@linux]$ git remote -v
0day-ci https://github.com/0day-ci/linux.git (fetch)
0day-ci https://github.com/0day-ci/linux.git (push)
[bhe@dhcp-128-28 linux]$ git branch -a| grep Baoquan| grep resource
  
remotes/0day-ci/Baoquan-He/resource-Use-list_head-to-link-sibling-resource/20180612-113600

Could you help have a look at this?

Thanks
Baoquan

> 
> All error/warnings (new ones prefixed by >>):
> 
> >> arch/mips/pci/pci-rc32434.c:57:11: error: initialization from incompatible 
> >> pointer type [-Werror=incompatible-pointer-types]
>  .child = &rc32434_res_pci_mem2
>   ^
>arch/mips/pci/pci-rc32434.c:57:11: note: (near initialization for 
> 'rc32434_res_pci_mem1.child.next')
> >> arch/mips/pci/pci-rc32434.c:51:47: warning: missing braces around 
> >> initializer [-Wmissing-braces]
> static struct resource rc32434_res_pci_mem1 = {
>   ^
>arch/mips/pci/pci-rc32434.c:60:47: warning: missing braces around 
> initializer [-Wmissing-braces]
> static struct resource rc32434_res_pci_mem2 = {
>   ^
>cc1: some warnings being treated as errors
> 
> vim +57 arch/mips/pci/pci-rc32434.c
> 
> 73b4390f Ralf Baechle 2008-07-16  50  
> 73b4390f Ralf Baechle 2008-07-16 @51  static struct resource 
> rc32434_res_pci_mem1 = {
> 73b4390f Ralf Baechle 2008-07-16  52  .name = "PCI MEM1",
> 73b4390f Ralf Baechle 2008-07-16  53  .start = 0x5000,
> 73b4390f Ralf Baechle 2008-07-16  54  .end = 0x5FFF,
> 73b4390f Ralf Baechle 2008-07-16  55  .flags = IORESOURCE_MEM,
> 73b4390f Ralf Baechle 2008-07-16  56  .sibling = NULL,
> 73b4390f Ralf Baechle 2008-07-16 @57  .child = &rc32434_res_pci_mem2
> 73b4390f Ralf Baechle 2008-07-16  58  };
> 73b4390f Ralf Baechle 2008-07-16  59  
> 
> :: The code at line 57 was first introduced by commit
> :: 73b4390fb23456964201abda79f1210fe337d01a [MIPS] Routerboard 532: 
> Support for base system
> 
> :: TO: Ralf Baechle 
> :: CC: Ralf Baechle 
> 
> ---
> 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


[PATCH 1/1] Drivers: HV: Send one page worth of kmsg dump over Hyper-V during panic

2018-07-07 Thread kys
From: Sunil Muthuswamy 

In the VM mode on Hyper-V, currently, when the kernel panics, an error
code and few register values are populated in an MSR and the Hypervisor
notified. This information is collected on the host. The amount of
information currently collected is found to be limited and not very
actionable. To gather more actionable data, such as stack trace, the
proposal is to write one page worth of kmsg data on an allocated page
and the Hypervisor notified of the page address through the MSR.

- Sysctl option to control the behavior, with ON by default.

Cc: K. Y. Srinivasan 
Cc: Stephen Hemminger 
Signed-off-by: Sunil Muthuswamy 
Signed-off-by: K. Y. Srinivasan 
---
 Documentation/sysctl/kernel.txt|  11 +++
 arch/x86/hyperv/hv_init.c  |  27 +++
 arch/x86/include/asm/hyperv-tlfs.h |   5 +-
 arch/x86/include/asm/mshyperv.h|   1 +
 drivers/hv/vmbus_drv.c | 110 +
 5 files changed, 152 insertions(+), 2 deletions(-)

diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt
index eded671d55eb..59585030cbaf 100644
--- a/Documentation/sysctl/kernel.txt
+++ b/Documentation/sysctl/kernel.txt
@@ -39,6 +39,7 @@ show up in /proc/sys/kernel:
 - hung_task_check_count
 - hung_task_timeout_secs
 - hung_task_warnings
+- hyperv_record_panic_msg
 - kexec_load_disabled
 - kptr_restrict
 - l2cr[ PPC only ]
@@ -374,6 +375,16 @@ This file shows up if CONFIG_DETECT_HUNG_TASK is enabled.
 
 ==
 
+hyperv_record_panic_msg:
+
+Controls whether the panic kmsg data should be reported to Hyper-V.
+
+0: do not report panic kmsg data.
+
+1: report the panic kmsg data. This is the default behavior.
+
+==
+
 kexec_load_disabled:
 
 A toggle indicating if the kexec_load syscall has been disabled. This
diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
index 595e44e8abaa..9c70018a9906 100644
--- a/arch/x86/hyperv/hv_init.c
+++ b/arch/x86/hyperv/hv_init.c
@@ -423,6 +423,33 @@ void hyperv_report_panic(struct pt_regs *regs, long err)
 }
 EXPORT_SYMBOL_GPL(hyperv_report_panic);
 
+/**
+ * hyperv_report_panic_msg - report panic message to Hyper-V
+ * @pa: physical address of the panic page containing the message
+ * @size: size of the message in the page
+ */
+void hyperv_report_panic_msg(phys_addr_t pa, size_t size)
+{
+   /*
+* P3 to contain the physical address of the panic page & P4 to
+* contain the size of the panic data in that page. Rest of the
+* registers are no-op when the NOTIFY_MSG flag is set.
+*/
+   wrmsrl(HV_X64_MSR_CRASH_P0, 0);
+   wrmsrl(HV_X64_MSR_CRASH_P1, 0);
+   wrmsrl(HV_X64_MSR_CRASH_P2, 0);
+   wrmsrl(HV_X64_MSR_CRASH_P3, pa);
+   wrmsrl(HV_X64_MSR_CRASH_P4, size);
+
+   /*
+* Let Hyper-V know there is crash data available along with
+* the panic message.
+*/
+   wrmsrl(HV_X64_MSR_CRASH_CTL,
+  (HV_CRASH_CTL_CRASH_NOTIFY | HV_CRASH_CTL_CRASH_NOTIFY_MSG));
+}
+EXPORT_SYMBOL_GPL(hyperv_report_panic_msg);
+
 bool hv_is_hyperv_initialized(void)
 {
union hv_x64_msr_hypercall_contents hypercall_msr;
diff --git a/arch/x86/include/asm/hyperv-tlfs.h 
b/arch/x86/include/asm/hyperv-tlfs.h
index 96272e99b64e..6ced78af48da 100644
--- a/arch/x86/include/asm/hyperv-tlfs.h
+++ b/arch/x86/include/asm/hyperv-tlfs.h
@@ -176,9 +176,10 @@
 #define HV_X64_ENLIGHTENED_VMCS_RECOMMENDED(1 << 14)
 
 /*
- * Crash notification flag.
+ * Crash notification flags.
  */
-#define HV_CRASH_CTL_CRASH_NOTIFY (1ULL << 63)
+#define HV_CRASH_CTL_CRASH_NOTIFY_MSG  BIT_ULL(62)
+#define HV_CRASH_CTL_CRASH_NOTIFY  BIT_ULL(63)
 
 /* MSR used to identify the guest OS. */
 #define HV_X64_MSR_GUEST_OS_ID 0x4000
diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index 81e768b8d9eb..156a2e5a97a9 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -299,6 +299,7 @@ static inline int cpumask_to_vpset(struct hv_vpset *vpset,
 void __init hyperv_init(void);
 void hyperv_setup_mmu_ops(void);
 void hyperv_report_panic(struct pt_regs *regs, long err);
+void hyperv_report_panic_msg(phys_addr_t pa, size_t size);
 bool hv_is_hyperv_initialized(void);
 void hyperv_cleanup(void);
 
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index b10fe26c4891..05e37283d7c3 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -56,6 +56,8 @@ static struct completion probe_event;
 
 static int hyperv_cpuhp_online;
 
+static void *hv_panic_page;
+
 static int hyperv_panic_event(struct notifier_block *nb, unsigned long val,
  void *args)
 {
@@ -1018,6 +1020,75 @@ static void vmbus_isr(void)
add_interrupt_randomness(HYPERVISOR_CALLBACK_VECTOR, 0);
 }
 
+/*
+ * Boolean to control whether to report

[RFC PATCH v1] Xilinx AXI-Stream FIFO v4.1 IP core driver

2018-07-07 Thread Jacob Feder
Hi all,
I have developed this driver for a Xilinx-provided IP block for their Zynq
SoC. I fixed all of the checkpatch.pl problems I knew how to. If someone
could chime in on how to fix the remaining few it would be appreciated.

Also looking for feedback on general structure. It's my first driver (and
patch submission) so I'm sure there are plenty of things to be improved on
:).

Functionally everything works OK except the performance isn't as good as I
was hoping for. I have been testing it by operating the FIFO in loopback
mode (AXI-Stream TX interface feeding back into RX interface) running on
the XC7Z020 (7000 series) Zynq device. I am getting anything between
3-16MB/s depending on the amount of data transferred. The performance
claimed by the PG080 datasheet is ~65MB/s. The CPU isn't under significant
load (~12%) as reported by top so I don't think that's the bottleneck.

Please +CC in responses as I'm not on the mailing list.

Cheers


This IP core has read and write AXI-Stream FIFOs, the contents of which can
be accessed from the AXI4 memory-mapped interface. This is useful for
transferring data from a processor into the FPGA fabric. The driver creates
a character device that can be read/written to with standard
open/read/write/close.

See Xilinx PG080 document for IP details.

Currently supports only store-forward mode with a 32-bit
AXI4-Lite interface. DOES NOT support:
- cut-through mode
- AXI4 (non-lite)

Signed-off-by: Jacob Feder 
---
 drivers/staging/axisfifo/axis-fifo.c | 1296 ++
 drivers/staging/axisfifo/axis-fifo.h |  119 
 2 files changed, 1415 insertions(+)
 create mode 100644 drivers/staging/axisfifo/axis-fifo.c
 create mode 100644 drivers/staging/axisfifo/axis-fifo.h

diff --git a/drivers/staging/axisfifo/axis-fifo.c 
b/drivers/staging/axisfifo/axis-fifo.c
new file mode 100644
index 000..a61f22b
--- /dev/null
+++ b/drivers/staging/axisfifo/axis-fifo.c
@@ -0,0 +1,1296 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Xilinx AXIS FIFO: interface to the Xilinx AXI-Stream FIFO IP core
+ *
+ * Copyright (C) 2018 Jacob Feder
+ *
+ * Authors:  Jacob Feder 
+ *
+ * See Xilinx PG080 document for IP details
+ */
+
+/* 
+ *   includes
+ * 
+ */
+
+#include "axis-fifo.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+/* 
+ *   globals
+ * 
+ */
+
+static unsigned int num_fifo_devices; /* number of initialized devices */
+static struct mutex num_fifo_devices_mutex; /* mutex for num_fifo_devices */
+
+static int read_timeout = 1000; /* ms to wait before read() times out */
+static int write_timeout = 1000; /* ms to wait before write() times out */
+
+/* 
+ * module command-line arguments
+ * 
+ */
+
+module_param(read_timeout, int, 0444);
+MODULE_PARM_DESC(read_timeout, "ms to wait before blocking read() timing out; 
set to -1 for no timeout");
+module_param(write_timeout, int, 0444);
+MODULE_PARM_DESC(write_timeout, "ms to wait before blocking write() timing 
out; set to -1 for no timeout");
+
+/* 
+ * sysfs entries
+ * 
+ */
+
+static ssize_t sysfs_write(struct device *dev, const char *buf,
+  size_t count, unsigned int addr_offset)
+{
+   struct axis_fifo_local *device_wrapper = dev_get_drvdata(dev);
+
+   if (!mutex_trylock(&device_wrapper->write_mutex)) {
+   dev_err(device_wrapper->os_device,
+   "couldn't acquire write lock\n");
+   return -EBUSY;
+   }
+
+   if (!mutex_trylock(&device_wrapper->read_mutex)) {
+   dev_err(device_wrapper->os_device,
+   "couldn't acquire read lock\n");
+   mutex_unlock(&device_wrapper->write_mutex);
+   dev_dbg(device_wrapper->os_device, "released write lock\n");
+   return -EBUSY;
+   }
+
+   dev_dbg(device_wrapper->os_device, "acquired locks\n");
+
+   if (count != 4) {
+   dev_err(device_wrapper->os_device,
+   "error, sysfs write to address 0x%x expected 4 bytes\n",
+   addr_offset);
+   mutex_unlock(&device_wrapper->write_mutex);
+   mutex_unlock(&device_wrapper->read_mutex);
+   return -EINVAL;
+   }
+
+   dev_dbg(device_wrapper->os_device,
+   "writing 0x%x to sysfs address 0x%x\n",
+   *(unsigned int *)buf, addr_offset);
+   iowrite32(*(unsigned int __force *)buf,
+ device_wrapper->base_addr + addr_offset);
+   mutex_unlock(&device_wrapper->write_mutex);
+   mutex_unlock(&device_wrapper->read_mutex);
+   dev_dbg(d

[PATCH] staging: mt7621-pci: refactor pci related read and writes functions

2018-07-07 Thread Sergio Paracuellos
This commit simplifies and clean a lot of stuff related with pci
reads and writes. It deletes a lot of not needed at all functions
and use kernel arch operations read[b,w,l] and write[b,w,l] instead
of use custom macros. It also include one function helper called
'mt7621_pci_get_cfgaddr' to easily obtain config address. Also to
get pci base address a global 'mt7621_pci_base' variable has been
included and initialized as a pointer to RALINK_PCI_BASE in driver
probe function. With this changes LOC is clearly decreased and
readability is increased.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-pci/pci-mt7621.c | 178 +++-
 1 file changed, 58 insertions(+), 120 deletions(-)

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c 
b/drivers/staging/mt7621-pci/pci-mt7621.c
index c12447d..dabe5c4 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -113,23 +113,6 @@
 #define RALINK_PCIEPHY_P0P1_CTL_OFFSET (RALINK_PCI_BASE + 0x9000)
 #define RALINK_PCIEPHY_P2_CTL_OFFSET   (RALINK_PCI_BASE + 0xA000)
 
-#define MV_WRITE(ofs, data)\
-   *(volatile u32 *)(RALINK_PCI_BASE+(ofs)) = cpu_to_le32(data)
-#define MV_READ(ofs, data) \
-   *(data) = le32_to_cpu(*(volatile u32 *)(RALINK_PCI_BASE+(ofs)))
-#define MV_READ_DATA(ofs)  \
-   le32_to_cpu(*(volatile u32 *)(RALINK_PCI_BASE+(ofs)))
-
-#define MV_WRITE_16(ofs, data) \
-   *(volatile u16 *)(RALINK_PCI_BASE+(ofs)) = cpu_to_le16(data)
-#define MV_READ_16(ofs, data)  \
-   *(data) = le16_to_cpu(*(volatile u16 *)(RALINK_PCI_BASE+(ofs)))
-
-#define MV_WRITE_8(ofs, data)  \
-   *(volatile u8 *)(RALINK_PCI_BASE+(ofs)) = data
-#define MV_READ_8(ofs, data)   \
-   *(data) = *(volatile u8 *)(RALINK_PCI_BASE+(ofs))
-
 #define RALINK_PCI_MM_MAP_BASE 0x6000
 #define RALINK_PCI_IO_MAP_BASE 0x1e16
 
@@ -173,123 +156,75 @@
 #define MEMORY_BASE 0x0
 static int pcie_link_status = 0;
 
-#define PCI_ACCESS_READ_1  0
-#define PCI_ACCESS_READ_2  1
-#define PCI_ACCESS_READ_4  2
-#define PCI_ACCESS_WRITE_1 3
-#define PCI_ACCESS_WRITE_2 4
-#define PCI_ACCESS_WRITE_4 5
+static void __iomem *mt7621_pci_base;
 
-static int config_access(unsigned char access_type, struct pci_bus *bus,
-   unsigned int devfn, unsigned int where, u32 *data)
+static inline u32 mt7621_pci_get_cfgaddr(unsigned int bus, unsigned int slot,
+unsigned int func, unsigned int where)
 {
-   unsigned int slot = PCI_SLOT(devfn);
-   u8 func = PCI_FUNC(devfn);
-   uint32_t address_reg, data_reg;
-   unsigned int address;
+   return ((bus << 16) | (slot << 11) | (func << 8) | (where & 0xfc) |
+   0x8000);
+}
+
+static int
+pci_config_read(struct pci_bus *bus, unsigned int devfn,
+   int where, int size, u32 *val)
+{
+   u32 address_reg, data_reg;
+   u32 address;
 
address_reg = RALINK_PCI_CONFIG_ADDR;
data_reg = RALINK_PCI_CONFIG_DATA_VIRTUAL_REG;
 
-   address = (((where&0xF00)>>8)<<24) |(bus->number << 16) | (slot << 11) |
-   (func << 8) | (where & 0xfc) | 0x8000;
-   MV_WRITE(address_reg, address);
+   address = (((where & 0xF00) >> 8) << 24) |
+  mt7621_pci_get_cfgaddr(bus->number, PCI_SLOT(devfn),
+ PCI_FUNC(devfn), where);
 
-   switch (access_type) {
-   case PCI_ACCESS_WRITE_1:
-   MV_WRITE_8(data_reg+(where&0x3), *data);
-   break;
-   case PCI_ACCESS_WRITE_2:
-   MV_WRITE_16(data_reg+(where&0x3), *data);
-   break;
-   case PCI_ACCESS_WRITE_4:
-   MV_WRITE(data_reg, *data);
-   break;
-   case PCI_ACCESS_READ_1:
-   MV_READ_8(data_reg+(where&0x3), data);
-   break;
-   case PCI_ACCESS_READ_2:
-   MV_READ_16(data_reg+(where&0x3), data);
+   writel(address, mt7621_pci_base + address_reg);
+
+   switch (size) {
+   case 1:
+   *val = readb(mt7621_pci_base + data_reg + (where & 0x3));
break;
-   case PCI_ACCESS_READ_4:
-   MV_READ(data_reg, data);
+   case 2:
+   *val = readw(mt7621_pci_base + data_reg + (where & 0x3));
break;
-   default:
-   printk("no specify access type\n");
+   case 4:
+   *val = readl(mt7621_pci_base + data_reg);
break;
}
-   return 0;
-}
-
-static int
-read_config_byte(struct pci_bus *bus, unsigned int devfn, int where, u8 *val)
-{
-   return config_access(PCI_ACCESS_READ_1, bus, devfn, (unsigned 
int)where, (u32 *)val);
-}
-
-static int
-read_config_word(struct pci_bus *bus, unsigned int devfn, int where, u16 *val)
-{
-   return config_access(PCI_ACCESS_READ_2, bus, devfn, (unsigned 
int)where, (u32 *)val);
-}
-
-static int
-read_config_

[PATCH v1] media: staging: tegra-vde: Replace debug messages with trace points

2018-07-07 Thread Dmitry Osipenko
Trace points are much more efficient than debug messages for extensive
tracing and could be conveniently enabled / disabled dynamically, hence
let's replace debug messages with the trace points.

Signed-off-by: Dmitry Osipenko 
---
 drivers/staging/media/tegra-vde/tegra-vde.c | 221 +++-
 drivers/staging/media/tegra-vde/trace.h | 101 +
 2 files changed, 227 insertions(+), 95 deletions(-)
 create mode 100644 drivers/staging/media/tegra-vde/trace.h

diff --git a/drivers/staging/media/tegra-vde/tegra-vde.c 
b/drivers/staging/media/tegra-vde/tegra-vde.c
index 6f06061a40d9..3f71b46d287b 100644
--- a/drivers/staging/media/tegra-vde/tegra-vde.c
+++ b/drivers/staging/media/tegra-vde/tegra-vde.c
@@ -24,6 +24,8 @@
 
 #include 
 
+#define CREATE_TRACE_POINTS
+#include "trace.h"
 #include "uapi.h"
 
 #define ICMDQUE_WR 0x00
@@ -35,14 +37,6 @@
 #define BSE_ICMDQUE_EMPTY  BIT(3)
 #define BSE_DMA_BUSY   BIT(23)
 
-#define VDE_WR(__data, __addr) \
-do {   \
-   dev_dbg(vde->miscdev.parent,\
-   "%s: %d: 0x%08X => " #__addr ")\n", \
-   __func__, __LINE__, (u32)(__data)); \
-   writel_relaxed(__data, __addr); \
-} while (0)
-
 struct video_frame {
struct dma_buf_attachment *y_dmabuf_attachment;
struct dma_buf_attachment *cb_dmabuf_attachment;
@@ -81,12 +75,63 @@ struct tegra_vde {
u32 *iram;
 };
 
+static __maybe_unused
+char const *tegra_vde_reg_base_name(struct tegra_vde *vde, void __iomem *base)
+{
+   if (vde->sxe == base)
+   return "SXE";
+
+   if (vde->bsev == base)
+   return "BSEV";
+
+   if (vde->mbe == base)
+   return "MBE";
+
+   if (vde->ppe == base)
+   return "PPE";
+
+   if (vde->mce == base)
+   return "MCE";
+
+   if (vde->tfe == base)
+   return "TFE";
+
+   if (vde->ppb == base)
+   return "PPB";
+
+   if (vde->vdma == base)
+   return "VDMA";
+
+   if (vde->frameid == base)
+   return "FRAMEID";
+
+   return "???";
+}
+
+static void tegra_vde_writel(struct tegra_vde *vde,
+u32 value, void __iomem *base, u32 offset)
+{
+   trace_vde_writel(vde, base, offset, value);
+
+   writel_relaxed(value, base + offset);
+}
+
+static u32 tegra_vde_readl(struct tegra_vde *vde,
+  void __iomem *base, u32 offset)
+{
+   u32 value = readl_relaxed(base + offset);
+
+   trace_vde_readl(vde, base, offset, value);
+
+   return value;
+}
+
 static void tegra_vde_set_bits(struct tegra_vde *vde,
-  u32 mask, void __iomem *regs)
+  u32 mask, void __iomem *base, u32 offset)
 {
-   u32 value = readl_relaxed(regs);
+   u32 value = tegra_vde_readl(vde, base, offset);
 
-   VDE_WR(value | mask, regs);
+   tegra_vde_writel(vde, value | mask, base, offset);
 }
 
 static int tegra_vde_wait_mbe(struct tegra_vde *vde)
@@ -107,8 +152,8 @@ static int tegra_vde_setup_mbe_frame_idx(struct tegra_vde 
*vde,
unsigned int idx;
int err;
 
-   VDE_WR(0xD000 | (0 << 23), vde->mbe + 0x80);
-   VDE_WR(0xD020 | (0 << 23), vde->mbe + 0x80);
+   tegra_vde_writel(vde, 0xD000 | (0 << 23), vde->mbe, 0x80);
+   tegra_vde_writel(vde, 0xD020 | (0 << 23), vde->mbe, 0x80);
 
err = tegra_vde_wait_mbe(vde);
if (err)
@@ -118,8 +163,10 @@ static int tegra_vde_setup_mbe_frame_idx(struct tegra_vde 
*vde,
return 0;
 
for (idx = 0, frame_idx = 1; idx < refs_nb; idx++, frame_idx++) {
-   VDE_WR(0xD000 | (frame_idx << 23), vde->mbe + 0x80);
-   VDE_WR(0xD020 | (frame_idx << 23), vde->mbe + 0x80);
+   tegra_vde_writel(vde, 0xD000 | (frame_idx << 23),
+vde->mbe, 0x80);
+   tegra_vde_writel(vde, 0xD020 | (frame_idx << 23),
+vde->mbe, 0x80);
 
frame_idx_enb_mask |= frame_idx << (6 * (idx % 4));
 
@@ -128,7 +175,7 @@ static int tegra_vde_setup_mbe_frame_idx(struct tegra_vde 
*vde,
value |= (idx >> 2) << 24;
value |= frame_idx_enb_mask;
 
-   VDE_WR(value, vde->mbe + 0x80);
+   tegra_vde_writel(vde, value, vde->mbe, 0x80);
 
err = tegra_vde_wait_mbe(vde);
if (err)
@@ -143,8 +190,10 @@ static int tegra_vde_setup_mbe_frame_idx(struct tegra_vde 
*vde,
 
 static void tegra_vde_mbe_set_0xa_reg(struct tegra_vde *vde, int reg, u32 val)
 {
-   VDE_WR(0xA000 | (reg << 24) | (val & 0x), vde->mbe + 0x80);
-   VDE_WR(0xA000 | ((reg + 1) << 24) | (val >> 16), vde->mbe + 0x80);
+   tegra_vde_writel(

[PATCH 07/12] staging:rtl8192u: Correct spacing before and after parenthesis - Style

2018-07-07 Thread John Whitmore
Corrected coding style issues aroung opening and closed parenthesis.

Signed-off-by: John Whitmore 
---
 .../rtl8192u/ieee80211/ieee80211_softmac.c| 78 +--
 1 file changed, 36 insertions(+), 42 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
index a33509e6d2b0..429b8140d3ef 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
@@ -263,7 +263,7 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct 
ieee80211_device *ieee
/* check whether the managed packet queued greater than 5 */
if (!ieee->check_nic_enough_desc(ieee->dev, 
tcb_desc->queue_index) ||\
(skb_queue_len(&ieee->skb_waitQ[tcb_desc->queue_index]) != 
0) || \
-   (ieee->queue_stop) ) {
+   (ieee->queue_stop)) {
/* insert the skb packet to the management queue */
/* as for the completion function, it does not need
 * to check it any more.
@@ -493,7 +493,7 @@ static void ieee80211_softmac_scan_wq(struct work_struct 
*work)
}
}
} while (!channel_map[ieee->current_network.channel]);
-   if (ieee->scanning == 0 )
+   if (ieee->scanning == 0)
goto out;
ieee->set_chan(ieee->dev, ieee->current_network.channel);
if (channel_map[ieee->current_network.channel] == 1)
@@ -584,7 +584,7 @@ EXPORT_SYMBOL(ieee80211_stop_scan);
 /* called with ieee->lock held */
 static void ieee80211_start_scan(struct ieee80211_device *ieee)
 {
-   if (IS_DOT11D_ENABLE(ieee) ) {
+   if (IS_DOT11D_ENABLE(ieee)) {
if (IS_COUNTRY_IE_VALID(ieee))
RESET_CIE_WATCHDOG(ieee);
}
@@ -601,7 +601,7 @@ static void ieee80211_start_scan(struct ieee80211_device 
*ieee)
 /* called with wx_mutex held */
 void ieee80211_start_scan_syncro(struct ieee80211_device *ieee)
 {
-   if (IS_DOT11D_ENABLE(ieee) ) {
+   if (IS_DOT11D_ENABLE(ieee)) {
if (IS_COUNTRY_IE_VALID(ieee))
RESET_CIE_WATCHDOG(ieee);
}
@@ -728,9 +728,9 @@ static struct sk_buff *ieee80211_probe_resp(struct 
ieee80211_device *ieee, u8 *d
return NULL;
skb_reserve(skb, ieee->tx_headroom);
beacon_buf = skb_put(skb, (beacon_size - ieee->tx_headroom));
-   memcpy (beacon_buf->header.addr1, dest, ETH_ALEN);
-   memcpy (beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
-   memcpy (beacon_buf->header.addr3, ieee->current_network.bssid, 
ETH_ALEN);
+   memcpy(beacon_buf->header.addr1, dest, ETH_ALEN);
+   memcpy(beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
+   memcpy(beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN);
 
beacon_buf->header.duration_id = 0; /* FIXME */
beacon_buf->beacon_interval =
@@ -973,7 +973,7 @@ ieee80211_association_req(struct ieee80211_network *beacon,
HTConstructCapabilityElement(ieee, ht_cap_buf, &ht_cap_len, 
encrypt);
if (ieee->pHTInfo->bCurrentRT2RTAggregation) {
realtek_ie_buf = ieee->pHTInfo->szRT2RTAggBuffer;
-   realtek_ie_len = sizeof( 
ieee->pHTInfo->szRT2RTAggBuffer);
+   realtek_ie_len = 
sizeof(ieee->pHTInfo->szRT2RTAggBuffer);
HTConstructRT2RTAggElement(ieee, realtek_ie_buf, 
&realtek_ie_len);
}
}
@@ -1033,7 +1033,7 @@ ieee80211_association_req(struct ieee80211_network 
*beacon,
memcpy(ieee->ap_mac_addr, beacon->bssid, ETH_ALEN);//for HW security, 
John
 
hdr->capability = cpu_to_le16(WLAN_CAPABILITY_BSS);
-   if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
+   if (beacon->capability & WLAN_CAPABILITY_PRIVACY)
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
 
if (beacon->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
@@ -1237,7 +1237,7 @@ static void ieee80211_auth_challenge(struct 
ieee80211_device *ieee,
 
IEEE80211_DEBUG_MGMT("Sending authentication challenge 
response\n");
 
-   ieee80211_encrypt_fragment(ieee, skb, sizeof(struct 
rtl_80211_hdr_3addr  ));
+   ieee80211_encrypt_fragment(ieee, skb, sizeof(struct 
rtl_80211_hdr_3addr));
 
softmac_mgmt_xmit(skb, ieee);
mod_timer(&ieee->associate_timer, jiffies + (HZ / 2));
@@ -1287,7 +1287,7 @@ static void ieee80211_associate_complete_wq(struct 
work_struct *work)
}
ieee->LinkDetectInfo.SlotNum = 2 * (1 + 
ieee->current_network.beacon_interval / 500);
// To prevent the immediately calling watch_dog after association.
-   if (ieee->LinkDetectInfo.NumRecvBcnInPeriod == 0 || 
ieee->LinkDetectInfo.NumRecvDataInPeriod == 0 ) {

[PATCH 11/12] staging:rtl8192u: Correct indentation of ieee80211_softmac_new_net()

2018-07-07 Thread John Whitmore
Coding style change to correct the indentation of the function
ieee80211_softmac_new_net()

Signed-off-by: John Whitmore 
---
 .../rtl8192u/ieee80211/ieee80211_softmac.c| 101 +-
 1 file changed, 50 insertions(+), 51 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
index fd2cf8d8d593..e1a91db7f0a1 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
@@ -1378,63 +1378,62 @@ inline void ieee80211_softmac_new_net(struct 
ieee80211_device *ieee, struct ieee
 * if the network does broadcast and the user did set essid 
chech if essid match
 */
if ((apset && apmatch &&
-   ((ssidset && ssidbroad && ssidmatch) || 
(ssidbroad && !ssidset) || (!ssidbroad && ssidset))) ||
-   /* if the ap is not set, check that the user set the 
bssid
-* and the network does broadcast and that those two 
bssid matches
+((ssidset && ssidbroad && ssidmatch) || (ssidbroad && 
!ssidset) || (!ssidbroad && ssidset))) ||
+   /* if the ap is not set, check that the user set the bssid
+* and the network does broadcast and that those two bssid 
matches
+*/
+   (!apset && ssidset && ssidbroad && ssidmatch)) {
+   /* if the essid is hidden replace it with the
+* essid provided by the user.
 */
-   (!apset && ssidset && ssidbroad && ssidmatch)
-   ) {
-   /* if the essid is hidden replace it with the
-   * essid provided by the user.
-   */
-   if (!ssidbroad) {
-   strncpy(tmp_ssid, 
ieee->current_network.ssid, IW_ESSID_MAX_SIZE);
-   tmp_ssid_len = 
ieee->current_network.ssid_len;
-   }
-   memcpy(&ieee->current_network, net, 
sizeof(struct ieee80211_network));
-
-   strncpy(ieee->current_network.ssid, tmp_ssid, 
IW_ESSID_MAX_SIZE);
-   ieee->current_network.ssid_len = tmp_ssid_len;
-   printk(KERN_INFO"Linking with %s,channel:%d, 
qos:%d, myHT:%d, networkHT:%d\n",
-  ieee->current_network.ssid,
-  ieee->current_network.channel,
-  ieee->current_network.qos_data.supported,
-  ieee->pHTInfo->bEnableHT,
-  ieee->current_network.bssht.bdSupportHT);
-
-   //ieee->pHTInfo->IOTAction = 0;
-   HTResetIOTSetting(ieee->pHTInfo);
-   if (ieee->iw_mode == IW_MODE_INFRA) {
-   /* Join the network for the first time 
*/
-   ieee->AsocRetryCount = 0;
-   //for HT by amy 080514
-   if 
((ieee->current_network.qos_data.supported == 1) &&
-   // (ieee->pHTInfo->bEnableHT && 
ieee->current_network.bssht.bdSupportHT))
-   
ieee->current_network.bssht.bdSupportHT) {
+   if (!ssidbroad) {
+   strncpy(tmp_ssid, ieee->current_network.ssid, 
IW_ESSID_MAX_SIZE);
+   tmp_ssid_len = ieee->current_network.ssid_len;
+   }
+   memcpy(&ieee->current_network, net, sizeof(struct 
ieee80211_network));
+
+   strncpy(ieee->current_network.ssid, tmp_ssid, 
IW_ESSID_MAX_SIZE);
+   ieee->current_network.ssid_len = tmp_ssid_len;
+   printk(KERN_INFO"Linking with %s,channel:%d, qos:%d, 
myHT:%d, networkHT:%d\n",
+  ieee->current_network.ssid,
+  ieee->current_network.channel,
+  ieee->current_network.qos_data.supported,
+  ieee->pHTInfo->bEnableHT,
+  ieee->current_network.bssht.bdSupportHT);
+
+   //ieee->pHTInfo->IOTAction = 0;
+   HTResetIOTSetting(ieee->pHTInfo);
+   if (ieee->iw_mode == IW_MODE_INFRA) {
+   /* Join the network for the first time */
+   ieee->AsocRetryCount = 0;
+   //for HT by amy 080514
+   

[PATCH 08/12] staging:rtl8192u: Remove prohibited spaces - Coding Style

2018-07-07 Thread John Whitmore
Simple removal of spaces prohibited by the coding standard.

Signed-off-by: John Whitmore 
---
 .../staging/rtl8192u/ieee80211/ieee80211_softmac.c   | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
index 429b8140d3ef..6d62fc1b249c 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
@@ -1073,7 +1073,7 @@ ieee80211_association_req(struct ieee80211_network 
*beacon,
// CCX1 spec V1.13, A01.1 CKIP Negotiation (page23):
// "The CKIP negotiation is started with the associate request 
from the client to the access point,
//  containing an Aironet element with both the MIC and KP bits 
set."
-   osCcxAironetIE.Octet[IE_CISCO_FLAG_POSITION] |=  
(SUPPORT_CKIP_PK | SUPPORT_CKIP_MIC) ;
+   osCcxAironetIE.Octet[IE_CISCO_FLAG_POSITION] |= 
(SUPPORT_CKIP_PK | SUPPORT_CKIP_MIC);
tag = skb_put(skb, ckip_ie_len);
*tag++ = MFIE_TYPE_AIRONET;
*tag++ = osCcxAironetIE.Length;
@@ -1202,7 +1202,7 @@ static void ieee80211_associate_step1(struct 
ieee80211_device *ieee)
if (!skb) {
ieee80211_associate_abort(ieee);
} else {
-   ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ;
+   ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING;
IEEE80211_DEBUG_MGMT("Sending authentication request\n");
softmac_mgmt_xmit(skb, ieee);
//BUGON when you try to add_timer twice, using mod_timer may be 
better, john0709
@@ -1796,7 +1796,7 @@ static void ieee80211_process_action(struct 
ieee80211_device *ieee,
return;
}
tmp = *act;
-   act ++;
+   act++;
switch (tmp) {
case ACT_CAT_BA:
if (*act == ACT_ADDBAREQ)
@@ -2115,7 +2115,7 @@ void ieee80211_wake_queue(struct ieee80211_device *ieee)
struct rtl_80211_hdr_3addr  *header;
 
spin_lock_irqsave(&ieee->lock, flags);
-   if (! ieee->queue_stop) goto exit;
+   if (!ieee->queue_stop) goto exit;
 
ieee->queue_stop = 0;
 
@@ -2141,7 +2141,7 @@ void ieee80211_wake_queue(struct ieee80211_device *ieee)
ieee->softmac_stats.swtxawake++;
netif_wake_queue(ieee->dev);
}
-exit :
+exit:
spin_unlock_irqrestore(&ieee->lock, flags);
 }
 EXPORT_SYMBOL(ieee80211_wake_queue);
@@ -2315,7 +2315,7 @@ void ieee80211_start_bss(struct ieee80211_device *ieee)
// STA shall not start a BSS unless properly formed Beacon frame 
including a Country IE.
//
if (IS_DOT11D_ENABLE(ieee) && !IS_COUNTRY_IE_VALID(ieee)) {
-   if (! ieee->bGlobalDomain)
+   if (!ieee->bGlobalDomain)
return;
}
/* check if we have already found the net we
-- 
2.18.0

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


[PATCH 12/12] staging:rtl8192u: Correction of indentation issues - Coding Style

2018-07-07 Thread John Whitmore
Simple changes to correct indentation issues.

Signed-off-by: John Whitmore 
---
 .../rtl8192u/ieee80211/ieee80211_softmac.c| 24 +--
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
index e1a91db7f0a1..b1dc8d2eba0e 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
@@ -2354,10 +2354,10 @@ void ieee80211_disassociate(struct ieee80211_device 
*ieee)
 {
netif_carrier_off(ieee->dev);
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)
-   ieee80211_reset_queue(ieee);
+   ieee80211_reset_queue(ieee);
 
if (ieee->data_hard_stop)
-   ieee->data_hard_stop(ieee->dev);
+   ieee->data_hard_stop(ieee->dev);
if (IS_DOT11D_ENABLE(ieee))
Dot11d_Reset(ieee);
ieee->state = IEEE80211_NOLINK;
@@ -2508,9 +2508,9 @@ void ieee80211_start_protocol(struct ieee80211_device 
*ieee)
 // ieee->set_chan(ieee->dev,ieee->current_network.channel);
 
for (i = 0; i < 17; i++) {
- ieee->last_rxseq_num[i] = -1;
- ieee->last_rxfrag_num[i] = -1;
- ieee->last_packet_time[i] = 0;
+   ieee->last_rxseq_num[i] = -1;
+   ieee->last_rxfrag_num[i] = -1;
+   ieee->last_packet_time[i] = 0;
}
 
ieee->init_wmmparam_flag = 0;//reinitialize AC_xx_PARAM registers.
@@ -2968,14 +2968,14 @@ SendDisassociation(struct ieee80211_device *ieee,
   u8   asRsn
 )
 {
-   struct ieee80211_network *beacon = &ieee->current_network;
-   struct sk_buff *skb;
+   struct ieee80211_network *beacon = &ieee->current_network;
+   struct sk_buff *skb;
 
-   skb = ieee80211_disassociate_skb(beacon, ieee, asRsn);
-   if (skb) {
-   softmac_mgmt_xmit(skb, ieee);
-   //dev_kfree_skb_any(skb);//edit by thomas
-   }
+   skb = ieee80211_disassociate_skb(beacon, ieee, asRsn);
+   if (skb) {
+   softmac_mgmt_xmit(skb, ieee);
+   //dev_kfree_skb_any(skb);//edit by thomas
+   }
 }
 EXPORT_SYMBOL(SendDisassociation);
 
-- 
2.18.0

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


[PATCH 09/12] staging:rtl8192u: Move trailing conditional statement to the following line

2018-07-07 Thread John Whitmore
Coding standard requires that the conditional statement is not on the same
line as the 'if' or 'else' but on the following line. Statements moved
accordingly.

Signed-off-by: John Whitmore 
---
 .../rtl8192u/ieee80211/ieee80211_softmac.c| 25 +--
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
index 6d62fc1b249c..7bc2e94792ca 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
@@ -622,7 +622,8 @@ ieee80211_authentication_req(struct ieee80211_network 
*beacon,
int len = sizeof(struct ieee80211_authentication) + challengelen + 
ieee->tx_headroom;
 
skb = dev_alloc_skb(len);
-   if (!skb) return NULL;
+   if (!skb)
+   return NULL;
 
skb_reserve(skb, ieee->tx_headroom);
auth = skb_put(skb, sizeof(struct ieee80211_authentication));
@@ -680,7 +681,8 @@ static struct sk_buff *ieee80211_probe_resp(struct 
ieee80211_device *ieee, u8 *d
u8 *tmp_generic_ie_buf = NULL;
u8 tmp_generic_ie_len = 0;
 
-   if (rate_ex_len > 0) rate_ex_len += 2;
+   if (rate_ex_len > 0)
+   rate_ex_len += 2;
 
if (ieee->current_network.capability & WLAN_CAPABILITY_IBSS)
atim_len = 4;
@@ -834,7 +836,8 @@ static struct sk_buff *ieee80211_assoc_resp(struct 
ieee80211_device *ieee,
 
if (ieee->host_encrypt)
crypt = ieee->crypt[ieee->tx_keyidx];
-   else crypt = NULL;
+   else
+   crypt = NULL;
 
encrypt = crypt && crypt->ops;
 
@@ -843,8 +846,10 @@ static struct sk_buff *ieee80211_assoc_resp(struct 
ieee80211_device *ieee,
 
assoc->status = 0;
assoc->aid = cpu_to_le16(ieee->assoc_id);
-   if (ieee->assoc_id == 0x2007) ieee->assoc_id = 0;
-   else ieee->assoc_id++;
+   if (ieee->assoc_id == 0x2007)
+   ieee->assoc_id = 0;
+   else
+   ieee->assoc_id++;
 
tag = skb_put(skb, rate_len);
 
@@ -1529,9 +1534,12 @@ static short probe_rq_parse(struct ieee80211_device 
*ieee, struct sk_buff *skb,
}
 
//IEEE80211DMESG("Card MAC address is "MACSTR, MAC2STR(src));
-   if (ssidlen == 0) return 1;
+   if (ssidlen == 0)
+   return 1;
+
+   if (!ssid)
+   return 1; /* ssid not found in tagged param */
 
-   if (!ssid) return 1; /* ssid not found in tagged param */
return (!strncmp(ssid, ieee->current_network.ssid, ssidlen));
 }
 
@@ -2115,7 +2123,8 @@ void ieee80211_wake_queue(struct ieee80211_device *ieee)
struct rtl_80211_hdr_3addr  *header;
 
spin_lock_irqsave(&ieee->lock, flags);
-   if (!ieee->queue_stop) goto exit;
+   if (!ieee->queue_stop)
+   goto exit;
 
ieee->queue_stop = 0;
 
-- 
2.18.0

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


[PATCH 10/12] staging:rtl8192u: Remove unnecessary parentheses - Coding Style

2018-07-07 Thread John Whitmore
checkpatch.pl flags unnecessary parentheses so removed from code.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
index 7bc2e94792ca..fd2cf8d8d593 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
@@ -699,9 +699,9 @@ static struct sk_buff *ieee80211_probe_resp(struct 
ieee80211_device *ieee, u8 *d
encrypt = ieee->host_encrypt && crypt && crypt->ops &&
((0 == strcmp(crypt->ops->name, "WEP") || wpa_ie_len));
/* HT ralated element */
-   tmp_ht_cap_buf = (u8 *)&(ieee->pHTInfo->SelfHTCap);
+   tmp_ht_cap_buf = (u8 *)&ieee->pHTInfo->SelfHTCap;
tmp_ht_cap_len = sizeof(ieee->pHTInfo->SelfHTCap);
-   tmp_ht_info_buf = (u8 *)&(ieee->pHTInfo->SelfHTInfo);
+   tmp_ht_info_buf = (u8 *)&ieee->pHTInfo->SelfHTInfo;
tmp_ht_info_len = sizeof(ieee->pHTInfo->SelfHTInfo);
HTConstructCapabilityElement(ieee, tmp_ht_cap_buf, &tmp_ht_cap_len, 
encrypt);
HTConstructInfoElement(ieee, tmp_ht_info_buf, &tmp_ht_info_len, 
encrypt);
@@ -973,7 +973,7 @@ ieee80211_association_req(struct ieee80211_network *beacon,
 
/* Include High Throuput capability && Realtek proprietary */
if (ieee->pHTInfo->bCurrentHTSupport && ieee->pHTInfo->bEnableHT) {
-   ht_cap_buf = (u8 *)&(ieee->pHTInfo->SelfHTCap);
+   ht_cap_buf = (u8 *)&ieee->pHTInfo->SelfHTCap;
ht_cap_len = sizeof(ieee->pHTInfo->SelfHTCap);
HTConstructCapabilityElement(ieee, ht_cap_buf, &ht_cap_len, 
encrypt);
if (ieee->pHTInfo->bCurrentRT2RTAggregation) {
@@ -1413,7 +1413,7 @@ inline void ieee80211_softmac_new_net(struct 
ieee80211_device *ieee, struct ieee

ieee->current_network.bssht.bdSupportHT) {
 /*WB, 2008.09.09:bCurrentHTSupport and bEnableHT two flags are going to put 
together to check whether we are in HT now, so needn't to check bEnableHT flags 
here. That's is to say we will set to HT support whenever joined AP has the 
ability to support HT. And whether we are in HT or not, please check 
bCurrentHTSupport&&bEnableHT now please.*/
//  
ieee->pHTInfo->bCurrentHTSupport = true;
-   
HTResetSelfAndSavePeerSetting(ieee, &(ieee->current_network));
+   
HTResetSelfAndSavePeerSetting(ieee, &ieee->current_network);
} else {

ieee->pHTInfo->bCurrentHTSupport = false;
}
-- 
2.18.0

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


[PATCH 05/12] staging:rtl8192u: Correct indentation and spacing for braces of code blocks

2018-07-07 Thread John Whitmore
Simple style change to fix the indentaiton and spacing of the braces around
multi ling code blocks.

Signed-off-by: John Whitmore 
---
 .../rtl8192u/ieee80211/ieee80211_softmac.c| 250 --
 1 file changed, 105 insertions(+), 145 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
index 5ec74f9d61b2..a33509e6d2b0 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
@@ -107,11 +107,10 @@ static void ieee80211_WMM_Info(struct ieee80211_device 
*ieee, u8 **tag_p)
*tag++ = 0x00;
*tag++ = 0x01;
 #ifdef SUPPORT_USPD
-   if (ieee->current_network.wmm_info & 0x80) {
+   if (ieee->current_network.wmm_info & 0x80)
*tag++ = 0x0f | MAX_SP_Len;
-   } else {
+   else
*tag++ = MAX_SP_Len;
-   }
 #else
*tag++ = MAX_SP_Len;
 #endif
@@ -200,8 +199,7 @@ static u8 MgntQuery_MgntFrameTxRate(struct ieee80211_device 
*ieee)
 
/*
// Data rate of ProbeReq is already decided. Annie, 2005-03-31
-   if( pMgntInfo->bScanInProgress || (pMgntInfo->bDualModeScanStep!=0) )
-   {
+   if( pMgntInfo->bScanInProgress || (pMgntInfo->bDualModeScanStep!=0) ) {
if(pMgntInfo->dot11CurrentWirelessMode==WIRELESS_MODE_A)
rate = 0x0c;
else
@@ -233,10 +231,10 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct 
ieee80211_device *ieee
tcb_desc->bTxDisableRateFallBack = 1;
tcb_desc->bTxUseDriverAssingedRate = 1;
 
-   if (single){
-   if (ieee->queue_stop){
+   if (single) {
+   if (ieee->queue_stop) {
enqueue_mgmt(ieee, skb);
-   }else{
+   } else {
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4);
 
if (ieee->seq_ctrl[0] == 0xFFF)
@@ -251,7 +249,7 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct 
ieee80211_device *ieee
}
 
spin_unlock_irqrestore(&ieee->lock, flags);
-   }else{
+   } else {
spin_unlock_irqrestore(&ieee->lock, flags);
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags);
 
@@ -287,7 +285,7 @@ softmac_ps_mgmt_xmit(struct sk_buff *skb, struct 
ieee80211_device *ieee)
struct rtl_80211_hdr_3addr  *header =
(struct rtl_80211_hdr_3addr  *)skb->data;
 
-   if (single){
+   if (single) {
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4);
 
if (ieee->seq_ctrl[0] == 0xFFF)
@@ -298,7 +296,7 @@ softmac_ps_mgmt_xmit(struct sk_buff *skb, struct 
ieee80211_device *ieee)
/* avoid watchdog triggers */
netif_trans_update(ieee->dev);
ieee->softmac_data_hard_start_xmit(skb, ieee->dev, 
ieee->basic_rate);
-   }else{
+   } else {
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4);
 
if (ieee->seq_ctrl[0] == 0xFFF)
@@ -420,13 +418,12 @@ void ieee80211_softmac_scan_syncro(struct 
ieee80211_device *ieee)
memcpy(channel_map, GET_DOT11D_INFO(ieee)->channel_map, 
MAX_CHANNEL_NUMBER + 1);
mutex_lock(&ieee->scan_mutex);
 
-   while (1)
-   {
-   do{
+   while (1) {
+   do {
ch++;
if (ch > MAX_CHANNEL_NUMBER)
goto out; /* scan completed */
-   }while (!channel_map[ch]);
+   } while (!channel_map[ch]);
 
/* this function can be called in two situations
 * 1- We have switched to ad-hoc mode and we are
@@ -462,16 +459,15 @@ void ieee80211_softmac_scan_syncro(struct 
ieee80211_device *ieee)
msleep_interruptible(IEEE80211_SOFTMAC_SCAN_TIME);
}
 out:
-   if (ieee->state < IEEE80211_LINKED){
+   if (ieee->state < IEEE80211_LINKED) {
ieee->actscanning = false;
mutex_unlock(&ieee->scan_mutex);
+   } else {
+   ieee->sync_scan_hurryup = 0;
+   if (IS_DOT11D_ENABLE(ieee))
+   DOT11D_ScanComplete(ieee);
+   mutex_unlock(&ieee->scan_mutex);
}
-   else{
-   ieee->sync_scan_hurryup = 0;
-   if (IS_DOT11D_ENABLE(ieee))
-   DOT11D_ScanComplete(ieee);
-   mutex_unlock(&ieee->scan_mutex);
-}
 }
 EXPORT_SYMBOL(ieee80211_softmac_scan_syncro);
 
@@ -486,18 +482,17 @@ static void ieee80211_softmac_scan_wq(struct work_struct 
*work)
if (!ieee->ieee_up)
return;
mutex_lock(&ieee->scan_mutex);
-   do{
+   do {
ieee->current_network.channel =
(ieee->current_network.channel + 1) % 
MAX_CHANNEL_NUMBER;
-   if (watchdog++ > MAX_CHANNEL_NUMBER)
-   {
+   

[PATCH 04/12] staging:rtl8192u: Add spaces required around operators - Coding Style

2018-07-07 Thread John Whitmore
Added the spaces, required by coding style, around the various operators.

Signed-off-by: John Whitmore 
---
 .../rtl8192u/ieee80211/ieee80211_softmac.c| 124 +-
 1 file changed, 62 insertions(+), 62 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
index e046cc49f3d7..5ec74f9d61b2 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
@@ -108,7 +108,7 @@ static void ieee80211_WMM_Info(struct ieee80211_device 
*ieee, u8 **tag_p)
*tag++ = 0x01;
 #ifdef SUPPORT_USPD
if (ieee->current_network.wmm_info & 0x80) {
-   *tag++ = 0x0f|MAX_SP_Len;
+   *tag++ = 0x0f | MAX_SP_Len;
} else {
*tag++ = MAX_SP_Len;
}
@@ -142,7 +142,7 @@ static void enqueue_mgmt(struct ieee80211_device *ieee, 
struct sk_buff *skb)
 {
int nh;
 
-   nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM;
+   nh = (ieee->mgmt_queue_head + 1) % MGMT_QUEUE_NUM;
 
 /*
  * if the queue is full but we have newer frames then
@@ -167,7 +167,7 @@ static struct sk_buff *dequeue_mgmt(struct ieee80211_device 
*ieee)
ret = ieee->mgmt_queue_ring[ieee->mgmt_queue_tail];
 
ieee->mgmt_queue_tail =
-   (ieee->mgmt_queue_tail+1) % MGMT_QUEUE_NUM;
+   (ieee->mgmt_queue_tail + 1) % MGMT_QUEUE_NUM;
 
return ret;
 }
@@ -192,7 +192,7 @@ static u8 MgntQuery_MgntFrameTxRate(struct ieee80211_device 
*ieee)
/* 2005.01.26, by rcnjko. */
if (ieee->mode == IEEE_A ||
ieee->mode == IEEE_N_5G ||
-   (ieee->mode == IEEE_N_24G&&!pHTInfo->bCurSuppCCK))
+   (ieee->mode == IEEE_N_24G && !pHTInfo->bCurSuppCCK))
rate = 0x0c;
else
rate = 0x02;
@@ -237,7 +237,7 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct 
ieee80211_device *ieee
if (ieee->queue_stop){
enqueue_mgmt(ieee, skb);
}else{
-   header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0]<<4);
+   header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4);
 
if (ieee->seq_ctrl[0] == 0xFFF)
ieee->seq_ctrl[0] = 0;
@@ -373,7 +373,7 @@ static void ieee80211_send_beacon(struct ieee80211_device 
*ieee)
 // if(!timer_pending(&ieee->beacon_timer))
 // add_timer(&ieee->beacon_timer);
mod_timer(&ieee->beacon_timer,
- jiffies + 
msecs_to_jiffies(ieee->current_network.beacon_interval-5));
+ jiffies + 
msecs_to_jiffies(ieee->current_network.beacon_interval - 5));
}
//spin_unlock_irqrestore(&ieee->beacon_lock,flags);
 }
@@ -415,9 +415,9 @@ static void ieee80211_send_probe_requests(struct 
ieee80211_device *ieee)
 void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
 {
short ch = 0;
-   u8 channel_map[MAX_CHANNEL_NUMBER+1];
+   u8 channel_map[MAX_CHANNEL_NUMBER + 1];
 
-   memcpy(channel_map, GET_DOT11D_INFO(ieee)->channel_map, 
MAX_CHANNEL_NUMBER+1);
+   memcpy(channel_map, GET_DOT11D_INFO(ieee)->channel_map, 
MAX_CHANNEL_NUMBER + 1);
mutex_lock(&ieee->scan_mutex);
 
while (1)
@@ -480,9 +480,9 @@ static void ieee80211_softmac_scan_wq(struct work_struct 
*work)
struct delayed_work *dwork = to_delayed_work(work);
struct ieee80211_device *ieee = container_of(dwork, struct 
ieee80211_device, softmac_scan_wq);
static short watchdog;
-   u8 channel_map[MAX_CHANNEL_NUMBER+1];
+   u8 channel_map[MAX_CHANNEL_NUMBER + 1];
 
-   memcpy(channel_map, GET_DOT11D_INFO(ieee)->channel_map, 
MAX_CHANNEL_NUMBER+1);
+   memcpy(channel_map, GET_DOT11D_INFO(ieee)->channel_map, 
MAX_CHANNEL_NUMBER + 1);
if (!ieee->ieee_up)
return;
mutex_lock(&ieee->scan_mutex);
@@ -677,7 +677,7 @@ static struct sk_buff *ieee80211_probe_resp(struct 
ieee80211_device *ieee, u8 *d
 
char *ssid = ieee->current_network.ssid;
int ssid_len = ieee->current_network.ssid_len;
-   int rate_len = ieee->current_network.rates_len+2;
+   int rate_len = ieee->current_network.rates_len + 2;
int rate_ex_len = ieee->current_network.rates_ex_len;
int wpa_ie_len = ieee->wpa_ie_len;
u8 erpinfo_content = 0;
@@ -690,7 +690,7 @@ static struct sk_buff *ieee80211_probe_resp(struct 
ieee80211_device *ieee, u8 *d
u8 *tmp_generic_ie_buf = NULL;
u8 tmp_generic_ie_len = 0;
 
-   if (rate_ex_len > 0) rate_ex_len+=2;
+   if (rate_ex_len > 0) rate_ex_len += 2;
 
if (ieee->current_network.capability & WLAN_CAPABILITY_IBSS)
atim_len = 4;
@@ -721,19 +721,19 @@ static struct sk_buff *ieee8021

[PATCH 06/12] staging:rtl8192u: rename HT_EXTCHNL_OFFSET -> enum ht_extension_chan_width

2018-07-07 Thread John Whitmore
remove the typedef of enumerated type HT_EXTCHNL_OFFSET and replace it with
'enum ht_extension_chan_offset'

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/ieee80211.h| 4 ++--
 drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c | 2 +-
 drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h   | 6 +++---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c   | 6 +++---
 drivers/staging/rtl8192u/r819xU_phy.c | 5 +++--
 drivers/staging/rtl8192u/r819xU_phy.h | 2 +-
 6 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h 
b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
index 8ca24c10c28e..3b7968681f77 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
@@ -2002,7 +2002,7 @@ struct ieee80211_device {
short (*check_nic_enough_desc)(struct net_device *dev, int queue_index);
//added by wb for HT related
 // void (*SwChnlByTimerHandler)(struct net_device *dev, int channel);
-   void (*SetBWModeHandler)(struct net_device *dev, enum ht_channel_width 
Bandwidth, HT_EXTCHNL_OFFSET Offset);
+   void (*SetBWModeHandler)(struct net_device *dev, enum ht_channel_width 
Bandwidth, enum ht_extension_chan_offset Offset);
 // void (*UpdateHalRATRTableHandler)(struct net_device* dev, u8* pMcsRate);
bool (*GetNmodeSupportBySecCfg)(struct net_device *dev);
void (*SetWirelessMode)(struct net_device *dev, u8 wireless_mode);
@@ -2358,7 +2358,7 @@ void HTDebugHTCapability(u8 *CapIE, u8 *TitleString);
 void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString);
 
 void HTSetConnectBwMode(struct ieee80211_device *ieee,
-   enum ht_channel_width Bandwidth, HT_EXTCHNL_OFFSET 
Offset);
+   enum ht_channel_width Bandwidth, enum 
ht_extension_chan_offset Offset);
 void HTUpdateDefaultSetting(struct ieee80211_device *ieee);
 void HTConstructCapabilityElement(struct ieee80211_device *ieee, u8 *posHTCap,
  u8 *len, u8 isEncrypt);
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
index 804d628ed9eb..81020fbcdc20 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
@@ -302,7 +302,7 @@ void ieee80211_wx_sync_scan_wq(struct work_struct *work)
 {
struct ieee80211_device *ieee = container_of(work, struct 
ieee80211_device, wx_sync_scan_wq);
short chan;
-   HT_EXTCHNL_OFFSET chan_offset = 0;
+   enum ht_extension_chan_offset chan_offset = 0;
enum ht_channel_width bandwidth = 0;
int b40M = 0;
 
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h
index c13ca7f0f4dd..7d54a7cd9514 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h
@@ -36,12 +36,12 @@ enum ht_channel_width {
 // Represent Extension Channel Offset in HT Capabilities
 // This is available only in 40Mhz mode.
 //
-typedef enum _HT_EXTCHNL_OFFSET {
+enum ht_extension_chan_offset {
HT_EXTCHNL_OFFSET_NO_EXT = 0,
HT_EXTCHNL_OFFSET_UPPER = 1,
HT_EXTCHNL_OFFSET_NO_DEF = 2,
HT_EXTCHNL_OFFSET_LOWER = 3,
-}HT_EXTCHNL_OFFSET, *PHT_EXTCHNL_OFFSET;
+};
 
 typedef enum _CHNLOP {
CHNLOP_NONE = 0, // No Action now
@@ -237,7 +237,7 @@ typedef struct _RT_HIGH_THROUGHPUT {
u8  PeerMimoPs;
 
// 40MHz Channel Offset settings.
-   HT_EXTCHNL_OFFSET   CurSTAExtChnlOffset;
+   enum ht_extension_chan_offset   CurSTAExtChnlOffset;
u8  bCurTxBW40MHz;  // If we use 40 MHz to 
Tx
u8  PeerBandwidth;
 
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 86c63b217d3b..264d15fbcc6b 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -894,7 +894,7 @@ static u8 HTFilterMCSRate(struct ieee80211_device *ieee, u8 
*pSupportMCS,
return true;
 }
 
-void HTSetConnectBwMode(struct ieee80211_device *ieee, enum ht_channel_width   
Bandwidth, HT_EXTCHNL_OFFSETOffset);
+void HTSetConnectBwMode(struct ieee80211_device *ieee, enum ht_channel_width 
Bandwidth, enum ht_extension_chan_offset  Offset);
 void HTOnAssocRsp(struct ieee80211_device *ieee)
 {
PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
@@ -936,7 +936,7 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
 // IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA|IEEE80211_DL_HT, pPeerHTInfo, 
sizeof(HT_INFORMATION_ELE));
// Config Supported Channel Width setting
//
-   HTSetConnectBwMode(ieee, (enum ht_channel_

[PATCH 03/12] staging:rtl8192u: Remove blank lines before '}' and after '{' characters

2018-07-07 Thread John Whitmore
Coding style change to simply remove the unrequired spaces before a closing
brace or before an opening brace.

Signed-off-by: John Whitmore 
---
 .../rtl8192u/ieee80211/ieee80211_softmac.c| 44 ++-
 1 file changed, 13 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
index 1f6d0fb3c5bd..e046cc49f3d7 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
@@ -77,8 +77,7 @@ static void ieee80211_MFIE_Grate(struct ieee80211_device 
*ieee, u8 **tag_p)
 {
u8 *tag = *tag_p;
 
-   if (ieee->modulation & IEEE80211_OFDM_MODULATION) {
-
+   if (ieee->modulation & IEEE80211_OFDM_MODULATION) {
*tag++ = MFIE_TYPE_RATES_EX;
*tag++ = 8;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
@@ -89,7 +88,6 @@ static void ieee80211_MFIE_Grate(struct ieee80211_device 
*ieee, u8 **tag_p)
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
}
 
/* We may add an option for custom rates that specific HW might support 
*/
@@ -301,7 +299,6 @@ softmac_ps_mgmt_xmit(struct sk_buff *skb, struct 
ieee80211_device *ieee)
netif_trans_update(ieee->dev);
ieee->softmac_data_hard_start_xmit(skb, ieee->dev, 
ieee->basic_rate);
}else{
-
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4);
 
if (ieee->seq_ctrl[0] == 0xFFF)
@@ -1473,7 +1470,6 @@ void ieee80211_softmac_check_all_nets(struct 
ieee80211_device *ieee)
spin_lock_irqsave(&ieee->lock, flags);
 
list_for_each_entry(target, &ieee->network_list, list) {
-
/* if the state become different that NOLINK means
 * we had found what we are searching for
 */
@@ -1572,8 +1568,7 @@ static int assoc_rq_parse(struct sk_buff *skb, u8 *dest)
struct ieee80211_assoc_request_frame *a;
 
if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
-   sizeof(struct ieee80211_info_element))) {
-
+   sizeof(struct ieee80211_info_element))) {
IEEE80211_DEBUG_MGMT("invalid len in auth request:%d \n", 
skb->len);
return -1;
}
@@ -1640,7 +1635,6 @@ ieee80211_rx_auth_rq(struct ieee80211_device *ieee, 
struct sk_buff *skb)
ieee80211_resp_to_auth(ieee, status, dest);
}
//DMESG("Dest is "MACSTR, MAC2STR(dest));
-
 }
 
 static inline void
@@ -1665,7 +1659,6 @@ static void ieee80211_sta_ps_send_null_frame(struct 
ieee80211_device *ieee,
 
if (buf)
softmac_ps_mgmt_xmit(buf, ieee);
-
 }
 /* EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame); */
 
@@ -1726,10 +1719,9 @@ static inline void ieee80211_sta_ps(struct 
ieee80211_device *ieee)
spin_lock_irqsave(&ieee->lock, flags);
 
if ((ieee->ps == IEEE80211_PS_DISABLED ||
-   ieee->iw_mode != IW_MODE_INFRA ||
-   ieee->state != IEEE80211_LINKED)){
-
-   //  #warning CHECK_LOCK_HERE
+ieee->iw_mode != IW_MODE_INFRA ||
+ieee->state != IEEE80211_LINKED)){
+   //  #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
 
ieee80211_sta_wakeup(ieee, 1);
@@ -1999,8 +1991,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, 
struct sk_buff *skb,
case IEEE80211_STYPE_AUTH:
if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) {
if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING
-   && ieee->iw_mode == IW_MODE_INFRA) {
-
+   && ieee->iw_mode == IW_MODE_INFRA) {
IEEE80211_DEBUG_MGMT("Received auth response");
ieee80211_check_auth_response(ieee, skb);
} else if (ieee->iw_mode == IW_MODE_MASTER) {
@@ -2011,9 +2002,9 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, 
struct sk_buff *skb,
 
case IEEE80211_STYPE_PROBE_REQ:
if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
-   ((ieee->iw_mode == IW_MODE_ADHOC ||
-   ieee->iw_mode == IW_MODE_MASTER) &&
-   ieee->state == IEEE80211_LINKED)){
+   ((ieee->iw_mode == IW_MODE_ADHOC ||
+ ieee->iw_mode == IW_MODE_MASTER) &&
+ieee->state == IEEE80211_LINKED)){
ieee80211_rx_probe_rq(ieee, skb);
}
break;
@@ -2024,9 +2015,8 @@ ieee80211_rx_frame_softmac(struct ieee8

[PATCH 02/12] staging:rtl8192u: Add space required before '(' - Style

2018-07-07 Thread John Whitmore
Simple addition of the coding style required space before '('.

Signed-off-by: John Whitmore 
---
 .../rtl8192u/ieee80211/ieee80211_softmac.c| 174 +-
 1 file changed, 86 insertions(+), 88 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
index 5895d6e5eb67..1f6d0fb3c5bd 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
@@ -109,7 +109,7 @@ static void ieee80211_WMM_Info(struct ieee80211_device 
*ieee, u8 **tag_p)
*tag++ = 0x00;
*tag++ = 0x01;
 #ifdef SUPPORT_USPD
-   if(ieee->current_network.wmm_info & 0x80) {
+   if (ieee->current_network.wmm_info & 0x80) {
*tag++ = 0x0f|MAX_SP_Len;
} else {
*tag++ = MAX_SP_Len;
@@ -163,7 +163,7 @@ static struct sk_buff *dequeue_mgmt(struct ieee80211_device 
*ieee)
 {
struct sk_buff *ret;
 
-   if(ieee->mgmt_queue_tail == ieee->mgmt_queue_head)
+   if (ieee->mgmt_queue_tail == ieee->mgmt_queue_head)
return NULL;
 
ret = ieee->mgmt_queue_ring[ieee->mgmt_queue_tail];
@@ -185,16 +185,16 @@ static u8 MgntQuery_MgntFrameTxRate(struct 
ieee80211_device *ieee)
u8 rate;
 
/* 2008/01/25 MH For broadcom, MGNT frame set as OFDM 6M. */
-   if(pHTInfo->IOTAction & HT_IOT_ACT_MGNT_USE_CCK_6M)
+   if (pHTInfo->IOTAction & HT_IOT_ACT_MGNT_USE_CCK_6M)
rate = 0x0c;
else
rate = ieee->basic_rate & 0x7f;
 
if (rate == 0) {
/* 2005.01.26, by rcnjko. */
-   if(ieee->mode == IEEE_A ||
-  ieee->mode == IEEE_N_5G ||
-  (ieee->mode == IEEE_N_24G&&!pHTInfo->bCurSuppCCK))
+   if (ieee->mode == IEEE_A ||
+   ieee->mode == IEEE_N_5G ||
+   (ieee->mode == IEEE_N_24G&&!pHTInfo->bCurSuppCCK))
rate = 0x0c;
else
rate = 0x02;
@@ -235,8 +235,8 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct 
ieee80211_device *ieee
tcb_desc->bTxDisableRateFallBack = 1;
tcb_desc->bTxUseDriverAssingedRate = 1;
 
-   if(single){
-   if(ieee->queue_stop){
+   if (single){
+   if (ieee->queue_stop){
enqueue_mgmt(ieee, skb);
}else{
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0]<<4);
@@ -265,9 +265,9 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct 
ieee80211_device *ieee
ieee->seq_ctrl[0]++;
 
/* check whether the managed packet queued greater than 5 */
-   if(!ieee->check_nic_enough_desc(ieee->dev, 
tcb_desc->queue_index) ||\
-   
(skb_queue_len(&ieee->skb_waitQ[tcb_desc->queue_index]) != 0) ||\
-   (ieee->queue_stop) ) {
+   if (!ieee->check_nic_enough_desc(ieee->dev, 
tcb_desc->queue_index) ||\
+   (skb_queue_len(&ieee->skb_waitQ[tcb_desc->queue_index]) != 
0) || \
+   (ieee->queue_stop) ) {
/* insert the skb packet to the management queue */
/* as for the completion function, it does not need
 * to check it any more.
@@ -289,7 +289,7 @@ softmac_ps_mgmt_xmit(struct sk_buff *skb, struct 
ieee80211_device *ieee)
struct rtl_80211_hdr_3addr  *header =
(struct rtl_80211_hdr_3addr  *)skb->data;
 
-   if(single){
+   if (single){
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4);
 
if (ieee->seq_ctrl[0] == 0xFFF)
@@ -358,7 +358,7 @@ static void ieee80211_send_beacon(struct ieee80211_device 
*ieee)
 {
struct sk_buff *skb;
 
-   if(!ieee->ieee_up)
+   if (!ieee->ieee_up)
return;
//unsigned long flags;
skb = ieee80211_get_beacon_(ieee);
@@ -423,13 +423,13 @@ void ieee80211_softmac_scan_syncro(struct 
ieee80211_device *ieee)
memcpy(channel_map, GET_DOT11D_INFO(ieee)->channel_map, 
MAX_CHANNEL_NUMBER+1);
mutex_lock(&ieee->scan_mutex);
 
-   while(1)
+   while (1)
{
do{
ch++;
if (ch > MAX_CHANNEL_NUMBER)
goto out; /* scan completed */
-   }while(!channel_map[ch]);
+   }while (!channel_map[ch]);
 
/* this function can be called in two situations
 * 1- We have switched to ad-hoc mode and we are
@@ -453,7 +453,7 @@ void ieee80211_softmac_scan_syncro(struct ieee80211_device 
*ieee)
if (ieee->state == IEEE80211_LINKED)
goto out;
ieee->set_chan(ieee->dev, ch);
-   if(channel_map[ch] == 1)
+   if (ch

[PATCH 01/12] staging:rtl8192u: rename HT_CHANNEL_WIDTH -> enum ht_channel_width

2018-07-07 Thread John Whitmore
remove the typedef HT_CHANNEL_WIDTH and replace with 'enum ht_channel_width'

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/ieee80211.h| 4 ++--
 drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c | 4 ++--
 drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h   | 4 ++--
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c   | 6 +++---
 drivers/staging/rtl8192u/r8190_rtl8256.c  | 2 +-
 drivers/staging/rtl8192u/r8190_rtl8256.h  | 2 +-
 drivers/staging/rtl8192u/r8192U.h | 2 +-
 drivers/staging/rtl8192u/r819xU_phy.c | 2 +-
 drivers/staging/rtl8192u/r819xU_phy.h | 3 ++-
 9 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h 
b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
index 3addaa65085a..8ca24c10c28e 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
@@ -2002,7 +2002,7 @@ struct ieee80211_device {
short (*check_nic_enough_desc)(struct net_device *dev, int queue_index);
//added by wb for HT related
 // void (*SwChnlByTimerHandler)(struct net_device *dev, int channel);
-   void (*SetBWModeHandler)(struct net_device *dev, HT_CHANNEL_WIDTH 
Bandwidth, HT_EXTCHNL_OFFSET Offset);
+   void (*SetBWModeHandler)(struct net_device *dev, enum ht_channel_width 
Bandwidth, HT_EXTCHNL_OFFSET Offset);
 // void (*UpdateHalRATRTableHandler)(struct net_device* dev, u8* pMcsRate);
bool (*GetNmodeSupportBySecCfg)(struct net_device *dev);
void (*SetWirelessMode)(struct net_device *dev, u8 wireless_mode);
@@ -2358,7 +2358,7 @@ void HTDebugHTCapability(u8 *CapIE, u8 *TitleString);
 void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString);
 
 void HTSetConnectBwMode(struct ieee80211_device *ieee,
-   HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset);
+   enum ht_channel_width Bandwidth, HT_EXTCHNL_OFFSET 
Offset);
 void HTUpdateDefaultSetting(struct ieee80211_device *ieee);
 void HTConstructCapabilityElement(struct ieee80211_device *ieee, u8 *posHTCap,
  u8 *len, u8 isEncrypt);
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
index 21bd0dc40888..804d628ed9eb 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
@@ -303,7 +303,7 @@ void ieee80211_wx_sync_scan_wq(struct work_struct *work)
struct ieee80211_device *ieee = container_of(work, struct 
ieee80211_device, wx_sync_scan_wq);
short chan;
HT_EXTCHNL_OFFSET chan_offset = 0;
-   HT_CHANNEL_WIDTH bandwidth = 0;
+   enum ht_channel_width bandwidth = 0;
int b40M = 0;
 
chan = ieee->current_network.channel;
@@ -320,7 +320,7 @@ void ieee80211_wx_sync_scan_wq(struct work_struct *work)
if (ieee->pHTInfo->bCurrentHTSupport && ieee->pHTInfo->bEnableHT && 
ieee->pHTInfo->bCurBW40MHz) {
b40M = 1;
chan_offset = ieee->pHTInfo->CurSTAExtChnlOffset;
-   bandwidth = (HT_CHANNEL_WIDTH)ieee->pHTInfo->bCurBW40MHz;
+   bandwidth = (enum ht_channel_width)ieee->pHTInfo->bCurBW40MHz;
printk("Scan in 40M, force to 20M first:%d, %d\n", chan_offset, 
bandwidth);
ieee->SetBWModeHandler(ieee->dev, HT_CHANNEL_WIDTH_20, 
HT_EXTCHNL_OFFSET_NO_EXT);
}
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h
index 6abf32b142ef..c13ca7f0f4dd 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h
@@ -27,10 +27,10 @@
 //
 // Represent Channel Width in HT Capabilities
 //
-typedef enum _HT_CHANNEL_WIDTH {
+enum ht_channel_width {
HT_CHANNEL_WIDTH_20 = 0,
HT_CHANNEL_WIDTH_20_40 = 1,
-}HT_CHANNEL_WIDTH, *PHT_CHANNEL_WIDTH;
+};
 
 //
 // Represent Extension Channel Offset in HT Capabilities
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index abf55877331e..86c63b217d3b 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -894,7 +894,7 @@ static u8 HTFilterMCSRate(struct ieee80211_device *ieee, u8 
*pSupportMCS,
return true;
 }
 
-void HTSetConnectBwMode(struct ieee80211_device *ieee, HT_CHANNEL_WIDTH
Bandwidth, HT_EXTCHNL_OFFSETOffset);
+void HTSetConnectBwMode(struct ieee80211_device *ieee, enum ht_channel_width   
Bandwidth, HT_EXTCHNL_OFFSETOffset);
 void HTOnAssocRsp(struct ieee80211_device *ieee)
 {
PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
@@ -936,7 +936,7 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
 //  

Re: [PATCH] staging: rtl8188eu: replace while with shorter for loop

2018-07-07 Thread Greg KH
On Sat, Jul 07, 2018 at 01:22:50PM +0200, Michael Straube wrote:
> Simplify rtw_get_rateset_len() by replacing the while loop
> with a shorter for loop. Also replace tabs with spaces in
> the definition line.

Normally I will insist that this be two separate patches, as you are
doing two different things.  But it's a nice summer day out, I don't
like to argue...

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


Re: [PATCH 3/3] drivers/speakup: kobjects : Fixed Coding issues -Debugging

2018-07-07 Thread Greg KH
On Thu, Jul 05, 2018 at 02:12:20AM +, Tamir Suliman wrote:
> Updated printk() of i18n messages to include KERN_INFO facility level to 
> improve debuggin.
> then later noticed that I forgot to add a space on printk.
> 
> Signed-off-by: Tamir Suliman 
> ---
>  drivers/staging/speakup/kobjects.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/speakup/kobjects.c 
> b/drivers/staging/speakup/kobjects.c
> index 7e79f99..af664f0 100644
> --- a/drivers/staging/speakup/kobjects.c
> +++ b/drivers/staging/speakup/kobjects.c
> @@ -740,7 +740,7 @@ static void report_msg_status(int reset, int received, 
> int used,
>   snprintf(buf + (len - 1), sizeof(buf) - (len - 1),
>" with %d reject%s\n",
>rejected, rejected > 1 ? "s" : "");
> - printk(KERN_INFO "i18n messages rejected\n",buf);
> + printk(KERN_INFO "i18n messages rejected\n", buf);
>   }
>  }
>  
> -- 
> 1.8.3.1

Where are patches 1 and 2 of this series?

And the changelog text does not match what the text itself does, so I
can't take this as-is :(

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


Re: [PATCH] staging: speakup: fix wraparound in uaccess length check

2018-07-07 Thread Greg Kroah-Hartman
On Sat, Jul 07, 2018 at 10:29:26AM +0200, Samuel Thibault wrote:
> Re,
> 
> Could you review, test, and resubmit the patch below instead?
> 
> Samuel
> 
> 
> If softsynthx_read() is called with `count < 3`, `count - 3` wraps, causing
> the loop to copy as much data as available to the provided buffer. If
> softsynthx_read() is invoked through sys_splice(), this causes an
> unbounded kernel write; but even when userspace just reads from it
> normally, a small size could cause userspace crashes.
> 
> Fixes: 425e586cf95b ("speakup: add unicode variant of /dev/softsynth")
> Cc: sta...@vger.kernel.org
> Signed-off-by: Samuel Thibault 

You forgot a "reported-by:" line :(

also, I already applied Jann's patch, so could you either just send the
fixup, or a revert/add of this patch once you all agree on the proper
solution here?

thanks,

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


[PATCH] staging: rtl8723bs: remove rtw_beamforming.h

2018-07-07 Thread Michael Straube
The header rtw_beamforming.h is not used anywhere.
'git grep rtw_beamforming.h' returns nothing, remove the file.

Signed-off-by: Michael Straube 
---
 .../rtl8723bs/include/rtw_beamforming.h   | 127 --
 1 file changed, 127 deletions(-)
 delete mode 100644 drivers/staging/rtl8723bs/include/rtw_beamforming.h

diff --git a/drivers/staging/rtl8723bs/include/rtw_beamforming.h 
b/drivers/staging/rtl8723bs/include/rtw_beamforming.h
deleted file mode 100644
index 031496c8c02c..
--- a/drivers/staging/rtl8723bs/include/rtw_beamforming.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/**
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- 
**/
-#ifndef __RTW_BEAMFORMING_H_
-#define __RTW_BEAMFORMING_H_
-
-#define BEAMFORMING_ENTRY_NUM  2
-#define GET_BEAMFORM_INFO(_pmlmepriv)  ((struct beamforming_info 
*)(&(_pmlmepriv)->beamforming_info))
-
-typedef enum _BEAMFORMING_ENTRY_STATE
-{
-   BEAMFORMING_ENTRY_STATE_UNINITIALIZE,
-   BEAMFORMING_ENTRY_STATE_INITIALIZEING,
-   BEAMFORMING_ENTRY_STATE_INITIALIZED,
-   BEAMFORMING_ENTRY_STATE_PROGRESSING,
-   BEAMFORMING_ENTRY_STATE_PROGRESSED,
-}BEAMFORMING_ENTRY_STATE, *PBEAMFORMING_ENTRY_STATE;
-
-
-typedef enum _BEAMFORMING_STATE
-{
-   BEAMFORMING_STATE_IDLE,
-   BEAMFORMING_STATE_START,
-   BEAMFORMING_STATE_END,
-}BEAMFORMING_STATE, *PBEAMFORMING_STATE;
-
-
-typedef enum _BEAMFORMING_CAP
-{
-   BEAMFORMING_CAP_NONE = 0x0,
-   BEAMFORMER_CAP_HT_EXPLICIT = 0x1,
-   BEAMFORMEE_CAP_HT_EXPLICIT = 0x2,
-   BEAMFORMER_CAP_VHT_SU = 0x4,/*  Self has er Cap, 
because Reg er  & peer ee */
-   BEAMFORMEE_CAP_VHT_SU = 0x8,/*  Self has ee Cap, 
because Reg ee & peer er */
-   BEAMFORMER_CAP = 0x10,
-   BEAMFORMEE_CAP = 0x20,
-}BEAMFORMING_CAP, *PBEAMFORMING_CAP;
-
-
-typedef enum _SOUNDING_MODE
-{
-   SOUNDING_SW_VHT_TIMER = 0x0,
-   SOUNDING_SW_HT_TIMER = 0x1,
-   SOUNDING_STOP_All_TIMER = 0x2,
-   SOUNDING_HW_VHT_TIMER = 0x3,
-   SOUNDING_HW_HT_TIMER = 0x4,
-   SOUNDING_STOP_OID_TIMER = 0x5,
-   SOUNDING_AUTO_VHT_TIMER = 0x6,
-   SOUNDING_AUTO_HT_TIMER = 0x7,
-   SOUNDING_FW_VHT_TIMER = 0x8,
-   SOUNDING_FW_HT_TIMER = 0x9,
-}SOUNDING_MODE, *PSOUNDING_MODE;
-
-
-enum BEAMFORMING_CTRL_TYPE
-{
-   BEAMFORMING_CTRL_ENTER = 0,
-   BEAMFORMING_CTRL_LEAVE = 1,
-   BEAMFORMING_CTRL_START_PERIOD = 2,
-   BEAMFORMING_CTRL_END_PERIOD = 3,
-   BEAMFORMING_CTRL_SOUNDING_FAIL =4,
-   BEAMFORMING_CTRL_SOUNDING_CLK =5,
-};
-
-struct beamforming_entry {
-   boolbUsed;
-   boolbSound;
-   u16 aid;/*  Used to construct AID field of NDPA 
packet. */
-   u16 mac_id; /*  Used to Set Reg42C in IBSS mode. */
-   u16 p_aid;  /*  Used to fill Reg42C & Reg714 to compare 
with P_AID of Tx DESC. */
-   u8 mac_addr[6];/*  Used to fill Reg6E4 to fill Mac address of CSI 
report frame. */
-   enum CHANNEL_WIDTH  sound_bw;   /*  Sounding BandWidth */
-   u16 sound_period;
-   BEAMFORMING_CAP beamforming_entry_cap;
-   BEAMFORMING_ENTRY_STATE beamforming_entry_state;
-   u8 LogSeq;
-   u8 LogRetryCnt;
-   u8 LogSuccessCnt;
-   u8 LogStatusFailCnt;
-   u8 PreCsiReport[327];
-   u8 DefaultCsiCnt;
-   boolbDefaultCSI;
-};
-
-struct sounding_info {
-   u8  sound_idx;
-   enum CHANNEL_WIDTH  sound_bw;
-   SOUNDING_MODE   sound_mode;
-   u16 sound_period;
-};
-
-struct beamforming_info {
-   BEAMFORMING_CAP beamforming_cap;
-   BEAMFORMING_STATE   beamforming_state;
-   struct beamforming_entry
beamforming_entry[BEAMFORMING_ENTRY_NUM];
-   u8  beamforming_cur_idx;
-   u8  beamforming_in_progress;
-   u8  sounding_sequence;
-   struct sounding_infosounding_info;
-};
-
-struct rtw_ndpa_sta_info {
-   u16 aid:12;
-   u16 feedback_type:1;
-   u16 nc_index:3;
-};
-
-BEAMFORMING_CAP beamforming_get_entry_beam_cap_by_mac_id(void *pmlmepriv , u8 
mac_id);
-void beamforming_notify(struct adapter * adapter);
-BEAMFORMING_CAP beamforming_get_beamform_cap(struct beamforming_info 
*pBeamInfo);
-
-u32 beamforming_get_report_frame(struct adapter * Adapter, union recv_frame 
*precv_frame);
-
-bool   beamforming_send_ht_ndpa_packet(struct adapter * Adapter, u8 *ra, enum 
CHANNEL_WIDTH bw, u8 qidx);
-bool   beamforming_send_vht_ndpa_packet(struct adapter * Adapter, u8 *ra, u16 
aid, enum CHANNEL_WIDTH bw, u8 qidx);
-
-void beamforming_check_sounding_success(struct adapter * Adapter, bool status);

[PATCH] staging: rtl8723bs: remove rtw_br_ext.h

2018-07-07 Thread Michael Straube
The header rtw_br_ext.h is not used anywhere.
'git grep rtw_br_ext.h' returns nothing, remove the file.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8723bs/include/rtw_br_ext.h| 55 ---
 1 file changed, 55 deletions(-)
 delete mode 100644 drivers/staging/rtl8723bs/include/rtw_br_ext.h

diff --git a/drivers/staging/rtl8723bs/include/rtw_br_ext.h 
b/drivers/staging/rtl8723bs/include/rtw_br_ext.h
deleted file mode 100644
index 5eaeb3c9a97c..
--- a/drivers/staging/rtl8723bs/include/rtw_br_ext.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/**
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- 
**/
-#ifndef _RTW_BR_EXT_H_
-#define _RTW_BR_EXT_H_
-
-#define MACADDRLEN 6
-#define _DEBUG_ERR DBG_8192C
-#define _DEBUG_INFO/* DBG_8192C */
-#define DEBUG_WARN DBG_8192C
-#define DEBUG_INFO /* DBG_8192C */
-#define DEBUG_ERR  DBG_8192C
-/* define GET_MY_HWADDR
((GET_MIB(priv))->dot11OperationEntry.hwaddr) */
-#define GET_MY_HWADDR(padapter)
((padapter)->eeprompriv.mac_addr)
-
-#define NAT25_HASH_BITS4
-#define NAT25_HASH_SIZE(1 << NAT25_HASH_BITS)
-#define NAT25_AGEING_TIME  300
-
-#define MAX_NETWORK_ADDR_LEN   17
-
-struct nat25_network_db_entry
-{
-   struct nat25_network_db_entry   *next_hash;
-   struct nat25_network_db_entry   **pprev_hash;
-   atomic_tuse_count;
-   unsigned char   macAddr[6];
-   unsigned long   ageing_timer;
-   unsigned char   
networkAddr[MAX_NETWORK_ADDR_LEN];
-};
-
-enum NAT25_METHOD {
-   NAT25_MIN,
-   NAT25_CHECK,
-   NAT25_INSERT,
-   NAT25_LOOKUP,
-   NAT25_PARSE,
-   NAT25_MAX
-};
-
-struct br_ext_info {
-   unsigned intnat25_disable;
-   unsigned intmacclone_enable;
-   unsigned intdhcp_bcst_disable;
-   int addPPPoETag;/*  1: Add PPPoE relay-SID, 0: 
disable */
-   unsigned char nat25_dmzMac[MACADDRLEN];
-   unsigned intnat25sc_disable;
-};
-
-void nat25_db_cleanup(struct adapter *priv);
-
-#endif /*  _RTW_BR_EXT_H_ */
-- 
2.18.0

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


[PATCH] staging: rtl8188eu: replace while with shorter for loop

2018-07-07 Thread Michael Straube
Simplify rtw_get_rateset_len() by replacing the while loop
with a shorter for loop. Also replace tabs with spaces in
the definition line.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_ieee80211.c | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c 
b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
index e47927b9c3b8..711ebb0ad640 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
@@ -200,17 +200,13 @@ void rtw_set_supported_rate(u8 *SupportedRates, uint mode)
}
 }
 
-uint   rtw_get_rateset_len(u8  *rateset)
+uint rtw_get_rateset_len(u8 *rateset)
 {
-   uint i = 0;
+   uint i;
 
-   while (1) {
-   if ((rateset[i]) == 0)
-   break;
-   if (i > 12)
+   for (i = 0; i < 13; i++)
+   if (rateset[i] == 0)
break;
-   i++;
-   }
return i;
 }
 
-- 
2.18.0

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


Re: [PATCH v1 1/2] ARM: dts: tegra20: Add Memory Client reset to VDE

2018-07-07 Thread Dmitry Osipenko
On Sunday, 20 May 2018 16:48:44 MSK Dmitry Osipenko wrote:
> Hook up Memory Client reset of the Video Decoder to the decoders DT node.
> 
> Signed-off-by: Dmitry Osipenko 

Thierry, is there anything I could do in order to get these patches applied?


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


Re: [PATCH] staging: speakup: fix wraparound in uaccess length check

2018-07-07 Thread Samuel Thibault
Jann Horn, le sam. 07 juil. 2018 10:22:52 +0200, a ecrit:
> Or should I rewrite the
> patch to be simple and just bail out on `count < 3`?

Our mails have crossed :)

I believe what I sent is correct: for softsynth it does not make sense
to have room for less than 1 (non-unicode) or 3 (unicode) bytes.

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


Re: [PATCH] staging: speakup: fix wraparound in uaccess length check

2018-07-07 Thread Samuel Thibault
Re,

Could you review, test, and resubmit the patch below instead?

Samuel


If softsynthx_read() is called with `count < 3`, `count - 3` wraps, causing
the loop to copy as much data as available to the provided buffer. If
softsynthx_read() is invoked through sys_splice(), this causes an
unbounded kernel write; but even when userspace just reads from it
normally, a small size could cause userspace crashes.

Fixes: 425e586cf95b ("speakup: add unicode variant of /dev/softsynth")
Cc: sta...@vger.kernel.org
Signed-off-by: Samuel Thibault 

--- a/drivers/staging/speakup/speakup_soft.c
+++ b/drivers/staging/speakup/speakup_soft.c
@@ -198,11 +198,15 @@ static ssize_t softsynthx_read(struct fi
int chars_sent = 0;
char __user *cp;
char *init;
+   size_t bytes_per_ch = unicode ? 3 : 1;
u16 ch;
int empty;
unsigned long flags;
DEFINE_WAIT(wait);
 
+   if (count < bytes_per_ch)
+   return -EINVAL;
+
spin_lock_irqsave(&speakup_info.spinlock, flags);
while (1) {
prepare_to_wait(&speakup_event, &wait, TASK_INTERRUPTIBLE);
@@ -228,7 +232,7 @@ static ssize_t softsynthx_read(struct fi
init = get_initstring();
 
/* Keep 3 bytes available for a 16bit UTF-8-encoded character */
-   while (chars_sent <= count - 3) {
+   while (chars_sent <= count - bytes_per_ch) {
if (speakup_info.flushing) {
speakup_info.flushing = 0;
ch = '\x18';
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: speakup: fix wraparound in uaccess length check

2018-07-07 Thread Samuel Thibault
Jann Horn, le sam. 07 juil. 2018 03:53:44 +0200, a ecrit:
> @@ -257,6 +257,8 @@ static ssize_t softsynthx_read(struct file *fp, char 
> __user *buf, size_t count,
>   0x80 | (ch & 0x3f)
>   };
>  
> + if (chars_sent + 2 > count)
> + break;
>   if (copy_to_user(cp, s, sizeof(s)))
>   return -EFAULT;

Err, but then we have lost 'ch' that was consumed by the
synth_buffer_getc() call, so the fix seems wrong to me.

Nacked-by: Samuel Thibault 

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


Re: [PATCH] staging: speakup: fix wraparound in uaccess length check

2018-07-07 Thread Greg Kroah-Hartman
On Sat, Jul 07, 2018 at 03:53:44AM +0200, Jann Horn wrote:
> If softsynthx_read() is called with `count < 3`, `count - 3` wraps, causing
> the loop to copy as much data as available to the provided buffer. If
> softsynthx_read() is invoked through sys_splice(), this causes an
> unbounded kernel write; but even when userspace just reads from it
> normally, a small size could cause userspace crashes.
> 
> Fixes: 425e586cf95b ("speakup: add unicode variant of /dev/softsynth")
> Cc: sta...@vger.kernel.org
> Signed-off-by: Jann Horn 
> ---
> 
> Reproducer (kernel overflows userspace stack, resulting in segfault):

Nice find, thanks for the patch!

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


Re: [PATCH] drivers/staging/gasket: Use refcount_read()

2018-07-07 Thread Greg Kroah-Hartman
On Fri, Jul 06, 2018 at 11:43:10PM -0700, Todd Poynor wrote:
> From: Todd Poynor 
> 
> Use the refcount_read accessor function, avoid reaching into refcount
> and atomic struct fields.
> 
> Signed-off-by: Todd Poynor 
> ---
>  drivers/staging/gasket/gasket_sysfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/gasket/gasket_sysfs.c 
> b/drivers/staging/gasket/gasket_sysfs.c
> index d45098c90b4b..b5cdc180772a 100644
> --- a/drivers/staging/gasket/gasket_sysfs.c
> +++ b/drivers/staging/gasket/gasket_sysfs.c
> @@ -122,7 +122,7 @@ static void put_mapping(struct gasket_sysfs_mapping 
> *mapping)
>   }
>  
>   mutex_lock(&mapping->mutex);
> - if (mapping->refcount.refcount.refs.counter == 0)
> + if (refcount_read(&mapping->refcount.refcount) == 0)
>   gasket_nodev_error("Refcount is already 0!");
>   if (kref_put(&mapping->refcount, release_entry)) {
>   gasket_nodev_info("Removing Gasket sysfs mapping, device %s",

Thanks for the patch, but ugh, why in the world is this driver even
doing this type of thing?  Odds are all of these reference counting
checks can be removed, something else to add to the "todo" file...

thanks,

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


[PATCH 4/4] staging: mt7621-pci: Move open-braces to match kernel code style

2018-07-07 Thread Peter Vernia
Moves some open-braces to the end of the conditional statement to match the
kernel's coding style

Signed-off-by: Peter Vernia 
---
 drivers/staging/mt7621-pci/pci-mt7621.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c 
b/drivers/staging/mt7621-pci/pci-mt7621.c
index 3c7978e..c12447d 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -532,8 +532,7 @@ static int mt7621_pci_probe(struct platform_device *pdev)
*(unsigned int *)(0xbe000620) |= 0x1<<19 | 0x1<<8 | 0x1<<7; 
// set DATA
mdelay(1000);
 
-   if ((RALINK_PCI0_STATUS & 0x1) == 0)
-   {
+   if ((RALINK_PCI0_STATUS & 0x1) == 0) {
printk("PCIE0 no card, disable it(RST&CLK)\n");
ASSERT_SYSRST_PCIE(RALINK_PCIE0_RST);
rt_sysc_m32(RALINK_PCIE0_CLK_EN, 0, RALINK_CLKCFG1);
@@ -543,8 +542,7 @@ static int mt7621_pci_probe(struct platform_device *pdev)
RALINK_PCI_PCIMSK_ADDR |= (1<<20); // enable pcie1 interrupt
}
 
-   if ((RALINK_PCI1_STATUS & 0x1) == 0)
-   {
+   if ((RALINK_PCI1_STATUS & 0x1) == 0) {
printk("PCIE1 no card, disable it(RST&CLK)\n");
ASSERT_SYSRST_PCIE(RALINK_PCIE1_RST);
rt_sysc_m32(RALINK_PCIE1_CLK_EN, 0, RALINK_CLKCFG1);
-- 
2.7.4

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


[PATCH 3/4] staging: mt7621-pci: Add spaces after commas in pci-mt7621.c

2018-07-07 Thread Peter Vernia
Adds spaces after commas in parameter lists in pci-mt7621.c

Signed-off-by: Peter Vernia 
---
 drivers/staging/mt7621-pci/pci-mt7621.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c 
b/drivers/staging/mt7621-pci/pci-mt7621.c
index c7932ae..3c7978e 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -399,10 +399,10 @@ set_phy_for_ssc(void)
if (reg >= 6) {
printk("* Xtal 25MHz *\n");
set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 
0x4bc),  4, 2, 0x01); // RG_PE1_H_PLL_FBKSEL  //Feedback clock select
-   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 
0x49c),  0,31, 0x1800);   // RG_PE1_H_LCDDS_PCW_NCPO  //DDS NCPO 
PCW (for host mode)
-   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 
0x4a4),  0,16, 0x18d);// RG_PE1_H_LCDDS_SSC_PRD   //DDS SSC dither 
period control
-   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 
0x4a8),  0,12, 0x4a); // RG_PE1_H_LCDDS_SSC_DELTA //DDS SSC dither 
amplitude control
-   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 
0x4a8), 16,12, 0x4a); // RG_PE1_H_LCDDS_SSC_DELTA1//DDS SSC dither 
amplitude control for initial
+   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 
0x49c),  0, 31, 0x1800);  // RG_PE1_H_LCDDS_PCW_NCPO  //DDS NCPO 
PCW (for host mode)
+   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 
0x4a4),  0, 16, 0x18d);   // RG_PE1_H_LCDDS_SSC_PRD   //DDS SSC dither 
period control
+   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 
0x4a8),  0, 12, 0x4a);// RG_PE1_H_LCDDS_SSC_DELTA //DDS SSC dither 
amplitude control
+   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 
0x4a8), 16, 12, 0x4a);// RG_PE1_H_LCDDS_SSC_DELTA1//DDS SSC dither 
amplitude control for initial
} else {
printk("* Xtal 20MHz *\n");
}
@@ -436,10 +436,10 @@ set_phy_for_ssc(void)
set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x490),  6, 
2, 0x00);   // RG_PE1_H_PLL_PREDIV  //Pre-divider ratio (for host mode)
if (reg >= 6) { // 25MHz Xtal
set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 
0x4bc),  4, 2, 0x01);   // RG_PE1_H_PLL_FBKSEL  //Feedback clock select
-   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 
0x49c),  0,31, 0x1800); // RG_PE1_H_LCDDS_PCW_NCPO  //DDS NCPO PCW (for 
host mode)
-   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 
0x4a4),  0,16, 0x18d);  // RG_PE1_H_LCDDS_SSC_PRD   //DDS SSC dither 
period control
-   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 
0x4a8),  0,12, 0x4a);   // RG_PE1_H_LCDDS_SSC_DELTA //DDS SSC dither 
amplitude control
-   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 
0x4a8), 16,12, 0x4a);   // RG_PE1_H_LCDDS_SSC_DELTA1//DDS SSC dither 
amplitude control for initial
+   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 
0x49c),  0, 31, 0x1800);// RG_PE1_H_LCDDS_PCW_NCPO  //DDS NCPO 
PCW (for host mode)
+   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 
0x4a4),  0, 16, 0x18d); // RG_PE1_H_LCDDS_SSC_PRD   //DDS SSC dither 
period control
+   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 
0x4a8),  0, 12, 0x4a);  // RG_PE1_H_LCDDS_SSC_DELTA //DDS SSC dither 
amplitude control
+   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 
0x4a8), 16, 12, 0x4a);  // RG_PE1_H_LCDDS_SSC_DELTA1//DDS SSC dither 
amplitude control for initial
}
}
set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x4a0),  5, 1, 
0x01);   // RG_PE1_LCDDS_CLK_PH_INV  //DDS clock inversion
-- 
2.7.4

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


[PATCH 2/4] staging: mt7621-pci: Fix spacing around equals sign

2018-07-07 Thread Peter Vernia
Add spaces in front of the equals sign in assignment operations

Signed-off-by: Peter Vernia 
---
 drivers/staging/mt7621-pci/pci-mt7621.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c 
b/drivers/staging/mt7621-pci/pci-mt7621.c
index ded58ba..c7932ae 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -292,7 +292,7 @@ pci_config_write(struct pci_bus *bus, unsigned int devfn, 
int where, int size, u
}
 }
 
-struct pci_ops mt7621_pci_ops= {
+struct pci_ops mt7621_pci_ops = {
.read   = pci_config_read,
.write  = pci_config_write,
 };
@@ -480,8 +480,8 @@ static int mt7621_pci_probe(struct platform_device *pdev)
unsigned long val = 0;
 
iomem_resource.start = 0;
-   iomem_resource.end= ~0;
-   ioport_resource.start= 0;
+   iomem_resource.end = ~0;
+   ioport_resource.start = 0;
ioport_resource.end = ~0;
 
val = RALINK_PCIE0_RST;
-- 
2.7.4

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


[PATCH 1/4] staging: mt7621-pci: Fix spaces around parenthesis in pci-7621.c

2018-07-07 Thread Peter Vernia
Adds spaces before open parenthesis, and removes spaces after open parenthesis

Signed-off-by: Peter Vernia 
---
 drivers/staging/mt7621-pci/pci-mt7621.c | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c 
b/drivers/staging/mt7621-pci/pci-mt7621.c
index b373d76..ded58ba 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -139,14 +139,14 @@
rt_sysc_m32(0, val, RALINK_RSTCTRL);\
else\
rt_sysc_m32(val, 0, RALINK_RSTCTRL);\
-   } while(0)
+   } while (0)
 #define DEASSERT_SYSRST_PCIE(val)  \
do {\
if (rt_sysc_r32(SYSC_REG_CHIP_REV) == 0x00030101)   \
rt_sysc_m32(val, 0, RALINK_RSTCTRL);\
else\
rt_sysc_m32(0, val, RALINK_RSTCTRL);\
-   } while(0)
+   } while (0)
 #define RALINK_CLKCFG1 0x30
 #define RALINK_RSTCTRL 0x34
 #define RALINK_GPIOMODE0x60
@@ -195,7 +195,7 @@ static int config_access(unsigned char access_type, struct 
pci_bus *bus,
(func << 8) | (where & 0xfc) | 0x8000;
MV_WRITE(address_reg, address);
 
-   switch(access_type) {
+   switch (access_type) {
case PCI_ACCESS_WRITE_1:
MV_WRITE_8(data_reg+(where&0x3), *data);
break;
@@ -206,7 +206,7 @@ static int config_access(unsigned char access_type, struct 
pci_bus *bus,
MV_WRITE(data_reg, *data);
break;
case PCI_ACCESS_READ_1:
-   MV_READ_8( data_reg+(where&0x3), data);
+   MV_READ_8(data_reg+(where&0x3), data);
break;
case PCI_ACCESS_READ_2:
MV_READ_16(data_reg+(where&0x3), data);
@@ -391,7 +391,7 @@ set_phy_for_ssc(void)
set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x100),  4, 1, 
0x01); // rg_pe1_frc_phy_en//Force Port 1 enable control
set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x000),  5, 1, 
0x00); // rg_pe1_phy_en//Port 0 disable
set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x100),  5, 1, 
0x00); // rg_pe1_phy_en//Port 1 disable
-   if(reg <= 5 && reg >= 3) {  // 40MHz Xtal
+   if (reg <= 5 && reg >= 3) { // 40MHz Xtal
set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x490),  
6, 2, 0x01); // RG_PE1_H_PLL_PREDIV  //Pre-divider ratio (for host mode)
printk("* Xtal 40MHz *\n");
} else {// 25MHz | 20MHz Xtal
@@ -414,7 +414,7 @@ set_phy_for_ssc(void)
set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x490),  8, 4, 
0x01); // RG_PE1_H_PLL_IC
set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x4ac), 16, 3, 
0x00); // RG_PE1_H_PLL_BR
set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x490),  1, 3, 
0x02); // RG_PE1_PLL_DIVEN
-   if(reg <= 5 && reg >= 3) {  // 40MHz Xtal
+   if (reg <= 5 && reg >= 3) { // 40MHz Xtal
set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x414),  
6, 2, 0x01); // rg_pe1_mstckdiv  //value of da_pe1_mstckdiv 
when force mode enable
set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x414),  
5, 1, 0x01); // rg_pe1_frc_mstckdiv  //force mode enable of da_pe1_mstckdiv
}
@@ -430,7 +430,7 @@ set_phy_for_ssc(void)
set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x400),  9, 2, 
0x00);   // rg_pe1_h_xtal_type
set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x000),  4, 1, 
0x01);   // rg_pe1_frc_phy_en//Force Port 0 enable control
set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x000),  5, 1, 
0x00);   // rg_pe1_phy_en//Port 0 disable
-   if(reg <= 5 && reg >= 3) {  // 40MHz Xtal
+   if (reg <= 5 && reg >= 3) { // 40MHz Xtal
set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x490),  6, 
2, 0x01);   // RG_PE1_H_PLL_PREDIV  //Pre-divider ratio (for host mode)
} else {// 25MHz | 20MHz Xtal
set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x490),  6, 
2, 0x00);   // RG_PE1_H_PLL_PREDIV  //Pre-divider ratio (for host mode)
@@ -449,7 +449,7 @@ set_phy_for_ssc(void)
set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x490),  8, 4, 
0x01);   // RG_PE1_H_PLL_IC
set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x4ac), 16, 3, 
0x00);   // RG_PE1_H_PLL_BR
set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_C