Re: [PATCH 05/23] staging: wilc1000: rename goto to avoid leading '_' in label name

2018-07-19 Thread Ajay Singh
Hi Dan,

On Thu, 19 Jul 2018 12:27:44 +0300
Dan Carpenter  wrote:

> On Thu, Jul 19, 2018 at 04:15:01AM +0530, Ajay Singh wrote:
> > diff --git a/drivers/staging/wilc1000/wilc_wlan.c
> > b/drivers/staging/wilc1000/wilc_wlan.c index 85af365..8e71c28 100644
> > --- a/drivers/staging/wilc1000/wilc_wlan.c
> > +++ b/drivers/staging/wilc1000/wilc_wlan.c
> > @@ -850,13 +850,13 @@ static void wilc_wlan_handle_isr_ext(struct
> > wilc *wilc, u32 int_status) if (wilc->rx_buffer)
> > buffer = >rx_buffer[offset];
> > else
> > -   goto _end_;
> > +   goto end;  
> 
> This isn't related to your patch but this goto doesn't appear to make
> any sort of sense.  I have no idea what was intended.
> 

Thanks for pointing it out. I will include these changes in separate
patchset.

Yes, the position of goto label can be moved just before
wilc_wlan_handle_rxq(wilc), as 'ret' will always be '0' when goto
statement is executed.

Actually earlier there were few more goto statement in this function
and single label 'end' was used to handle for different cases. But in
previous cleanup patches those cases were removed.
Now this function can be further refactor by either moving
goto label before wilc_wlan_handle_rxq(wilc) or avoid goto use by
adding the rx_buffer validation along with size check.

i.e 

end:
wilc_wlan_handle_rxq(wilc)


OR

if (size > 0 && wilc->rx_buffer) {


}
wilc_wlan_handle_rxq(wilc)



> >  
> > wilc->hif_func->hif_clear_int_ext(wilc,
> >   DATA_INT_CLR |
> > ENABLE_RX_VMM); ret = wilc->hif_func->hif_block_rx_ext(wilc, 0,
> > buffer, size); 
> > -_end_:
> > +end:
> > if (ret) {
> > offset += size;
> > wilc->rx_buffer_offset = offset;  
> 
> regards,
> dan carpenter
> 
> ___
> devel mailing list
> de...@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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


[PATCH] Drivers: staging: rts5208: xd.c fixed a brace coding style issue

2018-07-19 Thread Ali Aminian
Fixing a coding style issue

Signed-off-by: Ali Aminian 
---
 drivers/staging/rts5208/xd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rts5208/xd.c b/drivers/staging/rts5208/xd.c
index 667dfe1..261d868 100644
--- a/drivers/staging/rts5208/xd.c
+++ b/drivers/staging/rts5208/xd.c
@@ -787,9 +787,8 @@ static int reset_xd(struct rtsx_chip *chip)
}
 
dev_dbg(rtsx_dev(chip), "CIS block: 0x%x\n", xd_card->cis_block);
-   if (xd_card->cis_block == 0x) {
+   if (xd_card->cis_block == 0x)
return STATUS_FAIL;
-   }
 
chip->capacity[chip->card2lun[XD_CARD]] = xd_card->capacity;
 
-- 
2.7.4

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


RE: [PATCH V3 0/4] KVM/x86/hyper-V: Introduce PV guest address space mapping flush support

2018-07-19 Thread KY Srinivasan



> -Original Message-
> From: Tianyu Lan
> Sent: Thursday, July 19, 2018 1:40 AM
> Cc: Tianyu Lan ; de...@linuxdriverproject.org;
> Haiyang Zhang ; h...@zytor.com;
> k...@vger.kernel.org; KY Srinivasan ; linux-
> ker...@vger.kernel.org; mi...@redhat.com; pbonz...@redhat.com;
> rkrc...@redhat.com; Stephen Hemminger ;
> t...@linutronix.de; x...@kernel.org; Michael Kelley (EOSG)
> ; vkuzn...@redhat.com
> Subject: [PATCH V3 0/4] KVM/x86/hyper-V: Introduce PV guest address
> space mapping flush support
> 
> Hyper-V provides a para-virtualization hypercall
> HvFlushGuestPhysicalAddressSpace
> to flush nested VM address space mapping in l1 hypervisor and it's to reduce
> overhead
> of flushing ept tlb among vcpus. The tradition way is to send IPIs to all
> affected
> vcpus and executes INVEPT on each vcpus. It will trigger several vmexits for
> IPI and
> INVEPT emulation. The pv hypercall can help to flush specified ept table on 
> all
> vcpus
> via one single hypercall.
> 
> Change since v2:
>- Make ept_pointers_match as tristate "check", "match" and "mismatch".
>Set "check" in vmx_set_cr3(), check all ept table pointers in
> hv_remote_flush_tlb()
>and call hypercall when all ept pointers are same.
>- Rename kvm_arch_hv_flush_remote_tlb with
> kvm_arch_flush_remote_tlb and
>Rename kvm_x86_ops->hv_tlb_remote_flush with kvm_x86_ops-
> >tlb_remote_flush
>- Fix issue that ignore updating tlbs_dirty during calling
> kvm_arch_flush_remote_tlbs()
>- Merge patch "KVM/VMX: Add identical ept table pointer check" and
>patch "KVM/x86: Add tlb_remote_flush callback support for vmx"
> 
> Change since v1:
>- Fix compilation error for non-x86 platform.
>- Use ept_pointers_match to check condition of identical ept
> table pointer and get ept pointer from struct 
> vcpu_vmx->ept_pointer.
>- Add hyperv_nested_flush_guest_mapping ftrace support
> 
> 
> 
> Lan Tianyu (4):
>   X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall
> support
>   X86/Hyper-V: Add hyperv_nested_flush_guest_mapping ftrace support
>   KVM: Add tlb remote flush callback in kvm_x86_ops.
>   KVM/x86: Add tlb_remote_flush callback support for vmx
> 
>  arch/x86/hyperv/Makefile|  2 +-
>  arch/x86/hyperv/nested.c| 67
> ++
>  arch/x86/include/asm/hyperv-tlfs.h  |  8 +
>  arch/x86/include/asm/kvm_host.h | 11 ++
>  arch/x86/include/asm/mshyperv.h |  2 ++
>  arch/x86/include/asm/trace/hyperv.h | 14 
>  arch/x86/kvm/vmx.c  | 72
> -
>  include/linux/kvm_host.h|  7 
>  virt/kvm/kvm_main.c |  3 +-
>  9 files changed, 183 insertions(+), 3 deletions(-)
>  create mode 100644 arch/x86/hyperv/nested.c

Acked-by: K. Y. Srinivasan 

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


[PATCH 00/20 v4] staging: gasket: sundry fixes and fixups

2018-07-19 Thread Todd Poynor
From: Todd Poynor 

Various fixes mainly from the chromium review of the gasket and apex
drivers.  More to come.

Todd Poynor (20):
  staging: gasket: allow compile for ARM64 in Kconfig
  staging: gasket: gasket_enable_dev remove unnecessary variable
  staging: gasket: remove code for no physical device
  staging: gasket: fix class create bug handling
  staging: gasket: remove unnecessary code in coherent allocator
  staging: gasket: don't treat no device reset callback as an error
  staging: gasket: gasket_mmap return error instead of valid BAR index
  staging: gasket: apex_clock_gating simplify logic, reduce indentation
  staging: gasket: gasket page table functions use bool return type
  staging: gasket: remove else clause after return in if clause
  staging: gasket: fix comment syntax in apex.h
  staging: gasket: remove unnecessary parens in page table code
  staging: gasket: gasket_mmap use PAGE_MASK
  staging: gasket: remove extra parens in gasket_write_mappable_regions
  staging: gasket: fix multi-line comment syntax in gasket_core.h
  staging: gasket: always allow root open for write
  staging: gasket: top ioctl handler add __user annotations
  staging: gasket: apex ioctl add __user annotations
  staging: gasket: common ioctl dispatcher add __user annotations
  staging: gasket: common ioctls add __user annotations

Patches changed from v3 in v4:
  staging: gasket: remove X86 Kconfig restriction
 Rename: staging: gasket: allow compile for ARM64 in Kconfig
 Restore existing "depends on" for X86_64, add ARM64.  Only compile for
 64-bit architectures known to work with this driver.
  staging: gasket: always allow root open for write
 Fold in patch to convert apex_ioctl_check_permissions to return bool
 Convert gasket_ioctl_check_permissions to use bool types.
  staging: gasket: apex_ioctl_check_permissions use bool return type
 Folded into above patch.
  staging: gasket: annotate ioctl arg with __user
 Split up into new patches:
staging: gasket: top ioctl handler add __user annotations
staging: gasket: apex ioctl add __user annotations
staging: gasket: common ioctl dispatcher add __user annotations
staging: gasket: common ioctls add __user annotations
 Convert various uses of void * to actual type.
 Minor formatting and naming changes.
 Drop Reviewed-By: Dmitry Torokhov due to changes since review.

Patches unchanged from v3 in v4:
  staging: gasket: gasket_enable_dev remove unnecessary variable
  staging: gasket: remove code for no physical device
  staging: gasket: fix class create bug handling
  staging: gasket: remove unnecessary code in coherent allocator
  staging: gasket: don't treat no device reset callback as an error
  staging: gasket: gasket_mmap return error instead of valid BAR index
  staging: gasket: apex_clock_gating simplify logic, reduce indentation
  staging: gasket: gasket page table functions use bool return type
  staging: gasket: remove else clause after return in if clause
  staging: gasket: fix comment syntax in apex.h
  staging: gasket: remove unnecessary parens in page table code
  staging: gasket: gasket_mmap use PAGE_MASK
  staging: gasket: remove extra parens in gasket_write_mappable_regions
  staging: gasket: fix multi-line comment syntax in gasket_core.h

Patches removed from v3 in v4 (already merged to staging-next):
  staging: gasket: fix typo in apex_enter_reset
  staging: gasket: fix typo in gasket_core.h comments
  staging: gasket: whitespace fix in gasket_page_table_init
  staging: gasket: remove driver registration on class creation failure
  staging: gasket: hold mutex on gasket driver unregistration
  staging: gasket: Return EBUSY on mapping create when already in use
  staging: gasket: Remove stale pointers on error allocating attr array
  staging: gasket: convert gasket_mmap_has_permissions to bool return
  staging: gasket: fix gasket_wait_with_reschedule timeout return code
  staging: gasket: gasket_wait_with_reschedule use msleep
  staging: gasket: gasket_wait_with_reschedule simplify logic
  staging: gasket: gasket_wait_with_reschedule use 32 bits of retry
  staging: gasket: bail out of reset sequence on device callback error
  staging: gasket: drop gasket_cdev_get_info, use container_of

 drivers/staging/gasket/Kconfig |   2 +-
 drivers/staging/gasket/apex.h  |   7 +-
 drivers/staging/gasket/apex_driver.c   |  73 +--
 drivers/staging/gasket/gasket_core.c   |  44 +++
 drivers/staging/gasket/gasket_core.h   |  10 +-
 drivers/staging/gasket/gasket_ioctl.c  | 144 +++--
 drivers/staging/gasket/gasket_ioctl.h  |   4 +-
 drivers/staging/gasket/gasket_page_table.c |  64 +
 drivers/staging/gasket/gasket_page_table.h |   8 +-
 9 files changed, 174 insertions(+), 182 deletions(-)

-- 
2.18.0.233.g985f88cf7e-goog

___
devel mailing list
de...@linuxdriverproject.org

[PATCH 1/1] x86/hyper-v: Fix a merge error

2018-07-19 Thread kys
From: "K. Y. Srinivasan" 

When the mapping betwween the Linux notion of CPU ID
to the hypervisor's notion of CPU ID is not initialized,
we should fall back on the non-enligghtened path for IPI.
A merge error introduced this bug; fix it.

Fixes: 1268ed0c474a ("Merge branch 'x86/urgent' into x86/hyperv")

Reported-by: Michael Kelley 
Signed-off-by: K. Y. Srinivasan 
---
 arch/x86/hyperv/hv_apic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/hyperv/hv_apic.c b/arch/x86/hyperv/hv_apic.c
