Re: [PATCH 1/9] staging: sm750fb: fix length of lines

2017-05-15 Thread Dan Carpenter
On Sun, May 14, 2017 at 12:42:34AM +0200, Matej Dujava wrote:
> This patch breaks lines that are longer than 80 characters and joins
> together those, that are too short and can be placed at one.
>

The patch basically doesn't match the changelog.

regards,
dan carpenter

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


Re: [PATCH] drivers/staging: refactor dgnc tty registration.

2017-05-15 Thread Dan Carpenter
On Sun, May 14, 2017 at 06:50:24PM +0300, Haim Daniel wrote:
> @@ -129,6 +113,41 @@ static void dgnc_tty_set_termios(struct tty_struct *tty,
>  
>  /* TTY Initialization/Cleanup Functions */
>  
> +static struct tty_driver *__dgnc_tty_register(char *serial_name, uint 
> maxports,

No need for double underscores.

> +   int major, int minor)
> +{
> + int rc;
> + struct tty_driver *drv = tty_alloc_driver(maxports,
> +   TTY_DRIVER_REAL_RAW |
> +   TTY_DRIVER_DYNAMIC_DEV |
> +   TTY_DRIVER_HARDWARE_BREAK);
> + if (IS_ERR(drv))
> + return drv;

Blank line between declaration and code.  Do it like this:

struct tty_driver *drv;
int rc;

drv = tty_alloc_driver(maxports, TTY_DRIVER_REAL_RAW |
 TTY_DRIVER_DYNAMIC_DEV |
 TTY_DRIVER_HARDWARE_BREAK);
if (IS_ERR(drv))
return drv;


Also create a matching dgnc_tty_unregister function that does:

static void dgnc_tty_unregister(struct tty_driver *drv)
{
tty_unregister_driver(drv);
put_tty_driver(drv);
}

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


Re: linux-4.12-rc1/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c:2966: cart before the horse ?

2017-05-15 Thread Dan Carpenter
On Sun, May 14, 2017 at 07:19:50PM +, David Binderman wrote:
> Hello there,
> 
> linux-4.12-rc1/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c:2966]: (style) 
> Array index 'i' is used before limits check.
> 
> Source code is
> 
> while (szLine[i] != '{' && i < strlen(szLine))
> i++;
> 

It wouldn't surprise me if this function was buggy somehow but that's a
false positive. i == strlen() is still within bounds because strlen()
returns the number of characters not counting the NUL terminator.

regards,
dan carpenter


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


[PATCH] staging: vme: Use BIT macro for bit definitions

2017-05-15 Thread Ricardo Silva
Use the BIT(n) macro instead of '(1 << n)' in definitions where the bit
semantics clearly applies.

Fixes true positive "Prefer using the BIT macro" checks reported by
checkpatch.

Some of these checks are still triggering on definitions using
'(1 << n)', namely for PIO2_CNTR_SC_DEV1, PIO2_CNTR_RW_LSB and
PIO2_CNTR_MODE1. Leave them be, as the context there is more of a
"multi-bit field value" ((val << n), where for some cases 'val' happens
to be 1) rather than a "single bit" (1 << n), so keeping the value as is
in the code makes it more readable that using a combination of BIT
macros.

Signed-off-by: Ricardo Silva 
---
 drivers/staging/vme/devices/vme_pio2.h | 80 +-
 1 file changed, 40 insertions(+), 40 deletions(-)

diff --git a/drivers/staging/vme/devices/vme_pio2.h 
b/drivers/staging/vme/devices/vme_pio2.h
index 5577df3199e7..ac4a4bad4091 100644
--- a/drivers/staging/vme/devices/vme_pio2.h
+++ b/drivers/staging/vme/devices/vme_pio2.h
@@ -68,38 +68,38 @@ static const int PIO2_CHANNEL_BANK[32] = { 0, 0, 0, 0, 0, 
0, 0, 0,
2, 2, 2, 2, 2, 2, 2, 2,
3, 3, 3, 3, 3, 3, 3, 3 };
 
-#define PIO2_CHANNEL0_BIT  (1 << 0)
-#define PIO2_CHANNEL1_BIT  (1 << 1)
-#define PIO2_CHANNEL2_BIT  (1 << 2)
-#define PIO2_CHANNEL3_BIT  (1 << 3)
-#define PIO2_CHANNEL4_BIT  (1 << 4)
-#define PIO2_CHANNEL5_BIT  (1 << 5)
-#define PIO2_CHANNEL6_BIT  (1 << 6)
-#define PIO2_CHANNEL7_BIT  (1 << 7)
-#define PIO2_CHANNEL8_BIT  (1 << 0)
-#define PIO2_CHANNEL9_BIT  (1 << 1)
-#define PIO2_CHANNEL10_BIT (1 << 2)
-#define PIO2_CHANNEL11_BIT (1 << 3)
-#define PIO2_CHANNEL12_BIT (1 << 4)
-#define PIO2_CHANNEL13_BIT (1 << 5)
-#define PIO2_CHANNEL14_BIT (1 << 6)
-#define PIO2_CHANNEL15_BIT (1 << 7)
-#define PIO2_CHANNEL16_BIT (1 << 0)
-#define PIO2_CHANNEL17_BIT (1 << 1)
-#define PIO2_CHANNEL18_BIT (1 << 2)
-#define PIO2_CHANNEL19_BIT (1 << 3)
-#define PIO2_CHANNEL20_BIT (1 << 4)
-#define PIO2_CHANNEL21_BIT (1 << 5)
-#define PIO2_CHANNEL22_BIT (1 << 6)
-#define PIO2_CHANNEL23_BIT (1 << 7)
-#define PIO2_CHANNEL24_BIT (1 << 0)
-#define PIO2_CHANNEL25_BIT (1 << 1)
-#define PIO2_CHANNEL26_BIT (1 << 2)
-#define PIO2_CHANNEL27_BIT (1 << 3)
-#define PIO2_CHANNEL28_BIT (1 << 4)
-#define PIO2_CHANNEL29_BIT (1 << 5)
-#define PIO2_CHANNEL30_BIT (1 << 6)
-#define PIO2_CHANNEL31_BIT (1 << 7)
+#define PIO2_CHANNEL0_BIT  BIT(0)
+#define PIO2_CHANNEL1_BIT  BIT(1)
+#define PIO2_CHANNEL2_BIT  BIT(2)
+#define PIO2_CHANNEL3_BIT  BIT(3)
+#define PIO2_CHANNEL4_BIT  BIT(4)
+#define PIO2_CHANNEL5_BIT  BIT(5)
+#define PIO2_CHANNEL6_BIT  BIT(6)
+#define PIO2_CHANNEL7_BIT  BIT(7)
+#define PIO2_CHANNEL8_BIT  BIT(0)
+#define PIO2_CHANNEL9_BIT  BIT(1)
+#define PIO2_CHANNEL10_BIT BIT(2)
+#define PIO2_CHANNEL11_BIT BIT(3)
+#define PIO2_CHANNEL12_BIT BIT(4)
+#define PIO2_CHANNEL13_BIT BIT(5)
+#define PIO2_CHANNEL14_BIT BIT(6)
+#define PIO2_CHANNEL15_BIT BIT(7)
+#define PIO2_CHANNEL16_BIT BIT(0)
+#define PIO2_CHANNEL17_BIT BIT(1)
+#define PIO2_CHANNEL18_BIT BIT(2)
+#define PIO2_CHANNEL19_BIT BIT(3)
+#define PIO2_CHANNEL20_BIT BIT(4)
+#define PIO2_CHANNEL21_BIT BIT(5)
+#define PIO2_CHANNEL22_BIT BIT(6)
+#define PIO2_CHANNEL23_BIT BIT(7)
+#define PIO2_CHANNEL24_BIT BIT(0)
+#define PIO2_CHANNEL25_BIT BIT(1)
+#define PIO2_CHANNEL26_BIT BIT(2)
+#define PIO2_CHANNEL27_BIT BIT(3)
+#define PIO2_CHANNEL28_BIT BIT(4)
+#define PIO2_CHANNEL29_BIT BIT(5)
+#define PIO2_CHANNEL30_BIT BIT(6)
+#define PIO2_CHANNEL31_BIT BIT(7)
 
 static const int PIO2_CHANNEL_BIT[32] = { PIO2_CHANNEL0_BIT, PIO2_CHANNEL1_BIT,
PIO2_CHANNEL2_BIT, PIO2_CHANNEL3_BIT,
@@ -120,12 +120,12 @@ static const int PIO2_CHANNEL_BIT[32] = { 
PIO2_CHANNEL0_BIT, PIO2_CHANNEL1_BIT,
};
 
 /* PIO2_REGS_INT_STAT_CNTR (0xc) */
-#define PIO2_COUNTER0  (1 << 0)
-#define PIO2_COUNTER1  (1 << 1)
-#define PIO2_COUNTER2  (1 << 2)
-#define PIO2_COUNTER3  (1 << 3)
-#define PIO2_COUNTER4  (1 << 4)
-#define PIO2_COUNTER5  (1 << 5)
+#define PIO2_COUNTER0  BIT(0)
+#define PIO2_COUNTER1  

[PATCH] Staging: rtl8723bs: core: rtw_mlme: Fix spelling issues

2017-05-15 Thread Ammly Fredrick
Fixed spelling warnings produced by scripts/checkpatch.pl

Signed-off-by: Ammly Fredrick 
---
 drivers/staging/rtl8723bs/core/rtw_mlme.c | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index 9e355734f0c0..0c07b9b31081 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -249,7 +249,7 @@ void _rtw_free_network_nolock(structmlme_priv 
*pmlmepriv, struct wlan_network *
 /*
return the wlan_network with the matching addr
 
-   Shall be calle under atomic context... to avoid possible racing 
condition...
+   Shall be called under atomic context... to avoid possible racing 
condition...
 */
 struct wlan_network *_rtw_find_network(struct __queue *scanned_queue, u8 *addr)
 {
@@ -412,7 +412,7 @@ void rtw_free_network_queue(struct adapter *dev, u8 
isfreeall)
 /*
return the wlan_network with the matching addr
 
-   Shall be calle under atomic context... to avoid possible racing 
condition...
+   Shall be called under atomic context... to avoid possible racing 
condition...
 */
 struct wlan_network *rtw_find_network(struct __queue *scanned_queue, u8 *addr)
 {
@@ -564,7 +564,7 @@ void update_network(struct wlan_bssid_ex *dst, struct 
wlan_bssid_ex *src,
sq_final = 
((u32)(src->PhyInfo.SignalQuality)+(u32)(dst->PhyInfo.SignalQuality)*4)/5;
rssi_final = (src->Rssi+dst->Rssi*4)/5;
} else {
-   /* bss info not receving from the right channel, use 
the original RX signal infos */
+   /* bss info not receiving from the right channel, use 
the original RX signal infos */
ss_final = dst->PhyInfo.SignalStrength;
sq_final = dst->PhyInfo.SignalQuality;
rssi_final = dst->Rssi;
@@ -680,7 +680,7 @@ void rtw_update_scanned_network(struct adapter *adapter, 
struct wlan_bssid_ex *t
pnetwork->aid = 0;
pnetwork->join_res = 0;
 
-   /* bss info not receving from the right channel */
+   /* bss info not receiving from the right channel */
if (pnetwork->network.PhyInfo.SignalQuality == 101)
pnetwork->network.PhyInfo.SignalQuality = 0;
} else {
@@ -699,7 +699,7 @@ void rtw_update_scanned_network(struct adapter *adapter, 
struct wlan_bssid_ex *t
 
pnetwork->last_scanned = jiffies;
 
-   /* bss info not receving from the right channel */
+   /* bss info not receiving from the right channel */
if (pnetwork->network.PhyInfo.SignalQuality == 101)
pnetwork->network.PhyInfo.SignalQuality = 0;
 
@@ -715,7 +715,7 @@ void rtw_update_scanned_network(struct adapter *adapter, 
struct wlan_bssid_ex *t
 
pnetwork->last_scanned = jiffies;
 
-   /* target.Reserved[0]== 1, means that scaned network is a bcn 
frame. */
+   /* target.Reserved[0]== 1, means that scanned network is a bcn 
frame. */
if ((pnetwork->network.IELength > target->IELength) && 
(target->Reserved[0] == 1))
update_ie = false;
 
@@ -1264,7 +1264,7 @@ static struct sta_info *rtw_joinbss_update_stainfo(struct 
adapter *padapter, str
 
/*  Commented by Albert 2012/07/21 */
/*  When doing the WPS, the wps_ie_len won't equal to 0 */
-   /*  And the Wi-Fi driver shouldn't allow the data packet to 
be tramsmitted. */
+   /*  And the Wi-Fi driver shouldn't allow the data packet to 
be transmitted. */
if (padapter->securitypriv.wps_ie_len != 0) {
psta->ieee8021x_blocked = true;
padapter->securitypriv.wps_ie_len = 0;
@@ -1272,7 +1272,7 @@ static struct sta_info *rtw_joinbss_update_stainfo(struct 
adapter *padapter, str
 
 
/* for A-MPDU Rx reordering buffer control for bmc_sta & 
sta_info */
-   /* if A-MPDU Rx is enabled, reseting  rx_ordering_ctrl 
wstart_b(indicate_seq) to default value = 0x */
+   /* if A-MPDU Rx is enabled, resetting  rx_ordering_ctrl 
wstart_b(indicate_seq) to default value = 0x */
/* todo: check if AP can send A-MPDU packets */
for (i = 0; i < 16 ; i++) {
/* preorder_ctrl = &precvpriv->recvreorder_ctrl[i]; */
@@ -1374,7 +1374,7 @@ static void rtw_joinbss_update_network(struct adapter 
*padapter, struct wlan_net
rtw_update_ht_cap(padapter, cur_network->network.IEs, 
cur_network->network.IELength, (u8) 
cur_network->network.Configuration.DSConfig);
 }
 
-/* Notes: the fucntion could 

Re: [PATCH] staging: vt6656: Break too long lines

2017-05-15 Thread Greg KH
On Sat, May 13, 2017 at 12:30:07AM +0900, Juan Manuel Torres Palma wrote:
> Fix style in rxtx.c splitting lines into 80 characters or less.
> 
> Signed-off-by: Juan Manuel Torres Palma 

_ALWAYS_ test build your patches, so you don't get a grumpy maintainer
telling you to test build your patches... :)

thanks,

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


Re: [PATCH 09/13] staging: most: net: prefer __func__ over the function name

2017-05-15 Thread Greg KH
On Fri, May 12, 2017 at 12:59:57PM +0200, Christian Gromm wrote:
> From: Andrey Shvetsov 
> 
> This replaces the function names in the print messages with the __func__
> macro.
> 
> Signed-off-by: Andrey Shvetsov 
> Signed-off-by: Christian Gromm 
> ---
>  drivers/staging/most/aim-network/networking.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/most/aim-network/networking.c 
> b/drivers/staging/most/aim-network/networking.c
> index e2935cc..36483b9 100644
> --- a/drivers/staging/most/aim-network/networking.c
> +++ b/drivers/staging/most/aim-network/networking.c
> @@ -502,14 +502,14 @@ static int aim_rx_data(struct mbo *mbo)
>  
>  static int __init most_net_init(void)
>  {
> - pr_info("most_net_init()\n");
> + pr_info("%s()\n", __func__);
>   spin_lock_init(&list_lock);
>   return most_register_aim(&aim);
>  }
>  
>  static void __exit most_net_exit(void)
>  {
> - pr_info("most_net_exit()\n");
> + pr_info("%s()\n", __func__);

No, these need to just be deleted entirely, no need to be noisy for no
good reason at all.  If you really need to trace the code, use the
built-in kernel tracing functionality.

thanks,

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


[PATCH 1/2] staging/atomisp: one char read beyond end of string

2017-05-15 Thread Dan Carpenter
We should verify that "ix < max_len" before we test whether we have
reached the NUL terminator.

Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
Reported-by: David Binderman 
Signed-off-by: Dan Carpenter 

diff --git 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h
 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h
index 568631698a3d..74b5a1c7ac9a 100644
--- 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h
+++ 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h
@@ -72,9 +72,8 @@ static size_t strnlen_s(
return 0;
}
 
-   for (ix=0;
-   ((src_str[ix] != '\0') && (ix< max_len));
-   ++ix) /*Nothing else to do*/;
+   for (ix = 0; ix < max_len && src_str[ix] != '\0'; ix++)
+   ;
 
/* On Error, it will return src_size == max_len*/
return ix;
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 11/13] staging: most: net: fix race between create/destroy device

2017-05-15 Thread Greg KH
On Fri, May 12, 2017 at 12:59:59PM +0200, Christian Gromm wrote:
> From: Andrey Shvetsov 
> 
> This introduces the kref for the net_dev_context to prevent the
> destruction of the network devices that are in use.
> 
> Each get_net_dev_context is completed with the put_net_dev_context,
> except the function aim_probe_channel that calls one more
> get_net_dev_context or kref_get and the function aim_disconnect_channel
> that calls one more put_net_dev_context.
> 
> Signed-off-by: Andrey Shvetsov 
> Signed-off-by: Christian Gromm 
> ---
>  drivers/staging/most/aim-network/networking.c | 92 
> +--
>  1 file changed, 72 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/staging/most/aim-network/networking.c 
> b/drivers/staging/most/aim-network/networking.c
> index cbd9500..8cf1c81 100644
> --- a/drivers/staging/most/aim-network/networking.c
> +++ b/drivers/staging/most/aim-network/networking.c
> @@ -21,6 +21,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include "mostcore.h"
>  
>  #define MEP_HDR_LEN 8
> @@ -69,6 +70,7 @@ struct net_dev_context {
>   struct net_dev_channel rx;
>   struct net_dev_channel tx;
>   struct list_head list;
> + struct kref kref;
>  };
>  
>  static struct list_head net_devices = LIST_HEAD_INIT(net_devices);
> @@ -268,6 +270,26 @@ static void most_nd_setup(struct net_device *dev)
>   dev->netdev_ops = &most_nd_ops;
>  }
>  
> +static void release_nd(struct kref *kref)
> +{
> + struct net_dev_context *nd;
> +
> + nd = container_of(kref, struct net_dev_context, kref);
> + list_del(&nd->list);

That might delete something off of the list, but it does not free the
structure itself, where is that handled?

Why do you need a reference count for all of this?  Doesn't the
networking core provide you the needed functions for this?

thanks,

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


Re: [PATCH 1/2] staging/atomisp: one char read beyond end of string

2017-05-15 Thread Dan Carpenter
Oops.  Please ignore this one.  I meant to send it to David Binderman's
thread.

regards,
dan carpenter


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


[PATCH 1/2] staging/atomisp: one char read beyond end of string

2017-05-15 Thread Dan Carpenter
We should verify that "ix < max_len" before we test whether we have
reached the NUL terminator.

Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
Reported-by: David Binderman 
Signed-off-by: Dan Carpenter 

diff --git 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h
 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h
index 568631698a3d..74b5a1c7ac9a 100644
--- 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h
+++ 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h
@@ -72,9 +72,8 @@ static size_t strnlen_s(
return 0;
}
 
-   for (ix=0;
-   ((src_str[ix] != '\0') && (ix< max_len));
-   ++ix) /*Nothing else to do*/;
+   for (ix = 0; ix < max_len && src_str[ix] != '\0'; ix++)
+   ;
 
/* On Error, it will return src_size == max_len*/
return ix;
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2] staging/atomisp: putting NULs in the wrong place

2017-05-15 Thread Dan Carpenter
We're putting the NUL terminators one space beyond where they belong.
This doesn't show up in testing because all but the callers put a NUL in
the correct place themselves.  LOL.  It causes a static checker warning
about buffer overflows.

Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
Signed-off-by: Dan Carpenter 

diff --git 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h
 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h
index 74b5a1c7ac9a..c53241a7a281 100644
--- 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h
+++ 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h
@@ -117,7 +117,7 @@ STORAGE_CLASS_INLINE int strncpy_s(
 
/* dest_str is big enough for the len */
strncpy(dest_str, src_str, len);
-   dest_str[len+1] = '\0';
+   dest_str[len] = '\0';
return 0;
 }
 
@@ -157,7 +157,7 @@ STORAGE_CLASS_INLINE int strcpy_s(
 
/* dest_str is big enough for the len */
strncpy(dest_str, src_str, len);
-   dest_str[len+1] = '\0';
+   dest_str[len] = '\0';
return 0;
 }
 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 1/8] staging: ks7010: avoid CamelCase in fields of struct local_gain_t

2017-05-15 Thread Greg Kroah-Hartman
On Fri, May 12, 2017 at 03:42:36PM +0200, Janusz Lisiecki wrote:
> Replace CamelCase fields of struct with underscores to comply
> with the standard kernel coding style
> 
> Signed-off-by: Janusz Lisiecki 

This patch, and your others in this series, do not apply at all to my
staging-testing branch, can you please rebase them against that branch
and resend them?

thanks,

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


Re: [PATCH] drivers/staging/ccree: Removing trailing whitespaces

2017-05-15 Thread Greg Kroah-Hartman
On Mon, May 15, 2017 at 11:03:40AM +0530, Pushkar Jambhlekar wrote:
> Fixing 'checkpatch.pl' warnings: Trailing whitespaces
> 
> Signed-off-by: Pushkar Jambhlekar 
> ---
>  drivers/staging/ccree/ssi_cipher.c | 110 
> ++---
>  1 file changed, 55 insertions(+), 55 deletions(-)

Doesn't apply to my tree as someone else just did this right before you
did :(

sorry,

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


Re: [PATCH 3/9] staging: sm750fb: reordering of macro definitions

2017-05-15 Thread Greg KH
On Sun, May 14, 2017 at 12:42:36AM +0200, Matej Dujava wrote:
> This patch reorder definition of macros so all macros are in same order.
> 
> Signed-off-by: Matej Dujava 
> ---
>  drivers/staging/sm750fb/ddk750_display.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/sm750fb/ddk750_display.h 
> b/drivers/staging/sm750fb/ddk750_display.h
> index 6f639d7..cef7f46 100644
> --- a/drivers/staging/sm750fb/ddk750_display.h
> +++ b/drivers/staging/sm750fb/ddk750_display.h
> @@ -81,8 +81,8 @@
>  #define DPMS_OFFSET  9
>  #define DPMS_MASK(3 << DPMS_OFFSET)
>  #define DPMS_USAGE   (DPMS_MASK << 16)
> -#define DPMS_OFF ((3 << DPMS_OFFSET) | DPMS_USAGE)
>  #define DPMS_ON  ((0 << DPMS_OFFSET) | DPMS_USAGE)
> +#define DPMS_OFF ((3 << DPMS_OFFSET) | DPMS_USAGE)

What "order" are you speaking of here?

I don't understand why this change is needed, sorry.

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


Re: [PATCH 2/2] staging/atomisp: putting NULs in the wrong place

2017-05-15 Thread walter harms


Am 15.05.2017 12:01, schrieb Dan Carpenter:
> We're putting the NUL terminators one space beyond where they belong.
> This doesn't show up in testing because all but the callers put a NUL in
> the correct place themselves.  LOL.  It causes a static checker warning
> about buffer overflows.
> 
> Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
> Signed-off-by: Dan Carpenter 
> 
> diff --git 
> a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h
>  
> b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h
> index 74b5a1c7ac9a..c53241a7a281 100644
> --- 
> a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h
> +++ 
> b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h
> @@ -117,7 +117,7 @@ STORAGE_CLASS_INLINE int strncpy_s(
>  
>   /* dest_str is big enough for the len */
>   strncpy(dest_str, src_str, len);
> - dest_str[len+1] = '\0';
> + dest_str[len] = '\0';
>   return 0;
>  }
>  
> @@ -157,7 +157,7 @@ STORAGE_CLASS_INLINE int strcpy_s(
>  
>   /* dest_str is big enough for the len */
>   strncpy(dest_str, src_str, len);
> - dest_str[len+1] = '\0';
> + dest_str[len] = '\0';
>   return 0;
>  }
>  

can this strcpy_s() replaced with strlcpy ?

re,
 wh


> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 4/9] staging: sm750fb: removing unnecessary binary operations

2017-05-15 Thread Greg KH
On Sun, May 14, 2017 at 12:42:37AM +0200, Matej Dujava wrote:
> This patch remove unnecessary operation (eg. ``X | (0x0 << Y)`` to ``X``).
> 
> Signed-off-by: Matej Dujava 
> ---
>  drivers/staging/sm750fb/ddk750_display.h | 32 
> 
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/staging/sm750fb/ddk750_display.h 
> b/drivers/staging/sm750fb/ddk750_display.h
> index cef7f46..f9e1614 100644
> --- a/drivers/staging/sm750fb/ddk750_display.h
> +++ b/drivers/staging/sm750fb/ddk750_display.h
> @@ -9,8 +9,8 @@
>  #define PNL_2_OFFSET 0
>  #define PNL_2_MASK   (3 << PNL_2_OFFSET)
>  #define PNL_2_USAGE  (PNL_2_MASK << 16)
> -#define PNL_2_PRI((0 << PNL_2_OFFSET) | PNL_2_USAGE)
> -#define PNL_2_SEC((2 << PNL_2_OFFSET) | PNL_2_USAGE)
> +#define PNL_2_PRI(PNL_2_USAGE)
> +#define PNL_2_SEC(PNL_2_USAGE | (2 << PNL_2_OFFSET))

But the original makes more sense to read, don't you think so?

thanks,

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


Re: [PATCH 0/9] staging: sm750fb: cleaning code

2017-05-15 Thread Greg KH
On Sun, May 14, 2017 at 12:42:33AM +0200, Matej Dujava wrote:
> Folowing patches are cleaning some warnings and checkups from checkpatch.pl

I've only reviewed a few of these, please fix them up based on the
comments you have received so far and resend.

thanks,

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


Re: [PATCH 2/2] staging/atomisp: putting NULs in the wrong place

2017-05-15 Thread Dan Carpenter
On Mon, May 15, 2017 at 12:21:45PM +0200, walter harms wrote:
> can this strcpy_s() replaced with strlcpy ?
> 

These functions obviously should be removed, yes.  Please send a patch
for that and we can drop my patches.  Give David reported-by credit.

regards,
dan carpenter

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


Re: [patch 2/6] tty: export tty_open_by_driver

2017-05-15 Thread Greg Kroah-Hartman
On Sat, Apr 29, 2017 at 08:52:59PM +0100, Okash Khawaja wrote:
> This applies on top of the changes already in staging-next branch which allow
> kernel access to TTY dev.
> 
> Signe-doff-by: Okash Khawaja 
> Reviewed-by: Samuel Thibault 
> 
> Index: linux-staging/drivers/tty/tty_io.c
> ===
> --- linux-staging.orig/drivers/tty/tty_io.c
> +++ linux-staging/drivers/tty/tty_io.c
> @@ -1369,7 +1369,10 @@ static struct tty_struct *tty_driver_loo
>   struct tty_struct *tty;
>  
>   if (driver->ops->lookup)
> - tty = driver->ops->lookup(driver, file, idx);
> + if (!file)
> + tty = ERR_PTR(-EIO);
> + else
> + tty = driver->ops->lookup(driver, file, idx);

Why make this change?  Shouldn't the lookup function allow a NULL file
pointer?  Or is the problem that they do not?

>   else
>   tty = driver->ttys[idx];
>  
> @@ -2001,7 +2004,7 @@ static struct tty_driver *tty_lookup_dri
>   struct tty_driver *console_driver = console_device(index);
>   if (console_driver) {
>   driver = tty_driver_kref_get(console_driver);
> - if (driver) {
> + if (driver && filp) {

Why change this too?

Your changelog does not explain any of this, please do so.

thanks,

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


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

2017-05-15 Thread Greg Kroah-Hartman
On Fri, May 12, 2017 at 08:43:58PM +0100, Okash Khawaja wrote:
> 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 

Doesn't apply as I didn't take your full series.  Please resend it with
that series fixed up.

thanks,

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


Re: [PATCH] staging: vt6656: Break too long lines

2017-05-15 Thread Greg KH
On Sat, May 13, 2017 at 07:45:28AM +0900, Juan Manuel Torres Palma wrote:
> Fix style in rxtx.c splitting lines into 80 characters or less.
> 
> Signed-off-by: Juan Manuel Torres Palma 
> ---
>  drivers/staging/vt6656/rxtx.c | 20 
>  1 file changed, 12 insertions(+), 8 deletions(-)

This patch does not apply to my tree :(

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


Re: [PATCH v2] staging: rtl8188eu: fix indentation error

2017-05-15 Thread Greg Kroah-Hartman
On Fri, May 12, 2017 at 06:39:44PM -0700, Remco Verhoef wrote:
> Fixes a 'code indent should use tabs where possible' checkpatch code
> style error by changing whitespace into tabs.
> 
> Signed-off-by: Remco Verhoef 
> ---
> Changes in v2:
>   - More expressive commit message and subject
> 
>  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)

Try putting this right under the other "struct" string, to line things
up better.

thanks,

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


Re: [patch 2/6] tty: export tty_open_by_driver

2017-05-15 Thread Okash Khawaja
Hi,

On Mon, May 15, 2017 at 11:31 AM, Greg Kroah-Hartman
 wrote:
> On Sat, Apr 29, 2017 at 08:52:59PM +0100, Okash Khawaja wrote:
>> This applies on top of the changes already in staging-next branch which allow
>> kernel access to TTY dev.
>>
>> Signe-doff-by: Okash Khawaja 
>> Reviewed-by: Samuel Thibault 
>>
>> Index: linux-staging/drivers/tty/tty_io.c
>> ===
>> --- linux-staging.orig/drivers/tty/tty_io.c
>> +++ linux-staging/drivers/tty/tty_io.c
>> @@ -1369,7 +1369,10 @@ static struct tty_struct *tty_driver_loo
>>   struct tty_struct *tty;
>>
>>   if (driver->ops->lookup)
>> - tty = driver->ops->lookup(driver, file, idx);
>> + if (!file)
>> + tty = ERR_PTR(-EIO);
>> + else
>> + tty = driver->ops->lookup(driver, file, idx);
>
> Why make this change?  Shouldn't the lookup function allow a NULL file
> pointer?  Or is the problem that they do not?
>
>>   else
>>   tty = driver->ttys[idx];
>>
>> @@ -2001,7 +2004,7 @@ static struct tty_driver *tty_lookup_dri
>>   struct tty_driver *console_driver = console_device(index);
>>   if (console_driver) {
>>   driver = tty_driver_kref_get(console_driver);
>> - if (driver) {
>> + if (driver && filp) {
>
> Why change this too?
>
> Your changelog does not explain any of this, please do so.
>
> thanks,
>
> greg k-h


Sorry, I should have been more descriptive here. The changes which
check file pointer for null are basically from Alan Cox's patch here:
http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1215095.html.
The description from that patch is quoted below:

"[RFC] tty_port: allow a port to be opened with a tty that has no file handle

Let us create tty objects entirely in kernel space. Untested proposal to
show why all the ideas around rewriting half the uart stack are not needed.

With this a kernel created non file backed tty object could be used to
handle
data, and set terminal modes. Not all ldiscs can cope with this as N_TTY in
particular has to work back to the fs/tty layer.

The tty_port code is however otherwise clean of file handles as far as I can
tell as is the low level tty port write path used by the ldisc, the
configuration low level interfaces and most of the ldiscs.

Currently you don't have any exposure to see tty hangups because those are
built around the file layer. However a) it's a fixed port so you probably
don't care about that b) if you do we can add a callback and c) you almost
certainly don't want the userspace tear down/rebuild behaviour anyway.

This should however be sufficient if we wanted for example to enumerate all
the bluetooth bound fixed ports via ACPI and make them directly available.

It doesn't deal with the case of a user opening a port that's also kernel
opened and that would need some locking out (so it returned EBUSY if bound
to a kernel device of some kind). That needs resolving along with how you
"up" or "down" your new bluetooth device, or enumerate it while providing
the existing tty API to avoid regressions (and to debug)."

With this patchset tty_open_by_driver is now called from inside kernel
with file pointer set to null. I can resend this patch with above
description.

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


[PATCH 9/9] staging: wlan-ng: p80211conv: change args types of p80211_caphdr structure to be network compatible.

2017-05-15 Thread Karim Eshapa
Change p80211_caphdr structure args types to __be.. to be
compatible with byte ordering of the network.
and in hfa384x_usb.c make calculations with respect to machine.

Signed-off-by: Karim Eshapa 
---
 drivers/staging/wlan-ng/hfa384x_usb.c |  2 +-
 drivers/staging/wlan-ng/p80211conv.h  | 28 ++--
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c 
b/drivers/staging/wlan-ng/hfa384x_usb.c
index 6134eba..8f989bc 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -3513,7 +3513,7 @@ static void hfa384x_int_rxmonitor(struct wlandevice 
*wlandev,
 
caphdr->version = htonl(P80211CAPTURE_VERSION);
caphdr->length = htonl(sizeof(struct p80211_caphdr));
-   caphdr->mactime = __cpu_to_be64(rxdesc->time) * 1000;
+   caphdr->mactime = __cpu_to_be64(rxdesc->time * 1000);
caphdr->hosttime = __cpu_to_be64(jiffies);
caphdr->phytype = htonl(4); /* dss_dot11_b */
caphdr->channel = htonl(hw->sniff_channel);
diff --git a/drivers/staging/wlan-ng/p80211conv.h 
b/drivers/staging/wlan-ng/p80211conv.h
index 04bac2e..66332b1 100644
--- a/drivers/staging/wlan-ng/p80211conv.h
+++ b/drivers/staging/wlan-ng/p80211conv.h
@@ -101,20 +101,20 @@ void p80211skb_rxmeta_detach(struct sk_buff *skb);
  * Frame capture header.  (See doc/capturefrm.txt)
  */
 struct p80211_caphdr {
-   u32 version;
-   u32 length;
-   u64 mactime;
-   u64 hosttime;
-   u32 phytype;
-   u32 channel;
-   u32 datarate;
-   u32 antenna;
-   u32 priority;
-   u32 ssi_type;
-   s32 ssi_signal;
-   s32 ssi_noise;
-   u32 preamble;
-   u32 encoding;
+   __be32 version;
+   __be32 length;
+   __be64 mactime;
+   __be64 hosttime;
+   __be32 phytype;
+   __be32 channel;
+   __be32 datarate;
+   __be32 antenna;
+   __be32 priority;
+   __be32 ssi_type;
+   __be32 ssi_signal;
+   __be32 ssi_noise;
+   __be32 preamble;
+   __be32 encoding;
 };
 
 /* buffer free method pointer type */
-- 
2.7.4

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


[PATCH] staging: wlan-ng: p80211conv: change args types of p80211_caphdr structure to be network compatible.

2017-05-15 Thread Karim Eshapa
Change p80211_caphdr structure args types to __be.. to be
compatible with byte ordering of the network.
and in hfa384x_usb.c make calculations with respect to machine.

Signed-off-by: Karim Eshapa 
---
 drivers/staging/wlan-ng/hfa384x_usb.c |  2 +-
 drivers/staging/wlan-ng/p80211conv.h  | 28 ++--
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c 
b/drivers/staging/wlan-ng/hfa384x_usb.c
index 6134eba..8f989bc 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -3513,7 +3513,7 @@ static void hfa384x_int_rxmonitor(struct wlandevice 
*wlandev,
 
caphdr->version = htonl(P80211CAPTURE_VERSION);
caphdr->length = htonl(sizeof(struct p80211_caphdr));
-   caphdr->mactime = __cpu_to_be64(rxdesc->time) * 1000;
+   caphdr->mactime = __cpu_to_be64(rxdesc->time * 1000);
caphdr->hosttime = __cpu_to_be64(jiffies);
caphdr->phytype = htonl(4); /* dss_dot11_b */
caphdr->channel = htonl(hw->sniff_channel);
diff --git a/drivers/staging/wlan-ng/p80211conv.h 
b/drivers/staging/wlan-ng/p80211conv.h
index 04bac2e..66332b1 100644
--- a/drivers/staging/wlan-ng/p80211conv.h
+++ b/drivers/staging/wlan-ng/p80211conv.h
@@ -101,20 +101,20 @@ void p80211skb_rxmeta_detach(struct sk_buff *skb);
  * Frame capture header.  (See doc/capturefrm.txt)
  */
 struct p80211_caphdr {
-   u32 version;
-   u32 length;
-   u64 mactime;
-   u64 hosttime;
-   u32 phytype;
-   u32 channel;
-   u32 datarate;
-   u32 antenna;
-   u32 priority;
-   u32 ssi_type;
-   s32 ssi_signal;
-   s32 ssi_noise;
-   u32 preamble;
-   u32 encoding;
+   __be32 version;
+   __be32 length;
+   __be64 mactime;
+   __be64 hosttime;
+   __be32 phytype;
+   __be32 channel;
+   __be32 datarate;
+   __be32 antenna;
+   __be32 priority;
+   __be32 ssi_type;
+   __be32 ssi_signal;
+   __be32 ssi_noise;
+   __be32 preamble;
+   __be32 encoding;
 };
 
 /* buffer free method pointer type */
-- 
2.7.4

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


Re: [patch 2/6] tty: export tty_open_by_driver

2017-05-15 Thread Greg Kroah-Hartman
On Mon, May 15, 2017 at 12:10:06PM +0100, Okash Khawaja wrote:
> Hi,
> 
> On Mon, May 15, 2017 at 11:31 AM, Greg Kroah-Hartman
>  wrote:
> > On Sat, Apr 29, 2017 at 08:52:59PM +0100, Okash Khawaja wrote:
> >> This applies on top of the changes already in staging-next branch which 
> >> allow
> >> kernel access to TTY dev.
> >>
> >> Signe-doff-by: Okash Khawaja 
> >> Reviewed-by: Samuel Thibault 
> >>
> >> Index: linux-staging/drivers/tty/tty_io.c
> >> ===
> >> --- linux-staging.orig/drivers/tty/tty_io.c
> >> +++ linux-staging/drivers/tty/tty_io.c
> >> @@ -1369,7 +1369,10 @@ static struct tty_struct *tty_driver_loo
> >>   struct tty_struct *tty;
> >>
> >>   if (driver->ops->lookup)
> >> - tty = driver->ops->lookup(driver, file, idx);
> >> + if (!file)
> >> + tty = ERR_PTR(-EIO);
> >> + else
> >> + tty = driver->ops->lookup(driver, file, idx);
> >
> > Why make this change?  Shouldn't the lookup function allow a NULL file
> > pointer?  Or is the problem that they do not?
> >
> >>   else
> >>   tty = driver->ttys[idx];
> >>
> >> @@ -2001,7 +2004,7 @@ static struct tty_driver *tty_lookup_dri
> >>   struct tty_driver *console_driver = console_device(index);
> >>   if (console_driver) {
> >>   driver = tty_driver_kref_get(console_driver);
> >> - if (driver) {
> >> + if (driver && filp) {
> >
> > Why change this too?
> >
> > Your changelog does not explain any of this, please do so.
> >
> > thanks,
> >
> > greg k-h
> 
> 
> Sorry, I should have been more descriptive here. The changes which
> check file pointer for null are basically from Alan Cox's patch here:
> http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1215095.html.
> The description from that patch is quoted below:
> 
> "[RFC] tty_port: allow a port to be opened with a tty that has no file handle
> 
> Let us create tty objects entirely in kernel space. Untested proposal to
> show why all the ideas around rewriting half the uart stack are not 
> needed.
> 
> With this a kernel created non file backed tty object could be used to
> handle
> data, and set terminal modes. Not all ldiscs can cope with this as N_TTY 
> in
> particular has to work back to the fs/tty layer.
> 
> The tty_port code is however otherwise clean of file handles as far as I 
> can
> tell as is the low level tty port write path used by the ldisc, the
> configuration low level interfaces and most of the ldiscs.
> 
> Currently you don't have any exposure to see tty hangups because those are
> built around the file layer. However a) it's a fixed port so you probably
> don't care about that b) if you do we can add a callback and c) you almost
> certainly don't want the userspace tear down/rebuild behaviour anyway.
> 
> This should however be sufficient if we wanted for example to enumerate 
> all
> the bluetooth bound fixed ports via ACPI and make them directly available.
> 
> It doesn't deal with the case of a user opening a port that's also kernel
> opened and that would need some locking out (so it returned EBUSY if bound
> to a kernel device of some kind). That needs resolving along with how you
> "up" or "down" your new bluetooth device, or enumerate it while providing
> the existing tty API to avoid regressions (and to debug)."
> 
> With this patchset tty_open_by_driver is now called from inside kernel
> with file pointer set to null. I can resend this patch with above
> description.

Please fix that up and resend the whole series.

thanks,

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


Re: [PATCH 9/9] staging: wlan-ng: p80211conv: change args types of p80211_caphdr structure to be network compatible.

2017-05-15 Thread Greg KH
On Mon, May 15, 2017 at 01:22:02PM +0200, Karim Eshapa wrote:
> Change p80211_caphdr structure args types to __be.. to be
> compatible with byte ordering of the network.
> and in hfa384x_usb.c make calculations with respect to machine.
> 
> Signed-off-by: Karim Eshapa 
> ---
>  drivers/staging/wlan-ng/hfa384x_usb.c |  2 +-
>  drivers/staging/wlan-ng/p80211conv.h  | 28 ++--
>  2 files changed, 15 insertions(+), 15 deletions(-)

Where are patches 1-8?
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 9/9] staging: wlan-ng: p80211conv: change args types of p80211_caphdr structure to be network compatible.

2017-05-15 Thread Karim Eshapa
it's only one patch sorry, there is 
something going wrong with my 'git' creating patch.

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


[PATCH v2] drivers/staging: refactor dgnc tty registration.

2017-05-15 Thread Haim Daniel
-remove duplicate tty allocation code for serial and printer drivers.
-fix sparse warning: too long initializer-string for array of char.

Signed-off-by: Haim Daniel 
---
 drivers/staging/dgnc/dgnc_driver.h |  13 
 drivers/staging/dgnc/dgnc_tty.c| 150 +++--
 2 files changed, 59 insertions(+), 104 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index 980410f..764d6fe 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -52,19 +52,6 @@
 
 #define dgnc_jiffies_from_ms(a) (((a) * HZ) / 1000)
 
-/*
- * Define a local default termios struct. All ports will be created
- * with this termios initially.  This is the same structure that is defined
- * as the default in tty_io.c with the same settings overridden as in serial.c
- *
- * In short, this should match the internal serial ports' defaults.
- */
-#defineDEFAULT_IFLAGS  (ICRNL | IXON)
-#defineDEFAULT_OFLAGS  (OPOST | ONLCR)
-#defineDEFAULT_CFLAGS  (B9600 | CS8 | CREAD | HUPCL | CLOCAL)
-#defineDEFAULT_LFLAGS  (ISIG | ICANON | ECHO | ECHOE | ECHOK | \
-   ECHOCTL | ECHOKE | IEXTEN)
-
 #ifndef _POSIX_VDISABLE
 #define   _POSIX_VDISABLE '\0'
 #endif
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index 9e98781..189a731 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -51,22 +51,6 @@
.digi_term ="ansi"  /* default terminal type */
 };
 
-/*
- * Define a local default termios struct. All ports will be created
- * with this termios initially.
- *
- * This defines a raw port at 9600 baud, 8 data bits, no parity,
- * 1 stop bit.
- */
-static const struct ktermios default_termios = {
-   .c_iflag =  (DEFAULT_IFLAGS),
-   .c_oflag =  (DEFAULT_OFLAGS),
-   .c_cflag =  (DEFAULT_CFLAGS),
-   .c_lflag =  (DEFAULT_LFLAGS),
-   .c_cc = INIT_C_CC,
-   .c_line =   0,
-};
-
 static int dgnc_tty_open(struct tty_struct *tty, struct file *file);
 static void dgnc_tty_close(struct tty_struct *tty, struct file *file);
 static int dgnc_block_til_ready(struct tty_struct *tty, struct file *file,
@@ -129,6 +113,49 @@ static void dgnc_tty_set_termios(struct tty_struct *tty,
 
 /* TTY Initialization/Cleanup Functions */
 
+static struct tty_driver *_dgnc_tty_register(char *serial_name, uint maxports,
+int major, int minor)
+{
+   int rc;
+   struct tty_driver *drv;
+
+   drv = tty_alloc_driver(maxports,
+  TTY_DRIVER_REAL_RAW |
+  TTY_DRIVER_DYNAMIC_DEV |
+  TTY_DRIVER_HARDWARE_BREAK);
+   if (IS_ERR(drv))
+   return drv;
+
+   drv->name = serial_name;
+   drv->name_base = 0;
+   drv->major = major;
+   drv->minor_start = minor;
+   drv->type = TTY_DRIVER_TYPE_SERIAL;
+   drv->subtype = SERIAL_TYPE_NORMAL;
+   drv->init_termios = tty_std_termios;
+   drv->init_termios.c_cflag = (B9600 | CS8 | CREAD | HUPCL | CLOCAL);
+   drv->init_termios.c_ispeed = 9600;
+   drv->init_termios.c_ospeed = 9600;
+   drv->driver_name = DRVSTR;
+   /*
+* Entry points for driver.  Called by the kernel from
+* tty_io.c and n_tty.c.
+*/
+   tty_set_operations(drv, &dgnc_tty_ops);
+   rc = tty_register_driver(drv);
+   if (rc < 0) {
+   put_tty_driver(drv);
+   return ERR_PTR(rc);
+   }
+   return drv;
+}
+
+static void _dgnc_tty_unregister(struct tty_driver *drv)
+{
+   tty_unregister_driver(drv);
+   put_tty_driver(drv);
+}
+
 /**
  * dgnc_tty_register() - Init the tty subsystem for this board.
  */
@@ -136,95 +163,36 @@ int dgnc_tty_register(struct dgnc_board *brd)
 {
int rc;
 
-   brd->serial_driver = tty_alloc_driver(brd->maxports,
- TTY_DRIVER_REAL_RAW |
- TTY_DRIVER_DYNAMIC_DEV |
- TTY_DRIVER_HARDWARE_BREAK);
-   if (IS_ERR(brd->serial_driver))
-   return PTR_ERR(brd->serial_driver);
-
snprintf(brd->serial_name, MAXTTYNAMELEN, "tty_dgnc_%d_",
 brd->boardnum);
 
-   brd->serial_driver->name = brd->serial_name;
-   brd->serial_driver->name_base = 0;
-   brd->serial_driver->major = 0;
-   brd->serial_driver->minor_start = 0;
-   brd->serial_driver->type = TTY_DRIVER_TYPE_SERIAL;
-   brd->serial_driver->subtype = SERIAL_TYPE_NORMAL;
-   brd->serial_driver->init_termios = default_termios;
-   brd->serial_driver->driver_name = DRVSTR;
-
-   /*
-* Entry points for driver.  Called by the kernel from
-* tty_io.c and n_tty.c.
-*/
-   tty_set_operations(brd->serial_driver, &dgnc_tty_o

Re: [PATCH v2] drivers/staging: refactor dgnc tty registration.

2017-05-15 Thread Dan Carpenter
On Mon, May 15, 2017 at 02:48:52PM +0300, Haim Daniel wrote:
> +static struct tty_driver *_dgnc_tty_register(char *serial_name, uint 
> maxports,


Ahh...  I see why you are adding underscores.  Please, just get a better
name instead of taking an existing name and adding underscores.

regards,
dan carpenter

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


[PATCH] staging: wlan-ng: p80211conv: change args types of p80211_caphdr structure to be network compatible.

2017-05-15 Thread Karim Eshapa
Change p80211_caphdr structure args types to __be.. to be
compatible with byte ordering of the network.
and in hfa384x_usb.c make calculations with respect to machine.

Signed-off-by: Karim Eshapa 
---
 drivers/staging/wlan-ng/hfa384x_usb.c |  2 +-
 drivers/staging/wlan-ng/p80211conv.h  | 28 ++--
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c 
b/drivers/staging/wlan-ng/hfa384x_usb.c
index 6134eba..8f989bc 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -3513,7 +3513,7 @@ static void hfa384x_int_rxmonitor(struct wlandevice 
*wlandev,
 
caphdr->version = htonl(P80211CAPTURE_VERSION);
caphdr->length = htonl(sizeof(struct p80211_caphdr));
-   caphdr->mactime = __cpu_to_be64(rxdesc->time) * 1000;
+   caphdr->mactime = __cpu_to_be64(rxdesc->time * 1000);
caphdr->hosttime = __cpu_to_be64(jiffies);
caphdr->phytype = htonl(4); /* dss_dot11_b */
caphdr->channel = htonl(hw->sniff_channel);
diff --git a/drivers/staging/wlan-ng/p80211conv.h 
b/drivers/staging/wlan-ng/p80211conv.h
index 04bac2e..66332b1 100644
--- a/drivers/staging/wlan-ng/p80211conv.h
+++ b/drivers/staging/wlan-ng/p80211conv.h
@@ -101,20 +101,20 @@ void p80211skb_rxmeta_detach(struct sk_buff *skb);
  * Frame capture header.  (See doc/capturefrm.txt)
  */
 struct p80211_caphdr {
-   u32 version;
-   u32 length;
-   u64 mactime;
-   u64 hosttime;
-   u32 phytype;
-   u32 channel;
-   u32 datarate;
-   u32 antenna;
-   u32 priority;
-   u32 ssi_type;
-   s32 ssi_signal;
-   s32 ssi_noise;
-   u32 preamble;
-   u32 encoding;
+   __be32 version;
+   __be32 length;
+   __be64 mactime;
+   __be64 hosttime;
+   __be32 phytype;
+   __be32 channel;
+   __be32 datarate;
+   __be32 antenna;
+   __be32 priority;
+   __be32 ssi_type;
+   __be32 ssi_signal;
+   __be32 ssi_noise;
+   __be32 preamble;
+   __be32 encoding;
 };
 
 /* buffer free method pointer type */
-- 
2.7.4

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


[PATCH v3] drivers/staging: refactor dgnc tty registration.

2017-05-15 Thread Haim Daniel
-remove duplicate tty allocation code for serial and printer drivers.
-fix sparse warning: too long initializer-string for array of char.

Signed-off-by: Haim Daniel 
---
 drivers/staging/dgnc/dgnc_driver.h |  13 
 drivers/staging/dgnc/dgnc_tty.c| 150 +++--
 2 files changed, 59 insertions(+), 104 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index 980410f..764d6fe 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -52,19 +52,6 @@
 
 #define dgnc_jiffies_from_ms(a) (((a) * HZ) / 1000)
 
-/*
- * Define a local default termios struct. All ports will be created
- * with this termios initially.  This is the same structure that is defined
- * as the default in tty_io.c with the same settings overridden as in serial.c
- *
- * In short, this should match the internal serial ports' defaults.
- */
-#defineDEFAULT_IFLAGS  (ICRNL | IXON)
-#defineDEFAULT_OFLAGS  (OPOST | ONLCR)
-#defineDEFAULT_CFLAGS  (B9600 | CS8 | CREAD | HUPCL | CLOCAL)
-#defineDEFAULT_LFLAGS  (ISIG | ICANON | ECHO | ECHOE | ECHOK | \
-   ECHOCTL | ECHOKE | IEXTEN)
-
 #ifndef _POSIX_VDISABLE
 #define   _POSIX_VDISABLE '\0'
 #endif
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index 9e98781..d3736da 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -51,22 +51,6 @@
.digi_term ="ansi"  /* default terminal type */
 };
 
-/*
- * Define a local default termios struct. All ports will be created
- * with this termios initially.
- *
- * This defines a raw port at 9600 baud, 8 data bits, no parity,
- * 1 stop bit.
- */
-static const struct ktermios default_termios = {
-   .c_iflag =  (DEFAULT_IFLAGS),
-   .c_oflag =  (DEFAULT_OFLAGS),
-   .c_cflag =  (DEFAULT_CFLAGS),
-   .c_lflag =  (DEFAULT_LFLAGS),
-   .c_cc = INIT_C_CC,
-   .c_line =   0,
-};
-
 static int dgnc_tty_open(struct tty_struct *tty, struct file *file);
 static void dgnc_tty_close(struct tty_struct *tty, struct file *file);
 static int dgnc_block_til_ready(struct tty_struct *tty, struct file *file,
@@ -129,6 +113,49 @@ static void dgnc_tty_set_termios(struct tty_struct *tty,
 
 /* TTY Initialization/Cleanup Functions */
 
+static struct tty_driver *dgnc_tty_create(char *serial_name, uint maxports,
+ int major, int minor)
+{
+   int rc;
+   struct tty_driver *drv;
+
+   drv = tty_alloc_driver(maxports,
+  TTY_DRIVER_REAL_RAW |
+  TTY_DRIVER_DYNAMIC_DEV |
+  TTY_DRIVER_HARDWARE_BREAK);
+   if (IS_ERR(drv))
+   return drv;
+
+   drv->name = serial_name;
+   drv->name_base = 0;
+   drv->major = major;
+   drv->minor_start = minor;
+   drv->type = TTY_DRIVER_TYPE_SERIAL;
+   drv->subtype = SERIAL_TYPE_NORMAL;
+   drv->init_termios = tty_std_termios;
+   drv->init_termios.c_cflag = (B9600 | CS8 | CREAD | HUPCL | CLOCAL);
+   drv->init_termios.c_ispeed = 9600;
+   drv->init_termios.c_ospeed = 9600;
+   drv->driver_name = DRVSTR;
+   /*
+* Entry points for driver.  Called by the kernel from
+* tty_io.c and n_tty.c.
+*/
+   tty_set_operations(drv, &dgnc_tty_ops);
+   rc = tty_register_driver(drv);
+   if (rc < 0) {
+   put_tty_driver(drv);
+   return ERR_PTR(rc);
+   }
+   return drv;
+}
+
+static void dgnc_tty_free(struct tty_driver *drv)
+{
+   tty_unregister_driver(drv);
+   put_tty_driver(drv);
+}
+
 /**
  * dgnc_tty_register() - Init the tty subsystem for this board.
  */
@@ -136,95 +163,36 @@ int dgnc_tty_register(struct dgnc_board *brd)
 {
int rc;
 
-   brd->serial_driver = tty_alloc_driver(brd->maxports,
- TTY_DRIVER_REAL_RAW |
- TTY_DRIVER_DYNAMIC_DEV |
- TTY_DRIVER_HARDWARE_BREAK);
-   if (IS_ERR(brd->serial_driver))
-   return PTR_ERR(brd->serial_driver);
-
snprintf(brd->serial_name, MAXTTYNAMELEN, "tty_dgnc_%d_",
 brd->boardnum);
 
-   brd->serial_driver->name = brd->serial_name;
-   brd->serial_driver->name_base = 0;
-   brd->serial_driver->major = 0;
-   brd->serial_driver->minor_start = 0;
-   brd->serial_driver->type = TTY_DRIVER_TYPE_SERIAL;
-   brd->serial_driver->subtype = SERIAL_TYPE_NORMAL;
-   brd->serial_driver->init_termios = default_termios;
-   brd->serial_driver->driver_name = DRVSTR;
-
-   /*
-* Entry points for driver.  Called by the kernel from
-* tty_io.c and n_tty.c.
-*/
-   tty_set_operations(brd->serial_driver, &dgnc_tty_ops);
-
- 

Re: [PATCH v3] drivers/staging: refactor dgnc tty registration.

2017-05-15 Thread Dan Carpenter
On Mon, May 15, 2017 at 03:30:50PM +0300, Haim Daniel wrote:
> -remove duplicate tty allocation code for serial and printer drivers.
> -fix sparse warning: too long initializer-string for array of char.

I think my version of Sparse is too old.  I don't get a warning.  Please
cut and paste the exact warning.

> 
> Signed-off-by: Haim Daniel 
> ---
>  drivers/staging/dgnc/dgnc_driver.h |  13 
>  drivers/staging/dgnc/dgnc_tty.c| 150 
> +++--
>  2 files changed, 59 insertions(+), 104 deletions(-)
> 
> diff --git a/drivers/staging/dgnc/dgnc_driver.h 
> b/drivers/staging/dgnc/dgnc_driver.h
> index 980410f..764d6fe 100644
> --- a/drivers/staging/dgnc/dgnc_driver.h
> +++ b/drivers/staging/dgnc/dgnc_driver.h
> @@ -52,19 +52,6 @@
>  
>  #define dgnc_jiffies_from_ms(a) (((a) * HZ) / 1000)
>  
> -/*
> - * Define a local default termios struct. All ports will be created
> - * with this termios initially.  This is the same structure that is defined
> - * as the default in tty_io.c with the same settings overridden as in 
> serial.c
> - *
> - * In short, this should match the internal serial ports' defaults.
> - */
> -#define  DEFAULT_IFLAGS  (ICRNL | IXON)
> -#define  DEFAULT_OFLAGS  (OPOST | ONLCR)
> -#define  DEFAULT_CFLAGS  (B9600 | CS8 | CREAD | HUPCL | CLOCAL)
> -#define  DEFAULT_LFLAGS  (ISIG | ICANON | ECHO | ECHOE | ECHOK | \
> - ECHOCTL | ECHOKE | IEXTEN)
> -
>  #ifndef _POSIX_VDISABLE
>  #define   _POSIX_VDISABLE '\0'
>  #endif
> diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
> index 9e98781..d3736da 100644
> --- a/drivers/staging/dgnc/dgnc_tty.c
> +++ b/drivers/staging/dgnc/dgnc_tty.c
> @@ -51,22 +51,6 @@
>   .digi_term ="ansi"  /* default terminal type */
>  };
>  
> -/*
> - * Define a local default termios struct. All ports will be created
> - * with this termios initially.
> - *
> - * This defines a raw port at 9600 baud, 8 data bits, no parity,
> - * 1 stop bit.
> - */
> -static const struct ktermios default_termios = {
> - .c_iflag =  (DEFAULT_IFLAGS),
> - .c_oflag =  (DEFAULT_OFLAGS),
> - .c_cflag =  (DEFAULT_CFLAGS),
> - .c_lflag =  (DEFAULT_LFLAGS),
> - .c_cc = INIT_C_CC,

We don't need INIT_C_CC?

> - .c_line =   0,
> -};
> -
>  static int dgnc_tty_open(struct tty_struct *tty, struct file *file);
>  static void dgnc_tty_close(struct tty_struct *tty, struct file *file);
>  static int dgnc_block_til_ready(struct tty_struct *tty, struct file *file,
> @@ -129,6 +113,49 @@ static void dgnc_tty_set_termios(struct tty_struct *tty,
>  
>  /* TTY Initialization/Cleanup Functions */
>  
> +static struct tty_driver *dgnc_tty_create(char *serial_name, uint maxports,
> +   int major, int minor)
> +{
> + int rc;
> + struct tty_driver *drv;
> +
> + drv = tty_alloc_driver(maxports,
> +TTY_DRIVER_REAL_RAW |
> +TTY_DRIVER_DYNAMIC_DEV |
> +TTY_DRIVER_HARDWARE_BREAK);
> + if (IS_ERR(drv))
> + return drv;
> +
> + drv->name = serial_name;
> + drv->name_base = 0;
> + drv->major = major;
> + drv->minor_start = minor;
> + drv->type = TTY_DRIVER_TYPE_SERIAL;
> + drv->subtype = SERIAL_TYPE_NORMAL;
> + drv->init_termios = tty_std_termios;
> + drv->init_termios.c_cflag = (B9600 | CS8 | CREAD | HUPCL | CLOCAL);
> + drv->init_termios.c_ispeed = 9600;
> + drv->init_termios.c_ospeed = 9600;

Setting c_ispeed and c_ospeed is almost certainly correct, but they're
not mentioned in the changelog.

Btw, the overwhelming vast majority of staging drivers are sent without
testing.  But it looks like maybe you are testing yours?  Please mention
that in the changelog because it makes us feel warm inside.

Otherwise it looks fine to me.  Sorry for making you redo it so many
times instead of reviewing thouroughly all at once.  I shouldn't have
been so lazy.

I still feel a bit bad about my review that I didn't spot bug Sparse
saw...

regards,
dan carpenter


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


Re: [PATCH v3 2/3] staging: typec: fusb302: reset i2c_busy state in error

2017-05-15 Thread Guenter Roeck

On 05/12/2017 01:16 PM, Rui Miguel Silva wrote:

Fix reset of i2c_busy flag if an error occurs during the i2c block read.

Signed-off-by: Rui Miguel Silva 


Reviewed-by: Guenter Roeck 


---
 drivers/staging/typec/fusb302/fusb302.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/typec/fusb302/fusb302.c 
b/drivers/staging/typec/fusb302/fusb302.c
index 65df6407db84..37fd0bd0f2a6 100644
--- a/drivers/staging/typec/fusb302/fusb302.c
+++ b/drivers/staging/typec/fusb302/fusb302.c
@@ -365,13 +365,15 @@ static int fusb302_i2c_block_read(struct fusb302_chip 
*chip, u8 address,
if (ret < 0) {
fusb302_log(chip, "cannot block read 0x%02x, len=%d, ret=%d",
address, length, ret);
-   return ret;
+   goto done;
}
if (ret != length) {
fusb302_log(chip, "only read %d/%d bytes from 0x%02x",
ret, length, address);
-   return -EIO;
+   ret = -EIO;
}
+
+done:
atomic_set(&chip->i2c_busy, 0);

return ret;



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


Re: [PATCH v3 3/3] staging: typec: fusb302: refactor resume retry mechanism

2017-05-15 Thread Guenter Roeck

On 05/12/2017 01:16 PM, Rui Miguel Silva wrote:

The i2c functions need to test the pm_suspend state and do, if needed, some
retry before i2c operations. This code was repeated 4x.

To isolate this, create a new function to check suspend state and call it in
every need place.

As at it, move the error message from pr_err to dev_err.

Signed-off-by: Rui Miguel Silva 


Reviewed-by: Guenter Roeck 


---
 drivers/staging/typec/fusb302/fusb302.c | 70 +
 1 file changed, 36 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/typec/fusb302/fusb302.c 
b/drivers/staging/typec/fusb302/fusb302.c
index 37fd0bd0f2a6..7e974f2244b3 100644
--- a/drivers/staging/typec/fusb302/fusb302.c
+++ b/drivers/staging/typec/fusb302/fusb302.c
@@ -264,22 +264,36 @@ static void fusb302_debugfs_exit(const struct 
fusb302_chip *chip) { }

 #define FUSB302_RESUME_RETRY 10
 #define FUSB302_RESUME_RETRY_SLEEP 50
-static int fusb302_i2c_write(struct fusb302_chip *chip,
-u8 address, u8 data)
+
+static bool fusb302_is_suspended(struct fusb302_chip *chip)
 {
int retry_cnt;
-   int ret = 0;

-   atomic_set(&chip->i2c_busy, 1);
for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) {
if (atomic_read(&chip->pm_suspend)) {
-   pr_err("fusb302_i2c: pm suspend, retry %d/%d\n",
-  retry_cnt + 1, FUSB302_RESUME_RETRY);
+   dev_err(chip->dev, "i2c: pm suspend, retry %d/%d\n",
+   retry_cnt + 1, FUSB302_RESUME_RETRY);
msleep(FUSB302_RESUME_RETRY_SLEEP);
} else {
-   break;
+   return false;
}
}
+
+   return true;
+}
+
+static int fusb302_i2c_write(struct fusb302_chip *chip,
+u8 address, u8 data)
+{
+   int ret = 0;
+
+   atomic_set(&chip->i2c_busy, 1);
+
+   if (fusb302_is_suspended(chip)) {
+   atomic_set(&chip->i2c_busy, 0);
+   return -ETIMEDOUT;
+   }
+
ret = i2c_smbus_write_byte_data(chip->i2c_client, address, data);
if (ret < 0)
fusb302_log(chip, "cannot write 0x%02x to 0x%02x, ret=%d",
@@ -292,21 +306,17 @@ static int fusb302_i2c_write(struct fusb302_chip *chip,
 static int fusb302_i2c_block_write(struct fusb302_chip *chip, u8 address,
   u8 length, const u8 *data)
 {
-   int retry_cnt;
int ret = 0;

if (length <= 0)
return ret;
atomic_set(&chip->i2c_busy, 1);
-   for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) {
-   if (atomic_read(&chip->pm_suspend)) {
-   pr_err("fusb302_i2c: pm suspend, retry %d/%d\n",
-  retry_cnt + 1, FUSB302_RESUME_RETRY);
-   msleep(FUSB302_RESUME_RETRY_SLEEP);
-   } else {
-   break;
-   }
+
+   if (fusb302_is_suspended(chip)) {
+   atomic_set(&chip->i2c_busy, 0);
+   return -ETIMEDOUT;
}
+
ret = i2c_smbus_write_i2c_block_data(chip->i2c_client, address,
 length, data);
if (ret < 0)
@@ -320,19 +330,15 @@ static int fusb302_i2c_block_write(struct fusb302_chip 
*chip, u8 address,
 static int fusb302_i2c_read(struct fusb302_chip *chip,
u8 address, u8 *data)
 {
-   int retry_cnt;
int ret = 0;

atomic_set(&chip->i2c_busy, 1);
-   for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) {
-   if (atomic_read(&chip->pm_suspend)) {
-   pr_err("fusb302_i2c: pm suspend, retry %d/%d\n",
-  retry_cnt + 1, FUSB302_RESUME_RETRY);
-   msleep(FUSB302_RESUME_RETRY_SLEEP);
-   } else {
-   break;
-   }
+
+   if (fusb302_is_suspended(chip)) {
+   atomic_set(&chip->i2c_busy, 0);
+   return -ETIMEDOUT;
}
+
ret = i2c_smbus_read_byte_data(chip->i2c_client, address);
*data = (u8)ret;
if (ret < 0)
@@ -345,21 +351,17 @@ static int fusb302_i2c_read(struct fusb302_chip *chip,
 static int fusb302_i2c_block_read(struct fusb302_chip *chip, u8 address,
  u8 length, u8 *data)
 {
-   int retry_cnt;
int ret = 0;

if (length <= 0)
return ret;
atomic_set(&chip->i2c_busy, 1);
-   for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) {
-   if (atomic_read(&chip->pm_suspend)) {
-   pr_err("fusb302_i2c: pm suspend, retry %d/%d\n",
-  retry_cnt + 1, FUSB302_RESUME_RETRY);
-   msleep(FUSB302_RESUME_RETRY_SLEEP);
-   

Re: [PATCH v3] drivers/staging: refactor dgnc tty registration.

2017-05-15 Thread Haim Daniel

me@haim-toshiba1 ~ $ dpkg -l sparse
Desired=Unknown/Install/Remove/Purge/Hold
| 
Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend

|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name  Version   Architecture  Description
+++-=-=-=-
ii  sparse0.4.5~rc1-1   amd64 semantic parser of 
source files


me@haim-toshiba1 linux (next-20170512) $ make clean M=drivers/staging 
/dgnc/; make C=1 M=drivers/staging/dgnc/


drivers/staging/dgnc/dgnc_tty.c:66:25: warning: too long 
initializer-string for array of char


On 05/15/2017 03:52 PM, Dan Carpenter wrote:

On Mon, May 15, 2017 at 03:30:50PM +0300, Haim Daniel wrote:

-remove duplicate tty allocation code for serial and printer drivers.
-fix sparse warning: too long initializer-string for array of char.


I think my version of Sparse is too old.  I don't get a warning.  Please
cut and paste the exact warning.



Signed-off-by: Haim Daniel 
---
 drivers/staging/dgnc/dgnc_driver.h |  13 
 drivers/staging/dgnc/dgnc_tty.c| 150 +++--
 2 files changed, 59 insertions(+), 104 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index 980410f..764d6fe 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -52,19 +52,6 @@

 #define dgnc_jiffies_from_ms(a) (((a) * HZ) / 1000)

-/*
- * Define a local default termios struct. All ports will be created
- * with this termios initially.  This is the same structure that is defined
- * as the default in tty_io.c with the same settings overridden as in serial.c
- *
- * In short, this should match the internal serial ports' defaults.
- */
-#defineDEFAULT_IFLAGS  (ICRNL | IXON)
-#defineDEFAULT_OFLAGS  (OPOST | ONLCR)
-#defineDEFAULT_CFLAGS  (B9600 | CS8 | CREAD | HUPCL | CLOCAL)
-#defineDEFAULT_LFLAGS  (ISIG | ICANON | ECHO | ECHOE | ECHOK | \
-   ECHOCTL | ECHOKE | IEXTEN)
-
 #ifndef _POSIX_VDISABLE
 #define   _POSIX_VDISABLE '\0'
 #endif
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index 9e98781..d3736da 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -51,22 +51,6 @@
.digi_term ="ansi"/* default terminal type */
 };

-/*
- * Define a local default termios struct. All ports will be created
- * with this termios initially.
- *
- * This defines a raw port at 9600 baud, 8 data bits, no parity,
- * 1 stop bit.
- */
-static const struct ktermios default_termios = {
-   .c_iflag =  (DEFAULT_IFLAGS),
-   .c_oflag =  (DEFAULT_OFLAGS),
-   .c_cflag =  (DEFAULT_CFLAGS),
-   .c_lflag =  (DEFAULT_LFLAGS),
-   .c_cc = INIT_C_CC,


We don't need INIT_C_CC?
No, the idea was reusing the tty_std_termios, and setting only the 
relevant params.





-   .c_line =   0,
-};
-
 static int dgnc_tty_open(struct tty_struct *tty, struct file *file);
 static void dgnc_tty_close(struct tty_struct *tty, struct file *file);
 static int dgnc_block_til_ready(struct tty_struct *tty, struct file *file,
@@ -129,6 +113,49 @@ static void dgnc_tty_set_termios(struct tty_struct *tty,

 /* TTY Initialization/Cleanup Functions */

+static struct tty_driver *dgnc_tty_create(char *serial_name, uint maxports,
+ int major, int minor)
+{
+   int rc;
+   struct tty_driver *drv;
+
+   drv = tty_alloc_driver(maxports,
+  TTY_DRIVER_REAL_RAW |
+  TTY_DRIVER_DYNAMIC_DEV |
+  TTY_DRIVER_HARDWARE_BREAK);
+   if (IS_ERR(drv))
+   return drv;
+
+   drv->name = serial_name;
+   drv->name_base = 0;
+   drv->major = major;
+   drv->minor_start = minor;
+   drv->type = TTY_DRIVER_TYPE_SERIAL;
+   drv->subtype = SERIAL_TYPE_NORMAL;
+   drv->init_termios = tty_std_termios;
+   drv->init_termios.c_cflag = (B9600 | CS8 | CREAD | HUPCL | CLOCAL);
+   drv->init_termios.c_ispeed = 9600;
+   drv->init_termios.c_ospeed = 9600;


Setting c_ispeed and c_ospeed is almost certainly correct, but they're
not mentioned in the changelog.

Ack, will do.

Btw, the overwhelming vast majority of staging drivers are sent without
testing.  But it looks like maybe you are testing yours?  Please mention
that in the changelog because it makes us feel warm inside.
I only unit tested a fraction of the code, will mention it in the 
changelog, for the sake of that fuzzy feeling :)



Otherwise it looks fine to me.  Sorry for making you redo it so many
times instead of reviewing thouroughly all at once.  I shouldn't have
been so lazy.

np.


I still feel a bit bad about my review that I didn't spot bug Sparse
saw...

regards,
dan carpenter





_

[PATCH v4] drivers/staging: refactor dgnc tty registration.

2017-05-15 Thread Haim Daniel
-remove duplicate tty allocation code for serial and printer drivers.
-add missing tty c_ispeed and c_ospeed initialization to 9600.
-fix sparse warning: too long initializer-string for array of char.

This patch was only unit tested due to lack of the actual hardware.

Signed-off-by: Haim Daniel 
---
 drivers/staging/dgnc/dgnc_driver.h |  13 
 drivers/staging/dgnc/dgnc_tty.c| 150 +++--
 2 files changed, 59 insertions(+), 104 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index 980410f..764d6fe 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -52,19 +52,6 @@
 
 #define dgnc_jiffies_from_ms(a) (((a) * HZ) / 1000)
 
-/*
- * Define a local default termios struct. All ports will be created
- * with this termios initially.  This is the same structure that is defined
- * as the default in tty_io.c with the same settings overridden as in serial.c
- *
- * In short, this should match the internal serial ports' defaults.
- */
-#defineDEFAULT_IFLAGS  (ICRNL | IXON)
-#defineDEFAULT_OFLAGS  (OPOST | ONLCR)
-#defineDEFAULT_CFLAGS  (B9600 | CS8 | CREAD | HUPCL | CLOCAL)
-#defineDEFAULT_LFLAGS  (ISIG | ICANON | ECHO | ECHOE | ECHOK | \
-   ECHOCTL | ECHOKE | IEXTEN)
-
 #ifndef _POSIX_VDISABLE
 #define   _POSIX_VDISABLE '\0'
 #endif
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index 9e98781..d3736da 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -51,22 +51,6 @@
.digi_term ="ansi"  /* default terminal type */
 };
 
-/*
- * Define a local default termios struct. All ports will be created
- * with this termios initially.
- *
- * This defines a raw port at 9600 baud, 8 data bits, no parity,
- * 1 stop bit.
- */
-static const struct ktermios default_termios = {
-   .c_iflag =  (DEFAULT_IFLAGS),
-   .c_oflag =  (DEFAULT_OFLAGS),
-   .c_cflag =  (DEFAULT_CFLAGS),
-   .c_lflag =  (DEFAULT_LFLAGS),
-   .c_cc = INIT_C_CC,
-   .c_line =   0,
-};
-
 static int dgnc_tty_open(struct tty_struct *tty, struct file *file);
 static void dgnc_tty_close(struct tty_struct *tty, struct file *file);
 static int dgnc_block_til_ready(struct tty_struct *tty, struct file *file,
@@ -129,6 +113,49 @@ static void dgnc_tty_set_termios(struct tty_struct *tty,
 
 /* TTY Initialization/Cleanup Functions */
 
+static struct tty_driver *dgnc_tty_create(char *serial_name, uint maxports,
+ int major, int minor)
+{
+   int rc;
+   struct tty_driver *drv;
+
+   drv = tty_alloc_driver(maxports,
+  TTY_DRIVER_REAL_RAW |
+  TTY_DRIVER_DYNAMIC_DEV |
+  TTY_DRIVER_HARDWARE_BREAK);
+   if (IS_ERR(drv))
+   return drv;
+
+   drv->name = serial_name;
+   drv->name_base = 0;
+   drv->major = major;
+   drv->minor_start = minor;
+   drv->type = TTY_DRIVER_TYPE_SERIAL;
+   drv->subtype = SERIAL_TYPE_NORMAL;
+   drv->init_termios = tty_std_termios;
+   drv->init_termios.c_cflag = (B9600 | CS8 | CREAD | HUPCL | CLOCAL);
+   drv->init_termios.c_ispeed = 9600;
+   drv->init_termios.c_ospeed = 9600;
+   drv->driver_name = DRVSTR;
+   /*
+* Entry points for driver.  Called by the kernel from
+* tty_io.c and n_tty.c.
+*/
+   tty_set_operations(drv, &dgnc_tty_ops);
+   rc = tty_register_driver(drv);
+   if (rc < 0) {
+   put_tty_driver(drv);
+   return ERR_PTR(rc);
+   }
+   return drv;
+}
+
+static void dgnc_tty_free(struct tty_driver *drv)
+{
+   tty_unregister_driver(drv);
+   put_tty_driver(drv);
+}
+
 /**
  * dgnc_tty_register() - Init the tty subsystem for this board.
  */
@@ -136,95 +163,36 @@ int dgnc_tty_register(struct dgnc_board *brd)
 {
int rc;
 
-   brd->serial_driver = tty_alloc_driver(brd->maxports,
- TTY_DRIVER_REAL_RAW |
- TTY_DRIVER_DYNAMIC_DEV |
- TTY_DRIVER_HARDWARE_BREAK);
-   if (IS_ERR(brd->serial_driver))
-   return PTR_ERR(brd->serial_driver);
-
snprintf(brd->serial_name, MAXTTYNAMELEN, "tty_dgnc_%d_",
 brd->boardnum);
 
-   brd->serial_driver->name = brd->serial_name;
-   brd->serial_driver->name_base = 0;
-   brd->serial_driver->major = 0;
-   brd->serial_driver->minor_start = 0;
-   brd->serial_driver->type = TTY_DRIVER_TYPE_SERIAL;
-   brd->serial_driver->subtype = SERIAL_TYPE_NORMAL;
-   brd->serial_driver->init_termios = default_termios;
-   brd->serial_driver->driver_name = DRVSTR;
-
-   /*
-* Entry points for driver.  Called by 

[PATCH] staging: vt6656: fix style

2017-05-15 Thread Juan Manuel Torres Palma
Fix coding style, including breaking too long lines, multiple
assignments in same line and empty lines.

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

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 1b87c08..9e4d407 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;
@@ -147,7 +149,10 @@ static __le16 vnt_get_rtscts_rsvtime_le(struct vnt_private 
*priv, u8 rsv_type,
 {
u32 rrv_time, rts_time, cts_time, ack_time, data_time;
 
-   rrv_time = rts_time = cts_time = ack_time = data_time = 0;
+   rrv_time = 0;
+   rts_time = 0;
+   cts_time = 0;
+   ack_time = 0;
 
data_time = vnt_get_frame_time(priv->preamble_type, pkt_type,
   frame_length, current_rate);
@@ -155,9 +160,11 @@ static __le16 vnt_get_rtscts_rsvtime_le(struct vnt_private 
*priv, u8 rsv_type,
if (rsv_type == 0) {
rts_time = vnt_get_frame_time(priv->preamble_type, pkt_type,
  20, priv->top_cck_basic_rate);
-   cts_time = ack_time = vnt_get_frame_time(priv->preamble_type,
-pkt_type, 14,
-
priv->top_cck_basic_rate);
+   ack_time = vnt_get_frame_time(priv->preamble_type,
+ pkt_type, 14,
+ priv->top_cck_basic_rate);
+   cts_time = ack_time;
+
} else if (rsv_type == 1) {
rts_time = vnt_get_frame_time(priv->preamble_type, pkt_type,
  20, priv->top_cck_basic_rate);
@@ -168,8 +175,10 @@ static __le16 vnt_get_rtscts_rsvtime_le(struct vnt_private 
*priv, u8 rsv_type,
} else if (rsv_type == 2) {
rts_time = vnt_get_frame_time(priv->preamble_type, pkt_type,
  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);
+   ack_time = vnt_get_frame_time(priv->preamble_type, pkt_type,
+ 14, priv->top_ofdm_basic_rate);
+   cts_time = ack_time;
+
} else if (rsv_type == 3) {
cts_time = vnt_get_frame_time(priv->preamble_type, pkt_type,
  14, priv->top_cck_basic_rate);
@@ -267,7 +276,6 @@ static u16 vnt_mac_hdr_pos(struct vnt_usb_send_context 
*tx_context,
 static u16 vnt_rxtx_datahead_g(struct vnt_usb_send_context *tx_context,
   struct vnt_tx_datahead_g *buf)
 {
-
struct vnt_private *priv = tx_context->priv;
struct ieee80211_hdr *hdr =
(struct ieee80211_hdr *)tx_context->skb->data;
@@ -691,7 +699,6 @@ static u16 vnt_generate_tx_parameter(struct 
vnt_usb_send_context *tx_context,
 struct vnt_mic_hdr **mic_hdr, u32 need_mic,
 bool need_rts)
 {
-
if (tx_context->pkt_type == PK_TYPE_11GB ||
tx_context->pkt_type == PK_TYPE_11GA) {
if (need_rts) {
@@ -779,14 +786,12 @@ static void vnt_fill_txkey(struct vnt_usb_send_context 
*tx_context,
if (ieee80211_has_a4(hdr->frame_control))
ether_addr_copy(mic_hdr->addr4, hdr->addr4);
 
-
memcpy(key_buffer, tx_key->key, WLAN_KEY_LEN_CCMP);
 
break;
default:
break;
}
-
 }
 
 int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb)
-- 
2.9.3

___
devel mailing list
de...@linuxdriverp

[PATCH 0/2] staging: greybus: fix arche driver compilation

2017-05-15 Thread Johan Hovold
The arche driver currently depends on the out-of-tree usb3613 driver and
this prevented a recent compile breakage after removing the timesync
code from being detected.

These patches remove the remaining timesync bits, and enable compile
testing of the arche driver to avoid further unintended breakage.

Johan


Johan Hovold (2):
  staging: greybus: arche: remove timesync remains
  staging: greybus: enable compile testing of arche driver

 drivers/staging/greybus/Kconfig  |  10 +++
 drivers/staging/greybus/Makefile |   2 +-
 drivers/staging/greybus/arche-apb-ctrl.c |  11 +--
 drivers/staging/greybus/arche-platform.c | 150 ++-
 drivers/staging/greybus/arche_platform.h |   8 --
 5 files changed, 21 insertions(+), 160 deletions(-)

-- 
2.13.0

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


[PATCH 2/2] staging: greybus: enable compile testing of arche driver

2017-05-15 Thread Johan Hovold
Add Arche platform-driver config option and allow the driver to be
compile tested also without the usb3613 driver.

Signed-off-by: Johan Hovold 
---
 drivers/staging/greybus/Kconfig  | 10 ++
 drivers/staging/greybus/Makefile |  2 +-
 drivers/staging/greybus/arche-platform.c |  7 +++
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/greybus/Kconfig b/drivers/staging/greybus/Kconfig
index 50de2d72dde0..cc59cf93ab9e 100644
--- a/drivers/staging/greybus/Kconfig
+++ b/drivers/staging/greybus/Kconfig
@@ -216,4 +216,14 @@ config GREYBUS_USB
  will be called gb-usb.ko
 
 endif  # GREYBUS_BRIDGED_PHY
+
+config GREYBUS_ARCHE
+   tristate "Greybus Arche Platform driver"
+   depends on CONFIG_USB_CONFIG_USB_HSIC_USB3613 || COMPILE_TEST
+   ---help---
+ Select this option if you have an Arche device.
+
+ To compile this code as a module, chose M here: the module
+ will be called gb-arche.ko
+
 endif  # GREYBUS
diff --git a/drivers/staging/greybus/Makefile b/drivers/staging/greybus/Makefile
index b26b9a35bdd5..23e1cb7bff8e 100644
--- a/drivers/staging/greybus/Makefile
+++ b/drivers/staging/greybus/Makefile
@@ -91,4 +91,4 @@ obj-$(CONFIG_GREYBUS_USB) += gb-usb.o
 # Greybus Platform driver
 gb-arche-y := arche-platform.o arche-apb-ctrl.o
 
-obj-$(CONFIG_USB_HSIC_USB3613) += gb-arche.o
+obj-$(CONFIG_GREYBUS_ARCHE)+= gb-arche.o
diff --git a/drivers/staging/greybus/arche-platform.c 
b/drivers/staging/greybus/arche-platform.c
index 9e644bfe2ae0..5bce5e039596 100644
--- a/drivers/staging/greybus/arche-platform.c
+++ b/drivers/staging/greybus/arche-platform.c
@@ -24,7 +24,14 @@
 #include "arche_platform.h"
 #include "greybus.h"
 
+#if IS_ENABLED(CONFIG_USB_HSIC_USB3613)
 #include 
+#else
+static inline int usb3613_hub_mode_ctrl(bool unused)
+{
+   return 0;
+}
+#endif
 
 #define WD_COLDBOOT_PULSE_WIDTH_MS 30
 
-- 
2.13.0

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


[PATCH 1/2] staging: greybus: arche: remove timesync remains

2017-05-15 Thread Johan Hovold
Remove the remaining timesync bits that were left in the arche platform
driver and which prevented the driver from being compiled.

Fixes: bdfb95c4baab ("staging: greybus: remove timesync protocol support")
Signed-off-by: Johan Hovold 
---
 drivers/staging/greybus/arche-apb-ctrl.c |  11 +--
 drivers/staging/greybus/arche-platform.c | 143 ---
 drivers/staging/greybus/arche_platform.h |   8 --
 3 files changed, 3 insertions(+), 159 deletions(-)

diff --git a/drivers/staging/greybus/arche-apb-ctrl.c 
b/drivers/staging/greybus/arche-apb-ctrl.c
index 02243b4fd898..0412f3d06efb 100644
--- a/drivers/staging/greybus/arche-apb-ctrl.c
+++ b/drivers/staging/greybus/arche-apb-ctrl.c
@@ -22,6 +22,8 @@
 #include "arche_platform.h"
 
 
+static void apb_bootret_deassert(struct device *dev);
+
 struct arche_apb_ctrl_drvdata {
/* Control GPIO signals to and from AP <=> AP Bridges */
int resetn_gpio;
@@ -222,14 +224,7 @@ static void poweroff_seq(struct platform_device *pdev)
/* TODO: May have to send an event to SVC about this exit */
 }
 
-void apb_bootret_assert(struct device *dev)
-{
-   struct arche_apb_ctrl_drvdata *apb = dev_get_drvdata(dev);
-
-   gpio_set_value(apb->boot_ret_gpio, 1);
-}
-
-void apb_bootret_deassert(struct device *dev)
+static void apb_bootret_deassert(struct device *dev)
 {
struct arche_apb_ctrl_drvdata *apb = dev_get_drvdata(dev);
 
diff --git a/drivers/staging/greybus/arche-platform.c 
b/drivers/staging/greybus/arche-platform.c
index aac1145f1983..9e644bfe2ae0 100644
--- a/drivers/staging/greybus/arche-platform.c
+++ b/drivers/staging/greybus/arche-platform.c
@@ -35,7 +35,6 @@ enum svc_wakedetect_state {
WD_STATE_STANDBYBOOT_TRIG,  /* As of now not used ?? */
WD_STATE_COLDBOOT_START,/* Cold boot process started */
WD_STATE_STANDBYBOOT_START, /* Not used */
-   WD_STATE_TIMESYNC,
 };
 
 struct arche_platform_drvdata {
@@ -59,26 +58,12 @@ struct arche_platform_drvdata {
int wake_detect_irq;
spinlock_t wake_lock;   /* Protect wake_detect_state */
struct mutex platform_state_mutex;  /* Protect state */
-   wait_queue_head_t wq;   /* WQ for arche_pdata->state */
unsigned long wake_detect_start;
struct notifier_block pm_notifier;
 
struct device *dev;
-   struct gb_timesync_svc *timesync_svc_pdata;
 };
 
-static int arche_apb_bootret_assert(struct device *dev, void *data)
-{
-   apb_bootret_assert(dev);
-   return 0;
-}
-
-static int arche_apb_bootret_deassert(struct device *dev, void *data)
-{
-   apb_bootret_deassert(dev);
-   return 0;
-}
-
 /* Requires calling context to hold arche_pdata->platform_state_mutex */
 static void arche_platform_set_state(struct arche_platform_drvdata 
*arche_pdata,
 enum arche_platform_state state)
@@ -86,112 +71,6 @@ static void arche_platform_set_state(struct 
arche_platform_drvdata *arche_pdata,
arche_pdata->state = state;
 }
 
-/*
- * arche_platform_change_state: Change the operational state
- *
- * This exported function allows external drivers to change the state
- * of the arche-platform driver.
- * Note that this function only supports transitions between two states
- * with limited functionality.
- *
- *  - ARCHE_PLATFORM_STATE_TIME_SYNC:
- *Once set, allows timesync operations between SVC <=> AP and makes
- *sure that arche-platform driver ignores any subsequent events/pulses
- *from SVC over wake/detect.
- *
- *  - ARCHE_PLATFORM_STATE_ACTIVE:
- *Puts back driver to active state, where any pulse from SVC on wake/detect
- *line would trigger either cold/standby boot.
- *Note: Transition request from this function does not trigger cold/standby
- *  boot. It just puts back driver book keeping variable back to ACTIVE
- *  state and restores the interrupt.
- *
- * Returns -ENODEV if device not found, -EAGAIN if the driver cannot currently
- * satisfy the requested state-transition or -EINVAL for all other
- * state-transition requests.
- */
-int arche_platform_change_state(enum arche_platform_state state,
-   struct gb_timesync_svc *timesync_svc_pdata)
-{
-   struct arche_platform_drvdata *arche_pdata;
-   struct platform_device *pdev;
-   struct device_node *np;
-   int ret = -EAGAIN;
-   unsigned long flags;
-
-   np = of_find_compatible_node(NULL, NULL, "google,arche-platform");
-   if (!np) {
-   pr_err("google,arche-platform device node not found\n");
-   return -ENODEV;
-   }
-
-   pdev = of_find_device_by_node(np);
-   if (!pdev) {
-   pr_err("arche-platform device not found\n");
-   of_node_put(np);
-   return -ENODEV;
-   }
-
-   arche_pdata = platform_get_drvdata(pdev);
-
-   mutex_lock(&arche_pdata->platform_state_mute

Re: [Bug] VCHIQ functional test broken

2017-05-15 Thread Phil Elwell
On 13/05/2017 10:30, Russell King - ARM Linux wrote:
> On Sat, May 13, 2017 at 11:07:28AM +0200, Stefan Wahren wrote:
>> In the meantime this issue has been fixed by Phil [1].
> 
> Right - definitely a driver bug.  Mapping more memory for DMA than is
> actually going to be DMA'd to and expecting data to be preserved is
> really horrid.

That feature was added during the upstreaming process, and as Stefan says
there is an outstanding patch for it.

>> Unfortunately i found another issue. If i enable CONFIG_HIGHMEM in
>> the kernel config, the data during functional test gets corrupted.
>> Phil said it's caused by the usage of get_user_pages() [2].
> 
> Without knowing who "Phil" is in that thread, but...
> 
>HIGHMEM is a problem because you can't use get_user_pages on pages in
>HIGHMEM.
> 
> is an interesting statement, and without any reasoning or evidence.
> 
> I also believe it to be incorrect.  get_user_pages() returns an array
> of struct page pointers for the user memory, calling flush_dcache_page()
> and flush_anon_page() on them to ensure that any kernel mapping is
> coherent with what is in userspace.
> 
> As far as returning the array of page pointers, get_user_pages() doesn't
> care whether they're lowmem or highmem.
> 
> flush_dcache_page() doesn't care either - if it wants to flush the page
> and the page is a highmem page, it will temporarily map it before
> flushing it.
> 
> flush_anon_page() is a no-op for all non-aliasing caches.
> 
> get_user_pages() works fine for whatever memory on other platforms and
> drivers such as etnaviv, so I think this comes down to the vchip driver
> doing things in ways that the kernel interfaces its using don't expect -
> exactly like the "lets pass full pages to the DMA API" broken-ness.

See previous comment.

> I would like to hear the justification for that statement, but without
> any justification, I assert that the statement is false.

I am the Phil in question, and the off-the-cuff comment was the result of
a hazy memory of issues encountered with VCHIQ bulk transfers as a Broadcom
employee (which would have been on a 2.6 kernel). I suspect there may have
been some use of kernel virtual addresses as an intermediate representation,
but I no longer have access to that code.

If get_user_pages is HIGHMEM-safe (and I can see why it would be), then the
cause of the corruption Stefan saw is probably the special handling of
unaligned reads, specifically:

memcpy((char *)page_address(pages[0]) +
pagelist->offset,
fragments,
head_bytes);

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


Re: [Bug] VCHIQ functional test broken

2017-05-15 Thread Stefan Wahren
Am 15.05.2017 um 16:29 schrieb Phil Elwell:
> On 13/05/2017 10:30, Russell King - ARM Linux wrote:
>> On Sat, May 13, 2017 at 11:07:28AM +0200, Stefan Wahren wrote:
>>> In the meantime this issue has been fixed by Phil [1].
>> Right - definitely a driver bug.  Mapping more memory for DMA than is
>> actually going to be DMA'd to and expecting data to be preserved is
>> really horrid.
> That feature was added during the upstreaming process, and as Stefan says
> there is an outstanding patch for it.
>
>>> Unfortunately i found another issue. If i enable CONFIG_HIGHMEM in
>>> the kernel config, the data during functional test gets corrupted.
>>> Phil said it's caused by the usage of get_user_pages() [2].
>> Without knowing who "Phil" is in that thread, but...
>>
>>HIGHMEM is a problem because you can't use get_user_pages on pages in
>>HIGHMEM.
>>
>> is an interesting statement, and without any reasoning or evidence.
>>
>> I also believe it to be incorrect.  get_user_pages() returns an array
>> of struct page pointers for the user memory, calling flush_dcache_page()
>> and flush_anon_page() on them to ensure that any kernel mapping is
>> coherent with what is in userspace.
>>
>> As far as returning the array of page pointers, get_user_pages() doesn't
>> care whether they're lowmem or highmem.
>>
>> flush_dcache_page() doesn't care either - if it wants to flush the page
>> and the page is a highmem page, it will temporarily map it before
>> flushing it.
>>
>> flush_anon_page() is a no-op for all non-aliasing caches.
>>
>> get_user_pages() works fine for whatever memory on other platforms and
>> drivers such as etnaviv, so I think this comes down to the vchip driver
>> doing things in ways that the kernel interfaces its using don't expect -
>> exactly like the "lets pass full pages to the DMA API" broken-ness.
> See previous comment.
>
>> I would like to hear the justification for that statement, but without
>> any justification, I assert that the statement is false.
> I am the Phil in question, and the off-the-cuff comment was the result of
> a hazy memory of issues encountered with VCHIQ bulk transfers as a Broadcom
> employee (which would have been on a 2.6 kernel). I suspect there may have
> been some use of kernel virtual addresses as an intermediate representation,
> but I no longer have access to that code.
>
> If get_user_pages is HIGHMEM-safe (and I can see why it would be), then the
> cause of the corruption Stefan saw is probably the special handling of
> unaligned reads, specifically:
>
>   memcpy((char *)page_address(pages[0]) +
>   pagelist->offset,
>   fragments,
>   head_bytes);


Btw shouldn't we use copy_from_user() at this place?
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Bug] VCHIQ functional test broken

2017-05-15 Thread Phil Elwell
On 15/05/2017 15:54, Stefan Wahren wrote:
> Am 15.05.2017 um 16:29 schrieb Phil Elwell:
>> On 13/05/2017 10:30, Russell King - ARM Linux wrote:
>>> On Sat, May 13, 2017 at 11:07:28AM +0200, Stefan Wahren wrote:
 In the meantime this issue has been fixed by Phil [1].
>>> Right - definitely a driver bug.  Mapping more memory for DMA than is
>>> actually going to be DMA'd to and expecting data to be preserved is
>>> really horrid.
>> That feature was added during the upstreaming process, and as Stefan says
>> there is an outstanding patch for it.
>>
 Unfortunately i found another issue. If i enable CONFIG_HIGHMEM in
 the kernel config, the data during functional test gets corrupted.
 Phil said it's caused by the usage of get_user_pages() [2].
>>> Without knowing who "Phil" is in that thread, but...
>>>
>>>HIGHMEM is a problem because you can't use get_user_pages on pages in
>>>HIGHMEM.
>>>
>>> is an interesting statement, and without any reasoning or evidence.
>>>
>>> I also believe it to be incorrect.  get_user_pages() returns an array
>>> of struct page pointers for the user memory, calling flush_dcache_page()
>>> and flush_anon_page() on them to ensure that any kernel mapping is
>>> coherent with what is in userspace.
>>>
>>> As far as returning the array of page pointers, get_user_pages() doesn't
>>> care whether they're lowmem or highmem.
>>>
>>> flush_dcache_page() doesn't care either - if it wants to flush the page
>>> and the page is a highmem page, it will temporarily map it before
>>> flushing it.
>>>
>>> flush_anon_page() is a no-op for all non-aliasing caches.
>>>
>>> get_user_pages() works fine for whatever memory on other platforms and
>>> drivers such as etnaviv, so I think this comes down to the vchip driver
>>> doing things in ways that the kernel interfaces its using don't expect -
>>> exactly like the "lets pass full pages to the DMA API" broken-ness.
>> See previous comment.
>>
>>> I would like to hear the justification for that statement, but without
>>> any justification, I assert that the statement is false.
>> I am the Phil in question, and the off-the-cuff comment was the result of
>> a hazy memory of issues encountered with VCHIQ bulk transfers as a Broadcom
>> employee (which would have been on a 2.6 kernel). I suspect there may have
>> been some use of kernel virtual addresses as an intermediate representation,
>> but I no longer have access to that code.
>>
>> If get_user_pages is HIGHMEM-safe (and I can see why it would be), then the
>> cause of the corruption Stefan saw is probably the special handling of
>> unaligned reads, specifically:
>>
>>  memcpy((char *)page_address(pages[0]) +
>>  pagelist->offset,
>>  fragments,
>>  head_bytes);
> 
> 
> Btw shouldn't we use copy_from_user() at this place?

I'm sure you mean copy_to_user(), and the answer is "it's complicated". 
Depending
on the relative timing, this code can also be called from a kernel thread, so I
doubt that would work.

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


Re: [PATCH 1/2] staging: greybus: arche: remove timesync remains

2017-05-15 Thread Bryan O'Donoghue

On 15/05/17 15:26, Johan Hovold wrote:

Remove the remaining timesync bits that were left in the arche platform
driver and which prevented the driver from being compiled.

Fixes: bdfb95c4baab ("staging: greybus: remove timesync protocol support")
Signed-off-by: Johan Hovold 


I thought the plan was to drop arche* too ?

Why not just do that now ?

---
bod

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


Re: [PATCH 1/2] staging: greybus: arche: remove timesync remains

2017-05-15 Thread Johan Hovold
On Mon, May 15, 2017 at 04:17:55PM +0100, Bryan O'Donoghue wrote:
> On 15/05/17 15:26, Johan Hovold wrote:
> > Remove the remaining timesync bits that were left in the arche platform
> > driver and which prevented the driver from being compiled.
> >
> > Fixes: bdfb95c4baab ("staging: greybus: remove timesync protocol support")
> > Signed-off-by: Johan Hovold 
> 
> I thought the plan was to drop arche* too ?

Well it's not gonna live on in its current form at least.

> Why not just do that now ?

Since it's still needed to boot an Ara phone.

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


Re: [PATCH 2/2] staging: greybus: enable compile testing of arche driver

2017-05-15 Thread Randy Dunlap
On 05/15/17 07:26, Johan Hovold wrote:
> Add Arche platform-driver config option and allow the driver to be
> compile tested also without the usb3613 driver.
> 
> Signed-off-by: Johan Hovold 
> ---
>  drivers/staging/greybus/Kconfig  | 10 ++
>  drivers/staging/greybus/Makefile |  2 +-
>  drivers/staging/greybus/arche-platform.c |  7 +++
>  3 files changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/greybus/Kconfig b/drivers/staging/greybus/Kconfig
> index 50de2d72dde0..cc59cf93ab9e 100644
> --- a/drivers/staging/greybus/Kconfig
> +++ b/drivers/staging/greybus/Kconfig
> @@ -216,4 +216,14 @@ config GREYBUS_USB
> will be called gb-usb.ko
>  
>  endif# GREYBUS_BRIDGED_PHY
> +
> +config GREYBUS_ARCHE
> + tristate "Greybus Arche Platform driver"
> + depends on CONFIG_USB_CONFIG_USB_HSIC_USB3613 || COMPILE_TEST

depends on USB_HSIC_3613 || COMPILE_TEST
??

> + ---help---
> +   Select this option if you have an Arche device.
> +
> +   To compile this code as a module, chose M here: the module
> +   will be called gb-arche.ko
> +
>  endif# GREYBUS


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


[patch v2 1/6] tty: export tty_open_by_driver

2017-05-15 Thread Okash Khawaja
This exports tty_open_by_driver so that it can be called from other places 
inside the kernel. The checks for null file pointer are based on Alan Cox's 
patch here: 
http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1215095.html. 
Description below is quoted from it:

"[RFC] tty_port: allow a port to be opened with a tty that has no file handle

Let us create tty objects entirely in kernel space. Untested proposal to
show why all the ideas around rewriting half the uart stack are not needed.

With this a kernel created non file backed tty object could be used to 
handle
data, and set terminal modes. Not all ldiscs can cope with this as N_TTY in
particular has to work back to the fs/tty layer.

The tty_port code is however otherwise clean of file handles as far as I can
tell as is the low level tty port write path used by the ldisc, the
configuration low level interfaces and most of the ldiscs.

Currently you don't have any exposure to see tty hangups because those are
built around the file layer. However a) it's a fixed port so you probably
don't care about that b) if you do we can add a callback and c) you almost
certainly don't want the userspace tear down/rebuild behaviour anyway.

This should however be sufficient if we wanted for example to enumerate all
the bluetooth bound fixed ports via ACPI and make them directly available.

It doesn't deal with the case of a user opening a port that's also kernel
opened and that would need some locking out (so it returned EBUSY if bound
to a kernel device of some kind). That needs resolving along with how you
"up" or "down" your new bluetooth device, or enumerate it while providing
the existing tty API to avoid regressions (and to debug)."

The exported funtion is used later in this patch set to gain access to 
tty_struct.

Signed-off-by: Okash Khawaja 
Reviewed-by: Samuel Thibault 

Index: linux-staging/drivers/tty/tty_io.c
===
--- linux-staging.orig/drivers/tty/tty_io.c
+++ linux-staging/drivers/tty/tty_io.c
@@ -1369,7 +1369,10 @@ static struct tty_struct *tty_driver_loo
struct tty_struct *tty;
 
if (driver->ops->lookup)
-   tty = driver->ops->lookup(driver, file, idx);
+   if (!file)
+   tty = ERR_PTR(-EIO);
+   else
+   tty = driver->ops->lookup(driver, file, idx);
else
tty = driver->ttys[idx];
 
@@ -2001,7 +2004,7 @@ static struct tty_driver *tty_lookup_dri
struct tty_driver *console_driver = console_device(index);
if (console_driver) {
driver = tty_driver_kref_get(console_driver);
-   if (driver) {
+   if (driver && filp) {
/* Don't let /dev/console block */
filp->f_flags |= O_NONBLOCK;
break;
@@ -2034,7 +2037,7 @@ static struct tty_driver *tty_lookup_dri
  *   - concurrent tty driver removal w/ lookup
  *   - concurrent tty removal from driver table
  */
-static struct tty_struct *tty_open_by_driver(dev_t device, struct inode *inode,
+struct tty_struct *tty_open_by_driver(dev_t device, struct inode *inode,
 struct file *filp)
 {
struct tty_struct *tty;
@@ -2079,6 +2082,7 @@ out:
tty_driver_kref_put(driver);
return tty;
 }
+EXPORT_SYMBOL(tty_open_by_driver);
 
 /**
  * tty_open-   open a tty device
Index: linux-staging/include/linux/tty.h
===
--- linux-staging.orig/include/linux/tty.h
+++ linux-staging/include/linux/tty.h
@@ -401,6 +401,8 @@ extern struct tty_struct *get_current_tt
 /* tty_io.c */
 extern int __init tty_init(void);
 extern const char *tty_name(const struct tty_struct *tty);
+extern struct tty_struct *tty_open_by_driver(dev_t device, struct inode *inode,
+   struct file *filp);
 #else
 static inline void console_init(void)
 { }

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


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

2017-05-15 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,13 +93,22 @@
.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);
 
+static inline void get_termios(struct tty_struct *tty, struct ktermios 
*out_termios)
+{
+   down_read(&tty->termios_rwsem);
+   *out_termios = tty->termios;
+   up_read(&tty->termios_rwsem);
+}
+
 static int spk_ttyio_initialise_ldisc(int ser)
 {
int ret = 0;
struct tty_struct *tty;
+   struct ktermios tmp_termios;
 
ret = tty_register_ldisc(N_SPEAKUP, &spk_ttyio_ldisc_ops);
if (ret) {
@@ -127,6 +137,20 @@
}
 
clear_bit(TTY_HUPPED, &tty->flags);
+   /* ensure hardware flow control is enabled */
+   get_termios(tty, &tmp_termios);
+   if (!(tmp_termios.c_cflag & CRTSCTS)) {
+   tmp_termios.c_cflag |= CRTSCTS;
+   tty_set_termios(tty, &tmp_termios);
+   /*
+* check c_cflag to see if it's updated as tty_set_termios may 
not return
+* error even when no tty bits are changed by the request.
+*/
+   get_termios(tty, &tmp_termios);
+   if (!(tmp_termios.c_cflag & CRTSCTS))
+   pr_warn("speakup: Failed to set hardware flow 
control\n");
+   }
+
tty_unlock(tty);
 
ret = tty_set_ldisc(tty, N_SPEAKUP);
@@ -201,6 +225,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/s

[patch v2 5/6] staging: speakup: migrate apollo, ltlk, audptr, decext, dectlk and spkout

2017-05-15 Thread Okash Khawaja
This patch simply uses the changes introduced in previous patches and migrates
apollo, ltlk, audptr, decext, spkout and dectlk. Migrations are straightforward
function pointer updates.

Signed-off by: Okash Khawaja 
Reviewed-by: Samuel Thibault 

Index: linux-staging/drivers/staging/speakup/speakup_apollo.c
===
--- linux-staging.orig/drivers/staging/speakup/speakup_apollo.c
+++ linux-staging/drivers/staging/speakup/speakup_apollo.c
@@ -22,9 +22,9 @@
 #include 
 #include 
 #include 
+#include   /* for UART_MCR* constants */
 
 #include "spk_priv.h"
-#include "serialio.h"
 #include "speakup.h"
 
 #define DRV_VERSION "2.21"
@@ -108,10 +108,10 @@
.startup = SYNTH_START,
.checkval = SYNTH_CHECK,
.vars = vars,
-   .io_ops = &spk_serial_io_ops,
-   .probe = spk_serial_synth_probe,
-   .release = spk_serial_release,
-   .synth_immediate = spk_serial_synth_immediate,
+   .io_ops = &spk_ttyio_ops,
+   .probe = spk_ttyio_synth_probe,
+   .release = spk_ttyio_release,
+   .synth_immediate = spk_ttyio_synth_immediate,
.catch_up = do_catch_up,
.flush = spk_synth_flush,
.is_alive = spk_synth_is_alive_restart,
Index: linux-staging/drivers/staging/speakup/speakup_ltlk.c
===
--- linux-staging.orig/drivers/staging/speakup/speakup_ltlk.c
+++ linux-staging/drivers/staging/speakup/speakup_ltlk.c
@@ -20,7 +20,6 @@
  */
 #include "speakup.h"
 #include "spk_priv.h"
-#include "serialio.h"
 #include "speakup_dtlk.h" /* local header file for LiteTalk values */
 
 #define DRV_VERSION "2.11"
@@ -111,10 +110,10 @@
.startup = SYNTH_START,
.checkval = SYNTH_CHECK,
.vars = vars,
-   .io_ops = &spk_serial_io_ops,
+   .io_ops = &spk_ttyio_ops,
.probe = synth_probe,
-   .release = spk_serial_release,
-   .synth_immediate = spk_serial_synth_immediate,
+   .release = spk_ttyio_release,
+   .synth_immediate = spk_ttyio_synth_immediate,
.catch_up = spk_do_catch_up,
.flush = spk_synth_flush,
.is_alive = spk_synth_is_alive_restart,
@@ -159,7 +158,7 @@
 {
int failed = 0;
 
-   failed = spk_serial_synth_probe(synth);
+   failed = spk_ttyio_synth_probe(synth);
if (failed == 0)
synth_interrogate(synth);
synth->alive = !failed;
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
@@ -20,7 +20,6 @@
  */
 #include "spk_priv.h"
 #include "speakup.h"
-#include "serialio.h"
 
 #define DRV_VERSION "2.11"
 #define SYNTH_CLEAR 0x18 /* flush synth buffer */
@@ -104,10 +103,10 @@
.startup = SYNTH_START,
.checkval = SYNTH_CHECK,
.vars = vars,
-   .io_ops = &spk_serial_io_ops,
+   .io_ops = &spk_ttyio_ops,
.probe = synth_probe,
-   .release = spk_serial_release,
-   .synth_immediate = spk_serial_synth_immediate,
+   .release = spk_ttyio_release,
+   .synth_immediate = spk_ttyio_synth_immediate,
.catch_up = spk_do_catch_up,
.flush = synth_flush,
.is_alive = spk_synth_is_alive_restart,
@@ -154,7 +153,7 @@
 {
int failed;
 
-   failed = spk_serial_synth_probe(synth);
+   failed = spk_ttyio_synth_probe(synth);
if (failed == 0)
synth_version(synth);
synth->alive = !failed;
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
@@ -24,12 +24,12 @@
 #include 
 
 #include "spk_priv.h"
-#include "serialio.h"
 #include "speakup.h"
 
 #define DRV_VERSION "2.14"
 #define SYNTH_CLEAR 0x03
 #define PROCSPEECH 0x0b
+
 static volatile unsigned char last_char;
 
 static void read_buff_add(u_char ch)
@@ -123,10 +123,10 @@
.startup = SYNTH_START,
.checkval = SYNTH_CHECK,
.vars = vars,
-   .io_ops = &spk_serial_io_ops,
-   .probe = spk_serial_synth_probe,
-   .release = spk_serial_release,
-   .synth_immediate = spk_serial_synth_immediate,
+   .io_ops = &spk_ttyio_ops,
+   .probe = spk_ttyio_synth_probe,
+   .release = spk_ttyio_release,
+   .synth_immediate = spk_ttyio_synth_immediate,
.catch_up = do_catch_up,
.flush = synth_flush,
.is_alive = spk_synth_is_alive_restart,
Index: linux-staging/drivers/staging/speakup/speakup_spkout.c
===
--- linux-staging.orig/drivers/staging/speakup/speakup_spkout.c
+++ linux-staging/drivers/staging/speakup/speakup_spkout.c
@@ -20,7 +20,6 @@
  */
 #include "spk_priv

[patch v2 2/6] staging: speakup: add tty-based comms functions

2017-05-15 Thread Okash Khawaja
This adds spk_ttyio.c file. It contains a set of functions which implement
those methods in spk_synth struct which relate to sending bytes out using
serial comms. Implementations in this file perform the same function but
using TTY subsystem instead. Currently synths access serial ports, directly
poking standard ISA ports by trying to steal them from serial driver. Some ISA
cards actually need this way of doing it, but most other synthesizers don't,
and can actually work by using the proper TTY subsystem through a new N_SPEAKUP
line discipline. So this adds the methods for drivers to switch to accessing
serial ports through the TTY subsystem, whenever appropriate.

Signed-off-by: Okash Khawaja 
Reviewed-by: Samuel Thibault 

Index: linux-staging/drivers/staging/speakup/Makefile
===
--- linux-staging.orig/drivers/staging/speakup/Makefile
+++ linux-staging/drivers/staging/speakup/Makefile
@@ -25,6 +25,7 @@ speakup-y := \
kobjects.o \
selection.o \
serialio.o \
+   spk_ttyio.o \
synth.o \
thread.o \
varhandlers.o
Index: linux-staging/drivers/staging/speakup/spk_priv.h
===
--- linux-staging.orig/drivers/staging/speakup/spk_priv.h
+++ linux-staging/drivers/staging/speakup/spk_priv.h
@@ -44,6 +44,7 @@ const struct old_serial_port *spk_serial
 void spk_stop_serial_interrupt(void);
 int spk_wait_for_xmitr(struct spk_synth *in_synth);
 void spk_serial_release(void);
+void spk_ttyio_release(void);
 
 void synth_buffer_skip_nonlatin1(void);
 u16 synth_buffer_getc(void);
@@ -56,7 +57,9 @@ ssize_t spk_var_store(struct kobject *ko
  const char *buf, size_t count);
 
 int spk_serial_synth_probe(struct spk_synth *synth);
+int spk_ttyio_synth_probe(struct spk_synth *synth);
 const char *spk_serial_synth_immediate(struct spk_synth *synth, const char 
*buff);
+const char *spk_ttyio_synth_immediate(struct spk_synth *synth, const char 
*buff);
 void spk_do_catch_up(struct spk_synth *synth);
 void spk_synth_flush(struct spk_synth *synth);
 unsigned char spk_synth_get_index(struct spk_synth *synth);
@@ -78,5 +81,6 @@ extern struct speakup_info_t speakup_inf
 extern struct var_t synth_time_vars[];
 
 extern struct spk_io_ops spk_serial_io_ops;
+extern struct spk_io_ops spk_ttyio_ops;
 
 #endif
Index: linux-staging/drivers/staging/speakup/spk_ttyio.c
===
--- /dev/null
+++ linux-staging/drivers/staging/speakup/spk_ttyio.c
@@ -0,0 +1,143 @@
+#include 
+#include 
+
+#include "speakup.h"
+#include "spk_types.h"
+
+static struct tty_struct *speakup_tty;
+
+static int spk_ttyio_ldisc_open(struct tty_struct *tty)
+{
+   if (tty->ops->write == NULL)
+   return -EOPNOTSUPP;
+   speakup_tty = tty;
+
+   return 0;
+}
+
+static void spk_ttyio_ldisc_close(struct tty_struct *tty)
+{
+   speakup_tty = NULL;
+}
+
+static struct tty_ldisc_ops spk_ttyio_ldisc_ops = {
+   .owner  = THIS_MODULE,
+   .magic  = TTY_LDISC_MAGIC,
+   .name   = "speakup_ldisc",
+   .open   = spk_ttyio_ldisc_open,
+   .close  = spk_ttyio_ldisc_close,
+};
+
+static int spk_ttyio_out(struct spk_synth *in_synth, const char ch);
+struct spk_io_ops spk_ttyio_ops = {
+   .synth_out = spk_ttyio_out,
+};
+EXPORT_SYMBOL_GPL(spk_ttyio_ops);
+
+static int spk_ttyio_initialise_ldisc(int ser)
+{
+   int ret = 0;
+   struct tty_struct *tty;
+
+   ret = tty_register_ldisc(N_SPEAKUP, &spk_ttyio_ldisc_ops);
+   if (ret) {
+   pr_err("Error registering line discipline.\n");
+   return ret;
+   }
+
+   if (ser < 0 || ser > (255 - 64)) {
+   pr_err("speakup: Invalid ser param. Must be between 0 and 191 
inclusive.\n");
+   return -EINVAL;
+   }
+
+   /* TODO: support more than ttyS* */
+   tty = tty_open_by_driver(MKDEV(4, (ser +  64)), NULL, NULL);
+   if (IS_ERR(tty))
+   return PTR_ERR(tty);
+
+   if (tty->ops->open)
+   ret = tty->ops->open(tty, NULL);
+   else
+   ret = -ENODEV;
+
+   if (ret) {
+   tty_unlock(tty);
+   return ret;
+   }
+
+   clear_bit(TTY_HUPPED, &tty->flags);
+   tty_unlock(tty);
+
+   ret = tty_set_ldisc(tty, N_SPEAKUP);
+
+   return ret;
+}
+
+static int spk_ttyio_out(struct spk_synth *in_synth, const char ch)
+{
+   if (in_synth->alive && speakup_tty && speakup_tty->ops->write) {
+   int ret = speakup_tty->ops->write(speakup_tty, &ch, 1);
+   if (ret == 0)
+   /* No room */
+   return 0;
+   if (ret < 0) {
+   pr_warn("%s: I/O error, deactivating speakup\n", 
in_synth->long_name);
+   /* No synth any more, so nobody will 

[patch v2 0/6] staging: speakup: migrate synths to use TTY-based comms

2017-05-15 Thread Okash Khawaja
This patchset migrates all external synths from using raw serial i/o to
using tty-based comms. The synths not migrated are internal ones -
plugged directly into motherboard, communicating over ISA etc. It's
important to note that these patches access TTY from inside kernel.

Here is the summary of the patches in this set.

Patch 1: Exports tty_open_by_driver in order to allow the speakup to
access it.
Patch 2: Adds spk_ttyio.c, a container of TTY-based comms.
Patch 3: Migrates some synths which use relatively simple comms - output
only.
Patch 4: Adds more TTY-based functionality that wasn't already added in
patch 2.
Patch 5: Migrates remaining external synths based.
Patch 6: Contains these fixes: flushing TTY buffers and ensuring hardware
flow control.

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


[patch v2 4/6] staging: speakup: add send_xchar, tiocmset and input functionality for tty

2017-05-15 Thread Okash Khawaja
This patch adds further TTY-based functionality, specifically implementation
of send_xchar and tiocmset methods, and input. send_xchar and tiocmset
methods simply delegate to corresponding TTY operations.

For input, it implements the receive_buf2 callback in tty_ldisc_ops of
speakup's ldisc. If a synth defines read_buff_add method then receive_buf2
simply delegates to that and returns.

For spk_ttyio_in, the data is passed from receive_buf2 thread to
spk_ttyio_in thread through spk_ldisc_data structure. It has following
members:

- char buf: represents data received
- struct semaphore sem: used to signal to spk_ttyio_in thread that data
is available to be read without having to busy wait
- bool buf_free: this is used in comination with mb() calls to syncronise
the two threads over buf

receive_buf2 only writes to buf if buf_free is true. The check for buf_free
and writing to buf are separated by mb() to ensure that spk_ttyio_in has read
buf before receive_buf2 writes to it. After writing, it ups the semaphore to
signal to spk_ttyio_in that there is now data to read.

spk_ttyio_in waits for data to read by downing the semaphore. Thus when
signalled by receive_buf2 thread above, it reads from buf and sets buf_free
to true. These two operations are separated by mb() to ensure that
receive_buf2 thread finds buf_free to be true only after buf has been read.
After that spk_ttyio_in calls tty_schedule_flip for subsequent data to come
in through receive_buf2.

Signed-off-by: Okash Khawaja 
Reviewed-by: Samuel Thibault 

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
@@ -1,36 +1,97 @@
 #include 
 #include 
+#include 
+#include 
 
 #include "speakup.h"
 #include "spk_types.h"
+#include "spk_priv.h"
 
+struct spk_ldisc_data {
+   char buf;
+   struct semaphore sem;
+   bool buf_free;
+};
+
+static struct spk_synth *spk_ttyio_synth;
 static struct tty_struct *speakup_tty;
 
 static int spk_ttyio_ldisc_open(struct tty_struct *tty)
 {
+   struct spk_ldisc_data *ldisc_data;
+
if (tty->ops->write == NULL)
return -EOPNOTSUPP;
speakup_tty = tty;
 
+   ldisc_data = kmalloc(sizeof(struct spk_ldisc_data), GFP_KERNEL);
+   if (!ldisc_data) {
+   pr_err("speakup: Failed to allocate ldisc_data.\n");
+   return -ENOMEM;
+   }
+
+   sema_init(&ldisc_data->sem, 0);
+   ldisc_data->buf_free = true;
+   speakup_tty->disc_data = ldisc_data;
+
return 0;
 }
 
 static void spk_ttyio_ldisc_close(struct tty_struct *tty)
 {
+   kfree(speakup_tty->disc_data);
speakup_tty = NULL;
 }
 
+static int spk_ttyio_receive_buf2(struct tty_struct *tty,
+   const unsigned char *cp, char *fp, int count)
+{
+   struct spk_ldisc_data *ldisc_data = tty->disc_data;
+
+   if (spk_ttyio_synth->read_buff_add) {
+   int i;
+   for (i = 0; i < count; i++)
+   spk_ttyio_synth->read_buff_add(cp[i]);
+
+   return count;
+   }
+
+   if (!ldisc_data->buf_free)
+   /* ttyio_in will tty_schedule_flip */
+   return 0;
+
+   /* Make sure the consumer has read buf before we have seen
+ * buf_free == true and overwrite buf */
+   mb();
+
+   ldisc_data->buf = cp[0];
+   ldisc_data->buf_free = false;
+   up(&ldisc_data->sem);
+
+   return 1;
+}
+
 static struct tty_ldisc_ops spk_ttyio_ldisc_ops = {
.owner  = THIS_MODULE,
.magic  = TTY_LDISC_MAGIC,
.name   = "speakup_ldisc",
.open   = spk_ttyio_ldisc_open,
.close  = spk_ttyio_ldisc_close,
+   .receive_buf2   = spk_ttyio_receive_buf2,
 };
 
 static int spk_ttyio_out(struct spk_synth *in_synth, const char ch);
+static void spk_ttyio_send_xchar(char ch);
+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);
+
 struct spk_io_ops spk_ttyio_ops = {
.synth_out = spk_ttyio_out,
+   .send_xchar = spk_ttyio_send_xchar,
+   .tiocmset = spk_ttyio_tiocmset,
+   .synth_in = spk_ttyio_in,
+   .synth_in_nowait = spk_ttyio_in_nowait,
 };
 EXPORT_SYMBOL_GPL(spk_ttyio_ops);
 
@@ -95,6 +156,51 @@
return 0;
 }
 
+static void spk_ttyio_send_xchar(char ch)
+{
+   speakup_tty->ops->send_xchar(speakup_tty, ch);
+}
+
+static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear)
+{
+   speakup_tty->ops->tiocmset(speakup_tty, set, clear);
+}
+
+static unsigned char ttyio_in(int timeout)
+{
+   struct spk_ldisc_data *ldisc_data = speakup_tty->disc_data;
+   char rv;
+
+   if (down_timeout(&ldisc_data->sem, usecs_to_jiffies(timeout)) == 
-ETIME) {
+ 

[patch v2 3/6] staging: speakup: migrate acntsa, bns, dummy and txprt to ttyio

2017-05-15 Thread Okash Khawaja
This changes the above five synths to TTY-based comms. They were chosen as a
first pass because their serial comms are straightforward, i.e. they don't use
serial input and don't do internal port knocking.

Signed-off-by: Okash Khawaja 
Reviewed-by: Samuel Thibault 

Index: linux-staging/drivers/staging/speakup/speakup_dummy.c
===
--- linux-staging.orig/drivers/staging/speakup/speakup_dummy.c
+++ linux-staging/drivers/staging/speakup/speakup_dummy.c
@@ -98,10 +98,10 @@ static struct spk_synth synth_dummy = {
.startup = SYNTH_START,
.checkval = SYNTH_CHECK,
.vars = vars,
-   .io_ops = &spk_serial_io_ops,
-   .probe = spk_serial_synth_probe,
-   .release = spk_serial_release,
-   .synth_immediate = spk_serial_synth_immediate,
+   .io_ops = &spk_ttyio_ops,
+   .probe = spk_ttyio_synth_probe,
+   .release = spk_ttyio_release,
+   .synth_immediate = spk_ttyio_synth_immediate,
.catch_up = spk_do_catch_up,
.flush = spk_synth_flush,
.is_alive = spk_synth_is_alive_restart,
Index: linux-staging/drivers/staging/speakup/speakup_acntsa.c
===
--- linux-staging.orig/drivers/staging/speakup/speakup_acntsa.c
+++ linux-staging/drivers/staging/speakup/speakup_acntsa.c
@@ -99,10 +99,10 @@ static struct spk_synth synth_acntsa = {
.startup = SYNTH_START,
.checkval = SYNTH_CHECK,
.vars = vars,
-   .io_ops = &spk_serial_io_ops,
+   .io_ops = &spk_ttyio_ops,
.probe = synth_probe,
-   .release = spk_serial_release,
-   .synth_immediate = spk_serial_synth_immediate,
+   .release = spk_ttyio_release,
+   .synth_immediate = spk_ttyio_synth_immediate,
.catch_up = spk_do_catch_up,
.flush = spk_synth_flush,
.is_alive = spk_synth_is_alive_restart,
@@ -125,7 +125,7 @@ static int synth_probe(struct spk_synth
 {
int failed;
 
-   failed = spk_serial_synth_probe(synth);
+   failed = spk_ttyio_synth_probe(synth);
if (failed == 0) {
synth->synth_immediate(synth, "\033=R\r");
mdelay(100);
Index: linux-staging/drivers/staging/speakup/speakup_txprt.c
===
--- linux-staging.orig/drivers/staging/speakup/speakup_txprt.c
+++ linux-staging/drivers/staging/speakup/speakup_txprt.c
@@ -95,10 +95,10 @@ static struct spk_synth synth_txprt = {
.startup = SYNTH_START,
.checkval = SYNTH_CHECK,
.vars = vars,
-   .io_ops = &spk_serial_io_ops,
-   .probe = spk_serial_synth_probe,
-   .release = spk_serial_release,
-   .synth_immediate = spk_serial_synth_immediate,
+   .io_ops = &spk_ttyio_ops,
+   .probe = spk_ttyio_synth_probe,
+   .release = spk_ttyio_release,
+   .synth_immediate = spk_ttyio_synth_immediate,
.catch_up = spk_do_catch_up,
.flush = spk_synth_flush,
.is_alive = spk_synth_is_alive_restart,

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


[PATCH v3 2/2] staging: ks7010: avoid CamelCase: local variables in ks_hostif.c

2017-05-15 Thread Janusz Lisiecki
Replace CamelCase local variables' name with underscores to comply
with the standard kernel coding style.
Changed:
- LinkSpeed
- TransmittedFrameCount
- ReceivedFragmentCount
- FailedCount
- FCSErrorCount

Signed-off-by: Janusz Lisiecki 
---
 drivers/staging/ks7010/ks_hostif.c | 33 -
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c 
b/drivers/staging/ks7010/ks_hostif.c
index 0f9a798..92ed175 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -994,22 +994,22 @@ void hostif_phy_information_confirm(struct 
ks_wlan_private *priv)
 {
struct iw_statistics *wstats = &priv->wstats;
unsigned char rssi, signal, noise;
-   unsigned char LinkSpeed;
-   unsigned int TransmittedFrameCount, ReceivedFragmentCount;
-   unsigned int FailedCount, FCSErrorCount;
+   unsigned char link_speed;
+   unsigned int transmitted_frame_count, received_fragment_count;
+   unsigned int failed_count, fcs_error_count;
 
DPRINTK(3, "\n");
rssi = get_BYTE(priv);
signal = get_BYTE(priv);
noise = get_BYTE(priv);
-   LinkSpeed = get_BYTE(priv);
-   TransmittedFrameCount = get_DWORD(priv);
-   ReceivedFragmentCount = get_DWORD(priv);
-   FailedCount = get_DWORD(priv);
-   FCSErrorCount = get_DWORD(priv);
+   link_speed = get_BYTE(priv);
+   transmitted_frame_count = get_DWORD(priv);
+   received_fragment_count = get_DWORD(priv);
+   failed_count = get_DWORD(priv);
+   fcs_error_count = get_DWORD(priv);
 
DPRINTK(4, "phyinfo confirm rssi=%d signal=%d\n", rssi, signal);
-   priv->current_rate = (LinkSpeed & RATE_MASK);
+   priv->current_rate = (link_speed & RATE_MASK);
wstats->qual.qual = signal;
wstats->qual.level = 256 - rssi;
wstats->qual.noise = 0; /* invalid noise value */
@@ -1017,14 +1017,13 @@ void hostif_phy_information_confirm(struct 
ks_wlan_private *priv)
 
DPRINTK(3, "\nrssi=%u\n"
   "signal=%u\n"
-  "LinkSpeed=%ux500Kbps\n"
-  "TransmittedFrameCount=%u\n"
-  "ReceivedFragmentCount=%u\n"
-  "FailedCount=%u\n"
-  "FCSErrorCount=%u\n",
-   rssi, signal, LinkSpeed, TransmittedFrameCount,
-   ReceivedFragmentCount, FailedCount, FCSErrorCount);
-
+  "link_speed=%ux500Kbps\n"
+  "transmitted_frame_count=%u\n"
+  "received_fragment_count=%u\n"
+  "failed_count=%u\n"
+  "fcs_error_count=%u\n",
+   rssi, signal, link_speed, transmitted_frame_count,
+   received_fragment_count, failed_count, fcs_error_count);
/* wake_up_interruptible_all(&priv->confirm_wait); */
complete(&priv->confirm_wait);
 }
-- 
1.9.1

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


[PATCH v3 0/2] Avoid CamelCases in ks7010 driver

2017-05-15 Thread Janusz Lisiecki
This patchset fix CamelCases in ks7010 driver except michael_mic
which will be replaced by kernel implementation in the future.
---
v2:
 - Rebased all patches to next-20170512. 2 and 8 should apply cleanly now
v3:
 - Rebased all not yet applied patched to staging-testing branch
   of gregkh/staging git (others from v1 and v2 are already there)

Janusz Lisiecki (2):
  staging: ks7010: avoid CamelCase: receiveDTIMs
  staging: ks7010: avoid CamelCase: local variables in ks_hostif.c

 drivers/staging/ks7010/ks_hostif.c | 59 +++---
 drivers/staging/ks7010/ks_hostif.h |  2 +-
 2 files changed, 30 insertions(+), 31 deletions(-)

-- 
1.9.1

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


[PATCH v3 1/2] staging: ks7010: avoid CamelCase: receiveDTIMs

2017-05-15 Thread Janusz Lisiecki
Replace CamelCase variable name with underscores to comply
with the standard kernel coding style.

Signed-off-by: Janusz Lisiecki 
---
 drivers/staging/ks7010/ks_hostif.c | 26 +-
 drivers/staging/ks7010/ks_hostif.h |  2 +-
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c 
b/drivers/staging/ks7010/ks_hostif.c
index caf2551..0f9a798 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -1660,13 +1660,13 @@ void hostif_phy_information_request(struct 
ks_wlan_private *priv)
 
 static
 void hostif_power_mgmt_request(struct ks_wlan_private *priv,
-  unsigned long mode, unsigned long wake_up,
-  unsigned long receiveDTIMs)
+   unsigned long mode, unsigned long wake_up,
+   unsigned long receive_dtims)
 {
struct hostif_power_mgmt_request_t *pp;
 
-   DPRINTK(3, "mode=%lu wake_up=%lu receiveDTIMs=%lu\n", mode, wake_up,
-   receiveDTIMs);
+   DPRINTK(3, "mode=%lu wake_up=%lu receive_dtims=%lu\n", mode, wake_up,
+   receive_dtims);
 
pp = hostif_generic_request(sizeof(*pp), HIF_POWER_MGMT_REQ);
if (!pp)
@@ -1674,7 +1674,7 @@ void hostif_power_mgmt_request(struct ks_wlan_private 
*priv,
 
pp->mode = cpu_to_le32((uint32_t)mode);
pp->wake_up = cpu_to_le32((uint32_t)wake_up);
-   pp->receiveDTIMs = cpu_to_le32((uint32_t)receiveDTIMs);
+   pp->receive_dtims = cpu_to_le32((uint32_t)receive_dtims);
 
/* send to device request */
ps_confirm_wait_inc(priv);
@@ -2218,44 +2218,44 @@ void hostif_sme_multicast_set(struct ks_wlan_private 
*priv)
 static
 void hostif_sme_power_mgmt_set(struct ks_wlan_private *priv)
 {
-   unsigned long mode, wake_up, receiveDTIMs;
+   unsigned long mode, wake_up, receive_dtims;
 
DPRINTK(3, "\n");
switch (priv->reg.power_mgmt) {
case POWER_MGMT_ACTIVE:
mode = POWER_ACTIVE;
wake_up = 0;
-   receiveDTIMs = 0;
+   receive_dtims = 0;
break;
case POWER_MGMT_SAVE1:
if (priv->reg.operation_mode == MODE_INFRASTRUCTURE) {
mode = POWER_SAVE;
wake_up = 0;
-   receiveDTIMs = 0;
+   receive_dtims = 0;
} else {
mode = POWER_ACTIVE;
wake_up = 0;
-   receiveDTIMs = 0;
+   receive_dtims = 0;
}
break;
case POWER_MGMT_SAVE2:
if (priv->reg.operation_mode == MODE_INFRASTRUCTURE) {
mode = POWER_SAVE;
wake_up = 0;
-   receiveDTIMs = 1;
+   receive_dtims = 1;
} else {
mode = POWER_ACTIVE;
wake_up = 0;
-   receiveDTIMs = 0;
+   receive_dtims = 0;
}
break;
default:
mode = POWER_ACTIVE;
wake_up = 0;
-   receiveDTIMs = 0;
+   receive_dtims = 0;
break;
}
-   hostif_power_mgmt_request(priv, mode, wake_up, receiveDTIMs);
+   hostif_power_mgmt_request(priv, mode, wake_up, receive_dtims);
 }
 
 static
diff --git a/drivers/staging/ks7010/ks_hostif.h 
b/drivers/staging/ks7010/ks_hostif.h
index 538600f..a148714 100644
--- a/drivers/staging/ks7010/ks_hostif.h
+++ b/drivers/staging/ks7010/ks_hostif.h
@@ -188,7 +188,7 @@ struct hostif_power_mgmt_request_t {
u32 wake_up;
 #define SLEEP_FALSE 0
 #define SLEEP_TRUE  1  /* not used */
-   u32 receiveDTIMs;
+   u32 receive_dtims;
 #define DTIM_FALSE 0
 #define DTIM_TRUE  1
 } __packed;
-- 
1.9.1

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


[PATCH 0/5] staging: media: lirc: Fix several checkpatch issues

2017-05-15 Thread Ricardo Silva
This patch series is intended to fix several checkpatch issues (from
CHECK level) found on lirc_zilog.c:

The 1st patch focus on whitespace related fixes.
The 2nd patch fixes NULL comparisons style.
The 3rd patch is for using __func__ in logging functions that are to
trace the function's name, instead of writing down the actual function
name.
The 4th patch changes use of sizeof(struct s) to sizeof(*s_ptr) instead.
Finally, the 5th patch fixes unbalanced braces around if/else
statements.

All checks were fixed, except for the following (and why):

 * CHECK: "Do not include the paragraph about writing to the Free
   Software Foundation...", in the file's header.
   Didn't want to mess with the license notice, unless given explicit
   permission.

 * CHECK: "struct mutex definition without comment", for the ir_lock
   mutex from struct IR. I understand the mutex is there to serialize
   access to the i2c bus but felt hesitant about adding such comment,
   due to lack of deeper knowledge about the driver.

 * CHECK: "Please don't use multiple blank lines". Two instances of
   these were left because acting as logical code blocks separators
   (separating vars declarations from functions, etc.). They seem
   intended for readability purposes.

 * CHECK: "Alignment should match open parenthesis", unchanged because
   makes the code more readable.

 * CHECK: "usleep_range is preferred over udelay".
   Wouldn't know which range to use, due to lack of deeper knowledge
   about the module.

 * CHECK: "ENOSYS means 'invalid syscall nr' and nothing else", in some
   of the module's ioctl function return paths. I believe correct return
   value here would be -ENOTTY, but had some doubts about doing the
   change, as this could break userspace. Will gladly do the change if
   it's OK.

Please advise if it's ok to go ahead and fix these remaining checks.

Ricardo Silva (5):
  staging: media: lirc: Fix whitespace style checks
  staging: media: lirc: Fix NULL comparisons style
  staging: media: lirc: Use __func__ for logging function name
  staging: media: lirc: Use sizeof(*p) instead of sizeof(struct P)
  staging: media: lirc: Fix unbalanced braces around if/else

 drivers/staging/media/lirc/lirc_zilog.c | 110 
 1 file changed, 56 insertions(+), 54 deletions(-)

-- 
2.12.2

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


[PATCH 4/5] staging: media: lirc: Use sizeof(*p) instead of sizeof(struct P)

2017-05-15 Thread Ricardo Silva
Fix all checkpatch reported issues for "CHECK: Prefer
kzalloc(sizeof(*)...) over kzalloc(sizeof(struct )...)".

Other similar case in the code already using recommended style, so make
it all consistent with the recommended practice.

Signed-off-by: Ricardo Silva 
---
 drivers/staging/media/lirc/lirc_zilog.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/media/lirc/lirc_zilog.c 
b/drivers/staging/media/lirc/lirc_zilog.c
index 99b5858124e0..7e36693b66a8 100644
--- a/drivers/staging/media/lirc/lirc_zilog.c
+++ b/drivers/staging/media/lirc/lirc_zilog.c
@@ -1474,7 +1474,7 @@ static int ir_probe(struct i2c_client *client, const 
struct i2c_device_id *id)
/* Use a single struct IR instance for both the Rx and Tx functions */
ir = get_ir_device_by_adapter(adap);
if (!ir) {
-   ir = kzalloc(sizeof(struct IR), GFP_KERNEL);
+   ir = kzalloc(sizeof(*ir), GFP_KERNEL);
if (!ir) {
ret = -ENOMEM;
goto out_no_ir;
@@ -1514,7 +1514,7 @@ static int ir_probe(struct i2c_client *client, const 
struct i2c_device_id *id)
rx = get_ir_rx(ir);
 
/* Set up a struct IR_tx instance */
-   tx = kzalloc(sizeof(struct IR_tx), GFP_KERNEL);
+   tx = kzalloc(sizeof(*tx), GFP_KERNEL);
if (!tx) {
ret = -ENOMEM;
goto out_put_xx;
@@ -1558,7 +1558,7 @@ static int ir_probe(struct i2c_client *client, const 
struct i2c_device_id *id)
tx = get_ir_tx(ir);
 
/* Set up a struct IR_rx instance */
-   rx = kzalloc(sizeof(struct IR_rx), GFP_KERNEL);
+   rx = kzalloc(sizeof(*rx), GFP_KERNEL);
if (!rx) {
ret = -ENOMEM;
goto out_put_xx;
-- 
2.12.2

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


[PATCH 2/5] staging: media: lirc: Fix NULL comparisons style

2017-05-15 Thread Ricardo Silva
Fix all checkpatch reported issues for "CHECK: Comparison to NULL could
be written...".

Do these comparisons using the recommended coding style and consistent
with other similar cases in the file, which already used the recommended
way.

Signed-off-by: Ricardo Silva 
---
 drivers/staging/media/lirc/lirc_zilog.c | 48 -
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/media/lirc/lirc_zilog.c 
b/drivers/staging/media/lirc/lirc_zilog.c
index 0cb974461cd2..b33a2c820dc2 100644
--- a/drivers/staging/media/lirc/lirc_zilog.c
+++ b/drivers/staging/media/lirc/lirc_zilog.c
@@ -215,7 +215,7 @@ static struct IR_rx *get_ir_rx(struct IR *ir)
 
spin_lock(&ir->rx_ref_lock);
rx = ir->rx;
-   if (rx != NULL)
+   if (rx)
kref_get(&rx->ref);
spin_unlock(&ir->rx_ref_lock);
return rx;
@@ -277,7 +277,7 @@ static struct IR_tx *get_ir_tx(struct IR *ir)
 
spin_lock(&ir->tx_ref_lock);
tx = ir->tx;
-   if (tx != NULL)
+   if (tx)
kref_get(&tx->ref);
spin_unlock(&ir->tx_ref_lock);
return tx;
@@ -327,12 +327,12 @@ static int add_to_buf(struct IR *ir)
}
 
rx = get_ir_rx(ir);
-   if (rx == NULL)
+   if (!rx)
return -ENXIO;
 
/* Ensure our rx->c i2c_client remains valid for the duration */
mutex_lock(&rx->client_lock);
-   if (rx->c == NULL) {
+   if (!rx->c) {
mutex_unlock(&rx->client_lock);
put_ir_rx(rx, false);
return -ENXIO;
@@ -388,7 +388,7 @@ static int add_to_buf(struct IR *ir)
break;
}
schedule_timeout((100 * HZ + 999) / 1000);
-   if (tx != NULL)
+   if (tx)
tx->need_boot = 1;
 
++failures;
@@ -444,7 +444,7 @@ static int add_to_buf(struct IR *ir)
} while (!lirc_buffer_full(rbuf));
 
mutex_unlock(&rx->client_lock);
-   if (tx != NULL)
+   if (tx)
put_ir_tx(tx, false);
put_ir_rx(rx, false);
return ret;
@@ -772,7 +772,7 @@ static int fw_load(struct IR_tx *tx)
 
/* Parse the file */
tx_data = vmalloc(sizeof(*tx_data));
-   if (tx_data == NULL) {
+   if (!tx_data) {
release_firmware(fw_entry);
ret = -ENOMEM;
goto out;
@@ -781,7 +781,7 @@ static int fw_load(struct IR_tx *tx)
 
/* Copy the data so hotplug doesn't get confused and timeout */
tx_data->datap = vmalloc(fw_entry->size);
-   if (tx_data->datap == NULL) {
+   if (!tx_data->datap) {
release_firmware(fw_entry);
vfree(tx_data);
ret = -ENOMEM;
@@ -818,7 +818,7 @@ static int fw_load(struct IR_tx *tx)
 
tx_data->code_sets = vmalloc(
tx_data->num_code_sets * sizeof(char *));
-   if (tx_data->code_sets == NULL) {
+   if (!tx_data->code_sets) {
fw_unload_locked();
ret = -ENOMEM;
goto out;
@@ -905,7 +905,7 @@ static ssize_t read(struct file *filep, char __user 
*outbuf, size_t n,
}
 
rx = get_ir_rx(ir);
-   if (rx == NULL)
+   if (!rx)
return -ENXIO;
 
/*
@@ -,12 +,12 @@ static ssize_t write(struct file *filep, const char 
__user *buf, size_t n,
 
/* Get a struct IR_tx reference */
tx = get_ir_tx(ir);
-   if (tx == NULL)
+   if (!tx)
return -ENXIO;
 
/* Ensure our tx->c i2c_client remains valid for the duration */
mutex_lock(&tx->client_lock);
-   if (tx->c == NULL) {
+   if (!tx->c) {
mutex_unlock(&tx->client_lock);
put_ir_tx(tx, false);
return -ENXIO;
@@ -1215,7 +1215,7 @@ static unsigned int poll(struct file *filep, poll_table 
*wait)
dev_dbg(ir->l.dev, "poll called\n");
 
rx = get_ir_rx(ir);
-   if (rx == NULL) {
+   if (!rx) {
/*
 * Revisit this, if our poll function ever reports writeable
 * status for Tx
@@ -1322,7 +1322,7 @@ static int open(struct inode *node, struct file *filep)
/* find our IR struct */
ir = get_ir_device_by_minor(minor);
 
-   if (ir == NULL)
+   if (!ir)
return -ENODEV;
 
atomic_inc(&ir->open_count);
@@ -1340,7 +1340,7 @@ static int close(struct inode *node, struct file *filep)
/* find our IR struct */
struct IR *ir = filep->private_data;
 
-   if (ir == NULL) {
+   if (!ir) {
pr_err("ir: close: no private_data attached to the file!\n");
return -ENODEV;
}
@@ -1407,7 +1407,7 @@ static int ir_remove(struct i2c_client *client)
if (strncmp("ir_tx_z8", client->name, 8) == 0) {
 

[PATCH 1/5] staging: media: lirc: Fix whitespace style checks

2017-05-15 Thread Ricardo Silva
Fix style issues reported by checkpatch, affecting whitespace only:

 * CHECK: "Please don't use multiple blank lines".
   Two of these still triggering and left untouched because used for
   separating logical blocks (vars from functions, etc.).

 * CHECK: "spaces preferred around that ''".
   All fixed.

 * CHECK: "Alignment should match open parenthesis".
   All fixed except one on line 1161, left untouched for readability.

Move towards recommended coding style without compromising readability.

Signed-off-by: Ricardo Silva 
---
 drivers/staging/media/lirc/lirc_zilog.c | 37 -
 1 file changed, 18 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/media/lirc/lirc_zilog.c 
b/drivers/staging/media/lirc/lirc_zilog.c
index 8ce1db04414a..0cb974461cd2 100644
--- a/drivers/staging/media/lirc/lirc_zilog.c
+++ b/drivers/staging/media/lirc/lirc_zilog.c
@@ -472,7 +472,7 @@ static int lirc_thread(void *arg)
 
/* if device not opened, we can sleep half a second */
if (atomic_read(&ir->open_count) == 0) {
-   schedule_timeout(HZ/2);
+   schedule_timeout(HZ / 2);
continue;
}
 
@@ -508,7 +508,7 @@ static void set_use_dec(void *data)
 
 /* safe read of a uint32 (always network byte order) */
 static int read_uint32(unsigned char **data,
-unsigned char *endp, unsigned int *val)
+  unsigned char *endp, unsigned int *val)
 {
if (*data + 4 > endp)
return 0;
@@ -520,7 +520,7 @@ static int read_uint32(unsigned char **data,
 
 /* safe read of a uint8 */
 static int read_uint8(unsigned char **data,
-   unsigned char *endp, unsigned char *val)
+ unsigned char *endp, unsigned char *val)
 {
if (*data + 1 > endp)
return 0;
@@ -530,7 +530,7 @@ static int read_uint8(unsigned char **data,
 
 /* safe skipping of N bytes */
 static int skip(unsigned char **data,
- unsigned char *endp, unsigned int distance)
+   unsigned char *endp, unsigned int distance)
 {
if (*data + distance > endp)
return 0;
@@ -540,7 +540,7 @@ static int skip(unsigned char **data,
 
 /* decompress key data into the given buffer */
 static int get_key_data(unsigned char *buf,
-unsigned int codeset, unsigned int key)
+   unsigned int codeset, unsigned int key)
 {
unsigned char *data, *endp, *diffs, *key_block;
unsigned char keys, ndiffs, id;
@@ -810,7 +810,7 @@ static int fw_load(struct IR_tx *tx)
goto corrupt;
 
if (!read_uint32(&data, tx_data->endp,
- &tx_data->num_code_sets))
+&tx_data->num_code_sets))
goto corrupt;
 
dev_dbg(tx->ir->l.dev, "%u IR blaster codesets loaded\n",
@@ -866,12 +866,12 @@ static int fw_load(struct IR_tx *tx)
 * global fixed
 */
if (!skip(&data, tx_data->endp,
-  1 + TX_BLOCK_SIZE - num_global_fixed))
+ 1 + TX_BLOCK_SIZE - num_global_fixed))
goto corrupt;
 
/* Then we have keys-1 blocks of key id+diffs */
if (!skip(&data, tx_data->endp,
-  (ndiffs + 1) * (keys - 1)))
+ (ndiffs + 1) * (keys - 1)))
goto corrupt;
}
ret = 0;
@@ -1065,7 +1065,7 @@ static int send_code(struct IR_tx *tx, unsigned int code, 
unsigned int key)
break;
dev_dbg(tx->ir->l.dev,
"NAK expected: i2c_master_send failed with %d (try 
%d)\n",
-   ret, i+1);
+   ret, i + 1);
}
if (ret != 1) {
dev_err(tx->ir->l.dev,
@@ -1231,7 +1231,7 @@ static unsigned int poll(struct file *filep, poll_table 
*wait)
poll_wait(filep, &rbuf->wait_poll, wait);
 
/* Indicate what ops could happen immediately without blocking */
-   ret = lirc_buffer_empty(rbuf) ? 0 : (POLLIN|POLLRDNORM);
+   ret = lirc_buffer_empty(rbuf) ? 0 : (POLLIN | POLLRDNORM);
 
dev_dbg(ir->l.dev, "poll result = %s\n",
ret ? "POLLIN|POLLRDNORM" : "none");
@@ -1255,15 +1255,15 @@ static long ioctl(struct file *filep, unsigned int cmd, 
unsigned long arg)
result = put_user(features, uptr);
break;
case LIRC_GET_REC_MODE:
-   if (!(features&LIRC_CAN_REC_MASK))
+   if (!(features & LIRC_CAN_REC_MASK))
return -ENOSYS;
 
result = put_user(LIRC_REC2MODE
- (features&LIRC_CAN_REC_MASK),
+ (features & LIRC_CAN_REC_MASK),

[PATCH 5/5] staging: media: lirc: Fix unbalanced braces around if/else

2017-05-15 Thread Ricardo Silva
Fix all checkpatch reported issues for:

 * CHECK: "braces {} should be used on all arms of this statement".
 * CHECK: "Unbalanced braces around else statement".

Make sure all if/else statements are balanced in terms of braces. Most
cases in code are, but a few were left unbalanced, so put them all
consistent with the recommended style.

Signed-off-by: Ricardo Silva 
---
 drivers/staging/media/lirc/lirc_zilog.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/lirc/lirc_zilog.c 
b/drivers/staging/media/lirc/lirc_zilog.c
index 7e36693b66a8..121126beccd0 100644
--- a/drivers/staging/media/lirc/lirc_zilog.c
+++ b/drivers/staging/media/lirc/lirc_zilog.c
@@ -554,9 +554,9 @@ static int get_key_data(unsigned char *buf,
if (!read_uint32(&data, tx_data->endp, &i))
goto corrupt;
 
-   if (i == codeset)
+   if (i == codeset) {
break;
-   else if (codeset > i) {
+   } else if (codeset > i) {
base = pos + 1;
--lim;
}
@@ -990,8 +990,9 @@ static int send_code(struct IR_tx *tx, unsigned int code, 
unsigned int key)
"failed to get data for code %u, key %u -- check 
lircd.conf entries\n",
code, key);
return ret;
-   } else if (ret != 0)
+   } else if (ret != 0) {
return ret;
+   }
 
/* Send the data block */
ret = send_data_block(tx, data_block);
@@ -1188,8 +1189,9 @@ static ssize_t write(struct file *filep, const char 
__user *buf, size_t n,
schedule_timeout((100 * HZ + 999) / 1000);
tx->need_boot = 1;
++failures;
-   } else
+   } else {
i += sizeof(int);
+   }
}
 
/* Release i2c bus */
-- 
2.12.2

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


[PATCH 3/5] staging: media: lirc: Use __func__ for logging function name

2017-05-15 Thread Ricardo Silva
Fix all checkpatch reported issues for "CHECK: Prefer using '"%s...",
__func__' to using '', ..."

Use recommended style. Additionally, __func__ was already used in
similar cases throughout the code, so make it all consistent.

Signed-off-by: Ricardo Silva 
---
 drivers/staging/media/lirc/lirc_zilog.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/lirc/lirc_zilog.c 
b/drivers/staging/media/lirc/lirc_zilog.c
index b33a2c820dc2..99b5858124e0 100644
--- a/drivers/staging/media/lirc/lirc_zilog.c
+++ b/drivers/staging/media/lirc/lirc_zilog.c
@@ -1212,7 +1212,7 @@ static unsigned int poll(struct file *filep, poll_table 
*wait)
struct lirc_buffer *rbuf = ir->l.rbuf;
unsigned int ret;
 
-   dev_dbg(ir->l.dev, "poll called\n");
+   dev_dbg(ir->l.dev, "%s called\n", __func__);
 
rx = get_ir_rx(ir);
if (!rx) {
@@ -1220,7 +1220,7 @@ static unsigned int poll(struct file *filep, poll_table 
*wait)
 * Revisit this, if our poll function ever reports writeable
 * status for Tx
 */
-   dev_dbg(ir->l.dev, "poll result = POLLERR\n");
+   dev_dbg(ir->l.dev, "%s result = POLLERR\n", __func__);
return POLLERR;
}
 
@@ -1233,7 +1233,7 @@ static unsigned int poll(struct file *filep, poll_table 
*wait)
/* Indicate what ops could happen immediately without blocking */
ret = lirc_buffer_empty(rbuf) ? 0 : (POLLIN | POLLRDNORM);
 
-   dev_dbg(ir->l.dev, "poll result = %s\n",
+   dev_dbg(ir->l.dev, "%s result = %s\n", __func__,
ret ? "POLLIN|POLLRDNORM" : "none");
return ret;
 }
@@ -1341,7 +1341,8 @@ static int close(struct inode *node, struct file *filep)
struct IR *ir = filep->private_data;
 
if (!ir) {
-   pr_err("ir: close: no private_data attached to the file!\n");
+   pr_err("ir: %s: no private_data attached to the file!\n",
+  __func__);
return -ENODEV;
}
 
-- 
2.12.2

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


[PATCH v3] staging: rtl8188eu: fix indentation error

2017-05-15 Thread Remco Verhoef
Fixes a 'code indent should use tabs where possible' checkpatch code
style error by changing whitespace into tabs.

Signed-off-by: Remco Verhoef 
---
Changes in v2:
  - More expressive commit message and subject
Changes in v3:
  - Align with struct, to line things up better

 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..9f51f54 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


Re: [PATCH 1/2] staging: greybus: arche: remove timesync remains

2017-05-15 Thread Bryan O'Donoghue

On 15/05/17 17:10, Johan Hovold wrote:

On Mon, May 15, 2017 at 04:17:55PM +0100, Bryan O'Donoghue wrote:

On 15/05/17 15:26, Johan Hovold wrote:

Remove the remaining timesync bits that were left in the arche platform
driver and which prevented the driver from being compiled.

Fixes: bdfb95c4baab ("staging: greybus: remove timesync protocol support")
Signed-off-by: Johan Hovold 


I thought the plan was to drop arche* too ?


Well it's not gonna live on in its current form at least.


Why not just do that now ?


Since it's still needed to boot an Ara phone.


Funny I thought the plan was to nuke it to get greybus out of staging.

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


[PATCH v2 4/7] staging: sm750fb: Remove typedef from "typedef enum _clock_type_t"

2017-05-15 Thread Matej Dujava
This patch removes typedefs from enum and renames it from "typedef enum
_clock_type_t" to "enum clock_type" as per kernel coding standards.

Signed-off-by: Matej Dujava 
---
 drivers/staging/sm750fb/ddk750_chip.h | 8 
 drivers/staging/sm750fb/ddk750_mode.c | 2 +-
 drivers/staging/sm750fb/ddk750_mode.h | 2 +-
 drivers/staging/sm750fb/sm750_hw.c| 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.h 
b/drivers/staging/sm750fb/ddk750_chip.h
index f2eee2b..e5cb436 100644
--- a/drivers/staging/sm750fb/ddk750_chip.h
+++ b/drivers/staging/sm750fb/ddk750_chip.h
@@ -31,17 +31,17 @@ enum logical_chip_type {
 };
 
 
-typedef enum _clock_type_t {
+enum clock_type {
MXCLK_PLL,
PRIMARY_PLL,
SECONDARY_PLL,
VGA0_PLL,
VGA1_PLL,
-}
-clock_type_t;
+};
+
 
 struct pll_value {
-   clock_type_t clockType;
+   enum clock_type clockType;
unsigned long inputFreq; /* Input clock frequency to the PLL */
 
/* Use this when clockType = PANEL_PLL */
diff --git a/drivers/staging/sm750fb/ddk750_mode.c 
b/drivers/staging/sm750fb/ddk750_mode.c
index bb673e1..24d3447 100644
--- a/drivers/staging/sm750fb/ddk750_mode.c
+++ b/drivers/staging/sm750fb/ddk750_mode.c
@@ -205,7 +205,7 @@ static int programModeRegisters(struct mode_parameter 
*pModeParam,
return ret;
 }
 
-int ddk750_setModeTiming(struct mode_parameter *parm, clock_type_t clock)
+int ddk750_setModeTiming(struct mode_parameter *parm, enum clock_type clock)
 {
struct pll_value pll;
unsigned int uiActualPixelClk;
diff --git a/drivers/staging/sm750fb/ddk750_mode.h 
b/drivers/staging/sm750fb/ddk750_mode.h
index d5eae36..704dbfd 100644
--- a/drivers/staging/sm750fb/ddk750_mode.h
+++ b/drivers/staging/sm750fb/ddk750_mode.h
@@ -32,5 +32,5 @@ struct mode_parameter {
enum spolarity clock_phase_polarity;
 };
 
-int ddk750_setModeTiming(struct mode_parameter *parm, clock_type_t clock);
+int ddk750_setModeTiming(struct mode_parameter *parm, enum clock_type clock);
 #endif
diff --git a/drivers/staging/sm750fb/sm750_hw.c 
b/drivers/staging/sm750fb/sm750_hw.c
index baf1bbd..3cdc4ae 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -253,7 +253,7 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc *crtc,
int ret, fmt;
u32 reg;
struct mode_parameter modparm;
-   clock_type_t clock;
+   enum clock_type clock;
struct sm750_dev *sm750_dev;
struct lynxfb_par *par;
 
-- 
1.8.3.1

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


[PATCH v2 6/7] staging: sm750fb: Remove typedef from "typedef enum _DPMS_t"

2017-05-15 Thread Matej Dujava
This patch removes typedefs from enum and renames it from
"typedef enum _DPMS_t" to "enum DPMS" as per kernel coding standards.

Signed-off-by: Matej Dujava 
---
 drivers/staging/sm750fb/ddk750_power.c | 2 +-
 drivers/staging/sm750fb/ddk750_power.h | 7 +++
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_power.c 
b/drivers/staging/sm750fb/ddk750_power.c
index 222ae1a..bc91e73 100644
--- a/drivers/staging/sm750fb/ddk750_power.c
+++ b/drivers/staging/sm750fb/ddk750_power.c
@@ -2,7 +2,7 @@
 #include "ddk750_reg.h"
 #include "ddk750_power.h"
 
-void ddk750_set_dpms(DPMS_t state)
+void ddk750_set_dpms(enum DPMS state)
 {
unsigned int value;
 
diff --git a/drivers/staging/sm750fb/ddk750_power.h 
b/drivers/staging/sm750fb/ddk750_power.h
index 44c4fc5..6764e53 100644
--- a/drivers/staging/sm750fb/ddk750_power.h
+++ b/drivers/staging/sm750fb/ddk750_power.h
@@ -1,20 +1,19 @@
 #ifndef DDK750_POWER_H__
 #define DDK750_POWER_H__
 
-typedef enum _DPMS_t {
+enum DPMS {
crtDPMS_ON = 0x0,
crtDPMS_STANDBY = 0x1,
crtDPMS_SUSPEND = 0x2,
crtDPMS_OFF = 0x3,
-}
-DPMS_t;
+};
 
 #define setDAC(off) {  \
poke32(MISC_CTRL,   \
   (peek32(MISC_CTRL) & ~MISC_CTRL_DAC_POWER_OFF) | (off)); \
 }
 
-void ddk750_set_dpms(DPMS_t state);
+void ddk750_set_dpms(enum DPMS state);
 void sm750_set_power_mode(unsigned int powerMode);
 void sm750_set_current_gate(unsigned int gate);
 
-- 
1.8.3.1

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


[PATCH v2 3/7] staging: sm750fb: Remove typedef from "typedef enum _logical_chip_type_t"

2017-05-15 Thread Matej Dujava
This patch removes typedefs from enum and renames it from "typedef enum
_logical_chip_type_t" to "enum logical_chip_type" as per kernel coding
standards.

Signed-off-by: Matej Dujava 
---
 drivers/staging/sm750fb/ddk750_chip.c | 2 +-
 drivers/staging/sm750fb/ddk750_chip.h | 8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.c 
b/drivers/staging/sm750fb/ddk750_chip.c
index 64d0a53..f009631 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -7,7 +7,7 @@
 
 static logical_chip_type_t chip;
 
-logical_chip_type_t sm750_get_chip_type(void)
+enum logical_chip_type sm750_get_chip_type(void)
 {
return chip;
 }
diff --git a/drivers/staging/sm750fb/ddk750_chip.h 
b/drivers/staging/sm750fb/ddk750_chip.h
index 2c7a9b9..f2eee2b 100644
--- a/drivers/staging/sm750fb/ddk750_chip.h
+++ b/drivers/staging/sm750fb/ddk750_chip.h
@@ -23,13 +23,13 @@ static inline void poke32(u32 data, u32 addr)
 }
 
 /* This is all the chips recognized by this library */
-typedef enum _logical_chip_type_t {
+enum logical_chip_type {
SM_UNKNOWN,
SM718,
SM750,
SM750LE,
-}
-logical_chip_type_t;
+};
+
 
 typedef enum _clock_type_t {
MXCLK_PLL,
@@ -93,7 +93,7 @@ struct initchip_param {
/* More initialization parameter can be added if needed */
 };
 
-logical_chip_type_t sm750_get_chip_type(void);
+enum logical_chip_type sm750_get_chip_type(void);
 void sm750_set_chip_type(unsigned short devId, u8 revId);
 unsigned int sm750_calc_pll_value(unsigned int request, struct  pll_value 
*pll);
 unsigned int sm750_format_pll_reg(struct pll_value *pPLL);
-- 
1.8.3.1

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


[PATCH v2 7/7] staging: sm750fb: Remove typedef from "typedef enum _sii164_hot_plug_mode_t"

2017-05-15 Thread Matej Dujava
This patch removes typedefs from enum and renames it from "typedef enum
_sii164_hot_plug_mode_t" to "enum sii164_hot_plug_mode" as per kernel
coding standards.

Signed-off-by: Matej Dujava 
---
 drivers/staging/sm750fb/ddk750_sii164.c | 2 +-
 drivers/staging/sm750fb/ddk750_sii164.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_sii164.c 
b/drivers/staging/sm750fb/ddk750_sii164.c
index 0431833..f7bf84e8 100644
--- a/drivers/staging/sm750fb/ddk750_sii164.c
+++ b/drivers/staging/sm750fb/ddk750_sii164.c
@@ -296,7 +296,7 @@ void sii164SetPower(unsigned char powerUp)
  *  sii164SelectHotPlugDetectionMode
  *  This function selects the mode of the hot plug detection.
  */
-static void sii164SelectHotPlugDetectionMode(sii164_hot_plug_mode_t 
hotPlugMode)
+static void sii164SelectHotPlugDetectionMode(enum sii164_hot_plug_mode 
hotPlugMode)
 {
unsigned char detectReg;
 
diff --git a/drivers/staging/sm750fb/ddk750_sii164.h 
b/drivers/staging/sm750fb/ddk750_sii164.h
index 6968cf5..e06ba72 100644
--- a/drivers/staging/sm750fb/ddk750_sii164.h
+++ b/drivers/staging/sm750fb/ddk750_sii164.h
@@ -4,12 +4,12 @@
 #define USE_DVICHIP
 
 /* Hot Plug detection mode structure */
-typedef enum _sii164_hot_plug_mode_t {
+enum sii164_hot_plug_mode {
SII164_HOTPLUG_DISABLE = 0, /* Disable Hot Plug output bit 
(always high). */
SII164_HOTPLUG_USE_MDI, /* Use Monitor Detect Interrupt 
bit. */
SII164_HOTPLUG_USE_RSEN,/* Use Receiver Sense detect bit. */
SII164_HOTPLUG_USE_HTPLG/* Use Hot Plug detect bit. */
-} sii164_hot_plug_mode_t;
+};
 
 
 /* Silicon Image SiI164 chip prototype */
-- 
1.8.3.1

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


[PATCH v2 0/7] staging: sm750fb: cleaning code

2017-05-15 Thread Matej Dujava
Folowing patch set cleans some warnings and checkups from checkpatch.pl
and also fix code to better fot linux code style.

Changes since v1 [1]:

* staging: sm750fb: fix length of lines, function calls and declaration
* created better description

* squashed: 
staging: sm750fb: unifying macro definitions
staging: sm750fb: reordering of macro definitions
staging: sm750fb: removing unnecessary binary operations
* delete duplicit macro for MHZ

[1] https://lkml.org/lkml/2017/5/15/284

Matej Dujava (7):
  staging: sm750fb: fix length of lines, function calls and declaration
  staging: sm750fb: unifying macro usage and definitions
  staging: sm750fb: Remove typedef from "typedef enum
_logical_chip_type_t"
  staging: sm750fb: Remove typedef from "typedef enum _clock_type_t"
  staging: sm750fb: Remove typedef from "typedef enum _disp_output_t"
  staging: sm750fb: Remove typedef from "typedef enum _DPMS_t"
  staging: sm750fb: Remove typedef from "typedef enum
_sii164_hot_plug_mode_t"

 drivers/staging/sm750fb/ddk750_chip.c| 27 +-
 drivers/staging/sm750fb/ddk750_chip.h| 16 +++---
 drivers/staging/sm750fb/ddk750_display.c |  2 +-
 drivers/staging/sm750fb/ddk750_display.h | 86 
 drivers/staging/sm750fb/ddk750_dvi.c | 35 +++--
 drivers/staging/sm750fb/ddk750_dvi.h | 43 
 drivers/staging/sm750fb/ddk750_hwi2c.c   | 37 +-
 drivers/staging/sm750fb/ddk750_mode.c|  2 +-
 drivers/staging/sm750fb/ddk750_mode.h|  2 +-
 drivers/staging/sm750fb/ddk750_power.c   |  2 +-
 drivers/staging/sm750fb/ddk750_power.h   |  7 ++-
 drivers/staging/sm750fb/ddk750_sii164.c  | 49 --
 drivers/staging/sm750fb/ddk750_sii164.h  | 26 +-
 drivers/staging/sm750fb/ddk750_swi2c.c   | 21 +++-
 drivers/staging/sm750fb/ddk750_swi2c.h   | 18 ++-
 drivers/staging/sm750fb/sm750.c  | 26 +-
 drivers/staging/sm750fb/sm750.h  |  6 +--
 drivers/staging/sm750fb/sm750_accel.c| 15 +++---
 drivers/staging/sm750fb/sm750_cursor.c   | 17 +++
 drivers/staging/sm750fb/sm750_hw.c   |  4 +-
 20 files changed, 201 insertions(+), 240 deletions(-)

-- 
1.8.3.1

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


[PATCH v2 2/7] staging: sm750fb: unifying macro usage and definitions

2017-05-15 Thread Matej Dujava
This patch adds tabs into macro definitions so all rhs are on same column.
Removing MHz macro from ddk_chip.c file and reuse MHZ from sm750.h.

Signed-off-by: Matej Dujava 
---
 drivers/staging/sm750fb/ddk750_chip.c| 18 
 drivers/staging/sm750fb/ddk750_display.h | 78 
 drivers/staging/sm750fb/ddk750_hwi2c.c   |  4 +-
 drivers/staging/sm750fb/sm750.h  |  6 +--
 4 files changed, 52 insertions(+), 54 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.c 
b/drivers/staging/sm750fb/ddk750_chip.c
index 944dd25..64d0a53 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -5,8 +5,6 @@
 #include "ddk750_chip.h"
 #include "ddk750_power.h"
 
-#define MHz(x) ((x) * 100)
-
 static logical_chip_type_t chip;
 
 logical_chip_type_t sm750_get_chip_type(void)
@@ -36,7 +34,7 @@ static unsigned int get_mxclk_freq(void)
unsigned int M, N, OD, POD;
 
if (sm750_get_chip_type() == SM750LE)
-   return MHz(130);
+   return MHZ(130);
 
pll_reg = peek32(MXCLK_PLL_CTRL);
M = (pll_reg & PLL_CTRL_M_MASK) >> PLL_CTRL_M_SHIFT;
@@ -98,8 +96,8 @@ static void set_memory_clock(unsigned int frequency)
 * Set the frequency to the maximum frequency
 * that the DDR Memory can take which is 336MHz.
 */
-   if (frequency > MHz(336))
-   frequency = MHz(336);
+   if (frequency > MHZ(336))
+   frequency = MHZ(336);
 
/* Calculate the divisor */
divisor = DIV_ROUND_CLOSEST(get_mxclk_freq(), frequency);
@@ -150,8 +148,8 @@ static void set_master_clock(unsigned int frequency)
 * Set the frequency to the maximum frequency
 * that the SM750 engine can run, which is about 190 MHz.
 */
-   if (frequency > MHz(190))
-   frequency = MHz(190);
+   if (frequency > MHZ(190))
+   frequency = MHZ(190);
 
/* Calculate the divisor */
divisor = DIV_ROUND_CLOSEST(get_mxclk_freq(), frequency);
@@ -237,13 +235,13 @@ int ddk750_init_hw(struct initchip_param *pInitParam)
}
 
/* Set the Main Chip Clock */
-   set_chip_clock(MHz((unsigned int)pInitParam->chipClock));
+   set_chip_clock(MHZ((unsigned int)pInitParam->chipClock));
 
/* Set up memory clock. */
-   set_memory_clock(MHz(pInitParam->memClock));
+   set_memory_clock(MHZ(pInitParam->memClock));
 
/* Set up master clock */
-   set_master_clock(MHz(pInitParam->masterClock));
+   set_master_clock(MHZ(pInitParam->masterClock));
 
/*
 * Reset the memory controller.
diff --git a/drivers/staging/sm750fb/ddk750_display.h 
b/drivers/staging/sm750fb/ddk750_display.h
index 609bf74..b34a2c6 100644
--- a/drivers/staging/sm750fb/ddk750_display.h
+++ b/drivers/staging/sm750fb/ddk750_display.h
@@ -6,83 +6,83 @@
  * 8[29:28]
  */
 
-#define PNL_2_OFFSET 0
-#define PNL_2_MASK (3 << PNL_2_OFFSET)
+#define PNL_2_OFFSET   0
+#define PNL_2_MASK (0x3 << PNL_2_OFFSET)
 #define PNL_2_USAGE(PNL_2_MASK << 16)
-#define PNL_2_PRI  ((0 << PNL_2_OFFSET) | PNL_2_USAGE)
-#define PNL_2_SEC  ((2 << PNL_2_OFFSET) | PNL_2_USAGE)
+#define PNL_2_PRI  ((0x0 << PNL_2_OFFSET) | PNL_2_USAGE)
+#define PNL_2_SEC  ((0x2 << PNL_2_OFFSET) | PNL_2_USAGE)
 
 /*
  * primary timing & plane enable bit
  * 1: 8[8] & 8[2] on
  * 0: both off
  */
-#define PRI_TP_OFFSET 4
-#define PRI_TP_MASK BIT(PRI_TP_OFFSET)
-#define PRI_TP_USAGE (PRI_TP_MASK << 16)
-#define PRI_TP_ON ((0x1 << PRI_TP_OFFSET) | PRI_TP_USAGE)
-#define PRI_TP_OFF ((0x0 << PRI_TP_OFFSET) | PRI_TP_USAGE)
+#define PRI_TP_OFFSET  4
+#define PRI_TP_MASKBIT(PRI_TP_OFFSET)
+#define PRI_TP_USAGE   (PRI_TP_MASK << 16)
+#define PRI_TP_ON  ((0x1 << PRI_TP_OFFSET) | PRI_TP_USAGE)
+#define PRI_TP_OFF ((0x0 << PRI_TP_OFFSET) | PRI_TP_USAGE)
 
 /*
  * panel sequency status
  * 8[27:24]
  */
-#define PNL_SEQ_OFFSET 6
-#define PNL_SEQ_MASK BIT(PNL_SEQ_OFFSET)
-#define PNL_SEQ_USAGE (PNL_SEQ_MASK << 16)
-#define PNL_SEQ_ON (BIT(PNL_SEQ_OFFSET) | PNL_SEQ_USAGE)
-#define PNL_SEQ_OFF ((0 << PNL_SEQ_OFFSET) | PNL_SEQ_USAGE)
+#define PNL_SEQ_OFFSET 6
+#define PNL_SEQ_MASK   BIT(PNL_SEQ_OFFSET)
+#define PNL_SEQ_USAGE  (PNL_SEQ_MASK << 16)
+#define PNL_SEQ_ON ((0x1 << PNL_SEQ_OFFSET) | PNL_SEQ_USAGE)
+#define PNL_SEQ_OFF((0x0 << PNL_SEQ_OFFSET) | PNL_SEQ_USAGE)
 
 /*
  * dual digital output
  * 8[19]
  */
-#define DUAL_TFT_OFFSET 8
-#define DUAL_TFT_MASK BIT(DUAL_TFT_OFFSET)
-#define DUAL_TFT_USAGE (DUAL_TFT_MASK << 16)
-#define DUAL_TFT_ON (BIT(DUAL_TFT_OFFSET) | DUAL_TFT_USAGE)
-#define DUAL_TFT_OFF ((0 << DUAL_TFT_OFFSET) | DUAL_TFT_USAGE)
+#define DUAL_TFT_OFFSET8
+#define DUAL_TFT_MASK  BIT(DUAL_TFT_OFFSET)
+#define

[PATCH v2 5/7] staging: sm750fb: Remove typedef from "typedef enum _disp_output_t"

2017-05-15 Thread Matej Dujava
This patch removes typedefs from enum and renames it from "typedef enum
_disp_output_t" to "enum disp_output" as per kernel coding standards.

Signed-off-by: Matej Dujava 
---
 drivers/staging/sm750fb/ddk750_display.c | 2 +-
 drivers/staging/sm750fb/ddk750_display.h | 8 
 drivers/staging/sm750fb/sm750_hw.c   | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_display.c 
b/drivers/staging/sm750fb/ddk750_display.c
index 9b116ed6..13b91c3 100644
--- a/drivers/staging/sm750fb/ddk750_display.c
+++ b/drivers/staging/sm750fb/ddk750_display.c
@@ -110,7 +110,7 @@ static void swPanelPowerSequence(int disp, int delay)
primary_wait_vertical_sync(delay);
 }
 
-void ddk750_setLogicalDispOut(disp_output_t output)
+void ddk750_setLogicalDispOut(enum disp_output output)
 {
unsigned int reg;
 
diff --git a/drivers/staging/sm750fb/ddk750_display.h 
b/drivers/staging/sm750fb/ddk750_display.h
index b34a2c6..4d9ec3b 100644
--- a/drivers/staging/sm750fb/ddk750_display.h
+++ b/drivers/staging/sm750fb/ddk750_display.h
@@ -88,7 +88,7 @@
  * LCD1 means panel path TFT1  & panel path DVI (so enable DAC)
  * CRT means crt path DSUB
  */
-typedef enum _disp_output_t {
+enum disp_output {
do_LCD1_PRI = PNL_2_PRI | PRI_TP_ON | PNL_SEQ_ON | DAC_ON,
do_LCD1_SEC = PNL_2_SEC | SEC_TP_ON | PNL_SEQ_ON | DAC_ON,
do_LCD2_PRI = CRT_2_PRI | PRI_TP_ON | DUAL_TFT_ON,
@@ -99,9 +99,9 @@
 */
do_CRT_PRI = CRT_2_PRI | PRI_TP_ON | DPMS_ON | DAC_ON,
do_CRT_SEC = CRT_2_SEC | SEC_TP_ON | DPMS_ON | DAC_ON,
-}
-disp_output_t;
+};
 
-void ddk750_setLogicalDispOut(disp_output_t output);
+
+void ddk750_setLogicalDispOut(enum disp_output output);
 
 #endif
diff --git a/drivers/staging/sm750fb/sm750_hw.c 
b/drivers/staging/sm750fb/sm750_hw.c
index 3cdc4ae..f7d1e67 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -184,7 +184,7 @@ int hw_sm750_output_setMode(struct lynxfb_output *output,
struct fb_fix_screeninfo *fix)
 {
int ret;
-   disp_output_t dispSet;
+   enum disp_output dispSet;
int channel;
 
ret = 0;
-- 
1.8.3.1

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


[PATCH v2 1/7] staging: sm750fb: fix length of lines, function calls and declaration

2017-05-15 Thread Matej Dujava
This patch breaks lines that are longer than 80 characters and joins
together those, that are too short and can be placed at one.

Function calls and declarations are updated to fit kernel code style.

Signed-off-by: Matej Dujava 
---
 drivers/staging/sm750fb/ddk750_chip.c   |  7 +++--
 drivers/staging/sm750fb/ddk750_dvi.c| 35 +--
 drivers/staging/sm750fb/ddk750_dvi.h| 43 ++---
 drivers/staging/sm750fb/ddk750_hwi2c.c  | 33 --
 drivers/staging/sm750fb/ddk750_sii164.c | 49 ++---
 drivers/staging/sm750fb/ddk750_sii164.h | 22 +++
 drivers/staging/sm750fb/ddk750_swi2c.c  | 21 --
 drivers/staging/sm750fb/ddk750_swi2c.h  | 18 
 drivers/staging/sm750fb/sm750.c | 26 -
 drivers/staging/sm750fb/sm750_accel.c   | 15 +-
 drivers/staging/sm750fb/sm750_cursor.c  | 17 +---
 11 files changed, 125 insertions(+), 161 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.c 
b/drivers/staging/sm750fb/ddk750_chip.c
index 5e4bfb6..944dd25 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -175,7 +175,7 @@ static void set_master_clock(unsigned int frequency)
}
 
sm750_set_current_gate(reg);
-   }
+   }
 }
 
 unsigned int ddk750_get_vm_size(void)
@@ -224,7 +224,7 @@ int ddk750_init_hw(struct initchip_param *pInitParam)
sm750_set_current_gate(reg);
 
if (sm750_get_chip_type() != SM750LE) {
-   /*  set panel pll and graphic mode via mmio_88 */
+   /* set panel pll and graphic mode via mmio_88 */
reg = peek32(VGA_CONFIGURATION);
reg |= (VGA_CONFIGURATION_PLL | VGA_CONFIGURATION_MODE);
poke32(VGA_CONFIGURATION, reg);
@@ -309,7 +309,8 @@ int ddk750_init_hw(struct initchip_param *pInitParam)
  * M = {1,...,255}
  * N = {2,...,15}
  */
-unsigned int sm750_calc_pll_value(unsigned int request_orig, struct pll_value 
*pll)
+unsigned int sm750_calc_pll_value(unsigned int request_orig,
+ struct pll_value *pll)
 {
/*
 * as sm750 register definition,
diff --git a/drivers/staging/sm750fb/ddk750_dvi.c 
b/drivers/staging/sm750fb/ddk750_dvi.c
index 171ae06..87a199d 100644
--- a/drivers/staging/sm750fb/ddk750_dvi.c
+++ b/drivers/staging/sm750fb/ddk750_dvi.c
@@ -29,26 +29,31 @@
 #endif
 };
 
-int dviInit(
-   unsigned char edgeSelect,
-   unsigned char busSelect,
-   unsigned char dualEdgeClkSelect,
-   unsigned char hsyncEnable,
-   unsigned char vsyncEnable,
-   unsigned char deskewEnable,
-   unsigned char deskewSetting,
-   unsigned char continuousSyncEnable,
-   unsigned char pllFilterEnable,
-   unsigned char pllFilterValue
-   )
+int dviInit(unsigned char edgeSelect,
+   unsigned char busSelect,
+   unsigned char dualEdgeClkSelect,
+   unsigned char hsyncEnable,
+   unsigned char vsyncEnable,
+   unsigned char deskewEnable,
+   unsigned char deskewSetting,
+   unsigned char continuousSyncEnable,
+   unsigned char pllFilterEnable,
+   unsigned char pllFilterValue)
 {
dvi_ctrl_device_t *pCurrentDviCtrl;
 
pCurrentDviCtrl = g_dcftSupportedDviController;
if (pCurrentDviCtrl->pfnInit) {
-   return pCurrentDviCtrl->pfnInit(edgeSelect, busSelect, 
dualEdgeClkSelect, hsyncEnable,
-   vsyncEnable, deskewEnable, 
deskewSetting, continuousSyncEnable,
-   pllFilterEnable, 
pllFilterValue);
+   return pCurrentDviCtrl->pfnInit(edgeSelect,
+   busSelect,
+   dualEdgeClkSelect,
+   hsyncEnable,
+   vsyncEnable,
+   deskewEnable,
+   deskewSetting,
+   continuousSyncEnable,
+   pllFilterEnable,
+   pllFilterValue);
}
return -1; /* error */
 }
diff --git a/drivers/staging/sm750fb/ddk750_dvi.h 
b/drivers/staging/sm750fb/ddk750_dvi.h
index 677939c..4a83945 100644
--- a/drivers/staging/sm750fb/ddk750_dvi.h
+++ b/drivers/staging/sm750fb/ddk750_dvi.h
@@ -3,17 +3,16 @@
 
 /* dvi chip stuffs structros */
 
-typedef long (*PFN_DVICTRL_INIT)(
-   unsigned char edgeSelect,
-   unsigned char busSelect,
-   unsigned char dualEdgeClkSelect,
-   unsigned char hsyncEnable,
-   unsigned char vsyncEnable,
-   unsigned char deskewEnable,
-   unsigned char deskewSetting,
-