[PATCH v2 1/7] staging: ccree: rename staging ver and mark as broken

2018-01-22 Thread Gilad Ben-Yossef
Rename the Kconfig var of the staging tree version of the driver
in preparation of introducing the final version of the driver
into the cryptodev tree to avoid link time symbol collisions.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/Kconfig  | 4 ++--
 drivers/staging/ccree/Makefile | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/ccree/Kconfig b/drivers/staging/ccree/Kconfig
index 0b3092b..a84b6ab 100644
--- a/drivers/staging/ccree/Kconfig
+++ b/drivers/staging/ccree/Kconfig
@@ -1,6 +1,6 @@
-config CRYPTO_DEV_CCREE
+config CRYPTO_DEV_CCREE_OLD
tristate "Support for ARM TrustZone CryptoCell C7XX family of Crypto 
accelerators"
-   depends on CRYPTO && CRYPTO_HW && OF && HAS_DMA
+   depends on CRYPTO && CRYPTO_HW && OF && HAS_DMA && BROKEN
default n
select CRYPTO_HASH
select CRYPTO_BLKCIPHER
diff --git a/drivers/staging/ccree/Makefile b/drivers/staging/ccree/Makefile
index ae702f3..1e7d105 100644
--- a/drivers/staging/ccree/Makefile
+++ b/drivers/staging/ccree/Makefile
@@ -1,3 +1,3 @@
-obj-$(CONFIG_CRYPTO_DEV_CCREE) := ccree.o
+obj-$(CONFIG_CRYPTO_DEV_CCREE_OLD) := ccree.o
 ccree-y := ssi_driver.o ssi_sysfs.o ssi_buffer_mgr.o ssi_request_mgr.o 
ssi_cipher.o ssi_hash.o ssi_aead.o ssi_ivgen.o ssi_sram_mgr.o ssi_pm.o
 ccree-$(CONFIG_CRYPTO_FIPS) += ssi_fips.o
-- 
2.7.4

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


[PATCH v2 0/7] crypto: ccree: Introduce Arm TrustZone CryptoCell

2018-01-22 Thread Gilad Ben-Yossef
Arm TrustZone CryptoCell is a security hardware IP that
includes support for hardware based hash, digest, cipher
and AEAD operations. This driver provides support for
these as part of the Linux Crypto sub-system.

The driver spent some time now in the staging tree being
cleaned up and is now submitted for review for the
purpose of moving into the crypto tree. The first patch
therefore renames its copy in the staging directory
Kconfig define and marks it broken, otherwise there is a
build failure due to global symbols collisions.

Please note that the driver include stubs for yet
unexposed functionality (ivgen and secure HW keys),
which will be added later.

Signed-off-by: Gilad Ben-Yossef 

Changes from v1:
- Use KConfig directive to stop staging tree version to not
  collide during link time as opposed to deleting it as indicated
  by Greg KH.
- Switched from legacy ablkcipher to skcipher interface as
  indicated by Corentin Labbe.
- Removed unused zero_buff struct as indicated by Corentin Labbe.
- Moved to kzfree for all IV/key buffers as indicated by
  Corentin Labbe.
- Moved to using __des3_ede_setkey() in lieu of home grown
  version as indicated by Stephan Mueller.
- Fixed multiple small coding style from Dan Carpenter and others.
- Fixed pointer signedness sparse warnings as indicated by Jeremy
  Sowden.
- Rename all registered algs driver name to -ccree prefix

Gilad Ben-Yossef (7):
  staging: ccree: rename staging ver and mark as broken
  crypto: ccree: introduce CryptoCell driver
  crypto: ccree: add skcipher support
  crypto: ccree: add ahash support
  crypto: ccree: add AEAD support
  crypto: ccree: add FIPS support
  MAINTAINERS: update ccree entry

 MAINTAINERS |5 +-
 drivers/crypto/Kconfig  |   27 +
 drivers/crypto/Makefile |1 +
 drivers/crypto/ccree/Makefile   |7 +
 drivers/crypto/ccree/cc_aead.c  | 2702 +++
 drivers/crypto/ccree/cc_aead.h  |  109 ++
 drivers/crypto/ccree/cc_buffer_mgr.c| 1651 +++
 drivers/crypto/ccree/cc_buffer_mgr.h|   72 +
 drivers/crypto/ccree/cc_cipher.c| 1130 +
 drivers/crypto/ccree/cc_cipher.h|   59 +
 drivers/crypto/ccree/cc_crypto_ctx.h|  170 ++
 drivers/crypto/ccree/cc_debugfs.c   |  101 ++
 drivers/crypto/ccree/cc_debugfs.h   |   32 +
 drivers/crypto/ccree/cc_driver.c|  476 ++
 drivers/crypto/ccree/cc_driver.h|  194 +++
 drivers/crypto/ccree/cc_fips.c  |  111 ++
 drivers/crypto/ccree/cc_fips.h  |   37 +
 drivers/crypto/ccree/cc_hash.c  | 2296 ++
 drivers/crypto/ccree/cc_hash.h  |  114 ++
 drivers/crypto/ccree/cc_host_regs.h |  142 ++
 drivers/crypto/ccree/cc_hw_queue_defs.h |  590 +++
 drivers/crypto/ccree/cc_ivgen.c |  280 
 drivers/crypto/ccree/cc_ivgen.h |   55 +
 drivers/crypto/ccree/cc_kernel_regs.h   |  167 ++
 drivers/crypto/ccree/cc_lli_defs.h  |   59 +
 drivers/crypto/ccree/cc_pm.c|  122 ++
 drivers/crypto/ccree/cc_pm.h|   57 +
 drivers/crypto/ccree/cc_request_mgr.c   |  713 
 drivers/crypto/ccree/cc_request_mgr.h   |   51 +
 drivers/crypto/ccree/cc_sram_mgr.c  |  107 ++
 drivers/crypto/ccree/cc_sram_mgr.h  |   65 +
 drivers/staging/ccree/Kconfig   |4 +-
 drivers/staging/ccree/Makefile  |2 +-
 33 files changed, 11702 insertions(+), 6 deletions(-)
 create mode 100644 drivers/crypto/ccree/Makefile
 create mode 100644 drivers/crypto/ccree/cc_aead.c
 create mode 100644 drivers/crypto/ccree/cc_aead.h
 create mode 100644 drivers/crypto/ccree/cc_buffer_mgr.c
 create mode 100644 drivers/crypto/ccree/cc_buffer_mgr.h
 create mode 100644 drivers/crypto/ccree/cc_cipher.c
 create mode 100644 drivers/crypto/ccree/cc_cipher.h
 create mode 100644 drivers/crypto/ccree/cc_crypto_ctx.h
 create mode 100644 drivers/crypto/ccree/cc_debugfs.c
 create mode 100644 drivers/crypto/ccree/cc_debugfs.h
 create mode 100644 drivers/crypto/ccree/cc_driver.c
 create mode 100644 drivers/crypto/ccree/cc_driver.h
 create mode 100644 drivers/crypto/ccree/cc_fips.c
 create mode 100644 drivers/crypto/ccree/cc_fips.h
 create mode 100644 drivers/crypto/ccree/cc_hash.c
 create mode 100644 drivers/crypto/ccree/cc_hash.h
 create mode 100644 drivers/crypto/ccree/cc_host_regs.h
 create mode 100644 drivers/crypto/ccree/cc_hw_queue_defs.h
 create mode 100644 drivers/crypto/ccree/cc_ivgen.c
 create mode 100644 drivers/crypto/ccree/cc_ivgen.h
 create mode 100644 drivers/crypto/ccree/cc_kernel_regs.h
 create mode 100644 drivers/crypto/ccree/cc_lli_defs.h
 create mode 100644 drivers/crypto/ccree/cc_pm.c
 create mode 100644 drivers/crypto/ccree/cc_pm.h
 create mode 100644 drivers/crypto/ccree/cc_request_mgr.c
 create mode 100644 drivers/crypto/ccree/cc_request_mgr.h
 create mode 100644 drivers/crypto/ccree/cc_sram_mgr.c
 create mode 100644 drivers/crypto

[PATCH v2 7/7] MAINTAINERS: update ccree entry

2018-01-22 Thread Gilad Ben-Yossef
Update Arm TrustZone CryptoCell driver entry move into drivers/crypto/

Signed-off-by: Gilad Ben-Yossef 
---
 MAINTAINERS | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 1082846..560e068 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3273,12 +3273,11 @@ F:  drivers/net/ieee802154/cc2520.c
 F: include/linux/spi/cc2520.h
 F: Documentation/devicetree/bindings/net/ieee802154/cc2520.txt
 
-CCREE ARM TRUSTZONE CRYPTOCELL 700 REE DRIVER
+CCREE ARM TRUSTZONE CRYPTOCELL REE DRIVER
 M: Gilad Ben-Yossef 
 L: linux-cry...@vger.kernel.org
-L: driverdev-devel@linuxdriverproject.org
 S: Supported
-F: drivers/staging/ccree/
+F: drivers/crypto/ccree/
 W: 
https://developer.arm.com/products/system-ip/trustzone-cryptocell/cryptocell-700-family
 
 CEC FRAMEWORK
-- 
2.7.4

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


[PATCH v2 2/7] crypto: ccree: introduce CryptoCell driver

2018-01-22 Thread Gilad Ben-Yossef
Introduce basic low level Arm TrustZone CryptoCell HW support.
This first patch doesn't actually register any Crypto API
transformations, these will follow up in the next patch.

This first revision supports the CC 712 REE component.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/crypto/Kconfig  |  27 ++
 drivers/crypto/Makefile |   1 +
 drivers/crypto/ccree/Makefile   |   6 +
 drivers/crypto/ccree/cc_buffer_mgr.c| 387 +
 drivers/crypto/ccree/cc_buffer_mgr.h|  60 +++
 drivers/crypto/ccree/cc_crypto_ctx.h| 170 
 drivers/crypto/ccree/cc_debugfs.c   | 101 +
 drivers/crypto/ccree/cc_debugfs.h   |  32 ++
 drivers/crypto/ccree/cc_driver.c| 417 +++
 drivers/crypto/ccree/cc_driver.h| 186 +
 drivers/crypto/ccree/cc_host_regs.h | 142 +++
 drivers/crypto/ccree/cc_hw_queue_defs.h | 590 ++
 drivers/crypto/ccree/cc_ivgen.c | 280 +
 drivers/crypto/ccree/cc_ivgen.h |  55 +++
 drivers/crypto/ccree/cc_kernel_regs.h   | 167 
 drivers/crypto/ccree/cc_lli_defs.h  |  59 +++
 drivers/crypto/ccree/cc_pm.c| 118 ++
 drivers/crypto/ccree/cc_pm.h|  57 +++
 drivers/crypto/ccree/cc_request_mgr.c   | 713 
 drivers/crypto/ccree/cc_request_mgr.h   |  51 +++
 drivers/crypto/ccree/cc_sram_mgr.c  | 107 +
 drivers/crypto/ccree/cc_sram_mgr.h  |  65 +++
 22 files changed, 3791 insertions(+)
 create mode 100644 drivers/crypto/ccree/Makefile
 create mode 100644 drivers/crypto/ccree/cc_buffer_mgr.c
 create mode 100644 drivers/crypto/ccree/cc_buffer_mgr.h
 create mode 100644 drivers/crypto/ccree/cc_crypto_ctx.h
 create mode 100644 drivers/crypto/ccree/cc_debugfs.c
 create mode 100644 drivers/crypto/ccree/cc_debugfs.h
 create mode 100644 drivers/crypto/ccree/cc_driver.c
 create mode 100644 drivers/crypto/ccree/cc_driver.h
 create mode 100644 drivers/crypto/ccree/cc_host_regs.h
 create mode 100644 drivers/crypto/ccree/cc_hw_queue_defs.h
 create mode 100644 drivers/crypto/ccree/cc_ivgen.c
 create mode 100644 drivers/crypto/ccree/cc_ivgen.h
 create mode 100644 drivers/crypto/ccree/cc_kernel_regs.h
 create mode 100644 drivers/crypto/ccree/cc_lli_defs.h
 create mode 100644 drivers/crypto/ccree/cc_pm.c
 create mode 100644 drivers/crypto/ccree/cc_pm.h
 create mode 100644 drivers/crypto/ccree/cc_request_mgr.c
 create mode 100644 drivers/crypto/ccree/cc_request_mgr.h
 create mode 100644 drivers/crypto/ccree/cc_sram_mgr.c
 create mode 100644 drivers/crypto/ccree/cc_sram_mgr.h

diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
index 47ec920..ed912bf 100644
--- a/drivers/crypto/Kconfig
+++ b/drivers/crypto/Kconfig
@@ -731,4 +731,31 @@ config CRYPTO_DEV_ARTPEC6
 
  To compile this driver as a module, choose M here.
 
+config CRYPTO_DEV_CCREE
+   tristate "Support for ARM TrustZone CryptoCell family of security 
processors"
+   depends on CRYPTO && CRYPTO_HW && OF && HAS_DMA
+   default n
+   select CRYPTO_HASH
+   select CRYPTO_BLKCIPHER
+   select CRYPTO_DES
+   select CRYPTO_AEAD
+   select CRYPTO_AUTHENC
+   select CRYPTO_SHA1
+   select CRYPTO_MD5
+   select CRYPTO_SHA256
+   select CRYPTO_SHA512
+   select CRYPTO_HMAC
+   select CRYPTO_AES
+   select CRYPTO_CBC
+   select CRYPTO_ECB
+   select CRYPTO_CTR
+   select CRYPTO_XTS
+   help
+ Say 'Y' to enable a driver for the Arm TrustZone CryptoCell
+ family of processors. Currently only the CryptoCell 712 REE
+ is supported.
+ Choose this if you wish to use hardware acceleration of
+ cryptographic operations on the system REE.
+ If unsure say Y.
+
 endif # CRYPTO_HW
diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile
index 2513d13..ee5ec5c9 100644
--- a/drivers/crypto/Makefile
+++ b/drivers/crypto/Makefile
@@ -6,6 +6,7 @@ obj-$(CONFIG_CRYPTO_DEV_ATMEL_ECC) += atmel-ecc.o
 obj-$(CONFIG_CRYPTO_DEV_BFIN_CRC) += bfin_crc.o
 obj-$(CONFIG_CRYPTO_DEV_CAVIUM_ZIP) += cavium/
 obj-$(CONFIG_CRYPTO_DEV_CCP) += ccp/
+obj-$(CONFIG_CRYPTO_DEV_CCREE) += ccree/
 obj-$(CONFIG_CRYPTO_DEV_CHELSIO) += chelsio/
 obj-$(CONFIG_CRYPTO_DEV_CPT) += cavium/cpt/
 obj-$(CONFIG_CRYPTO_DEV_NITROX) += cavium/nitrox/
diff --git a/drivers/crypto/ccree/Makefile b/drivers/crypto/ccree/Makefile
new file mode 100644
index 000..6b204ab
--- /dev/null
+++ b/drivers/crypto/ccree/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-$(CONFIG_CRYPTO_DEV_CCREE) := ccree.o
+ccree-y := cc_driver.o cc_buffer_mgr.o cc_request_mgr.o cc_ivgen.o 
cc_sram_mgr.o
+ccree-$(CONFIG_DEBUG_FS) += cc_debugfs.o
+ccree-$(CONFIG_PM) += cc_pm.o
diff --git a/drivers/crypto/ccree/cc_buffer_mgr.c 
b/drivers/crypto/ccree/cc_buffer_mgr.c
new file mode 100644
index 000..4c67579
--- /dev/null
+++ b/drivers/crypto/ccree/cc_buffer_mgr.c
@@ -0,0

[PATCH v2 6/7] crypto: ccree: add FIPS support

2018-01-22 Thread Gilad Ben-Yossef
Add FIPS mode support to CryptoCell driver

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/crypto/ccree/Makefile|   1 +
 drivers/crypto/ccree/cc_driver.c |  29 +-
 drivers/crypto/ccree/cc_driver.h |   1 +
 drivers/crypto/ccree/cc_fips.c   | 111 +++
 drivers/crypto/ccree/cc_fips.h   |  37 +
 5 files changed, 177 insertions(+), 2 deletions(-)
 create mode 100644 drivers/crypto/ccree/cc_fips.c
 create mode 100644 drivers/crypto/ccree/cc_fips.h

diff --git a/drivers/crypto/ccree/Makefile b/drivers/crypto/ccree/Makefile
index 7cb3082..bdc2797 100644
--- a/drivers/crypto/ccree/Makefile
+++ b/drivers/crypto/ccree/Makefile
@@ -2,5 +2,6 @@
 
 obj-$(CONFIG_CRYPTO_DEV_CCREE) := ccree.o
 ccree-y := cc_driver.o cc_buffer_mgr.o cc_request_mgr.o cc_cipher.o cc_hash.o 
cc_aead.o cc_ivgen.o cc_sram_mgr.o
+ccree-$(CONFIG_CRYPTO_FIPS) += cc_fips.o
 ccree-$(CONFIG_DEBUG_FS) += cc_debugfs.o
 ccree-$(CONFIG_PM) += cc_pm.o
diff --git a/drivers/crypto/ccree/cc_driver.c b/drivers/crypto/ccree/cc_driver.c
index 8a530a4..827e329 100644
--- a/drivers/crypto/ccree/cc_driver.c
+++ b/drivers/crypto/ccree/cc_driver.c
@@ -25,6 +25,7 @@
 #include "cc_ivgen.h"
 #include "cc_sram_mgr.h"
 #include "cc_pm.h"
+#include "cc_fips.h"
 
 bool cc_dump_desc;
 module_param_named(dump_desc, cc_dump_desc, bool, 0600);
@@ -78,7 +79,17 @@ static irqreturn_t cc_isr(int irq, void *dev_id)
irr &= ~CC_COMP_IRQ_MASK;
complete_request(drvdata);
}
-
+#ifdef CONFIG_CRYPTO_FIPS
+   /* TEE FIPS interrupt */
+   if (irr & CC_GPR0_IRQ_MASK) {
+   /* Mask interrupt - will be unmasked in Deferred service
+* handler
+*/
+   cc_iowrite(drvdata, CC_REG(HOST_IMR), imr | CC_GPR0_IRQ_MASK);
+   irr &= ~CC_GPR0_IRQ_MASK;
+   fips_handler(drvdata);
+   }
+#endif
/* AXI error interrupt */
if (irr & CC_AXI_ERR_IRQ_MASK) {
u32 axi_err;
@@ -243,10 +254,15 @@ static int init_cc_resources(struct platform_device 
*plat_dev)
goto post_regs_err;
}
 
+   rc = cc_fips_init(new_drvdata);
+   if (rc) {
+   dev_err(dev, "CC_FIPS_INIT failed 0x%x\n", rc);
+   goto post_debugfs_err;
+   }
rc = cc_sram_mgr_init(new_drvdata);
if (rc) {
dev_err(dev, "cc_sram_mgr_init failed\n");
-   goto post_debugfs_err;
+   goto post_fips_init_err;
}
 
new_drvdata->mlli_sram_addr =
@@ -301,6 +317,12 @@ static int init_cc_resources(struct platform_device 
*plat_dev)
goto post_hash_err;
}
 
+   /* If we got here and FIPS mode is enabled
+* it means all FIPS test passed, so let TEE
+* know we're good.
+*/
+   cc_set_ree_fips_status(new_drvdata, true);
+
return 0;
 
 post_hash_err:
@@ -317,6 +339,8 @@ static int init_cc_resources(struct platform_device 
*plat_dev)
cc_req_mgr_fini(new_drvdata);
 post_sram_mgr_err:
cc_sram_mgr_fini(new_drvdata);
+post_fips_init_err:
+   cc_fips_fini(new_drvdata);
 post_debugfs_err:
cc_debugfs_fini(new_drvdata);
 post_regs_err:
@@ -345,6 +369,7 @@ static void cleanup_cc_resources(struct platform_device 
*plat_dev)
cc_buffer_mgr_fini(drvdata);
cc_req_mgr_fini(drvdata);
cc_sram_mgr_fini(drvdata);
+   cc_fips_fini(drvdata);
cc_debugfs_fini(drvdata);
fini_cc_regs(drvdata);
cc_clk_off(drvdata);
diff --git a/drivers/crypto/ccree/cc_driver.h b/drivers/crypto/ccree/cc_driver.h
index 0109c64..9cc488f 100644
--- a/drivers/crypto/ccree/cc_driver.h
+++ b/drivers/crypto/ccree/cc_driver.h
@@ -116,6 +116,7 @@ struct cc_drvdata {
void *hash_handle;
void *aead_handle;
void *request_mgr_handle;
+   void *fips_handle;
void *ivgen_handle;
void *sram_mgr_handle;
void *debugfs;
diff --git a/drivers/crypto/ccree/cc_fips.c b/drivers/crypto/ccree/cc_fips.c
new file mode 100644
index 000..de08af9
--- /dev/null
+++ b/drivers/crypto/ccree/cc_fips.c
@@ -0,0 +1,111 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */
+
+#include 
+#include 
+
+#include "cc_driver.h"
+#include "cc_fips.h"
+
+static void fips_dsr(unsigned long devarg);
+
+struct cc_fips_handle {
+   struct tasklet_struct tasklet;
+};
+
+/* The function called once at driver entry point to check
+ * whether TEE FIPS error occurred.
+ */
+static bool cc_get_tee_fips_status(struct cc_drvdata *drvdata)
+{
+   u32 reg;
+
+   reg = cc_ioread(drvdata, CC_REG(GPR_HOST));
+   return (reg == (CC_FIPS_SYNC_TEE_STATUS | CC_FIPS_SYNC_MODULE_OK));
+}
+
+/*
+ * This function should push the FIPS REE library status towards the TEE 
library
+ * by writing the error state to HOST_GPR0 register.
+ */
+void cc_set_ree_fips_status(struct cc_drvdata *drvdata, bo

[PATCH v2 3/7] crypto: ccree: add skcipher support

2018-01-22 Thread Gilad Ben-Yossef
Add CryptoCell skcipher support

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/crypto/ccree/Makefile|2 +-
 drivers/crypto/ccree/cc_buffer_mgr.c |  125 
 drivers/crypto/ccree/cc_buffer_mgr.h |8 +
 drivers/crypto/ccree/cc_cipher.c | 1130 ++
 drivers/crypto/ccree/cc_cipher.h |   59 ++
 drivers/crypto/ccree/cc_driver.c |   11 +
 drivers/crypto/ccree/cc_driver.h |6 +-
 7 files changed, 1339 insertions(+), 2 deletions(-)
 create mode 100644 drivers/crypto/ccree/cc_cipher.c
 create mode 100644 drivers/crypto/ccree/cc_cipher.h

diff --git a/drivers/crypto/ccree/Makefile b/drivers/crypto/ccree/Makefile
index 6b204ab..a7fecad 100644
--- a/drivers/crypto/ccree/Makefile
+++ b/drivers/crypto/ccree/Makefile
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 
 obj-$(CONFIG_CRYPTO_DEV_CCREE) := ccree.o
-ccree-y := cc_driver.o cc_buffer_mgr.o cc_request_mgr.o cc_ivgen.o 
cc_sram_mgr.o
+ccree-y := cc_driver.o cc_buffer_mgr.o cc_request_mgr.o cc_cipher.o cc_ivgen.o 
cc_sram_mgr.o
 ccree-$(CONFIG_DEBUG_FS) += cc_debugfs.o
 ccree-$(CONFIG_PM) += cc_pm.o
diff --git a/drivers/crypto/ccree/cc_buffer_mgr.c 
b/drivers/crypto/ccree/cc_buffer_mgr.c
index 4c67579..46be101 100644
--- a/drivers/crypto/ccree/cc_buffer_mgr.c
+++ b/drivers/crypto/ccree/cc_buffer_mgr.c
@@ -8,6 +8,7 @@
 
 #include "cc_buffer_mgr.h"
 #include "cc_lli_defs.h"
+#include "cc_cipher.h"
 
 enum dma_buffer_type {
DMA_NULL_TYPE = -1,
@@ -347,6 +348,130 @@ static int cc_map_sg(struct device *dev, struct 
scatterlist *sg,
return 0;
 }
 
+void cc_unmap_cipher_request(struct device *dev, void *ctx,
+unsigned int ivsize, struct scatterlist *src,
+struct scatterlist *dst)
+{
+   struct cipher_req_ctx *req_ctx = (struct cipher_req_ctx *)ctx;
+
+   if (req_ctx->gen_ctx.iv_dma_addr) {
+   dev_dbg(dev, "Unmapped iv: iv_dma_addr=%pad iv_size=%u\n",
+   &req_ctx->gen_ctx.iv_dma_addr, ivsize);
+   dma_unmap_single(dev, req_ctx->gen_ctx.iv_dma_addr,
+ivsize,
+req_ctx->is_giv ? DMA_BIDIRECTIONAL :
+DMA_TO_DEVICE);
+   }
+   /* Release pool */
+   if (req_ctx->dma_buf_type == CC_DMA_BUF_MLLI &&
+   req_ctx->mlli_params.mlli_virt_addr) {
+   dma_pool_free(req_ctx->mlli_params.curr_pool,
+ req_ctx->mlli_params.mlli_virt_addr,
+ req_ctx->mlli_params.mlli_dma_addr);
+   }
+
+   dma_unmap_sg(dev, src, req_ctx->in_nents, DMA_BIDIRECTIONAL);
+   dev_dbg(dev, "Unmapped req->src=%pK\n", sg_virt(src));
+
+   if (src != dst) {
+   dma_unmap_sg(dev, dst, req_ctx->out_nents, DMA_BIDIRECTIONAL);
+   dev_dbg(dev, "Unmapped req->dst=%pK\n", sg_virt(dst));
+   }
+}
+
+int cc_map_cipher_request(struct cc_drvdata *drvdata, void *ctx,
+ unsigned int ivsize, unsigned int nbytes,
+ void *info, struct scatterlist *src,
+ struct scatterlist *dst, gfp_t flags)
+{
+   struct cipher_req_ctx *req_ctx = (struct cipher_req_ctx *)ctx;
+   struct mlli_params *mlli_params = &req_ctx->mlli_params;
+   struct buff_mgr_handle *buff_mgr = drvdata->buff_mgr_handle;
+   struct device *dev = drvdata_to_dev(drvdata);
+   struct buffer_array sg_data;
+   u32 dummy = 0;
+   int rc = 0;
+   u32 mapped_nents = 0;
+
+   req_ctx->dma_buf_type = CC_DMA_BUF_DLLI;
+   mlli_params->curr_pool = NULL;
+   sg_data.num_of_buffers = 0;
+
+   /* Map IV buffer */
+   if (ivsize) {
+   dump_byte_array("iv", (u8 *)info, ivsize);
+   req_ctx->gen_ctx.iv_dma_addr =
+   dma_map_single(dev, (void *)info,
+  ivsize,
+  req_ctx->is_giv ? DMA_BIDIRECTIONAL :
+  DMA_TO_DEVICE);
+   if (dma_mapping_error(dev, req_ctx->gen_ctx.iv_dma_addr)) {
+   dev_err(dev, "Mapping iv %u B at va=%pK for DMA 
failed\n",
+   ivsize, info);
+   return -ENOMEM;
+   }
+   dev_dbg(dev, "Mapped iv %u B at va=%pK to dma=%pad\n",
+   ivsize, info, &req_ctx->gen_ctx.iv_dma_addr);
+   } else {
+   req_ctx->gen_ctx.iv_dma_addr = 0;
+   }
+
+   /* Map the src SGL */
+   rc = cc_map_sg(dev, src, nbytes, DMA_BIDIRECTIONAL, &req_ctx->in_nents,
+  LLI_MAX_NUM_OF_DATA_ENTRIES, &dummy, &mapped_nents);
+   if (rc) {
+   rc = -ENOMEM;
+   goto cipher_exit;
+   }
+   if (mapped_nents > 1)
+   req_ctx->dma_buf_type = CC_DMA_BUF_MLLI;
+
+   if (src == dst) {
+   /* Ha

[PATCH v2 4/7] crypto: ccree: add ahash support

2018-01-22 Thread Gilad Ben-Yossef
Add CryptoCell async. hash and HMAC support.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/crypto/ccree/Makefile|2 +-
 drivers/crypto/ccree/cc_buffer_mgr.c |  261 +++-
 drivers/crypto/ccree/cc_driver.c |   13 +
 drivers/crypto/ccree/cc_driver.h |1 +
 drivers/crypto/ccree/cc_hash.c   | 2296 ++
 drivers/crypto/ccree/cc_hash.h   |  114 ++
 drivers/crypto/ccree/cc_pm.c |4 +
 7 files changed, 2688 insertions(+), 3 deletions(-)
 create mode 100644 drivers/crypto/ccree/cc_hash.c
 create mode 100644 drivers/crypto/ccree/cc_hash.h

diff --git a/drivers/crypto/ccree/Makefile b/drivers/crypto/ccree/Makefile
index a7fecad..1109480 100644
--- a/drivers/crypto/ccree/Makefile
+++ b/drivers/crypto/ccree/Makefile
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 
 obj-$(CONFIG_CRYPTO_DEV_CCREE) := ccree.o
-ccree-y := cc_driver.o cc_buffer_mgr.o cc_request_mgr.o cc_cipher.o cc_ivgen.o 
cc_sram_mgr.o
+ccree-y := cc_driver.o cc_buffer_mgr.o cc_request_mgr.o cc_cipher.o cc_hash.o 
cc_ivgen.o cc_sram_mgr.o
 ccree-$(CONFIG_DEBUG_FS) += cc_debugfs.o
 ccree-$(CONFIG_PM) += cc_pm.o
diff --git a/drivers/crypto/ccree/cc_buffer_mgr.c 
b/drivers/crypto/ccree/cc_buffer_mgr.c
index 46be101..bb306b4 100644
--- a/drivers/crypto/ccree/cc_buffer_mgr.c
+++ b/drivers/crypto/ccree/cc_buffer_mgr.c
@@ -9,6 +9,7 @@
 #include "cc_buffer_mgr.h"
 #include "cc_lli_defs.h"
 #include "cc_cipher.h"
+#include "cc_hash.h"
 
 enum dma_buffer_type {
DMA_NULL_TYPE = -1,
@@ -348,9 +349,33 @@ static int cc_map_sg(struct device *dev, struct 
scatterlist *sg,
return 0;
 }
 
+static int cc_set_hash_buf(struct device *dev, struct ahash_req_ctx *areq_ctx,
+  u8 *curr_buff, u32 curr_buff_cnt,
+  struct buffer_array *sg_data)
+{
+   dev_dbg(dev, " handle curr buff %x set to   DLLI\n", curr_buff_cnt);
+   /* create sg for the current buffer */
+   sg_init_one(areq_ctx->buff_sg, curr_buff, curr_buff_cnt);
+   if (dma_map_sg(dev, areq_ctx->buff_sg, 1, DMA_TO_DEVICE) != 1) {
+   dev_err(dev, "dma_map_sg() src buffer failed\n");
+   return -ENOMEM;
+   }
+   dev_dbg(dev, "Mapped curr_buff: dma_address=%pad page=%p addr=%pK 
offset=%u length=%u\n",
+   &sg_dma_address(areq_ctx->buff_sg), sg_page(areq_ctx->buff_sg),
+   sg_virt(areq_ctx->buff_sg), areq_ctx->buff_sg->offset,
+   areq_ctx->buff_sg->length);
+   areq_ctx->data_dma_buf_type = CC_DMA_BUF_DLLI;
+   areq_ctx->curr_sg = areq_ctx->buff_sg;
+   areq_ctx->in_nents = 0;
+   /* prepare for case of MLLI */
+   cc_add_sg_entry(dev, sg_data, 1, areq_ctx->buff_sg, curr_buff_cnt, 0,
+   false, NULL);
+   return 0;
+}
+
 void cc_unmap_cipher_request(struct device *dev, void *ctx,
-unsigned int ivsize, struct scatterlist *src,
-struct scatterlist *dst)
+   unsigned int ivsize, struct scatterlist *src,
+   struct scatterlist *dst)
 {
struct cipher_req_ctx *req_ctx = (struct cipher_req_ctx *)ctx;
 
@@ -472,6 +497,238 @@ int cc_map_cipher_request(struct cc_drvdata *drvdata, 
void *ctx,
return rc;
 }
 
+int cc_map_hash_request_final(struct cc_drvdata *drvdata, void *ctx,
+ struct scatterlist *src, unsigned int nbytes,
+ bool do_update, gfp_t flags)
+{
+   struct ahash_req_ctx *areq_ctx = (struct ahash_req_ctx *)ctx;
+   struct device *dev = drvdata_to_dev(drvdata);
+   u8 *curr_buff = cc_hash_buf(areq_ctx);
+   u32 *curr_buff_cnt = cc_hash_buf_cnt(areq_ctx);
+   struct mlli_params *mlli_params = &areq_ctx->mlli_params;
+   struct buffer_array sg_data;
+   struct buff_mgr_handle *buff_mgr = drvdata->buff_mgr_handle;
+   u32 dummy = 0;
+   u32 mapped_nents = 0;
+
+   dev_dbg(dev, "final params : curr_buff=%pK curr_buff_cnt=0x%X nbytes = 
0x%X src=%pK curr_index=%u\n",
+   curr_buff, *curr_buff_cnt, nbytes, src, areq_ctx->buff_index);
+   /* Init the type of the dma buffer */
+   areq_ctx->data_dma_buf_type = CC_DMA_BUF_NULL;
+   mlli_params->curr_pool = NULL;
+   sg_data.num_of_buffers = 0;
+   areq_ctx->in_nents = 0;
+
+   if (nbytes == 0 && *curr_buff_cnt == 0) {
+   /* nothing to do */
+   return 0;
+   }
+
+   /*TODO: copy data in case that buffer is enough for operation */
+   /* map the previous buffer */
+   if (*curr_buff_cnt) {
+   if (cc_set_hash_buf(dev, areq_ctx, curr_buff, *curr_buff_cnt,
+   &sg_data)) {
+   return -ENOMEM;
+   }
+   }
+
+   if (src && nbytes > 0 && do_update) {
+   if (cc_map_sg(dev, src, nbytes, DMA_TO_DEVICE,
+ &areq_

[PATCH v2 5/7] crypto: ccree: add AEAD support

2018-01-22 Thread Gilad Ben-Yossef
Add CryptoCell AEAD support

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/crypto/ccree/Makefile|2 +-
 drivers/crypto/ccree/cc_aead.c   | 2702 ++
 drivers/crypto/ccree/cc_aead.h   |  109 ++
 drivers/crypto/ccree/cc_buffer_mgr.c |  882 +++
 drivers/crypto/ccree/cc_buffer_mgr.h |4 +
 drivers/crypto/ccree/cc_driver.c |   10 +
 drivers/crypto/ccree/cc_driver.h |2 +
 7 files changed, 3710 insertions(+), 1 deletion(-)
 create mode 100644 drivers/crypto/ccree/cc_aead.c
 create mode 100644 drivers/crypto/ccree/cc_aead.h

diff --git a/drivers/crypto/ccree/Makefile b/drivers/crypto/ccree/Makefile
index 1109480..7cb3082 100644
--- a/drivers/crypto/ccree/Makefile
+++ b/drivers/crypto/ccree/Makefile
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 
 obj-$(CONFIG_CRYPTO_DEV_CCREE) := ccree.o
-ccree-y := cc_driver.o cc_buffer_mgr.o cc_request_mgr.o cc_cipher.o cc_hash.o 
cc_ivgen.o cc_sram_mgr.o
+ccree-y := cc_driver.o cc_buffer_mgr.o cc_request_mgr.o cc_cipher.o cc_hash.o 
cc_aead.o cc_ivgen.o cc_sram_mgr.o
 ccree-$(CONFIG_DEBUG_FS) += cc_debugfs.o
 ccree-$(CONFIG_PM) += cc_pm.o
diff --git a/drivers/crypto/ccree/cc_aead.c b/drivers/crypto/ccree/cc_aead.c
new file mode 100644
index 000..3e1046a
--- /dev/null
+++ b/drivers/crypto/ccree/cc_aead.c
@@ -0,0 +1,2702 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "cc_driver.h"
+#include "cc_buffer_mgr.h"
+#include "cc_aead.h"
+#include "cc_request_mgr.h"
+#include "cc_hash.h"
+#include "cc_sram_mgr.h"
+
+#define template_aead  template_u.aead
+
+#define MAX_AEAD_SETKEY_SEQ 12
+#define MAX_AEAD_PROCESS_SEQ 23
+
+#define MAX_HMAC_DIGEST_SIZE (SHA256_DIGEST_SIZE)
+#define MAX_HMAC_BLOCK_SIZE (SHA256_BLOCK_SIZE)
+
+#define AES_CCM_RFC4309_NONCE_SIZE 3
+#define MAX_NONCE_SIZE CTR_RFC3686_NONCE_SIZE
+
+/* Value of each ICV_CMP byte (of 8) in case of success */
+#define ICV_VERIF_OK 0x01
+
+struct cc_aead_handle {
+   cc_sram_addr_t sram_workspace_addr;
+   struct list_head aead_list;
+};
+
+struct cc_hmac_s {
+   u8 *padded_authkey;
+   u8 *ipad_opad; /* IPAD, OPAD*/
+   dma_addr_t padded_authkey_dma_addr;
+   dma_addr_t ipad_opad_dma_addr;
+};
+
+struct cc_xcbc_s {
+   u8 *xcbc_keys; /* K1,K2,K3 */
+   dma_addr_t xcbc_keys_dma_addr;
+};
+
+struct cc_aead_ctx {
+   struct cc_drvdata *drvdata;
+   u8 ctr_nonce[MAX_NONCE_SIZE]; /* used for ctr3686 iv and aes ccm */
+   u8 *enckey;
+   dma_addr_t enckey_dma_addr;
+   union {
+   struct cc_hmac_s hmac;
+   struct cc_xcbc_s xcbc;
+   } auth_state;
+   unsigned int enc_keylen;
+   unsigned int auth_keylen;
+   unsigned int authsize; /* Actual (reduced?) size of the MAC/ICv */
+   enum drv_cipher_mode cipher_mode;
+   enum cc_flow_mode flow_mode;
+   enum drv_hash_mode auth_mode;
+};
+
+static inline bool valid_assoclen(struct aead_request *req)
+{
+   return ((req->assoclen == 16) || (req->assoclen == 20));
+}
+
+static void cc_aead_exit(struct crypto_aead *tfm)
+{
+   struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm);
+   struct device *dev = drvdata_to_dev(ctx->drvdata);
+
+   dev_dbg(dev, "Clearing context @%p for %s\n", crypto_aead_ctx(tfm),
+   crypto_tfm_alg_name(&tfm->base));
+
+   /* Unmap enckey buffer */
+   if (ctx->enckey) {
+   dma_free_coherent(dev, AES_MAX_KEY_SIZE, ctx->enckey,
+ ctx->enckey_dma_addr);
+   dev_dbg(dev, "Freed enckey DMA buffer enckey_dma_addr=%pad\n",
+   &ctx->enckey_dma_addr);
+   ctx->enckey_dma_addr = 0;
+   ctx->enckey = NULL;
+   }
+
+   if (ctx->auth_mode == DRV_HASH_XCBC_MAC) { /* XCBC authetication */
+   struct cc_xcbc_s *xcbc = &ctx->auth_state.xcbc;
+
+   if (xcbc->xcbc_keys) {
+   dma_free_coherent(dev, CC_AES_128_BIT_KEY_SIZE * 3,
+ xcbc->xcbc_keys,
+ xcbc->xcbc_keys_dma_addr);
+   }
+   dev_dbg(dev, "Freed xcbc_keys DMA buffer 
xcbc_keys_dma_addr=%pad\n",
+   &xcbc->xcbc_keys_dma_addr);
+   xcbc->xcbc_keys_dma_addr = 0;
+   xcbc->xcbc_keys = NULL;
+   } else if (ctx->auth_mode != DRV_HASH_NULL) { /* HMAC auth. */
+   struct cc_hmac_s *hmac = &ctx->auth_state.hmac;
+
+   if (hmac->ipad_opad) {
+   dma_free_coherent(dev, 2 * MAX_HMAC_DIGEST_SIZE,
+ hmac->ipad_opad,
+ hmac->ipad_opad_dma_addr);
+   dev_dbg(dev, "Freed ipad_opad DMA buffer 
ipad_opad_dma_addr=%pad\n",
+  

[PATCH v2 03/14] staging: wilc1000: fix alignments to match open parenthesis

2018-01-22 Thread Ajay Singh
Fix "Alignment should match open parenthesis" issues reported by
checkpatch.pl script. changes to comply with linux coding style.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 46e2d55..358354b 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3730,8 +3730,8 @@ int wilc_add_station(struct wilc_vif *vif, struct 
add_sta_param *sta_param)
memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param));
if (add_sta_info->rates_len > 0) {
add_sta_info->rates = kmemdup(sta_param->rates,
- add_sta_info->rates_len,
- GFP_KERNEL);
+ add_sta_info->rates_len,
+ GFP_KERNEL);
if (!add_sta_info->rates)
return -ENOMEM;
}
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 3c3f1863..d9725ef 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -695,7 +695,7 @@ static int wlan_initialize_threads(struct net_device *dev)
wilc = vif->wilc;
 
wilc->txq_thread = kthread_run(linux_wlan_txq_task, (void *)dev,
-"K_TXQ_TASK");
+  "K_TXQ_TASK");
if (IS_ERR(wilc->txq_thread)) {
netdev_err(dev, "couldn't create TXQ thread\n");
wilc->close = 0;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index fb4a142..621810d 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -470,10 +470,10 @@ static void CfgScanResult(enum scan_event scan_event,
 int wilc_connecting;
 
 static void cfg_connect_result(enum conn_event conn_disconn_evt,
-struct connect_info *conn_info,
-u8 mac_status,
-struct disconnect_info *disconn_info,
-void *priv_data)
+  struct connect_info *conn_info,
+  u8 mac_status,
+  struct disconnect_info *disconn_info,
+  void *priv_data)
 {
struct wilc_priv *priv;
struct net_device *dev;
@@ -623,18 +623,18 @@ static int scan(struct wiphy *wiphy, struct 
cfg80211_scan_request *request)
}
}
ret = wilc_scan(vif, USER_SCAN, ACTIVE_SCAN,
-au8ScanChanList,
-request->n_channels,
-(const u8 *)request->ie,
-request->ie_len, CfgScanResult,
-(void *)priv, &strHiddenNetwork);
+   au8ScanChanList,
+   request->n_channels,
+   (const u8 *)request->ie,
+   request->ie_len, CfgScanResult,
+   (void *)priv, &strHiddenNetwork);
} else {
ret = wilc_scan(vif, USER_SCAN, ACTIVE_SCAN,
-au8ScanChanList,
-request->n_channels,
-(const u8 *)request->ie,
-request->ie_len, CfgScanResult,
-(void *)priv, NULL);
+   au8ScanChanList,
+   request->n_channels,
+   (const u8 *)request->ie,
+   request->ie_len, CfgScanResult,
+   (void *)priv, NULL);
}
} else {
netdev_err(priv->dev, "Requested scanned channels over\n");
@@ -793,11 +793,11 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
wilc_wlan_set_bssid(dev, pstrNetworkInfo->bssid, STATION_MODE);
 
ret = wilc_set_join_req(vif, pstrNetworkInfo->bssid, sme->ssid,
-sme->ssid_len, sme->ie, sme->ie_len,
-cfg_connect_result, (void *)pr

[PATCH v2 05/14] staging: wilc1000: rename camelCase used in Handle_DelAllSta() and its variable

2018-01-22 Thread Ajay Singh
Fix "Avoid camelCase" issue reported by checkpatch.pl script.

Signed-off-by: Ajay Singh 
Reviewed-by: Claudiu Beznea 
---
 drivers/staging/wilc1000/host_interface.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 8f8e727..f0168e3 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -2123,34 +2123,34 @@ static void Handle_AddStation(struct wilc_vif *vif,
kfree(wid.val);
 }
 
-static void Handle_DelAllSta(struct wilc_vif *vif,
-struct del_all_sta *pstrDelAllStaParam)
+static void handle_del_all_sta(struct wilc_vif *vif,
+  struct del_all_sta *param)
 {
s32 result = 0;
struct wid wid;
-   u8 *pu8CurrByte;
+   u8 *curr_byte;
u8 i;
-   u8 au8Zero_Buff[6] = {0};
+   u8 zero_buff[6] = {0};
 
wid.id = (u16)WID_DEL_ALL_STA;
wid.type = WID_STR;
-   wid.size = (pstrDelAllStaParam->assoc_sta * ETH_ALEN) + 1;
+   wid.size = (param->assoc_sta * ETH_ALEN) + 1;
 
-   wid.val = kmalloc((pstrDelAllStaParam->assoc_sta * ETH_ALEN) + 1, 
GFP_KERNEL);
+   wid.val = kmalloc((param->assoc_sta * ETH_ALEN) + 1, GFP_KERNEL);
if (!wid.val)
goto ERRORHANDLER;
 
-   pu8CurrByte = wid.val;
+   curr_byte = wid.val;
 
-   *(pu8CurrByte++) = pstrDelAllStaParam->assoc_sta;
+   *(curr_byte++) = param->assoc_sta;
 
for (i = 0; i < MAX_NUM_STA; i++) {
-   if (memcmp(pstrDelAllStaParam->del_all_sta[i], au8Zero_Buff, 
ETH_ALEN))
-   memcpy(pu8CurrByte, pstrDelAllStaParam->del_all_sta[i], 
ETH_ALEN);
+   if (memcmp(param->del_all_sta[i], zero_buff, ETH_ALEN))
+   memcpy(curr_byte, param->del_all_sta[i], ETH_ALEN);
else
continue;
 
-   pu8CurrByte += ETH_ALEN;
+   curr_byte += ETH_ALEN;
}
 
result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
@@ -2626,7 +2626,7 @@ static void host_if_work(struct work_struct *work)
break;
 
case HOST_IF_MSG_DEL_ALL_STA:
-   Handle_DelAllSta(msg->vif, &msg->body.del_all_sta_info);
+   handle_del_all_sta(msg->vif, &msg->body.del_all_sta_info);
break;
 
case HOST_IF_MSG_SET_TX_POWER:
-- 
2.7.4

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


[PATCH v2 04/14] staging: wilc1000: rename host_int_ParseJoinBssParam() and it's variable using camelCase

2018-01-22 Thread Ajay Singh
Fix "Avoid CamelCase:" issue reported by checkpatch.pl script
Rename host_int_ParseJoinBssParam() & its variables name using
camelCase.

Signed-off-by: Ajay Singh 
Reviewed-by: Claudiu Beznea 
---
 drivers/staging/wilc1000/host_interface.c | 230 +++---
 1 file changed, 115 insertions(+), 115 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 358354b..8f8e727 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -265,7 +265,7 @@ static struct wilc_vif *join_req_vif;
 #define FLUSHED_JOIN_REQ 1
 #define FLUSHED_BYTE_POS 79
 
-static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo);
+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_ScanDone(struct wilc_vif *vif, enum scan_event enuEvent);
 static void host_if_work(struct work_struct *work);
@@ -1288,7 +1288,7 @@ static s32 Handle_RcvdNtwrkInfo(struct wilc_vif *vif,
hif_drv->usr_scan_req.rcvd_ch_cnt++;
 
pstrNetworkInfo->new_network = true;
-   pJoinParams = 
host_int_ParseJoinBssParam(pstrNetworkInfo);
+   pJoinParams = 
host_int_parse_join_bss_param(pstrNetworkInfo);
 

hif_drv->usr_scan_req.scan_result(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo,
  
hif_drv->usr_scan_req.arg,
@@ -3870,152 +3870,152 @@ int wilc_setup_multicast_filter(struct wilc_vif *vif, 
bool enabled,
return result;
 }
 
-static void *host_int_ParseJoinBssParam(struct network_info *ptstrNetworkInfo)
+static void *host_int_parse_join_bss_param(struct network_info *info)
 {
-   struct join_bss_param *pNewJoinBssParam = NULL;
-   u8 *pu8IEs;
-   u16 u16IEsLen;
+   struct join_bss_param *param = NULL;
+   u8 *ies;
+   u16 ies_len;
u16 index = 0;
-   u8 suppRatesNo = 0;
-   u8 extSuppRatesNo;
-   u16 jumpOffset;
-   u8 pcipherCount;
-   u8 authCount;
-   u8 pcipherTotalCount = 0;
-   u8 authTotalCount = 0;
+   u8 rates_no = 0;
+   u8 ext_rates_no;
+   u16 offset;
+   u8 pcipher_cnt;
+   u8 auth_cnt;
+   u8 pcipher_total_cnt = 0;
+   u8 auth_total_cnt = 0;
u8 i, j;
 
-   pu8IEs = ptstrNetworkInfo->ies;
-   u16IEsLen = ptstrNetworkInfo->ies_len;
-
-   pNewJoinBssParam = kzalloc(sizeof(*pNewJoinBssParam), GFP_KERNEL);
-   if (pNewJoinBssParam) {
-   pNewJoinBssParam->dtim_period = ptstrNetworkInfo->dtim_period;
-   pNewJoinBssParam->beacon_period = 
ptstrNetworkInfo->beacon_period;
-   pNewJoinBssParam->cap_info = ptstrNetworkInfo->cap_info;
-   memcpy(pNewJoinBssParam->bssid, ptstrNetworkInfo->bssid, 6);
-   memcpy((u8 *)pNewJoinBssParam->ssid, ptstrNetworkInfo->ssid,
-  ptstrNetworkInfo->ssid_len + 1);
-   pNewJoinBssParam->ssid_len = ptstrNetworkInfo->ssid_len;
-   memset(pNewJoinBssParam->rsn_pcip_policy, 0xFF, 3);
-   memset(pNewJoinBssParam->rsn_auth_policy, 0xFF, 3);
-
-   while (index < u16IEsLen) {
-   if (pu8IEs[index] == SUPP_RATES_IE) {
-   suppRatesNo = pu8IEs[index + 1];
-   pNewJoinBssParam->supp_rates[0] = suppRatesNo;
+   ies = info->ies;
+   ies_len = info->ies_len;
+
+   param = kzalloc(sizeof(*param), GFP_KERNEL);
+   if (param) {
+   param->dtim_period = info->dtim_period;
+   param->beacon_period = info->beacon_period;
+   param->cap_info = info->cap_info;
+   memcpy(param->bssid, info->bssid, 6);
+   memcpy((u8 *)param->ssid, info->ssid,
+  info->ssid_len + 1);
+   param->ssid_len = info->ssid_len;
+   memset(param->rsn_pcip_policy, 0xFF, 3);
+   memset(param->rsn_auth_policy, 0xFF, 3);
+
+   while (index < ies_len) {
+   if (ies[index] == SUPP_RATES_IE) {
+   rates_no = ies[index + 1];
+   param->supp_rates[0] = rates_no;
index += 2;
 
-   for (i = 0; i < suppRatesNo; i++)
-   pNewJoinBssParam->supp_rates[i + 1] = 
pu8IEs[index + i];
+   for (i = 0; i < rates_no; i++)
+   param->supp_rates[i + 1] = ies[index + 
i];
 
-   index += suppRatesNo;
-   } else if (pu8IEs[index] == EXT_SUPP_RATES_IE) {
-   extSuppRatesNo = p

[PATCH v2 07/14] staging: wilc1000: rename u32WidsCount variable to avoid camelCase

2018-01-22 Thread Ajay Singh
Fix "Avoid camleCase" issue reported by checkpatch.pl script.
rename variable name from u32WidsCount to wid_cnt to fix
checkpatch.pl report issue.

Signed-off-by: Ajay Singh 
Reviewed-by: Claudiu Beznea 
---
 drivers/staging/wilc1000/host_interface.c | 146 +++---
 1 file changed, 73 insertions(+), 73 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 13ac482..496c72f 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -907,7 +907,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
 {
s32 result = 0;
struct wid wid_list[8];
-   u32 u32WidsCount = 0, dummyval = 0;
+   u32 wid_cnt = 0, dummyval = 0;
u8 *pu8CurrByte = NULL;
struct join_bss_param *ptstrJoinBssParam;
struct host_if_drv *hif_drv = vif->hif_drv;
@@ -952,30 +952,30 @@ static s32 Handle_Connect(struct wilc_vif *vif,
hif_drv->usr_conn_req.conn_result = pstrHostIFconnectAttr->result;
hif_drv->usr_conn_req.arg = pstrHostIFconnectAttr->arg;
 
-   wid_list[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT;
-   wid_list[u32WidsCount].type = WID_INT;
-   wid_list[u32WidsCount].size = sizeof(u32);
-   wid_list[u32WidsCount].val = (s8 *)(&(dummyval));
-   u32WidsCount++;
+   wid_list[wid_cnt].id = WID_SUCCESS_FRAME_COUNT;
+   wid_list[wid_cnt].type = WID_INT;
+   wid_list[wid_cnt].size = sizeof(u32);
+   wid_list[wid_cnt].val = (s8 *)(&(dummyval));
+   wid_cnt++;
 
-   wid_list[u32WidsCount].id = WID_RECEIVED_FRAGMENT_COUNT;
-   wid_list[u32WidsCount].type = WID_INT;
-   wid_list[u32WidsCount].size = sizeof(u32);
-   wid_list[u32WidsCount].val = (s8 *)(&(dummyval));
-   u32WidsCount++;
+   wid_list[wid_cnt].id = WID_RECEIVED_FRAGMENT_COUNT;
+   wid_list[wid_cnt].type = WID_INT;
+   wid_list[wid_cnt].size = sizeof(u32);
+   wid_list[wid_cnt].val = (s8 *)(&(dummyval));
+   wid_cnt++;
 
-   wid_list[u32WidsCount].id = WID_FAILED_COUNT;
-   wid_list[u32WidsCount].type = WID_INT;
-   wid_list[u32WidsCount].size = sizeof(u32);
-   wid_list[u32WidsCount].val = (s8 *)(&(dummyval));
-   u32WidsCount++;
+   wid_list[wid_cnt].id = WID_FAILED_COUNT;
+   wid_list[wid_cnt].type = WID_INT;
+   wid_list[wid_cnt].size = sizeof(u32);
+   wid_list[wid_cnt].val = (s8 *)(&(dummyval));
+   wid_cnt++;
 
{
-   wid_list[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE;
-   wid_list[u32WidsCount].type = WID_BIN_DATA;
-   wid_list[u32WidsCount].val = hif_drv->usr_conn_req.ies;
-   wid_list[u32WidsCount].size = hif_drv->usr_conn_req.ies_len;
-   u32WidsCount++;
+   wid_list[wid_cnt].id = WID_INFO_ELEMENT_ASSOCIATE;
+   wid_list[wid_cnt].type = WID_BIN_DATA;
+   wid_list[wid_cnt].val = hif_drv->usr_conn_req.ies;
+   wid_list[wid_cnt].size = hif_drv->usr_conn_req.ies_len;
+   wid_cnt++;
 
if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
info_element_size = hif_drv->usr_conn_req.ies_len;
@@ -984,39 +984,39 @@ static s32 Handle_Connect(struct wilc_vif *vif,
   info_element_size);
}
}
-   wid_list[u32WidsCount].id = (u16)WID_11I_MODE;
-   wid_list[u32WidsCount].type = WID_CHAR;
-   wid_list[u32WidsCount].size = sizeof(char);
-   wid_list[u32WidsCount].val = (s8 *)&hif_drv->usr_conn_req.security;
-   u32WidsCount++;
+   wid_list[wid_cnt].id = (u16)WID_11I_MODE;
+   wid_list[wid_cnt].type = WID_CHAR;
+   wid_list[wid_cnt].size = sizeof(char);
+   wid_list[wid_cnt].val = (s8 *)&hif_drv->usr_conn_req.security;
+   wid_cnt++;
 
if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7))
mode_11i = hif_drv->usr_conn_req.security;
 
-   wid_list[u32WidsCount].id = (u16)WID_AUTH_TYPE;
-   wid_list[u32WidsCount].type = WID_CHAR;
-   wid_list[u32WidsCount].size = sizeof(char);
-   wid_list[u32WidsCount].val = (s8 *)&hif_drv->usr_conn_req.auth_type;
-   u32WidsCount++;
+   wid_list[wid_cnt].id = (u16)WID_AUTH_TYPE;
+   wid_list[wid_cnt].type = WID_CHAR;
+   wid_list[wid_cnt].size = sizeof(char);
+   wid_list[wid_cnt].val = (s8 *)&hif_drv->usr_conn_req.auth_type;
+   wid_cnt++;
 
if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7))
auth_type = (u8)hif_drv->usr_conn_req.auth_type;
 
-   wid_list[u32WidsCount].id = (u16)WID_JOIN_REQ_EXTENDED;
-   wid_list[u32WidsCount].type = WID_STR;
-   wid_list[u32WidsCount].size = 112;
-   wid_list[u32WidsCount].val = kmalloc(wid_list[u32WidsCount].size, 
GFP_KERNEL);
+   wid_list[wid_cnt].id = (u16)WID_JOIN_REQ_EXTENDED;
+   wid_list[wid_cnt].type = WID_STR;
+   wid_list[wid_c

[PATCH v2 01/14] staging: wilc1000: remove unnecessary use of parentheses

2018-01-22 Thread Ajay Singh
Fix "Unnecessary parentheses around" issue found by checkpatch.pl
script.Remove the unnecessary parentheses to follow linux coding style.

Signed-off-by: Ajay Singh 
Reviewed-by: Claudiu Beznea 
---
 drivers/staging/wilc1000/coreconfigurator.c   |  2 +-
 drivers/staging/wilc1000/host_interface.c | 34 +++
 drivers/staging/wilc1000/linux_wlan.c |  8 +++---
 drivers/staging/wilc1000/wilc_sdio.c  |  4 +--
 drivers/staging/wilc1000/wilc_spi.c   | 20 ++---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 26 -
 drivers/staging/wilc1000/wilc_wlan.c  |  2 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.c  |  6 ++--
 8 files changed, 51 insertions(+), 51 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 8cf886d..e98fc8e 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -201,7 +201,7 @@ static inline u16 get_cap_info(u8 *data)
 
st = get_sub_type(data);
 
-   if ((st == BEACON) || (st == PROBE_RSP))
+   if (st == BEACON || st == PROBE_RSP)
index += TIME_STAMP_LEN + BEACON_INTERVAL_LEN;
 
cap_info  = data[index];
diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 4ff1a59..46e2d55 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -394,7 +394,7 @@ static void handle_set_operation_mode(struct wilc_vif *vif,
ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
   wilc_get_vif_idx(vif));
 
-   if ((hif_op_mode->mode) == IDLE_MODE)
+   if (hif_op_mode->mode == IDLE_MODE)
complete(&hif_driver_comp);
 
if (ret)
@@ -760,8 +760,8 @@ static s32 handle_scan(struct wilc_vif *vif, struct 
scan_attr *scan_info)
hif_drv->usr_scan_req.scan_result = scan_info->result;
hif_drv->usr_scan_req.arg = scan_info->arg;
 
-   if ((hif_drv->hif_state >= HOST_IF_SCANNING) &&
-   (hif_drv->hif_state < HOST_IF_CONNECTED)) {
+   if (hif_drv->hif_state >= HOST_IF_SCANNING &&
+   hif_drv->hif_state < HOST_IF_CONNECTED) {
netdev_err(vif->ndev, "Already scan\n");
result = -EBUSY;
goto ERRORHANDLER;
@@ -1025,7 +1025,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
pu8CurrByte += MAX_SSID_LEN;
*(pu8CurrByte++) = INFRASTRUCTURE;
 
-   if ((pstrHostIFconnectAttr->ch >= 1) && (pstrHostIFconnectAttr->ch <= 
14)) {
+   if (pstrHostIFconnectAttr->ch >= 1 && pstrHostIFconnectAttr->ch <= 14) {
*(pu8CurrByte++) = pstrHostIFconnectAttr->ch;
} else {
netdev_err(vif->ndev, "Channel out of range\n");
@@ -1258,8 +1258,8 @@ static s32 Handle_RcvdNtwrkInfo(struct wilc_vif *vif,
 
if (hif_drv->usr_scan_req.scan_result) {
wilc_parse_network_info(pstrRcvdNetworkInfo->buffer, 
&pstrNetworkInfo);
-   if ((!pstrNetworkInfo) ||
-   (!hif_drv->usr_scan_req.scan_result)) {
+   if (!pstrNetworkInfo ||
+   !hif_drv->usr_scan_req.scan_result) {
netdev_err(vif->ndev, "driver is null\n");
result = -EINVAL;
goto done;
@@ -1340,8 +1340,8 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
return -ENODEV;
}
 
-   if ((hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) ||
-   (hif_drv->hif_state == HOST_IF_CONNECTED) ||
+   if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP ||
+   hif_drv->hif_state == HOST_IF_CONNECTED ||
hif_drv->usr_scan_req.scan_result) {
if (!pstrRcvdGnrlAsyncInfo->buffer ||
!hif_drv->usr_conn_req.conn_result) {
@@ -1400,8 +1400,8 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
}
}
 
-   if ((u8MacStatus == MAC_CONNECTED) &&
-   (strConnectInfo.status != SUCCESSFUL_STATUSCODE))   
{
+   if (u8MacStatus == MAC_CONNECTED &&
+   strConnectInfo.status != SUCCESSFUL_STATUSCODE) 
{
netdev_err(vif->ndev, "Received MAC status is 
MAC_CONNECTED while the received status code in Asoc Resp is not 
SUCCESSFUL_STATUSCODE\n");
eth_zero_addr(wilc_connected_ssid);
} else if (u8MacStatus == MAC_DISCONNECTED){
@@ -1412,8 +1412,8 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
if (hif_drv->usr_conn_req.bssid) {
memcpy(strConnectInfo.bssid, 
hif_drv->usr_conn_req.bssid, 6);
 
-   if 

[PATCH v2 02/14] staging: wilc1000: removed unnecessary defined enums typedef

2018-01-22 Thread Ajay Singh
Fix the "do not add new typedefs" issue found by checkpatch.pl
script

Signed-off-by: Ajay Singh 
Reviewed-by: Claudiu Beznea 
---
 drivers/staging/wilc1000/wilc_wlan_if.h | 72 -
 1 file changed, 36 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h 
b/drivers/staging/wilc1000/wilc_wlan_if.h
index 1641ddb..e186509 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -114,28 +114,28 @@ enum {
G_MIXED_11B_2_MODE, /* 1,2,5,11,6,12,24 otherwise all on */
 };
 
-typedef enum {
+enum {
G_SHORT_PREAMBLE= 0,/* Short Preamble */
G_LONG_PREAMBLE = 1,/* Long Preamble */
G_AUTO_PREAMBLE = 2,/* Auto Preamble Selection */
-} G_PREAMBLE_T;
+};
 
 #define MAC_CONNECTED  1
 #define MAC_DISCONNECTED   0
 
 #define SCAN_DONE  TRUE
-typedef enum {
+enum {
PASSIVE_SCAN= 0,
ACTIVE_SCAN = 1,
-} SCANTYPE_T;
+};
 
-typedef enum {
+enum {
NO_POWERSAVE= 0,
MIN_FAST_PS = 1,
MAX_FAST_PS = 2,
MIN_PSPOLL_PS   = 3,
MAX_PSPOLL_PS   = 4
-} USER_PS_MODE_T;
+};
 
 enum chip_ps_states {
CHIP_WAKEDUP= 0,
@@ -153,7 +153,7 @@ enum bus_release {
RELEASE_ALLOW_SLEEP = 1,
 };
 
-typedef enum {
+enum {
NO_SECURITY = 0,
WEP_40  = 0x3,
WEP_104 = 0x7,
@@ -163,7 +163,7 @@ typedef enum {
WPA2_AES= 0x31,
WPA2_TKIP   = 0x51,
WPA2_AES_TKIP   = 0x71, /* Aes or Tkip */
-} SECURITY_T;
+};
 
 enum AUTHTYPE {
OPEN_SYSTEM = 1,
@@ -178,88 +178,88 @@ enum SITESURVEY {
SITE_SURVEY_OFF = 2
 };
 
-typedef enum {
+enum {
NORMAL_ACK  = 0,
NO_ACK,
-} ACK_POLICY_T;
+};
 
-typedef enum {
+enum {
DONT_RESET  = 0,
DO_RESET= 1,
NO_REQUEST  = 2,
-} RESET_REQ_T;
+};
 
-typedef enum {
+enum {
REKEY_DISABLE   = 1,
REKEY_TIME_BASE,
REKEY_PKT_BASE,
REKEY_TIME_PKT_BASE
-} RSNA_REKEY_POLICY_T;
+};
 
-typedef enum {
+enum {
FILTER_NO   = 0x00,
FILTER_AP_ONLY  = 0x01,
FILTER_STA_ONLY = 0x02
-} SCAN_CLASS_FITLER_T;
+};
 
-typedef enum {
+enum {
PRI_HIGH_RSSI   = 0x00,
PRI_LOW_RSSI= 0x04,
PRI_DETECT  = 0x08
-} SCAN_PRI_T;
+};
 
-typedef enum {
+enum {
CH_FILTER_OFF   = 0x00,
CH_FILTER_ON= 0x10
-} CH_FILTER_T;
+};
 
-typedef enum {
+enum {
AUTO_PROT   = 0,/* Auto */
NO_PROT,/* Do not use any protection */
ERP_PROT,   /* Protect all ERP frame exchanges */
HT_PROT,/* Protect all HT frame exchanges  */
GF_PROT,/* Protect all GF frame exchanges  */
-} N_PROTECTION_MODE_T;
+};
 
-typedef enum {
+enum {
G_SELF_CTS_PROT,
G_RTS_CTS_PROT,
-} G_PROTECTION_MODE_T;
+};
 
-typedef enum {
+enum {
HT_MIXED_MODE   = 1,
HT_ONLY_20MHZ_MODE,
HT_ONLY_20_40MHZ_MODE,
-} N_OPERATING_MODE_T;
+};
 
-typedef enum {
+enum {
NO_DETECT   = 0,
DETECT_ONLY = 1,
DETECT_PROTECT  = 2,
DETECT_PROTECT_REPORT   = 3,
-} N_OBSS_DETECTION_T;
+};
 
-typedef enum {
+enum {
RTS_CTS_NONHT_PROT  = 0,/* RTS-CTS at non-HT rate */
FIRST_FRAME_NONHT_PROT, /* First frame at non-HT rate */
LSIG_TXOP_PROT, /* LSIG TXOP Protection */
FIRST_FRAME_MIXED_PROT, /* First frame at Mixed format */
-} N_PROTECTION_TYPE_T;
+};
 
-typedef enum {
+enum {
STATIC_MODE = 1,
DYNAMIC_MODE= 2,
MIMO_MODE   = 3,/* power save disable */
-} N_SMPS_MODE_T;
+};
 
-typedef enum {
+enum {
DISABLE_SELF_CTS,
ENABLE_SELF_CTS,
DISABLE_TX_ABORT,
ENABLE_TX_ABORT,
HW_TRIGGER_ABORT,
SW_TRIGGER_ABORT,
-} TX_ABORT_OPTION_T;
+};
 
 enum wid_type {
WID_CHAR= 0,
@@ -281,7 +281,7 @@ struct wid {
s8 *val;
 };
 
-typedef enum {
+enum {
WID_NIL = 0x,
 
/*
@@ -889,7 +889,7 @@ typedef enum {
/* Miscellaneous WIDs */
WID_ALL = 0x7FFE,
WID_MAX = 0x
-} WID_T;
+};
 
 struct wilc;
 int wilc_wlan_init(struct net_device *dev);
-- 
2.7.4

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

[PATCH v2 00/14] fix to remove unnecessary parenthesis, typedef and avoid camelCase

2018-01-22 Thread Ajay Singh
This patch series contains changes to fix issues reported by checkpatch.pl 
script.

Changes since v1:
* Patch0004: Used "host_int_parse_join_bss_param" for function name.
* Patch0009: Put memcpy statement in single line instead of using two lines.
* Patch0010: Used "bss_param" for variable name instead of j_bss_param.
* Added "Reviewed-by: Claudiu Beznea " for commit 
description.
* Modify the commit description to start with capital letter for all patch.


Ajay Singh (14):
  staging: wilc1000: remove unnecessary use of parentheses
  staging: wilc1000: removed unnecessary defined enums typedef
  staging: wilc1000: fix alignments to match open parenthesis
  staging: wilc1000: rename host_int_ParseJoinBssParam() and it's
variable using camelCase
  staging: wilc1000: rename camelCase used in Handle_DelAllSta() and its
variable
  staging: wilc1000: rename strWIDList variable to wid_list to avoid
camelCase
  staging: wilc1000: rename u32WidsCount variable to avoid camelCase
  staging: wilc1000: rename pu8CurrByte variable to avoid camelCase
  staging: wilc1000: rename pstrHostIFconnectAttr argument to avoid
camelCase
  staging: wilc1000: rename ptstrJoinBssParam variable to avoid
camelCase
  staging: wilc1000: rename strConnectInfo variable to avoid camelCase
  staging: wilc1000: rename Handle_ScanDone() to avoid camelCase
  staging: wilc1000: rename Handle_Connect() to avoid camelCase
  staging: wilc1000: rename Handle_ConnectTimeout() and Handle_Key()

 drivers/staging/wilc1000/coreconfigurator.c   |   2 +-
 drivers/staging/wilc1000/host_interface.c | 937 +++---
 drivers/staging/wilc1000/linux_wlan.c |  10 +-
 drivers/staging/wilc1000/wilc_sdio.c  |   4 +-
 drivers/staging/wilc1000/wilc_spi.c   |  20 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  64 +-
 drivers/staging/wilc1000/wilc_wlan.c  |   2 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.c  |   6 +-
 drivers/staging/wilc1000/wilc_wlan_if.h   |  72 +-
 9 files changed, 555 insertions(+), 562 deletions(-)

-- 
2.7.4

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


[PATCH v2 09/14] staging: wilc1000: rename pstrHostIFconnectAttr argument to avoid camelCase

2018-01-22 Thread Ajay Singh
Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh 
Reviewed-by: Claudiu Beznea 
---
 drivers/staging/wilc1000/host_interface.c | 105 ++
 1 file changed, 49 insertions(+), 56 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 43f8559..4856d4f 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -903,7 +903,7 @@ static s32 Handle_ScanDone(struct wilc_vif *vif,
 
 u8 wilc_connected_ssid[6] = {0};
 static s32 Handle_Connect(struct wilc_vif *vif,
- struct connect_attr *pstrHostIFconnectAttr)
+ struct connect_attr *attr)
 {
s32 result = 0;
struct wid wid_list[8];
@@ -912,45 +912,41 @@ static s32 Handle_Connect(struct wilc_vif *vif,
struct join_bss_param *ptstrJoinBssParam;
struct host_if_drv *hif_drv = vif->hif_drv;
 
-   if (memcmp(pstrHostIFconnectAttr->bssid, wilc_connected_ssid, ETH_ALEN) 
== 0) {
+   if (memcmp(attr->bssid, wilc_connected_ssid, ETH_ALEN) == 0) {
result = 0;
netdev_err(vif->ndev, "Discard connect request\n");
return result;
}
 
-   ptstrJoinBssParam = pstrHostIFconnectAttr->params;
+   ptstrJoinBssParam = attr->params;
if (!ptstrJoinBssParam) {
netdev_err(vif->ndev, "Required BSSID not found\n");
result = -ENOENT;
goto ERRORHANDLER;
}
 
-   if (pstrHostIFconnectAttr->bssid) {
+   if (attr->bssid) {
hif_drv->usr_conn_req.bssid = kmalloc(6, GFP_KERNEL);
-   memcpy(hif_drv->usr_conn_req.bssid, 
pstrHostIFconnectAttr->bssid, 6);
+   memcpy(hif_drv->usr_conn_req.bssid, attr->bssid, 6);
}
 
-   hif_drv->usr_conn_req.ssid_len = pstrHostIFconnectAttr->ssid_len;
-   if (pstrHostIFconnectAttr->ssid) {
-   hif_drv->usr_conn_req.ssid = 
kmalloc(pstrHostIFconnectAttr->ssid_len + 1, GFP_KERNEL);
-   memcpy(hif_drv->usr_conn_req.ssid,
-  pstrHostIFconnectAttr->ssid,
-  pstrHostIFconnectAttr->ssid_len);
-   hif_drv->usr_conn_req.ssid[pstrHostIFconnectAttr->ssid_len] = 
'\0';
+   hif_drv->usr_conn_req.ssid_len = attr->ssid_len;
+   if (attr->ssid) {
+   hif_drv->usr_conn_req.ssid = kmalloc(attr->ssid_len + 1, 
GFP_KERNEL);
+   memcpy(hif_drv->usr_conn_req.ssid, attr->ssid, attr->ssid_len);
+   hif_drv->usr_conn_req.ssid[attr->ssid_len] = '\0';
}
 
-   hif_drv->usr_conn_req.ies_len = pstrHostIFconnectAttr->ies_len;
-   if (pstrHostIFconnectAttr->ies) {
-   hif_drv->usr_conn_req.ies = 
kmalloc(pstrHostIFconnectAttr->ies_len, GFP_KERNEL);
-   memcpy(hif_drv->usr_conn_req.ies,
-  pstrHostIFconnectAttr->ies,
-  pstrHostIFconnectAttr->ies_len);
+   hif_drv->usr_conn_req.ies_len = attr->ies_len;
+   if (attr->ies) {
+   hif_drv->usr_conn_req.ies = kmalloc(attr->ies_len, GFP_KERNEL);
+   memcpy(hif_drv->usr_conn_req.ies, attr->ies, attr->ies_len);
}
 
-   hif_drv->usr_conn_req.security = pstrHostIFconnectAttr->security;
-   hif_drv->usr_conn_req.auth_type = pstrHostIFconnectAttr->auth_type;
-   hif_drv->usr_conn_req.conn_result = pstrHostIFconnectAttr->result;
-   hif_drv->usr_conn_req.arg = pstrHostIFconnectAttr->arg;
+   hif_drv->usr_conn_req.security = attr->security;
+   hif_drv->usr_conn_req.auth_type = attr->auth_type;
+   hif_drv->usr_conn_req.conn_result = attr->result;
+   hif_drv->usr_conn_req.arg = attr->arg;
 
wid_list[wid_cnt].id = WID_SUCCESS_FRAME_COUNT;
wid_list[wid_cnt].type = WID_INT;
@@ -977,7 +973,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
wid_list[wid_cnt].size = hif_drv->usr_conn_req.ies_len;
wid_cnt++;
 
-   if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
+   if (memcmp("DIRECT-", attr->ssid, 7)) {
info_element_size = hif_drv->usr_conn_req.ies_len;
info_element = kmalloc(info_element_size, GFP_KERNEL);
memcpy(info_element, hif_drv->usr_conn_req.ies,
@@ -990,7 +986,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
wid_list[wid_cnt].val = (s8 *)&hif_drv->usr_conn_req.security;
wid_cnt++;
 
-   if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7))
+   if (memcmp("DIRECT-", attr->ssid, 7))
mode_11i = hif_drv->usr_conn_req.security;
 
wid_list[wid_cnt].id = (u16)WID_AUTH_TYPE;
@@ -999,7 +995,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
wid_list[wid_cnt].val = (s8 *)&hif_drv->usr_conn_req.auth_type;
wid_cnt++;
 
-   if (memcmp("DIRECT-",

[PATCH v2 11/14] staging: wilc1000: rename strConnectInfo variable to avoid camelCase

2018-01-22 Thread Ajay Singh
Fix "Avoid camelCase" issue reported by checkpatch.pl script.
In this patch rename "strConnectInfo" variable to resolve
issue reported by checkpatch.pl script.

Signed-off-by: Ajay Singh 
Reviewed-by: Claudiu Beznea 
---
 drivers/staging/wilc1000/host_interface.c | 74 +++
 1 file changed, 37 insertions(+), 37 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index c3b6368..0eaf6c6 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1115,30 +1115,30 @@ static s32 Handle_Connect(struct wilc_vif *vif,
 
 ERRORHANDLER:
if (result) {
-   struct connect_info strConnectInfo;
+   struct connect_info conn_info;
 
del_timer(&hif_drv->connect_timer);
 
-   memset(&strConnectInfo, 0, sizeof(struct connect_info));
+   memset(&conn_info, 0, sizeof(struct connect_info));
 
if (attr->result) {
if (attr->bssid)
-   memcpy(strConnectInfo.bssid, attr->bssid, 6);
+   memcpy(conn_info.bssid, attr->bssid, 6);
 
if (attr->ies) {
-   strConnectInfo.req_ies_len = attr->ies_len;
-   strConnectInfo.req_ies = kmalloc(attr->ies_len, 
GFP_KERNEL);
-   memcpy(strConnectInfo.req_ies, attr->ies, 
attr->ies_len);
+   conn_info.req_ies_len = attr->ies_len;
+   conn_info.req_ies = kmalloc(attr->ies_len, 
GFP_KERNEL);
+   memcpy(conn_info.req_ies, attr->ies, 
attr->ies_len);
}
 
attr->result(CONN_DISCONN_EVENT_CONN_RESP,
-  &strConnectInfo,
+  &conn_info,
   MAC_DISCONNECTED,
   NULL,
   attr->arg);
hif_drv->hif_state = HOST_IF_IDLE;
-   kfree(strConnectInfo.req_ies);
-   strConnectInfo.req_ies = NULL;
+   kfree(conn_info.req_ies);
+   conn_info.req_ies = NULL;
 
} else {
netdev_err(vif->ndev, "Connect callback is NULL\n");
@@ -1161,7 +1161,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
 static s32 Handle_ConnectTimeout(struct wilc_vif *vif)
 {
s32 result = 0;
-   struct connect_info strConnectInfo;
+   struct connect_info conn_info;
struct wid wid;
u16 u16DummyReasonCode = 0;
struct host_if_drv *hif_drv = vif->hif_drv;
@@ -1175,30 +1175,30 @@ static s32 Handle_ConnectTimeout(struct wilc_vif *vif)
 
scan_while_connected = false;
 
-   memset(&strConnectInfo, 0, sizeof(struct connect_info));
+   memset(&conn_info, 0, sizeof(struct connect_info));
 
if (hif_drv->usr_conn_req.conn_result) {
if (hif_drv->usr_conn_req.bssid) {
-   memcpy(strConnectInfo.bssid,
+   memcpy(conn_info.bssid,
   hif_drv->usr_conn_req.bssid, 6);
}
 
if (hif_drv->usr_conn_req.ies) {
-   strConnectInfo.req_ies_len = 
hif_drv->usr_conn_req.ies_len;
-   strConnectInfo.req_ies = 
kmalloc(hif_drv->usr_conn_req.ies_len, GFP_KERNEL);
-   memcpy(strConnectInfo.req_ies,
+   conn_info.req_ies_len = hif_drv->usr_conn_req.ies_len;
+   conn_info.req_ies = 
kmalloc(hif_drv->usr_conn_req.ies_len, GFP_KERNEL);
+   memcpy(conn_info.req_ies,
   hif_drv->usr_conn_req.ies,
   hif_drv->usr_conn_req.ies_len);
}
 
hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_CONN_RESP,
- &strConnectInfo,
+ &conn_info,
  MAC_DISCONNECTED,
  NULL,
  hif_drv->usr_conn_req.arg);
 
-   kfree(strConnectInfo.req_ies);
-   strConnectInfo.req_ies = NULL;
+   kfree(conn_info.req_ies);
+   conn_info.req_ies = NULL;
} else {
netdev_err(vif->ndev, "Connect callback is NULL\n");
}
@@ -1323,7 +1323,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
u8 u8MacStatus;
u8 u8MacStatusReasonCode;
u8 u8MacStatu

[PATCH v2 14/14] staging: wilc1000: rename Handle_ConnectTimeout() and Handle_Key()

2018-01-22 Thread Ajay Singh
Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh 
Reviewed-by: Claudiu Beznea 
---
 drivers/staging/wilc1000/host_interface.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 6e462db..38b2f2e 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1158,7 +1158,7 @@ static s32 handle_connect(struct wilc_vif *vif,
return result;
 }
 
-static s32 Handle_ConnectTimeout(struct wilc_vif *vif)
+static s32 handle_connect_timeout(struct wilc_vif *vif)
 {
s32 result = 0;
struct connect_info conn_info;
@@ -1518,7 +1518,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
return result;
 }
 
-static int Handle_Key(struct wilc_vif *vif,
+static int handle_key(struct wilc_vif *vif,
  struct key_attr *pstrHostIFkeyAttr)
 {
s32 result = 0;
@@ -2504,7 +2504,7 @@ static void host_if_work(struct work_struct *work)
break;
 
case HOST_IF_MSG_KEY:
-   Handle_Key(msg->vif, &msg->body.key_info);
+   handle_key(msg->vif, &msg->body.key_info);
break;
 
case HOST_IF_MSG_CFG_PARAMS:
@@ -2571,7 +2571,7 @@ static void host_if_work(struct work_struct *work)
break;
 
case HOST_IF_MSG_CONNECT_TIMER_FIRED:
-   Handle_ConnectTimeout(msg->vif);
+   handle_connect_timeout(msg->vif);
break;
 
case HOST_IF_MSG_POWER_MGMT:
-- 
2.7.4

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


[PATCH v2 13/14] staging: wilc1000: rename Handle_Connect() to avoid camelCase

2018-01-22 Thread Ajay Singh
Fix "Avoid camelcase" issue found by checkpatch.pl
script.

Signed-off-by: Ajay Singh 
Reviewed-by: Claudiu Beznea 
---
 drivers/staging/wilc1000/host_interface.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index b34243c..6e462db 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -902,7 +902,7 @@ static s32 handle_scan_done(struct wilc_vif *vif,
 }
 
 u8 wilc_connected_ssid[6] = {0};
-static s32 Handle_Connect(struct wilc_vif *vif,
+static s32 handle_connect(struct wilc_vif *vif,
  struct connect_attr *attr)
 {
s32 result = 0;
@@ -2491,7 +2491,7 @@ static void host_if_work(struct work_struct *work)
break;
 
case HOST_IF_MSG_CONNECT:
-   Handle_Connect(msg->vif, &msg->body.con_info);
+   handle_connect(msg->vif, &msg->body.con_info);
break;
 
case HOST_IF_MSG_RCVD_NTWRK_INFO:
-- 
2.7.4

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


[PATCH v2 10/14] staging: wilc1000: rename ptstrJoinBssParam variable to avoid camelCase

2018-01-22 Thread Ajay Singh
Fix "Avoid camelCase" issue reported by checkpatch.pl script.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 4856d4f..c3b6368 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -909,7 +909,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
struct wid wid_list[8];
u32 wid_cnt = 0, dummyval = 0;
u8 *cur_byte = NULL;
-   struct join_bss_param *ptstrJoinBssParam;
+   struct join_bss_param *bss_param;
struct host_if_drv *hif_drv = vif->hif_drv;
 
if (memcmp(attr->bssid, wilc_connected_ssid, ETH_ALEN) == 0) {
@@ -918,8 +918,8 @@ static s32 Handle_Connect(struct wilc_vif *vif,
return result;
}
 
-   ptstrJoinBssParam = attr->params;
-   if (!ptstrJoinBssParam) {
+   bss_param = attr->params;
+   if (!bss_param) {
netdev_err(vif->ndev, "Required BSSID not found\n");
result = -ENOENT;
goto ERRORHANDLER;
@@ -1027,8 +1027,8 @@ static s32 Handle_Connect(struct wilc_vif *vif,
netdev_err(vif->ndev, "Channel out of range\n");
*(cur_byte++) = 0xFF;
}
-   *(cur_byte++)  = (ptstrJoinBssParam->cap_info) & 0xFF;
-   *(cur_byte++)  = ((ptstrJoinBssParam->cap_info) >> 8) & 0xFF;
+   *(cur_byte++)  = (bss_param->cap_info) & 0xFF;
+   *(cur_byte++)  = ((bss_param->cap_info) >> 8) & 0xFF;
 
if (attr->bssid)
memcpy(cur_byte, attr->bssid, 6);
@@ -1038,57 +1038,57 @@ static s32 Handle_Connect(struct wilc_vif *vif,
memcpy(cur_byte, attr->bssid, 6);
cur_byte += 6;
 
-   *(cur_byte++)  = (ptstrJoinBssParam->beacon_period) & 0xFF;
-   *(cur_byte++)  = ((ptstrJoinBssParam->beacon_period) >> 8) & 0xFF;
-   *(cur_byte++)  =  ptstrJoinBssParam->dtim_period;
+   *(cur_byte++)  = (bss_param->beacon_period) & 0xFF;
+   *(cur_byte++)  = ((bss_param->beacon_period) >> 8) & 0xFF;
+   *(cur_byte++)  =  bss_param->dtim_period;
 
-   memcpy(cur_byte, ptstrJoinBssParam->supp_rates, MAX_RATES_SUPPORTED + 
1);
+   memcpy(cur_byte, bss_param->supp_rates, MAX_RATES_SUPPORTED + 1);
cur_byte += (MAX_RATES_SUPPORTED + 1);
 
-   *(cur_byte++)  =  ptstrJoinBssParam->wmm_cap;
-   *(cur_byte++)  = ptstrJoinBssParam->uapsd_cap;
+   *(cur_byte++)  =  bss_param->wmm_cap;
+   *(cur_byte++)  = bss_param->uapsd_cap;
 
-   *(cur_byte++)  = ptstrJoinBssParam->ht_capable;
-   hif_drv->usr_conn_req.ht_capable = ptstrJoinBssParam->ht_capable;
+   *(cur_byte++)  = bss_param->ht_capable;
+   hif_drv->usr_conn_req.ht_capable = bss_param->ht_capable;
 
-   *(cur_byte++)  =  ptstrJoinBssParam->rsn_found;
-   *(cur_byte++)  =  ptstrJoinBssParam->rsn_grp_policy;
-   *(cur_byte++) =  ptstrJoinBssParam->mode_802_11i;
+   *(cur_byte++)  =  bss_param->rsn_found;
+   *(cur_byte++)  =  bss_param->rsn_grp_policy;
+   *(cur_byte++) =  bss_param->mode_802_11i;
 
-   memcpy(cur_byte, ptstrJoinBssParam->rsn_pcip_policy, 
sizeof(ptstrJoinBssParam->rsn_pcip_policy));
-   cur_byte += sizeof(ptstrJoinBssParam->rsn_pcip_policy);
+   memcpy(cur_byte, bss_param->rsn_pcip_policy, 
sizeof(bss_param->rsn_pcip_policy));
+   cur_byte += sizeof(bss_param->rsn_pcip_policy);
 
-   memcpy(cur_byte, ptstrJoinBssParam->rsn_auth_policy, 
sizeof(ptstrJoinBssParam->rsn_auth_policy));
-   cur_byte += sizeof(ptstrJoinBssParam->rsn_auth_policy);
+   memcpy(cur_byte, bss_param->rsn_auth_policy, 
sizeof(bss_param->rsn_auth_policy));
+   cur_byte += sizeof(bss_param->rsn_auth_policy);
 
-   memcpy(cur_byte, ptstrJoinBssParam->rsn_cap, 
sizeof(ptstrJoinBssParam->rsn_cap));
-   cur_byte += sizeof(ptstrJoinBssParam->rsn_cap);
+   memcpy(cur_byte, bss_param->rsn_cap, sizeof(bss_param->rsn_cap));
+   cur_byte += sizeof(bss_param->rsn_cap);
 
*(cur_byte++) = REAL_JOIN_REQ;
-   *(cur_byte++) = ptstrJoinBssParam->noa_enabled;
+   *(cur_byte++) = bss_param->noa_enabled;
 
-   if (ptstrJoinBssParam->noa_enabled) {
-   *(cur_byte++) = (ptstrJoinBssParam->tsf) & 0xFF;
-   *(cur_byte++) = ((ptstrJoinBssParam->tsf) >> 8) & 0xFF;
-   *(cur_byte++) = ((ptstrJoinBssParam->tsf) >> 16) & 0xFF;
-   *(cur_byte++) = ((ptstrJoinBssParam->tsf) >> 24) & 0xFF;
+   if (bss_param->noa_enabled) {
+   *(cur_byte++) = (bss_param->tsf) & 0xFF;
+   *(cur_byte++) = ((bss_param->tsf) >> 8) & 0xFF;
+   *(cur_byte++) = ((bss_param->tsf) >> 16) & 0xFF;
+   *(cur_byte++) = ((bss_param->tsf) >> 24) & 0xFF;
 
-   *(cur_byte++) = ptstrJoinBssParam->

[PATCH v2 06/14] staging: wilc1000: rename strWIDList variable to wid_list to avoid camelCase

2018-01-22 Thread Ajay Singh
Fix "Avoid camelCase" issue found by checkpatch.pl script.
Rename variable name from strWIDList to wid_list.

Signed-off-by: Ajay Singh 
Reviewed-by: Claudiu Beznea 
---
 drivers/staging/wilc1000/host_interface.c | 176 +++---
 1 file changed, 88 insertions(+), 88 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index f0168e3..13ac482 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -906,7 +906,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
  struct connect_attr *pstrHostIFconnectAttr)
 {
s32 result = 0;
-   struct wid strWIDList[8];
+   struct wid wid_list[8];
u32 u32WidsCount = 0, dummyval = 0;
u8 *pu8CurrByte = NULL;
struct join_bss_param *ptstrJoinBssParam;
@@ -952,29 +952,29 @@ static s32 Handle_Connect(struct wilc_vif *vif,
hif_drv->usr_conn_req.conn_result = pstrHostIFconnectAttr->result;
hif_drv->usr_conn_req.arg = pstrHostIFconnectAttr->arg;
 
-   strWIDList[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT;
-   strWIDList[u32WidsCount].type = WID_INT;
-   strWIDList[u32WidsCount].size = sizeof(u32);
-   strWIDList[u32WidsCount].val = (s8 *)(&(dummyval));
+   wid_list[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT;
+   wid_list[u32WidsCount].type = WID_INT;
+   wid_list[u32WidsCount].size = sizeof(u32);
+   wid_list[u32WidsCount].val = (s8 *)(&(dummyval));
u32WidsCount++;
 
-   strWIDList[u32WidsCount].id = WID_RECEIVED_FRAGMENT_COUNT;
-   strWIDList[u32WidsCount].type = WID_INT;
-   strWIDList[u32WidsCount].size = sizeof(u32);
-   strWIDList[u32WidsCount].val = (s8 *)(&(dummyval));
+   wid_list[u32WidsCount].id = WID_RECEIVED_FRAGMENT_COUNT;
+   wid_list[u32WidsCount].type = WID_INT;
+   wid_list[u32WidsCount].size = sizeof(u32);
+   wid_list[u32WidsCount].val = (s8 *)(&(dummyval));
u32WidsCount++;
 
-   strWIDList[u32WidsCount].id = WID_FAILED_COUNT;
-   strWIDList[u32WidsCount].type = WID_INT;
-   strWIDList[u32WidsCount].size = sizeof(u32);
-   strWIDList[u32WidsCount].val = (s8 *)(&(dummyval));
+   wid_list[u32WidsCount].id = WID_FAILED_COUNT;
+   wid_list[u32WidsCount].type = WID_INT;
+   wid_list[u32WidsCount].size = sizeof(u32);
+   wid_list[u32WidsCount].val = (s8 *)(&(dummyval));
u32WidsCount++;
 
{
-   strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE;
-   strWIDList[u32WidsCount].type = WID_BIN_DATA;
-   strWIDList[u32WidsCount].val = hif_drv->usr_conn_req.ies;
-   strWIDList[u32WidsCount].size = hif_drv->usr_conn_req.ies_len;
+   wid_list[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE;
+   wid_list[u32WidsCount].type = WID_BIN_DATA;
+   wid_list[u32WidsCount].val = hif_drv->usr_conn_req.ies;
+   wid_list[u32WidsCount].size = hif_drv->usr_conn_req.ies_len;
u32WidsCount++;
 
if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
@@ -984,39 +984,39 @@ static s32 Handle_Connect(struct wilc_vif *vif,
   info_element_size);
}
}
-   strWIDList[u32WidsCount].id = (u16)WID_11I_MODE;
-   strWIDList[u32WidsCount].type = WID_CHAR;
-   strWIDList[u32WidsCount].size = sizeof(char);
-   strWIDList[u32WidsCount].val = (s8 *)&hif_drv->usr_conn_req.security;
+   wid_list[u32WidsCount].id = (u16)WID_11I_MODE;
+   wid_list[u32WidsCount].type = WID_CHAR;
+   wid_list[u32WidsCount].size = sizeof(char);
+   wid_list[u32WidsCount].val = (s8 *)&hif_drv->usr_conn_req.security;
u32WidsCount++;
 
if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7))
mode_11i = hif_drv->usr_conn_req.security;
 
-   strWIDList[u32WidsCount].id = (u16)WID_AUTH_TYPE;
-   strWIDList[u32WidsCount].type = WID_CHAR;
-   strWIDList[u32WidsCount].size = sizeof(char);
-   strWIDList[u32WidsCount].val = (s8 *)&hif_drv->usr_conn_req.auth_type;
+   wid_list[u32WidsCount].id = (u16)WID_AUTH_TYPE;
+   wid_list[u32WidsCount].type = WID_CHAR;
+   wid_list[u32WidsCount].size = sizeof(char);
+   wid_list[u32WidsCount].val = (s8 *)&hif_drv->usr_conn_req.auth_type;
u32WidsCount++;
 
if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7))
auth_type = (u8)hif_drv->usr_conn_req.auth_type;
 
-   strWIDList[u32WidsCount].id = (u16)WID_JOIN_REQ_EXTENDED;
-   strWIDList[u32WidsCount].type = WID_STR;
-   strWIDList[u32WidsCount].size = 112;
-   strWIDList[u32WidsCount].val = kmalloc(strWIDList[u32WidsCount].size, 
GFP_KERNEL);
+   wid_list[u32WidsCount].id = (u16)WID_JOIN_REQ_EXTENDED;
+   wid_list[u32WidsCount].type = WID_STR;
+   wid_list[u32WidsCount].size = 112;
+   wid_l

[PATCH v2 08/14] staging: wilc1000: rename pu8CurrByte variable to avoid camelCase

2018-01-22 Thread Ajay Singh
Fix "Avoid camelCase" issue reported by checkpatch.pl script.
rename variable name from "pu8CurrByte" to "cur_byte"

Signed-off-by: Ajay Singh 
Reviewed-by: Claudiu Beznea 
---
 drivers/staging/wilc1000/host_interface.c | 232 +++---
 1 file changed, 116 insertions(+), 116 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 496c72f..43f8559 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -908,7 +908,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
s32 result = 0;
struct wid wid_list[8];
u32 wid_cnt = 0, dummyval = 0;
-   u8 *pu8CurrByte = NULL;
+   u8 *cur_byte = NULL;
struct join_bss_param *ptstrJoinBssParam;
struct host_if_drv *hif_drv = vif->hif_drv;
 
@@ -1016,90 +1016,90 @@ static s32 Handle_Connect(struct wilc_vif *vif,
goto ERRORHANDLER;
}
 
-   pu8CurrByte = wid_list[wid_cnt].val;
+   cur_byte = wid_list[wid_cnt].val;
 
if (pstrHostIFconnectAttr->ssid) {
-   memcpy(pu8CurrByte, pstrHostIFconnectAttr->ssid, 
pstrHostIFconnectAttr->ssid_len);
-   pu8CurrByte[pstrHostIFconnectAttr->ssid_len] = '\0';
+   memcpy(cur_byte, pstrHostIFconnectAttr->ssid, 
pstrHostIFconnectAttr->ssid_len);
+   cur_byte[pstrHostIFconnectAttr->ssid_len] = '\0';
}
-   pu8CurrByte += MAX_SSID_LEN;
-   *(pu8CurrByte++) = INFRASTRUCTURE;
+   cur_byte += MAX_SSID_LEN;
+   *(cur_byte++) = INFRASTRUCTURE;
 
if (pstrHostIFconnectAttr->ch >= 1 && pstrHostIFconnectAttr->ch <= 14) {
-   *(pu8CurrByte++) = pstrHostIFconnectAttr->ch;
+   *(cur_byte++) = pstrHostIFconnectAttr->ch;
} else {
netdev_err(vif->ndev, "Channel out of range\n");
-   *(pu8CurrByte++) = 0xFF;
+   *(cur_byte++) = 0xFF;
}
-   *(pu8CurrByte++)  = (ptstrJoinBssParam->cap_info) & 0xFF;
-   *(pu8CurrByte++)  = ((ptstrJoinBssParam->cap_info) >> 8) & 0xFF;
+   *(cur_byte++)  = (ptstrJoinBssParam->cap_info) & 0xFF;
+   *(cur_byte++)  = ((ptstrJoinBssParam->cap_info) >> 8) & 0xFF;
 
if (pstrHostIFconnectAttr->bssid)
-   memcpy(pu8CurrByte, pstrHostIFconnectAttr->bssid, 6);
-   pu8CurrByte += 6;
+   memcpy(cur_byte, pstrHostIFconnectAttr->bssid, 6);
+   cur_byte += 6;
 
if (pstrHostIFconnectAttr->bssid)
-   memcpy(pu8CurrByte, pstrHostIFconnectAttr->bssid, 6);
-   pu8CurrByte += 6;
+   memcpy(cur_byte, pstrHostIFconnectAttr->bssid, 6);
+   cur_byte += 6;
 
-   *(pu8CurrByte++)  = (ptstrJoinBssParam->beacon_period) & 0xFF;
-   *(pu8CurrByte++)  = ((ptstrJoinBssParam->beacon_period) >> 8) & 0xFF;
-   *(pu8CurrByte++)  =  ptstrJoinBssParam->dtim_period;
+   *(cur_byte++)  = (ptstrJoinBssParam->beacon_period) & 0xFF;
+   *(cur_byte++)  = ((ptstrJoinBssParam->beacon_period) >> 8) & 0xFF;
+   *(cur_byte++)  =  ptstrJoinBssParam->dtim_period;
 
-   memcpy(pu8CurrByte, ptstrJoinBssParam->supp_rates, MAX_RATES_SUPPORTED 
+ 1);
-   pu8CurrByte += (MAX_RATES_SUPPORTED + 1);
+   memcpy(cur_byte, ptstrJoinBssParam->supp_rates, MAX_RATES_SUPPORTED + 
1);
+   cur_byte += (MAX_RATES_SUPPORTED + 1);
 
-   *(pu8CurrByte++)  =  ptstrJoinBssParam->wmm_cap;
-   *(pu8CurrByte++)  = ptstrJoinBssParam->uapsd_cap;
+   *(cur_byte++)  =  ptstrJoinBssParam->wmm_cap;
+   *(cur_byte++)  = ptstrJoinBssParam->uapsd_cap;
 
-   *(pu8CurrByte++)  = ptstrJoinBssParam->ht_capable;
+   *(cur_byte++)  = ptstrJoinBssParam->ht_capable;
hif_drv->usr_conn_req.ht_capable = ptstrJoinBssParam->ht_capable;
 
-   *(pu8CurrByte++)  =  ptstrJoinBssParam->rsn_found;
-   *(pu8CurrByte++)  =  ptstrJoinBssParam->rsn_grp_policy;
-   *(pu8CurrByte++) =  ptstrJoinBssParam->mode_802_11i;
+   *(cur_byte++)  =  ptstrJoinBssParam->rsn_found;
+   *(cur_byte++)  =  ptstrJoinBssParam->rsn_grp_policy;
+   *(cur_byte++) =  ptstrJoinBssParam->mode_802_11i;
 
-   memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_pcip_policy, 
sizeof(ptstrJoinBssParam->rsn_pcip_policy));
-   pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_pcip_policy);
+   memcpy(cur_byte, ptstrJoinBssParam->rsn_pcip_policy, 
sizeof(ptstrJoinBssParam->rsn_pcip_policy));
+   cur_byte += sizeof(ptstrJoinBssParam->rsn_pcip_policy);
 
-   memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_auth_policy, 
sizeof(ptstrJoinBssParam->rsn_auth_policy));
-   pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_auth_policy);
+   memcpy(cur_byte, ptstrJoinBssParam->rsn_auth_policy, 
sizeof(ptstrJoinBssParam->rsn_auth_policy));
+   cur_byte += sizeof(ptstrJoinBssParam->rsn_auth_policy);
 
-   memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_cap, 
sizeof(ptstrJoinBssParam->rsn_cap));
-   pu8CurrByte += si

[PATCH v2 12/14] staging: wilc1000: rename Handle_ScanDone() to avoid camelCase

2018-01-22 Thread Ajay Singh
Fix "Avoid camelCase" issue reported by checkpatch.pl
script.

Signed-off-by: Ajay Singh 
Reviewed-by: Claudiu Beznea 
---
 drivers/staging/wilc1000/host_interface.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 0eaf6c6..b34243c 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -267,7 +267,7 @@ static struct wilc_vif *join_req_vif;
 
 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_ScanDone(struct wilc_vif *vif, enum scan_event enuEvent);
+static s32 handle_scan_done(struct wilc_vif *vif, enum scan_event enuEvent);
 static void host_if_work(struct work_struct *work);
 
 /*!
@@ -847,7 +847,7 @@ static s32 handle_scan(struct wilc_vif *vif, struct 
scan_attr *scan_info)
 ERRORHANDLER:
if (result) {
del_timer(&hif_drv->scan_timer);
-   Handle_ScanDone(vif, SCAN_EVENT_ABORTED);
+   handle_scan_done(vif, SCAN_EVENT_ABORTED);
}
 
kfree(scan_info->ch_freq_list);
@@ -863,8 +863,8 @@ static s32 handle_scan(struct wilc_vif *vif, struct 
scan_attr *scan_info)
return result;
 }
 
-static s32 Handle_ScanDone(struct wilc_vif *vif,
-  enum scan_event enuEvent)
+static s32 handle_scan_done(struct wilc_vif *vif,
+   enum scan_event enuEvent)
 {
s32 result = 0;
u8 u8abort_running_scan;
@@ -1460,7 +1460,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
 
if (hif_drv->usr_scan_req.scan_result) {
del_timer(&hif_drv->scan_timer);
-   Handle_ScanDone(vif, SCAN_EVENT_ABORTED);
+   handle_scan_done(vif, SCAN_EVENT_ABORTED);
}
 
strDisconnectNotifInfo.reason = 0;
@@ -1508,7 +1508,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
   (hif_drv->usr_scan_req.scan_result)) {
del_timer(&hif_drv->scan_timer);
if (hif_drv->usr_scan_req.scan_result)
-   Handle_ScanDone(vif, SCAN_EVENT_ABORTED);
+   handle_scan_done(vif, SCAN_EVENT_ABORTED);
}
}
 
@@ -2525,7 +2525,7 @@ static void host_if_work(struct work_struct *work)
if (!wilc_wlan_get_num_conn_ifcs(wilc))
wilc_chip_sleep_manually(wilc);
 
-   Handle_ScanDone(msg->vif, SCAN_EVENT_DONE);
+   handle_scan_done(msg->vif, SCAN_EVENT_DONE);
 
if (msg->vif->hif_drv->remain_on_ch_pending)
Handle_RemainOnChan(msg->vif,
@@ -2567,7 +2567,7 @@ static void host_if_work(struct work_struct *work)
break;
 
case HOST_IF_MSG_SCAN_TIMER_FIRED:
-   Handle_ScanDone(msg->vif, SCAN_EVENT_ABORTED);
+   handle_scan_done(msg->vif, SCAN_EVENT_ABORTED);
break;
 
case HOST_IF_MSG_CONNECT_TIMER_FIRED:
-- 
2.7.4

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


[PATCH] staging: lustre: libcfs: Prevent harmless read underflow

2018-01-22 Thread Dan Carpenter
Because this is a post-op instead of a pre-op, then it means we check
if knl_buffer[-1] is a space.  It doesn't really hurt anything, but
it causes a static checker warning so let's fix it.

Fixes: d7e09d0397e8 ("staging: add Lustre file system client support")
Signed-off-by: Dan Carpenter 

diff --git a/drivers/staging/lustre/lnet/libcfs/tracefile.c 
b/drivers/staging/lustre/lnet/libcfs/tracefile.c
index da2844f37edf..57913aae1d88 100644
--- a/drivers/staging/lustre/lnet/libcfs/tracefile.c
+++ b/drivers/staging/lustre/lnet/libcfs/tracefile.c
@@ -785,7 +785,7 @@ int cfs_trace_copyin_string(char *knl_buffer, int 
knl_buffer_nob,
return -EFAULT;
 
nob = strnlen(knl_buffer, usr_buffer_nob);
-   while (nob-- >= 0)/* strip trailing whitespace */
+   while (--nob >= 0)/* strip trailing whitespace */
if (!isspace(knl_buffer[nob]))
break;
 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/2] staging: lustre: Fix comment style

2018-01-22 Thread Greg Kroah-Hartman
On Fri, Jan 19, 2018 at 05:53:59PM -0800, Joe Perches wrote:
> On Thu, 2018-01-18 at 16:51 +0100, Fabian Huegel wrote:
> > Most multi-line comments started on the first line, but the preferred
> > linux kernel style is to start multi-line comments on the second line.
> > Some comments became less readable after the change, so we changed them
> > to single-line comments.
> []
> > diff --git a/drivers/staging/lustre/lustre/include/obd_class.h 
> > b/drivers/staging/lustre/lustre/include/obd_class.h
> > 
> > @@ -182,7 +179,8 @@ struct config_llog_data {
> > struct obd_export *cld_mgcexp;
> > struct mutexcld_lock;
> > int  cld_type;
> > -   unsigned intcld_stopping:1, /* we were told to stop
> > +   unsigned intcld_stopping:1, /*
> > +* we were told to stop
> >  * watching
> >  */
> > cld_lostlock:1; /* lock not requeued */
> 
> probably better for both of these to be bool
> instead of bitfield.

That's a change best left for a separate patch :)

thanks,

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


[PATCH] staging: rts5208: Fix "seg_no" calculation in reset_ms_card()

2018-01-22 Thread Dan Carpenter
I get some static checker warnings like this:

drivers/staging/rts5208/ms.c:2607 ms_build_l2p_tbl()
error: buffer underflow 'ms_card->segment' (-1)-16

The problem is that we memset "ms_card" to zero at the start of the
reset_ms_card() function.  That means that when we try to calculate
"ms_card->total_block / 512 - 1" then it's just always -1.  The fix is
to calculate "seg_no" before doing the memset().

This is a static checker fix, and I am not able to test it.  My theory
is that reset_ms_card() gets very little testing which is why this bug
exists.

Fixes: fa590c222fba ("staging: rts5208: add support for rts5208 and rts5288")
Signed-off-by: Dan Carpenter 

diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c
index 7cdce87f3051..821256b95e22 100644
--- a/drivers/staging/rts5208/ms.c
+++ b/drivers/staging/rts5208/ms.c
@@ -2821,6 +2821,7 @@ static int ms_build_l2p_tbl(struct rtsx_chip *chip, int 
seg_no)
 int reset_ms_card(struct rtsx_chip *chip)
 {
struct ms_info *ms_card = &chip->ms_card;
+   int seg_no = ms_card->total_block / 512 - 1;
int retval;
 
memset(ms_card, 0, sizeof(struct ms_info));
@@ -2863,7 +2864,7 @@ int reset_ms_card(struct rtsx_chip *chip)
/* Build table for the last segment,
 * to check if L2P table block exists, erasing it
 */
-   retval = ms_build_l2p_tbl(chip, ms_card->total_block / 512 - 1);
+   retval = ms_build_l2p_tbl(chip, seg_no);
if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
return STATUS_FAIL;
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: lustre: Fix avoid intensive reconnecting for ko2iblnd patch

2018-01-22 Thread Greg Kroah-Hartman
On Tue, Jan 16, 2018 at 06:02:07PM +, Eremin, Dmitry wrote:
> The logic of the original commit 4d99b2581eff ("staging: lustre: avoid 
> intensive reconnecting for ko2iblnd")
> was assumed conditional free of struct kib_conn if the second argument 
> free_conn in function
> kiblnd_destroy_conn(struct kib_conn *conn, bool free_conn) is true. But this 
> hunk of code was dropped
> from original commit. As result the logic works wrong and current code use 
> struct kib_conn after
> free.
> 
> > drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
> >   3317  kiblnd_destroy_conn(conn, !peer);
> >  Freed always (but 
> > should be conditionally)
> >   3318
> >   3319  spin_lock_irqsave(lock, flags);
> >   3320  if (!peer)
> >   3321  continue;
> >   3322
> >   3323  conn->ibc_peer = peer;
> > ^ Use after free
> >   3324  if (peer->ibp_reconnected < 
> > KIB_RECONN_HIGH_RACE)
> >   3325  list_add_tail(&conn->ibc_list,
> >
> > 
> >   3326
> > &kiblnd_data.kib_reconn_list);
> >   3327  else
> >   3328  list_add_tail(&conn->ibc_list,
> > 
> > 
> >   3329
> > &kiblnd_data.kib_reconn_wait);
> 
> After attached patch this code will use struct kib_conn only when it was not 
> freed.
> 
> Signed-off-by: Dmitry Eremin 
> ---
>  drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c 
> b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
> index 2ebc484..a15a625 100644
> --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
> +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
> @@ -890,7 +890,8 @@ void kiblnd_destroy_conn(struct kib_conn *conn, bool 
> free_conn)
>   atomic_dec(&net->ibn_nconns);
>   }
>  
> - kfree(conn);
> + if (free_conn)
> + kfree(conn);
>  }
>  
>  int kiblnd_close_peer_conns_locked(struct kib_peer *peer, int why)

This patch needs a real "Fixes:" tag, right?

Also, as this was from 4.6, it should go to the stable trees, right?
Can you resend this with that info, and then send a follow-on patch to
fix this up the way I recommended so that no one is confused in the
future?

thanks,

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


Re: [PATCH v3 3/7] x86/hyper-v: reenlightenment notifications support

2018-01-22 Thread Vitaly Kuznetsov
Thomas Gleixner  writes:

> On Fri, 19 Jan 2018, Vitaly Kuznetsov wrote:
>> kbuild test robot  writes:
>> 
>> > Hi Vitaly,
>> >
>> > Thank you for the patch! Perhaps something to improve:
>> >
>> > [auto build test WARNING on tip/auto-latest]
>> > [also build test WARNING on v4.15-rc8 next-20180118]
>> > [cannot apply to tip/x86/core kvm/linux-next]
>> > [if your patch is applied to the wrong git tree, please drop us a note to 
>> > help improve the system]
>> >
>> > url:
>> > https://github.com/0day-ci/linux/commits/Vitaly-Kuznetsov/x86-kvm-hyperv-stable-clocksorce-for-L2-guests-when-running-nested-KVM-on-Hyper-V/20180119-160814
>> > config: x86_64-allmodconfig (attached as .config)
>> > compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
>> > reproduce:
>> > # save the attached .config to linux build tree
>> > make ARCH=x86_64 
>> >
>> > All warnings (new ones prefixed by >>):
>> >
>> >In file included from include/linux/kasan.h:17:0,
>> > from include/linux/slab.h:129,
>> > from include/linux/irq.h:26,
>> > from arch/x86/include/asm/hardirq.h:6,
>> > from include/linux/hardirq.h:9,
>> > from include/linux/interrupt.h:13,
>> > from arch/x86/include/asm/mshyperv.h:8,
>> > from 
>> > arch/x86//entry/vdso/vdso32/../vclock_gettime.c:20,
>> > from arch/x86//entry/vdso/vdso32/vclock_gettime.c:33:
>> >arch/x86/include/asm/pgtable.h: In function 'clone_pgd_range':
>> >arch/x86/include/asm/pgtable.h:1129:9: error: implicit declaration of 
>> > function 'kernel_to_user_pgdp'; did you mean 'u64_to_user_ptr'? 
>> > [-Werror=implicit-function-declaration]
>> >  memcpy(kernel_to_user_pgdp(dst), kernel_to_user_pgdp(src),
>> > ^~~
>> 
>> Sorry but I'm failing to see how this (and all the rest) is related to
>> my patch ...
>
> You added '#include ' to mshyperv.h which is included in
> vclock_gettime.c and pulls in other stuff which fails to expand
>

Oh, right, thanks! I'll see what can be done.

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


Re: [PATCH] staging: most: replace function name to __func__

2018-01-22 Thread Greg Kroah-Hartman
On Sun, Jan 21, 2018 at 04:05:26PM +, Sidong Yang wrote:
> Fix checkpatch.pl warning message about logging code. Previous code
> contains hard coded function name. Fix this code by using __func__
> macro.
> 
> Signed-off-by: Sidong Yang 
> ---
>  drivers/staging/most/dim2/dim2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/most/dim2/dim2.c 
> b/drivers/staging/most/dim2/dim2.c
> index 21e3fb48bdb4..f9bc7dea75b8 100644
> --- a/drivers/staging/most/dim2/dim2.c
> +++ b/drivers/staging/most/dim2/dim2.c
> @@ -151,7 +151,7 @@ void dimcb_io_write(u32 __iomem *ptr32, u32 value)
>   */
>  void dimcb_on_error(u8 error_id, const char *error_message)
>  {
> - pr_err("dimcb_on_error: error_id - %d, error_message - %s\n", error_id,
> + pr_err("%s: error_id - %d, error_message - %s\n", __func__, error_id,
>  error_message);
>  }
>  

This is ok, but this function should really be removed and just use
dev_err() instead everywhere this is called.  And there's no need for
yet-another-wrapper-function dim_on_error() that does nothing but call
this function as well.  Too many levels of indirection for no reason...

thanks,

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


Re: [PATCH v2 12/14] staging: wilc1000: rename Handle_ScanDone() to avoid camelCase

2018-01-22 Thread Claudiu Beznea


On 22.01.2018 12:22, Ajay Singh wrote:
> Fix "Avoid camelCase" issue reported by checkpatch.pl
> script.
Same here as in patch 02 of this series.

> 
> Signed-off-by: Ajay Singh 
> Reviewed-by: Claudiu Beznea 
> ---
>  drivers/staging/wilc1000/host_interface.c | 16 
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/host_interface.c 
> b/drivers/staging/wilc1000/host_interface.c
> index 0eaf6c6..b34243c 100644
> --- a/drivers/staging/wilc1000/host_interface.c
> +++ b/drivers/staging/wilc1000/host_interface.c
> @@ -267,7 +267,7 @@ static struct wilc_vif *join_req_vif;
>  
>  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_ScanDone(struct wilc_vif *vif, enum scan_event enuEvent);
> +static s32 handle_scan_done(struct wilc_vif *vif, enum scan_event enuEvent);
>  static void host_if_work(struct work_struct *work);
>  
>  /*!
> @@ -847,7 +847,7 @@ static s32 handle_scan(struct wilc_vif *vif, struct 
> scan_attr *scan_info)
>  ERRORHANDLER:
>   if (result) {
>   del_timer(&hif_drv->scan_timer);
> - Handle_ScanDone(vif, SCAN_EVENT_ABORTED);
> + handle_scan_done(vif, SCAN_EVENT_ABORTED);
>   }
>  
>   kfree(scan_info->ch_freq_list);
> @@ -863,8 +863,8 @@ static s32 handle_scan(struct wilc_vif *vif, struct 
> scan_attr *scan_info)
>   return result;
>  }
>  
> -static s32 Handle_ScanDone(struct wilc_vif *vif,
> -enum scan_event enuEvent)
> +static s32 handle_scan_done(struct wilc_vif *vif,
> + enum scan_event enuEvent)
>  {
>   s32 result = 0;
>   u8 u8abort_running_scan;
> @@ -1460,7 +1460,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif 
> *vif,
>  
>   if (hif_drv->usr_scan_req.scan_result) {
>   del_timer(&hif_drv->scan_timer);
> - Handle_ScanDone(vif, SCAN_EVENT_ABORTED);
> + handle_scan_done(vif, SCAN_EVENT_ABORTED);
>   }
>  
>   strDisconnectNotifInfo.reason = 0;
> @@ -1508,7 +1508,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif 
> *vif,
>  (hif_drv->usr_scan_req.scan_result)) {
>   del_timer(&hif_drv->scan_timer);
>   if (hif_drv->usr_scan_req.scan_result)
> - Handle_ScanDone(vif, SCAN_EVENT_ABORTED);
> + handle_scan_done(vif, SCAN_EVENT_ABORTED);
>   }
>   }
>  
> @@ -2525,7 +2525,7 @@ static void host_if_work(struct work_struct *work)
>   if (!wilc_wlan_get_num_conn_ifcs(wilc))
>   wilc_chip_sleep_manually(wilc);
>  
> - Handle_ScanDone(msg->vif, SCAN_EVENT_DONE);
> + handle_scan_done(msg->vif, SCAN_EVENT_DONE);
>  
>   if (msg->vif->hif_drv->remain_on_ch_pending)
>   Handle_RemainOnChan(msg->vif,
> @@ -2567,7 +2567,7 @@ static void host_if_work(struct work_struct *work)
>   break;
>  
>   case HOST_IF_MSG_SCAN_TIMER_FIRED:
> - Handle_ScanDone(msg->vif, SCAN_EVENT_ABORTED);
> + handle_scan_done(msg->vif, SCAN_EVENT_ABORTED);
>   break;
>  
>   case HOST_IF_MSG_CONNECT_TIMER_FIRED:
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 04/14] staging: wilc1000: rename host_int_ParseJoinBssParam() and it's variable using camelCase

2018-01-22 Thread Claudiu Beznea


On 22.01.2018 12:22, Ajay Singh wrote:
> Fix "Avoid CamelCase:" issue reported by checkpatch.pl script
Forgot a dot here?
> Rename host_int_ParseJoinBssParam() & its variables name using
> camelCase.
> 
> Signed-off-by: Ajay Singh 
> Reviewed-by: Claudiu Beznea 
> ---
>  drivers/staging/wilc1000/host_interface.c | 230 
> +++---
>  1 file changed, 115 insertions(+), 115 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/host_interface.c 
> b/drivers/staging/wilc1000/host_interface.c
> index 358354b..8f8e727 100644
> --- a/drivers/staging/wilc1000/host_interface.c
> +++ b/drivers/staging/wilc1000/host_interface.c
> @@ -265,7 +265,7 @@ static struct wilc_vif *join_req_vif;
>  #define FLUSHED_JOIN_REQ 1
>  #define FLUSHED_BYTE_POS 79
>  
> -static void *host_int_ParseJoinBssParam(struct network_info 
> *ptstrNetworkInfo);
> +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_ScanDone(struct wilc_vif *vif, enum scan_event enuEvent);
>  static void host_if_work(struct work_struct *work);
> @@ -1288,7 +1288,7 @@ static s32 Handle_RcvdNtwrkInfo(struct wilc_vif *vif,
>   hif_drv->usr_scan_req.rcvd_ch_cnt++;
>  
>   pstrNetworkInfo->new_network = true;
> - pJoinParams = 
> host_int_ParseJoinBssParam(pstrNetworkInfo);
> + pJoinParams = 
> host_int_parse_join_bss_param(pstrNetworkInfo);
>  
>   
> hif_drv->usr_scan_req.scan_result(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo,
> 
> hif_drv->usr_scan_req.arg,
> @@ -3870,152 +3870,152 @@ int wilc_setup_multicast_filter(struct wilc_vif 
> *vif, bool enabled,
>   return result;
>  }
>  
> -static void *host_int_ParseJoinBssParam(struct network_info 
> *ptstrNetworkInfo)
> +static void *host_int_parse_join_bss_param(struct network_info *info)
>  {
> - struct join_bss_param *pNewJoinBssParam = NULL;
> - u8 *pu8IEs;
> - u16 u16IEsLen;
> + struct join_bss_param *param = NULL;
> + u8 *ies;
> + u16 ies_len;
>   u16 index = 0;
> - u8 suppRatesNo = 0;
> - u8 extSuppRatesNo;
> - u16 jumpOffset;
> - u8 pcipherCount;
> - u8 authCount;
> - u8 pcipherTotalCount = 0;
> - u8 authTotalCount = 0;
> + u8 rates_no = 0;
> + u8 ext_rates_no;
> + u16 offset;
> + u8 pcipher_cnt;
> + u8 auth_cnt;
> + u8 pcipher_total_cnt = 0;
> + u8 auth_total_cnt = 0;
>   u8 i, j;
>  
> - pu8IEs = ptstrNetworkInfo->ies;
> - u16IEsLen = ptstrNetworkInfo->ies_len;
> -
> - pNewJoinBssParam = kzalloc(sizeof(*pNewJoinBssParam), GFP_KERNEL);
> - if (pNewJoinBssParam) {
> - pNewJoinBssParam->dtim_period = ptstrNetworkInfo->dtim_period;
> - pNewJoinBssParam->beacon_period = 
> ptstrNetworkInfo->beacon_period;
> - pNewJoinBssParam->cap_info = ptstrNetworkInfo->cap_info;
> - memcpy(pNewJoinBssParam->bssid, ptstrNetworkInfo->bssid, 6);
> - memcpy((u8 *)pNewJoinBssParam->ssid, ptstrNetworkInfo->ssid,
> -ptstrNetworkInfo->ssid_len + 1);
> - pNewJoinBssParam->ssid_len = ptstrNetworkInfo->ssid_len;
> - memset(pNewJoinBssParam->rsn_pcip_policy, 0xFF, 3);
> - memset(pNewJoinBssParam->rsn_auth_policy, 0xFF, 3);
> -
> - while (index < u16IEsLen) {
> - if (pu8IEs[index] == SUPP_RATES_IE) {
> - suppRatesNo = pu8IEs[index + 1];
> - pNewJoinBssParam->supp_rates[0] = suppRatesNo;
> + ies = info->ies;
> + ies_len = info->ies_len;
> +
> + param = kzalloc(sizeof(*param), GFP_KERNEL);
> + if (param) {
> + param->dtim_period = info->dtim_period;
> + param->beacon_period = info->beacon_period;
> + param->cap_info = info->cap_info;
> + memcpy(param->bssid, info->bssid, 6);
> + memcpy((u8 *)param->ssid, info->ssid,
> +info->ssid_len + 1);
> + param->ssid_len = info->ssid_len;
> + memset(param->rsn_pcip_policy, 0xFF, 3);
> + memset(param->rsn_auth_policy, 0xFF, 3);
> +
> + while (index < ies_len) {
> + if (ies[index] == SUPP_RATES_IE) {
> + rates_no = ies[index + 1];
> + param->supp_rates[0] = rates_no;
>   index += 2;
>  
> - for (i = 0; i < suppRatesNo; i++)
> - pNewJoinBssParam->supp_rates[i + 1] = 
> pu8IEs[index + i];
> + for (i = 0; i < rates_no; i++)
> + param->supp_rates[i + 1] = ies[index + 
> i];
>  
> - 

Re: [PATCH v2 00/14] fix to remove unnecessary parenthesis,typedef and avoid camelCase

2018-01-22 Thread Claudiu Beznea


On 22.01.2018 12:22, Ajay Singh wrote:
> This patch series contains changes to fix issues reported by checkpatch.pl 
> script.
> 
> Changes since v1:
> * Patch0004: Used "host_int_parse_join_bss_param" for function name.
> * Patch0009: Put memcpy statement in single line instead of using two lines.
> * Patch0010: Used "bss_param" for variable name instead of j_bss_param.
> * Added "Reviewed-by: Claudiu Beznea " for 
> commit description.
> * Modify the commit description to start with capital letter for all patch.
You forgot to do it for patches 3 and 8.
> 
> 
> Ajay Singh (14):
>   staging: wilc1000: remove unnecessary use of parentheses
>   staging: wilc1000: removed unnecessary defined enums typedef
>   staging: wilc1000: fix alignments to match open parenthesis
>   staging: wilc1000: rename host_int_ParseJoinBssParam() and it's
> variable using camelCase
>   staging: wilc1000: rename camelCase used in Handle_DelAllSta() and its
> variable
>   staging: wilc1000: rename strWIDList variable to wid_list to avoid
> camelCase
>   staging: wilc1000: rename u32WidsCount variable to avoid camelCase
>   staging: wilc1000: rename pu8CurrByte variable to avoid camelCase
>   staging: wilc1000: rename pstrHostIFconnectAttr argument to avoid
> camelCase
>   staging: wilc1000: rename ptstrJoinBssParam variable to avoid
> camelCase
>   staging: wilc1000: rename strConnectInfo variable to avoid camelCase
>   staging: wilc1000: rename Handle_ScanDone() to avoid camelCase
>   staging: wilc1000: rename Handle_Connect() to avoid camelCase
>   staging: wilc1000: rename Handle_ConnectTimeout() and Handle_Key()
> 
>  drivers/staging/wilc1000/coreconfigurator.c   |   2 +-
>  drivers/staging/wilc1000/host_interface.c | 937 
> +++---
>  drivers/staging/wilc1000/linux_wlan.c |  10 +-
>  drivers/staging/wilc1000/wilc_sdio.c  |   4 +-
>  drivers/staging/wilc1000/wilc_spi.c   |  20 +-
>  drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  64 +-
>  drivers/staging/wilc1000/wilc_wlan.c  |   2 +-
>  drivers/staging/wilc1000/wilc_wlan_cfg.c  |   6 +-
>  drivers/staging/wilc1000/wilc_wlan_if.h   |  72 +-
>  9 files changed, 555 insertions(+), 562 deletions(-)
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 00/14] fix to remove unnecessary parenthesis,typedef and avoid camelCase

2018-01-22 Thread Claudiu Beznea


On 22.01.2018 13:10, Claudiu Beznea wrote:
> 
> 
> On 22.01.2018 12:22, Ajay Singh wrote:
>> This patch series contains changes to fix issues reported by checkpatch.pl 
>> script.
>>
>> Changes since v1:
>> * Patch0004: Used "host_int_parse_join_bss_param" for function name.
>> * Patch0009: Put memcpy statement in single line instead of using two lines.
>> * Patch0010: Used "bss_param" for variable name instead of j_bss_param.
>> * Added "Reviewed-by: Claudiu Beznea " for 
>> commit description.
>> * Modify the commit description to start with capital letter for all patch.
> You forgot to do it for patches 3 and 8.
Also, for 7.
>>
>>
>> Ajay Singh (14):
>>   staging: wilc1000: remove unnecessary use of parentheses
>>   staging: wilc1000: removed unnecessary defined enums typedef
>>   staging: wilc1000: fix alignments to match open parenthesis
>>   staging: wilc1000: rename host_int_ParseJoinBssParam() and it's
>> variable using camelCase
>>   staging: wilc1000: rename camelCase used in Handle_DelAllSta() and its
>> variable
>>   staging: wilc1000: rename strWIDList variable to wid_list to avoid
>> camelCase
>>   staging: wilc1000: rename u32WidsCount variable to avoid camelCase
>>   staging: wilc1000: rename pu8CurrByte variable to avoid camelCase
>>   staging: wilc1000: rename pstrHostIFconnectAttr argument to avoid
>> camelCase
>>   staging: wilc1000: rename ptstrJoinBssParam variable to avoid
>> camelCase
>>   staging: wilc1000: rename strConnectInfo variable to avoid camelCase
>>   staging: wilc1000: rename Handle_ScanDone() to avoid camelCase
>>   staging: wilc1000: rename Handle_Connect() to avoid camelCase
>>   staging: wilc1000: rename Handle_ConnectTimeout() and Handle_Key()
>>
>>  drivers/staging/wilc1000/coreconfigurator.c   |   2 +-
>>  drivers/staging/wilc1000/host_interface.c | 937 
>> +++---
>>  drivers/staging/wilc1000/linux_wlan.c |  10 +-
>>  drivers/staging/wilc1000/wilc_sdio.c  |   4 +-
>>  drivers/staging/wilc1000/wilc_spi.c   |  20 +-
>>  drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  64 +-
>>  drivers/staging/wilc1000/wilc_wlan.c  |   2 +-
>>  drivers/staging/wilc1000/wilc_wlan_cfg.c  |   6 +-
>>  drivers/staging/wilc1000/wilc_wlan_if.h   |  72 +-
>>  9 files changed, 555 insertions(+), 562 deletions(-)
>>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 02/14] staging: wilc1000: removed unnecessary defined enums typedef

2018-01-22 Thread Claudiu Beznea


On 22.01.2018 12:22, Ajay Singh wrote:
> Fix the "do not add new typedefs" issue found by checkpatch.pl
> script
> 
>From 
>https://www.kernel.org/doc/html/latest/process/submitting-patches.html#the-canonical-patch-format
the the message body line is wrapped at 75 columns.


> Signed-off-by: Ajay Singh 
> Reviewed-by: Claudiu Beznea 
> ---
>  drivers/staging/wilc1000/wilc_wlan_if.h | 72 
> -
>  1 file changed, 36 insertions(+), 36 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h 
> b/drivers/staging/wilc1000/wilc_wlan_if.h
> index 1641ddb..e186509 100644
> --- a/drivers/staging/wilc1000/wilc_wlan_if.h
> +++ b/drivers/staging/wilc1000/wilc_wlan_if.h
> @@ -114,28 +114,28 @@ enum {
>   G_MIXED_11B_2_MODE, /* 1,2,5,11,6,12,24 otherwise all on */
>  };
>  
> -typedef enum {
> +enum {
>   G_SHORT_PREAMBLE= 0,/* Short Preamble */
>   G_LONG_PREAMBLE = 1,/* Long Preamble */
>   G_AUTO_PREAMBLE = 2,/* Auto Preamble Selection */
> -} G_PREAMBLE_T;
> +};
>  
>  #define MAC_CONNECTED1
>  #define MAC_DISCONNECTED 0
>  
>  #define SCAN_DONETRUE
> -typedef enum {
> +enum {
>   PASSIVE_SCAN= 0,
>   ACTIVE_SCAN = 1,
> -} SCANTYPE_T;
> +};
>  
> -typedef enum {
> +enum {
>   NO_POWERSAVE= 0,
>   MIN_FAST_PS = 1,
>   MAX_FAST_PS = 2,
>   MIN_PSPOLL_PS   = 3,
>   MAX_PSPOLL_PS   = 4
> -} USER_PS_MODE_T;
> +};
>  
>  enum chip_ps_states {
>   CHIP_WAKEDUP= 0,
> @@ -153,7 +153,7 @@ enum bus_release {
>   RELEASE_ALLOW_SLEEP = 1,
>  };
>  
> -typedef enum {
> +enum {
>   NO_SECURITY = 0,
>   WEP_40  = 0x3,
>   WEP_104 = 0x7,
> @@ -163,7 +163,7 @@ typedef enum {
>   WPA2_AES= 0x31,
>   WPA2_TKIP   = 0x51,
>   WPA2_AES_TKIP   = 0x71, /* Aes or Tkip */
> -} SECURITY_T;
> +};
>  
>  enum AUTHTYPE {
>   OPEN_SYSTEM = 1,
> @@ -178,88 +178,88 @@ enum SITESURVEY {
>   SITE_SURVEY_OFF = 2
>  };
>  
> -typedef enum {
> +enum {
>   NORMAL_ACK  = 0,
>   NO_ACK,
> -} ACK_POLICY_T;
> +};
>  
> -typedef enum {
> +enum {
>   DONT_RESET  = 0,
>   DO_RESET= 1,
>   NO_REQUEST  = 2,
> -} RESET_REQ_T;
> +};
>  
> -typedef enum {
> +enum {
>   REKEY_DISABLE   = 1,
>   REKEY_TIME_BASE,
>   REKEY_PKT_BASE,
>   REKEY_TIME_PKT_BASE
> -} RSNA_REKEY_POLICY_T;
> +};
>  
> -typedef enum {
> +enum {
>   FILTER_NO   = 0x00,
>   FILTER_AP_ONLY  = 0x01,
>   FILTER_STA_ONLY = 0x02
> -} SCAN_CLASS_FITLER_T;
> +};
>  
> -typedef enum {
> +enum {
>   PRI_HIGH_RSSI   = 0x00,
>   PRI_LOW_RSSI= 0x04,
>   PRI_DETECT  = 0x08
> -} SCAN_PRI_T;
> +};
>  
> -typedef enum {
> +enum {
>   CH_FILTER_OFF   = 0x00,
>   CH_FILTER_ON= 0x10
> -} CH_FILTER_T;
> +};
>  
> -typedef enum {
> +enum {
>   AUTO_PROT   = 0,/* Auto */
>   NO_PROT,/* Do not use any protection */
>   ERP_PROT,   /* Protect all ERP frame exchanges */
>   HT_PROT,/* Protect all HT frame exchanges  */
>   GF_PROT,/* Protect all GF frame exchanges  */
> -} N_PROTECTION_MODE_T;
> +};
>  
> -typedef enum {
> +enum {
>   G_SELF_CTS_PROT,
>   G_RTS_CTS_PROT,
> -} G_PROTECTION_MODE_T;
> +};
>  
> -typedef enum {
> +enum {
>   HT_MIXED_MODE   = 1,
>   HT_ONLY_20MHZ_MODE,
>   HT_ONLY_20_40MHZ_MODE,
> -} N_OPERATING_MODE_T;
> +};
>  
> -typedef enum {
> +enum {
>   NO_DETECT   = 0,
>   DETECT_ONLY = 1,
>   DETECT_PROTECT  = 2,
>   DETECT_PROTECT_REPORT   = 3,
> -} N_OBSS_DETECTION_T;
> +};
>  
> -typedef enum {
> +enum {
>   RTS_CTS_NONHT_PROT  = 0,/* RTS-CTS at non-HT rate */
>   FIRST_FRAME_NONHT_PROT, /* First frame at non-HT rate */
>   LSIG_TXOP_PROT, /* LSIG TXOP Protection */
>   FIRST_FRAME_MIXED_PROT, /* First frame at Mixed format */
> -} N_PROTECTION_TYPE_T;
> +};
>  
> -typedef enum {
> +enum {
>   STATIC_MODE = 1,
>   DYNAMIC_MODE= 2,
>   MIMO_MODE   = 3,/* power save disable */
> -} N_SMPS_MODE_T;
> +};
>  
> -typedef enum {
> +enum {
>   DISABLE_SELF_CTS,
>   ENABLE_SELF_CTS,
>   DISABLE_TX_ABORT,
>   ENABLE_TX_ABORT,
>   HW_TRIGGER_ABORT,
>   SW_TRIGGER_ABORT,
> -} TX_ABORT_OPTION_T;
> +};
>  
>  enum wid_type {
>   WID_CHAR= 0,
> @@ -281,7 +281,7 @@ struct wid {
>   s8 *val;
>  };
>  
> -typedef enum {
> +enum {
>   WID_NIL 

Re: [PATCH v2 13/14] staging: wilc1000: rename Handle_Connect() to avoid camelCase

2018-01-22 Thread Claudiu Beznea


On 22.01.2018 12:22, Ajay Singh wrote:
> Fix "Avoid camelcase" issue found by checkpatch.pl
> script.
> 
Same here as in patch 02 of this series.

> Signed-off-by: Ajay Singh 
> Reviewed-by: Claudiu Beznea 
> ---
>  drivers/staging/wilc1000/host_interface.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/host_interface.c 
> b/drivers/staging/wilc1000/host_interface.c
> index b34243c..6e462db 100644
> --- a/drivers/staging/wilc1000/host_interface.c
> +++ b/drivers/staging/wilc1000/host_interface.c
> @@ -902,7 +902,7 @@ static s32 handle_scan_done(struct wilc_vif *vif,
>  }
>  
>  u8 wilc_connected_ssid[6] = {0};
> -static s32 Handle_Connect(struct wilc_vif *vif,
> +static s32 handle_connect(struct wilc_vif *vif,
> struct connect_attr *attr)
>  {
>   s32 result = 0;
> @@ -2491,7 +2491,7 @@ static void host_if_work(struct work_struct *work)
>   break;
>  
>   case HOST_IF_MSG_CONNECT:
> - Handle_Connect(msg->vif, &msg->body.con_info);
> + handle_connect(msg->vif, &msg->body.con_info);
>   break;
>  
>   case HOST_IF_MSG_RCVD_NTWRK_INFO:
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 02/14] staging: wilc1000: removed unnecessary defined enums typedef

2018-01-22 Thread Dan Carpenter
On Mon, Jan 22, 2018 at 01:06:59PM +0200, Claudiu Beznea wrote:
> 
> 
> On 22.01.2018 12:22, Ajay Singh wrote:
> > Fix the "do not add new typedefs" issue found by checkpatch.pl
> > script
> > 
> >From 
> >https://www.kernel.org/doc/html/latest/process/submitting-patches.html#the-canonical-patch-format
> the the message body line is wrapped at 75 columns.
> 

I normally consider 75 characters a maximum.  I wrap at 72 characters
like a normal email.

If we get too hung up on procedures for their own sake then it makes
sending patches a real pain.  There are some people I just don't send
patches to because they are too much headache to deal with.

regards,
dan carpenter

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


Re: [PATCH v2 02/14] staging: wilc1000: removed unnecessary defined enums typedef

2018-01-22 Thread Claudiu Beznea


On 22.01.2018 13:22, Dan Carpenter wrote:
> On Mon, Jan 22, 2018 at 01:06:59PM +0200, Claudiu Beznea wrote:
>>
>>
>> On 22.01.2018 12:22, Ajay Singh wrote:
>>> Fix the "do not add new typedefs" issue found by checkpatch.pl
>>> script
>>>
>> >From 
>> >https://www.kernel.org/doc/html/latest/process/submitting-patches.html#the-canonical-patch-format
>> the the message body line is wrapped at 75 columns.
>>
> 
> I normally consider 75 characters a maximum.  I wrap at 72 characters
> like a normal email.
> 
> If we get too hung up on procedures for their own sake then it makes
> sending patches a real pain.
I agree with you. This is not my intention even it may look this way with
my previous comments. Was just a note. My bad, next time I'll have to
specify this.

Thank you,
Claudiu Beznea  

There are some people I just don't send
> patches to because they are too much headache to deal with.> 
> regards,
> dan carpenter
> 
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 00/14] fix to remove unnecessary parenthesis,typedef and avoid camelCase

2018-01-22 Thread Claudiu Beznea
My comments to this series were only notes to be taken
into account for future patches.

Thank you,
Claudiu Beznea

On 22.01.2018 12:22, Ajay Singh wrote:
> This patch series contains changes to fix issues reported by checkpatch.pl 
> script.
> 
> Changes since v1:
> * Patch0004: Used "host_int_parse_join_bss_param" for function name.
> * Patch0009: Put memcpy statement in single line instead of using two lines.
> * Patch0010: Used "bss_param" for variable name instead of j_bss_param.
> * Added "Reviewed-by: Claudiu Beznea " for 
> commit description.
> * Modify the commit description to start with capital letter for all patch.
> 
> 
> Ajay Singh (14):
>   staging: wilc1000: remove unnecessary use of parentheses
>   staging: wilc1000: removed unnecessary defined enums typedef
>   staging: wilc1000: fix alignments to match open parenthesis
>   staging: wilc1000: rename host_int_ParseJoinBssParam() and it's
> variable using camelCase
>   staging: wilc1000: rename camelCase used in Handle_DelAllSta() and its
> variable
>   staging: wilc1000: rename strWIDList variable to wid_list to avoid
> camelCase
>   staging: wilc1000: rename u32WidsCount variable to avoid camelCase
>   staging: wilc1000: rename pu8CurrByte variable to avoid camelCase
>   staging: wilc1000: rename pstrHostIFconnectAttr argument to avoid
> camelCase
>   staging: wilc1000: rename ptstrJoinBssParam variable to avoid
> camelCase
>   staging: wilc1000: rename strConnectInfo variable to avoid camelCase
>   staging: wilc1000: rename Handle_ScanDone() to avoid camelCase
>   staging: wilc1000: rename Handle_Connect() to avoid camelCase
>   staging: wilc1000: rename Handle_ConnectTimeout() and Handle_Key()
> 
>  drivers/staging/wilc1000/coreconfigurator.c   |   2 +-
>  drivers/staging/wilc1000/host_interface.c | 937 
> +++---
>  drivers/staging/wilc1000/linux_wlan.c |  10 +-
>  drivers/staging/wilc1000/wilc_sdio.c  |   4 +-
>  drivers/staging/wilc1000/wilc_spi.c   |  20 +-
>  drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  64 +-
>  drivers/staging/wilc1000/wilc_wlan.c  |   2 +-
>  drivers/staging/wilc1000/wilc_wlan_cfg.c  |   6 +-
>  drivers/staging/wilc1000/wilc_wlan_if.h   |  72 +-
>  9 files changed, 555 insertions(+), 562 deletions(-)
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 3/7] x86/hyper-v: reenlightenment notifications support

2018-01-22 Thread Vitaly Kuznetsov
"Michael Kelley (EOSG)"  writes:

> On Fri, 19 Jan 2018, Thomas Gleixner wrote:
>
>> -Original Message-
>> From: Thomas Gleixner [mailto:t...@linutronix.de]
>> Sent: Friday, January 19, 2018 11:48 PM
>> To: Vitaly Kuznetsov 
>> Cc: kbuild test robot ; kbuild-...@01.org; 
>> k...@vger.kernel.org;
>> x...@kernel.org; Stephen Hemminger ; Radim Krčmář
>> ; Haiyang Zhang ; linux-
>> ker...@vger.kernel.org; de...@linuxdriverproject.org; Michael Kelley (EOSG)
>> ; Ingo Molnar ; Roman Kagan
>> ; Andy Lutomirski ; H. Peter Anvin
>> ; Paolo Bonzini ; Mohammed Gamal
>> 
>> Subject: Re: [PATCH v3 3/7] x86/hyper-v: reenlightenment notifications 
>> support
>> 
>> On Fri, 19 Jan 2018, Vitaly Kuznetsov wrote:
>> > kbuild test robot  writes:
>> >
>> > > Hi Vitaly,
>> > >
>> > > Thank you for the patch! Perhaps something to improve:
>> > >
>> > > [auto build test WARNING on tip/auto-latest]
>> > > [also build test WARNING on v4.15-rc8 next-20180118]
>> > > [cannot apply to tip/x86/core kvm/linux-next]
>> > > [if your patch is applied to the wrong git tree, please drop us a note 
>> > > to help improve the
>> system]
>> > >
>> > > url:
>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-
>> ci%2Flinux%2Fcommits%2FVitaly-Kuznetsov%2Fx86-kvm-hyperv-stable-clocksorce-for-L2-
>> guests-when-running-nested-KVM-on-Hyper-V%2F20180119-
>> 160814&data=02%7C01%7CMichael.H.Kelley%40microsoft.com%7Ce95c66107da6446826830
>> 8d55fda2c2b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636520313062777623&s
>> data=kAXl3mLVUdJi%2BsB4Ub0fmUHQfl6NuUDjW%2FAY9%2BFLZE4%3D&reserved=0
>> > > config: x86_64-allmodconfig (attached as .config)
>> > > compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
>> > > reproduce:
>> > > # save the attached .config to linux build tree
>> > > make ARCH=x86_64
>> > >
>> > > All warnings (new ones prefixed by >>):
>> > >
>> > >In file included from include/linux/kasan.h:17:0,
>> > > from include/linux/slab.h:129,
>> > > from include/linux/irq.h:26,
>> > > from arch/x86/include/asm/hardirq.h:6,
>> > > from include/linux/hardirq.h:9,
>> > > from include/linux/interrupt.h:13,
>> > > from arch/x86/include/asm/mshyperv.h:8,
>> > > from 
>> > > arch/x86//entry/vdso/vdso32/../vclock_gettime.c:20,
>> > > from arch/x86//entry/vdso/vdso32/vclock_gettime.c:33:
>> > >arch/x86/include/asm/pgtable.h: In function 'clone_pgd_range':
>> > >arch/x86/include/asm/pgtable.h:1129:9: error: implicit declaration of 
>> > > function
>> 'kernel_to_user_pgdp'; did you mean 'u64_to_user_ptr'? 
>> [-Werror=implicit-function-
>> declaration]
>> > >  memcpy(kernel_to_user_pgdp(dst), kernel_to_user_pgdp(src),
>> > > ^~~
>> >
>> > Sorry but I'm failing to see how this (and all the rest) is related to
>> > my patch ...
>> 
>> You added '#include ' to mshyperv.h which is included in
>> vclock_gettime.c and pulls in other stuff which fails to expand
>
> Is the declaration of hyperv_reenlightenment_intr() even needed in
> mshyperv.h?  The '#include ' is there for the __irq_entry
> annotation on that declaration.   There's a declaration of the parallel (and
> unannotated) hyperv_vector_handler(), but that looks like a fossil that
> isn't needed either.
>

True,

the only need for the declaration in mshyperv.h is to silence "warning:
no previous prototype for ‘hyperv_reenlightenment_intr’"; I'm not sure
if this actually needs fixing.

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


[PATCH] staging: rtl8192u: remove redundant initialization of 'timeout'

2018-01-22 Thread Colin King
From: Colin Ian King 

Variable timeout is initialized however this value is never read and
it is reassigned a new value a little later, hence the initialization
is redundant and can be removed.

Cleans up clang warning:
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:1728:6: warning:
Value stored to 'timeout' during its initialization is never read

Signed-off-by: Colin Ian King 
---
 drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
index f56fdc7a4b61..25c186a8bde3 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
@@ -1725,7 +1725,7 @@ static void ieee80211_sta_ps_send_null_frame(struct 
ieee80211_device *ieee,
 static short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h,
u32 *time_l)
 {
-   int timeout = ieee->ps_timeout;
+   int timeout;
u8 dtim;
/*if(ieee->ps == IEEE80211_PS_DISABLED ||
ieee->iw_mode != IW_MODE_INFRA ||
-- 
2.15.1

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


Re: [PATCH-next] hal_com_phycfg: Remove unneeded semicolons

2018-01-22 Thread Greg KH
On Wed, Jan 17, 2018 at 08:29:21PM -0500, Christopher Díaz Riveros wrote:
> Trivial fix removes unneeded semicolons after switch blocks.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Christopher Díaz Riveros 
> ---
>  drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 16 +++-
>  1 file changed, 7 insertions(+), 9 deletions(-)

In the future the subject line should say the subsystem and driver, so I
know what to be looking for here.  As an example, this patch should say:

Subject: [PATCH] staging: rtl8723bs: hal_com_phycfg: Remove unneeded semicolons

No need to say -next in there either, that's assumed :)

I'll edit this by hand this time, but please fix up for the future
patches you send.

thanks,

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


Re: [PATCH-next] hal_com_phycfg: Remove unneeded semicolons

2018-01-22 Thread Christopher Díaz Riveros
El lun, 22-01-2018 a las 17:03 +0100, Greg KH escribió:
> On Wed, Jan 17, 2018 at 08:29:21PM -0500, Christopher Díaz Riveros
> wrote:
> > Trivial fix removes unneeded semicolons after switch blocks.
> > 
> > This issue was detected by using the Coccinelle software.
> > 
> > Signed-off-by: Christopher Díaz Riveros 
> > ---
> >  drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 16 +++---
> > --
> >  1 file changed, 7 insertions(+), 9 deletions(-)
> 
> In the future the subject line should say the subsystem and driver,
> so I
> know what to be looking for here.  As an example, this patch should
> say:
> 
> Subject: [PATCH] staging: rtl8723bs: hal_com_phycfg: Remove unneeded
> semicolons
> 
> No need to say -next in there either, that's assumed :)
> 
> I'll edit this by hand this time, but please fix up for the future
> patches you send.
> 
> thanks,
> 
Thank you Greg, I'm still learning the process, but I'll do it better
next time. :)
-- 
Christopher Díaz Riveros
Gentoo Linux Developer
GPG Fingerprint: E517 5ECB 8152 98E4 FEBC  2BAA 4DBB D10F 0FDD 2547

signature.asc
Description: This is a digitally signed message part
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: android: ion: Zero CMA allocated memory

2018-01-22 Thread Liam Mark
On Fri, 19 Jan 2018, Dan Carpenter wrote:

> On Fri, Jan 19, 2018 at 11:16:47AM -0800, Liam Mark wrote:
> > Since the CMA API is now used directly the allocated memory is no longer
> > automatically zeroed.
> > 
> > Explicitly zero CMA allocated memory to ensure that no data is exposed
> > to userspace.
> > 
> > Change-Id: I08e143707a0d31610821a7f16826c262bf3c1999
> 
> How do I use this Gerrit tag?  I type it into
> https://android-review.googlesource.com/ somewhere?

Sorry, this tag won’t be any use to you, I will strip it out.

Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: android: ion: Zero CMA allocated memory

2018-01-22 Thread Liam Mark
On Sat, 20 Jan 2018, Greg KH wrote:

> On Fri, Jan 19, 2018 at 11:16:47AM -0800, Liam Mark wrote:
> > Since the CMA API is now used directly the allocated memory is no longer
> > automatically zeroed.
> > 
> > Explicitly zero CMA allocated memory to ensure that no data is exposed
> > to userspace.
> 
> How far back does this patch need to be ported?  What is the git commit
> id that caused this change to be needed?  Please add it as a "Fixes:"
> tag to the patch.
> 

It goes back to 204f672255c2 ("ion: Use CMA APIs directly"), I will update 
the change.

> > 
> > Change-Id: I08e143707a0d31610821a7f16826c262bf3c1999
> 
> I'm guessing you didn't run scripts/checkpatch.pl on this patch :(
> 
> Please fix up and resend.

Thanks, I will clean it up.

Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging: android: ion: Zero CMA allocated memory

2018-01-22 Thread Liam Mark
Since commit 204f672255c2 ("staging: android: ion: Use CMA APIs directly")
the CMA API is now used directly and therefore the allocated memory is no
longer automatically zeroed.

Explicitly zero CMA allocated memory to ensure that no data is exposed to
userspace.

Fixes: 204f672255c2 ("staging: android: ion: Use CMA APIs directly")
Signed-off-by: Liam Mark 
---
Changes in v2:
  - Clean up the commit message.
  - Add 'Fixes:'

 drivers/staging/android/ion/ion_cma_heap.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/android/ion/ion_cma_heap.c 
b/drivers/staging/android/ion/ion_cma_heap.c
index 86196ffd2faf..91a98785607a 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -51,6 +51,8 @@ static int ion_cma_allocate(struct ion_heap *heap, struct 
ion_buffer *buffer,
if (!pages)
return -ENOMEM;
 
+   memset(page_address(pages), 0, size);
+
table = kmalloc(sizeof(*table), GFP_KERNEL);
if (!table)
goto err;
-- 
1.8.5.2


Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: sm750fb: fix CamelCase for dispSet var

2018-01-22 Thread Petr Sedlak
Fix warning reported by checkpatch:

  CHECK: Avoid CamelCase: 

By renaming dispSet to disp_set

Signed-off-by: Petr Sedlak 
---
 drivers/staging/sm750fb/sm750_hw.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750_hw.c 
b/drivers/staging/sm750fb/sm750_hw.c
index ffd114a..a8c7986 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -185,29 +185,29 @@ int hw_sm750_output_setMode(struct lynxfb_output *output,
struct fb_fix_screeninfo *fix)
 {
int ret;
-   disp_output_t dispSet;
+   disp_output_t disp_set;
int channel;
 
ret = 0;
-   dispSet = 0;
+   disp_set = 0;
channel = *output->channel;
 
if (sm750_get_chip_type() != SM750LE) {
if (channel == sm750_primary) {
pr_info("primary channel\n");
if (output->paths & sm750_panel)
-   dispSet |= do_LCD1_PRI;
+   disp_set |= do_LCD1_PRI;
if (output->paths & sm750_crt)
-   dispSet |= do_CRT_PRI;
+   disp_set |= do_CRT_PRI;
 
} else {
pr_info("secondary channel\n");
if (output->paths & sm750_panel)
-   dispSet |= do_LCD1_SEC;
+   disp_set |= do_LCD1_SEC;
if (output->paths & sm750_crt)
-   dispSet |= do_CRT_SEC;
+   disp_set |= do_CRT_SEC;
}
-   ddk750_setLogicalDispOut(dispSet);
+   ddk750_setLogicalDispOut(disp_set);
} else {
/* just open DISPLAY_CONTROL_750LE register bit 3:0 */
u32 reg;
-- 
2.7.4

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


[PATCH] Staging: iio: ade7758: Expand buf_lock to cover both buffer

2018-01-22 Thread Shreeya Patel
iio_dev->mlock is to be used only by the IIO core for protecting
device mode changes between INDIO_DIRECT and INDIO_BUFFER.

This patch replaces the use of mlock with the already established
buf_lock mutex.

Introducing 'unlocked' __ade7758_spi_write_reg_8 and
__ade7758_spi_read_reg_8 functions to be used by ade7758_write_samp_freq
and ade7758_read_samp_freq which avoids nested locks and maintains
atomicity between bus and device frequency changes.

Signed-off-by: Shreeya Patel 
---
 drivers/staging/iio/meter/ade7758.h  |  2 +-
 drivers/staging/iio/meter/ade7758_core.c | 49 +++-
 2 files changed, 37 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/iio/meter/ade7758.h 
b/drivers/staging/iio/meter/ade7758.h
index 6ae78d8..2de81b5 100644
--- a/drivers/staging/iio/meter/ade7758.h
+++ b/drivers/staging/iio/meter/ade7758.h
@@ -111,7 +111,7 @@
  * @trig:  data ready trigger registered with iio
  * @tx:transmit buffer
  * @rx:receive buffer
- * @buf_lock:  mutex to protect tx and rx
+ * @buf_lock:  mutex to protect tx, rx, read and write frequency
  **/
 struct ade7758_state {
struct spi_device   *us;
diff --git a/drivers/staging/iio/meter/ade7758_core.c 
b/drivers/staging/iio/meter/ade7758_core.c
index 7b7ffe5..7f8f8c4 100644
--- a/drivers/staging/iio/meter/ade7758_core.c
+++ b/drivers/staging/iio/meter/ade7758_core.c
@@ -24,17 +24,26 @@
 #include "meter.h"
 #include "ade7758.h"
 
-int ade7758_spi_write_reg_8(struct device *dev, u8 reg_address, u8 val)
+/* Unlocked version of ade7758_spi_write_reg_8 function */
+int __ade7758_spi_write_reg_8(struct device *dev, u8 reg_address, u8 val)
 {
-   int ret;
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct ade7758_state *st = iio_priv(indio_dev);
 
-   mutex_lock(&st->buf_lock);
st->tx[0] = ADE7758_WRITE_REG(reg_address);
st->tx[1] = val;
 
-   ret = spi_write(st->us, st->tx, 2);
+   return spi_write(st->us, st->tx, 2);
+}
+
+int ade7758_spi_write_reg_8(struct device *dev, u8 reg_address, u8 val)
+{
+   int ret;
+   struct iio_dev *indio_dev = dev_to_iio_dev(dev);
+   struct ade7758_state *st = iio_priv(indio_dev);
+
+   mutex_lock(&st->buf_lock);
+   ret = __ade7758_spi_write_reg_8(dev, reg_address, val);
mutex_unlock(&st->buf_lock);
 
return ret;
@@ -91,7 +100,8 @@ static int ade7758_spi_write_reg_24(struct device *dev, u8 
reg_address,
return ret;
 }
 
-int ade7758_spi_read_reg_8(struct device *dev, u8 reg_address, u8 *val)
+/* Unlocked version of ade7758_spi_read_reg_16 function */
+int __ade7758_spi_read_reg_8(struct device *dev, u8 reg_address, u8 *val)
 {
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct ade7758_state *st = iio_priv(indio_dev);
@@ -111,7 +121,6 @@ int ade7758_spi_read_reg_8(struct device *dev, u8 
reg_address, u8 *val)
},
};
 
-   mutex_lock(&st->buf_lock);
st->tx[0] = ADE7758_READ_REG(reg_address);
st->tx[1] = 0;
 
@@ -124,7 +133,19 @@ int ade7758_spi_read_reg_8(struct device *dev, u8 
reg_address, u8 *val)
*val = st->rx[0];
 
 error_ret:
+   return ret;
+}
+
+int ade7758_spi_read_reg_8(struct device *dev, u8 reg_address, u8 *val)
+{
+   struct iio_dev *indio_dev = dev_to_iio_dev(dev);
+   struct ade7758_state *st = iio_priv(indio_dev);
+   int ret;
+
+   mutex_lock(&st->buf_lock);
+   ret = __ade7758_spi_read_reg_8(dev, reg_address, val);
mutex_unlock(&st->buf_lock);
+
return ret;
 }
 
@@ -470,7 +491,7 @@ static int ade7758_read_samp_freq(struct device *dev, int 
*val)
int ret;
u8 t;
 
-   ret = ade7758_spi_read_reg_8(dev, ADE7758_WAVMODE, &t);
+   ret = __ade7758_spi_read_reg_8(dev, ADE7758_WAVMODE, &t);
if (ret)
return ret;
 
@@ -503,14 +524,14 @@ static int ade7758_write_samp_freq(struct device *dev, 
int val)
goto out;
}
 
-   ret = ade7758_spi_read_reg_8(dev, ADE7758_WAVMODE, ®);
+   ret = __ade7758_spi_read_reg_8(dev, ADE7758_WAVMODE, ®);
if (ret)
goto out;
 
reg &= ~(5 << 3);
reg |= t << 5;
 
-   ret = ade7758_spi_write_reg_8(dev, ADE7758_WAVMODE, reg);
+   ret = __ade7758_spi_write_reg_8(dev, ADE7758_WAVMODE, reg);
 
 out:
return ret;
@@ -523,12 +544,13 @@ static int ade7758_read_raw(struct iio_dev *indio_dev,
long mask)
 {
int ret;
+   struct ade7758_state *st = iio_priv(indio_dev);
 
switch (mask) {
case IIO_CHAN_INFO_SAMP_FREQ:
-   mutex_lock(&indio_dev->mlock);
+   mutex_lock(&st->buf_lock);
ret = ade7758_read_samp_freq(&indio_dev->dev, val);
-   mutex_unlock(&indio_dev->mlock);
+   mutex_unlock(&st->buf_lock);
return ret;
 

Re: [PATCH net-next] hv_netvsc: Use the num_online_cpus() for channel limit

2018-01-22 Thread David Miller
From: Haiyang Zhang 
Date: Fri, 19 Jan 2018 13:26:43 -0700

> From: Haiyang Zhang 
> 
> Since we no longer localize channel/CPU affiliation within one NUMA
> node, num_online_cpus() is used as the number of channel cap, instead of
> the number of processors in a NUMA node.
> 
> This patch allows a bigger range for tuning the number of channels.
> 
> Signed-off-by: Haiyang Zhang 

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


[PATCH v2 char-misc 1/1] Drivers: hv: vmbus: Implement Direct Mode for stimer0

2018-01-22 Thread mikelley
From: Michael Kelley 

The 2016 version of Hyper-V offers the option to operate the guest VM
per-vcpu stimer's in Direct Mode, which means the timer interupts on its
own vector rather than queueing a VMbus message. Direct Mode reduces
timer processing overhead in both the hypervisor and the guest, and
avoids having timer interrupts pollute the VMbus interrupt stream for
the synthetic NIC and storage.  This patch enables Direct Mode by
default on stimer0 when running on a version of Hyper-V that supports it,
with a hv_vmbus module parameter for disabling Direct Mode and reverting
to the old behavior.

In prep for coming support of Hyper-V on ARM64, the arch independent
portion of the code contains calls to routines that will be populated
on ARM64 but are not needed and do nothing on x86.

Signed-off-by: Michael Kelley 
---
Changes since v1:
* Major rework to allocate and use a fixed interrupt vector
* Fixed block comment style
* Removed minor changes unrelated to Direct Mode

---
 arch/x86/entry/entry_32.S  |  3 ++
 arch/x86/entry/entry_64.S  |  2 ++
 arch/x86/include/asm/hardirq.h |  3 ++
 arch/x86/include/asm/irq_vectors.h |  7 +++-
 arch/x86/include/asm/mshyperv.h| 12 +++
 arch/x86/include/uapi/asm/hyperv.h |  3 ++
 arch/x86/kernel/cpu/mshyperv.c | 41 ++-
 arch/x86/kernel/irq.c  |  9 +
 drivers/hv/hv.c| 67 --
 drivers/hv/hyperv_vmbus.h  |  4 ++-
 10 files changed, 146 insertions(+), 5 deletions(-)

diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S
index ace8f32..1814991 100644
--- a/arch/x86/entry/entry_32.S
+++ b/arch/x86/entry/entry_32.S
@@ -882,6 +882,9 @@ BUILD_INTERRUPT3(xen_hvm_callback_vector, 
HYPERVISOR_CALLBACK_VECTOR,
 BUILD_INTERRUPT3(hyperv_callback_vector, HYPERVISOR_CALLBACK_VECTOR,
 hyperv_vector_handler)
 
+BUILD_INTERRUPT3(hv_stimer0_callback_vector, HYPERV_STIMER0_VECTOR,
+hv_stimer0_vector_handler)
+
 #endif /* CONFIG_HYPERV */
 
 ENTRY(page_fault)
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index f048e38..23afac9 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -1227,6 +1227,8 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
 #if IS_ENABLED(CONFIG_HYPERV)
 apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
hyperv_callback_vector hyperv_vector_handler
+apicinterrupt3 HYPERV_STIMER0_VECTOR \
+   hv_stimer0_callback_vector hv_stimer0_vector_handler
 #endif /* CONFIG_HYPERV */
 
 idtentry debug do_debughas_error_code=0
paranoid=1 shift_ist=DEBUG_STACK
diff --git a/arch/x86/include/asm/hardirq.h b/arch/x86/include/asm/hardirq.h
index 51cc979..c788343 100644
--- a/arch/x86/include/asm/hardirq.h
+++ b/arch/x86/include/asm/hardirq.h
@@ -38,6 +38,9 @@
 #if IS_ENABLED(CONFIG_HYPERV) || defined(CONFIG_XEN)
unsigned int irq_hv_callback_count;
 #endif
+#if IS_ENABLED(CONFIG_HYPERV)
+   unsigned int hyperv_stimer0_count;
+#endif
 } cacheline_aligned irq_cpustat_t;
 
 DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
diff --git a/arch/x86/include/asm/irq_vectors.h 
b/arch/x86/include/asm/irq_vectors.h
index 67421f6..6accf0b 100644
--- a/arch/x86/include/asm/irq_vectors.h
+++ b/arch/x86/include/asm/irq_vectors.h
@@ -103,7 +103,12 @@
 #endif
 
 #define MANAGED_IRQ_SHUTDOWN_VECTOR0xef
-#define LOCAL_TIMER_VECTOR 0xee
+
+#if IS_ENABLED(CONFIG_HYPERV)
+#define HYPERV_STIMER0_VECTOR  0xee
+#endif
+
+#define LOCAL_TIMER_VECTOR 0xed
 
 #define NR_VECTORS  256
 
diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index b623a42..aed9185 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -171,6 +171,18 @@ static inline void vmbus_signal_eom(struct hv_message 
*msg, u32 old_msg_type)
 void hv_setup_crash_handler(void (*handler)(struct pt_regs *regs));
 void hv_remove_crash_handler(void);
 
+/*
+ * Routines for stimer0 Direct Mode handling.
+ * On x86/x64, there are no percpu actions to take.
+ */
+void hv_stimer0_callback_vector(void);
+int hv_setup_stimer0_irq(int *irq, int *vector, void (*handler)(void));
+void hv_remove_stimer0_irq(int irq);
+
+static inline void hv_enable_stimer0_percpu_irq(int irq) {}
+static inline void hv_disable_stimer0_percpu_irq(int irq) {}
+
+
 #if IS_ENABLED(CONFIG_HYPERV)
 extern struct clocksource *hyperv_cs;
 extern void *hv_hypercall_pg;
diff --git a/arch/x86/include/uapi/asm/hyperv.h 
b/arch/x86/include/uapi/asm/hyperv.h
index 1a5bfea..7213cb8 100644
--- a/arch/x86/include/uapi/asm/hyperv.h
+++ b/arch/x86/include/uapi/asm/hyperv.h
@@ -74,6 +74,9 @@
 /* Crash MSR available */
 #define HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE (1 << 10)
 
+/* stimer Direct Mode is available */
+#define HV_X64_STIMER_DIRECT_MODE_AVAILABLE(1 << 19)
+
 /*
  * Feature identification: EBX indicat

[staging:staging-next 468/569] drivers/staging/lustre/lnet/selftest/module.c:125:47: error: 'struct cfs_cpt_table' has no member named 'ctb_parts'

2018-01-22 Thread kbuild test robot
Hi NeilBrown,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
staging-next
head:   9fb8b101a7529a7d882df16448f20c1879535f0b
commit: 6106c0f82481e686b337ee0c403821fb5c3c17ef [468/569] staging: lustre: 
lnet: convert selftest to use workqueues
config: i386-randconfig-sb0-01230733 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
git checkout 6106c0f82481e686b337ee0c403821fb5c3c17ef
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/staging/lustre/lnet/selftest/module.c: In function 
'lnet_selftest_init':
>> drivers/staging/lustre/lnet/selftest/module.c:125:47: error: 'struct 
>> cfs_cpt_table' has no member named 'ctb_parts'
  cpumask_copy(attrs.cpumask, lnet_cpt_table()->ctb_parts[i].cpt_cpumask);
  ^

vim +125 drivers/staging/lustre/lnet/selftest/module.c

87  
88  static int
89  lnet_selftest_init(void)
90  {
91  int nscheds;
92  int rc;
93  int i;
94  
95  lst_serial_wq = alloc_ordered_workqueue("lst_s", 0);
96  if (!lst_serial_wq) {
97  CERROR("Failed to create serial WI scheduler for 
LST\n");
98  return rc;
99  }
   100  lst_init_step = LST_INIT_WI_SERIAL;
   101  
   102  nscheds = cfs_cpt_number(lnet_cpt_table());
   103  lst_test_wq = kvmalloc_array(nscheds, sizeof(lst_test_wq[0]),
   104  GFP_KERNEL | __GFP_ZERO);
   105  if (!lst_test_wq)
   106  goto error;
   107  
   108  lst_init_step = LST_INIT_WI_TEST;
   109  for (i = 0; i < nscheds; i++) {
   110  int nthrs = cfs_cpt_weight(lnet_cpt_table(), i);
   111  struct workqueue_attrs attrs;
   112  
   113  /* reserve at least one CPU for LND */
   114  nthrs = max(nthrs - 1, 1);
   115  lst_test_wq[i] = alloc_workqueue("lst_t", WQ_UNBOUND, 
nthrs);
   116  if (!lst_test_wq[i]) {
   117  CWARN("Failed to create CPU partition affinity 
WI scheduler %d for LST\n",
   118i);
   119  goto error;
   120  }
   121  attrs.nice = 0;
   122  #ifdef CONFIG_CPUMASK_OFFSTACK
   123  attrs.cpumask = 
lnet_cpt_table()->ctb_parts[i].cpt_cpumask;
   124  #else
 > 125  cpumask_copy(attrs.cpumask, 
 > lnet_cpt_table()->ctb_parts[i].cpt_cpumask);
   126  #endif
   127  attrs.no_numa = false;
   128  apply_workqueue_attrs(lst_test_wq[i], &attrs);
   129  }
   130  
   131  rc = srpc_startup();
   132  if (rc) {
   133  CERROR("LST can't startup rpc\n");
   134  goto error;
   135  }
   136  lst_init_step = LST_INIT_RPC;
   137  
   138  rc = sfw_startup();
   139  if (rc) {
   140  CERROR("LST can't startup framework\n");
   141  goto error;
   142  }
   143  lst_init_step = LST_INIT_FW;
   144  
   145  rc = lstcon_console_init();
   146  if (rc) {
   147  CERROR("LST can't startup console\n");
   148  goto error;
   149  }
   150  lst_init_step = LST_INIT_CONSOLE;
   151  return 0;
   152  error:
   153  lnet_selftest_exit();
   154  return rc;
   155  }
   156  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Darlehen

2018-01-22 Thread defina
Benötigen Sie Privat- oder Geschäftskredite ohne Stress und schnelle 
Zustimmung? Wenn ja, kontaktieren Sie uns bitte alexgr...@gmail.com
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [bug report] staging: lustre: replace simple cases of LIBCFS_ALLOC with kzalloc.

2018-01-22 Thread NeilBrown
On Mon, Jan 15 2018, Dan Carpenter wrote:

> [  This code was already buggy, it's just that Neil's change made it
>show up in static analysis.  - dan ]

Thanks!

This bug was introduced by

 Commit: 4d99b2581eff ("staging: lustre: avoid intensive reconnecting for 
ko2iblnd")

which added a "free_conn" arg to kiblnd_destroy_conn(), but never used
the arg.  Presumably it is meant to say "Don't free something", but
exactly what should be free and what shouldn't isn't immediately clear.

Liang:  do you remember what you intended for that arg to do?

Thanks,
NeilBrown

>
> Hello NeilBrown,
>
> The patch 3c88bdbbf919: "staging: lustre: replace simple cases of
> LIBCFS_ALLOC with kzalloc." from Jan 9, 2018, leads to the following
> static checker warning:
>
>   drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:3323 
> kiblnd_connd()
>   error: dereferencing freed memory 'conn'
>
> drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
>   3303  if (!list_empty(&kiblnd_data.kib_connd_zombies)) {
>   3304  struct kib_peer *peer = NULL;
>   3305  
>   3306  conn = 
> list_entry(kiblnd_data.kib_connd_zombies.next,
>   3307struct kib_conn, ibc_list);
>   3308  list_del(&conn->ibc_list);
>   3309  if (conn->ibc_reconnect) {
>   3310  peer = conn->ibc_peer;
>   3311  kiblnd_peer_addref(peer);
>   3312  }
>   3313  
>   3314  spin_unlock_irqrestore(lock, flags);
>   3315  dropped_lock = 1;
>   3316  
>   3317  kiblnd_destroy_conn(conn, !peer);
> 
> Freed
>
>   3318  
>   3319  spin_lock_irqsave(lock, flags);
>   3320  if (!peer)
>   3321  continue;
>   3322  
>   3323  conn->ibc_peer = peer;
> ^^
> Use after free
>
>   3324  if (peer->ibp_reconnected < 
> KIB_RECONN_HIGH_RACE)
>   3325  list_add_tail(&conn->ibc_list,
>^^
>
>   3326
> &kiblnd_data.kib_reconn_list);
>   3327  else
>   3328  list_add_tail(&conn->ibc_list,
>^^
>
>   3329
> &kiblnd_data.kib_reconn_wait);
>   3330  }
>
> regards,
> dan carpenter


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