index 0c3c9f8fee77..5b0f613428c2 100644
--- a/arch/x86/hyperv/hv_apic.c
+++ b/arch/x86/hyperv/hv_apic.c
@@ -168,7 +168,7 @@ static bool __send_ipi_mask(const struct cpumask *mask, int 
vector)
for_each_cpu(cur_cpu, mask) {
vcpu = hv_cpu_number_to_vp_number(cur_cpu);
if (vcpu == VP_INVAL)
-   return true;
+   return false;
 
/*
 * This particular version of the IPI hypercall can
-- 
2.17.1

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


[PATCH 09/20] staging: gasket: gasket page table functions use bool return type

2018-07-19 Thread Todd Poynor
From: Todd Poynor 

Convert from int to bool return type for gasket page table functions
that return values used as booleans.

Reported-by: Guenter Roeck 
Signed-off-by: Simon Que 
Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/gasket_page_table.c | 58 +++---
 drivers/staging/gasket/gasket_page_table.h |  8 +--
 2 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/gasket/gasket_page_table.c 
b/drivers/staging/gasket/gasket_page_table.c
index 36a560c87af36..2a27db658a4e4 100644
--- a/drivers/staging/gasket/gasket_page_table.c
+++ b/drivers/staging/gasket/gasket_page_table.c
@@ -262,16 +262,16 @@ static void gasket_perform_unmapping(
 static void gasket_free_extended_subtable(
struct gasket_page_table *pg_tbl, struct gasket_page_table_entry *pte,
u64 __iomem *att_reg);
-static int gasket_release_page(struct page *page);
+static bool gasket_release_page(struct page *page);
 
 /* Other/utility declarations */
-static inline int gasket_addr_is_simple(
+static inline bool gasket_addr_is_simple(
struct gasket_page_table *pg_tbl, ulong addr);
-static int gasket_is_simple_dev_addr_bad(
+static bool gasket_is_simple_dev_addr_bad(
struct gasket_page_table *pg_tbl, ulong dev_addr, uint num_pages);
-static int gasket_is_extended_dev_addr_bad(
+static bool gasket_is_extended_dev_addr_bad(
struct gasket_page_table *pg_tbl, ulong dev_addr, uint num_pages);
-static int gasket_is_pte_range_free(
+static bool gasket_is_pte_range_free(
struct gasket_page_table_entry *pte, uint num_entries);
 static void gasket_page_table_garbage_collect_nolock(
struct gasket_page_table *pg_tbl);
@@ -558,7 +558,7 @@ int gasket_page_table_lookup_page(
 }
 
 /* See gasket_page_table.h for description. */
-int gasket_page_table_are_addrs_bad(
+bool gasket_page_table_are_addrs_bad(
struct gasket_page_table *pg_tbl, ulong host_addr, ulong dev_addr,
ulong bytes)
 {
@@ -567,7 +567,7 @@ int gasket_page_table_are_addrs_bad(
pg_tbl,
"host mapping address 0x%lx must be page aligned",
host_addr);
-   return 1;
+   return true;
}
 
return gasket_page_table_is_dev_addr_bad(pg_tbl, dev_addr, bytes);
@@ -575,7 +575,7 @@ int gasket_page_table_are_addrs_bad(
 EXPORT_SYMBOL(gasket_page_table_are_addrs_bad);
 
 /* See gasket_page_table.h for description. */
-int gasket_page_table_is_dev_addr_bad(
+bool gasket_page_table_is_dev_addr_bad(
struct gasket_page_table *pg_tbl, ulong dev_addr, ulong bytes)
 {
uint num_pages = bytes / PAGE_SIZE;
@@ -584,7 +584,7 @@ int gasket_page_table_is_dev_addr_bad(
gasket_pg_tbl_error(
pg_tbl,
"mapping size 0x%lX must be page aligned", bytes);
-   return 1;
+   return true;
}
 
if (num_pages == 0) {
@@ -592,7 +592,7 @@ int gasket_page_table_is_dev_addr_bad(
pg_tbl,
"requested mapping is less than one page: %lu / %lu",
bytes, PAGE_SIZE);
-   return 1;
+   return true;
}
 
if (gasket_addr_is_simple(pg_tbl, dev_addr))
@@ -1285,23 +1285,23 @@ static void gasket_free_extended_subtable(
 /*
  * Safely return a page to the OS.
  * @page: The page to return to the OS.
- * Returns 1 if the page was released, 0 if it was
+ * Returns true if the page was released, false if it was
  * ignored.
  */
-static int gasket_release_page(struct page *page)
+static bool gasket_release_page(struct page *page)
 {
if (!page)
-   return 0;
+   return false;
 
if (!PageReserved(page))
SetPageDirty(page);
put_page(page);
 
-   return 1;
+   return true;
 }
 
 /* Evaluates to nonzero if the specified virtual address is simple. */
-static inline int gasket_addr_is_simple(
+static inline bool gasket_addr_is_simple(
struct gasket_page_table *pg_tbl, ulong addr)
 {
return !((addr) & (pg_tbl)->extended_flag);
@@ -1317,7 +1317,7 @@ static inline int gasket_addr_is_simple(
  * address to/from page + offset) and that the requested page range starts and
  * ends within the set of currently-partitioned simple pages.
  */
-static int gasket_is_simple_dev_addr_bad(
+static bool gasket_is_simple_dev_addr_bad(
struct gasket_page_table *pg_tbl, ulong dev_addr, uint num_pages)
 {
ulong page_offset = dev_addr & (PAGE_SIZE - 1);
@@ -1328,7 +1328,7 @@ static int gasket_is_simple_dev_addr_bad(
pg_tbl, 1, page_index, page_offset) != dev_addr) {
gasket_pg_tbl_error(
pg_tbl, "address is invalid, 0x%lX", dev_addr);
-   return 1;
+   return true;
}
 
if (page_index >= pg_tbl->num_simple_entries) {
@@ -1336,7 +1336,7 @@ static 

[PATCH 12/20] staging: gasket: remove unnecessary parens in page table code

2018-07-19 Thread Todd Poynor
From: Todd Poynor 

gasket_alloc_coherent_memory() extra parentheses in statement.

Reported-by: Guenter Roeck 
Signed-off-by: Simon Que 
Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/gasket_page_table.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/gasket/gasket_page_table.c 
b/drivers/staging/gasket/gasket_page_table.c
index 617d602b8b447..9f8116112e0ac 100644
--- a/drivers/staging/gasket/gasket_page_table.c
+++ b/drivers/staging/gasket/gasket_page_table.c
@@ -1639,7 +1639,7 @@ int gasket_alloc_coherent_memory(struct gasket_dev 
*gasket_dev, u64 size,
dma_addr_t handle;
void *mem;
int j;
-   unsigned int num_pages = (size + PAGE_SIZE - 1) / (PAGE_SIZE);
+   unsigned int num_pages = (size + PAGE_SIZE - 1) / PAGE_SIZE;
const struct gasket_driver_desc *driver_desc =
gasket_get_driver_desc(gasket_dev);
 
-- 
2.18.0.233.g985f88cf7e-goog

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


[PATCH 11/20] staging: gasket: fix comment syntax in apex.h

2018-07-19 Thread Todd Poynor
From: Todd Poynor 

Use kernel-style multi-line comment syntax.

Reported-by: Guenter Roeck 
Signed-off-by: Simon Que 
Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/apex.h | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/gasket/apex.h b/drivers/staging/gasket/apex.h
index 4ef264106f503..d89cc2387b7d4 100644
--- a/drivers/staging/gasket/apex.h
+++ b/drivers/staging/gasket/apex.h
@@ -22,9 +22,10 @@
 
 #define APEX_EXTENDED_SHIFT 63 /* Extended address bit position. */
 
-/* Addresses are 2^3=8 bytes each. */
-/* page in second level page table */
-/* holds APEX_PAGE_SIZE/8 addresses  */
+/*
+ * Addresses are 2^3=8 bytes each. Page in second level page table holds
+ * APEX_PAGE_SIZE/8 addresses.
+ */
 #define APEX_ADDR_SHIFT 3
 #define APEX_LEVEL_SHIFT (APEX_PAGE_SHIFT - APEX_ADDR_SHIFT)
 #define APEX_LEVEL_SIZE BIT(APEX_LEVEL_SHIFT)
-- 
2.18.0.233.g985f88cf7e-goog

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


[PATCH 13/20] staging: gasket: gasket_mmap use PAGE_MASK

2018-07-19 Thread Todd Poynor
From: Todd Poynor 

gasket_mmap use PAGE_MASK, instead of performing math on PAGE_SIZE, for
simplicity and clarity.

Reported-by: Guenter Roeck 
Signed-off-by: Simon Que 
Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/gasket_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/gasket/gasket_core.c 
b/drivers/staging/gasket/gasket_core.c
index 3cf918f9d2604..ae5febec8844c 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -1591,7 +1591,7 @@ static int gasket_mmap(struct file *filp, struct 
vm_area_struct *vma)
}
driver_desc = gasket_dev->internal_desc->driver_desc;
 
-   if (vma->vm_start & (PAGE_SIZE - 1)) {
+   if (vma->vm_start & ~PAGE_MASK) {
gasket_log_error(
gasket_dev, "Base address not page-aligned: 0x%p\n",
(void *)vma->vm_start);
-- 
2.18.0.233.g985f88cf7e-goog

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


[PATCH 16/20] staging: gasket: always allow root open for write

2018-07-19 Thread Todd Poynor
From: Todd Poynor 

Always allow root to open device for writing.

Drop special-casing of ioctl permissions for root vs. owner.

Convert to bool types as appropriate.

Reported-by: Dmitry Torokhov 
Signed-off-by: Zhongze Hu 
Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/apex_driver.c  | 15 --
 drivers/staging/gasket/gasket_core.c  |  8 ---
 drivers/staging/gasket/gasket_ioctl.c | 30 +--
 3 files changed, 23 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/gasket/apex_driver.c 
b/drivers/staging/gasket/apex_driver.c
index a01b1f2b827ea..4c00f3609f081 100644
--- a/drivers/staging/gasket/apex_driver.c
+++ b/drivers/staging/gasket/apex_driver.c
@@ -140,7 +140,7 @@ static int apex_reset(struct gasket_dev *gasket_dev, uint 
type);
 
 static int apex_get_status(struct gasket_dev *gasket_dev);
 
-static uint apex_ioctl_check_permissions(struct file *file, uint cmd);
+static bool apex_ioctl_check_permissions(struct file *file, uint cmd);
 
 static long apex_ioctl(struct file *file, uint cmd, ulong arg);
 
@@ -625,18 +625,11 @@ static bool is_gcb_in_reset(struct gasket_dev *gasket_dev)
  * @file: File pointer from ioctl.
  * @cmd: ioctl command.
  *
- * Returns 1 if the current user may execute this ioctl, and 0 otherwise.
+ * Returns true if the current user may execute this ioctl, and false 
otherwise.
  */
-static uint apex_ioctl_check_permissions(struct file *filp, uint cmd)
+static bool apex_ioctl_check_permissions(struct file *filp, uint cmd)
 {
-   struct gasket_dev *gasket_dev = filp->private_data;
-   int root = capable(CAP_SYS_ADMIN);
-   int is_owner = gasket_dev->dev_info.ownership.is_owned &&
-  current->tgid == gasket_dev->dev_info.ownership.owner;
-
-   if (root || is_owner)
-   return 1;
-   return 0;
+   return !!(filp->f_mode & FMODE_WRITE);
 }
 
 /*
diff --git a/drivers/staging/gasket/gasket_core.c 
b/drivers/staging/gasket/gasket_core.c
index ba48a379b0ada..254fb392c05c1 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -1072,6 +1072,7 @@ static int gasket_open(struct inode *inode, struct file 
*filp)
char task_name[TASK_COMM_LEN];
struct gasket_cdev_info *dev_info =
container_of(inode->i_cdev, struct gasket_cdev_info, cdev);
+   int is_root = capable(CAP_SYS_ADMIN);
 
gasket_dev = dev_info->gasket_dev_ptr;
driver_desc = gasket_dev->internal_desc->driver_desc;
@@ -1085,7 +1086,7 @@ static int gasket_open(struct inode *inode, struct file 
*filp)
"Attempting to open with tgid %u (%s) (f_mode: 0%03o, "
"fmode_write: %d is_root: %u)",
current->tgid, task_name, filp->f_mode,
-   (filp->f_mode & FMODE_WRITE), capable(CAP_SYS_ADMIN));
+   (filp->f_mode & FMODE_WRITE), is_root);
 
/* Always allow non-writing accesses. */
if (!(filp->f_mode & FMODE_WRITE)) {
@@ -1099,8 +1100,9 @@ static int gasket_open(struct inode *inode, struct file 
*filp)
gasket_dev, "Current owner open count (owning tgid %u): %d.",
ownership->owner, ownership->write_open_count);
 
-   /* Opening a node owned by another TGID is an error (even root.) */
-   if (ownership->is_owned && ownership->owner != current->tgid) {
+   /* Opening a node owned by another TGID is an error (unless root) */
+   if (ownership->is_owned && ownership->owner != current->tgid &&
+   !is_root) {
gasket_log_error(
gasket_dev,
"Process %u is opening a node held by %u.",
diff --git a/drivers/staging/gasket/gasket_ioctl.c 
b/drivers/staging/gasket/gasket_ioctl.c
index d0142ed048a65..8fd44979fe713 100644
--- a/drivers/staging/gasket/gasket_ioctl.c
+++ b/drivers/staging/gasket/gasket_ioctl.c
@@ -22,7 +22,7 @@
 #define trace_gasket_ioctl_config_coherent_allocator(x, ...)
 #endif
 
-static uint gasket_ioctl_check_permissions(struct file *filp, uint cmd);
+static bool gasket_ioctl_check_permissions(struct file *filp, uint cmd);
 static int gasket_set_event_fd(struct gasket_dev *dev, ulong arg);
 static int gasket_read_page_table_size(
struct gasket_dev *gasket_dev, ulong arg);
@@ -167,12 +167,13 @@ long gasket_is_supported_ioctl(uint cmd)
  * @filp: File structure pointer describing this node usage session.
  * @cmd: ioctl number to handle.
  *
- * Standard permissions checker.
+ * Check permissions for Gasket ioctls.
+ * Returns true if the file opener may execute this ioctl, or false otherwise.
  */
-static uint gasket_ioctl_check_permissions(struct file *filp, uint cmd)
+static bool gasket_ioctl_check_permissions(struct file *filp, uint cmd)
 {
-   uint alive, root, device_owner;
-   fmode_t read, write;
+   bool alive;
+   bool read, write;
struct gasket_dev *gasket_dev = (struct gasket_dev *)filp->private_data;
 

[PATCH 18/20] staging: gasket: apex ioctl add __user annotations

2018-07-19 Thread Todd Poynor
From: Todd Poynor 

Add __user annotation to ioctl pointer argument, for sparse checking.

Reported-by: Dmitry Torokhov 
Signed-off-by: Zhongze Hu 
Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/apex_driver.c | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/gasket/apex_driver.c 
b/drivers/staging/gasket/apex_driver.c
index 4c00f3609f081..3e76c4db5db2e 100644
--- a/drivers/staging/gasket/apex_driver.c
+++ b/drivers/staging/gasket/apex_driver.c
@@ -5,6 +5,7 @@
  * Copyright (C) 2018 Google, Inc.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -142,9 +143,10 @@ static int apex_get_status(struct gasket_dev *gasket_dev);
 
 static bool apex_ioctl_check_permissions(struct file *file, uint cmd);
 
-static long apex_ioctl(struct file *file, uint cmd, ulong arg);
+static long apex_ioctl(struct file *file, uint cmd, void __user *argp);
 
-static long apex_clock_gating(struct gasket_dev *gasket_dev, ulong arg);
+static long apex_clock_gating(struct gasket_dev *gasket_dev,
+ struct apex_gate_clock_ioctl __user *argp);
 
 static int apex_enter_reset(struct gasket_dev *gasket_dev, uint type);
 
@@ -635,7 +637,7 @@ static bool apex_ioctl_check_permissions(struct file *filp, 
uint cmd)
 /*
  * Apex-specific ioctl handler.
  */
-static long apex_ioctl(struct file *filp, uint cmd, ulong arg)
+static long apex_ioctl(struct file *filp, uint cmd, void __user *argp)
 {
struct gasket_dev *gasket_dev = filp->private_data;
 
@@ -644,7 +646,7 @@ static long apex_ioctl(struct file *filp, uint cmd, ulong 
arg)
 
switch (cmd) {
case APEX_IOCTL_GATE_CLOCK:
-   return apex_clock_gating(gasket_dev, arg);
+   return apex_clock_gating(gasket_dev, argp);
default:
return -ENOTTY; /* unknown command */
}
@@ -653,16 +655,17 @@ static long apex_ioctl(struct file *filp, uint cmd, ulong 
arg)
 /*
  * Gates or un-gates Apex clock.
  * @gasket_dev: Gasket device pointer.
- * @arg: User ioctl arg, in this case to a apex_gate_clock_ioctl struct.
+ * @argp: User ioctl arg, pointer to a apex_gate_clock_ioctl struct.
  */
-static long apex_clock_gating(struct gasket_dev *gasket_dev, ulong arg)
+static long apex_clock_gating(struct gasket_dev *gasket_dev,
+ struct apex_gate_clock_ioctl __user *argp)
 {
struct apex_gate_clock_ioctl ibuf;
 
if (bypass_top_level || !allow_sw_clock_gating)
return 0;
 
-   if (copy_from_user(, (void __user *)arg, sizeof(ibuf)))
+   if (copy_from_user(, argp, sizeof(ibuf)))
return -EFAULT;
 
gasket_log_error(gasket_dev, "%s %llu", __func__, ibuf.enable);
-- 
2.18.0.233.g985f88cf7e-goog

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


[PATCH 03/20] staging: gasket: remove code for no physical device

2018-07-19 Thread Todd Poynor
From: Todd Poynor 

gasket_enable_dev code for enabling a gasket device with no physical PCI
device registered shouldn't be necessary.

Reported-by: Greg Kroah-Hartman 
Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/gasket_core.c | 12 +---
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/gasket/gasket_core.c 
b/drivers/staging/gasket/gasket_core.c
index f327c9d7f90a3..18cc8e3283b39 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -898,7 +898,6 @@ static int gasket_enable_dev(
 {
int tbl_idx;
int ret;
-   struct device *ddev;
const struct gasket_driver_desc *driver_desc =
internal_desc->driver_desc;
 
@@ -919,21 +918,12 @@ static int gasket_enable_dev(
for (tbl_idx = 0; tbl_idx < driver_desc->num_page_tables; tbl_idx++) {
gasket_log_debug(
gasket_dev, "Initializing page table %d.", tbl_idx);
-   if (gasket_dev->pci_dev) {
-   ddev = _dev->pci_dev->dev;
-   } else {
-   gasket_log_error(
-   gasket_dev,
-   "%s with no physical device!!", __func__);
-   WARN_ON(1);
-   ddev = NULL;
-   }
ret = gasket_page_table_init(
_dev->page_table[tbl_idx],
_dev->bar_data[
driver_desc->page_table_bar_index],
_desc->page_table_configs[tbl_idx],
-   ddev, gasket_dev->pci_dev, true);
+   _dev->pci_dev->dev, gasket_dev->pci_dev, true);
if (ret) {
gasket_log_error(
gasket_dev,
-- 
2.18.0.233.g985f88cf7e-goog

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


[PATCH 06/20] staging: gasket: don't treat no device reset callback as an error

2018-07-19 Thread Todd Poynor
From: Todd Poynor 

It is not an error for a device to not have a reset callback registered.

Signed-off-by: Simon Que 
Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/gasket_core.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/gasket/gasket_core.c 
b/drivers/staging/gasket/gasket_core.c
index 53236e1ba4e48..eb5ad161ccda2 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -1836,11 +1836,8 @@ int gasket_reset_nolock(struct gasket_dev *gasket_dev, 
uint reset_type)
const struct gasket_driver_desc *driver_desc;
 
driver_desc = gasket_dev->internal_desc->driver_desc;
-   if (!driver_desc->device_reset_cb) {
-   gasket_log_error(
-   gasket_dev, "No device reset callback was registered.");
-   return -EINVAL;
-   }
+   if (!driver_desc->device_reset_cb)
+   return 0;
 
/* Perform a device reset of the requested type. */
ret = driver_desc->device_reset_cb(gasket_dev, reset_type);
-- 
2.18.0.233.g985f88cf7e-goog

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


[PATCH 08/20] staging: gasket: apex_clock_gating simplify logic, reduce indentation

2018-07-19 Thread Todd Poynor
From: Todd Poynor 

Collapse together two checks and return immediately, avoid conditional
indentation for most of function code.

Reported-by: Guenter Roeck 
Signed-off-by: Simon Que 
Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/apex_driver.c | 43 +---
 1 file changed, 20 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/gasket/apex_driver.c 
b/drivers/staging/gasket/apex_driver.c
index 3a83c3d4d5561..a01b1f2b827ea 100644
--- a/drivers/staging/gasket/apex_driver.c
+++ b/drivers/staging/gasket/apex_driver.c
@@ -666,33 +666,30 @@ static long apex_clock_gating(struct gasket_dev 
*gasket_dev, ulong arg)
 {
struct apex_gate_clock_ioctl ibuf;
 
-   if (bypass_top_level)
+   if (bypass_top_level || !allow_sw_clock_gating)
return 0;
 
-   if (allow_sw_clock_gating) {
-   if (copy_from_user(, (void __user *)arg, sizeof(ibuf)))
-   return -EFAULT;
+   if (copy_from_user(, (void __user *)arg, sizeof(ibuf)))
+   return -EFAULT;
 
-   gasket_log_error(
-   gasket_dev, "%s %llu", __func__, ibuf.enable);
+   gasket_log_error(gasket_dev, "%s %llu", __func__, ibuf.enable);
 
-   if (ibuf.enable) {
-   /* Quiesce AXI, gate GCB clock. */
-   gasket_read_modify_write_32(
-   gasket_dev, APEX_BAR_INDEX,
-   APEX_BAR2_REG_AXI_QUIESCE, 0x1, 1, 16);
-   gasket_read_modify_write_32(
-   gasket_dev, APEX_BAR_INDEX,
-   APEX_BAR2_REG_GCB_CLOCK_GATE, 0x1, 2, 18);
-   } else {
-   /* Un-gate GCB clock, un-quiesce AXI. */
-   gasket_read_modify_write_32(
-   gasket_dev, APEX_BAR_INDEX,
-   APEX_BAR2_REG_GCB_CLOCK_GATE, 0x0, 2, 18);
-   gasket_read_modify_write_32(
-   gasket_dev, APEX_BAR_INDEX,
-   APEX_BAR2_REG_AXI_QUIESCE, 0x0, 1, 16);
-   }
+   if (ibuf.enable) {
+   /* Quiesce AXI, gate GCB clock. */
+   gasket_read_modify_write_32(
+   gasket_dev, APEX_BAR_INDEX,
+   APEX_BAR2_REG_AXI_QUIESCE, 0x1, 1, 16);
+   gasket_read_modify_write_32(
+   gasket_dev, APEX_BAR_INDEX,
+   APEX_BAR2_REG_GCB_CLOCK_GATE, 0x1, 2, 18);
+   } else {
+   /* Un-gate GCB clock, un-quiesce AXI. */
+   gasket_read_modify_write_32(
+   gasket_dev, APEX_BAR_INDEX,
+   APEX_BAR2_REG_GCB_CLOCK_GATE, 0x0, 2, 18);
+   gasket_read_modify_write_32(
+   gasket_dev, APEX_BAR_INDEX,
+   APEX_BAR2_REG_AXI_QUIESCE, 0x0, 1, 16);
}
return 0;
 }
-- 
2.18.0.233.g985f88cf7e-goog

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


[PATCH 15/20] staging: gasket: fix multi-line comment syntax in gasket_core.h

2018-07-19 Thread Todd Poynor
From: Todd Poynor 

Use consistent kernel-style multi-line comment syntax.

Reported-by: Guenter Roeck 
Signed-off-by: Simon Que 
Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/gasket_core.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/gasket/gasket_core.h 
b/drivers/staging/gasket/gasket_core.h
index 50ad0c8853183..7ea1df123ba5d 100644
--- a/drivers/staging/gasket/gasket_core.h
+++ b/drivers/staging/gasket/gasket_core.h
@@ -54,7 +54,8 @@ enum gasket_interrupt_type {
PLATFORM_WIRE = 2,
 };
 
-/* Used to describe a Gasket interrupt. Contains an interrupt index, a 
register,
+/*
+ * Used to describe a Gasket interrupt. Contains an interrupt index, a 
register,
  * and packing data for that interrupt. The register and packing data
  * fields are relevant only for PCI_MSIX interrupt type and can be
  * set to 0 for everything else.
-- 
2.18.0.233.g985f88cf7e-goog

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


[PATCH 14/20] staging: gasket: remove extra parens in gasket_write_mappable_regions

2018-07-19 Thread Todd Poynor
From: Todd Poynor 

Remove unneeded parentheses around subexpressions.

Reported-by: Guenter Roeck 
Signed-off-by: Simon Que 
Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/gasket_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/gasket/gasket_core.c 
b/drivers/staging/gasket/gasket_core.c
index ae5febec8844c..ba48a379b0ada 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -1889,7 +1889,7 @@ static ssize_t gasket_write_mappable_regions(
if (bar_desc.permissions == GASKET_NOMAP)
return 0;
for (i = 0;
-(i < bar_desc.num_mappable_regions) && (total_written < PAGE_SIZE);
+i < bar_desc.num_mappable_regions && total_written < PAGE_SIZE;
 i++) {
min_addr = bar_desc.mappable_regions[i].start -
   driver_desc->legacy_mmap_address_offset;
-- 
2.18.0.233.g985f88cf7e-goog

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


[PATCH 20/20] staging: gasket: common ioctls add __user annotations

2018-07-19 Thread Todd Poynor
From: Todd Poynor 

Add __user annotation to gasket common ioctl pointer arguments for
sparse checking.

Reported-by: Dmitry Torokhov 
Signed-off-by: Zhongze Hu 
Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/gasket_ioctl.c | 102 ++
 1 file changed, 55 insertions(+), 47 deletions(-)

diff --git a/drivers/staging/gasket/gasket_ioctl.c 
b/drivers/staging/gasket/gasket_ioctl.c
index 998d0e215523c..2e2c9b997093b 100644
--- a/drivers/staging/gasket/gasket_ioctl.c
+++ b/drivers/staging/gasket/gasket_ioctl.c
@@ -24,17 +24,24 @@
 #endif
 
 static bool gasket_ioctl_check_permissions(struct file *filp, uint cmd);
-static int gasket_set_event_fd(struct gasket_dev *dev, ulong arg);
+static int gasket_set_event_fd(struct gasket_dev *dev,
+  struct gasket_interrupt_eventfd __user *argp);
 static int gasket_read_page_table_size(
-   struct gasket_dev *gasket_dev, ulong arg);
+   struct gasket_dev *gasket_dev,
+   struct gasket_page_table_ioctl __user *argp);
 static int gasket_read_simple_page_table_size(
-   struct gasket_dev *gasket_dev, ulong arg);
+   struct gasket_dev *gasket_dev,
+   struct gasket_page_table_ioctl __user *argp);
 static int gasket_partition_page_table(
-   struct gasket_dev *gasket_dev, ulong arg);
-static int gasket_map_buffers(struct gasket_dev *gasket_dev, ulong arg);
-static int gasket_unmap_buffers(struct gasket_dev *gasket_dev, ulong arg);
+   struct gasket_dev *gasket_dev,
+   struct gasket_page_table_ioctl __user *argp);
+static int gasket_map_buffers(struct gasket_dev *gasket_dev,
+ struct gasket_page_table_ioctl __user *argp);
+static int gasket_unmap_buffers(struct gasket_dev *gasket_dev,
+   struct gasket_page_table_ioctl __user *argp);
 static int gasket_config_coherent_allocator(
-   struct gasket_dev *gasket_dev, ulong arg);
+   struct gasket_dev *gasket_dev,
+   struct gasket_coherent_alloc_config_ioctl __user *argp);
 
 /*
  * standard ioctl dispatch function.
@@ -80,7 +87,7 @@ long gasket_handle_ioctl(struct file *filp, uint cmd, void 
__user *argp)
retval = gasket_reset(gasket_dev, arg);
break;
case GASKET_IOCTL_SET_EVENTFD:
-   retval = gasket_set_event_fd(gasket_dev, arg);
+   retval = gasket_set_event_fd(gasket_dev, argp);
break;
case GASKET_IOCTL_CLEAR_EVENTFD:
trace_gasket_ioctl_integer_data(arg);
@@ -89,31 +96,30 @@ long gasket_handle_ioctl(struct file *filp, uint cmd, void 
__user *argp)
break;
case GASKET_IOCTL_PARTITION_PAGE_TABLE:
trace_gasket_ioctl_integer_data(arg);
-   retval = gasket_partition_page_table(gasket_dev, arg);
+   retval = gasket_partition_page_table(gasket_dev, argp);
break;
case GASKET_IOCTL_NUMBER_PAGE_TABLES:
trace_gasket_ioctl_integer_data(gasket_dev->num_page_tables);
-   if (copy_to_user((void __user *)arg,
-_dev->num_page_tables,
+   if (copy_to_user(argp, _dev->num_page_tables,
 sizeof(uint64_t)))
retval = -EFAULT;
else
retval = 0;
break;
case GASKET_IOCTL_PAGE_TABLE_SIZE:
-   retval = gasket_read_page_table_size(gasket_dev, arg);
+   retval = gasket_read_page_table_size(gasket_dev, argp);
break;
case GASKET_IOCTL_SIMPLE_PAGE_TABLE_SIZE:
-   retval = gasket_read_simple_page_table_size(gasket_dev, arg);
+   retval = gasket_read_simple_page_table_size(gasket_dev, argp);
break;
case GASKET_IOCTL_MAP_BUFFER:
-   retval = gasket_map_buffers(gasket_dev, arg);
+   retval = gasket_map_buffers(gasket_dev, argp);
break;
case GASKET_IOCTL_CONFIG_COHERENT_ALLOCATOR:
-   retval = gasket_config_coherent_allocator(gasket_dev, arg);
+   retval = gasket_config_coherent_allocator(gasket_dev, argp);
break;
case GASKET_IOCTL_UNMAP_BUFFER:
-   retval = gasket_unmap_buffers(gasket_dev, arg);
+   retval = gasket_unmap_buffers(gasket_dev, argp);
break;
case GASKET_IOCTL_CLEAR_INTERRUPT_COUNTS:
/* Clear interrupt counts doesn't take an arg, so use 0. */
@@ -218,16 +224,15 @@ static bool gasket_ioctl_check_permissions(struct file 
*filp, uint cmd)
 /*
  * Associate an eventfd with an interrupt.
  * @gasket_dev: Pointer to the current gasket_dev we're using.
- * @arg: Pointer to gasket_interrupt_eventfd struct in userspace.
+ * @argp: Pointer to gasket_interrupt_eventfd struct in userspace.
  */
-static int gasket_set_event_fd(struct gasket_dev *gasket_dev, ulong arg)
+static int 

[PATCH 17/20] staging: gasket: top ioctl handler add __user annotations

2018-07-19 Thread Todd Poynor
From: Todd Poynor 

Add __user annotation to gasket_core top-level ioctl handling pointer
arguments, for sparse checking.

Reported-by: Dmitry Torokhov 
Signed-off-by: Zhongze Hu 
Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/gasket_core.c | 6 --
 drivers/staging/gasket/gasket_core.h | 7 +--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/gasket/gasket_core.c 
b/drivers/staging/gasket/gasket_core.c
index 254fb392c05c1..40e46ca5228c8 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -14,6 +14,7 @@
 #include "gasket_page_table.h"
 #include "gasket_sysfs.h"
 
+#include 
 #include 
 #include 
 #include 
@@ -1781,6 +1782,7 @@ static long gasket_ioctl(struct file *filp, uint cmd, 
ulong arg)
 {
struct gasket_dev *gasket_dev;
const struct gasket_driver_desc *driver_desc;
+   void __user *argp = (void __user *)arg;
char path[256];
 
if (!filp)
@@ -1810,14 +1812,14 @@ static long gasket_ioctl(struct file *filp, uint cmd, 
ulong arg)
 * check_and_invoke_callback.
 */
if (driver_desc->ioctl_handler_cb)
-   return driver_desc->ioctl_handler_cb(filp, cmd, arg);
+   return driver_desc->ioctl_handler_cb(filp, cmd, argp);
 
gasket_log_error(
gasket_dev, "Received unknown ioctl 0x%x", cmd);
return -EINVAL;
}
 
-   return gasket_handle_ioctl(filp, cmd, arg);
+   return gasket_handle_ioctl(filp, cmd, argp);
 }
 
 int gasket_reset(struct gasket_dev *gasket_dev, uint reset_type)
diff --git a/drivers/staging/gasket/gasket_core.h 
b/drivers/staging/gasket/gasket_core.h
index 7ea1df123ba5d..bf4ed3769efb2 100644
--- a/drivers/staging/gasket/gasket_core.h
+++ b/drivers/staging/gasket/gasket_core.h
@@ -314,9 +314,12 @@ struct gasket_dev {
struct hlist_node legacy_hlist_node;
 };
 
+/* Type of the ioctl handler callback. */
+typedef long (*gasket_ioctl_handler_cb_t)
+   (struct file *file, uint cmd, void __user *argp);
 /* Type of the ioctl permissions check callback. See below. */
 typedef int (*gasket_ioctl_permissions_cb_t)(
-   struct file *filp, uint cmd, ulong arg);
+   struct file *filp, uint cmd, void __user *argp);
 
 /*
  * Device type descriptor.
@@ -550,7 +553,7 @@ struct gasket_driver_desc {
 * return -EINVAL. Should return an error status (either -EINVAL or
 * the error result of the ioctl being handled).
 */
-   long (*ioctl_handler_cb)(struct file *filp, uint cmd, ulong arg);
+   gasket_ioctl_handler_cb_t ioctl_handler_cb;
 
/*
 * device_status_cb: Callback to determine device health.
-- 
2.18.0.233.g985f88cf7e-goog

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


[PATCH 19/20] staging: gasket: common ioctl dispatcher add __user annotations

2018-07-19 Thread Todd Poynor
From: Todd Poynor 

Add __user annotation to gasket core common ioctl pointer arguments for
sparse checking.

Reported-by: Dmitry Torokhov 
Signed-off-by: Zhongze Hu 
Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/gasket_ioctl.c | 8 +---
 drivers/staging/gasket/gasket_ioctl.h | 4 +++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/gasket/gasket_ioctl.c 
b/drivers/staging/gasket/gasket_ioctl.c
index 8fd44979fe713..998d0e215523c 100644
--- a/drivers/staging/gasket/gasket_ioctl.c
+++ b/drivers/staging/gasket/gasket_ioctl.c
@@ -7,6 +7,7 @@
 #include "gasket_interrupt.h"
 #include "gasket_logging.h"
 #include "gasket_page_table.h"
+#include 
 #include 
 #include 
 
@@ -39,13 +40,14 @@ static int gasket_config_coherent_allocator(
  * standard ioctl dispatch function.
  * @filp: File structure pointer describing this node usage session.
  * @cmd: ioctl number to handle.
- * @arg: ioctl-specific data pointer.
+ * @argp: ioctl-specific data pointer.
  *
  * Standard ioctl dispatcher; forwards operations to individual handlers.
  */
-long gasket_handle_ioctl(struct file *filp, uint cmd, ulong arg)
+long gasket_handle_ioctl(struct file *filp, uint cmd, void __user *argp)
 {
struct gasket_dev *gasket_dev;
+   unsigned long arg = (unsigned long)argp;
int retval;
 
gasket_dev = (struct gasket_dev *)filp->private_data;
@@ -53,7 +55,7 @@ long gasket_handle_ioctl(struct file *filp, uint cmd, ulong 
arg)
 
if (gasket_get_ioctl_permissions_cb(gasket_dev)) {
retval = gasket_get_ioctl_permissions_cb(gasket_dev)(
-   filp, cmd, arg);
+   filp, cmd, argp);
if (retval < 0) {
trace_gasket_ioctl_exit(-EPERM);
return retval;
diff --git a/drivers/staging/gasket/gasket_ioctl.h 
b/drivers/staging/gasket/gasket_ioctl.h
index 461fab27a3e52..51f468c77f041 100644
--- a/drivers/staging/gasket/gasket_ioctl.h
+++ b/drivers/staging/gasket/gasket_ioctl.h
@@ -5,6 +5,8 @@
 
 #include "gasket_core.h"
 
+#include 
+
 /*
  * Handle Gasket common ioctls.
  * @filp: Pointer to the ioctl's file.
@@ -13,7 +15,7 @@
  *
  * Returns 0 on success and nonzero on failure.
  */
-long gasket_handle_ioctl(struct file *filp, uint cmd, ulong arg);
+long gasket_handle_ioctl(struct file *filp, uint cmd, void __user *argp);
 
 /*
  * Determines if an ioctl is part of the standard Gasket framework.
-- 
2.18.0.233.g985f88cf7e-goog

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


[PATCH 10/20] staging: gasket: remove else clause after return in if clause

2018-07-19 Thread Todd Poynor
From: Todd Poynor 

Else after return is unnecessary and may cause static code checkers to
complain.

Reported-by: Guenter Roeck 
Signed-off-by: Simon Que 
Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/gasket_page_table.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/gasket/gasket_page_table.c 
b/drivers/staging/gasket/gasket_page_table.c
index 2a27db658a4e4..617d602b8b447 100644
--- a/drivers/staging/gasket/gasket_page_table.c
+++ b/drivers/staging/gasket/gasket_page_table.c
@@ -598,9 +598,7 @@ bool gasket_page_table_is_dev_addr_bad(
if (gasket_addr_is_simple(pg_tbl, dev_addr))
return gasket_is_simple_dev_addr_bad(
pg_tbl, dev_addr, num_pages);
-   else
-   return gasket_is_extended_dev_addr_bad(
-   pg_tbl, dev_addr, num_pages);
+   return gasket_is_extended_dev_addr_bad(pg_tbl, dev_addr, num_pages);
 }
 EXPORT_SYMBOL(gasket_page_table_is_dev_addr_bad);
 
-- 
2.18.0.233.g985f88cf7e-goog

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


[PATCH 01/20] staging: gasket: allow compile for ARM64 in Kconfig

2018-07-19 Thread Todd Poynor
From: Todd Poynor 

The gasket and apex drivers are also to be used on ARM64 architectures.

Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/gasket/Kconfig b/drivers/staging/gasket/Kconfig
index c836389c1402d..970e299046c37 100644
--- a/drivers/staging/gasket/Kconfig
+++ b/drivers/staging/gasket/Kconfig
@@ -2,7 +2,7 @@ menu "Gasket devices"
 
 config STAGING_GASKET_FRAMEWORK
tristate "Gasket framework"
-   depends on PCI && X86_64
+   depends on PCI && (X86_64 || ARM64)
help
  This framework supports Gasket-compatible devices, such as Apex.
  It is required for any of the following module(s).
-- 
2.18.0.233.g985f88cf7e-goog

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


[PATCH 07/20] staging: gasket: gasket_mmap return error instead of valid BAR index

2018-07-19 Thread Todd Poynor
From: Todd Poynor 

When offset to be mapped matches both a BAR region and a coherent mapped
region return an error as intended, not the BAR index.

Signed-off-by: Simon Que 
Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/gasket_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/gasket/gasket_core.c 
b/drivers/staging/gasket/gasket_core.c
index eb5ad161ccda2..3cf918f9d2604 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -1627,7 +1627,7 @@ static int gasket_mmap(struct file *filp, struct 
vm_area_struct *vma)
"0x%lx",
raw_offset);
trace_gasket_mmap_exit(bar_index);
-   return bar_index;
+   return -EINVAL;
}
 
vma->vm_private_data = gasket_dev;
-- 
2.18.0.233.g985f88cf7e-goog

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


[PATCH 04/20] staging: gasket: fix class create bug handling

2018-07-19 Thread Todd Poynor
From: Todd Poynor 

class_create() never returns NULL, and this driver should never return
PTR_ERR(NULL) anyway.

Reported-by: Dmitry Torokhov 
Signed-off-by: Zhongze Hu 
Signed-off-by: Todd Poynor 
Reviewed-by: Dmitry Torokhov 
---
 drivers/staging/gasket/gasket_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/gasket/gasket_core.c 
b/drivers/staging/gasket/gasket_core.c
index 18cc8e3283b39..53236e1ba4e48 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -321,7 +321,7 @@ int gasket_register_device(const struct gasket_driver_desc 
*driver_desc)
internal->class =
class_create(driver_desc->module, driver_desc->name);
 
-   if (IS_ERR_OR_NULL(internal->class)) {
+   if (IS_ERR(internal->class)) {
gasket_nodev_error("Cannot register %s class [ret=%ld]",
   driver_desc->name, PTR_ERR(internal->class));
ret = PTR_ERR(internal->class);
-- 
2.18.0.233.g985f88cf7e-goog

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


[PATCH 05/20] staging: gasket: remove unnecessary code in coherent allocator

2018-07-19 Thread Todd Poynor
From: Todd Poynor 

Remove extraneous statement in gasket_config_coherent_allocator()

Reported-by: Dmitry Torokhov 
Signed-off-by: Zhongze Hu 
Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/gasket_ioctl.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/gasket/gasket_ioctl.c 
b/drivers/staging/gasket/gasket_ioctl.c
index 0c2f85cf54480..d0142ed048a65 100644
--- a/drivers/staging/gasket/gasket_ioctl.c
+++ b/drivers/staging/gasket/gasket_ioctl.c
@@ -420,10 +420,8 @@ static int gasket_config_coherent_allocator(
if (ibuf.page_table_index >= gasket_dev->num_page_tables)
return -EFAULT;
 
-   if (ibuf.size > PAGE_SIZE * MAX_NUM_COHERENT_PAGES) {
-   ibuf.size = PAGE_SIZE * MAX_NUM_COHERENT_PAGES;
+   if (ibuf.size > PAGE_SIZE * MAX_NUM_COHERENT_PAGES)
return -ENOMEM;
-   }
 
if (ibuf.enable == 0) {
ret = gasket_free_coherent_memory(
-- 
2.18.0.233.g985f88cf7e-goog

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


[PATCH 02/20] staging: gasket: gasket_enable_dev remove unnecessary variable

2018-07-19 Thread Todd Poynor
From: Todd Poynor 

Remove unnecessary variable, pass constant param instead.

Reported-by: Dmitry Torokhov 
Signed-off-by: Zhongze Hu 
Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/gasket_core.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/gasket/gasket_core.c 
b/drivers/staging/gasket/gasket_core.c
index 0d5ba7359af73..f327c9d7f90a3 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -898,7 +898,6 @@ static int gasket_enable_dev(
 {
int tbl_idx;
int ret;
-   bool has_dma_ops;
struct device *ddev;
const struct gasket_driver_desc *driver_desc =
internal_desc->driver_desc;
@@ -917,8 +916,6 @@ static int gasket_enable_dev(
return ret;
}
 
-   has_dma_ops = true;
-
for (tbl_idx = 0; tbl_idx < driver_desc->num_page_tables; tbl_idx++) {
gasket_log_debug(
gasket_dev, "Initializing page table %d.", tbl_idx);
@@ -936,7 +933,7 @@ static int gasket_enable_dev(
_dev->bar_data[
driver_desc->page_table_bar_index],
_desc->page_table_configs[tbl_idx],
-   ddev, gasket_dev->pci_dev, has_dma_ops);
+   ddev, gasket_dev->pci_dev, true);
if (ret) {
gasket_log_error(
gasket_dev,
-- 
2.18.0.233.g985f88cf7e-goog

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


Re: [PATCH 17/32] staging: gasket: annotate ioctl arg with __user

2018-07-19 Thread Todd Poynor
On Thu, Jul 19, 2018 at 2:37 AM, Greg Kroah-Hartman
 wrote:
> On Tue, Jul 17, 2018 at 01:56:57PM -0700, Todd Poynor wrote:
>> From: Todd Poynor 
>>
>> For sparse checking.
>
> Close, but you can do better :)
>
>>
>> Reported-by: Dmitry Torokhov 
>> Signed-off-by: Zhongze Hu 
>> Signed-off-by: Todd Poynor 
>> Reviewed-by: Dmitry Torokhov 
>> ---
>>  drivers/staging/gasket/apex_driver.c  | 11 ++--
>>  drivers/staging/gasket/gasket_core.c  |  6 ++-
>>  drivers/staging/gasket/gasket_core.h  |  4 +-
>>  drivers/staging/gasket/gasket_ioctl.c | 72 ++-
>>  drivers/staging/gasket/gasket_ioctl.h |  4 +-
>>  5 files changed, 52 insertions(+), 45 deletions(-)
>>
>> diff --git a/drivers/staging/gasket/apex_driver.c 
>> b/drivers/staging/gasket/apex_driver.c
>> index 612b3ab803196..c91c5aff5ab9c 100644
>> --- a/drivers/staging/gasket/apex_driver.c
>> +++ b/drivers/staging/gasket/apex_driver.c
>> @@ -5,6 +5,7 @@
>>   * Copyright (C) 2018 Google, Inc.
>>   */
>>
>> +#include 
>>  #include 
>>  #include 
>>  #include 
>> @@ -142,9 +143,9 @@ static int apex_get_status(struct gasket_dev 
>> *gasket_dev);
>>
>>  static uint apex_ioctl_check_permissions(struct file *file, uint cmd);
>>
>> -static long apex_ioctl(struct file *file, uint cmd, ulong arg);
>> +static long apex_ioctl(struct file *file, uint cmd, void __user *arg);
>>
>> -static long apex_clock_gating(struct gasket_dev *gasket_dev, ulong arg);
>> +static long apex_clock_gating(struct gasket_dev *gasket_dev, void __user 
>> *arg);
>
> Make this a __user pointer to the correct struct type you are handling
> here.  You know what the type is, use it.

Got it.

>
>>  static int apex_enter_reset(struct gasket_dev *gasket_dev, uint type);
>>
>> @@ -635,7 +636,7 @@ static uint apex_ioctl_check_permissions(struct file 
>> *filp, uint cmd)
>>  /*
>>   * Apex-specific ioctl handler.
>>   */
>> -static long apex_ioctl(struct file *filp, uint cmd, ulong arg)
>> +static long apex_ioctl(struct file *filp, uint cmd, void __user *arg)
>>  {
>>   struct gasket_dev *gasket_dev = filp->private_data;
>>
>> @@ -655,7 +656,7 @@ static long apex_ioctl(struct file *filp, uint cmd, 
>> ulong arg)
>>   * @gasket_dev: Gasket device pointer.
>>   * @arg: User ioctl arg, in this case to a apex_gate_clock_ioctl struct.
>>   */
>> -static long apex_clock_gating(struct gasket_dev *gasket_dev, ulong arg)
>> +static long apex_clock_gating(struct gasket_dev *gasket_dev, void __user 
>> *arg)
>
> As above, this should be a different type.
>
>>  {
>>   struct apex_gate_clock_ioctl ibuf;
>>
>> @@ -663,7 +664,7 @@ static long apex_clock_gating(struct gasket_dev 
>> *gasket_dev, ulong arg)
>>   return 0;
>>
>>   if (allow_sw_clock_gating) {
>> - if (copy_from_user(, (void __user *)arg, sizeof(ibuf)))
>> + if (copy_from_user(, arg, sizeof(ibuf)))
>>   return -EFAULT;
>>
>>   gasket_log_error(
>> diff --git a/drivers/staging/gasket/gasket_core.c 
>> b/drivers/staging/gasket/gasket_core.c
>> index 947b4fcc76970..ff34af42bbe7c 100644
>> --- a/drivers/staging/gasket/gasket_core.c
>> +++ b/drivers/staging/gasket/gasket_core.c
>> @@ -14,6 +14,7 @@
>>  #include "gasket_page_table.h"
>>  #include "gasket_sysfs.h"
>>
>> +#include 
>>  #include 
>>  #include 
>>  #include 
>> @@ -1823,14 +1824,15 @@ static long gasket_ioctl(struct file *filp, uint 
>> cmd, ulong arg)
>>* check_and_invoke_callback.
>>*/
>>   if (driver_desc->ioctl_handler_cb)
>> - return driver_desc->ioctl_handler_cb(filp, cmd, arg);
>> + return driver_desc->ioctl_handler_cb(
>> + filp, cmd, (void __user *)arg);
>
> You can use a temp variable and then only have to cast things once then,
> instead of twice, if you care.  Not a big deal.

But then I have to name it, and I suck at that. :P  I'm trying
switching to "arg" for ulong/int arguments and "argp" for pointer
arguments.

>
>>
>>   gasket_log_error(
>>   gasket_dev, "Received unknown ioctl 0x%x", cmd);
>
> This is a fun way to cause a DoS on your system, you should fix this up
> in later changes.

Yeah there's another patch coming soon that converts a bunch of errors
and infos to debugs.

>
>>   return -EINVAL;
>>   }
>>
>> - return gasket_handle_ioctl(filp, cmd, arg);
>> + return gasket_handle_ioctl(filp, cmd, (void __user *)arg);
>>  }
>>
>>  int gasket_reset(struct gasket_dev *gasket_dev, uint reset_type)
>> diff --git a/drivers/staging/gasket/gasket_core.h 
>> b/drivers/staging/gasket/gasket_core.h
>> index 50ad0c8853183..68b4d2ac9fd6c 100644
>> --- a/drivers/staging/gasket/gasket_core.h
>> +++ b/drivers/staging/gasket/gasket_core.h
>> @@ -315,7 +315,7 @@ struct gasket_dev {
>>
>>  /* Type of the ioctl permissions check callback. See below. */
>>  typedef int (*gasket_ioctl_permissions_cb_t)(
>> - struct file *filp, uint cmd, 

Re: [RFC PATCH v3] Xilinx AXI-Stream FIFO v4.1 IP core driver

2018-07-19 Thread Jacob Feder
First I run "make menuconfig" and select my driver in "device drivers" >
"staging". If I run "make" or "make all" or
"make drivers/staging/axis-fifo" everything compiles without errors or 
warnings even if I put blatant syntax errors in my code.
What am I missing here?

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


Re: [PATCH 16/32] staging: gasket: always allow root open for write

2018-07-19 Thread Todd Poynor
On Thu, Jul 19, 2018 at 2:29 AM, Greg Kroah-Hartman
 wrote:
> On Tue, Jul 17, 2018 at 01:56:56PM -0700, Todd Poynor wrote:
>> From: Todd Poynor 
>>
>> Always allow root to open device for writing.
>>
>> Drop special-casing of ioctl permissions for root vs. owner.
>>
>> Reported-by: Dmitry Torokhov 
>> Signed-off-by: Zhongze Hu 
>> Signed-off-by: Todd Poynor 
>> ---
>>  drivers/staging/gasket/apex_driver.c  |  9 +
>>  drivers/staging/gasket/gasket_core.c  |  8 +---
>>  drivers/staging/gasket/gasket_ioctl.c | 19 ---
>>  3 files changed, 14 insertions(+), 22 deletions(-)
>>
>> diff --git a/drivers/staging/gasket/apex_driver.c 
>> b/drivers/staging/gasket/apex_driver.c
>> index 3a83c3d4d5561..612b3ab803196 100644
>> --- a/drivers/staging/gasket/apex_driver.c
>> +++ b/drivers/staging/gasket/apex_driver.c
>> @@ -629,14 +629,7 @@ static bool is_gcb_in_reset(struct gasket_dev 
>> *gasket_dev)
>>   */
>>  static uint apex_ioctl_check_permissions(struct file *filp, uint cmd)
>>  {
>> - struct gasket_dev *gasket_dev = filp->private_data;
>> - int root = capable(CAP_SYS_ADMIN);
>> - int is_owner = gasket_dev->dev_info.ownership.is_owned &&
>> -current->tgid == gasket_dev->dev_info.ownership.owner;
>> -
>> - if (root || is_owner)
>> - return 1;
>> - return 0;
>> + return !!(filp->f_mode & FMODE_WRITE);
>
> Shouldn't this return a boolean instead of uint?

There's a patch farther down in the stack that does that, I wasn't
sure if I should collapse the two things together into a single patch,
will fold that patch into this one.

>
>>  }
>>
>>  /*
>> diff --git a/drivers/staging/gasket/gasket_core.c 
>> b/drivers/staging/gasket/gasket_core.c
>> index 0d5ba7359af73..947b4fcc76970 100644
>> --- a/drivers/staging/gasket/gasket_core.c
>> +++ b/drivers/staging/gasket/gasket_core.c
>> @@ -1085,6 +1085,7 @@ static int gasket_open(struct inode *inode, struct 
>> file *filp)
>>   char task_name[TASK_COMM_LEN];
>>   struct gasket_cdev_info *dev_info =
>>   container_of(inode->i_cdev, struct gasket_cdev_info, cdev);
>> + int is_root = capable(CAP_SYS_ADMIN);
>>
>>   gasket_dev = dev_info->gasket_dev_ptr;
>>   driver_desc = gasket_dev->internal_desc->driver_desc;
>> @@ -1098,7 +1099,7 @@ static int gasket_open(struct inode *inode, struct 
>> file *filp)
>>   "Attempting to open with tgid %u (%s) (f_mode: 0%03o, "
>>   "fmode_write: %d is_root: %u)",
>>   current->tgid, task_name, filp->f_mode,
>> - (filp->f_mode & FMODE_WRITE), capable(CAP_SYS_ADMIN));
>> + (filp->f_mode & FMODE_WRITE), is_root);
>>
>>   /* Always allow non-writing accesses. */
>>   if (!(filp->f_mode & FMODE_WRITE)) {
>> @@ -1112,8 +1113,9 @@ static int gasket_open(struct inode *inode, struct 
>> file *filp)
>>   gasket_dev, "Current owner open count (owning tgid %u): %d.",
>>   ownership->owner, ownership->write_open_count);
>>
>> - /* Opening a node owned by another TGID is an error (even root.) */
>> - if (ownership->is_owned && ownership->owner != current->tgid) {
>> + /* Opening a node owned by another TGID is an error (unless root) */
>> + if (ownership->is_owned && ownership->owner != current->tgid &&
>> + !is_root) {
>>   gasket_log_error(
>>   gasket_dev,
>>   "Process %u is opening a node held by %u.",
>> diff --git a/drivers/staging/gasket/gasket_ioctl.c 
>> b/drivers/staging/gasket/gasket_ioctl.c
>> index 0c2f85cf54480..d0fa05b8bf1d3 100644
>> --- a/drivers/staging/gasket/gasket_ioctl.c
>> +++ b/drivers/staging/gasket/gasket_ioctl.c
>> @@ -171,7 +171,7 @@ long gasket_is_supported_ioctl(uint cmd)
>>   */
>>  static uint gasket_ioctl_check_permissions(struct file *filp, uint cmd)
>>  {
>
> Also return bool?

Will fix, I had meant to send a patch for this, will just do that here.

>
>> - uint alive, root, device_owner;
>> + uint alive;
>>   fmode_t read, write;
>>   struct gasket_dev *gasket_dev = (struct gasket_dev 
>> *)filp->private_data;
>>
>> @@ -183,33 +183,30 @@ static uint gasket_ioctl_check_permissions(struct file 
>> *filp, uint cmd)
>>   alive, gasket_dev->status);
>>   }
>>
>> - root = capable(CAP_SYS_ADMIN);
>> - read = filp->f_mode & FMODE_READ;
>> - write = filp->f_mode & FMODE_WRITE;
>> - device_owner = (gasket_dev->dev_info.ownership.is_owned &&
>> - current->tgid == gasket_dev->dev_info.ownership.owner);
>> + read = !!(filp->f_mode & FMODE_READ);
>> + write = !!(filp->f_mode & FMODE_WRITE);
>
> These should be bool as well, right?

Right.

>
> I'll drop this patch, thanks.
>
> greg k-h



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


[PATCH] Staging: pi433: rf69: fixed a multi line comment issue

2018-07-19 Thread Mark Railton
Fixed a coding style issue

Signed-off-by: Mark Railton 
---
 drivers/staging/pi433/rf69.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index 90280e9b006d..14826fb505dd 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -618,7 +618,8 @@ bool rf69_get_flag(struct spi_device *spi, enum flag flag)
case fifo_full:
return (rf69_read_reg(spi, REG_IRQFLAGS2) & 
MASK_IRQFLAGS2_FIFO_FULL);
 /* case fifo_not_empty:
- * return (rf69_read_reg(spi, REG_IRQFLAGS2) & 
MASK_IRQFLAGS2_FIFO_NOT_EMPTY); */
+ * return (rf69_read_reg(spi, REG_IRQFLAGS2) & 
MASK_IRQFLAGS2_FIFO_NOT_EMPTY);
+ */
case fifo_empty:
return !(rf69_read_reg(spi, REG_IRQFLAGS2) & 
MASK_IRQFLAGS2_FIFO_NOT_EMPTY);
case fifo_level_below_threshold:
-- 
2.17.1

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


Re: [PATCH v7 4/4] kexec_file: Load kernel at top of system RAM if required

2018-07-19 Thread Andrew Morton
On Thu, 19 Jul 2018 23:17:53 +0800 Baoquan He  wrote:

> Hi Andrew,
> 
> On 07/18/18 at 03:33pm, Andrew Morton wrote:
> > On Wed, 18 Jul 2018 10:49:44 +0800 Baoquan He  wrote:
> > 
> > > For kexec_file loading, if kexec_buf.top_down is 'true', the memory which
> > > is used to load kernel/initrd/purgatory is supposed to be allocated from
> > > top to down. This is what we have been doing all along in the old kexec
> > > loading interface and the kexec loading is still default setting in some
> > > distributions. However, the current kexec_file loading interface doesn't
> > > do like this. The function arch_kexec_walk_mem() it calls ignores checking
> > > kexec_buf.top_down, but calls walk_system_ram_res() directly to go through
> > > all resources of System RAM from bottom to up, to try to find memory 
> > > region
> > > which can contain the specific kexec buffer, then call 
> > > locate_mem_hole_callback()
> > > to allocate memory in that found memory region from top to down. This 
> > > brings
> > > confusion especially when KASLR is widely supported , users have to make 
> > > clear
> > > why kexec/kdump kernel loading position is different between these two
> > > interfaces in order to exclude unnecessary noises. Hence these two 
> > > interfaces
> > > need be unified on behaviour.
> > 
> > As far as I can tell, the above is the whole reason for the patchset,
> > yes?  To avoid confusing users.
> 
> 
> In fact, it's not just trying to avoid confusing users. Kexec loading
> and kexec_file loading are just do the same thing in essence. Just we
> need do kernel image verification on uefi system, have to port kexec
> loading code to kernel. 
> 
> Kexec has been a formal feature in our distro, and customers owning
> those kind of very large machine can make use of this feature to speed
> up the reboot process. On uefi machine, the kexec_file loading will
> search place to put kernel under 4G from top to down. As we know, the
> 1st 4G space is DMA32 ZONE, dma, pci mmcfg, bios etc all try to consume
> it. It may have possibility to not be able to find a usable space for
> kernel/initrd. From the top down of the whole memory space, we don't
> have this worry. 
> 
> And at the first post, I just posted below with AKASHI's
> walk_system_ram_res_rev() version. Later you suggested to use
> list_head to link child sibling of resource, see what the code change
> looks like.
> http://lkml.kernel.org/r/20180322033722.9279-1-...@redhat.com
> 
> Then I posted v2
> http://lkml.kernel.org/r/20180408024724.16812-1-...@redhat.com
> Rob Herring mentioned that other components which has this tree struct
> have planned to do the same thing, replacing the singly linked list with
> list_head to link resource child sibling. Just quote Rob's words as
> below. I think this could be another reason.
> 
> ~ From Rob
> The DT struct device_node also has the same tree structure with
> parent, child, sibling pointers and converting to list_head had been
> on the todo list for a while. ACPI also has some tree walking
> functions (drivers/acpi/acpica/pstree.c). Perhaps there should be a
> common tree struct and helpers defined either on top of list_head or a
> ~
> new struct if that saves some size.

Please let's get all this into the changelogs?

> > 
> > Is that sufficient?  Can we instead simplify their lives by providing
> > better documentation or informative printks or better Kconfig text,
> > etc?
> > 
> > And who *are* the people who are performing this configuration?  Random
> > system administrators?  Linux distro engineers?  If the latter then
> > they presumably aren't easily confused!
> 
> Kexec was invented for kernel developer to speed up their kernel
> rebooting. Now high end sever admin, kernel developer and QE are also
> keen to use it to reboot large box for faster feature testing, bug
> debugging. Kernel dev could know this well, about kernel loading
> position, admin or QE might not be aware of it very well. 
> 
> > 
> > In other words, I'm trying to understand how much benefit this patchset
> > will provide to our users as a whole.
> 
> Understood. The list_head replacing patch truly involes too many code
> changes, it's risky. I am willing to try any idea from reviewers, won't
> persuit they have to be accepted finally. If don't have a try, we don't
> know what it looks like, and what impact it may have. I am fine to take
> AKASHI's simple version of walk_system_ram_res_rev() to lower risk, even
> though it could be a little bit low efficient.

The larger patch produces a better result.  We can handle it ;)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [RFC PATCH v3] Xilinx AXI-Stream FIFO v4.1 IP core driver

2018-07-19 Thread Stephen Hemminger
On Thu, 19 Jul 2018 13:16:57 +0300
Dan Carpenter  wrote:

> I'm getting some compile warnings where we us %u instead of %lu for
> size_t.
> 
> We also need a README explaining what else needs to be done before this
> can be moved out of staging into the normal part of the kernel.

Use %zu to print size_t variables.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [RFC PATCH v3] Xilinx AXI-Stream FIFO v4.1 IP core driver

2018-07-19 Thread Stephen Hemminger
On Wed, 18 Jul 2018 22:46:34 -0400
Jacob Feder  wrote:

> +MODULE_DESCRIPTION("Xilinx AXI-Stream FIFO v4.1 IP core driver\n\n"
> +"This IP core has read and write AXI-Stream FIFOs, the contents of which 
> can\n"
> +"be accessed from the AXI4 memory-mapped interface. This is useful for\n"
> +"transferring data from a processor into the FPGA fabric. The driver 
> creates\n"
> +"a character device that can be read/written to with standard\n"
> +"open/read/write/close.\n\n"
> +"See Xilinx PG080 document for IP details.\n"
> +"https://www.xilinx.com/support/documentation/ip_documentation/axi_fifo_mm_s/v4_1/pg080-axi-fifo-mm-s.pdf\n\n;
> +"The driver currently supports only store-forward mode with a 32-bit\n"
> +"AXI4 Lite interface. DOES NOT support:\n"
> +"- cut-through mode\n"
> +"- AXI4 (non-lite)");

One line for MODULE_DESCRIPTION it is for the modinfo tool, not marketing or 
documentation.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v7 1/4] resource: Move reparent_resources() to kernel/resource.c and make it public

2018-07-19 Thread Baoquan He
On 07/18/18 at 07:37pm, Andy Shevchenko wrote:
> On Wed, Jul 18, 2018 at 7:36 PM, Andy Shevchenko
>  wrote:
> > On Wed, Jul 18, 2018 at 5:49 AM, Baoquan He  wrote:
> >> reparent_resources() is duplicated in arch/microblaze/pci/pci-common.c
> >> and arch/powerpc/kernel/pci-common.c, so move it to kernel/resource.c
> >> so that it's shared.
> 
> >> + * Returns 0 on success, -ENOTSUPP if child resource is not completely
> >> + * contained by 'res', -ECANCELED if no any conflicting entry found.
> 
> You also can refer to constants by prefixing them with %, e.g. %-ENOTSUPP.
> But this is up to you completely.

Thanks, will fix when repost. 

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


Re: [PATCH v7 4/4] kexec_file: Load kernel at top of system RAM if required

2018-07-19 Thread Baoquan He
Hi Andrew,

On 07/18/18 at 03:33pm, Andrew Morton wrote:
> On Wed, 18 Jul 2018 10:49:44 +0800 Baoquan He  wrote:
> 
> > For kexec_file loading, if kexec_buf.top_down is 'true', the memory which
> > is used to load kernel/initrd/purgatory is supposed to be allocated from
> > top to down. This is what we have been doing all along in the old kexec
> > loading interface and the kexec loading is still default setting in some
> > distributions. However, the current kexec_file loading interface doesn't
> > do like this. The function arch_kexec_walk_mem() it calls ignores checking
> > kexec_buf.top_down, but calls walk_system_ram_res() directly to go through
> > all resources of System RAM from bottom to up, to try to find memory region
> > which can contain the specific kexec buffer, then call 
> > locate_mem_hole_callback()
> > to allocate memory in that found memory region from top to down. This brings
> > confusion especially when KASLR is widely supported , users have to make 
> > clear
> > why kexec/kdump kernel loading position is different between these two
> > interfaces in order to exclude unnecessary noises. Hence these two 
> > interfaces
> > need be unified on behaviour.
> 
> As far as I can tell, the above is the whole reason for the patchset,
> yes?  To avoid confusing users.


In fact, it's not just trying to avoid confusing users. Kexec loading
and kexec_file loading are just do the same thing in essence. Just we
need do kernel image verification on uefi system, have to port kexec
loading code to kernel. 

Kexec has been a formal feature in our distro, and customers owning
those kind of very large machine can make use of this feature to speed
up the reboot process. On uefi machine, the kexec_file loading will
search place to put kernel under 4G from top to down. As we know, the
1st 4G space is DMA32 ZONE, dma, pci mmcfg, bios etc all try to consume
it. It may have possibility to not be able to find a usable space for
kernel/initrd. From the top down of the whole memory space, we don't
have this worry. 

And at the first post, I just posted below with AKASHI's
walk_system_ram_res_rev() version. Later you suggested to use
list_head to link child sibling of resource, see what the code change
looks like.
http://lkml.kernel.org/r/20180322033722.9279-1-...@redhat.com

Then I posted v2
http://lkml.kernel.org/r/20180408024724.16812-1-...@redhat.com
Rob Herring mentioned that other components which has this tree struct
have planned to do the same thing, replacing the singly linked list with
list_head to link resource child sibling. Just quote Rob's words as
below. I think this could be another reason.

~ From Rob
The DT struct device_node also has the same tree structure with
parent, child, sibling pointers and converting to list_head had been
on the todo list for a while. ACPI also has some tree walking
functions (drivers/acpi/acpica/pstree.c). Perhaps there should be a
common tree struct and helpers defined either on top of list_head or a
~
new struct if that saves some size.

> 
> Is that sufficient?  Can we instead simplify their lives by providing
> better documentation or informative printks or better Kconfig text,
> etc?
> 
> And who *are* the people who are performing this configuration?  Random
> system administrators?  Linux distro engineers?  If the latter then
> they presumably aren't easily confused!

Kexec was invented for kernel developer to speed up their kernel
rebooting. Now high end sever admin, kernel developer and QE are also
keen to use it to reboot large box for faster feature testing, bug
debugging. Kernel dev could know this well, about kernel loading
position, admin or QE might not be aware of it very well. 

> 
> In other words, I'm trying to understand how much benefit this patchset
> will provide to our users as a whole.

Understood. The list_head replacing patch truly involes too many code
changes, it's risky. I am willing to try any idea from reviewers, won't
persuit they have to be accepted finally. If don't have a try, we don't
know what it looks like, and what impact it may have. I am fine to take
AKASHI's simple version of walk_system_ram_res_rev() to lower risk, even
though it could be a little bit low efficient.

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


[Update PATCH V3 1/4] X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall support

2018-07-19 Thread Tianyu Lan
Hyper-V supports a pv hypercall HvFlushGuestPhysicalAddressSpace to
flush nested VM address space mapping in l1 hypervisor and it's to
reduce overhead of flushing ept tlb among vcpus. This patch is to
implement it.

Signed-off-by: Lan Tianyu 
---
Change since v3
Remove GPL boilerplate.

 arch/x86/hyperv/Makefile   |  2 +-
 arch/x86/hyperv/nested.c   | 53 ++
 arch/x86/include/asm/hyperv-tlfs.h |  8 ++
 arch/x86/include/asm/mshyperv.h|  2 ++
 4 files changed, 64 insertions(+), 1 deletion(-)
 create mode 100644 arch/x86/hyperv/nested.c

diff --git a/arch/x86/hyperv/Makefile b/arch/x86/hyperv/Makefile
index b173d404e3df..b21ee65c4101 100644
--- a/arch/x86/hyperv/Makefile
+++ b/arch/x86/hyperv/Makefile
@@ -1,2 +1,2 @@
-obj-y  := hv_init.o mmu.o
+obj-y  := hv_init.o mmu.o nested.o
 obj-$(CONFIG_X86_64)   += hv_apic.o
diff --git a/arch/x86/hyperv/nested.c b/arch/x86/hyperv/nested.c
new file mode 100644
index ..3ad9d0fdea63
--- /dev/null
+++ b/arch/x86/hyperv/nested.c
@@ -0,0 +1,53 @@
+// SPDX-License-Identifier: GPL-2.0
+
+/*
+ * Hyper-V nested virtualization code.
+ *
+ * Copyright (C) 2018, Microsoft, Inc.
+ *
+ * Author : Lan Tianyu 
+ */
+
+
+#include 
+#include 
+#include 
+#include 
+
+int hyperv_flush_guest_mapping(u64 as)
+{
+   struct hv_guest_mapping_flush **flush_pcpu;
+   struct hv_guest_mapping_flush *flush;
+   u64 status;
+   unsigned long flags;
+   int ret = -EFAULT;
+
+   if (!hv_hypercall_pg)
+   goto fault;
+
+   local_irq_save(flags);
+
+   flush_pcpu = (struct hv_guest_mapping_flush **)
+   this_cpu_ptr(hyperv_pcpu_input_arg);
+
+   flush = *flush_pcpu;
+
+   if (unlikely(!flush)) {
+   local_irq_restore(flags);
+   goto fault;
+   }
+
+   flush->address_space = as;
+   flush->flags = 0;
+
+   status = hv_do_hypercall(HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_SPACE,
+flush, NULL);
+   local_irq_restore(flags);
+
+   if (!(status & HV_HYPERCALL_RESULT_MASK))
+   ret = 0;
+
+fault:
+   return ret;
+}
+EXPORT_SYMBOL_GPL(hyperv_flush_guest_mapping);
diff --git a/arch/x86/include/asm/hyperv-tlfs.h 
b/arch/x86/include/asm/hyperv-tlfs.h
index b8c89265baf0..08e24f552030 100644
--- a/arch/x86/include/asm/hyperv-tlfs.h
+++ b/arch/x86/include/asm/hyperv-tlfs.h
@@ -309,6 +309,7 @@ struct ms_hyperv_tsc_page {
 #define HV_X64_MSR_REENLIGHTENMENT_CONTROL 0x4106
 
 /* Nested features (CPUID 0x400A) EAX */
+#define HV_X64_NESTED_GUEST_MAPPING_FLUSH  BIT(18)
 #define HV_X64_NESTED_MSR_BITMAP   BIT(19)
 
 struct hv_reenlightenment_control {
@@ -350,6 +351,7 @@ struct hv_tsc_emulation_status {
 #define HVCALL_SEND_IPI_EX 0x0015
 #define HVCALL_POST_MESSAGE0x005c
 #define HVCALL_SIGNAL_EVENT0x005d
+#define HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_SPACE 0x00af
 
 #define HV_X64_MSR_VP_ASSIST_PAGE_ENABLE   0x0001
 #define HV_X64_MSR_VP_ASSIST_PAGE_ADDRESS_SHIFT12
@@ -741,6 +743,12 @@ struct ipi_arg_ex {
struct hv_vpset vp_set;
 };
 
+/* HvFlushGuestPhysicalAddressSpace hypercalls */
+struct hv_guest_mapping_flush {
+   u64 address_space;
+   u64 flags;
+};
+
 /* HvFlushVirtualAddressSpace, HvFlushVirtualAddressList hypercalls */
 struct hv_tlb_flush {
u64 address_space;
diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index 3cd14311edfa..a6a615b49876 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -302,6 +302,7 @@ void hyperv_reenlightenment_intr(struct pt_regs *regs);
 void set_hv_tscchange_cb(void (*cb)(void));
 void clear_hv_tscchange_cb(void);
 void hyperv_stop_tsc_emulation(void);
+int hyperv_flush_guest_mapping(u64 as);
 
 #ifdef CONFIG_X86_64
 void hv_apic_init(void);
@@ -321,6 +322,7 @@ static inline struct hv_vp_assist_page 
*hv_get_vp_assist_page(unsigned int cpu)
 {
return NULL;
 }
+static inline int hyperv_flush_guest_mapping(u64 as) { return -1; }
 #endif /* CONFIG_HYPERV */
 
 #ifdef CONFIG_HYPERV_TSCPAGE
-- 
2.14.3
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH V3 1/4] X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall support

2018-07-19 Thread Thomas Gleixner
On Thu, 19 Jul 2018, Tianyu Lan wrote:
> On 7/19/2018 8:05 PM, Thomas Gleixner wrote:
> > You already have the SPDX identifier. So the GPL boilerplate is not really
> > required, unless your legal departement insist on it.
> > 
> 
> Hi Thomas:
>   Thanks for your reminder. How about the following?
> 
> 
> +// SPDX-License-Identifier: GPL-2.0
> +
> +/*
> + * Hyper-V nested virtualization code.
> + *
> + * Copyright (C) 2018, Microsoft, Inc.
> + *
> + * Author : Lan Tianyu 
> + */

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


Re: [PATCH V3 1/4] X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall support

2018-07-19 Thread Tianyu Lan
On 7/19/2018 8:05 PM, Thomas Gleixner wrote:
> On Thu, 19 Jul 2018, Tianyu Lan wrote:
>> @@ -0,0 +1,64 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +
>> +/*
>> + * Hyper-V nested virtualization code.
>> + *
>> + * Copyright (C) 2018, Microsoft, Inc.
>> + *
>> + * Author : Lan Tianyu 
>> + *
>> + * This program is free software; you can redistribute it and/or modify it
>> + * under the terms of the GNU General Public License version 2 as published
>> + * by the Free Software Foundation.
>> + *
>> + * This program is distributed in the hope that it will be useful, but
>> + * WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
>> + * NON INFRINGEMENT.  See the GNU General Public License for more
>> + * details.
> 
> You already have the SPDX identifier. So the GPL boilerplate is not really
> required, unless your legal departement insist on it.
> 

Hi Thomas:
Thanks for your reminder. How about the following?


+// SPDX-License-Identifier: GPL-2.0
+
+/*
+ * Hyper-V nested virtualization code.
+ *
+ * Copyright (C) 2018, Microsoft, Inc.
+ *
+ * Author : Lan Tianyu 
+ */

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


Re: [PATCH V3 1/4] X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall support

2018-07-19 Thread Thomas Gleixner
On Thu, 19 Jul 2018, Tianyu Lan wrote:
> @@ -0,0 +1,64 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +/*
> + * Hyper-V nested virtualization code.
> + *
> + * Copyright (C) 2018, Microsoft, Inc.
> + *
> + * Author : Lan Tianyu 
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License version 2 as published
> + * by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
> + * NON INFRINGEMENT.  See the GNU General Public License for more
> + * details.

You already have the SPDX identifier. So the GPL boilerplate is not really
required, unless your legal departement insist on it.

Thanks,

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


Re: [RFC PATCH v3] Xilinx AXI-Stream FIFO v4.1 IP core driver

2018-07-19 Thread Dan Carpenter
I'm getting some compile warnings where we us %u instead of %lu for
size_t.

We also need a README explaining what else needs to be done before this
can be moved out of staging into the normal part of the kernel.

On Wed, Jul 18, 2018 at 10:46:34PM -0400, Jacob Feder wrote:
> I hope I did the Makefile/Kconfig corretly :)
> 
> Thanks for all the feedback.
> 
> Cheers,
> Jacob
> 

These sorts of meta commentary go under the --- cut off line

> 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.
> 
> https://www.xilinx.com/support/documentation/ip_documentation/axi_fifo_mm_s/v4_1/pg080-axi-fifo-mm-s.pdf
> 
> The driver currently supports only store-forward mode with a 32-bit
> AXI4 Lite interface. DOES NOT support:
> - cut-through mode
> - AXI4 (non-lite)
^^
This kind of information is useful, but it's not really a requirement
for being removed out of staging.  The code quality is OK to me
generally, but I'm not qualified to talk about big picture user API
stuff or very subsystem specific requirements.

> 
> Signed-off-by: Jacob Feder 
> ---
  ^^^

Here is the cut off line.  That way they aren't added to the kernel git
log.

>  drivers/staging/axisfifo/Kconfig  |9 +
>  drivers/staging/axisfifo/Makefile |1 +
>  drivers/staging/axisfifo/axis-fifo.c  | 1125 
> +
>  drivers/staging/axisfifo/axisfifo.txt |   89 +++
>  4 files changed, 1224 insertions(+)
>  create mode 100644 drivers/staging/axisfifo/Kconfig
>  create mode 100644 drivers/staging/axisfifo/Makefile
>  create mode 100644 drivers/staging/axisfifo/axis-fifo.c
>  create mode 100644 drivers/staging/axisfifo/axisfifo.txt
> 
> diff --git a/drivers/staging/axisfifo/Kconfig 
> b/drivers/staging/axisfifo/Kconfig
> new file mode 100644
> index 000..5ad68bf
> --- /dev/null
> +++ b/drivers/staging/axisfifo/Kconfig
> @@ -0,0 +1,9 @@
> +#
> +# "Xilinx AXI-Stream FIFO IP core driver"
> +#
> +config XIL_AXISFIFO
> + tristate "Xilinx AXI-Stream FIFO IP core driver"
> + default n
> + help
> +   This adds support for the Xilinx AXI-Stream
> +   FIFO IP core driver.


You also need to add yourself to drivers/staging/Kconfig,Makefile.  Use
make menuconfig to enable it and do a build.

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


Re: [PATCH 17/32] staging: gasket: annotate ioctl arg with __user

2018-07-19 Thread Greg Kroah-Hartman
On Tue, Jul 17, 2018 at 01:56:57PM -0700, Todd Poynor wrote:
> From: Todd Poynor 
> 
> For sparse checking.

Close, but you can do better :)

> 
> Reported-by: Dmitry Torokhov 
> Signed-off-by: Zhongze Hu 
> Signed-off-by: Todd Poynor 
> Reviewed-by: Dmitry Torokhov 
> ---
>  drivers/staging/gasket/apex_driver.c  | 11 ++--
>  drivers/staging/gasket/gasket_core.c  |  6 ++-
>  drivers/staging/gasket/gasket_core.h  |  4 +-
>  drivers/staging/gasket/gasket_ioctl.c | 72 ++-
>  drivers/staging/gasket/gasket_ioctl.h |  4 +-
>  5 files changed, 52 insertions(+), 45 deletions(-)
> 
> diff --git a/drivers/staging/gasket/apex_driver.c 
> b/drivers/staging/gasket/apex_driver.c
> index 612b3ab803196..c91c5aff5ab9c 100644
> --- a/drivers/staging/gasket/apex_driver.c
> +++ b/drivers/staging/gasket/apex_driver.c
> @@ -5,6 +5,7 @@
>   * Copyright (C) 2018 Google, Inc.
>   */
>  
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -142,9 +143,9 @@ static int apex_get_status(struct gasket_dev *gasket_dev);
>  
>  static uint apex_ioctl_check_permissions(struct file *file, uint cmd);
>  
> -static long apex_ioctl(struct file *file, uint cmd, ulong arg);
> +static long apex_ioctl(struct file *file, uint cmd, void __user *arg);
> 
> -static long apex_clock_gating(struct gasket_dev *gasket_dev, ulong arg);
> +static long apex_clock_gating(struct gasket_dev *gasket_dev, void __user 
> *arg);

Make this a __user pointer to the correct struct type you are handling
here.  You know what the type is, use it.

>  static int apex_enter_reset(struct gasket_dev *gasket_dev, uint type);
>  
> @@ -635,7 +636,7 @@ static uint apex_ioctl_check_permissions(struct file 
> *filp, uint cmd)
>  /*
>   * Apex-specific ioctl handler.
>   */
> -static long apex_ioctl(struct file *filp, uint cmd, ulong arg)
> +static long apex_ioctl(struct file *filp, uint cmd, void __user *arg)
>  {
>   struct gasket_dev *gasket_dev = filp->private_data;
>  
> @@ -655,7 +656,7 @@ static long apex_ioctl(struct file *filp, uint cmd, ulong 
> arg)
>   * @gasket_dev: Gasket device pointer.
>   * @arg: User ioctl arg, in this case to a apex_gate_clock_ioctl struct.
>   */
> -static long apex_clock_gating(struct gasket_dev *gasket_dev, ulong arg)
> +static long apex_clock_gating(struct gasket_dev *gasket_dev, void __user 
> *arg)

As above, this should be a different type.

>  {
>   struct apex_gate_clock_ioctl ibuf;
>  
> @@ -663,7 +664,7 @@ static long apex_clock_gating(struct gasket_dev 
> *gasket_dev, ulong arg)
>   return 0;
>  
>   if (allow_sw_clock_gating) {
> - if (copy_from_user(, (void __user *)arg, sizeof(ibuf)))
> + if (copy_from_user(, arg, sizeof(ibuf)))
>   return -EFAULT;
>  
>   gasket_log_error(
> diff --git a/drivers/staging/gasket/gasket_core.c 
> b/drivers/staging/gasket/gasket_core.c
> index 947b4fcc76970..ff34af42bbe7c 100644
> --- a/drivers/staging/gasket/gasket_core.c
> +++ b/drivers/staging/gasket/gasket_core.c
> @@ -14,6 +14,7 @@
>  #include "gasket_page_table.h"
>  #include "gasket_sysfs.h"
>  
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -1823,14 +1824,15 @@ static long gasket_ioctl(struct file *filp, uint cmd, 
> ulong arg)
>* check_and_invoke_callback.
>*/
>   if (driver_desc->ioctl_handler_cb)
> - return driver_desc->ioctl_handler_cb(filp, cmd, arg);
> + return driver_desc->ioctl_handler_cb(
> + filp, cmd, (void __user *)arg);

You can use a temp variable and then only have to cast things once then,
instead of twice, if you care.  Not a big deal.

>  
>   gasket_log_error(
>   gasket_dev, "Received unknown ioctl 0x%x", cmd);

This is a fun way to cause a DoS on your system, you should fix this up
in later changes.

>   return -EINVAL;
>   }
>  
> - return gasket_handle_ioctl(filp, cmd, arg);
> + return gasket_handle_ioctl(filp, cmd, (void __user *)arg);
>  }
>  
>  int gasket_reset(struct gasket_dev *gasket_dev, uint reset_type)
> diff --git a/drivers/staging/gasket/gasket_core.h 
> b/drivers/staging/gasket/gasket_core.h
> index 50ad0c8853183..68b4d2ac9fd6c 100644
> --- a/drivers/staging/gasket/gasket_core.h
> +++ b/drivers/staging/gasket/gasket_core.h
> @@ -315,7 +315,7 @@ struct gasket_dev {
>  
>  /* Type of the ioctl permissions check callback. See below. */
>  typedef int (*gasket_ioctl_permissions_cb_t)(
> - struct file *filp, uint cmd, ulong arg);
> + struct file *filp, uint cmd, void __user *arg);
>  
>  /*
>   * Device type descriptor.
> @@ -549,7 +549,7 @@ struct gasket_driver_desc {
>* return -EINVAL. Should return an error status (either -EINVAL or
>* the error result of the ioctl being handled).
>*/
> - long (*ioctl_handler_cb)(struct file *filp, uint cmd, ulong arg);
> + long (*ioctl_handler_cb)(struct file 

Re: [PATCH V3 0/4] KVM/x86/hyper-V: Introduce PV guest address space mapping flush support

2018-07-19 Thread Tianyu Lan
On 7/19/2018 4:57 PM, Paolo Bonzini wrote:
> On 19/07/2018 10:39, Tianyu Lan wrote:
>> Hyper-V provides a para-virtualization hypercall 
>> HvFlushGuestPhysicalAddressSpace
>> to flush nested VM address space mapping in l1 hypervisor and it's to reduce 
>> overhead
>> of flushing ept tlb among vcpus. The tradition way is to send IPIs to all 
>> affected
>> vcpus and executes INVEPT on each vcpus. It will trigger several vmexits for 
>> IPI and
>> INVEPT emulation. The pv hypercall can help to flush specified ept table on 
>> all vcpus
>> via one single hypercall.
> 
> Thanks, this looks good apart from a global replace of EFAULT with
> ENOTSUP (which can be done when applying).  Can I have an explicit ack
> for patches 1 and 2 from the Hyper-V people?

Thanks, Paolo. I will try to hyper-V people's ack.

> 
> Thanks,
> 
> Paolo
> 
>> Change since v2:
>> - Make ept_pointers_match as tristate "check", "match" and 
>> "mismatch".
>> Set "check" in vmx_set_cr3(), check all ept table pointers in 
>> hv_remote_flush_tlb()
>> and call hypercall when all ept pointers are same.
>> - Rename kvm_arch_hv_flush_remote_tlb with kvm_arch_flush_remote_tlb 
>> and
>> Rename kvm_x86_ops->hv_tlb_remote_flush with 
>> kvm_x86_ops->tlb_remote_flush
>> - Fix issue that ignore updating tlbs_dirty during calling 
>> kvm_arch_flush_remote_tlbs()
>> - Merge patch "KVM/VMX: Add identical ept table pointer check" and
>> patch "KVM/x86: Add tlb_remote_flush callback support for vmx"
>>
>> Change since v1:
>> - Fix compilation error for non-x86 platform.
>> - Use ept_pointers_match to check condition of identical ept
>>  table pointer and get ept pointer from struct 
>> vcpu_vmx->ept_pointer.
>> - Add hyperv_nested_flush_guest_mapping ftrace support
>>  
>>
>>
>> Lan Tianyu (4):
>>X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall
>>  support
>>X86/Hyper-V: Add hyperv_nested_flush_guest_mapping ftrace support
>>KVM: Add tlb remote flush callback in kvm_x86_ops.
>>KVM/x86: Add tlb_remote_flush callback support for vmx
>>
>>   arch/x86/hyperv/Makefile|  2 +-
>>   arch/x86/hyperv/nested.c| 67 ++
>>   arch/x86/include/asm/hyperv-tlfs.h  |  8 +
>>   arch/x86/include/asm/kvm_host.h | 11 ++
>>   arch/x86/include/asm/mshyperv.h |  2 ++
>>   arch/x86/include/asm/trace/hyperv.h | 14 
>>   arch/x86/kvm/vmx.c  | 72 
>> -
>>   include/linux/kvm_host.h|  7 
>>   virt/kvm/kvm_main.c |  3 +-
>>   9 files changed, 183 insertions(+), 3 deletions(-)
>>   create mode 100644 arch/x86/hyperv/nested.c
>>
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 16/32] staging: gasket: always allow root open for write

2018-07-19 Thread Greg Kroah-Hartman
On Tue, Jul 17, 2018 at 01:56:56PM -0700, Todd Poynor wrote:
> From: Todd Poynor 
> 
> Always allow root to open device for writing.
> 
> Drop special-casing of ioctl permissions for root vs. owner.
> 
> Reported-by: Dmitry Torokhov 
> Signed-off-by: Zhongze Hu 
> Signed-off-by: Todd Poynor 
> ---
>  drivers/staging/gasket/apex_driver.c  |  9 +
>  drivers/staging/gasket/gasket_core.c  |  8 +---
>  drivers/staging/gasket/gasket_ioctl.c | 19 ---
>  3 files changed, 14 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/staging/gasket/apex_driver.c 
> b/drivers/staging/gasket/apex_driver.c
> index 3a83c3d4d5561..612b3ab803196 100644
> --- a/drivers/staging/gasket/apex_driver.c
> +++ b/drivers/staging/gasket/apex_driver.c
> @@ -629,14 +629,7 @@ static bool is_gcb_in_reset(struct gasket_dev 
> *gasket_dev)
>   */
>  static uint apex_ioctl_check_permissions(struct file *filp, uint cmd)
>  {
> - struct gasket_dev *gasket_dev = filp->private_data;
> - int root = capable(CAP_SYS_ADMIN);
> - int is_owner = gasket_dev->dev_info.ownership.is_owned &&
> -current->tgid == gasket_dev->dev_info.ownership.owner;
> -
> - if (root || is_owner)
> - return 1;
> - return 0;
> + return !!(filp->f_mode & FMODE_WRITE);

Shouldn't this return a boolean instead of uint?

>  }
>  
>  /*
> diff --git a/drivers/staging/gasket/gasket_core.c 
> b/drivers/staging/gasket/gasket_core.c
> index 0d5ba7359af73..947b4fcc76970 100644
> --- a/drivers/staging/gasket/gasket_core.c
> +++ b/drivers/staging/gasket/gasket_core.c
> @@ -1085,6 +1085,7 @@ static int gasket_open(struct inode *inode, struct file 
> *filp)
>   char task_name[TASK_COMM_LEN];
>   struct gasket_cdev_info *dev_info =
>   container_of(inode->i_cdev, struct gasket_cdev_info, cdev);
> + int is_root = capable(CAP_SYS_ADMIN);
>  
>   gasket_dev = dev_info->gasket_dev_ptr;
>   driver_desc = gasket_dev->internal_desc->driver_desc;
> @@ -1098,7 +1099,7 @@ static int gasket_open(struct inode *inode, struct file 
> *filp)
>   "Attempting to open with tgid %u (%s) (f_mode: 0%03o, "
>   "fmode_write: %d is_root: %u)",
>   current->tgid, task_name, filp->f_mode,
> - (filp->f_mode & FMODE_WRITE), capable(CAP_SYS_ADMIN));
> + (filp->f_mode & FMODE_WRITE), is_root);
>  
>   /* Always allow non-writing accesses. */
>   if (!(filp->f_mode & FMODE_WRITE)) {
> @@ -1112,8 +1113,9 @@ static int gasket_open(struct inode *inode, struct file 
> *filp)
>   gasket_dev, "Current owner open count (owning tgid %u): %d.",
>   ownership->owner, ownership->write_open_count);
>  
> - /* Opening a node owned by another TGID is an error (even root.) */
> - if (ownership->is_owned && ownership->owner != current->tgid) {
> + /* Opening a node owned by another TGID is an error (unless root) */
> + if (ownership->is_owned && ownership->owner != current->tgid &&
> + !is_root) {
>   gasket_log_error(
>   gasket_dev,
>   "Process %u is opening a node held by %u.",
> diff --git a/drivers/staging/gasket/gasket_ioctl.c 
> b/drivers/staging/gasket/gasket_ioctl.c
> index 0c2f85cf54480..d0fa05b8bf1d3 100644
> --- a/drivers/staging/gasket/gasket_ioctl.c
> +++ b/drivers/staging/gasket/gasket_ioctl.c
> @@ -171,7 +171,7 @@ long gasket_is_supported_ioctl(uint cmd)
>   */
>  static uint gasket_ioctl_check_permissions(struct file *filp, uint cmd)
>  {

Also return bool?

> - uint alive, root, device_owner;
> + uint alive;
>   fmode_t read, write;
>   struct gasket_dev *gasket_dev = (struct gasket_dev *)filp->private_data;
>  
> @@ -183,33 +183,30 @@ static uint gasket_ioctl_check_permissions(struct file 
> *filp, uint cmd)
>   alive, gasket_dev->status);
>   }
>  
> - root = capable(CAP_SYS_ADMIN);
> - read = filp->f_mode & FMODE_READ;
> - write = filp->f_mode & FMODE_WRITE;
> - device_owner = (gasket_dev->dev_info.ownership.is_owned &&
> - current->tgid == gasket_dev->dev_info.ownership.owner);
> + read = !!(filp->f_mode & FMODE_READ);
> + write = !!(filp->f_mode & FMODE_WRITE);

These should be bool as well, right?

I'll drop this patch, thanks.

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


Re: [PATCH 05/23] staging: wilc1000: rename goto to avoid leading '_' in label name

2018-07-19 Thread Dan Carpenter
On Thu, Jul 19, 2018 at 04:15:01AM +0530, Ajay Singh wrote:
> diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
> b/drivers/staging/wilc1000/wilc_wlan.c
> index 85af365..8e71c28 100644
> --- a/drivers/staging/wilc1000/wilc_wlan.c
> +++ b/drivers/staging/wilc1000/wilc_wlan.c
> @@ -850,13 +850,13 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, 
> u32 int_status)
>   if (wilc->rx_buffer)
>   buffer = >rx_buffer[offset];
>   else
> - goto _end_;
> + goto end;

This isn't related to your patch but this goto doesn't appear to make
any sort of sense.  I have no idea what was intended.

>  
>   wilc->hif_func->hif_clear_int_ext(wilc,
> DATA_INT_CLR | ENABLE_RX_VMM);
>   ret = wilc->hif_func->hif_block_rx_ext(wilc, 0, buffer, size);
>  
> -_end_:
> +end:
>   if (ret) {
>   offset += size;
>   wilc->rx_buffer_offset = offset;

regards,
dan carpenter

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


Re: [PATCH 01/32] staging: gasket: remove X86 Kconfig restriction

2018-07-19 Thread Greg Kroah-Hartman
On Mon, Jul 16, 2018 at 07:08:55PM -0700, Todd Poynor wrote:
> From: Todd Poynor 
> 
> The gasket and apex drivers are to be used on other architectures
> besides X86.
> 
> Signed-off-by: Todd Poynor 
> ---
>  drivers/staging/gasket/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/gasket/Kconfig b/drivers/staging/gasket/Kconfig
> index c836389c1402d..ef40c4c75e0f2 100644
> --- a/drivers/staging/gasket/Kconfig
> +++ b/drivers/staging/gasket/Kconfig
> @@ -2,7 +2,7 @@ menu "Gasket devices"
>  
>  config STAGING_GASKET_FRAMEWORK
>   tristate "Gasket framework"
> - depends on PCI && X86_64
> + depends on PCI

I was waiting to see how badly 0-day barfed on this one, now dropping it
from my queue :)

thanks,

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


Re: [PATCH V3 0/4] KVM/x86/hyper-V: Introduce PV guest address space mapping flush support

2018-07-19 Thread Paolo Bonzini
On 19/07/2018 10:39, Tianyu Lan wrote:
> Hyper-V provides a para-virtualization hypercall 
> HvFlushGuestPhysicalAddressSpace
> to flush nested VM address space mapping in l1 hypervisor and it's to reduce 
> overhead
> of flushing ept tlb among vcpus. The tradition way is to send IPIs to all 
> affected
> vcpus and executes INVEPT on each vcpus. It will trigger several vmexits for 
> IPI and
> INVEPT emulation. The pv hypercall can help to flush specified ept table on 
> all vcpus
> via one single hypercall.

Thanks, this looks good apart from a global replace of EFAULT with
ENOTSUP (which can be done when applying).  Can I have an explicit ack
for patches 1 and 2 from the Hyper-V people?

Thanks,

Paolo

> Change since v2:
>- Make ept_pointers_match as tristate "check", "match" and "mismatch".
>Set "check" in vmx_set_cr3(), check all ept table pointers in 
> hv_remote_flush_tlb()
>and call hypercall when all ept pointers are same.
>- Rename kvm_arch_hv_flush_remote_tlb with kvm_arch_flush_remote_tlb 
> and
>Rename kvm_x86_ops->hv_tlb_remote_flush with 
> kvm_x86_ops->tlb_remote_flush
>- Fix issue that ignore updating tlbs_dirty during calling 
> kvm_arch_flush_remote_tlbs()
>- Merge patch "KVM/VMX: Add identical ept table pointer check" and
>patch "KVM/x86: Add tlb_remote_flush callback support for vmx"
> 
> Change since v1:
>- Fix compilation error for non-x86 platform.
>- Use ept_pointers_match to check condition of identical ept
> table pointer and get ept pointer from struct 
> vcpu_vmx->ept_pointer.
>- Add hyperv_nested_flush_guest_mapping ftrace support
>
> 
> 
> Lan Tianyu (4):
>   X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall
> support
>   X86/Hyper-V: Add hyperv_nested_flush_guest_mapping ftrace support
>   KVM: Add tlb remote flush callback in kvm_x86_ops.
>   KVM/x86: Add tlb_remote_flush callback support for vmx
> 
>  arch/x86/hyperv/Makefile|  2 +-
>  arch/x86/hyperv/nested.c| 67 ++
>  arch/x86/include/asm/hyperv-tlfs.h  |  8 +
>  arch/x86/include/asm/kvm_host.h | 11 ++
>  arch/x86/include/asm/mshyperv.h |  2 ++
>  arch/x86/include/asm/trace/hyperv.h | 14 
>  arch/x86/kvm/vmx.c  | 72 
> -
>  include/linux/kvm_host.h|  7 
>  virt/kvm/kvm_main.c |  3 +-
>  9 files changed, 183 insertions(+), 3 deletions(-)
>  create mode 100644 arch/x86/hyperv/nested.c
> 

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


[PATCH V3 0/4] KVM/x86/hyper-V: Introduce PV guest address space mapping flush support

2018-07-19 Thread Tianyu Lan
Hyper-V provides a para-virtualization hypercall 
HvFlushGuestPhysicalAddressSpace
to flush nested VM address space mapping in l1 hypervisor and it's to reduce 
overhead
of flushing ept tlb among vcpus. The tradition way is to send IPIs to all 
affected
vcpus and executes INVEPT on each vcpus. It will trigger several vmexits for 
IPI and
INVEPT emulation. The pv hypercall can help to flush specified ept table on all 
vcpus
via one single hypercall.

Change since v2:
   - Make ept_pointers_match as tristate "check", "match" and "mismatch".
   Set "check" in vmx_set_cr3(), check all ept table pointers in 
hv_remote_flush_tlb()
   and call hypercall when all ept pointers are same.
   - Rename kvm_arch_hv_flush_remote_tlb with kvm_arch_flush_remote_tlb and
   Rename kvm_x86_ops->hv_tlb_remote_flush with 
kvm_x86_ops->tlb_remote_flush
   - Fix issue that ignore updating tlbs_dirty during calling 
kvm_arch_flush_remote_tlbs()
   - Merge patch "KVM/VMX: Add identical ept table pointer check" and
   patch "KVM/x86: Add tlb_remote_flush callback support for vmx"

Change since v1:
   - Fix compilation error for non-x86 platform.
   - Use ept_pointers_match to check condition of identical ept
table pointer and get ept pointer from struct vcpu_vmx->ept_pointer.
   - Add hyperv_nested_flush_guest_mapping ftrace support
 


Lan Tianyu (4):
  X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall
support
  X86/Hyper-V: Add hyperv_nested_flush_guest_mapping ftrace support
  KVM: Add tlb remote flush callback in kvm_x86_ops.
  KVM/x86: Add tlb_remote_flush callback support for vmx

 arch/x86/hyperv/Makefile|  2 +-
 arch/x86/hyperv/nested.c| 67 ++
 arch/x86/include/asm/hyperv-tlfs.h  |  8 +
 arch/x86/include/asm/kvm_host.h | 11 ++
 arch/x86/include/asm/mshyperv.h |  2 ++
 arch/x86/include/asm/trace/hyperv.h | 14 
 arch/x86/kvm/vmx.c  | 72 -
 include/linux/kvm_host.h|  7 
 virt/kvm/kvm_main.c |  3 +-
 9 files changed, 183 insertions(+), 3 deletions(-)
 create mode 100644 arch/x86/hyperv/nested.c

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


[PATCH V3 2/4] X86/Hyper-V: Add hyperv_nested_flush_guest_mapping ftrace support

2018-07-19 Thread Tianyu Lan
This patch is to add hyperv_nested_flush_guest_mapping support to trace
hvFlushGuestPhysicalAddressSpace hypercall.

Signed-off-by: Lan Tianyu 
---
 arch/x86/hyperv/nested.c|  3 +++
 arch/x86/include/asm/trace/hyperv.h | 14 ++
 2 files changed, 17 insertions(+)

diff --git a/arch/x86/hyperv/nested.c b/arch/x86/hyperv/nested.c
index 74dd38b5221d..42a3232f2835 100644
--- a/arch/x86/hyperv/nested.c
+++ b/arch/x86/hyperv/nested.c
@@ -25,6 +25,8 @@
 #include 
 #include 
 
+#include 
+
 int hyperv_flush_guest_mapping(u64 as)
 {
struct hv_guest_mapping_flush **flush_pcpu;
@@ -59,6 +61,7 @@ int hyperv_flush_guest_mapping(u64 as)
ret = 0;
 
 fault:
+   trace_hyperv_nested_flush_guest_mapping(as, ret);
return ret;
 }
 EXPORT_SYMBOL_GPL(hyperv_flush_guest_mapping);
diff --git a/arch/x86/include/asm/trace/hyperv.h 
b/arch/x86/include/asm/trace/hyperv.h
index 4253bca99989..e1ffe61de8d6 100644
--- a/arch/x86/include/asm/trace/hyperv.h
+++ b/arch/x86/include/asm/trace/hyperv.h
@@ -28,6 +28,20 @@ TRACE_EVENT(hyperv_mmu_flush_tlb_others,
  __entry->addr, __entry->end)
);
 
+TRACE_EVENT(hyperv_nested_flush_guest_mapping,
+   TP_PROTO(u64 as, int ret),
+   TP_ARGS(as, ret),
+
+   TP_STRUCT__entry(
+   __field(u64, as)
+   __field(int, ret)
+   ),
+   TP_fast_assign(__entry->as = as;
+  __entry->ret = ret;
+   ),
+   TP_printk("address space %llx ret %d", __entry->as, __entry->ret)
+   );
+
 #endif /* CONFIG_HYPERV */
 
 #undef TRACE_INCLUDE_PATH
-- 
2.14.3
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V3 1/4] X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall support

2018-07-19 Thread Tianyu Lan
Hyper-V supports a pv hypercall HvFlushGuestPhysicalAddressSpace to
flush nested VM address space mapping in l1 hypervisor and it's to
reduce overhead of flushing ept tlb among vcpus. This patch is to
implement it.

Signed-off-by: Lan Tianyu 
---
 arch/x86/hyperv/Makefile   |  2 +-
 arch/x86/hyperv/nested.c   | 64 ++
 arch/x86/include/asm/hyperv-tlfs.h |  8 +
 arch/x86/include/asm/mshyperv.h|  2 ++
 4 files changed, 75 insertions(+), 1 deletion(-)
 create mode 100644 arch/x86/hyperv/nested.c

diff --git a/arch/x86/hyperv/Makefile b/arch/x86/hyperv/Makefile
index b173d404e3df..b21ee65c4101 100644
--- a/arch/x86/hyperv/Makefile
+++ b/arch/x86/hyperv/Makefile
@@ -1,2 +1,2 @@
-obj-y  := hv_init.o mmu.o
+obj-y  := hv_init.o mmu.o nested.o
 obj-$(CONFIG_X86_64)   += hv_apic.o
diff --git a/arch/x86/hyperv/nested.c b/arch/x86/hyperv/nested.c
new file mode 100644
index ..74dd38b5221d
--- /dev/null
+++ b/arch/x86/hyperv/nested.c
@@ -0,0 +1,64 @@
+// SPDX-License-Identifier: GPL-2.0
+
+/*
+ * Hyper-V nested virtualization code.
+ *
+ * Copyright (C) 2018, Microsoft, Inc.
+ *
+ * Author : Lan Tianyu 
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
+ * NON INFRINGEMENT.  See the GNU General Public License for more
+ * details.
+ *
+ */
+
+
+#include 
+#include 
+#include 
+#include 
+
+int hyperv_flush_guest_mapping(u64 as)
+{
+   struct hv_guest_mapping_flush **flush_pcpu;
+   struct hv_guest_mapping_flush *flush;
+   u64 status;
+   unsigned long flags;
+   int ret = -EFAULT;
+
+   if (!hv_hypercall_pg)
+   goto fault;
+
+   local_irq_save(flags);
+
+   flush_pcpu = (struct hv_guest_mapping_flush **)
+   this_cpu_ptr(hyperv_pcpu_input_arg);
+
+   flush = *flush_pcpu;
+
+   if (unlikely(!flush)) {
+   local_irq_restore(flags);
+   goto fault;
+   }
+
+   flush->address_space = as;
+   flush->flags = 0;
+
+   status = hv_do_hypercall(HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_SPACE,
+flush, NULL);
+   local_irq_restore(flags);
+
+   if (!(status & HV_HYPERCALL_RESULT_MASK))
+   ret = 0;
+
+fault:
+   return ret;
+}
+EXPORT_SYMBOL_GPL(hyperv_flush_guest_mapping);
diff --git a/arch/x86/include/asm/hyperv-tlfs.h 
b/arch/x86/include/asm/hyperv-tlfs.h
index b8c89265baf0..08e24f552030 100644
--- a/arch/x86/include/asm/hyperv-tlfs.h
+++ b/arch/x86/include/asm/hyperv-tlfs.h
@@ -309,6 +309,7 @@ struct ms_hyperv_tsc_page {
 #define HV_X64_MSR_REENLIGHTENMENT_CONTROL 0x4106
 
 /* Nested features (CPUID 0x400A) EAX */
+#define HV_X64_NESTED_GUEST_MAPPING_FLUSH  BIT(18)
 #define HV_X64_NESTED_MSR_BITMAP   BIT(19)
 
 struct hv_reenlightenment_control {
@@ -350,6 +351,7 @@ struct hv_tsc_emulation_status {
 #define HVCALL_SEND_IPI_EX 0x0015
 #define HVCALL_POST_MESSAGE0x005c
 #define HVCALL_SIGNAL_EVENT0x005d
+#define HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_SPACE 0x00af
 
 #define HV_X64_MSR_VP_ASSIST_PAGE_ENABLE   0x0001
 #define HV_X64_MSR_VP_ASSIST_PAGE_ADDRESS_SHIFT12
@@ -741,6 +743,12 @@ struct ipi_arg_ex {
struct hv_vpset vp_set;
 };
 
+/* HvFlushGuestPhysicalAddressSpace hypercalls */
+struct hv_guest_mapping_flush {
+   u64 address_space;
+   u64 flags;
+};
+
 /* HvFlushVirtualAddressSpace, HvFlushVirtualAddressList hypercalls */
 struct hv_tlb_flush {
u64 address_space;
diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index 3cd14311edfa..a6a615b49876 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -302,6 +302,7 @@ void hyperv_reenlightenment_intr(struct pt_regs *regs);
 void set_hv_tscchange_cb(void (*cb)(void));
 void clear_hv_tscchange_cb(void);
 void hyperv_stop_tsc_emulation(void);
+int hyperv_flush_guest_mapping(u64 as);
 
 #ifdef CONFIG_X86_64
 void hv_apic_init(void);
@@ -321,6 +322,7 @@ static inline struct hv_vp_assist_page 
*hv_get_vp_assist_page(unsigned int cpu)
 {
return NULL;
 }
+static inline int hyperv_flush_guest_mapping(u64 as) { return -1; }
 #endif /* CONFIG_HYPERV */
 
 #ifdef CONFIG_HYPERV_TSCPAGE
-- 
2.14.3
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style

2018-07-19 Thread Claudiu Beznea
Reviewed-by: Claudiu Beznea 


On 19.07.2018 01:44, Ajay Singh wrote:
> This patch series contains modification to follow Linux coding style &
> cleanup change to remove unused variables and enums.
> Few patches also contain changes to remove unnecessary typecast.
> 
> Ajay Singh (23):
>   staging: wilc1000: remove unused enum declaration
>   staging: wilc1000: remove enum connect_status instead use
> ieee80211_statuscode
>   staging: wilc1000: remove extra enum defined for data rates
>   staging: wilc1000: remove extra enums defined for ieee80211_eid
>   staging: wilc1000: rename goto to avoid leading '_' in label name
>   staging: wilc1000: rename enum CURRENT_TXRATE to use lowercase
>   staging: wilc1000: rename enum SITESURVEY to use lowercase
>   staging: wilc1000: rename enum AUTHTYPE to use lowercase
>   staging: wilc1000: remove unused elements in 'wilc' struct
>   staging: wilc1000: remove unnecessary elements from 'wilc_priv' struct
>   staging: wilc1000: removed unused element from wilc_cfg_frame struct
>   staging: wilc1000: remove the mutliple #define used for same macro
>   staging: wilc1000: use lowercase for 'IFC_UP' struct element name
>   staging: wilc1000: remove unnecessary blank line between variable
> declaration
>   staging: wilc1000: use single space before opening brances '{'
>   staging: wilc1000: remove unnecessary type used for wid id
>   staging: wilc1000: avoid forward declaration for handle_scan_done()
>   staging: wilc1000: avoid host_int_get_assoc_res_info() forward
> declaration
>   staging: wilc1000: avoid forward declaration of
> host_int_parse_join_bss_param()
>   staging: wilc1000: avoid setting default value for variable at
> declaration
>   staging: wilc1000: use 'int' inplace of 's32' date type
>   staging: wilc1000: remove unnecessary 'NULL' check from cfg80211_ops
> callbacks
>   staging: wilc1000: move variable assignment along with its declaration
> 
>  drivers/staging/wilc1000/coreconfigurator.c   |  84 +--
>  drivers/staging/wilc1000/coreconfigurator.h   |  20 -
>  drivers/staging/wilc1000/host_interface.c | 696 
> +++---
>  drivers/staging/wilc1000/host_interface.h |  20 +-
>  drivers/staging/wilc1000/linux_mon.c  |   2 -
>  drivers/staging/wilc1000/linux_wlan.c | 122 ++--
>  drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 307 +++---
>  drivers/staging/wilc1000/wilc_wfi_netdevice.h |  16 +-
>  drivers/staging/wilc1000/wilc_wlan.c  |  65 +-
>  drivers/staging/wilc1000/wilc_wlan.h  |   3 -
>  drivers/staging/wilc1000/wilc_wlan_if.h   |  56 +-
>  11 files changed, 517 insertions(+), 874 deletions(-)
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 21/23] staging: wilc1000: use 'int' inplace of 's32' date type

2018-07-19 Thread Ajay Singh
Cleanup patch to use 'int' instead of 's32' to have the same data type
based on its usage.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 48 +++
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 28 ++---
 2 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index d251a64..fb063e5 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -722,9 +722,9 @@ static void handle_cfg_param(struct work_struct *work)
kfree(msg);
 }
 
-static s32 handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
+static int handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
 {
-   s32 result = 0;
+   int result = 0;
u8 abort_running_scan;
struct wid wid;
struct host_if_drv *hif_drv = vif->hif_drv;
@@ -765,7 +765,7 @@ static void handle_scan(struct work_struct *work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct scan_attr *scan_info = >body.scan_info;
-   s32 result = 0;
+   int result = 0;
struct wid wid_list[5];
u32 index = 0;
u32 i;
@@ -883,7 +883,7 @@ static void handle_connect(struct work_struct *work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct connect_attr *conn_attr = >body.con_info;
-   s32 result = 0;
+   int result = 0;
struct wid wid_list[8];
u32 wid_cnt = 0, dummyval = 0;
u8 *cur_byte = NULL;
@@ -1148,7 +1148,7 @@ static void handle_connect_timeout(struct work_struct 
*work)
 {
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
-   s32 result;
+   int result;
struct connect_info info;
struct wid wid;
u16 dummy_reason_code = 0;
@@ -1454,7 +1454,7 @@ static s32 host_int_get_assoc_res_info(struct wilc_vif 
*vif,
   u32 max_assoc_resp_info_len,
   u32 *rcvd_assoc_resp_info_len)
 {
-   s32 result;
+   int result;
struct wid wid;
 
wid.id = WID_ASSOC_RES_INFO;
@@ -1926,7 +1926,7 @@ static void handle_disconnect(struct work_struct *work)
struct disconnect_info disconn_info;
struct user_scan_req *scan_req;
struct user_conn_req *conn_req;
-   s32 result;
+   int result;
u16 dummy_reason_code = 0;
 
wid.id = WID_DISCONNECT;
@@ -2004,7 +2004,7 @@ static void handle_get_rssi(struct work_struct *work)
 {
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
-   s32 result;
+   int result;
struct wid wid;
 
wid.id = WID_RSSI;
@@ -2084,7 +2084,7 @@ static void handle_get_inactive_time(struct work_struct 
*work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct sta_inactive_t *hif_sta_inactive = >body.mac_info;
-   s32 result;
+   int result;
struct wid wid;
 
wid.id = WID_SET_STA_MAC_INACTIVE_TIME;
@@ -2126,7 +2126,7 @@ static void handle_add_beacon(struct work_struct *work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct beacon_attr *param = >body.beacon_info;
-   s32 result;
+   int result;
struct wid wid;
u8 *cur_byte;
 
@@ -2181,7 +2181,7 @@ static void handle_del_beacon(struct work_struct *work)
 {
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
-   s32 result;
+   int result;
struct wid wid;
u8 del_beacon = 0;
 
@@ -2232,7 +2232,7 @@ static void handle_add_station(struct work_struct *work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct add_sta_param *param = >body.add_sta_info;
-   s32 result;
+   int result;
struct wid wid;
u8 *cur_byte;
 
@@ -2263,7 +2263,7 @@ static void handle_del_all_sta(struct work_struct *work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct del_all_sta *param = >body.del_all_sta_info;
-   s32 result;
+   int result;
struct wid wid;
u8 *curr_byte;
u8 i;
@@ -2307,7 +2307,7 @@ static void handle_del_station(struct work_struct *work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct del_sta *param = >body.del_sta_info;
-   s32 result;
+   

[PATCH 22/23] staging: wilc1000: remove unnecessary 'NULL' check from cfg80211_ops callbacks

2018-07-19 Thread Ajay Singh
Cleanup patch to remove the unnecessary 'NULL' check used in 'cfg80211_ops'
callback functions.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 15 ---
 1 file changed, 15 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index ba6f9ed..2d44333 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1781,9 +1781,6 @@ static int set_power_mgmt(struct wiphy *wiphy, struct 
net_device *dev,
struct wilc_priv *priv;
struct wilc_vif *vif;
 
-   if (!wiphy)
-   return -ENOENT;
-
priv = wiphy_priv(wiphy);
vif = netdev_priv(priv->dev);
if (!priv->hif_drv)
@@ -1921,9 +1918,6 @@ static int stop_ap(struct wiphy *wiphy, struct net_device 
*dev)
struct wilc_vif *vif;
u8 null_bssid[ETH_ALEN] = {0};
 
-   if (!wiphy)
-   return -EFAULT;
-
priv = wiphy_priv(wiphy);
vif = netdev_priv(priv->dev);
 
@@ -1945,9 +1939,6 @@ static int add_station(struct wiphy *wiphy, struct 
net_device *dev,
struct add_sta_param sta_params = { {0} };
struct wilc_vif *vif;
 
-   if (!wiphy)
-   return -EFAULT;
-
priv = wiphy_priv(wiphy);
vif = netdev_priv(dev);
 
@@ -1986,9 +1977,6 @@ static int del_station(struct wiphy *wiphy, struct 
net_device *dev,
struct wilc_vif *vif;
struct sta_info *info;
 
-   if (!wiphy)
-   return -EFAULT;
-
priv = wiphy_priv(wiphy);
vif = netdev_priv(dev);
 
@@ -2013,9 +2001,6 @@ static int change_station(struct wiphy *wiphy, struct 
net_device *dev,
struct add_sta_param sta_params = { {0} };
struct wilc_vif *vif;
 
-   if (!wiphy)
-   return -EFAULT;
-
vif = netdev_priv(dev);
 
if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) {
-- 
2.7.4

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


[PATCH 20/23] staging: wilc1000: avoid setting default value for variable at declaration

2018-07-19 Thread Ajay Singh
Cleanup patch to avoid setting default value for local variables and
also clubbed similar variables together.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/coreconfigurator.c   |  25 ++---
 drivers/staging/wilc1000/host_interface.c | 122 +++---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  20 ++--
 3 files changed, 79 insertions(+), 88 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 5933e4d..e09f10d 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -123,9 +123,7 @@ static inline void get_BSSID(u8 *data, u8 *bssid)
 
 static inline void get_ssid(u8 *data, u8 *ssid, u8 *p_ssid_len)
 {
-   u8 len = 0;
-   u8 i   = 0;
-   u8 j   = 0;
+   u8 i, j, len;
 
len = data[TAG_PARAM_OFFSET + 1];
j   = TAG_PARAM_OFFSET + 2;
@@ -198,18 +196,11 @@ static u8 get_current_channel_802_11n(u8 *msa, u16 rx_len)
 s32 wilc_parse_network_info(u8 *msg_buffer,
struct network_info **ret_network_info)
 {
-   struct network_info *network_info = NULL;
-   u8 msg_type = 0;
-   u16 wid_len  = 0;
-   u8 *wid_val = NULL;
-   u8 *msa = NULL;
-   u16 rx_len = 0;
-   u8 *tim_elm = NULL;
-   u8 *ies = NULL;
-   u16 ies_len = 0;
-   u8 index = 0;
-   u32 tsf_lo;
-   u32 tsf_hi;
+   struct network_info *network_info;
+   u8 *wid_val, *msa, *tim_elm, *ies;
+   u32 tsf_lo, tsf_hi;
+   u16 wid_len, rx_len, ies_len;
+   u8 msg_type, index;
 
msg_type = msg_buffer[0];
 
@@ -271,8 +262,8 @@ s32 wilc_parse_network_info(u8 *msg_buffer,
 s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
   struct connect_info *ret_conn_info)
 {
-   u8 *ies = NULL;
-   u16 ies_len = 0;
+   u8 *ies;
+   u16 ies_len;
 
ret_conn_info->status = get_asoc_status(buffer);
if (ret_conn_info->status == WLAN_STATUS_SUCCESS) {
diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 895a126..d251a64 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -259,7 +259,7 @@ static void handle_set_channel(struct work_struct *work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct channel_attr *hif_set_ch = >body.channel_info;
-   int ret = 0;
+   int ret;
struct wid wid;
 
wid.id = WID_CURRENT_CHANNEL;
@@ -280,10 +280,10 @@ static void handle_set_wfi_drv_handler(struct work_struct 
*work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct drv_handler *hif_drv_handler = >body.drv;
-   int ret = 0;
+   int ret;
struct wid wid;
u8 *currbyte, *buffer;
-   struct host_if_drv *hif_drv = NULL;
+   struct host_if_drv *hif_drv;
 
if (!vif->hif_drv || !hif_drv_handler)
goto free_msg;
@@ -327,7 +327,7 @@ static void handle_set_operation_mode(struct work_struct 
*work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct op_mode *hif_op_mode = >body.mode;
-   int ret = 0;
+   int ret;
struct wid wid;
 
wid.id = WID_SET_OPERATION_MODE;
@@ -352,7 +352,7 @@ static void handle_set_ip_address(struct work_struct *work)
struct wilc_vif *vif = msg->vif;
u8 *ip_addr = msg->body.ip_info.ip_addr;
u8 idx = msg->body.ip_info.idx;
-   int ret = 0;
+   int ret;
struct wid wid;
char firmware_ip_addr[4] = {0};
 
@@ -381,7 +381,7 @@ static void handle_get_ip_address(struct work_struct *work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
u8 idx = msg->body.ip_info.idx;
-   int ret = 0;
+   int ret;
struct wid wid;
 
wid.id = WID_IP_ADDRESS;
@@ -409,7 +409,7 @@ static void handle_get_mac_address(struct work_struct *work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct get_mac_addr *get_mac_addr = >body.get_mac_info;
-   int ret = 0;
+   int ret;
struct wid wid;
 
wid.id = WID_MAC_ADDR;
@@ -431,7 +431,7 @@ static void handle_cfg_param(struct work_struct *work)
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
struct wilc_vif *vif = msg->vif;
struct cfg_param_attr *param = >body.cfg_info;
-   int ret = 0;
+   int ret;
struct wid wid_list[32];
struct host_if_drv *hif_drv = vif->hif_drv;
int i = 0;
@@ -1148,7 +1148,7 @@ static void 

[PATCH 23/23] staging: wilc1000: move variable assignment along with its declaration

2018-07-19 Thread Ajay Singh
Cleanup patch to club the variable assignment along with the variable
declaration especially for private data.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c |   7 +-
 drivers/staging/wilc1000/linux_wlan.c | 113 +++
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 229 +++---
 drivers/staging/wilc1000/wilc_wlan.c  |  53 ++---
 4 files changed, 118 insertions(+), 284 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index fb063e5..c78b51a 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3429,13 +3429,10 @@ static void get_periodic_rssi(struct timer_list *unused)
 int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
 {
struct host_if_drv *hif_drv;
-   struct wilc_vif *vif;
-   struct wilc *wilc;
+   struct wilc_vif *vif = netdev_priv(dev);
+   struct wilc *wilc = vif->wilc;
int i;
 
-   vif = netdev_priv(dev);
-   wilc = vif->wilc;
-
hif_drv  = kzalloc(sizeof(*hif_drv), GFP_KERNEL);
if (!hif_drv)
return -ENOMEM;
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 5667a54..2f4bf8e 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -94,12 +94,9 @@ static int dev_state_ev_handler(struct notifier_block *this,
 
 static irqreturn_t isr_uh_routine(int irq, void *user_data)
 {
-   struct wilc_vif *vif;
-   struct wilc *wilc;
struct net_device *dev = user_data;
-
-   vif = netdev_priv(dev);
-   wilc = vif->wilc;
+   struct wilc_vif *vif = netdev_priv(dev);
+   struct wilc *wilc = vif->wilc;
 
if (wilc->close) {
netdev_err(dev, "Can't handle UH interrupt\n");
@@ -110,12 +107,9 @@ static irqreturn_t isr_uh_routine(int irq, void *user_data)
 
 static irqreturn_t isr_bh_routine(int irq, void *userdata)
 {
-   struct wilc_vif *vif;
-   struct wilc *wilc;
struct net_device *dev = userdata;
-
-   vif = netdev_priv(userdata);
-   wilc = vif->wilc;
+   struct wilc_vif *vif = netdev_priv(userdata);
+   struct wilc *wilc = vif->wilc;
 
if (wilc->close) {
netdev_err(dev, "Can't handle BH interrupt\n");
@@ -130,11 +124,8 @@ static irqreturn_t isr_bh_routine(int irq, void *userdata)
 static int init_irq(struct net_device *dev)
 {
int ret = 0;
-   struct wilc_vif *vif;
-   struct wilc *wl;
-
-   vif = netdev_priv(dev);
-   wl = vif->wilc;
+   struct wilc_vif *vif = netdev_priv(dev);
+   struct wilc *wl = vif->wilc;
 
if ((gpio_request(wl->gpio, "WILC_INTR") == 0) &&
(gpio_direction_input(wl->gpio) == 0)) {
@@ -163,11 +154,8 @@ static int init_irq(struct net_device *dev)
 
 static void deinit_irq(struct net_device *dev)
 {
-   struct wilc_vif *vif;
-   struct wilc *wilc;
-
-   vif = netdev_priv(dev);
-   wilc = vif->wilc;
+   struct wilc_vif *vif = netdev_priv(dev);
+   struct wilc *wilc = vif->wilc;
 
/* Deinitialize IRQ */
if (wilc->dev_irq_num) {
@@ -238,12 +226,9 @@ static int linux_wlan_txq_task(void *vp)
 {
int ret;
u32 txq_count;
-   struct wilc_vif *vif;
-   struct wilc *wl;
struct net_device *dev = vp;
-
-   vif = netdev_priv(dev);
-   wl = vif->wilc;
+   struct wilc_vif *vif = netdev_priv(dev);
+   struct wilc *wl = vif->wilc;
 
complete(>txq_thread_started);
while (1) {
@@ -271,15 +256,12 @@ static int linux_wlan_txq_task(void *vp)
 
 static int wilc_wlan_get_firmware(struct net_device *dev)
 {
-   struct wilc_vif *vif;
-   struct wilc *wilc;
+   struct wilc_vif *vif = netdev_priv(dev);
+   struct wilc *wilc = vif->wilc;
int chip_id, ret = 0;
const struct firmware *wilc_firmware;
char *firmware;
 
-   vif = netdev_priv(dev);
-   wilc = vif->wilc;
-
chip_id = wilc_get_chipid(wilc, false);
 
if (chip_id < 0x1003a0)
@@ -306,13 +288,10 @@ static int wilc_wlan_get_firmware(struct net_device *dev)
 
 static int linux_wlan_start_firmware(struct net_device *dev)
 {
-   struct wilc_vif *vif;
-   struct wilc *wilc;
+   struct wilc_vif *vif = netdev_priv(dev);
+   struct wilc *wilc = vif->wilc;
int ret = 0;
 
-   vif = netdev_priv(dev);
-   wilc = vif->wilc;
-
ret = wilc_wlan_start(wilc);
if (ret < 0)
return ret;
@@ -326,13 +305,10 @@ static int linux_wlan_start_firmware(struct net_device 
*dev)
 
 static int wilc1000_firmware_download(struct net_device *dev)
 {
-   struct wilc_vif *vif;
-   struct wilc *wilc;
+   struct wilc_vif *vif = netdev_priv(dev);
+   struct wilc *wilc = vif->wilc;
int ret = 0;
 
-   vif = 

[PATCH 18/23] staging: wilc1000: avoid host_int_get_assoc_res_info() forward declaration

2018-07-19 Thread Ajay Singh
Reorder the function position in host interface to avoid forward
declaration of host_int_get_assoc_res_info().

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 47 ++-
 1 file changed, 21 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index eabe5c7..f49e849 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1287,7 +1287,27 @@ static void handle_rcvd_ntwrk_info(struct work_struct 
*work)
 static s32 host_int_get_assoc_res_info(struct wilc_vif *vif,
   u8 *assoc_resp_info,
   u32 max_assoc_resp_info_len,
-  u32 *rcvd_assoc_resp_info_len);
+  u32 *rcvd_assoc_resp_info_len)
+{
+   s32 result;
+   struct wid wid;
+
+   wid.id = WID_ASSOC_RES_INFO;
+   wid.type = WID_STR;
+   wid.val = assoc_resp_info;
+   wid.size = max_assoc_resp_info_len;
+
+   result = wilc_send_config_pkt(vif, GET_CFG, , 1,
+ wilc_get_vif_idx(vif));
+   if (result) {
+   *rcvd_assoc_resp_info_len = 0;
+   netdev_err(vif->ndev, "Failed to send association response\n");
+   return -EINVAL;
+   }
+
+   *rcvd_assoc_resp_info_len = wid.size;
+   return result;
+}
 
 static inline void host_int_free_user_conn_req(struct host_if_drv *hif_drv)
 {
@@ -2979,31 +2999,6 @@ int wilc_disconnect(struct wilc_vif *vif, u16 
reason_code)
return result;
 }
 
-static s32 host_int_get_assoc_res_info(struct wilc_vif *vif,
-  u8 *assoc_resp_info,
-  u32 max_assoc_resp_info_len,
-  u32 *rcvd_assoc_resp_info_len)
-{
-   s32 result = 0;
-   struct wid wid;
-
-   wid.id = WID_ASSOC_RES_INFO;
-   wid.type = WID_STR;
-   wid.val = assoc_resp_info;
-   wid.size = max_assoc_resp_info_len;
-
-   result = wilc_send_config_pkt(vif, GET_CFG, , 1,
- wilc_get_vif_idx(vif));
-   if (result) {
-   *rcvd_assoc_resp_info_len = 0;
-   netdev_err(vif->ndev, "Failed to send association response\n");
-   return -EINVAL;
-   }
-
-   *rcvd_assoc_resp_info_len = wid.size;
-   return result;
-}
-
 int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel)
 {
int result;
-- 
2.7.4

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


[PATCH 12/23] staging: wilc1000: remove the mutliple #define used for same macro

2018-07-19 Thread Ajay Singh
Moved the same #define in common header file instead of having their
declartion in different files.

Below macros are moved to header file:
TCP_ACK_FILTER_LINK_SPEED_THRESH
DEFAULT_LINK_SPEED
GET_PKT_OFFSET

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 3 ---
 drivers/staging/wilc1000/linux_mon.c  | 1 -
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 5 -
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 5 +
 4 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 0ffe205..8649225 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -6,9 +6,6 @@
 
 #define FALSE_FRMWR_CHANNEL100
 
-#define TCP_ACK_FILTER_LINK_SPEED_THRESH   54
-#define DEFAULT_LINK_SPEED 72
-
 #define REAL_JOIN_REQ  0
 
 struct host_if_wpa_attr {
diff --git a/drivers/staging/wilc1000/linux_mon.c 
b/drivers/staging/wilc1000/linux_mon.c
index 1c7e6e1..bd09611 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -20,7 +20,6 @@ static u8 bssid[6];
 
 #define IEEE80211_RADIOTAP_F_TX_RTS0x0004  /* used rts/cts handshake */
 #define IEEE80211_RADIOTAP_F_TX_FAIL   0x0001  /* failed due to excessive*/
-#define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff)
 
 #define TX_RADIOTAP_PRESENT ((1 << IEEE80211_RADIOTAP_RATE) |  \
 (1 << IEEE80211_RADIOTAP_TX_FLAGS))
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 1a27e81..e561dce 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -77,11 +77,6 @@ static const struct wiphy_wowlan_support wowlan_support = {
.flags = WIPHY_WOWLAN_ANY
 };
 
-#define TCP_ACK_FILTER_LINK_SPEED_THRESH   54
-#define DEFAULT_LINK_SPEED 72
-
-#define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff)
-
 static struct network_info 
last_scanned_shadow[MAX_NUM_SCANNED_NETWORKS_SHADOW];
 static u32 last_scanned_cnt;
 struct timer_list wilc_during_ip_timer;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 87f8cdc..765681a 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -21,6 +21,11 @@
 
 #define NUM_REG_FRAME  2
 
+#define TCP_ACK_FILTER_LINK_SPEED_THRESH   54
+#define DEFAULT_LINK_SPEED 72
+
+#define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff)
+
 struct wilc_wfi_stats {
unsigned long rx_packets;
unsigned long tx_packets;
-- 
2.7.4

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


[PATCH 16/23] staging: wilc1000: remove unnecessary type used for wid id

2018-07-19 Thread Ajay Singh
Cleanup patch to remove unnecessary typecast used while assigning the
WID ID.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 84 +++
 1 file changed, 42 insertions(+), 42 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 2f25175..85ecba8 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -264,7 +264,7 @@ static void handle_set_channel(struct work_struct *work)
int ret = 0;
struct wid wid;
 
-   wid.id = (u16)WID_CURRENT_CHANNEL;
+   wid.id = WID_CURRENT_CHANNEL;
wid.type = WID_CHAR;
wid.val = (char *)_set_ch->set_ch;
wid.size = sizeof(char);
@@ -307,7 +307,7 @@ static void handle_set_wfi_drv_handler(struct work_struct 
*work)
currbyte++;
*currbyte = (hif_drv_handler->name | (hif_drv_handler->mode << 1));
 
-   wid.id = (u16)WID_SET_DRV_HANDLER;
+   wid.id = WID_SET_DRV_HANDLER;
wid.type = WID_STR;
wid.val = (s8 *)buffer;
wid.size = DRV_HANDLER_SIZE;
@@ -332,7 +332,7 @@ static void handle_set_operation_mode(struct work_struct 
*work)
int ret = 0;
struct wid wid;
 
-   wid.id = (u16)WID_SET_OPERATION_MODE;
+   wid.id = WID_SET_OPERATION_MODE;
wid.type = WID_INT;
wid.val = (s8 *)_op_mode->mode;
wid.size = sizeof(u32);
@@ -363,7 +363,7 @@ static void handle_set_ip_address(struct work_struct *work)
 
memcpy(set_ip[idx], ip_addr, IP_ALEN);
 
-   wid.id = (u16)WID_IP_ADDRESS;
+   wid.id = WID_IP_ADDRESS;
wid.type = WID_STR;
wid.val = ip_addr;
wid.size = IP_ALEN;
@@ -386,7 +386,7 @@ static void handle_get_ip_address(struct work_struct *work)
int ret = 0;
struct wid wid;
 
-   wid.id = (u16)WID_IP_ADDRESS;
+   wid.id = WID_IP_ADDRESS;
wid.type = WID_STR;
wid.val = kmalloc(IP_ALEN, GFP_KERNEL);
wid.size = IP_ALEN;
@@ -414,7 +414,7 @@ static void handle_get_mac_address(struct work_struct *work)
int ret = 0;
struct wid wid;
 
-   wid.id = (u16)WID_MAC_ADDR;
+   wid.id = WID_MAC_ADDR;
wid.type = WID_STR;
wid.val = get_mac_addr->mac_addr;
wid.size = ETH_ALEN;
@@ -757,7 +757,7 @@ static void handle_scan(struct work_struct *work)
 
hif_drv->usr_scan_req.rcvd_ch_cnt = 0;
 
-   wid_list[index].id = (u16)WID_SSID_PROBE_REQ;
+   wid_list[index].id = WID_SSID_PROBE_REQ;
wid_list[index].type = WID_STR;
 
for (i = 0; i < hidden_net->n_ssids; i++)
@@ -851,7 +851,7 @@ static s32 handle_scan_done(struct wilc_vif *vif, enum 
scan_event evt)
 
if (evt == SCAN_EVENT_ABORTED) {
abort_running_scan = 1;
-   wid.id = (u16)WID_ABORT_RUNNING_SCAN;
+   wid.id = WID_ABORT_RUNNING_SCAN;
wid.type = WID_CHAR;
wid.val = (s8 *)_running_scan;
wid.size = sizeof(char);
@@ -976,19 +976,19 @@ static void handle_connect(struct work_struct *work)
wid_list[wid_cnt].size = hif_drv->usr_conn_req.ies_len;
wid_cnt++;
 
-   wid_list[wid_cnt].id = (u16)WID_11I_MODE;
+   wid_list[wid_cnt].id = WID_11I_MODE;
wid_list[wid_cnt].type = WID_CHAR;
wid_list[wid_cnt].size = sizeof(char);
wid_list[wid_cnt].val = (s8 *)_drv->usr_conn_req.security;
wid_cnt++;
 
-   wid_list[wid_cnt].id = (u16)WID_AUTH_TYPE;
+   wid_list[wid_cnt].id = WID_AUTH_TYPE;
wid_list[wid_cnt].type = WID_CHAR;
wid_list[wid_cnt].size = sizeof(char);
wid_list[wid_cnt].val = (s8 *)_drv->usr_conn_req.auth_type;
wid_cnt++;
 
-   wid_list[wid_cnt].id = (u16)WID_JOIN_REQ_EXTENDED;
+   wid_list[wid_cnt].id = WID_JOIN_REQ_EXTENDED;
wid_list[wid_cnt].type = WID_STR;
wid_list[wid_cnt].size = 112;
wid_list[wid_cnt].val = kmalloc(wid_list[wid_cnt].size, GFP_KERNEL);
@@ -1192,7 +1192,7 @@ static void handle_connect_timeout(struct work_struct 
*work)
netdev_err(vif->ndev, "Connect callback is NULL\n");
}
 
-   wid.id = (u16)WID_DISCONNECT;
+   wid.id = WID_DISCONNECT;
wid.type = WID_CHAR;
wid.val = (s8 *)_reason_code;
wid.size = sizeof(char);
@@ -1496,7 +1496,7 @@ static int wilc_pmksa_key_copy(struct wilc_vif *vif, 
struct key_attr *hif_key)
   hif_key->attr.pmkid.pmkidlist[i].pmkid, PMKID_LEN);
}
 
-   wid.id = (u16)WID_PMKID_INFO;
+   wid.id = WID_PMKID_INFO;
wid.type = WID_STR;
wid.val = (s8 *)key_buf;
wid.size = (hif_key->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1;
@@ -1524,7 +1524,7 @@ static void handle_key(struct work_struct *work)
case WEP:
 
if (hif_key->action & ADDKEY_AP) {
-   wid_list[0].id = (u16)WID_11I_MODE;
+   

[PATCH 09/23] staging: wilc1000: remove unused elements in 'wilc' struct

2018-07-19 Thread Ajay Singh
Cleanup patch to remove unused elements from 'wilc' struct.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 4 
 drivers/staging/wilc1000/wilc_wlan.c  | 6 --
 2 files changed, 10 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index fe18ae9..22f3486 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -157,12 +157,8 @@ struct wilc {
 
struct txq_entry_t txq_head;
int txq_entries;
-   int txq_exit;
 
struct rxq_entry_t rxq_head;
-   int rxq_exit;
-
-   unsigned char eth_src_address[NUM_CONCURRENT_IFC][6];
 
const struct firmware *firmware;
 
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 8e71c28..c77e5c8 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -527,7 +527,6 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 
*txq_count)
wilc = vif->wilc;
 
txb = wilc->tx_buffer;
-   wilc->txq_exit = 0;
 
if (wilc->quit)
goto out;
@@ -713,7 +712,6 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 
*txq_count)
 out:
mutex_unlock(>txq_add_to_head_cs);
 
-   wilc->txq_exit = 1;
*txq_count = wilc->txq_entries;
return ret;
 }
@@ -780,8 +778,6 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
u8 *buffer;
struct rxq_entry_t *rqe;
 
-   wilc->rxq_exit = 0;
-
do {
if (wilc->quit) {
complete(>cfg_event);
@@ -797,8 +793,6 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
 
kfree(rqe);
} while (1);
-
-   wilc->rxq_exit = 1;
 }
 
 static void wilc_unknown_isr_ext(struct wilc *wilc)
-- 
2.7.4

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


[PATCH 06/23] staging: wilc1000: rename enum CURRENT_TXRATE to use lowercase

2018-07-19 Thread Ajay Singh
Cleanup patch to rename enums in lowercase to follow linux coding style.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 drivers/staging/wilc1000/host_interface.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 7309b7e..cc64b14 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -695,7 +695,7 @@ static void handle_cfg_param(struct work_struct *work)
i++;
}
if (param->flag & CURRENT_TX_RATE) {
-   enum CURRENT_TXRATE curr_tx_rate = param->curr_tx_rate;
+   enum current_tx_rate curr_tx_rate = param->curr_tx_rate;
 
if (curr_tx_rate == AUTORATE || curr_tx_rate == MBPS_1 ||
curr_tx_rate == MBPS_2 || curr_tx_rate == MBPS_5_5 ||
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 3cd97dd..64fc269 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -81,7 +81,7 @@ struct host_if_pmkid_attr {
struct host_if_pmkid pmkidlist[WILC_MAX_NUM_PMKIDS];
 };
 
-enum CURRENT_TXRATE {
+enum current_tx_rate {
AUTORATE= 0,
MBPS_1  = 1,
MBPS_2  = 2,
@@ -118,7 +118,7 @@ struct cfg_param_attr {
u8 scan_source;
u16 active_scan_time;
u16 passive_scan_time;
-   enum CURRENT_TXRATE curr_tx_rate;
+   enum current_tx_rate curr_tx_rate;
 
 };
 
-- 
2.7.4

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


[PATCH 19/23] staging: wilc1000: avoid forward declaration of host_int_parse_join_bss_param()

2018-07-19 Thread Ajay Singh
Reorder the functions position in host interface to avoid forward
declaration of host_int_parse_join_bss_param().

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 333 +++---
 1 file changed, 166 insertions(+), 167 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index f49e849..895a126 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -197,7 +197,6 @@ static u8 set_ip[2][4];
 static u8 get_ip[2][4];
 static u32 clients_count;
 
-static void *host_int_parse_join_bss_param(struct network_info *info);
 static int host_int_get_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx);
 
 /* 'msg' should be free by the caller for syc */
@@ -1216,6 +1215,172 @@ static void handle_connect_timeout(struct work_struct 
*work)
kfree(msg);
 }
 
+static void host_int_fill_join_bss_param(struct join_bss_param *param, u8 *ies,
+u16 *out_index, u8 *pcipher_tc,
+u8 *auth_total_cnt, u32 tsf_lo,
+u8 *rates_no)
+{
+   u8 ext_rates_no;
+   u16 offset;
+   u8 pcipher_cnt;
+   u8 auth_cnt;
+   u8 i, j;
+   u16 index = *out_index;
+
+   if (ies[index] == WLAN_EID_SUPP_RATES) {
+   *rates_no = ies[index + 1];
+   param->supp_rates[0] = *rates_no;
+   index += 2;
+
+   for (i = 0; i < *rates_no; i++)
+   param->supp_rates[i + 1] = ies[index + i];
+
+   index += *rates_no;
+   } else if (ies[index] == WLAN_EID_EXT_SUPP_RATES) {
+   ext_rates_no = ies[index + 1];
+   if (ext_rates_no > (MAX_RATES_SUPPORTED - *rates_no))
+   param->supp_rates[0] = MAX_RATES_SUPPORTED;
+   else
+   param->supp_rates[0] += ext_rates_no;
+   index += 2;
+   for (i = 0; i < (param->supp_rates[0] - *rates_no); i++)
+   param->supp_rates[*rates_no + i + 1] = ies[index + i];
+
+   index += ext_rates_no;
+   } else if (ies[index] == WLAN_EID_HT_CAPABILITY) {
+   param->ht_capable = true;
+   index += ies[index + 1] + 2;
+   } else if ((ies[index] == WLAN_EID_VENDOR_SPECIFIC) &&
+  (ies[index + 2] == 0x00) && (ies[index + 3] == 0x50) &&
+  (ies[index + 4] == 0xF2) && (ies[index + 5] == 0x02) &&
+  ((ies[index + 6] == 0x00) || (ies[index + 6] == 0x01)) &&
+  (ies[index + 7] == 0x01)) {
+   param->wmm_cap = true;
+
+   if (ies[index + 8] & BIT(7))
+   param->uapsd_cap = true;
+   index += ies[index + 1] + 2;
+   } else if ((ies[index] == WLAN_EID_VENDOR_SPECIFIC) &&
+(ies[index + 2] == 0x50) && (ies[index + 3] == 0x6f) &&
+(ies[index + 4] == 0x9a) &&
+(ies[index + 5] == 0x09) && (ies[index + 6] == 0x0c)) {
+   u16 p2p_cnt;
+
+   param->tsf = tsf_lo;
+   param->noa_enabled = 1;
+   param->idx = ies[index + 9];
+
+   if (ies[index + 10] & BIT(7)) {
+   param->opp_enabled = 1;
+   param->ct_window = ies[index + 10];
+   } else {
+   param->opp_enabled = 0;
+   }
+
+   param->cnt = ies[index + 11];
+   p2p_cnt = index + 12;
+
+   memcpy(param->duration, ies + p2p_cnt, 4);
+   p2p_cnt += 4;
+
+   memcpy(param->interval, ies + p2p_cnt, 4);
+   p2p_cnt += 4;
+
+   memcpy(param->start_time, ies + p2p_cnt, 4);
+
+   index += ies[index + 1] + 2;
+   } else if ((ies[index] == WLAN_EID_RSN) ||
+((ies[index] == WLAN_EID_VENDOR_SPECIFIC) &&
+ (ies[index + 2] == 0x00) &&
+ (ies[index + 3] == 0x50) && (ies[index + 4] == 0xF2) &&
+ (ies[index + 5] == 0x01))) {
+   u16 rsn_idx = index;
+
+   if (ies[rsn_idx] == WLAN_EID_RSN) {
+   param->mode_802_11i = 2;
+   } else {
+   if (param->mode_802_11i == 0)
+   param->mode_802_11i = 1;
+   rsn_idx += 4;
+   }
+
+   rsn_idx += 7;
+   param->rsn_grp_policy = ies[rsn_idx];
+   rsn_idx++;
+   offset = ies[rsn_idx] * 4;
+   pcipher_cnt = (ies[rsn_idx] > 3) ? 3 : ies[rsn_idx];
+   rsn_idx += 2;
+
+   i = *pcipher_tc;
+   j = 0;
+   for (; i < (pcipher_cnt + *pcipher_tc) && i < 3; i++, j++) {
+   u8 *policy =  >rsn_pcip_policy[i];
+
+   

[PATCH 13/23] staging: wilc1000: use lowercase for 'IFC_UP' struct element name

2018-07-19 Thread Ajay Singh
Cleanup patch to use lowercase for structure element name to follow
linux coding style.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.h | 2 +-
 drivers/staging/wilc1000/linux_wlan.c | 4 ++--
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 79166a5..9a016c5 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -277,7 +277,7 @@ struct host_if_drv {
struct timer_list remain_on_ch_timer;
struct wilc_vif *remain_on_ch_timer_vif;
 
-   bool IFC_UP;
+   bool ifc_up;
int driver_handler_id;
 };
 
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 032afc2..84d3145 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -45,7 +45,7 @@ static int dev_state_ev_handler(struct notifier_block *this,
switch (event) {
case NETDEV_UP:
if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) {
-   hif_drv->IFC_UP = 1;
+   hif_drv->ifc_up = 1;
wilc_optaining_ip = false;
del_timer(_during_ip_timer);
}
@@ -65,7 +65,7 @@ static int dev_state_ev_handler(struct notifier_block *this,
 
case NETDEV_DOWN:
if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) {
-   hif_drv->IFC_UP = 0;
+   hif_drv->ifc_up = 0;
wilc_optaining_ip = false;
}
 
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index e561dce..ebe7adc2 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -535,9 +535,9 @@ static void cfg_connect_result(enum conn_event 
conn_disconn_evt,
 
if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNEL;
-   if (wfi_drv->IFC_UP && dev == wl->vif[1]->ndev)
+   if (wfi_drv->ifc_up && dev == wl->vif[1]->ndev)
disconn_info->reason = 3;
-   else if (!wfi_drv->IFC_UP && dev == wl->vif[1]->ndev)
+   else if (!wfi_drv->ifc_up && dev == wl->vif[1]->ndev)
disconn_info->reason = 1;
 
cfg80211_disconnected(dev, disconn_info->reason,
-- 
2.7.4

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


[PATCH 15/23] staging: wilc1000: use single space before opening brances '{'

2018-07-19 Thread Ajay Singh
Cleanup patch to use single space instead of multiple space before the
'{'.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 6 +++---
 drivers/staging/wilc1000/linux_wlan.c | 2 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
 drivers/staging/wilc1000/wilc_wlan.c  | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 8649225..2f25175 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -799,7 +799,7 @@ static void handle_scan(struct work_struct *work)
scan_info->ch_list_len > 0) {
int i;
 
-   for (i = 0; i < scan_info->ch_list_len; i++){
+   for (i = 0; i < scan_info->ch_list_len; i++) {
if (scan_info->ch_freq_list[i] > 0)
scan_info->ch_freq_list[i] -= 1;
}
@@ -3337,7 +3337,7 @@ int wilc_deinit(struct wilc_vif *vif)
int result = 0;
struct host_if_drv *hif_drv = vif->hif_drv;
 
-   if (!hif_drv)   {
+   if (!hif_drv) {
netdev_err(vif->ndev, "hif_drv = NULL\n");
return -EFAULT;
}
@@ -3404,7 +3404,7 @@ void wilc_network_info_received(struct wilc *wilc, u8 
*buffer, u32 length)
return;
hif_drv = vif->hif_drv;
 
-   if (!hif_drv || hif_drv == terminated_handle)   {
+   if (!hif_drv || hif_drv == terminated_handle) {
netdev_err(vif->ndev, "driver not init[%p]\n", hif_drv);
return;
}
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 8f77435..5667a54 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -604,7 +604,7 @@ static void wilc_wlan_deinitialize(struct net_device *dev)
return;
}
 
-   if (wl->initialized){
+   if (wl->initialized) {
netdev_info(dev, "Deinitializing wilc1000...\n");
 
if (!wl->dev_irq_num &&
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 43003d8..96aaf14 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -524,7 +524,7 @@ static void cfg_connect_result(enum conn_event 
conn_disconn_evt,
conn_info->resp_ies,
conn_info->resp_ies_len, connect_status,
GFP_KERNEL);
-   } else if (conn_disconn_evt == CONN_DISCONN_EVENT_DISCONN_NOTIF){
+   } else if (conn_disconn_evt == CONN_DISCONN_EVENT_DISCONN_NOTIF) {
wilc_optaining_ip = false;
p2p_local_random = 0x01;
p2p_recv_random = 0x00;
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index c77e5c8..cb8bfd2 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -436,7 +436,7 @@ void chip_wakeup(struct wilc *wilc)
wilc_get_chipid(wilc, true);
} while (wilc_get_chipid(wilc, true) == 0);
} while (wilc_get_chipid(wilc, true) == 0);
-   } else if ((wilc->io_type & 0x1) == HIF_SDIO){
+   } else if ((wilc->io_type & 0x1) == HIF_SDIO) {
wilc->hif_func->hif_write_reg(wilc, 0xfa, 1);
udelay(200);
wilc->hif_func->hif_read_reg(wilc, 0xf0, );
-- 
2.7.4

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


[PATCH 14/23] staging: wilc1000: remove unnecessary blank line between variable declaration

2018-07-19 Thread Ajay Singh
Cleanup patch to remove the unnecessary blank line between variables
declaration inside the function.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_mon.c  | 1 -
 drivers/staging/wilc1000/linux_wlan.c | 1 -
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 
 3 files changed, 6 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_mon.c 
b/drivers/staging/wilc1000/linux_mon.c
index bd09611..14405bf 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -147,7 +147,6 @@ static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb,
 {
u32 rtap_len, ret = 0;
struct wilc_wfi_mon_priv  *mon_priv;
-
struct sk_buff *skb2;
struct wilc_wfi_radiotap_cb_hdr *cb_hdr;
 
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 84d3145..8f77435 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -780,7 +780,6 @@ static int mac_init_fn(struct net_device *ndev)
 static int wilc_mac_open(struct net_device *ndev)
 {
struct wilc_vif *vif;
-
unsigned char mac_add[ETH_ALEN] = {0};
int ret = 0;
int i = 0;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index ebe7adc2..43003d8 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1250,7 +1250,6 @@ static int del_pmksa(struct wiphy *wiphy, struct 
net_device *netdev,
 {
u32 i;
s32 ret = 0;
-
struct wilc_priv *priv = wiphy_priv(wiphy);
 
for (i = 0; i < priv->pmkid_list.numpmkid; i++) {
@@ -1315,7 +1314,6 @@ static inline void wilc_wfi_cfg_parse_ch_attr(u8 *buf, u8 
ch_list_attr_idx,
 static void wilc_wfi_cfg_parse_rx_action(u8 *buf, u32 len)
 {
u32 index = 0;
-
u8 op_channel_attr_index = 0;
u8 channel_list_attr_index = 0;
 
@@ -1338,7 +1336,6 @@ static void wilc_wfi_cfg_parse_tx_action(u8 *buf, u32 
len, bool oper_ch,
 u8 iftype)
 {
u32 index = 0;
-
u8 op_channel_attr_index = 0;
u8 channel_list_attr_index = 0;
 
@@ -2261,7 +2258,6 @@ struct wireless_dev *wilc_create_wiphy(struct net_device 
*net,
 int wilc_init_host_int(struct net_device *net)
 {
int ret = 0;
-
struct wilc_priv *priv;
 
priv = wdev_priv(net->ieee80211_ptr);
-- 
2.7.4

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


[PATCH 10/23] staging: wilc1000: remove unnecessary elements from 'wilc_priv' struct

2018-07-19 Thread Ajay Singh
Remove unused elements from 'wilc_priv' structure.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 7 ---
 2 files changed, 11 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 8f1c595..1a27e81 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2276,8 +2276,6 @@ int wilc_init_host_int(struct net_device *net)
}
op_ifcs++;
 
-   priv->auto_rate_adjusted = false;
-
priv->p2p_listen_state = false;
 
mutex_init(>scan_req_lock);
@@ -2297,8 +2295,6 @@ int wilc_deinit_host_int(struct net_device *net)
priv = wdev_priv(net->ieee80211_ptr);
vif = netdev_priv(priv->dev);
 
-   priv->auto_rate_adjusted = false;
-
priv->p2p_listen_state = false;
 
op_ifcs--;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 22f3486..87f8cdc 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -74,14 +74,10 @@ struct wilc_priv {
 
u8 associated_bss[ETH_ALEN];
struct sta_info assoc_stainfo;
-   struct net_device_stats stats;
-   u8 monitor_flag;
-   int status;
struct sk_buff *skb;
struct net_device *dev;
struct host_if_drv *hif_drv;
struct host_if_pmkid_attr pmkid_list;
-   struct wilc_wfi_stats netstats;
u8 wep_key[4][WLAN_KEY_LEN_WEP104];
u8 wep_key_len[4];
/* The real interface that the monitor is on */
@@ -91,9 +87,6 @@ struct wilc_priv {
u8 wilc_groupkey;
/* mutexes */
struct mutex scan_req_lock;
-   /*  */
-   bool auto_rate_adjusted;
-
bool p2p_listen_state;
 
 };
-- 
2.7.4

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


[PATCH 17/23] staging: wilc1000: avoid forward declaration for handle_scan_done()

2018-07-19 Thread Ajay Singh
Reorder the function position in host interface to avoid forward
declaration of handle_scan_done().

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 77 +++
 1 file changed, 38 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 85ecba8..eabe5c7 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -199,7 +199,6 @@ static u32 clients_count;
 
 static void *host_int_parse_join_bss_param(struct network_info *info);
 static int host_int_get_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx);
-static s32 handle_scan_done(struct wilc_vif *vif, enum scan_event evt);
 
 /* 'msg' should be free by the caller for syc */
 static struct host_if_msg*
@@ -724,6 +723,44 @@ static void handle_cfg_param(struct work_struct *work)
kfree(msg);
 }
 
+static s32 handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
+{
+   s32 result = 0;
+   u8 abort_running_scan;
+   struct wid wid;
+   struct host_if_drv *hif_drv = vif->hif_drv;
+   struct user_scan_req *scan_req;
+
+   if (evt == SCAN_EVENT_ABORTED) {
+   abort_running_scan = 1;
+   wid.id = WID_ABORT_RUNNING_SCAN;
+   wid.type = WID_CHAR;
+   wid.val = (s8 *)_running_scan;
+   wid.size = sizeof(char);
+
+   result = wilc_send_config_pkt(vif, SET_CFG, , 1,
+ wilc_get_vif_idx(vif));
+
+   if (result) {
+   netdev_err(vif->ndev, "Failed to set abort running\n");
+   result = -EFAULT;
+   }
+   }
+
+   if (!hif_drv) {
+   netdev_err(vif->ndev, "Driver handler is NULL\n");
+   return result;
+   }
+
+   scan_req = _drv->usr_scan_req;
+   if (scan_req->scan_result) {
+   scan_req->scan_result(evt, NULL, scan_req->arg, NULL);
+   scan_req->scan_result = NULL;
+   }
+
+   return result;
+}
+
 static void handle_scan(struct work_struct *work)
 {
struct host_if_msg *msg = container_of(work, struct host_if_msg, work);
@@ -841,44 +878,6 @@ static void handle_scan(struct work_struct *work)
kfree(msg);
 }
 
-static s32 handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
-{
-   s32 result = 0;
-   u8 abort_running_scan;
-   struct wid wid;
-   struct host_if_drv *hif_drv = vif->hif_drv;
-   struct user_scan_req *scan_req;
-
-   if (evt == SCAN_EVENT_ABORTED) {
-   abort_running_scan = 1;
-   wid.id = WID_ABORT_RUNNING_SCAN;
-   wid.type = WID_CHAR;
-   wid.val = (s8 *)_running_scan;
-   wid.size = sizeof(char);
-
-   result = wilc_send_config_pkt(vif, SET_CFG, , 1,
- wilc_get_vif_idx(vif));
-
-   if (result) {
-   netdev_err(vif->ndev, "Failed to set abort running\n");
-   result = -EFAULT;
-   }
-   }
-
-   if (!hif_drv) {
-   netdev_err(vif->ndev, "Driver handler is NULL\n");
-   return result;
-   }
-
-   scan_req = _drv->usr_scan_req;
-   if (scan_req->scan_result) {
-   scan_req->scan_result(evt, NULL, scan_req->arg, NULL);
-   scan_req->scan_result = NULL;
-   }
-
-   return result;
-}
-
 u8 wilc_connected_ssid[6] = {0};
 static void handle_connect(struct work_struct *work)
 {
-- 
2.7.4

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


[PATCH 08/23] staging: wilc1000: rename enum AUTHTYPE to use lowercase

2018-07-19 Thread Ajay Singh
Cleanup patch to rename enum AUTHTYPE to lowercase.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 8 
 drivers/staging/wilc1000/host_interface.h | 6 +++---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
 drivers/staging/wilc1000/wilc_wlan_if.h   | 2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index a5c0ac5..0ffe205 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -26,7 +26,7 @@ struct host_if_wep_attr {
u8 key_len;
u8 index;
u8 mode;
-   enum AUTHTYPE auth_type;
+   enum authtype auth_type;
 };
 
 union host_if_key_attr {
@@ -62,7 +62,7 @@ struct connect_attr {
u8 security;
wilc_connect_result result;
void *arg;
-   enum AUTHTYPE auth_type;
+   enum authtype auth_type;
u8 ch;
void *params;
 };
@@ -2632,7 +2632,7 @@ int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const 
u8 *key, u8 len,
 }
 
 int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len,
-   u8 index, u8 mode, enum AUTHTYPE auth_type)
+   u8 index, u8 mode, enum authtype auth_type)
 {
int result;
struct host_if_msg *msg;
@@ -2876,7 +2876,7 @@ int wilc_get_mac_address(struct wilc_vif *vif, u8 
*mac_addr)
 int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid,
  size_t ssid_len, const u8 *ies, size_t ies_len,
  wilc_connect_result connect_result, void *user_arg,
- u8 security, enum AUTHTYPE auth_type,
+ u8 security, enum authtype auth_type,
  u8 channel, void *join_params)
 {
int result = 0;
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 7f3e48c..79166a5 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -207,7 +207,7 @@ struct user_conn_req {
u8 *bssid;
u8 *ssid;
u8 security;
-   enum AUTHTYPE auth_type;
+   enum authtype auth_type;
size_t ssid_len;
u8 *ies;
size_t ies_len;
@@ -298,7 +298,7 @@ int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 
index);
 int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len,
 u8 index);
 int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len,
-   u8 index, u8 mode, enum AUTHTYPE auth_type);
+   u8 index, u8 mode, enum authtype auth_type);
 int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,
 const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic,
 u8 mode, u8 cipher_mode, u8 index);
@@ -314,7 +314,7 @@ int wilc_get_mac_address(struct wilc_vif *vif, u8 
*mac_addr);
 int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid,
  size_t ssid_len, const u8 *ies, size_t ies_len,
  wilc_connect_result connect_result, void *user_arg,
- u8 security, enum AUTHTYPE auth_type,
+ u8 security, enum authtype auth_type,
  u8 channel, void *join_params);
 int wilc_disconnect(struct wilc_vif *vif, u16 reason_code);
 int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel);
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 73606c3..8f1c595 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -678,7 +678,7 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
u32 i;
u32 sel_bssi_idx = UINT_MAX;
u8 security = NO_ENCRYPT;
-   enum AUTHTYPE auth_type = ANY;
+   enum authtype auth_type = ANY;
u32 cipher_group;
struct wilc_priv *priv;
struct host_if_drv *wfi_drv;
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h 
b/drivers/staging/wilc1000/wilc_wlan_if.h
index b82e149..73b57fb 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -131,7 +131,7 @@ enum {
WPA2_AES_TKIP   = 0x71, /* Aes or Tkip */
 };
 
-enum AUTHTYPE {
+enum authtype {
OPEN_SYSTEM = 1,
SHARED_KEY  = 2,
ANY = 3,
-- 
2.7.4

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


[PATCH 11/23] staging: wilc1000: removed unused element from wilc_cfg_frame struct

2018-07-19 Thread Ajay Singh
Cleanup up patch to remove the unused structure elements in
'wilc_cfg_frame' struct.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wlan.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.h 
b/drivers/staging/wilc1000/wilc_wlan.h
index dbdebf0..f29d1ea 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -255,9 +255,6 @@ struct wilc_hif_func {
 #define MAX_CFG_FRAME_SIZE 1468
 
 struct wilc_cfg_frame {
-   u8 ether_header[14];
-   u8 ip_header[20];
-   u8 udp_header[8];
u8 wid_header[8];
u8 frame[MAX_CFG_FRAME_SIZE];
 };
-- 
2.7.4

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


[PATCH 05/23] staging: wilc1000: rename goto to avoid leading '_' in label name

2018-07-19 Thread Ajay Singh
Cleanup patch to avoid use of leading '_' in goto label name. Also used
proper string for lable names.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 
 drivers/staging/wilc1000/wilc_wlan.c  | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index f90b9b6..73606c3 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2196,11 +2196,11 @@ static struct wireless_dev *wilc_wfi_cfg_alloc(void)
 
wdev = kzalloc(sizeof(*wdev), GFP_KERNEL);
if (!wdev)
-   goto _fail_;
+   goto out;
 
wdev->wiphy = wiphy_new(_cfg80211_ops, sizeof(struct wilc_priv));
if (!wdev->wiphy)
-   goto _fail_mem_;
+   goto free_mem;
 
wilc_band_2ghz.ht_cap.ht_supported = 1;
wilc_band_2ghz.ht_cap.cap |= (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT);
@@ -2212,9 +2212,9 @@ static struct wireless_dev *wilc_wfi_cfg_alloc(void)
 
return wdev;
 
-_fail_mem_:
+free_mem:
kfree(wdev);
-_fail_:
+out:
return NULL;
 }
 
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 85af365..8e71c28 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -850,13 +850,13 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, 
u32 int_status)
if (wilc->rx_buffer)
buffer = >rx_buffer[offset];
else
-   goto _end_;
+   goto end;
 
wilc->hif_func->hif_clear_int_ext(wilc,
  DATA_INT_CLR | ENABLE_RX_VMM);
ret = wilc->hif_func->hif_block_rx_ext(wilc, 0, buffer, size);
 
-_end_:
+end:
if (ret) {
offset += size;
wilc->rx_buffer_offset = offset;
-- 
2.7.4

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


[PATCH 04/23] staging: wilc1000: remove extra enums defined for ieee80211_eid

2018-07-19 Thread Ajay Singh
Cleanup patch to make use of existing enum 'ieee80211_eid' instead of
adding new enum in WILC for element ID's.

The below mapping is same to remove extra enum in WILC.

SUPP_RATES_IE   -> WLAN_EID_SUPP_RATES
EXT_SUPP_RATES_IE   -> WLAN_EID_EXT_SUPP_RATES
HT_CAPABILITY_IE-> WLAN_EID_HT_CAPABILITY
RSN_IE  -> WLAN_EID_RSN
WPA_IE  -> WLAN_EID_VENDOR_SPECIFIC
WMM_IE  -> WLAN_EID_VENDOR_SPECIFIC
P2P_IE  -> WLAN_EID_VENDOR_SPECIFIC

Also remove enum 'info_element_id' as its same as 'ieee80211_eid', below
the mapping of elements of enums which are used.

ITIM -> WLAN_EID_TIM
IDSPARMS -> WLAN_EID_DS_PARAMS

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/coreconfigurator.c | 47 ++---
 drivers/staging/wilc1000/host_interface.c   | 19 ++--
 drivers/staging/wilc1000/wilc_wlan_if.h | 10 --
 3 files changed, 12 insertions(+), 64 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index a987953..5933e4d 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -45,49 +45,6 @@ enum sub_frame_type {
FRAME_SUBTYPE_FORCE_32BIT  = 0x
 };
 
-enum info_element_id {
-   ISSID   = 0,   /* Service Set Identifier */
-   ISUPRATES   = 1,   /* Supported Rates*/
-   IFHPARMS= 2,   /* FH parameter set   */
-   IDSPARMS= 3,   /* DS parameter set   */
-   ICFPARMS= 4,   /* CF parameter set   */
-   ITIM= 5,   /* Traffic Information Map*/
-   IIBPARMS= 6,   /* IBSS parameter set */
-   ICOUNTRY= 7,   /* Country element*/
-   IEDCAPARAMS = 12,  /* EDCA parameter set */
-   ITSPEC  = 13,  /* Traffic Specification  */
-   ITCLAS  = 14,  /* Traffic Classification */
-   ISCHED  = 15,  /* Schedule   */
-   ICTEXT  = 16,  /* Challenge Text */
-   IPOWERCONSTRAINT= 32,  /* Power Constraint   */
-   IPOWERCAPABILITY= 33,  /* Power Capability   */
-   ITPCREQUEST = 34,  /* TPC Request*/
-   ITPCREPORT  = 35,  /* TPC Report */
-   ISUPCHANNEL = 36,  /* Supported channel list */
-   ICHSWANNOUNC= 37,  /* Channel Switch Announcement*/
-   IMEASUREMENTREQUEST = 38,  /* Measurement request*/
-   IMEASUREMENTREPORT  = 39,  /* Measurement report */
-   IQUIET  = 40,  /* Quiet element Info */
-   IIBSSDFS= 41,  /* IBSS DFS   */
-   IERPINFO= 42,  /* ERP Information*/
-   ITSDELAY= 43,  /* TS Delay   */
-   ITCLASPROCESS   = 44,  /* TCLAS Processing   */
-   IHTCAP  = 45,  /* HT Capabilities*/
-   IQOSCAP = 46,  /* QoS Capability */
-   IRSNELEMENT = 48,  /* RSN Information Element*/
-   IEXSUPRATES = 50,  /* Extended Supported Rates   */
-   IEXCHSWANNOUNC  = 60,  /* Extended Ch Switch Announcement*/
-   IHTOPERATION= 61,  /* HT Information */
-   ISECCHOFF   = 62,  /* Secondary Channel Offeset  */
-   I2040COEX   = 72,  /* 20/40 Coexistence IE   */
-   I2040INTOLCHREPORT  = 73,  /* 20/40 Intolerant channel report*/
-   IOBSSSCAN   = 74,  /* OBSS Scan parameters   */
-   IEXTCAP = 127, /* Extended capability*/
-   IWMM= 221, /* WMM parameters */
-   IWPAELEMENT = 221, /* WPA Information Element*/
-   INFOELEM_ID_FORCE_32BIT  = 0x
-};
-
 static inline u16 get_beacon_period(u8 *data)
 {
u16 bcn_per;
@@ -216,7 +173,7 @@ static u8 *get_tim_elm(u8 *msa, u16 rx_len, u16 
tag_param_offset)
index = tag_param_offset;
 
while (index < (rx_len - FCS_LEN)) {
-   if (msa[index] == ITIM)
+   if (msa[index] == WLAN_EID_TIM)
return [index];
index += (IE_HDR_LEN + msa[index + 1]);
}
@@ -230,7 +187,7 @@ static u8 get_current_channel_802_11n(u8 *msa, u16 rx_len)
 
index = TAG_PARAM_OFFSET;
while (index < (rx_len - FCS_LEN)) {
-   if (msa[index] == IDSPARMS)
+   if (msa[index] == WLAN_EID_DS_PARAMS)
return msa[index + 2];
index += msa[index + 1] + IE_HDR_LEN;
}
diff 

[PATCH 07/23] staging: wilc1000: rename enum SITESURVEY to use lowercase

2018-07-19 Thread Ajay Singh
Cleanup patch to have enum in lowercase as per linux coding style.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 drivers/staging/wilc1000/host_interface.h | 2 +-
 drivers/staging/wilc1000/wilc_wlan_if.h   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index cc64b14..a5c0ac5 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -635,7 +635,7 @@ static void handle_cfg_param(struct work_struct *work)
i++;
}
if (param->flag & SITE_SURVEY) {
-   enum SITESURVEY enabled = param->site_survey_enabled;
+   enum site_survey enabled = param->site_survey_enabled;
 
if (enabled < 3) {
wid_list[i].id = WID_SITE_SURVEY;
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 64fc269..7f3e48c 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -113,7 +113,7 @@ struct cfg_param_attr {
u8 txop_prot_disabled;
u16 beacon_interval;
u16 dtim_period;
-   enum SITESURVEY site_survey_enabled;
+   enum site_survey site_survey_enabled;
u16 site_survey_scan_time;
u8 scan_source;
u16 active_scan_time;
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h 
b/drivers/staging/wilc1000/wilc_wlan_if.h
index af414d7..b82e149 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -138,7 +138,7 @@ enum AUTHTYPE {
IEEE8021= 5
 };
 
-enum SITESURVEY {
+enum site_survey {
SITE_SURVEY_1CH = 0,
SITE_SURVEY_ALL_CH  = 1,
SITE_SURVEY_OFF = 2
-- 
2.7.4

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


[PATCH 00/23] staging: wilc1000: cleanup patch to follow linux coding style

2018-07-19 Thread Ajay Singh
This patch series contains modification to follow Linux coding style &
cleanup change to remove unused variables and enums.
Few patches also contain changes to remove unnecessary typecast.

Ajay Singh (23):
  staging: wilc1000: remove unused enum declaration
  staging: wilc1000: remove enum connect_status instead use
ieee80211_statuscode
  staging: wilc1000: remove extra enum defined for data rates
  staging: wilc1000: remove extra enums defined for ieee80211_eid
  staging: wilc1000: rename goto to avoid leading '_' in label name
  staging: wilc1000: rename enum CURRENT_TXRATE to use lowercase
  staging: wilc1000: rename enum SITESURVEY to use lowercase
  staging: wilc1000: rename enum AUTHTYPE to use lowercase
  staging: wilc1000: remove unused elements in 'wilc' struct
  staging: wilc1000: remove unnecessary elements from 'wilc_priv' struct
  staging: wilc1000: removed unused element from wilc_cfg_frame struct
  staging: wilc1000: remove the mutliple #define used for same macro
  staging: wilc1000: use lowercase for 'IFC_UP' struct element name
  staging: wilc1000: remove unnecessary blank line between variable
declaration
  staging: wilc1000: use single space before opening brances '{'
  staging: wilc1000: remove unnecessary type used for wid id
  staging: wilc1000: avoid forward declaration for handle_scan_done()
  staging: wilc1000: avoid host_int_get_assoc_res_info() forward
declaration
  staging: wilc1000: avoid forward declaration of
host_int_parse_join_bss_param()
  staging: wilc1000: avoid setting default value for variable at
declaration
  staging: wilc1000: use 'int' inplace of 's32' date type
  staging: wilc1000: remove unnecessary 'NULL' check from cfg80211_ops
callbacks
  staging: wilc1000: move variable assignment along with its declaration

 drivers/staging/wilc1000/coreconfigurator.c   |  84 +--
 drivers/staging/wilc1000/coreconfigurator.h   |  20 -
 drivers/staging/wilc1000/host_interface.c | 696 +++---
 drivers/staging/wilc1000/host_interface.h |  20 +-
 drivers/staging/wilc1000/linux_mon.c  |   2 -
 drivers/staging/wilc1000/linux_wlan.c | 122 ++--
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 307 +++---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  16 +-
 drivers/staging/wilc1000/wilc_wlan.c  |  65 +-
 drivers/staging/wilc1000/wilc_wlan.h  |   3 -
 drivers/staging/wilc1000/wilc_wlan_if.h   |  56 +-
 11 files changed, 517 insertions(+), 874 deletions(-)

-- 
2.7.4

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


[PATCH 03/23] staging: wilc1000: remove extra enum defined for data rates

2018-07-19 Thread Ajay Singh
Cleanup patch to remove extra enum defined to handle data rates.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c   |  2 +-
 drivers/staging/wilc1000/wilc_wlan_if.h | 16 
 2 files changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 0019bb8..032afc2 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -378,7 +378,7 @@ static int linux_wlan_init_test_config(struct net_device 
*dev,
if (!wilc_wlan_cfg_set(vif, 0, WID_BSS_TYPE, c_val, 1, 0, 0))
goto fail;
 
-   c_val[0] = RATE_AUTO;
+   c_val[0] = AUTORATE;
if (!wilc_wlan_cfg_set(vif, 0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0))
goto fail;
 
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h 
b/drivers/staging/wilc1000/wilc_wlan_if.h
index 85ac878..b23f86c 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -88,22 +88,6 @@ enum bss_types {
 };
 
 enum {
-   RATE_AUTO   = 0,
-   RATE_1MB= 1,
-   RATE_2MB= 2,
-   RATE_5MB= 5,
-   RATE_6MB= 6,
-   RATE_9MB= 9,
-   RATE_11MB   = 11,
-   RATE_12MB   = 12,
-   RATE_18MB   = 18,
-   RATE_24MB   = 24,
-   RATE_26MB   = 36,
-   RATE_48MB   = 48,
-   RATE_54MB   = 54
-};
-
-enum {
B_ONLY_MODE = 0,/* 1, 2 M, otherwise 5, 11 M */
G_ONLY_MODE,/* 6,12,24 otherwise 9,18,36,48,54 */
G_MIXED_11B_1_MODE, /* 1,2,5.5,11 otherwise all on */
-- 
2.7.4

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


[PATCH 02/23] staging: wilc1000: remove enum connect_status instead use ieee80211_statuscode

2018-07-19 Thread Ajay Singh
Cleanup patch to remove the use of enum 'connect_status' and instead use
predefined 'ieee80211_statuscode' for error code values.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/coreconfigurator.c   |  4 +++-
 drivers/staging/wilc1000/coreconfigurator.h   | 20 
 drivers/staging/wilc1000/host_interface.c |  6 +++---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  2 +-
 4 files changed, 7 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 0063895..a987953 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -1,4 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
+#include 
+
 #include "coreconfigurator.h"
 
 #define TAG_PARAM_OFFSET   (MAC_HDR_LEN + TIME_STAMP_LEN + \
@@ -316,7 +318,7 @@ s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
u16 ies_len = 0;
 
ret_conn_info->status = get_asoc_status(buffer);
-   if (ret_conn_info->status == SUCCESSFUL_STATUSCODE) {
+   if (ret_conn_info->status == WLAN_STATUS_SUCCESS) {
ies = [CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
ies_len = buffer_len - (CAP_INFO_LEN + STATUS_CODE_LEN +
AID_LEN);
diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
b/drivers/staging/wilc1000/coreconfigurator.h
index 55b5531..90d3d65 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -24,26 +24,6 @@
 #define MAKE_WORD16(lsb, msb) u16)(msb) << 8) & 0xFF00) | (lsb))
 #define MAKE_WORD32(lsw, msw) u32)(msw) << 16) & 0x) | (lsw))
 
-enum connect_status {
-   SUCCESSFUL_STATUSCODE= 0,
-   UNSPEC_FAIL  = 1,
-   UNSUP_CAP= 10,
-   REASOC_NO_ASOC   = 11,
-   FAIL_OTHER   = 12,
-   UNSUPT_ALG   = 13,
-   AUTH_SEQ_FAIL= 14,
-   CHLNG_FAIL   = 15,
-   AUTH_TIMEOUT = 16,
-   AP_FULL  = 17,
-   UNSUP_RATE   = 18,
-   SHORT_PREAMBLE_UNSUP = 19,
-   PBCC_UNSUP   = 20,
-   CHANNEL_AGIL_UNSUP   = 21,
-   SHORT_SLOT_UNSUP = 25,
-   OFDM_DSSS_UNSUP  = 26,
-   CONNECT_STS_FORCE_16_BIT = 0x
-};
-
 struct rssi_history_buffer {
bool full;
u8 index;
diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 918d06e..9b5bf3c 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1336,7 +1336,7 @@ static inline void host_int_parse_assoc_resp_info(struct 
wilc_vif *vif,
}
 
if (mac_status == MAC_STATUS_CONNECTED &&
-   conn_info.status != SUCCESSFUL_STATUSCODE) {
+   conn_info.status != WLAN_STATUS_SUCCESS) {
netdev_err(vif->ndev,
   "Received MAC status is MAC_STATUS_CONNECTED while 
the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n");
eth_zero_addr(wilc_connected_ssid);
@@ -1349,7 +1349,7 @@ static inline void host_int_parse_assoc_resp_info(struct 
wilc_vif *vif,
memcpy(conn_info.bssid, hif_drv->usr_conn_req.bssid, 6);
 
if (mac_status == MAC_STATUS_CONNECTED &&
-   conn_info.status == SUCCESSFUL_STATUSCODE) {
+   conn_info.status == WLAN_STATUS_SUCCESS) {
memcpy(hif_drv->assoc_bssid,
   hif_drv->usr_conn_req.bssid, ETH_ALEN);
}
@@ -1369,7 +1369,7 @@ static inline void host_int_parse_assoc_resp_info(struct 
wilc_vif *vif,
  hif_drv->usr_conn_req.arg);
 
if (mac_status == MAC_STATUS_CONNECTED &&
-   conn_info.status == SUCCESSFUL_STATUSCODE) {
+   conn_info.status == WLAN_STATUS_SUCCESS) {
wilc_set_power_mgmt(vif, 0, 0);
 
hif_drv->hif_state = HOST_IF_CONNECTED;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index e96163f..f90b9b6 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -489,7 +489,7 @@ static void cfg_connect_result(enum conn_event 
conn_disconn_evt,
connect_status = conn_info->status;
 
if (mac_status == MAC_STATUS_DISCONNECTED &&
-   conn_info->status == SUCCESSFUL_STATUSCODE) {
+   conn_info->status == WLAN_STATUS_SUCCESS) {
connect_status = WLAN_STATUS_UNSPECIFIED_FAILURE;
wilc_wlan_set_bssid(priv->dev, null_bssid,
STATION_MODE);
-- 
2.7.4


[PATCH 01/23] staging: wilc1000: remove unused enum declaration

2018-07-19 Thread Ajay Singh
Cleanup patch to remove unused enums.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/coreconfigurator.c |  8 
 drivers/staging/wilc1000/host_interface.h   |  6 --
 drivers/staging/wilc1000/wilc_wlan_if.h | 26 --
 3 files changed, 40 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 4481602..0063895 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -4,14 +4,6 @@
 #define TAG_PARAM_OFFSET   (MAC_HDR_LEN + TIME_STAMP_LEN + \
 BEACON_INTERVAL_LEN + CAP_INFO_LEN)
 
-enum basic_frame_type {
-   FRAME_TYPE_CONTROL = 0x04,
-   FRAME_TYPE_DATA= 0x08,
-   FRAME_TYPE_MANAGEMENT  = 0x00,
-   FRAME_TYPE_RESERVED= 0x0C,
-   FRAME_TYPE_FORCE_32BIT = 0x
-};
-
 enum sub_frame_type {
ASSOC_REQ = 0x00,
ASSOC_RSP = 0x10,
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 0ea22ab..3cd97dd 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -252,12 +252,6 @@ struct reg_frame {
u8 reg_id;
 };
 
-enum p2p_listen_state {
-   P2P_IDLE,
-   P2P_LISTEN,
-   P2P_GRP_FORMATION
-};
-
 struct wilc;
 struct host_if_drv {
struct user_scan_req usr_scan_req;
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h 
b/drivers/staging/wilc1000/wilc_wlan_if.h
index e4a7bf5..85ac878 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -176,12 +176,6 @@ enum {
 };
 
 enum {
-   DONT_RESET  = 0,
-   DO_RESET= 1,
-   NO_REQUEST  = 2,
-};
-
-enum {
REKEY_DISABLE   = 1,
REKEY_TIME_BASE,
REKEY_PKT_BASE,
@@ -195,17 +189,6 @@ enum {
 };
 
 enum {
-   PRI_HIGH_RSSI   = 0x00,
-   PRI_LOW_RSSI= 0x04,
-   PRI_DETECT  = 0x08
-};
-
-enum {
-   CH_FILTER_OFF   = 0x00,
-   CH_FILTER_ON= 0x10
-};
-
-enum {
AUTO_PROT   = 0,/* Auto */
NO_PROT,/* Do not use any protection */
ERP_PROT,   /* Protect all ERP frame exchanges */
@@ -244,15 +227,6 @@ enum {
MIMO_MODE   = 3,/* power save disable */
 };
 
-enum {
-   DISABLE_SELF_CTS,
-   ENABLE_SELF_CTS,
-   DISABLE_TX_ABORT,
-   ENABLE_TX_ABORT,
-   HW_TRIGGER_ABORT,
-   SW_TRIGGER_ABORT,
-};
-
 enum wid_type {
WID_CHAR= 0,
WID_SHORT   = 1,
-- 
2.7.4

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