[PATCH] staging: typec: Fix sparse warnings about incorrect types

2017-05-09 Thread Guru Das Srinagesh
Fix the following sparse warnings about incorrect type usage:

tcpci.c:290:38: warning: incorrect type in argument 1 (different base types)
tcpci.c:290:38:expected unsigned short [unsigned] [usertype] header
tcpci.c:290:38:got restricted __le16 const [usertype] header
tcpci.c:295:16: warning: incorrect type in assignment (different base types)
tcpci.c:295:16:expected unsigned int [unsigned] header
tcpci.c:295:16:got restricted __le16
tcpci.c:393:28: warning: incorrect type in assignment (different base types)
tcpci.c:393:28:expected restricted __le16 [usertype] header
tcpci.c:393:28:got unsigned int [unsigned] [addressable] reg

fusb302.c:1028:32: warning: incorrect type in argument 1 (different base types)
fusb302.c:1028:32:expected unsigned short [unsigned] [usertype] header
fusb302.c:1028:32:got restricted __le16 const [usertype] header
fusb302.c:1484:32: warning: incorrect type in argument 1 (different base types)
fusb302.c:1484:32:expected unsigned short [unsigned] [usertype] header
fusb302.c:1484:32:got restricted __le16 [usertype] header

Signed-off-by: Guru Das Srinagesh 
---
 drivers/staging/typec/fusb302/fusb302.c | 4 ++--
 drivers/staging/typec/tcpci.c   | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/typec/fusb302/fusb302.c 
b/drivers/staging/typec/fusb302/fusb302.c
index 2cee9a9..9612ef1 100644
--- a/drivers/staging/typec/fusb302/fusb302.c
+++ b/drivers/staging/typec/fusb302/fusb302.c
@@ -1025,7 +1025,7 @@ static int fusb302_pd_send_message(struct fusb302_chip 
*chip,
buf[pos++] = FUSB302_TKN_SYNC1;
buf[pos++] = FUSB302_TKN_SYNC2;
 
-   len = pd_header_cnt(msg->header) * 4;
+   len = pd_header_cnt(le16_to_cpu(msg->header)) * 4;
/* plug 2 for header */
len += 2;
if (len > 0x1F) {
@@ -1481,7 +1481,7 @@ static int fusb302_pd_read_message(struct fusb302_chip 
*chip,
 (u8 *)>header);
if (ret < 0)
return ret;
-   len = pd_header_cnt(msg->header) * 4;
+   len = pd_header_cnt(le16_to_cpu(msg->header)) * 4;
/* add 4 to length to include the CRC */
if (len > PD_MAX_PAYLOAD * 4) {
fusb302_log(chip, "PD message too long %d", len);
diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c
index 5e5be74..d0c22a7 100644
--- a/drivers/staging/typec/tcpci.c
+++ b/drivers/staging/typec/tcpci.c
@@ -287,12 +287,12 @@ static int tcpci_pd_transmit(struct tcpc_dev *tcpc,
unsigned int reg, cnt, header;
int ret;
 
-   cnt = msg ? pd_header_cnt(msg->header) * 4 : 0;
+   cnt = msg ? pd_header_cnt(le16_to_cpu(msg->header)) * 4 : 0;
ret = regmap_write(tcpci->regmap, TCPC_TX_BYTE_CNT, cnt + 2);
if (ret < 0)
return ret;
 
-   header = msg ? msg->header : 0;
+   header = msg ? le16_to_cpu(msg->header) : 0;
ret = tcpci_write16(tcpci, TCPC_TX_HDR, header);
if (ret < 0)
return ret;
@@ -390,7 +390,7 @@ static irqreturn_t tcpci_irq(int irq, void *dev_id)
regmap_read(tcpci->regmap, TCPC_RX_BYTE_CNT, );
 
tcpci_read16(tcpci, TCPC_RX_HDR, );
-   msg.header = reg;
+   msg.header = cpu_to_le16(reg);
 
if (WARN_ON(cnt > sizeof(msg.payload)))
cnt = sizeof(msg.payload);
-- 
2.7.4

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


You have been nominated for the £2 million charity support

2017-05-09 Thread Barrister Bobby Smith
You have been nominated for the charity program to support Prince Alwaleed Bin 
Tala, please contact:
http://bit.do/23awsa
for more information.

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


You have been nominated for the £2 million charity support

2017-05-09 Thread Barrister Bobby Smith
You have been nominated for the charity program to support Prince Alwaleed Bin 
Tala, please contact:
http://bit.do/23awsa
for more information.

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


[PATCH] Staging: rtl8192u - changed include of asm/io.h

2017-05-09 Thread Derek Robson
Changed include of  to be 
Complies, but I don't have hardware.
Found using checkpatch.

Signed-off-by: Derek Robson 
---
 drivers/staging/rtl8192u/r8192U.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index e702afb5a70e..4c7a5e3d3e5e 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -34,7 +34,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include "ieee80211/ieee80211.h"
 
 #define RTL8192U
-- 
2.12.2

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


[PATCH] staging: android: ion: Resolve minor indentation issue.

2017-05-09 Thread Matthew Giassa
Resolving a minor checkpatch/indentation issue in ion_carveout_heap.c,
ie:
drivers/staging/android/ion/ion_carveout_heap.c
---
CHECK: Alignment should match open parenthesis
+static phys_addr_t ion_carveout_allocate(struct ion_heap *heap,
+unsigned long size)

Signed-off-by: Matthew Giassa 
---
 drivers/staging/android/ion/ion_carveout_heap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_carveout_heap.c 
b/drivers/staging/android/ion/ion_carveout_heap.c
index 5fdc1f3..fee7650 100644
--- a/drivers/staging/android/ion/ion_carveout_heap.c
+++ b/drivers/staging/android/ion/ion_carveout_heap.c
@@ -33,7 +33,7 @@ struct ion_carveout_heap {
 };
 
 static phys_addr_t ion_carveout_allocate(struct ion_heap *heap,
-unsigned long size)
+unsigned long size)
 {
struct ion_carveout_heap *carveout_heap =
container_of(heap, struct ion_carveout_heap, heap);
-- 
2.7.4

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


[PATCH] staging: rtl8188eu: Fix one coding style problem

2017-05-09 Thread Remco Verhoef
Fix code indent should use tabs where possible coding style
error.

Signed-off-by: Remco Verhoef 
---
 drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c 
b/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c
index d9fa290..636f445 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c
@@ -58,7 +58,7 @@ static void process_link_qual(struct adapter *padapter,
 }
 
 void rtl8188e_process_phy_info(struct adapter *padapter,
-  struct recv_frame *precvframe)
+   struct recv_frame *precvframe)
 {
/*  Check RSSI */
process_rssi(padapter, precvframe);
-- 
1.9.1

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


[PATCH v2 0/3] coding style warnings fixes

2017-05-09 Thread Harinath Nampally
This revised patchset is for improvement in [PATCH v2 1/3]
as per the code review comment from Dan Carpenter.

Other two patches [PATCH v2 2/3] and [PATCH v2 3/3] are unchanged,
so they are same as [PATCH 2/3] and [PATCH 3/3] respectively.

Please find the following related patches:
[PATCH v2 1/3] staging: iio: meter: Add the comment for mutex definition
[PATCH v2 2/3] staging: iio: meter: Fix the identations for proper alignments
[PATCH v2 3/3] staging: iio: meter: Replace symbolic permissions with octal 
permissions

Harinath Nampally (3):
  staging: iio: meter: Add the comment for mutex definition
  staging: iio: meter: Fix the identations for proper alignments
  staging: iio: meter: Replace symbolic permissions with octal
permissions 

 drivers/staging/iio/meter/ade7753.c | 104 ++--
 1 file changed, 51 insertions(+), 52 deletions(-)

-- 
2.7.4

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


[PATCH v2 3/3] staging: iio: meter: Replace symbolic permissions with octal permissions.

2017-05-09 Thread Harinath Nampally
This patch fixes below kind of warnings:
WARNING: Symbolic permissions 'S_IXXX | S_IXXX' are not preferred.

Below errors are false positives:
ade7753.c:382: ERROR: Use 4 digit octal (0777) not decimal permissions
ade7753.c:386: ERROR: Use 4 digit octal (0777) not decimal permissions

Signed-off-by: Harinath Nampally 
---
Changes in v2:
 - None because only [PATCH v2 1/3] has improvement

 drivers/staging/iio/meter/ade7753.c | 46 ++---
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/iio/meter/ade7753.c 
b/drivers/staging/iio/meter/ade7753.c
index 5d45a68..2534bd0 100644
--- a/drivers/staging/iio/meter/ade7753.c
+++ b/drivers/staging/iio/meter/ade7753.c
@@ -298,92 +298,92 @@ static IIO_DEV_ATTR_AENERGY(ade7753_read_24bit, 
ADE7753_AENERGY);
 static IIO_DEV_ATTR_LAENERGY(ade7753_read_24bit, ADE7753_LAENERGY);
 static IIO_DEV_ATTR_VAENERGY(ade7753_read_24bit, ADE7753_VAENERGY);
 static IIO_DEV_ATTR_LVAENERGY(ade7753_read_24bit, ADE7753_LVAENERGY);
-static IIO_DEV_ATTR_CFDEN(S_IWUSR | S_IRUGO,
+static IIO_DEV_ATTR_CFDEN(0644,
ade7753_read_16bit,
ade7753_write_16bit,
ADE7753_CFDEN);
-static IIO_DEV_ATTR_CFNUM(S_IWUSR | S_IRUGO,
+static IIO_DEV_ATTR_CFNUM(0644,
ade7753_read_8bit,
ade7753_write_8bit,
ADE7753_CFNUM);
 static IIO_DEV_ATTR_CHKSUM(ade7753_read_8bit, ADE7753_CHKSUM);
-static IIO_DEV_ATTR_PHCAL(S_IWUSR | S_IRUGO,
+static IIO_DEV_ATTR_PHCAL(0644,
ade7753_read_16bit,
ade7753_write_16bit,
ADE7753_PHCAL);
-static IIO_DEV_ATTR_APOS(S_IWUSR | S_IRUGO,
+static IIO_DEV_ATTR_APOS(0644,
ade7753_read_16bit,
ade7753_write_16bit,
ADE7753_APOS);
-static IIO_DEV_ATTR_SAGCYC(S_IWUSR | S_IRUGO,
+static IIO_DEV_ATTR_SAGCYC(0644,
ade7753_read_8bit,
ade7753_write_8bit,
ADE7753_SAGCYC);
-static IIO_DEV_ATTR_SAGLVL(S_IWUSR | S_IRUGO,
+static IIO_DEV_ATTR_SAGLVL(0644,
ade7753_read_8bit,
ade7753_write_8bit,
ADE7753_SAGLVL);
-static IIO_DEV_ATTR_LINECYC(S_IWUSR | S_IRUGO,
+static IIO_DEV_ATTR_LINECYC(0644,
ade7753_read_8bit,
ade7753_write_8bit,
ADE7753_LINECYC);
-static IIO_DEV_ATTR_WDIV(S_IWUSR | S_IRUGO,
+static IIO_DEV_ATTR_WDIV(0644,
ade7753_read_8bit,
ade7753_write_8bit,
ADE7753_WDIV);
-static IIO_DEV_ATTR_IRMS(S_IWUSR | S_IRUGO,
+static IIO_DEV_ATTR_IRMS(0644,
ade7753_read_24bit,
NULL,
ADE7753_IRMS);
-static IIO_DEV_ATTR_VRMS(S_IRUGO,
+static IIO_DEV_ATTR_VRMS(0444,
ade7753_read_24bit,
NULL,
ADE7753_VRMS);
-static IIO_DEV_ATTR_IRMSOS(S_IWUSR | S_IRUGO,
+static IIO_DEV_ATTR_IRMSOS(0644,
ade7753_read_16bit,
ade7753_write_16bit,
ADE7753_IRMSOS);
-static IIO_DEV_ATTR_VRMSOS(S_IWUSR | S_IRUGO,
+static IIO_DEV_ATTR_VRMSOS(0644,
ade7753_read_16bit,
ade7753_write_16bit,
ADE7753_VRMSOS);
-static IIO_DEV_ATTR_WGAIN(S_IWUSR | S_IRUGO,
+static IIO_DEV_ATTR_WGAIN(0644,
ade7753_read_16bit,
ade7753_write_16bit,
ADE7753_WGAIN);
-static IIO_DEV_ATTR_VAGAIN(S_IWUSR | S_IRUGO,
+static IIO_DEV_ATTR_VAGAIN(0644,
ade7753_read_16bit,
ade7753_write_16bit,
ADE7753_VAGAIN);
-static IIO_DEV_ATTR_PGA_GAIN(S_IWUSR | S_IRUGO,
+static IIO_DEV_ATTR_PGA_GAIN(0644,
ade7753_read_16bit,
ade7753_write_16bit,
ADE7753_GAIN);
-static IIO_DEV_ATTR_IPKLVL(S_IWUSR | S_IRUGO,
+static IIO_DEV_ATTR_IPKLVL(0644,
ade7753_read_8bit,
ade7753_write_8bit,
ADE7753_IPKLVL);
-static IIO_DEV_ATTR_VPKLVL(S_IWUSR | S_IRUGO,
+static IIO_DEV_ATTR_VPKLVL(0644,
ade7753_read_8bit,
ade7753_write_8bit,
ADE7753_VPKLVL);
-static IIO_DEV_ATTR_IPEAK(S_IRUGO,
+static IIO_DEV_ATTR_IPEAK(0444,
ade7753_read_24bit,
NULL,
ADE7753_IPEAK);
-static IIO_DEV_ATTR_VPEAK(S_IRUGO,
+static IIO_DEV_ATTR_VPEAK(0444,
ade7753_read_24bit,
NULL,
ADE7753_VPEAK);
-static IIO_DEV_ATTR_VPERIOD(S_IRUGO,
+static IIO_DEV_ATTR_VPERIOD(0444,
ade7753_read_16bit,
NULL,
ADE7753_PERIOD);
-static IIO_DEV_ATTR_CH_OFF(1, S_IWUSR | S_IRUGO,
+static IIO_DEV_ATTR_CH_OFF(1, 0644,
ade7753_read_8bit,
ade7753_write_8bit,
ADE7753_CH1OS);
-static IIO_DEV_ATTR_CH_OFF(2, S_IWUSR | S_IRUGO,
+static IIO_DEV_ATTR_CH_OFF(2, 0644,
ade7753_read_8bit,

[PATCH v2 1/3] staging: iio: meter: Add the comment for mutex definition.

2017-05-09 Thread Harinath Nampally
This patch fixes below checkpatch.pl warning:
CHECK: struct mutex definition without comment

Signed-off-by: Harinath Nampally 
---
Changes in v2:
 - Removed the extra comment for mutex in the struct.

 drivers/staging/iio/meter/ade7753.c | 3 ++-
 1 file changed, 1 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/iio/meter/ade7753.c 
b/drivers/staging/iio/meter/ade7753.c
index b71fbd3..cffe6bf 100644
--- a/drivers/staging/iio/meter/ade7753.c
+++ b/drivers/staging/iio/meter/ade7753.c
@@ -78,12 +78,13 @@
 /**
  * struct ade7753_state - device instance specific data
  * @us: actual spi_device
+ * @buf_lock:   mutex to protect tx and rx
  * @tx: transmit buffer
  * @rx: receive buffer
- * @buf_lock:   mutex to protect tx and rx
  **/
 struct ade7753_state {
struct spi_device   *us;
struct mutexbuf_lock;
u8  tx[ADE7753_MAX_TX] cacheline_aligned;
u8  rx[ADE7753_MAX_RX];
-- 
2.7.4

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


[PATCH v2 2/3] staging: iio: meter: Fix the identations for proper alignments.

2017-05-09 Thread Harinath Nampally
This patch fixes below checkpatch.pl kind of warnings:
CHECK: Alignment should match open parenthesis

Signed-off-by: Harinath Nampally 
---
Changes in v2:
 - None because only [PATCH v2 1/3] has improvement

 drivers/staging/iio/meter/ade7753.c | 55 ++---
 1 file changed, 27 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/iio/meter/ade7753.c 
b/drivers/staging/iio/meter/ade7753.c
index cffe6bf..5d45a68 100644
--- a/drivers/staging/iio/meter/ade7753.c
+++ b/drivers/staging/iio/meter/ade7753.c
@@ -108,9 +108,8 @@ static int ade7753_spi_write_reg_8(struct device *dev,
return ret;
 }
 
-static int ade7753_spi_write_reg_16(struct device *dev,
-   u8 reg_address,
-   u16 value)
+static int ade7753_spi_write_reg_16(struct device *dev, u8 reg_address,
+   u16 value)
 {
int ret;
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
@@ -127,8 +126,8 @@ static int ade7753_spi_write_reg_16(struct device *dev,
 }
 
 static int ade7753_spi_read_reg_8(struct device *dev,
-   u8 reg_address,
-   u8 *val)
+ u8 reg_address,
+ u8 *val)
 {
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct ade7753_state *st = iio_priv(indio_dev);
@@ -137,7 +136,7 @@ static int ade7753_spi_read_reg_8(struct device *dev,
ret = spi_w8r8(st->us, ADE7753_READ_REG(reg_address));
if (ret < 0) {
dev_err(>us->dev, "problem when reading 8 bit register 
0x%02X",
-   reg_address);
+   reg_address);
return ret;
}
*val = ret;
@@ -146,8 +145,8 @@ static int ade7753_spi_read_reg_8(struct device *dev,
 }
 
 static int ade7753_spi_read_reg_16(struct device *dev,
-   u8 reg_address,
-   u16 *val)
+  u8 reg_address,
+  u16 *val)
 {
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct ade7753_state *st = iio_priv(indio_dev);
@@ -166,8 +165,8 @@ static int ade7753_spi_read_reg_16(struct device *dev,
 }
 
 static int ade7753_spi_read_reg_24(struct device *dev,
-   u8 reg_address,
-   u32 *val)
+  u8 reg_address,
+  u32 *val)
 {
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct ade7753_state *st = iio_priv(indio_dev);
@@ -190,7 +189,7 @@ static int ade7753_spi_read_reg_24(struct device *dev,
ret = spi_sync_transfer(st->us, xfers, ARRAY_SIZE(xfers));
if (ret) {
dev_err(>us->dev, "problem when reading 24 bit register 
0x%02X",
-   reg_address);
+   reg_address);
goto error_ret;
}
*val = (st->rx[0] << 16) | (st->rx[1] << 8) | st->rx[2];
@@ -201,8 +200,8 @@ static int ade7753_spi_read_reg_24(struct device *dev,
 }
 
 static ssize_t ade7753_read_8bit(struct device *dev,
-   struct device_attribute *attr,
-   char *buf)
+struct device_attribute *attr,
+char *buf)
 {
int ret;
u8 val;
@@ -216,8 +215,8 @@ static ssize_t ade7753_read_8bit(struct device *dev,
 }
 
 static ssize_t ade7753_read_16bit(struct device *dev,
-   struct device_attribute *attr,
-   char *buf)
+ struct device_attribute *attr,
+ char *buf)
 {
int ret;
u16 val;
@@ -231,8 +230,8 @@ static ssize_t ade7753_read_16bit(struct device *dev,
 }
 
 static ssize_t ade7753_read_24bit(struct device *dev,
-   struct device_attribute *attr,
-   char *buf)
+ struct device_attribute *attr,
+ char *buf)
 {
int ret;
u32 val;
@@ -246,9 +245,9 @@ static ssize_t ade7753_read_24bit(struct device *dev,
 }
 
 static ssize_t ade7753_write_8bit(struct device *dev,
-   struct device_attribute *attr,
-   const char *buf,
-   size_t len)
+ struct device_attribute *attr,
+ const char *buf,
+ size_t len)
 {
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
int ret;
@@ -264,9 +263,9 @@ static ssize_t ade7753_write_8bit(struct device *dev,
 }
 
 static ssize_t ade7753_write_16bit(struct device *dev,
-   struct device_attribute *attr,
-   const char *buf,
-   size_t len)
+  struct device_attribute *attr,
+  const char *buf,
+  size_t len)
 {
struct iio_dev_attr 

Re: [PATCH 1/7] staging: typec: tcpci: declare private structure as static

2017-05-09 Thread Guenter Roeck
On Tue, May 09, 2017 at 07:46:17PM +0200, Greg Kroah-Hartman wrote:
> On Tue, May 09, 2017 at 09:04:53AM -0700, Guenter Roeck wrote:
> > From: Olivier Leveque 
> > 
> > This fixes a sparse warning regarding an undeclared symbol. Since the
> > structure tcpci_tcpc_config is private to tcpci.c, it should be declared as
> > static.
> > 
> > Signed-off-by: Olivier Leveque 
> > Signed-off-by: Guenter Roeck 
> > ---
> >  drivers/staging/typec/tcpci.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Are any of these bugfixes for 4.12-stable, or can they wait for
> 4.13-rc1?
> 

They should all go into v4.12. There are no functionality enhancements,
only real bug fixes.

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


[PATCH] Update coding style to fit checkpatch.pl rules

2017-05-09 Thread Alexis Lothoré
Current HEAD did not pass the checkpatch script with --strict option, mainly
because of Camel Case names and long lines. As an exception, I have left the
defines nested in the "#if 0" in the header, since I am not sure it is a real
issue and it will probably be reused in the future, but please let me know if I
am wrong.

Signed-off-by: Alexis Lothoré 
---
 drivers/staging/emxx_udc/emxx_udc.c | 394 ++--
 drivers/staging/emxx_udc/emxx_udc.h | 180 
 2 files changed, 290 insertions(+), 284 deletions(-)

diff --git a/drivers/staging/emxx_udc/emxx_udc.c 
b/drivers/staging/emxx_udc/emxx_udc.c
index 77b242e..c3cda82 100644
--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -200,13 +200,13 @@ static u32 _nbu2ss_get_begin_ram_address(struct 
nbu2ss_udc *udc)
for (num = 0; num < NUM_ENDPOINTS - 1; num++) {
p_ep_regs = >p_regs->EP_REGS[num];
data = _nbu2ss_readl(_ep_regs->EP_PCKT_ADRS);
-   buf_type = _nbu2ss_readl(_ep_regs->EP_CONTROL) & EPn_BUF_TYPE;
+   buf_type = _nbu2ss_readl(_ep_regs->EP_CONTROL) & EPN_BUF_TYPE;
if (buf_type == 0) {
/* Single Buffer */
-   use_ram_size += (data & EPn_MPKT) / sizeof(u32);
+   use_ram_size += (data & EPN_MPKT) / sizeof(u32);
} else {
/* Double Buffer */
-   use_ram_size += ((data & EPn_MPKT) / sizeof(u32)) * 2;
+   use_ram_size += ((data & EPN_MPKT) / sizeof(u32)) * 2;
}
 
if ((data >> 16) > last_ram_adr)
@@ -245,15 +245,15 @@ static int _nbu2ss_ep_init(struct nbu2ss_udc *udc, struct 
nbu2ss_ep *ep)
/*   Bulk, Interrupt, ISO */
switch (ep->ep_type) {
case USB_ENDPOINT_XFER_BULK:
-   data = EPn_BULK;
+   data = EPN_BULK;
break;
 
case USB_ENDPOINT_XFER_INT:
-   data = EPn_BUF_SINGLE | EPn_INTERRUPT;
+   data = EPN_BUF_SINGLE | EPN_INTERRUPT;
break;
 
case USB_ENDPOINT_XFER_ISOC:
-   data = EPn_ISO;
+   data = EPN_ISO;
break;
 
default:
@@ -267,24 +267,24 @@ static int _nbu2ss_ep_init(struct nbu2ss_udc *udc, struct 
nbu2ss_ep *ep)
if (ep->direct == USB_DIR_OUT) {
/*-*/
/* OUT */
-   data = EPn_EN | EPn_BCLR | EPn_DIR0;
+   data = EPN_EN | EPN_BCLR | EPN_DIR0;
_nbu2ss_bitset(>p_regs->EP_REGS[num].EP_CONTROL, data);
 
-   data = EPn_ONAK | EPn_OSTL_EN | EPn_OSTL;
+   data = EPN_ONAK | EPN_OSTL_EN | EPN_OSTL;
_nbu2ss_bitclr(>p_regs->EP_REGS[num].EP_CONTROL, data);
 
-   data = EPn_OUT_EN | EPn_OUT_END_EN;
+   data = EPN_OUT_EN | EPN_OUT_END_EN;
_nbu2ss_bitset(>p_regs->EP_REGS[num].EP_INT_ENA, data);
} else {
/*-*/
/* IN */
-   data = EPn_EN | EPn_BCLR | EPn_AUTO;
+   data = EPN_EN | EPN_BCLR | EPN_AUTO;
_nbu2ss_bitset(>p_regs->EP_REGS[num].EP_CONTROL, data);
 
-   data = EPn_ISTL;
+   data = EPN_ISTL;
_nbu2ss_bitclr(>p_regs->EP_REGS[num].EP_CONTROL, data);
 
-   data = EPn_IN_EN | EPn_IN_END_EN;
+   data = EPN_IN_EN | EPN_IN_END_EN;
_nbu2ss_bitset(>p_regs->EP_REGS[num].EP_INT_ENA, data);
}
 
@@ -315,24 +315,24 @@ static int _nbu2ss_epn_exit(struct nbu2ss_udc *udc, 
struct nbu2ss_ep *ep)
if (ep->direct == USB_DIR_OUT) {
/*-*/
/* OUT */
-   data = EPn_ONAK | EPn_BCLR;
+   data = EPN_ONAK | EPN_BCLR;
_nbu2ss_bitset(>p_regs->EP_REGS[num].EP_CONTROL, data);
 
-   data = EPn_EN | EPn_DIR0;
+   data = EPN_EN | EPN_DIR0;
_nbu2ss_bitclr(>p_regs->EP_REGS[num].EP_CONTROL, data);
 
-   data = EPn_OUT_EN | EPn_OUT_END_EN;
+   data = EPN_OUT_EN | EPN_OUT_END_EN;
_nbu2ss_bitclr(>p_regs->EP_REGS[num].EP_INT_ENA, data);
} else {
/*-*/
/* IN */
-   data = EPn_BCLR;
+   data = EPN_BCLR;
_nbu2ss_bitset(>p_regs->EP_REGS[num].EP_CONTROL, data);
 
-   data = EPn_EN | EPn_AUTO;
+   data = EPN_EN | EPN_AUTO;
_nbu2ss_bitclr(>p_regs->EP_REGS[num].EP_CONTROL, data);
 
-   data = EPn_IN_EN | EPn_IN_END_EN;
+   data = EPN_IN_EN | EPN_IN_END_EN;
   

[PATCH] Update coding style

2017-05-09 Thread Alexis Lothoré
Current HEAD for emxx_udc driver did not pass checkpatch script, mainly because 
of Camel Case naming
and long lines.

Signed-off-by: Alexis Lothoré 
---
 drivers/staging/emxx_udc/emxx_udc.c | 394 ++--
 drivers/staging/emxx_udc/emxx_udc.h | 170 
 2 files changed, 285 insertions(+), 279 deletions(-)

diff --git a/drivers/staging/emxx_udc/emxx_udc.c 
b/drivers/staging/emxx_udc/emxx_udc.c
index 77b242e..c3cda82 100644
--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -200,13 +200,13 @@ static u32 _nbu2ss_get_begin_ram_address(struct 
nbu2ss_udc *udc)
for (num = 0; num < NUM_ENDPOINTS - 1; num++) {
p_ep_regs = >p_regs->EP_REGS[num];
data = _nbu2ss_readl(_ep_regs->EP_PCKT_ADRS);
-   buf_type = _nbu2ss_readl(_ep_regs->EP_CONTROL) & EPn_BUF_TYPE;
+   buf_type = _nbu2ss_readl(_ep_regs->EP_CONTROL) & EPN_BUF_TYPE;
if (buf_type == 0) {
/* Single Buffer */
-   use_ram_size += (data & EPn_MPKT) / sizeof(u32);
+   use_ram_size += (data & EPN_MPKT) / sizeof(u32);
} else {
/* Double Buffer */
-   use_ram_size += ((data & EPn_MPKT) / sizeof(u32)) * 2;
+   use_ram_size += ((data & EPN_MPKT) / sizeof(u32)) * 2;
}
 
if ((data >> 16) > last_ram_adr)
@@ -245,15 +245,15 @@ static int _nbu2ss_ep_init(struct nbu2ss_udc *udc, struct 
nbu2ss_ep *ep)
/*   Bulk, Interrupt, ISO */
switch (ep->ep_type) {
case USB_ENDPOINT_XFER_BULK:
-   data = EPn_BULK;
+   data = EPN_BULK;
break;
 
case USB_ENDPOINT_XFER_INT:
-   data = EPn_BUF_SINGLE | EPn_INTERRUPT;
+   data = EPN_BUF_SINGLE | EPN_INTERRUPT;
break;
 
case USB_ENDPOINT_XFER_ISOC:
-   data = EPn_ISO;
+   data = EPN_ISO;
break;
 
default:
@@ -267,24 +267,24 @@ static int _nbu2ss_ep_init(struct nbu2ss_udc *udc, struct 
nbu2ss_ep *ep)
if (ep->direct == USB_DIR_OUT) {
/*-*/
/* OUT */
-   data = EPn_EN | EPn_BCLR | EPn_DIR0;
+   data = EPN_EN | EPN_BCLR | EPN_DIR0;
_nbu2ss_bitset(>p_regs->EP_REGS[num].EP_CONTROL, data);
 
-   data = EPn_ONAK | EPn_OSTL_EN | EPn_OSTL;
+   data = EPN_ONAK | EPN_OSTL_EN | EPN_OSTL;
_nbu2ss_bitclr(>p_regs->EP_REGS[num].EP_CONTROL, data);
 
-   data = EPn_OUT_EN | EPn_OUT_END_EN;
+   data = EPN_OUT_EN | EPN_OUT_END_EN;
_nbu2ss_bitset(>p_regs->EP_REGS[num].EP_INT_ENA, data);
} else {
/*-*/
/* IN */
-   data = EPn_EN | EPn_BCLR | EPn_AUTO;
+   data = EPN_EN | EPN_BCLR | EPN_AUTO;
_nbu2ss_bitset(>p_regs->EP_REGS[num].EP_CONTROL, data);
 
-   data = EPn_ISTL;
+   data = EPN_ISTL;
_nbu2ss_bitclr(>p_regs->EP_REGS[num].EP_CONTROL, data);
 
-   data = EPn_IN_EN | EPn_IN_END_EN;
+   data = EPN_IN_EN | EPN_IN_END_EN;
_nbu2ss_bitset(>p_regs->EP_REGS[num].EP_INT_ENA, data);
}
 
@@ -315,24 +315,24 @@ static int _nbu2ss_epn_exit(struct nbu2ss_udc *udc, 
struct nbu2ss_ep *ep)
if (ep->direct == USB_DIR_OUT) {
/*-*/
/* OUT */
-   data = EPn_ONAK | EPn_BCLR;
+   data = EPN_ONAK | EPN_BCLR;
_nbu2ss_bitset(>p_regs->EP_REGS[num].EP_CONTROL, data);
 
-   data = EPn_EN | EPn_DIR0;
+   data = EPN_EN | EPN_DIR0;
_nbu2ss_bitclr(>p_regs->EP_REGS[num].EP_CONTROL, data);
 
-   data = EPn_OUT_EN | EPn_OUT_END_EN;
+   data = EPN_OUT_EN | EPN_OUT_END_EN;
_nbu2ss_bitclr(>p_regs->EP_REGS[num].EP_INT_ENA, data);
} else {
/*-*/
/* IN */
-   data = EPn_BCLR;
+   data = EPN_BCLR;
_nbu2ss_bitset(>p_regs->EP_REGS[num].EP_CONTROL, data);
 
-   data = EPn_EN | EPn_AUTO;
+   data = EPN_EN | EPN_AUTO;
_nbu2ss_bitclr(>p_regs->EP_REGS[num].EP_CONTROL, data);
 
-   data = EPn_IN_EN | EPn_IN_END_EN;
+   data = EPN_IN_EN | EPN_IN_END_EN;
_nbu2ss_bitclr(>p_regs->EP_REGS[num].EP_INT_ENA, data);
}
 
@@ -360,21 +360,21 @@ static void _nbu2ss_ep_dma_init(struct nbu2ss_udc *udc, 
struct nbu2ss_ep *ep)
 

[PATCH] staging: ccree: remove trailing whitespace. switch spaces to tabs

2017-05-09 Thread Connor Kelleher
ssi_fips.c:

fixing checkpatch.pl errors:

ERROR: trailing whitespace
+ * $

ERROR: trailing whitespace
+ * $

ERROR: trailing whitespace
+ * $

ERROR: trailing whitespace
+This function returns the REE FIPS state.  $

ERROR: trailing whitespace
+It should be called by kernel module. $

ERROR: code indent should use tabs where possible
+int rc = 0;$

ERROR: trailing whitespace
+This function returns the REE FIPS error.  $

ERROR: trailing whitespace
+It should be called by kernel module. $

ERROR: code indent should use tabs where possible
+int rc = 0;$

Signed-off-by: Connor Kelleher 
---
 drivers/staging/ccree/ssi_fips.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/ccree/ssi_fips.c b/drivers/staging/ccree/ssi_fips.c
index 50f748511979..25ee23a1cecf 100644
--- a/drivers/staging/ccree/ssi_fips.c
+++ b/drivers/staging/ccree/ssi_fips.c
@@ -1,15 +1,15 @@
 /*
  * Copyright (C) 2012-2017 ARM Limited or its affiliates.
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see .
  */
@@ -27,12 +27,12 @@ extern int ssi_fips_ext_get_state(ssi_fips_state_t 
*p_state);
 extern int ssi_fips_ext_get_error(ssi_fips_error_t *p_err);
 
 /*
-This function returns the REE FIPS state.  
-It should be called by kernel module. 
+This function returns the REE FIPS state.
+It should be called by kernel module.
 */
 int ssi_fips_get_state(ssi_fips_state_t *p_state)
 {
-int rc = 0;
+   int rc = 0;
 
if (p_state == NULL) {
return -EINVAL;
@@ -46,12 +46,12 @@ int ssi_fips_get_state(ssi_fips_state_t *p_state)
 EXPORT_SYMBOL(ssi_fips_get_state);
 
 /*
-This function returns the REE FIPS error.  
-It should be called by kernel module. 
+This function returns the REE FIPS error.
+It should be called by kernel module.
 */
 int ssi_fips_get_error(ssi_fips_error_t *p_err)
 {
-int rc = 0;
+   int rc = 0;
 
if (p_err == NULL) {
return -EINVAL;
-- 
2.11.0

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


Re: [PATCH 1/7] staging: typec: tcpci: declare private structure as static

2017-05-09 Thread Greg Kroah-Hartman
On Tue, May 09, 2017 at 09:04:53AM -0700, Guenter Roeck wrote:
> From: Olivier Leveque 
> 
> This fixes a sparse warning regarding an undeclared symbol. Since the
> structure tcpci_tcpc_config is private to tcpci.c, it should be declared as
> static.
> 
> Signed-off-by: Olivier Leveque 
> Signed-off-by: Guenter Roeck 
> ---
>  drivers/staging/typec/tcpci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Are any of these bugfixes for 4.12-stable, or can they wait for
4.13-rc1?

thanks,

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


Re: [PATCH] staging: media: cxd2099: Use __func__ macro in messages

2017-05-09 Thread Jasmin J.

Hi Alexandre!

The current cxd2099 driver is an old version. DD provides a newer variant.
Please see my patch series
  http://www.mail-archive.com/linux-media@vger.kernel.org/msg112410.html
Especially this patch
  http://www.mail-archive.com/linux-media@vger.kernel.org/msg112409.html
where I remove this useless printing already.

I kept the "slot_shutdown" print in my series, because it is useful and called
only if someone removes the CAM.

So I can agree with your first hunk.

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


[PATCH] staging: ccree: ssi_aead.c: Fix blank lines coding style issue

2017-05-09 Thread Alex
Checkpatch emits CHECK: Please don't use multiple blank lines.

Remove multiple blank lines.

Signed-off-by: Alexander Mazyrin 
---
 drivers/staging/ccree/ssi_aead.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c
index 0382917..c1ddd7f 100644
--- a/drivers/staging/ccree/ssi_aead.c
+++ b/drivers/staging/ccree/ssi_aead.c
@@ -2827,6 +2827,3 @@ int ssi_aead_alloc(struct ssi_drvdata *drvdata)
 fail0:
return rc;
 }
-
-
-
-- 
2.1.4

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


[PATCH 6/7] staging: typec: tcpm: Respond to Discover Identity commands

2017-05-09 Thread Guenter Roeck
If the lower level driver provided a list of VDOs in its configuration
data, send it to the partner as response to a Discover Identity command
if in device mode (UFP).

Cc: Yueyao Zhu 
Originally-from: Puma Hsu 
Signed-off-by: Guenter Roeck 
---
 drivers/staging/typec/pd_vdo.h |  4 +++-
 drivers/staging/typec/tcpm.c   | 27 +++
 drivers/staging/typec/tcpm.h   |  3 +++
 3 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/typec/pd_vdo.h b/drivers/staging/typec/pd_vdo.h
index dba172e0e0d1..d92259f8de0a 100644
--- a/drivers/staging/typec/pd_vdo.h
+++ b/drivers/staging/typec/pd_vdo.h
@@ -22,6 +22,9 @@
  * VDM object is minimum of VDM header + 6 additional data objects.
  */
 
+#define VDO_MAX_OBJECTS6
+#define VDO_MAX_SIZE   (VDO_MAX_OBJECTS + 1)
+
 /*
  * VDM header
  * --
@@ -34,7 +37,6 @@
  * <5>  :: reserved (SVDM), command type (UVDM)
  * <4:0>:: command
  */
-#define VDO_MAX_SIZE 7
 #define VDO(vid, type, custom) \
(((vid) << 16) |\
 ((type) << 15) |   \
diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
index a385f7e2a6fd..c749e980ddf9 100644
--- a/drivers/staging/typec/tcpm.c
+++ b/drivers/staging/typec/tcpm.c
@@ -252,6 +252,8 @@ struct tcpm_port {
unsigned int nr_src_pdo;
u32 snk_pdo[PDO_MAX_OBJECTS];
unsigned int nr_snk_pdo;
+   u32 snk_vdo[VDO_MAX_OBJECTS];
+   unsigned int nr_snk_vdo;
 
unsigned int max_snk_mv;
unsigned int max_snk_ma;
@@ -998,6 +1000,7 @@ static int tcpm_pd_svdm(struct tcpm_port *port, const 
__le32 *payload, int cnt,
struct pd_mode_data *modep;
int rlen = 0;
u16 svid;
+   int i;
 
tcpm_log(port, "Rx VDM cmd 0x%x type %d cmd %d len %d",
 p0, cmd_type, cmd, cnt);
@@ -1008,6 +1011,14 @@ static int tcpm_pd_svdm(struct tcpm_port *port, const 
__le32 *payload, int cnt,
case CMDT_INIT:
switch (cmd) {
case CMD_DISCOVER_IDENT:
+   /* 6.4.4.3.1: Only respond as UFP (device) */
+   if (port->data_role == TYPEC_DEVICE &&
+   port->nr_snk_vdo) {
+   for (i = 0; i <  port->nr_snk_vdo; i++)
+   response[i + 1]
+   = cpu_to_le32(port->snk_vdo[i]);
+   rlen = port->nr_snk_vdo + 1;
+   }
break;
case CMD_DISCOVER_SVID:
break;
@@ -3320,6 +3331,20 @@ static int tcpm_copy_pdos(u32 *dest_pdo, const u32 
*src_pdo,
return nr_pdo;
 }
 
+static int tcpm_copy_vdos(u32 *dest_vdo, const u32 *src_vdo,
+ unsigned int nr_vdo)
+{
+   unsigned int i;
+
+   if (nr_vdo > VDO_MAX_OBJECTS)
+   nr_vdo = VDO_MAX_OBJECTS;
+
+   for (i = 0; i < nr_vdo; i++)
+   dest_vdo[i] = src_vdo[i];
+
+   return nr_vdo;
+}
+
 void tcpm_update_source_capabilities(struct tcpm_port *port, const u32 *pdo,
 unsigned int nr_pdo)
 {
@@ -3410,6 +3435,8 @@ struct tcpm_port *tcpm_register_port(struct device *dev, 
struct tcpc_dev *tcpc)
  tcpc->config->nr_src_pdo);
port->nr_snk_pdo = tcpm_copy_pdos(port->snk_pdo, tcpc->config->snk_pdo,
  tcpc->config->nr_snk_pdo);
+   port->nr_snk_vdo = tcpm_copy_vdos(port->snk_vdo, tcpc->config->snk_vdo,
+ tcpc->config->nr_snk_vdo);
 
port->max_snk_mv = tcpc->config->max_snk_mv;
port->max_snk_ma = tcpc->config->max_snk_ma;
diff --git a/drivers/staging/typec/tcpm.h b/drivers/staging/typec/tcpm.h
index 969b365e6549..19c307d31a5a 100644
--- a/drivers/staging/typec/tcpm.h
+++ b/drivers/staging/typec/tcpm.h
@@ -60,6 +60,9 @@ struct tcpc_config {
const u32 *snk_pdo;
unsigned int nr_snk_pdo;
 
+   const u32 *snk_vdo;
+   unsigned int nr_snk_vdo;
+
unsigned int max_snk_mv;
unsigned int max_snk_ma;
unsigned int max_snk_mw;
-- 
2.7.4

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


[PATCH 5/7] staging: typec: tcpm: Set correct flags in PD request messages

2017-05-09 Thread Guenter Roeck
We do support USB PD communication, and devices supported by this driver
typically use USB power for purposes other than USB communication.

Originally-from: Puma Hsu 
Cc: Yueyao Zhu 
Signed-off-by: Guenter Roeck 
---
 drivers/staging/typec/tcpm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
index c5d8b129c4f4..a385f7e2a6fd 100644
--- a/drivers/staging/typec/tcpm.c
+++ b/drivers/staging/typec/tcpm.c
@@ -1738,8 +1738,7 @@ static int tcpm_pd_build_request(struct tcpm_port *port, 
u32 *rdo)
}
ma = min(ma, port->max_snk_ma);
 
-   /* XXX: Any other flags need to be set? */
-   flags = 0;
+   flags = RDO_USB_COMM | RDO_NO_SUSPEND;
 
/* Set mismatch bit if offered power is less than operating power */
mw = ma * mv / 1000;
-- 
2.7.4

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


[PATCH 4/7] staging: typec: tcpm: Drop duplicate PD messages

2017-05-09 Thread Guenter Roeck
Per USB PD standard, we have to drop duplicate PD messages.
We can not expect lower protocol layers to drop such messages,
since lower layers don't know if a message was dropped somewhere
else in the stack.

Originally-from: Puma Hsu 
Cc: Yueyao Zhu 
Signed-off-by: Guenter Roeck 
---
 drivers/staging/typec/pd.h   | 10 ++
 drivers/staging/typec/tcpm.c | 29 +
 2 files changed, 39 insertions(+)

diff --git a/drivers/staging/typec/pd.h b/drivers/staging/typec/pd.h
index 8d97bdb95f23..510ef7279900 100644
--- a/drivers/staging/typec/pd.h
+++ b/drivers/staging/typec/pd.h
@@ -92,6 +92,16 @@ static inline unsigned int pd_header_type_le(__le16 header)
return pd_header_type(le16_to_cpu(header));
 }
 
+static inline unsigned int pd_header_msgid(u16 header)
+{
+   return (header >> PD_HEADER_ID_SHIFT) & PD_HEADER_ID_MASK;
+}
+
+static inline unsigned int pd_header_msgid_le(__le16 header)
+{
+   return pd_header_msgid(le16_to_cpu(header));
+}
+
 #define PD_MAX_PAYLOAD 7
 
 struct pd_message {
diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
index abba655ba00a..c5d8b129c4f4 100644
--- a/drivers/staging/typec/tcpm.c
+++ b/drivers/staging/typec/tcpm.c
@@ -238,6 +238,7 @@ struct tcpm_port {
unsigned int hard_reset_count;
bool pd_capable;
bool explicit_contract;
+   unsigned int rx_msgid;
 
/* Partner capabilities/requests */
u32 sink_request;
@@ -1415,6 +1416,7 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port,
break;
case SOFT_RESET_SEND:
port->message_id = 0;
+   port->rx_msgid = -1;
if (port->pwr_role == TYPEC_SOURCE)
next_state = SRC_SEND_CAPABILITIES;
else
@@ -1503,6 +1505,22 @@ static void tcpm_pd_rx_handler(struct work_struct *work)
 port->attached);
 
if (port->attached) {
+   enum pd_ctrl_msg_type type = pd_header_type_le(msg->header);
+   unsigned int msgid = pd_header_msgid_le(msg->header);
+
+   /*
+* USB PD standard, 6.6.1.2:
+* "... if MessageID value in a received Message is the
+* same as the stored value, the receiver shall return a
+* GoodCRC Message with that MessageID value and drop
+* the Message (this is a retry of an already received
+* Message). Note: this shall not apply to the Soft_Reset
+* Message which always has a MessageID value of zero."
+*/
+   if (msgid == port->rx_msgid && type != PD_CTRL_SOFT_RESET)
+   goto done;
+   port->rx_msgid = msgid;
+
/*
 * If both ends believe to be DFP/host, we have a data role
 * mismatch.
@@ -1520,6 +1538,7 @@ static void tcpm_pd_rx_handler(struct work_struct *work)
}
}
 
+done:
mutex_unlock(>lock);
kfree(event);
 }
@@ -1957,6 +1976,12 @@ static void tcpm_reset_port(struct tcpm_port *port)
port->attached = false;
port->pd_capable = false;
 
+   /*
+* First Rx ID should be 0; set this to a sentinel of -1 so that
+* we can check tcpm_pd_rx_handler() if we had seen it before.
+*/
+   port->rx_msgid = -1;
+
port->tcpc->set_pd_rx(port->tcpc, false);
tcpm_init_vbus(port);   /* also disables charging */
tcpm_init_vconn(port);
@@ -2170,6 +2195,7 @@ static void run_state_machine(struct tcpm_port *port)
port->pwr_opmode = TYPEC_PWR_MODE_USB;
port->caps_count = 0;
port->message_id = 0;
+   port->rx_msgid = -1;
port->explicit_contract = false;
tcpm_set_state(port, SRC_SEND_CAPABILITIES, 0);
break;
@@ -2329,6 +2355,7 @@ static void run_state_machine(struct tcpm_port *port)
typec_set_pwr_opmode(port->typec_port, TYPEC_PWR_MODE_USB);
port->pwr_opmode = TYPEC_PWR_MODE_USB;
port->message_id = 0;
+   port->rx_msgid = -1;
port->explicit_contract = false;
tcpm_set_state(port, SNK_DISCOVERY, 0);
break;
@@ -2496,6 +2523,7 @@ static void run_state_machine(struct tcpm_port *port)
/* Soft_Reset states */
case SOFT_RESET:
port->message_id = 0;
+   port->rx_msgid = -1;
tcpm_pd_send_control(port, PD_CTRL_ACCEPT);
if (port->pwr_role == TYPEC_SOURCE)
tcpm_set_state(port, SRC_SEND_CAPABILITIES, 0);
@@ -2504,6 +2532,7 @@ static void run_state_machine(struct tcpm_port *port)
break;
case SOFT_RESET_SEND:

[PATCH 7/7] staging: typec: tcpm: Fix Port Power Role field in PS_RDY messages

2017-05-09 Thread Guenter Roeck
PS_RDY messages sent during power swap sequences are expected to reflect
the new power role.

Signed-off-by: Guenter Roeck 
---
 drivers/staging/typec/tcpm.c | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
index c749e980ddf9..20eb4ebcf8c3 100644
--- a/drivers/staging/typec/tcpm.c
+++ b/drivers/staging/typec/tcpm.c
@@ -2607,6 +2607,14 @@ static void run_state_machine(struct tcpm_port *port)
break;
case PR_SWAP_SRC_SNK_SOURCE_OFF:
tcpm_set_cc(port, TYPEC_CC_RD);
+   /*
+* USB-PD standard, 6.2.1.4, Port Power Role:
+* "During the Power Role Swap Sequence, for the initial Source
+* Port, the Port Power Role field shall be set to Sink in the
+* PS_RDY Message indicating that the initial Source’s power
+* supply is turned off"
+*/
+   tcpm_set_pwr_role(port, TYPEC_SINK);
if (tcpm_pd_send_control(port, PD_CTRL_PS_RDY)) {
tcpm_set_state(port, ERROR_RECOVERY, 0);
break;
@@ -2614,7 +2622,6 @@ static void run_state_machine(struct tcpm_port *port)
tcpm_set_state_cond(port, SNK_UNATTACHED, PD_T_PS_SOURCE_ON);
break;
case PR_SWAP_SRC_SNK_SINK_ON:
-   tcpm_set_pwr_role(port, TYPEC_SINK);
tcpm_swap_complete(port, 0);
tcpm_set_state(port, SNK_STARTUP, 0);
break;
@@ -2626,8 +2633,15 @@ static void run_state_machine(struct tcpm_port *port)
case PR_SWAP_SNK_SRC_SOURCE_ON:
tcpm_set_cc(port, tcpm_rp_cc(port));
tcpm_set_vbus(port, true);
-   tcpm_pd_send_control(port, PD_CTRL_PS_RDY);
+   /*
+* USB PD standard, 6.2.1.4:
+* "Subsequent Messages initiated by the Policy Engine,
+* such as the PS_RDY Message sent to indicate that Vbus
+* is ready, will have the Port Power Role field set to
+* Source."
+*/
tcpm_set_pwr_role(port, TYPEC_SOURCE);
+   tcpm_pd_send_control(port, PD_CTRL_PS_RDY);
tcpm_swap_complete(port, 0);
tcpm_set_state(port, SRC_STARTUP, 0);
break;
-- 
2.7.4

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


[PATCH 2/7] staging: typec: fusb302: Fix module autoload

2017-05-09 Thread Guenter Roeck
From: Javier Martinez Canillas 

If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the OF and I2C device ID table entries as module aliases, using the
MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/staging/typec/fusb302/fusb302.ko | grep alias
$

After this patch:

$ modinfo drivers/staging/typec/fusb302/fusb302.ko | grep alias
alias:  of:N*T*Cfcs,fusb302C*
alias:  of:N*T*Cfcs,fusb302
alias:  i2c:typec_fusb302

Signed-off-by: Javier Martinez Canillas 
Signed-off-by: Guenter Roeck 
---
 drivers/staging/typec/fusb302/fusb302.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/typec/fusb302/fusb302.c 
b/drivers/staging/typec/fusb302/fusb302.c
index 2cee9a952c9b..aa460f93a293 100644
--- a/drivers/staging/typec/fusb302/fusb302.c
+++ b/drivers/staging/typec/fusb302/fusb302.c
@@ -1787,11 +1787,13 @@ static const struct of_device_id fusb302_dt_match[] = {
{.compatible = "fcs,fusb302"},
{},
 };
+MODULE_DEVICE_TABLE(of, fusb302_dt_match);
 
 static const struct i2c_device_id fusb302_i2c_device_id[] = {
{"typec_fusb302", 0},
{},
 };
+MODULE_DEVICE_TABLE(i2c, fusb302_i2c_device_id);
 
 static const struct dev_pm_ops fusb302_pm_ops = {
.suspend = fusb302_pm_suspend,
-- 
2.7.4

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


[PATCH 3/7] staging: typec: fusb302: Fix chip->vbus_present init value

2017-05-09 Thread Guenter Roeck
From: Yueyao Zhu 

FUSB_REG_STATUS0 & FUSB_REG_STATUS0_VBUSOK = 0x40 & 0x80 is always
zero. Fix the code to what it is intended to be: check the VBUSOK
bit of the value read from address FUSB_REG_STATUS0.

Reported-by: Dan Carpenter 
Cc: Guenter Roeck 
Signed-off-by: Yueyao Zhu 
Signed-off-by: Guenter Roeck 
---
 drivers/staging/typec/fusb302/fusb302.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/typec/fusb302/fusb302.c 
b/drivers/staging/typec/fusb302/fusb302.c
index aa460f93a293..d8b50b49bb2d 100644
--- a/drivers/staging/typec/fusb302/fusb302.c
+++ b/drivers/staging/typec/fusb302/fusb302.c
@@ -489,7 +489,7 @@ static int tcpm_init(struct tcpc_dev *dev)
ret = fusb302_i2c_read(chip, FUSB_REG_STATUS0, );
if (ret < 0)
return ret;
-   chip->vbus_present = !!(FUSB_REG_STATUS0 & FUSB_REG_STATUS0_VBUSOK);
+   chip->vbus_present = !!(data & FUSB_REG_STATUS0_VBUSOK);
ret = fusb302_i2c_read(chip, FUSB_REG_DEVICE_ID, );
if (ret < 0)
return ret;
-- 
2.7.4

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


Re: [PATCH] staging: typec: Make undeclared symbol static

2017-05-09 Thread Guenter Roeck
On Tue, May 09, 2017 at 01:48:53AM -0700, Guru Das Srinagesh wrote:
> Fix sparse warning:
>   drivers/staging/typec/tcpci.c:428:26: warning: symbol 'tcpci_tcpc_config'
>   was not declared. Should it be static?
> 
> Signed-off-by: Guru Das Srinagesh 

Olivier Leveque already sent a similar patch last week.

Thanks,
Guenter

> ---
>  drivers/staging/typec/tcpci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c
> index 5e5be74..df72d8b 100644
> --- a/drivers/staging/typec/tcpci.c
> +++ b/drivers/staging/typec/tcpci.c
> @@ -425,7 +425,7 @@ static const struct regmap_config tcpci_regmap_config = {
>   .max_register = 0x7F, /* 0x80 .. 0xFF are vendor defined */
>  };
>  
> -const struct tcpc_config tcpci_tcpc_config = {
> +static const struct tcpc_config tcpci_tcpc_config = {
>   .type = TYPEC_PORT_DFP,
>   .default_role = TYPEC_SINK,
>  };
> -- 
> 2.7.4
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/7] staging: typec: tcpci: declare private structure as static

2017-05-09 Thread Guenter Roeck
From: Olivier Leveque 

This fixes a sparse warning regarding an undeclared symbol. Since the
structure tcpci_tcpc_config is private to tcpci.c, it should be declared as
static.

Signed-off-by: Olivier Leveque 
Signed-off-by: Guenter Roeck 
---
 drivers/staging/typec/tcpci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c
index 5e5be74c7850..df72d8b01e73 100644
--- a/drivers/staging/typec/tcpci.c
+++ b/drivers/staging/typec/tcpci.c
@@ -425,7 +425,7 @@ static const struct regmap_config tcpci_regmap_config = {
.max_register = 0x7F, /* 0x80 .. 0xFF are vendor defined */
 };
 
-const struct tcpc_config tcpci_tcpc_config = {
+static const struct tcpc_config tcpci_tcpc_config = {
.type = TYPEC_PORT_DFP,
.default_role = TYPEC_SINK,
 };
-- 
2.7.4

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


Re: [PATCH 3/4] Staging: rtl8712: ieee80211: fixed camelcase coding style

2017-05-09 Thread Joe Perches
On Tue, 2017-05-09 at 01:03 +0530, Jaya Durga wrote:
> Fixed coding style issue

Do please strive to do more than shut up checkpatch
messages.  It's _far_ more important to use sensible
coding mechanisms and reuse existing code utilities.

> diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c 
> b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
[]
> @@ -150,12 +150,12 @@ static noinline_for_stack char *translate_scan(struct 
> _adapter *padapter,
>   u16 cap, ht_cap = false, mcs_rate;
>   u8 rssi;
>  
> - if ((pnetwork->network.Configuration.DSConfig < 1) ||
> - (pnetwork->network.Configuration.DSConfig > 14)) {
> - if (pnetwork->network.Configuration.DSConfig < 1)
> - pnetwork->network.Configuration.DSConfig = 1;
> + if ((pnetwork->network.configuration.ds_config < 1) ||
> + (pnetwork->network.configuration.ds_config > 14)) {
> + if (pnetwork->network.configuration.ds_config < 1)
> + pnetwork->network.configuration.ds_config = 1;
>   else
> - pnetwork->network.Configuration.DSConfig = 14;
> + pnetwork->network.configuration.ds_config = 14;
>   }

For instance: this could be rewritten in a single line.

In a different patch, assuming you add a temporary for
>network.configuration, these 7 lines could be:

cfg->ds_config = clamp(cfg->ds_config, 1, 14);
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 4/4] Staging: rtl8712: ieee80211:fixed warning line over 80 characters coding style issue

2017-05-09 Thread Joe Perches
On Tue, 2017-05-09 at 00:52 +0530, Jaya Durga wrote:
> fixed warning line over 80 characters coding style issue
> 
> Signed-off-by: Jaya Durga 
> ---
>  drivers/staging/rtl8712/ieee80211.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8712/ieee80211.c 
> b/drivers/staging/rtl8712/ieee80211.c
> index 42cb46c..a7152df 100644
> --- a/drivers/staging/rtl8712/ieee80211.c
> +++ b/drivers/staging/rtl8712/ieee80211.c
> @@ -222,7 +222,9 @@ unsigned char *r8712_get_wpa_ie(unsigned char *pie, int 
> *wpa_ie_len, int limit)
>   pbuf = r8712_get_ie(pbuf, _WPA_IE_ID_, , limit);
>   if (pbuf) {
>   /*check if oui matches...*/
> - if (memcmp((pbuf + 2), wpa_oui_type, 
> sizeof(wpa_oui_type)))
> + if (memcmp(
> + (pbuf + 2), wpa_oui_type,
> + sizeof(wpa_oui_type)))
>   goto check_next_ie;
>   /*check version...*/
>   memcpy((u8 *), (pbuf + 6), sizeof(val16));

This is a oddly written function.
Perhaps something like this would be more obvious:

unsigned char *r8712_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit)
{
u8 *pbuf = pie;

while (1) {
int len;

pbuf = r8712_get_ie(pbuf, _WPA_IE_ID_, , limit);
if (!pbuf)
break;
/* check if oui matches... */
if (memcmp(pbuf + 2, WPA_OUI_TYPE, sizeof(WPA_OUI_TYPE)) == 0 &&
get_unaligned_le16(pbuf + 6) == 0x0001) {
*wpa_ie_len = *(pbuf + 1);
return pbuf;
}
limit = limit - (pbuf - pie) - 2 - len;
if (limit <= 0)
break;
pbuf += 2 + len;
}

*wpa_ie_len = 0;
return NULL;
}
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 1/2] staging: vt6656: Fix indentation style

2017-05-09 Thread Juan Manuel Torres Palma
Fix indentation to tabs instead of spaces.

Signed-off-by: Juan Manuel Torres Palma 
---
 drivers/staging/vt6656/rxtx.c | 34 +-
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 1835cd1..7af27ea 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -114,7 +114,7 @@ static __le16 vnt_time_stamp_off(struct vnt_private *priv, 
u16 rate)
 }
 
 static u32 vnt_get_rsvtime(struct vnt_private *priv, u8 pkt_type,
-   u32 frame_length, u16 rate, int need_ack)
+  u32 frame_length, u16 rate, int need_ack)
 {
u32 data_time, ack_time;
 
@@ -135,14 +135,14 @@ static u32 vnt_get_rsvtime(struct vnt_private *priv, u8 
pkt_type,
 }
 
 static __le16 vnt_rxtx_rsvtime_le16(struct vnt_private *priv, u8 pkt_type,
-u32 frame_length, u16 rate, int need_ack)
+   u32 frame_length, u16 rate, int need_ack)
 {
return cpu_to_le16((u16)vnt_get_rsvtime(priv, pkt_type,
frame_length, rate, need_ack));
 }
 
 static __le16 vnt_get_rtscts_rsvtime_le(struct vnt_private *priv,
-u8 rsv_type, u8 pkt_type, u32 
frame_length, u16 current_rate)
+   u8 rsv_type, u8 pkt_type, u32 
frame_length, u16 current_rate)
 {
u32 rrv_time, rts_time, cts_time, ack_time, data_time;
 
@@ -160,19 +160,19 @@ static __le16 vnt_get_rtscts_rsvtime_le(struct 
vnt_private *priv,
rts_time = vnt_get_frame_time(priv->preamble_type,
pkt_type, 20, priv->top_cck_basic_rate);
cts_time = vnt_get_frame_time(priv->preamble_type, pkt_type,
- 14, priv->top_cck_basic_rate);
+ 14, priv->top_cck_basic_rate);
ack_time = vnt_get_frame_time(priv->preamble_type, pkt_type,
- 14, priv->top_ofdm_basic_rate);
+ 14, priv->top_ofdm_basic_rate);
} else if (rsv_type == 2) {
rts_time = vnt_get_frame_time(priv->preamble_type, pkt_type,
- 20, priv->top_ofdm_basic_rate);
+ 20, priv->top_ofdm_basic_rate);
cts_time = ack_time = vnt_get_frame_time(priv->preamble_type,
pkt_type, 14, priv->top_ofdm_basic_rate);
} else if (rsv_type == 3) {
cts_time = vnt_get_frame_time(priv->preamble_type, pkt_type,
- 14, priv->top_cck_basic_rate);
+ 14, priv->top_cck_basic_rate);
ack_time = vnt_get_frame_time(priv->preamble_type, pkt_type,
- 14, priv->top_ofdm_basic_rate);
+ 14, priv->top_ofdm_basic_rate);
 
rrv_time = cts_time + ack_time + data_time + 2 * priv->sifs;
 
@@ -185,7 +185,7 @@ static __le16 vnt_get_rtscts_rsvtime_le(struct vnt_private 
*priv,
 }
 
 static __le16 vnt_get_duration_le(struct vnt_private *priv,
-  u8 pkt_type, int need_ack)
+ u8 pkt_type, int need_ack)
 {
u32 ack_time = 0;
 
@@ -227,7 +227,7 @@ static __le16 vnt_get_rtscts_duration_le(struct 
vnt_usb_send_context *context,
case RTSDUR_AA_F0:
case RTSDUR_AA_F1:
cts_time = vnt_get_frame_time(priv->preamble_type,
- pkt_type, 14, 
priv->top_ofdm_basic_rate);
+ pkt_type, 14, 
priv->top_ofdm_basic_rate);
dur_time = cts_time + 2 * priv->sifs +
vnt_get_rsvtime(priv, pkt_type,
frame_length, rate, need_ack);
@@ -410,7 +410,7 @@ static u16 vnt_rxtx_rts_g_head(struct vnt_usb_send_context 
*tx_context,
u16 current_rate = tx_context->tx_rate;
 
vnt_get_phy_field(priv, rts_frame_len, priv->top_cck_basic_rate,
- PK_TYPE_11B, >b);
+ PK_TYPE_11B, >b);
vnt_get_phy_field(priv, rts_frame_len, priv->top_ofdm_basic_rate,
  tx_context->pkt_type, >a);
 
@@ -437,7 +437,7 @@ static u16 vnt_rxtx_rts_g_fb_head(struct 
vnt_usb_send_context *tx_context,
u16 rts_frame_len = 20;
 
vnt_get_phy_field(priv, rts_frame_len, priv->top_cck_basic_rate,
- PK_TYPE_11B, >b);
+ PK_TYPE_11B, >b);
vnt_get_phy_field(priv, rts_frame_len, priv->top_ofdm_basic_rate,
  tx_context->pkt_type, >a);
 
@@ -683,9 +683,9 @@ static u16 

[PATCH v2 2/2] staging: vt6656: Break too long lines

2017-05-09 Thread Juan Manuel Torres Palma
Split long lines into several to match coding style.

Signed-off-by: Juan Manuel Torres Palma 
---
 drivers/staging/vt6656/rxtx.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 7af27ea..3d70ebe 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -122,11 +122,13 @@ static u32 vnt_get_rsvtime(struct vnt_private *priv, u8 
pkt_type,
   frame_length, rate);
 
if (pkt_type == PK_TYPE_11B)
-   ack_time = vnt_get_frame_time(priv->preamble_type, pkt_type,
- 14, 
(u16)priv->top_cck_basic_rate);
+   ack_time = vnt_get_frame_time(priv->preamble_type,
+ pkt_type, 14,
+ (u16)priv->top_cck_basic_rate);
else
-   ack_time = vnt_get_frame_time(priv->preamble_type, pkt_type,
- 14, 
(u16)priv->top_ofdm_basic_rate);
+   ack_time = vnt_get_frame_time(priv->preamble_type,
+ pkt_type, 14,
+ (u16)priv->top_ofdm_basic_rate);
 
if (need_ack)
return data_time + priv->sifs + ack_time;
@@ -142,7 +144,8 @@ static __le16 vnt_rxtx_rsvtime_le16(struct vnt_private 
*priv, u8 pkt_type,
 }
 
 static __le16 vnt_get_rtscts_rsvtime_le(struct vnt_private *priv,
-   u8 rsv_type, u8 pkt_type, u32 
frame_length, u16 current_rate)
+   u8 rsv_type, u8 pkt_type,
+   u32 frame_length, u16 current_rate)
 {
u32 rrv_time, rts_time, cts_time, ack_time, data_time;
 
@@ -227,7 +230,8 @@ static __le16 vnt_get_rtscts_duration_le(struct 
vnt_usb_send_context *context,
case RTSDUR_AA_F0:
case RTSDUR_AA_F1:
cts_time = vnt_get_frame_time(priv->preamble_type,
- pkt_type, 14, 
priv->top_ofdm_basic_rate);
+ pkt_type, 14,
+ priv->top_ofdm_basic_rate);
dur_time = cts_time + 2 * priv->sifs +
vnt_get_rsvtime(priv, pkt_type,
frame_length, rate, need_ack);
-- 
2.9.3

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


Re: [PATCH] staging: vt6656: fix style

2017-05-09 Thread Greg KH
On Tue, May 09, 2017 at 09:45:43PM +0900, Juan Manuel Torres Palma wrote:
> Cleanup all style warnings and errors in rxtx.c

That's really vague...

Please be very specific, and remember, you can only fix one "type of
thing" per patch, and no, "all style warnings and errors" is not a
single type of thing :)

thanks,

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


[PATCH] staging: media: cxd2099: Use __func__ macro in messages

2017-05-09 Thread Alexandre Ghiti
Replace hardcoded function names in print info with __func__.

Signed-off-by: Alexandre Ghiti 
---
 drivers/staging/media/cxd2099/cxd2099.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/media/cxd2099/cxd2099.c 
b/drivers/staging/media/cxd2099/cxd2099.c
index 18186d0..370ecb9 100644
--- a/drivers/staging/media/cxd2099/cxd2099.c
+++ b/drivers/staging/media/cxd2099/cxd2099.c
@@ -473,7 +473,7 @@ static int slot_shutdown(struct dvb_ca_en50221 *ca, int 
slot)
 {
struct cxd *ci = ca->data;
 
-   dev_info(>i2c->dev, "slot_shutdown\n");
+   dev_info(>i2c->dev, "%s\n", __func__);
mutex_lock(>lock);
write_regm(ci, 0x09, 0x08, 0x08);
write_regm(ci, 0x20, 0x80, 0x80); /* Reset CAM Mode */
@@ -564,7 +564,7 @@ static int read_data(struct dvb_ca_en50221 *ca, int slot, 
u8 *ebuf, int ecount)
campoll(ci);
mutex_unlock(>lock);
 
-   dev_info(>i2c->dev, "read_data\n");
+   dev_info(>i2c->dev, "%s\n", __func__);
if (!ci->dr)
return 0;
 
@@ -584,7 +584,7 @@ static int write_data(struct dvb_ca_en50221 *ca, int slot, 
u8 *ebuf, int ecount)
struct cxd *ci = ca->data;
 
mutex_lock(>lock);
-   dev_info(>i2c->dev, "write_data %d\n", ecount);
+   dev_info(>i2c->dev, "%s %d\n", __func__, ecount);
write_reg(ci, 0x0d, ecount >> 8);
write_reg(ci, 0x0e, ecount & 0xff);
write_block(ci, 0x11, ebuf, ecount);
-- 
2.1.4

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


[PATCH] staging: vt6656: fix style

2017-05-09 Thread Juan Manuel Torres Palma
Cleanup all style warnings and errors in rxtx.c

Signed-off-by: Juan Manuel Torres Palma 
---
 drivers/staging/vt6656/rxtx.c | 50 +++
 1 file changed, 27 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 1835cd13ef49..bf860484b3e3 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -114,7 +114,7 @@ static __le16 vnt_time_stamp_off(struct vnt_private *priv, 
u16 rate)
 }
 
 static u32 vnt_get_rsvtime(struct vnt_private *priv, u8 pkt_type,
-   u32 frame_length, u16 rate, int need_ack)
+  u32 frame_length, u16 rate, int need_ack)
 {
u32 data_time, ack_time;
 
@@ -122,11 +122,13 @@ static u32 vnt_get_rsvtime(struct vnt_private *priv, u8 
pkt_type,
   frame_length, rate);
 
if (pkt_type == PK_TYPE_11B)
-   ack_time = vnt_get_frame_time(priv->preamble_type, pkt_type,
- 14, 
(u16)priv->top_cck_basic_rate);
+   ack_time = vnt_get_frame_time(priv->preamble_type,
+ pkt_type, 14,
+ (u16)priv->top_cck_basic_rate);
else
-   ack_time = vnt_get_frame_time(priv->preamble_type, pkt_type,
- 14, 
(u16)priv->top_ofdm_basic_rate);
+   ack_time = vnt_get_frame_time(priv->preamble_type,
+ pkt_type, 14,
+ (u16)priv->top_ofdm_basic_rate);
 
if (need_ack)
return data_time + priv->sifs + ack_time;
@@ -135,14 +137,15 @@ static u32 vnt_get_rsvtime(struct vnt_private *priv, u8 
pkt_type,
 }
 
 static __le16 vnt_rxtx_rsvtime_le16(struct vnt_private *priv, u8 pkt_type,
-u32 frame_length, u16 rate, int need_ack)
+   u32 frame_length, u16 rate, int need_ack)
 {
return cpu_to_le16((u16)vnt_get_rsvtime(priv, pkt_type,
frame_length, rate, need_ack));
 }
 
-static __le16 vnt_get_rtscts_rsvtime_le(struct vnt_private *priv,
-u8 rsv_type, u8 pkt_type, u32 
frame_length, u16 current_rate)
+static __le16 vnt_get_rtscts_rsvtime_le(struct vnt_private *priv, u8 rsv_type,
+   u8 pkt_type, u32 frame_length,
+   u16 current_rate)
 {
u32 rrv_time, rts_time, cts_time, ack_time, data_time;
 
@@ -157,22 +160,22 @@ static __le16 vnt_get_rtscts_rsvtime_le(struct 
vnt_private *priv,
cts_time = ack_time = vnt_get_frame_time(priv->preamble_type,
pkt_type, 14, priv->top_cck_basic_rate);
} else if (rsv_type == 1) {
-   rts_time = vnt_get_frame_time(priv->preamble_type,
-   pkt_type, 20, priv->top_cck_basic_rate);
+   rts_time = vnt_get_frame_time(priv->preamble_type, pkt_type,
+ 20, priv->top_cck_basic_rate);
cts_time = vnt_get_frame_time(priv->preamble_type, pkt_type,
- 14, priv->top_cck_basic_rate);
+ 14, priv->top_cck_basic_rate);
ack_time = vnt_get_frame_time(priv->preamble_type, pkt_type,
- 14, priv->top_ofdm_basic_rate);
+ 14, priv->top_ofdm_basic_rate);
} else if (rsv_type == 2) {
rts_time = vnt_get_frame_time(priv->preamble_type, pkt_type,
- 20, priv->top_ofdm_basic_rate);
+ 20, priv->top_ofdm_basic_rate);
cts_time = ack_time = vnt_get_frame_time(priv->preamble_type,
pkt_type, 14, priv->top_ofdm_basic_rate);
} else if (rsv_type == 3) {
cts_time = vnt_get_frame_time(priv->preamble_type, pkt_type,
- 14, priv->top_cck_basic_rate);
+ 14, priv->top_cck_basic_rate);
ack_time = vnt_get_frame_time(priv->preamble_type, pkt_type,
- 14, priv->top_ofdm_basic_rate);
+ 14, priv->top_ofdm_basic_rate);
 
rrv_time = cts_time + ack_time + data_time + 2 * priv->sifs;
 
@@ -227,7 +230,8 @@ static __le16 vnt_get_rtscts_duration_le(struct 
vnt_usb_send_context *context,
case RTSDUR_AA_F0:
case RTSDUR_AA_F1:
cts_time = vnt_get_frame_time(priv->preamble_type,
- pkt_type, 14, 

[patch 0/1] staging: speakup: flush tty buffers and ensure hardware flow control

2017-05-09 Thread okash . khawaja
Hi,

This patch applies on top of previous patchset which migrates synths to TTY 
[1]. It fixes couple of issues and tries to ensure hardware flow control is 
enabled.

Thanks,
Okash

[1] https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1387738.html
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[patch 1/1] staging: speakup: flush tty buffers and ensure hardware flow control

2017-05-09 Thread okash . khawaja
This patch fixes the issue where TTY-migrated synths would take a while to shut 
up after hitting numpad enter key. When calling synth_flush, even though XOFF 
character is sent as high priority, data buffered in TTY layer is still sent to 
the synth. This patch flushes that buffered data when synth_flush is called.

It also tries to ensure that hardware flow control is enabled, by setting 
CRTSCTS using tty's termios.

Reported-by: John Covici 
Signed-off-by: Okash Khawaja 
Reviewed-by: Samuel Thibault 

Index: linux-staging/drivers/staging/speakup/serialio.c
===
--- linux-staging.orig/drivers/staging/speakup/serialio.c
+++ linux-staging/drivers/staging/speakup/serialio.c
@@ -30,6 +30,7 @@
 static void spk_serial_tiocmset(unsigned int set, unsigned int clear);
 static unsigned char spk_serial_in(void);
 static unsigned char spk_serial_in_nowait(void);
+static void spk_serial_flush_buffer(void);
 
 struct spk_io_ops spk_serial_io_ops = {
.synth_out = spk_serial_out,
@@ -37,6 +38,7 @@
.tiocmset = spk_serial_tiocmset,
.synth_in = spk_serial_in,
.synth_in_nowait = spk_serial_in_nowait,
+   .flush_buffer = spk_serial_flush_buffer,
 };
 EXPORT_SYMBOL_GPL(spk_serial_io_ops);
 
@@ -268,6 +270,11 @@
return inb_p(speakup_info.port_tts + UART_RX);
 }
 
+static void spk_serial_flush_buffer(void)
+{
+   /* TODO: flush the UART 16550 buffer */
+}
+
 static int spk_serial_out(struct spk_synth *in_synth, const char ch)
 {
if (in_synth->alive && spk_wait_for_xmitr(in_synth)) {
Index: linux-staging/drivers/staging/speakup/spk_ttyio.c
===
--- linux-staging.orig/drivers/staging/speakup/spk_ttyio.c
+++ linux-staging/drivers/staging/speakup/spk_ttyio.c
@@ -85,6 +85,7 @@
 static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear);
 static unsigned char spk_ttyio_in(void);
 static unsigned char spk_ttyio_in_nowait(void);
+static void spk_ttyio_flush_buffer(void);
 
 struct spk_io_ops spk_ttyio_ops = {
.synth_out = spk_ttyio_out,
@@ -92,6 +93,7 @@
.tiocmset = spk_ttyio_tiocmset,
.synth_in = spk_ttyio_in,
.synth_in_nowait = spk_ttyio_in_nowait,
+   .flush_buffer = spk_ttyio_flush_buffer,
 };
 EXPORT_SYMBOL_GPL(spk_ttyio_ops);
 
@@ -99,6 +101,7 @@
 {
int ret = 0;
struct tty_struct *tty;
+   struct ktermios tmp_termios;
 
ret = tty_register_ldisc(N_SPEAKUP, _ttyio_ldisc_ops);
if (ret) {
@@ -127,6 +130,18 @@
}
 
clear_bit(TTY_HUPPED, >flags);
+   /* ensure hardware flow control is enabled */
+   down_read(>termios_rwsem);
+   tmp_termios = tty->termios;
+   up_read(>termios_rwsem);
+
+   if (!(tmp_termios.c_cflag & CRTSCTS)) {
+   tmp_termios.c_cflag |= CRTSCTS;
+   ret = tty_set_termios(tty, _termios);
+   if (ret)
+   pr_warn("speakup: Failed to set hardware flow 
control\n");
+   }
+
tty_unlock(tty);
 
ret = tty_set_ldisc(tty, N_SPEAKUP);
@@ -201,6 +216,11 @@
return (rv == 0xff) ? 0 : rv;
 }
 
+static void spk_ttyio_flush_buffer(void)
+{
+   speakup_tty->ops->flush_buffer(speakup_tty);
+}
+
 int spk_ttyio_synth_probe(struct spk_synth *synth)
 {
int rv = spk_ttyio_initialise_ldisc(synth->ser);
Index: linux-staging/drivers/staging/speakup/spk_types.h
===
--- linux-staging.orig/drivers/staging/speakup/spk_types.h
+++ linux-staging/drivers/staging/speakup/spk_types.h
@@ -154,6 +154,7 @@
void (*tiocmset)(unsigned int set, unsigned int clear);
unsigned char (*synth_in)(void);
unsigned char (*synth_in_nowait)(void);
+   void (*flush_buffer)(void);
 };
 
 struct spk_synth {
Index: linux-staging/drivers/staging/speakup/speakup_audptr.c
===
--- linux-staging.orig/drivers/staging/speakup/speakup_audptr.c
+++ linux-staging/drivers/staging/speakup/speakup_audptr.c
@@ -127,6 +127,7 @@
 
 static void synth_flush(struct spk_synth *synth)
 {
+   synth->io_ops->flush_buffer();
synth->io_ops->send_xchar(SYNTH_CLEAR);
synth->io_ops->synth_out(synth, PROCSPEECH);
 }
Index: linux-staging/drivers/staging/speakup/speakup_decext.c
===
--- linux-staging.orig/drivers/staging/speakup/speakup_decext.c
+++ linux-staging/drivers/staging/speakup/speakup_decext.c
@@ -221,6 +221,7 @@
 static void synth_flush(struct spk_synth *synth)
 {
in_escape = 0;
+   synth->io_ops->flush_buffer();
synth->synth_immediate(synth, "\033P;10z\033\\");
 }
 
Index: linux-staging/drivers/staging/speakup/speakup_dectlk.c

[PATCH] staging: wlan-ng: prism2mgmt.c: fixed a double endian conversion before calling hfa384x_drvr_setconfig16, also fixes relative sparse warning

2017-05-09 Thread Andrea della Porta
staging: wlan-ng: prism2mgmt.c: This patches fixes a double endian conversion.
cpu_to_le16() was called twice first in prism2mgmt_scan and again inside
hfa384x_drvr_setconfig16() for the same variable, hence it was swapped
twice. Incidentally, it also fixed the following sparse warning:

drivers/staging/wlan-ng/prism2mgmt.c:173:30: warning: incorrect type in 
assignment (different base types)
drivers/staging/wlan-ng/prism2mgmt.c:173:30:expected unsigned short 
[unsigned] [usertype] word
drivers/staging/wlan-ng/prism2mgmt.c:173:30:got restricted __le16 
[usertype] 

Unfortunately, only compile tested.

Signed-off-by: Andrea della Porta 
---
 drivers/staging/wlan-ng/prism2mgmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wlan-ng/prism2mgmt.c 
b/drivers/staging/wlan-ng/prism2mgmt.c
index e23a0d0..f4d6e48 100644
--- a/drivers/staging/wlan-ng/prism2mgmt.c
+++ b/drivers/staging/wlan-ng/prism2mgmt.c
@@ -170,7 +170,7 @@ int prism2mgmt_scan(struct wlandevice *wlandev, void *msgp)
 hw->ident_sta_fw.variant) >
HFA384x_FIRMWARE_VERSION(1, 5, 0)) {
if (msg->scantype.data != P80211ENUM_scantype_active)
-   word = cpu_to_le16(msg->maxchanneltime.data);
+   word = msg->maxchanneltime.data;
else
word = 0;
 
-- 
2.4.10

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


Re: [PATCH 2/2] staging: ccree: Fix initialization of anonymous unions

2017-05-09 Thread Gilad Ben-Yossef
Hi,

On Sun, May 7, 2017 at 10:53 PM, Geert Uytterhoeven
 wrote:
> With gcc 4.1.2:
>
> drivers/staging/ccree/ssi_hash.c:1990: error: unknown field 
> ‘template_ahash’ specified in initializer
> drivers/staging/ccree/ssi_hash.c:1991: error: unknown field ‘init’ 
> specified in initializer
> drivers/staging/ccree/ssi_hash.c:1991: warning: missing braces around 
> initializer
> drivers/staging/ccree/ssi_hash.c:1991: warning: (near initialization for 
> ‘driver_hash[0]..template_ahash’)
> drivers/staging/ccree/ssi_hash.c:1992: error: unknown field ‘update’ 
> specified in initializer
> drivers/staging/ccree/ssi_hash.c:1992: warning: excess elements in union 
> initializer
> ...
>
> Add missing braces to fix this.
> After this it compiles without warnings with gcc 4.1.2 and 4.9.0.

It seems this bothered Andrew Morton too as he just took in to mm his
own patch for the same issue,

Thanks anyway!
Gilad

-- 
Gilad Ben-Yossef
Chief Coffee Drinker

"If you take a class in large-scale robotics, can you end up in a
situation where the homework eats your dog?"
 -- Jean-Baptiste Queru
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: rtl8192u: Fix type mismatch warnings reported by sparse

2017-05-09 Thread suniel . spartan
From: Suniel Mahesh 

The function Mk16_le() is calling le16_to_cpu()
internally. le16_to_cpu() takes an argument of type (__le *)
but the argument passed is of type (u16 *). Fixed it by passing
the correct argument type.

Signed-off-by: Suniel Mahesh 
---
 .../rtl8192u/ieee80211/ieee80211_crypt_tkip.c  | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
index 5039172..11ddf30 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
@@ -172,7 +172,7 @@ static inline u16 Mk16(u8 hi, u8 lo)
 }
 
 
-static inline u16 Mk16_le(u16 *v)
+static inline u16 Mk16_le(__le16 *v)
 {
return le16_to_cpu(*v);
 }
@@ -264,15 +264,15 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, 
const u16 *TTAK,
PPK[5] = TTAK[4] + IV16;
 
/* Step 2 - 96-bit bijective mixing using S-box */
-   PPK[0] += _S_(PPK[5] ^ Mk16_le((u16 *) [0]));
-   PPK[1] += _S_(PPK[0] ^ Mk16_le((u16 *) [2]));
-   PPK[2] += _S_(PPK[1] ^ Mk16_le((u16 *) [4]));
-   PPK[3] += _S_(PPK[2] ^ Mk16_le((u16 *) [6]));
-   PPK[4] += _S_(PPK[3] ^ Mk16_le((u16 *) [8]));
-   PPK[5] += _S_(PPK[4] ^ Mk16_le((u16 *) [10]));
-
-   PPK[0] += RotR1(PPK[5] ^ Mk16_le((u16 *) [12]));
-   PPK[1] += RotR1(PPK[0] ^ Mk16_le((u16 *) [14]));
+   PPK[0] += _S_(PPK[5] ^ Mk16_le((__le16 *)[0]));
+   PPK[1] += _S_(PPK[0] ^ Mk16_le((__le16 *)[2]));
+   PPK[2] += _S_(PPK[1] ^ Mk16_le((__le16 *)[4]));
+   PPK[3] += _S_(PPK[2] ^ Mk16_le((__le16 *)[6]));
+   PPK[4] += _S_(PPK[3] ^ Mk16_le((__le16 *)[8]));
+   PPK[5] += _S_(PPK[4] ^ Mk16_le((__le16 *)[10]));
+
+   PPK[0] += RotR1(PPK[5] ^ Mk16_le((__le16 *)[12]));
+   PPK[1] += RotR1(PPK[0] ^ Mk16_le((__le16 *)[14]));
PPK[2] += RotR1(PPK[1]);
PPK[3] += RotR1(PPK[2]);
PPK[4] += RotR1(PPK[3]);
@@ -285,7 +285,7 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, 
const u16 *TTAK,
WEPSeed[0] = Hi8(IV16);
WEPSeed[1] = (Hi8(IV16) | 0x20) & 0x7F;
WEPSeed[2] = Lo8(IV16);
-   WEPSeed[3] = Lo8((PPK[5] ^ Mk16_le((u16 *) [0])) >> 1);
+   WEPSeed[3] = Lo8((PPK[5] ^ Mk16_le((__le16 *)[0])) >> 1);
 
 #ifdef __BIG_ENDIAN
{
-- 
1.9.1

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


Re: [PATCH v4] staging: lustre: llite: Fix variable length array warning

2017-05-09 Thread Guru Das Srinagesh
On Tue, May 09, 2017 at 11:31:36AM +0300, Dan Carpenter wrote:
> Just ignore the warning.
> 
Thank you for your comments on this patch.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: typec: Make undeclared symbol static

2017-05-09 Thread Guru Das Srinagesh
Fix sparse warning:
  drivers/staging/typec/tcpci.c:428:26: warning: symbol 'tcpci_tcpc_config'
  was not declared. Should it be static?

Signed-off-by: Guru Das Srinagesh 
---
 drivers/staging/typec/tcpci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c
index 5e5be74..df72d8b 100644
--- a/drivers/staging/typec/tcpci.c
+++ b/drivers/staging/typec/tcpci.c
@@ -425,7 +425,7 @@ static const struct regmap_config tcpci_regmap_config = {
.max_register = 0x7F, /* 0x80 .. 0xFF are vendor defined */
 };
 
-const struct tcpc_config tcpci_tcpc_config = {
+static const struct tcpc_config tcpci_tcpc_config = {
.type = TYPEC_PORT_DFP,
.default_role = TYPEC_SINK,
 };
-- 
2.7.4

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


Re: [PATCH v4] staging: lustre: llite: Fix variable length array warning

2017-05-09 Thread Dan Carpenter
This patch introduces tons of memory leaks so we can't apply it.

Just ignore the warning.  The size is small enough that it won't
overflow the stack.  The other reason to avoid these types of
declarations is that in olden times (5 years ago at least) there was a
GCC for an arch where if you declared the variable inside a loop it
would not free the memory until after the end of the loop.

while ((foo = frob())) {
int whatver[x + y];
}

The memory would keep increasing until we broke from the loop or it
overflowed the stack and crashed.

On Mon, May 08, 2017 at 11:57:16PM -0700, Guru Das Srinagesh wrote:
> Fix sparse warning "warning: Variable length array is used." by using
> kmalloc_array to allocate the required amount of memory instead and
> kfree to deallocate memory after use.
> 
> Signed-off-by: Guru Das Srinagesh 
> ---
>  v4:
>- Changed kmalloc_array flags from GFP_KERNEL to GFP_ATOMIC
> 
>  v3:
>- Fixed checkpatch warning: Comparison to NULL could be written "!fullname"
> 
>  v2:
>- Added missing check for NULL return value of kmalloc_array()
> 
>  drivers/staging/lustre/lustre/llite/xattr.c | 23 +++
>  1 file changed, 19 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lustre/llite/xattr.c 
> b/drivers/staging/lustre/lustre/llite/xattr.c
> index 6187bff..ae2efd5 100644
> --- a/drivers/staging/lustre/lustre/llite/xattr.c
> +++ b/drivers/staging/lustre/lustre/llite/xattr.c
> @@ -86,13 +86,17 @@ ll_xattr_set_common(const struct xattr_handler *handler,
>   const char *name, const void *value, size_t size,
>   int flags)
>  {
> - char fullname[strlen(handler->prefix) + strlen(name) + 1];
> + int fullname_len = strlen(handler->prefix) + strlen(name) + 1;
> + char *fullname = kmalloc_array(fullname_len, sizeof(char), GFP_ATOMIC);

Using kmalloc_array() is pointless.  Everyone knows that sizeof(char) is
1 and also that 1 * x == x.  It just makes the code more confusing and
complicated for no reason.  Don't hide the allocation this declaration
block.  It should be next to the check for NULL.  But anyway, don't
bother resending, just ignore the warning.

regards,
dan carpenter

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


Re: [PATCH] staging : rtl8188eu : remove unnecessary else

2017-05-09 Thread Dan Carpenter
On Mon, May 08, 2017 at 02:13:00PM +0530, Surender Polsani wrote:
> according to coding style else is not generally
> useful after a break or return
> 
> Signed-off-by: Surender Polsani 
> ---
>  drivers/staging/rtl8188eu/hal/rtl8188e_dm.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_dm.c 
> b/drivers/staging/rtl8188eu/hal/rtl8188e_dm.c
> index d04b7fb..7420f55 100644
> --- a/drivers/staging/rtl8188eu/hal/rtl8188e_dm.c
> +++ b/drivers/staging/rtl8188eu/hal/rtl8188e_dm.c
> @@ -212,8 +212,7 @@ u8 rtw_hal_antdiv_before_linked(struct adapter *Adapter)
>  
>   rtw_antenna_select_cmd(Adapter, dm_swat_tbl->CurAntenna, false);
>   return true;
> - } else {
> + }
>   dm_swat_tbl->SWAS_NoLink_State = 0;
>   return false;
> - }

Nope.

I think you really need to learn C programming before you send any more
patches.

regards,
dan carpenter

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


Re: [PATCH 1/3] staging: iio: meter: Add the comment for mutex definition

2017-05-09 Thread Dan Carpenter
On Mon, May 08, 2017 at 10:00:37PM -0400, Harinath Nampally wrote:
> This patch fixes below checkpatch.pl warning:
> CHECK: struct mutex definition without comment
> 
> Signed-off-by: Harinath Nampally 
> ---
>  drivers/staging/iio/meter/ade7753.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/iio/meter/ade7753.c 
> b/drivers/staging/iio/meter/ade7753.c
> index b71fbd3..cffe6bf 100644
> --- a/drivers/staging/iio/meter/ade7753.c
> +++ b/drivers/staging/iio/meter/ade7753.c
> @@ -78,12 +78,13 @@
>  /**
>   * struct ade7753_state - device instance specific data
>   * @us: actual spi_device
> + * @buf_lock:   mutex to protect tx and rx
>   * @tx: transmit buffer
>   * @rx: receive buffer
> - * @buf_lock:   mutex to protect tx and rx
>   **/
>  struct ade7753_state {
>   struct spi_device   *us;
> + /* mutex to protect tx and rx */

Not aligned.  We don't need two duplicate comments anyway.

>   struct mutexbuf_lock;

regards,
dan carpenter

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


[PATCH v4] staging: lustre: llite: Fix variable length array warning

2017-05-09 Thread Guru Das Srinagesh
Fix sparse warning "warning: Variable length array is used." by using
kmalloc_array to allocate the required amount of memory instead and
kfree to deallocate memory after use.

Signed-off-by: Guru Das Srinagesh 
---
 v4:
   - Changed kmalloc_array flags from GFP_KERNEL to GFP_ATOMIC

 v3:
   - Fixed checkpatch warning: Comparison to NULL could be written "!fullname"

 v2:
   - Added missing check for NULL return value of kmalloc_array()

 drivers/staging/lustre/lustre/llite/xattr.c | 23 +++
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/xattr.c 
b/drivers/staging/lustre/lustre/llite/xattr.c
index 6187bff..ae2efd5 100644
--- a/drivers/staging/lustre/lustre/llite/xattr.c
+++ b/drivers/staging/lustre/lustre/llite/xattr.c
@@ -86,13 +86,17 @@ ll_xattr_set_common(const struct xattr_handler *handler,
const char *name, const void *value, size_t size,
int flags)
 {
-   char fullname[strlen(handler->prefix) + strlen(name) + 1];
+   int fullname_len = strlen(handler->prefix) + strlen(name) + 1;
+   char *fullname = kmalloc_array(fullname_len, sizeof(char), GFP_ATOMIC);
struct ll_sb_info *sbi = ll_i2sbi(inode);
struct ptlrpc_request *req = NULL;
const char *pv = value;
__u64 valid;
int rc;
 
+   if (!fullname)
+   return -ENOMEM;
+
if (flags == XATTR_REPLACE) {
ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_REMOVEXATTR, 1);
valid = OBD_MD_FLXATTRRM;
@@ -153,6 +157,9 @@ ll_xattr_set_common(const struct xattr_handler *handler,
}
 
ptlrpc_req_finished(req);
+
+   kfree(fullname);
+
return 0;
 }
 
@@ -363,13 +370,17 @@ static int ll_xattr_get_common(const struct xattr_handler 
*handler,
   struct dentry *dentry, struct inode *inode,
   const char *name, void *buffer, size_t size)
 {
-   char fullname[strlen(handler->prefix) + strlen(name) + 1];
+   int fullname_len = strlen(handler->prefix) + strlen(name) + 1;
+   char *fullname = kmalloc_array(fullname_len, sizeof(char), GFP_ATOMIC);
struct ll_sb_info *sbi = ll_i2sbi(inode);
 #ifdef CONFIG_FS_POSIX_ACL
struct ll_inode_info *lli = ll_i2info(inode);
 #endif
int rc;
 
+   if (!fullname)
+   return -ENOMEM;
+
CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p)\n",
   PFID(ll_inode2fid(inode)), inode);
 
@@ -411,8 +422,12 @@ static int ll_xattr_get_common(const struct xattr_handler 
*handler,
return -ENODATA;
 #endif
sprintf(fullname, "%s%s\n", handler->prefix, name);
-   return ll_xattr_list(inode, fullname, handler->flags, buffer, size,
-OBD_MD_FLXATTR);
+
+   rc = ll_xattr_list(inode, fullname, handler->flags, buffer, size,
+  OBD_MD_FLXATTR);
+   kfree(fullname);
+
+   return rc;
 }
 
 static ssize_t ll_getxattr_lov(struct inode *inode, void *buf, size_t buf_size)
-- 
2.7.4

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