[PATCH 17/30] staging: wilc1000: fix return type of wilc_del_allstation

2016-01-03 Thread Chaehyun Lim
This patch changes return type of wilc_del_allstation from s32 to int.
The result variable gets return value from wilc_mq_send that has data
type of int. It should be changed return type of this function as well
as data type of result variable.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 57d59dc..3f410b2 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4299,9 +4299,9 @@ int wilc_del_station(struct wilc_vif *vif, const u8 
*mac_addr)
return result;
 }
 
-s32 wilc_del_allstation(struct wilc_vif *vif, u8 pu8MacAddr[][ETH_ALEN])
+int wilc_del_allstation(struct wilc_vif *vif, u8 pu8MacAddr[][ETH_ALEN])
 {
-   s32 result = 0;
+   int result = 0;
struct host_if_msg msg;
struct del_all_sta *pstrDelAllStationMsg = &msg.body.del_all_sta_info;
struct host_if_drv *hif_drv = vif->hif_drv;
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index abb626e..6d424e7 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -347,7 +347,7 @@ s32 wilc_add_beacon(struct wilc_vif *vif, u32 u32Interval, 
u32 u32DTIMPeriod,
u32 u32HeadLen, u8 *pu8Head, u32 u32TailLen, u8 *pu8Tail);
 int wilc_del_beacon(struct wilc_vif *vif);
 int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param);
-s32 wilc_del_allstation(struct wilc_vif *vif, u8 pu8MacAddr[][ETH_ALEN]);
+int wilc_del_allstation(struct wilc_vif *vif, u8 pu8MacAddr[][ETH_ALEN]);
 int wilc_del_station(struct wilc_vif *vif, const u8 *mac_addr);
 int wilc_edit_station(struct wilc_vif *vif,
  struct add_sta_param *sta_param);
-- 
2.6.4

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


[PATCH 03/30] staging: wilc1000: rename u32SessionID in wilc_remain_on_channel

2016-01-03 Thread Chaehyun Lim
This patch renames u32SessionID to session_id to avoid camelcase.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 30b4f30..6ea907e 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4061,7 +4061,7 @@ void wilc_scan_complete_received(struct wilc *wilc, u8 
*pu8Buffer,
return;
 }
 
-int wilc_remain_on_channel(struct wilc_vif *vif, u32 u32SessionID,
+int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id,
   u32 u32duration, u16 chan,
   wilc_remain_on_chan_expired RemainOnChanExpired,
   wilc_remain_on_chan_ready RemainOnChanReady,
@@ -4084,7 +4084,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 
u32SessionID,
msg.body.remain_on_ch.ready = RemainOnChanReady;
msg.body.remain_on_ch.arg = pvUserArg;
msg.body.remain_on_ch.duration = u32duration;
-   msg.body.remain_on_ch.id = u32SessionID;
+   msg.body.remain_on_ch.id = session_id;
msg.vif = vif;
 
result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index e28f462..c935e49 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -356,7 +356,7 @@ int wilc_setup_multicast_filter(struct wilc_vif *vif, bool 
enabled,
u32 count);
 int wilc_setup_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx);
 s32 wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *pBSSID, char TID);
-int wilc_remain_on_channel(struct wilc_vif *vif, u32 u32SessionID,
+int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id,
   u32 u32duration, u16 chan,
   wilc_remain_on_chan_expired RemainOnChanExpired,
   wilc_remain_on_chan_ready RemainOnChanReady,
-- 
2.6.4

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


[PATCH 16/30] staging: wilc1000: remove rates variable in wilc_edit_station

2016-01-03 Thread Chaehyun Lim
Instead of using rates variable, it is used as add_sta_info->rates
directly.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 290c27a..57d59dc 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4372,12 +4372,11 @@ int wilc_edit_station(struct wilc_vif *vif,
 
memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param));
if (add_sta_info->rates_len > 0) {
-   u8 *rates = kmemdup(sta_param->rates,
-   add_sta_info->rates_len,
-   GFP_KERNEL);
-   if (!rates)
+   add_sta_info->rates = kmemdup(sta_param->rates,
+ add_sta_info->rates_len,
+ GFP_KERNEL);
+   if (!add_sta_info->rates)
return -ENOMEM;
-   add_sta_info->rates = rates;
}
 
result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
-- 
2.6.4

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


[PATCH 07/30] staging: wilc1000: rename pvUserArg in wilc_remain_on_channel

2016-01-03 Thread Chaehyun Lim
This patch renames pvUserArg to user_arg to avoid camelcase.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 21d1e87e..3636f76 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4065,7 +4065,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 
session_id,
   u32 duration, u16 chan,
   wilc_remain_on_chan_expired expired,
   wilc_remain_on_chan_ready ready,
-  void *pvUserArg)
+  void *user_arg)
 {
int result = 0;
struct host_if_msg msg;
@@ -4082,7 +4082,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 
session_id,
msg.body.remain_on_ch.ch = chan;
msg.body.remain_on_ch.expired = expired;
msg.body.remain_on_ch.ready = ready;
-   msg.body.remain_on_ch.arg = pvUserArg;
+   msg.body.remain_on_ch.arg = user_arg;
msg.body.remain_on_ch.duration = duration;
msg.body.remain_on_ch.id = session_id;
msg.vif = vif;
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 8a03055..4f741ff 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -360,7 +360,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 
session_id,
   u32 duration, u16 chan,
   wilc_remain_on_chan_expired expired,
   wilc_remain_on_chan_ready ready,
-  void *pvUserArg);
+  void *user_arg);
 int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id);
 int wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg);
 int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index);
-- 
2.6.4

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


[PATCH 05/30] staging: wilc1000: rename RemainOnChanExpired in wilc_remain_on_channel

2016-01-03 Thread Chaehyun Lim
This patch renames RemainOnChanExpired to expired to avoid camelcase.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 116942d..9265328 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4063,7 +4063,7 @@ void wilc_scan_complete_received(struct wilc *wilc, u8 
*pu8Buffer,
 
 int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id,
   u32 duration, u16 chan,
-  wilc_remain_on_chan_expired RemainOnChanExpired,
+  wilc_remain_on_chan_expired expired,
   wilc_remain_on_chan_ready RemainOnChanReady,
   void *pvUserArg)
 {
@@ -4080,7 +4080,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 
session_id,
 
msg.id = HOST_IF_MSG_REMAIN_ON_CHAN;
msg.body.remain_on_ch.ch = chan;
-   msg.body.remain_on_ch.expired = RemainOnChanExpired;
+   msg.body.remain_on_ch.expired = expired;
msg.body.remain_on_ch.ready = RemainOnChanReady;
msg.body.remain_on_ch.arg = pvUserArg;
msg.body.remain_on_ch.duration = duration;
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 4902cc8..d2ca27e 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -358,7 +358,7 @@ int wilc_setup_ipaddress(struct wilc_vif *vif, u8 *ip_addr, 
u8 idx);
 s32 wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *pBSSID, char TID);
 int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id,
   u32 duration, u16 chan,
-  wilc_remain_on_chan_expired RemainOnChanExpired,
+  wilc_remain_on_chan_expired expired,
   wilc_remain_on_chan_ready RemainOnChanReady,
   void *pvUserArg);
 int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id);
-- 
2.6.4

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


[PATCH 15/30] staging: wilc1000: use kmemdup in wilc_edit_station

2016-01-03 Thread Chaehyun Lim
This patch replaces kmalloc followed by memcpy with kmemdup.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 2f94804..290c27a 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4372,13 +4372,11 @@ int wilc_edit_station(struct wilc_vif *vif,
 
memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param));
if (add_sta_info->rates_len > 0) {
-   u8 *rates = kmalloc(add_sta_info->rates_len, GFP_KERNEL);
-
+   u8 *rates = kmemdup(sta_param->rates,
+   add_sta_info->rates_len,
+   GFP_KERNEL);
if (!rates)
return -ENOMEM;
-
-   memcpy(rates, sta_param->rates,
-  add_sta_info->rates_len);
add_sta_info->rates = rates;
}
 
-- 
2.6.4

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


[PATCH 04/30] staging: wilc1000: rename u32duration in wilc_remain_on_channel

2016-01-03 Thread Chaehyun Lim
This patch renames u32duration to duration to remove u32 prefix.
There is no need u32 prefix to show data type of this variable.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 6ea907e..116942d 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4062,7 +4062,7 @@ void wilc_scan_complete_received(struct wilc *wilc, u8 
*pu8Buffer,
 }
 
 int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id,
-  u32 u32duration, u16 chan,
+  u32 duration, u16 chan,
   wilc_remain_on_chan_expired RemainOnChanExpired,
   wilc_remain_on_chan_ready RemainOnChanReady,
   void *pvUserArg)
@@ -4083,7 +4083,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 
session_id,
msg.body.remain_on_ch.expired = RemainOnChanExpired;
msg.body.remain_on_ch.ready = RemainOnChanReady;
msg.body.remain_on_ch.arg = pvUserArg;
-   msg.body.remain_on_ch.duration = u32duration;
+   msg.body.remain_on_ch.duration = duration;
msg.body.remain_on_ch.id = session_id;
msg.vif = vif;
 
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index c935e49..4902cc8 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -357,7 +357,7 @@ int wilc_setup_multicast_filter(struct wilc_vif *vif, bool 
enabled,
 int wilc_setup_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx);
 s32 wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *pBSSID, char TID);
 int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id,
-  u32 u32duration, u16 chan,
+  u32 duration, u16 chan,
   wilc_remain_on_chan_expired RemainOnChanExpired,
   wilc_remain_on_chan_ready RemainOnChanReady,
   void *pvUserArg);
-- 
2.6.4

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


[PATCH 08/30] staging: wilc1000: fix return type of wilc_del_all_rx_ba_session

2016-01-03 Thread Chaehyun Lim
This patch changes return type of wilc_del_all_rx_ba_session from s32 to
int. The result variable gets return value from wilc_mq_send that has
return type of int. It should be changed return type of this function as
well as data type of result variable.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 3636f76..bf01e83 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4605,9 +4605,9 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo 
*ptstrNetworkInfo)
return (void *)pNewJoinBssParam;
 }
 
-s32 wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *pBSSID, char TID)
+int wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *pBSSID, char TID)
 {
-   s32 result = 0;
+   int result = 0;
struct host_if_msg msg;
struct ba_session_info *pBASessionInfo = &msg.body.session_info;
struct host_if_drv *hif_drv = vif->hif_drv;
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 4f741ff..85064cd 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -355,7 +355,7 @@ int wilc_set_power_mgmt(struct wilc_vif *vif, bool enabled, 
u32 timeout);
 int wilc_setup_multicast_filter(struct wilc_vif *vif, bool enabled,
u32 count);
 int wilc_setup_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx);
-s32 wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *pBSSID, char TID);
+int wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *pBSSID, char TID);
 int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id,
   u32 duration, u16 chan,
   wilc_remain_on_chan_expired expired,
-- 
2.6.4

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


[PATCH 14/30] staging: wilc1000: rename pstrAddStationMsg in wilc_edit_station

2016-01-03 Thread Chaehyun Lim
This patch renames pstrAddStationMsg to add_sta_info to avoid camelcase.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index de921fa..2f94804 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4355,7 +4355,7 @@ int wilc_edit_station(struct wilc_vif *vif,
 {
int result = 0;
struct host_if_msg msg;
-   struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info;
+   struct add_sta_param *add_sta_info = &msg.body.add_sta_info;
struct host_if_drv *hif_drv = vif->hif_drv;
 
if (!hif_drv) {
@@ -4370,16 +4370,16 @@ int wilc_edit_station(struct wilc_vif *vif,
msg.id = HOST_IF_MSG_EDIT_STATION;
msg.vif = vif;
 
-   memcpy(pstrAddStationMsg, sta_param, sizeof(struct add_sta_param));
-   if (pstrAddStationMsg->rates_len > 0) {
-   u8 *rates = kmalloc(pstrAddStationMsg->rates_len, GFP_KERNEL);
+   memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param));
+   if (add_sta_info->rates_len > 0) {
+   u8 *rates = kmalloc(add_sta_info->rates_len, GFP_KERNEL);
 
if (!rates)
return -ENOMEM;
 
memcpy(rates, sta_param->rates,
-  pstrAddStationMsg->rates_len);
-   pstrAddStationMsg->rates = rates;
+  add_sta_info->rates_len);
+   add_sta_info->rates = rates;
}
 
result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
-- 
2.6.4

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


[PATCH 09/30] staging: wilc1000: rename pBSSID in wilc_del_all_rx_ba_session

2016-01-03 Thread Chaehyun Lim
This patch renames pBSSID to bssid to avoid camelcase.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index bf01e83..735e6f1 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4605,7 +4605,7 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo 
*ptstrNetworkInfo)
return (void *)pNewJoinBssParam;
 }
 
-int wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *pBSSID, char TID)
+int wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *bssid, char TID)
 {
int result = 0;
struct host_if_msg msg;
@@ -4621,7 +4621,7 @@ int wilc_del_all_rx_ba_session(struct wilc_vif *vif, char 
*pBSSID, char TID)
 
msg.id = HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS;
 
-   memcpy(pBASessionInfo->bssid, pBSSID, ETH_ALEN);
+   memcpy(pBASessionInfo->bssid, bssid, ETH_ALEN);
pBASessionInfo->tid = TID;
msg.vif = vif;
 
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 85064cd..5f7156e 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -355,7 +355,7 @@ int wilc_set_power_mgmt(struct wilc_vif *vif, bool enabled, 
u32 timeout);
 int wilc_setup_multicast_filter(struct wilc_vif *vif, bool enabled,
u32 count);
 int wilc_setup_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx);
-int wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *pBSSID, char TID);
+int wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *bssid, char TID);
 int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id,
   u32 duration, u16 chan,
   wilc_remain_on_chan_expired expired,
-- 
2.6.4

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


[PATCH 01/30] staging: wilc1000: rename u32duration in struct remain_ch

2016-01-03 Thread Chaehyun Lim
The patch renames u32duration to duration that is a member of struct
remain_ch. The prefix u32 shows data type of its member, but there is no
need to use u32 prefix to represent data type.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 5a97a9d..39fa5a3 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -2558,7 +2558,7 @@ ERRORHANDLER:
hif_drv->remain_on_ch_timer.data = (unsigned long)vif;
mod_timer(&hif_drv->remain_on_ch_timer,
  jiffies +
- 
msecs_to_jiffies(pstrHostIfRemainOnChan->u32duration));
+ msecs_to_jiffies(pstrHostIfRemainOnChan->duration));
 
if (hif_drv->remain_on_ch.ready)
hif_drv->remain_on_ch.ready(hif_drv->remain_on_ch.arg);
@@ -4083,7 +4083,7 @@ s32 wilc_remain_on_channel(struct wilc_vif *vif, u32 
u32SessionID,
msg.body.remain_on_ch.expired = RemainOnChanExpired;
msg.body.remain_on_ch.ready = RemainOnChanReady;
msg.body.remain_on_ch.arg = pvUserArg;
-   msg.body.remain_on_ch.u32duration = u32duration;
+   msg.body.remain_on_ch.duration = u32duration;
msg.body.remain_on_ch.id = u32SessionID;
msg.vif = vif;
 
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index f90a530..a2f428f 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -240,7 +240,7 @@ struct ba_session_info {
 
 struct remain_ch {
u16 ch;
-   u32 u32duration;
+   u32 duration;
wilc_remain_on_chan_expired expired;
wilc_remain_on_chan_ready ready;
void *arg;
-- 
2.6.4

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


[PATCH 02/30] staging: wilc1000: fix return type of wilc_remain_on_channel

2016-01-03 Thread Chaehyun Lim
This patch changes return type of wilc_remain_on_channel from s32 to
int. The result variable gets return value from wilc_mq_send that has
data type of int. It should be changed return type of this function as
well as data type of result variable.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 39fa5a3..30b4f30 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4061,13 +4061,13 @@ void wilc_scan_complete_received(struct wilc *wilc, u8 
*pu8Buffer,
return;
 }
 
-s32 wilc_remain_on_channel(struct wilc_vif *vif, u32 u32SessionID,
+int wilc_remain_on_channel(struct wilc_vif *vif, u32 u32SessionID,
   u32 u32duration, u16 chan,
   wilc_remain_on_chan_expired RemainOnChanExpired,
   wilc_remain_on_chan_ready RemainOnChanReady,
   void *pvUserArg)
 {
-   s32 result = 0;
+   int result = 0;
struct host_if_msg msg;
struct host_if_drv *hif_drv = vif->hif_drv;
 
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index a2f428f..e28f462 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -356,7 +356,7 @@ int wilc_setup_multicast_filter(struct wilc_vif *vif, bool 
enabled,
u32 count);
 int wilc_setup_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx);
 s32 wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *pBSSID, char TID);
-s32 wilc_remain_on_channel(struct wilc_vif *vif, u32 u32SessionID,
+int wilc_remain_on_channel(struct wilc_vif *vif, u32 u32SessionID,
   u32 u32duration, u16 chan,
   wilc_remain_on_chan_expired RemainOnChanExpired,
   wilc_remain_on_chan_ready RemainOnChanReady,
-- 
2.6.4

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


[PATCH 13/30] staging: wilc1000: rename pstrStaParams in wilc_edit_station

2016-01-03 Thread Chaehyun Lim
This patch renames pstrStaParams to sta_param to avoid camelcase.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index eb2d664..de921fa 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4351,7 +4351,7 @@ s32 wilc_del_allstation(struct wilc_vif *vif, u8 
pu8MacAddr[][ETH_ALEN])
 }
 
 int wilc_edit_station(struct wilc_vif *vif,
- struct add_sta_param *pstrStaParams)
+ struct add_sta_param *sta_param)
 {
int result = 0;
struct host_if_msg msg;
@@ -4370,14 +4370,14 @@ int wilc_edit_station(struct wilc_vif *vif,
msg.id = HOST_IF_MSG_EDIT_STATION;
msg.vif = vif;
 
-   memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param));
+   memcpy(pstrAddStationMsg, sta_param, sizeof(struct add_sta_param));
if (pstrAddStationMsg->rates_len > 0) {
u8 *rates = kmalloc(pstrAddStationMsg->rates_len, GFP_KERNEL);
 
if (!rates)
return -ENOMEM;
 
-   memcpy(rates, pstrStaParams->rates,
+   memcpy(rates, sta_param->rates,
   pstrAddStationMsg->rates_len);
pstrAddStationMsg->rates = rates;
}
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index f60bebb..abb626e 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -350,7 +350,7 @@ int wilc_add_station(struct wilc_vif *vif, struct 
add_sta_param *sta_param);
 s32 wilc_del_allstation(struct wilc_vif *vif, u8 pu8MacAddr[][ETH_ALEN]);
 int wilc_del_station(struct wilc_vif *vif, const u8 *mac_addr);
 int wilc_edit_station(struct wilc_vif *vif,
- struct add_sta_param *pstrStaParams);
+ struct add_sta_param *sta_param);
 int wilc_set_power_mgmt(struct wilc_vif *vif, bool enabled, u32 timeout);
 int wilc_setup_multicast_filter(struct wilc_vif *vif, bool enabled,
u32 count);
-- 
2.6.4

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


[PATCH 10/30] staging: wilc1000: rename TID in wilc_del_all_rx_ba_session

2016-01-03 Thread Chaehyun Lim
This patch renames TID to tid to avoid camelcase.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 735e6f1..265c42b 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4605,7 +4605,7 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo 
*ptstrNetworkInfo)
return (void *)pNewJoinBssParam;
 }
 
-int wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *bssid, char TID)
+int wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *bssid, char tid)
 {
int result = 0;
struct host_if_msg msg;
@@ -4622,7 +4622,7 @@ int wilc_del_all_rx_ba_session(struct wilc_vif *vif, char 
*bssid, char TID)
msg.id = HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS;
 
memcpy(pBASessionInfo->bssid, bssid, ETH_ALEN);
-   pBASessionInfo->tid = TID;
+   pBASessionInfo->tid = tid;
msg.vif = vif;
 
result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 5f7156e..6c8fe3a 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -355,7 +355,7 @@ int wilc_set_power_mgmt(struct wilc_vif *vif, bool enabled, 
u32 timeout);
 int wilc_setup_multicast_filter(struct wilc_vif *vif, bool enabled,
u32 count);
 int wilc_setup_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx);
-int wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *bssid, char TID);
+int wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *bssid, char tid);
 int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id,
   u32 duration, u16 chan,
   wilc_remain_on_chan_expired expired,
-- 
2.6.4

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


[PATCH 11/30] staging: wilc1000: rename pBASessionInfo in wilc_del_all_rx_ba_session

2016-01-03 Thread Chaehyun Lim
This patch renames pBASessionInfo to ba_session_info to avoid camelcase.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 265c42b..409d910 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4609,7 +4609,7 @@ int wilc_del_all_rx_ba_session(struct wilc_vif *vif, char 
*bssid, char tid)
 {
int result = 0;
struct host_if_msg msg;
-   struct ba_session_info *pBASessionInfo = &msg.body.session_info;
+   struct ba_session_info *ba_session_info = &msg.body.session_info;
struct host_if_drv *hif_drv = vif->hif_drv;
 
if (!hif_drv) {
@@ -4621,8 +4621,8 @@ int wilc_del_all_rx_ba_session(struct wilc_vif *vif, char 
*bssid, char tid)
 
msg.id = HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS;
 
-   memcpy(pBASessionInfo->bssid, bssid, ETH_ALEN);
-   pBASessionInfo->tid = tid;
+   memcpy(ba_session_info->bssid, bssid, ETH_ALEN);
+   ba_session_info->tid = tid;
msg.vif = vif;
 
result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
-- 
2.6.4

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


[PATCH 06/30] staging: wilc1000: rename RemainOnChanReady in wilc_remain_on_channel

2016-01-03 Thread Chaehyun Lim
This patch renames RemainOnChanReady to ready to avoid camelcase.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 9265328..21d1e87e 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4064,7 +4064,7 @@ void wilc_scan_complete_received(struct wilc *wilc, u8 
*pu8Buffer,
 int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id,
   u32 duration, u16 chan,
   wilc_remain_on_chan_expired expired,
-  wilc_remain_on_chan_ready RemainOnChanReady,
+  wilc_remain_on_chan_ready ready,
   void *pvUserArg)
 {
int result = 0;
@@ -4081,7 +4081,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 
session_id,
msg.id = HOST_IF_MSG_REMAIN_ON_CHAN;
msg.body.remain_on_ch.ch = chan;
msg.body.remain_on_ch.expired = expired;
-   msg.body.remain_on_ch.ready = RemainOnChanReady;
+   msg.body.remain_on_ch.ready = ready;
msg.body.remain_on_ch.arg = pvUserArg;
msg.body.remain_on_ch.duration = duration;
msg.body.remain_on_ch.id = session_id;
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index d2ca27e..8a03055 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -359,7 +359,7 @@ s32 wilc_del_all_rx_ba_session(struct wilc_vif *vif, char 
*pBSSID, char TID);
 int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id,
   u32 duration, u16 chan,
   wilc_remain_on_chan_expired expired,
-  wilc_remain_on_chan_ready RemainOnChanReady,
+  wilc_remain_on_chan_ready ready,
   void *pvUserArg);
 int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id);
 int wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg);
-- 
2.6.4

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


[PATCH 12/30] staging: wilc1000: fix return type of wilc_edit_station

2016-01-03 Thread Chaehyun Lim
This patch changes return type of wilc_edit_station from s32 to int.
The result variable gets return value from wilc_mq_send that has data
type of int. It should be changed return type of this function as well
as data type of result variable.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 409d910..eb2d664 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4350,10 +4350,10 @@ s32 wilc_del_allstation(struct wilc_vif *vif, u8 
pu8MacAddr[][ETH_ALEN])
return result;
 }
 
-s32 wilc_edit_station(struct wilc_vif *vif,
+int wilc_edit_station(struct wilc_vif *vif,
  struct add_sta_param *pstrStaParams)
 {
-   s32 result = 0;
+   int result = 0;
struct host_if_msg msg;
struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info;
struct host_if_drv *hif_drv = vif->hif_drv;
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 6c8fe3a..f60bebb 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -349,7 +349,7 @@ int wilc_del_beacon(struct wilc_vif *vif);
 int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param);
 s32 wilc_del_allstation(struct wilc_vif *vif, u8 pu8MacAddr[][ETH_ALEN]);
 int wilc_del_station(struct wilc_vif *vif, const u8 *mac_addr);
-s32 wilc_edit_station(struct wilc_vif *vif,
+int wilc_edit_station(struct wilc_vif *vif,
  struct add_sta_param *pstrStaParams);
 int wilc_set_power_mgmt(struct wilc_vif *vif, bool enabled, u32 timeout);
 int wilc_setup_multicast_filter(struct wilc_vif *vif, bool enabled,
-- 
2.6.4

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


[PATCH 28/30] staging: wilc1000: rename u32TailLen in wilc_add_beacon

2016-01-03 Thread Chaehyun Lim
This patch renames u32TailLen to tail_len to avoid camelcase.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 8 
 drivers/staging/wilc1000/host_interface.h | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index e35465e..c81c749 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4160,7 +4160,7 @@ int wilc_frame_register(struct wilc_vif *vif, u16 
frame_type, bool reg)
 }
 
 int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period,
-   u32 head_len, u8 *head, u32 u32TailLen, u8 *pu8Tail)
+   u32 head_len, u8 *head, u32 tail_len, u8 *pu8Tail)
 {
int result = 0;
struct host_if_msg msg;
@@ -4186,10 +4186,10 @@ int wilc_add_beacon(struct wilc_vif *vif, u32 interval, 
u32 dtim_period,
result = -ENOMEM;
goto ERRORHANDLER;
}
-   pstrSetBeaconParam->tail_len = u32TailLen;
+   pstrSetBeaconParam->tail_len = tail_len;
 
-   if (u32TailLen > 0) {
-   pstrSetBeaconParam->tail = kmemdup(pu8Tail, u32TailLen,
+   if (tail_len > 0) {
+   pstrSetBeaconParam->tail = kmemdup(pu8Tail, tail_len,
   GFP_KERNEL);
if (!pstrSetBeaconParam->tail) {
result = -ENOMEM;
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 1c3f741..7e4ea18 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -344,7 +344,7 @@ s32 wilc_hif_set_cfg(struct wilc_vif *vif,
 s32 wilc_init(struct net_device *dev, struct host_if_drv **phWFIDrv);
 s32 wilc_deinit(struct wilc_vif *vif);
 int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period,
-   u32 head_len, u8 *head, u32 u32TailLen, u8 *pu8Tail);
+   u32 head_len, u8 *head, u32 tail_len, u8 *pu8Tail);
 int wilc_del_beacon(struct wilc_vif *vif);
 int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param);
 int wilc_del_allstation(struct wilc_vif *vif, u8 mac_addr[][ETH_ALEN]);
-- 
2.6.4

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


[PATCH 29/30] staging: wilc1000: rename pu8Tail in wilc_add_beacon

2016-01-03 Thread Chaehyun Lim
This patch renames pu8Tail to tail to avoid camelcase.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index c81c749..8f8c583 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4160,7 +4160,7 @@ int wilc_frame_register(struct wilc_vif *vif, u16 
frame_type, bool reg)
 }
 
 int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period,
-   u32 head_len, u8 *head, u32 tail_len, u8 *pu8Tail)
+   u32 head_len, u8 *head, u32 tail_len, u8 *tail)
 {
int result = 0;
struct host_if_msg msg;
@@ -4189,7 +4189,7 @@ int wilc_add_beacon(struct wilc_vif *vif, u32 interval, 
u32 dtim_period,
pstrSetBeaconParam->tail_len = tail_len;
 
if (tail_len > 0) {
-   pstrSetBeaconParam->tail = kmemdup(pu8Tail, tail_len,
+   pstrSetBeaconParam->tail = kmemdup(tail, tail_len,
   GFP_KERNEL);
if (!pstrSetBeaconParam->tail) {
result = -ENOMEM;
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 7e4ea18..b61b484 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -344,7 +344,7 @@ s32 wilc_hif_set_cfg(struct wilc_vif *vif,
 s32 wilc_init(struct net_device *dev, struct host_if_drv **phWFIDrv);
 s32 wilc_deinit(struct wilc_vif *vif);
 int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period,
-   u32 head_len, u8 *head, u32 tail_len, u8 *pu8Tail);
+   u32 head_len, u8 *head, u32 tail_len, u8 *tail);
 int wilc_del_beacon(struct wilc_vif *vif);
 int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param);
 int wilc_del_allstation(struct wilc_vif *vif, u8 mac_addr[][ETH_ALEN]);
-- 
2.6.4

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


[PATCH 23/30] staging: wilc1000: fix return type of wilc_add_beacon

2016-01-03 Thread Chaehyun Lim
This patch changes return type of wilc_add_beacon from s32 to int.
The result variable gets return value from wilc_mq_send that has data
type of int. It should be changed return type of this function as well
as result variable.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 0ff500d..8d935e4 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4159,10 +4159,10 @@ int wilc_frame_register(struct wilc_vif *vif, u16 
frame_type, bool reg)
return result;
 }
 
-s32 wilc_add_beacon(struct wilc_vif *vif, u32 u32Interval, u32 u32DTIMPeriod,
+int wilc_add_beacon(struct wilc_vif *vif, u32 u32Interval, u32 u32DTIMPeriod,
u32 u32HeadLen, u8 *pu8Head, u32 u32TailLen, u8 *pu8Tail)
 {
-   s32 result = 0;
+   int result = 0;
struct host_if_msg msg;
struct beacon_attr *pstrSetBeaconParam = &msg.body.beacon_info;
struct host_if_drv *hif_drv = vif->hif_drv;
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 3c932e7a..272b696 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -343,7 +343,7 @@ s32 wilc_hif_set_cfg(struct wilc_vif *vif,
 struct cfg_param_val *pstrCfgParamVal);
 s32 wilc_init(struct net_device *dev, struct host_if_drv **phWFIDrv);
 s32 wilc_deinit(struct wilc_vif *vif);
-s32 wilc_add_beacon(struct wilc_vif *vif, u32 u32Interval, u32 u32DTIMPeriod,
+int wilc_add_beacon(struct wilc_vif *vif, u32 u32Interval, u32 u32DTIMPeriod,
u32 u32HeadLen, u8 *pu8Head, u32 u32TailLen, u8 *pu8Tail);
 int wilc_del_beacon(struct wilc_vif *vif);
 int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param);
-- 
2.6.4

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


[PATCH 27/30] staging: wilc1000: rename pu8Head in wilc_add_beacon

2016-01-03 Thread Chaehyun Lim
This patch renames pu8Head to head to avoid camelcase.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 07674d2..e35465e 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4160,7 +4160,7 @@ int wilc_frame_register(struct wilc_vif *vif, u16 
frame_type, bool reg)
 }
 
 int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period,
-   u32 head_len, u8 *pu8Head, u32 u32TailLen, u8 *pu8Tail)
+   u32 head_len, u8 *head, u32 u32TailLen, u8 *pu8Tail)
 {
int result = 0;
struct host_if_msg msg;
@@ -4181,7 +4181,7 @@ int wilc_add_beacon(struct wilc_vif *vif, u32 interval, 
u32 dtim_period,
pstrSetBeaconParam->interval = interval;
pstrSetBeaconParam->dtim_period = dtim_period;
pstrSetBeaconParam->head_len = head_len;
-   pstrSetBeaconParam->head = kmemdup(pu8Head, head_len, GFP_KERNEL);
+   pstrSetBeaconParam->head = kmemdup(head, head_len, GFP_KERNEL);
if (!pstrSetBeaconParam->head) {
result = -ENOMEM;
goto ERRORHANDLER;
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 0275028..1c3f741 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -344,7 +344,7 @@ s32 wilc_hif_set_cfg(struct wilc_vif *vif,
 s32 wilc_init(struct net_device *dev, struct host_if_drv **phWFIDrv);
 s32 wilc_deinit(struct wilc_vif *vif);
 int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period,
-   u32 head_len, u8 *pu8Head, u32 u32TailLen, u8 *pu8Tail);
+   u32 head_len, u8 *head, u32 u32TailLen, u8 *pu8Tail);
 int wilc_del_beacon(struct wilc_vif *vif);
 int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param);
 int wilc_del_allstation(struct wilc_vif *vif, u8 mac_addr[][ETH_ALEN]);
-- 
2.6.4

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


[PATCH 22/30] staging: wilc1000: rename u8AssocNumb in wilc_del_allstation

2016-01-03 Thread Chaehyun Lim
This patch renames u8AssocNumb to assoc_sta to avoid camelcase.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index c0f30a2..0ff500d 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4307,7 +4307,7 @@ int wilc_del_allstation(struct wilc_vif *vif, u8 
mac_addr[][ETH_ALEN])
struct host_if_drv *hif_drv = vif->hif_drv;
u8 zero_addr[ETH_ALEN] = {0};
int i;
-   u8 u8AssocNumb = 0;
+   u8 assoc_sta = 0;
 
if (!hif_drv) {
PRINT_ER("driver is null\n");
@@ -4331,15 +4331,15 @@ int wilc_del_allstation(struct wilc_vif *vif, u8 
mac_addr[][ETH_ALEN])
del_all_sta_info->del_all_sta[i][3],
del_all_sta_info->del_all_sta[i][4],
del_all_sta_info->del_all_sta[i][5]);
-   u8AssocNumb++;
+   assoc_sta++;
}
}
-   if (!u8AssocNumb) {
+   if (!assoc_sta) {
PRINT_D(CFG80211_DBG, "NO ASSOCIATED STAS\n");
return result;
}
 
-   del_all_sta_info->assoc_sta = u8AssocNumb;
+   del_all_sta_info->assoc_sta = assoc_sta;
result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
 
if (result)
-- 
2.6.4

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


[PATCH 30/30] staging: wilc1000: rename pstrSetBeaconParam in wilc_add_beacon

2016-01-03 Thread Chaehyun Lim
This patch renames pstrSetBeaconParam to beacon_info to avoid camelcase.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 25 -
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 8f8c583..34d56cd 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4164,7 +4164,7 @@ int wilc_add_beacon(struct wilc_vif *vif, u32 interval, 
u32 dtim_period,
 {
int result = 0;
struct host_if_msg msg;
-   struct beacon_attr *pstrSetBeaconParam = &msg.body.beacon_info;
+   struct beacon_attr *beacon_info = &msg.body.beacon_info;
struct host_if_drv *hif_drv = vif->hif_drv;
 
if (!hif_drv) {
@@ -4178,25 +4178,24 @@ int wilc_add_beacon(struct wilc_vif *vif, u32 interval, 
u32 dtim_period,
 
msg.id = HOST_IF_MSG_ADD_BEACON;
msg.vif = vif;
-   pstrSetBeaconParam->interval = interval;
-   pstrSetBeaconParam->dtim_period = dtim_period;
-   pstrSetBeaconParam->head_len = head_len;
-   pstrSetBeaconParam->head = kmemdup(head, head_len, GFP_KERNEL);
-   if (!pstrSetBeaconParam->head) {
+   beacon_info->interval = interval;
+   beacon_info->dtim_period = dtim_period;
+   beacon_info->head_len = head_len;
+   beacon_info->head = kmemdup(head, head_len, GFP_KERNEL);
+   if (!beacon_info->head) {
result = -ENOMEM;
goto ERRORHANDLER;
}
-   pstrSetBeaconParam->tail_len = tail_len;
+   beacon_info->tail_len = tail_len;
 
if (tail_len > 0) {
-   pstrSetBeaconParam->tail = kmemdup(tail, tail_len,
-  GFP_KERNEL);
-   if (!pstrSetBeaconParam->tail) {
+   beacon_info->tail = kmemdup(tail, tail_len, GFP_KERNEL);
+   if (!beacon_info->tail) {
result = -ENOMEM;
goto ERRORHANDLER;
}
} else {
-   pstrSetBeaconParam->tail = NULL;
+   beacon_info->tail = NULL;
}
 
result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -4205,9 +4204,9 @@ int wilc_add_beacon(struct wilc_vif *vif, u32 interval, 
u32 dtim_period,
 
 ERRORHANDLER:
if (result) {
-   kfree(pstrSetBeaconParam->head);
+   kfree(beacon_info->head);
 
-   kfree(pstrSetBeaconParam->tail);
+   kfree(beacon_info->tail);
}
 
return result;
-- 
2.6.4

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


[PATCH 25/30] staging: wilc1000: rename u32DTIMPeriod in wilc_add_beacon

2016-01-03 Thread Chaehyun Lim
This patch renames u32DTIMPeriod to dtim_period to avoid camelcase.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 615ae59..9d9cf91 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4159,7 +4159,7 @@ int wilc_frame_register(struct wilc_vif *vif, u16 
frame_type, bool reg)
return result;
 }
 
-int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 u32DTIMPeriod,
+int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period,
u32 u32HeadLen, u8 *pu8Head, u32 u32TailLen, u8 *pu8Tail)
 {
int result = 0;
@@ -4179,7 +4179,7 @@ int wilc_add_beacon(struct wilc_vif *vif, u32 interval, 
u32 u32DTIMPeriod,
msg.id = HOST_IF_MSG_ADD_BEACON;
msg.vif = vif;
pstrSetBeaconParam->interval = interval;
-   pstrSetBeaconParam->dtim_period = u32DTIMPeriod;
+   pstrSetBeaconParam->dtim_period = dtim_period;
pstrSetBeaconParam->head_len = u32HeadLen;
pstrSetBeaconParam->head = kmemdup(pu8Head, u32HeadLen, GFP_KERNEL);
if (!pstrSetBeaconParam->head) {
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 93a8abb..58b73d6 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -343,7 +343,7 @@ s32 wilc_hif_set_cfg(struct wilc_vif *vif,
 struct cfg_param_val *pstrCfgParamVal);
 s32 wilc_init(struct net_device *dev, struct host_if_drv **phWFIDrv);
 s32 wilc_deinit(struct wilc_vif *vif);
-int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 u32DTIMPeriod,
+int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period,
u32 u32HeadLen, u8 *pu8Head, u32 u32TailLen, u8 *pu8Tail);
 int wilc_del_beacon(struct wilc_vif *vif);
 int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param);
-- 
2.6.4

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


[PATCH 21/30] staging: wilc1000: use int instead of u32

2016-01-03 Thread Chaehyun Lim
The variable i is used as array index so that it is better to use data
type of int.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index a3f120a..c0f30a2 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4306,7 +4306,7 @@ int wilc_del_allstation(struct wilc_vif *vif, u8 
mac_addr[][ETH_ALEN])
struct del_all_sta *del_all_sta_info = &msg.body.del_all_sta_info;
struct host_if_drv *hif_drv = vif->hif_drv;
u8 zero_addr[ETH_ALEN] = {0};
-   u32 i;
+   int i;
u8 u8AssocNumb = 0;
 
if (!hif_drv) {
-- 
2.6.4

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


[PATCH 24/30] staging: wilc1000: rename u32Interval in wilc_add_beacon

2016-01-03 Thread Chaehyun Lim
This patch renames u32Interval to interval to avoid camelcase.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 8d935e4..615ae59 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4159,7 +4159,7 @@ int wilc_frame_register(struct wilc_vif *vif, u16 
frame_type, bool reg)
return result;
 }
 
-int wilc_add_beacon(struct wilc_vif *vif, u32 u32Interval, u32 u32DTIMPeriod,
+int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 u32DTIMPeriod,
u32 u32HeadLen, u8 *pu8Head, u32 u32TailLen, u8 *pu8Tail)
 {
int result = 0;
@@ -4178,7 +4178,7 @@ int wilc_add_beacon(struct wilc_vif *vif, u32 
u32Interval, u32 u32DTIMPeriod,
 
msg.id = HOST_IF_MSG_ADD_BEACON;
msg.vif = vif;
-   pstrSetBeaconParam->interval = u32Interval;
+   pstrSetBeaconParam->interval = interval;
pstrSetBeaconParam->dtim_period = u32DTIMPeriod;
pstrSetBeaconParam->head_len = u32HeadLen;
pstrSetBeaconParam->head = kmemdup(pu8Head, u32HeadLen, GFP_KERNEL);
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 272b696..93a8abb 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -343,7 +343,7 @@ s32 wilc_hif_set_cfg(struct wilc_vif *vif,
 struct cfg_param_val *pstrCfgParamVal);
 s32 wilc_init(struct net_device *dev, struct host_if_drv **phWFIDrv);
 s32 wilc_deinit(struct wilc_vif *vif);
-int wilc_add_beacon(struct wilc_vif *vif, u32 u32Interval, u32 u32DTIMPeriod,
+int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 u32DTIMPeriod,
u32 u32HeadLen, u8 *pu8Head, u32 u32TailLen, u8 *pu8Tail);
 int wilc_del_beacon(struct wilc_vif *vif);
 int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param);
-- 
2.6.4

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


[PATCH 19/30] staging: wilc1000: rename pstrDelAllStationMsg in wilc_del_allstation

2016-01-03 Thread Chaehyun Lim
This patch renames pstrDelAllStationMsg to del_all_sta_info to avoid
camelcase.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 37a78a3..7686a52 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4303,7 +4303,7 @@ int wilc_del_allstation(struct wilc_vif *vif, u8 
mac_addr[][ETH_ALEN])
 {
int result = 0;
struct host_if_msg msg;
-   struct del_all_sta *pstrDelAllStationMsg = &msg.body.del_all_sta_info;
+   struct del_all_sta *del_all_sta_info = &msg.body.del_all_sta_info;
struct host_if_drv *hif_drv = vif->hif_drv;
u8 au8Zero_Buff[ETH_ALEN] = {0};
u32 i;
@@ -4323,14 +4323,14 @@ int wilc_del_allstation(struct wilc_vif *vif, u8 
mac_addr[][ETH_ALEN])
 
for (i = 0; i < MAX_NUM_STA; i++) {
if (memcmp(mac_addr[i], au8Zero_Buff, ETH_ALEN)) {
-   memcpy(pstrDelAllStationMsg->del_all_sta[i], 
mac_addr[i], ETH_ALEN);
+   memcpy(del_all_sta_info->del_all_sta[i], mac_addr[i], 
ETH_ALEN);
PRINT_D(CFG80211_DBG, "BSSID = %x%x%x%x%x%x\n",
-   pstrDelAllStationMsg->del_all_sta[i][0],
-   pstrDelAllStationMsg->del_all_sta[i][1],
-   pstrDelAllStationMsg->del_all_sta[i][2],
-   pstrDelAllStationMsg->del_all_sta[i][3],
-   pstrDelAllStationMsg->del_all_sta[i][4],
-   pstrDelAllStationMsg->del_all_sta[i][5]);
+   del_all_sta_info->del_all_sta[i][0],
+   del_all_sta_info->del_all_sta[i][1],
+   del_all_sta_info->del_all_sta[i][2],
+   del_all_sta_info->del_all_sta[i][3],
+   del_all_sta_info->del_all_sta[i][4],
+   del_all_sta_info->del_all_sta[i][5]);
u8AssocNumb++;
}
}
@@ -4339,7 +4339,7 @@ int wilc_del_allstation(struct wilc_vif *vif, u8 
mac_addr[][ETH_ALEN])
return result;
}
 
-   pstrDelAllStationMsg->assoc_sta = u8AssocNumb;
+   del_all_sta_info->assoc_sta = u8AssocNumb;
result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
 
if (result)
-- 
2.6.4

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


[PATCH 18/30] staging: wilc1000: rename pu8MacAddr in wilc_del_allstation

2016-01-03 Thread Chaehyun Lim
This patch renames pu8MacAddr to mac_addr to avoid camelcase.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 3f410b2..37a78a3 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4299,7 +4299,7 @@ int wilc_del_station(struct wilc_vif *vif, const u8 
*mac_addr)
return result;
 }
 
-int wilc_del_allstation(struct wilc_vif *vif, u8 pu8MacAddr[][ETH_ALEN])
+int wilc_del_allstation(struct wilc_vif *vif, u8 mac_addr[][ETH_ALEN])
 {
int result = 0;
struct host_if_msg msg;
@@ -4322,8 +4322,8 @@ int wilc_del_allstation(struct wilc_vif *vif, u8 
pu8MacAddr[][ETH_ALEN])
msg.vif = vif;
 
for (i = 0; i < MAX_NUM_STA; i++) {
-   if (memcmp(pu8MacAddr[i], au8Zero_Buff, ETH_ALEN)) {
-   memcpy(pstrDelAllStationMsg->del_all_sta[i], 
pu8MacAddr[i], ETH_ALEN);
+   if (memcmp(mac_addr[i], au8Zero_Buff, ETH_ALEN)) {
+   memcpy(pstrDelAllStationMsg->del_all_sta[i], 
mac_addr[i], ETH_ALEN);
PRINT_D(CFG80211_DBG, "BSSID = %x%x%x%x%x%x\n",
pstrDelAllStationMsg->del_all_sta[i][0],
pstrDelAllStationMsg->del_all_sta[i][1],
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 6d424e7..3c932e7a 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -347,7 +347,7 @@ s32 wilc_add_beacon(struct wilc_vif *vif, u32 u32Interval, 
u32 u32DTIMPeriod,
u32 u32HeadLen, u8 *pu8Head, u32 u32TailLen, u8 *pu8Tail);
 int wilc_del_beacon(struct wilc_vif *vif);
 int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param);
-int wilc_del_allstation(struct wilc_vif *vif, u8 pu8MacAddr[][ETH_ALEN]);
+int wilc_del_allstation(struct wilc_vif *vif, u8 mac_addr[][ETH_ALEN]);
 int wilc_del_station(struct wilc_vif *vif, const u8 *mac_addr);
 int wilc_edit_station(struct wilc_vif *vif,
  struct add_sta_param *sta_param);
-- 
2.6.4

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


[PATCH 20/30] staging: wilc1000: rename au8Zero_Buff in wilc_del_allstation

2016-01-03 Thread Chaehyun Lim
This patch renames au8Zero_Buff to zero_addr to avoid camelcase.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 7686a52..a3f120a 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4305,7 +4305,7 @@ int wilc_del_allstation(struct wilc_vif *vif, u8 
mac_addr[][ETH_ALEN])
struct host_if_msg msg;
struct del_all_sta *del_all_sta_info = &msg.body.del_all_sta_info;
struct host_if_drv *hif_drv = vif->hif_drv;
-   u8 au8Zero_Buff[ETH_ALEN] = {0};
+   u8 zero_addr[ETH_ALEN] = {0};
u32 i;
u8 u8AssocNumb = 0;
 
@@ -4322,7 +4322,7 @@ int wilc_del_allstation(struct wilc_vif *vif, u8 
mac_addr[][ETH_ALEN])
msg.vif = vif;
 
for (i = 0; i < MAX_NUM_STA; i++) {
-   if (memcmp(mac_addr[i], au8Zero_Buff, ETH_ALEN)) {
+   if (memcmp(mac_addr[i], zero_addr, ETH_ALEN)) {
memcpy(del_all_sta_info->del_all_sta[i], mac_addr[i], 
ETH_ALEN);
PRINT_D(CFG80211_DBG, "BSSID = %x%x%x%x%x%x\n",
del_all_sta_info->del_all_sta[i][0],
-- 
2.6.4

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


[PATCH 26/30] staging: wilc1000: rename u32HeadLen in wilc_add_beacon

2016-01-03 Thread Chaehyun Lim
This patch renames u32HeadLen to head_len to avoid camelcase.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 9d9cf91..07674d2 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4160,7 +4160,7 @@ int wilc_frame_register(struct wilc_vif *vif, u16 
frame_type, bool reg)
 }
 
 int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period,
-   u32 u32HeadLen, u8 *pu8Head, u32 u32TailLen, u8 *pu8Tail)
+   u32 head_len, u8 *pu8Head, u32 u32TailLen, u8 *pu8Tail)
 {
int result = 0;
struct host_if_msg msg;
@@ -4180,8 +4180,8 @@ int wilc_add_beacon(struct wilc_vif *vif, u32 interval, 
u32 dtim_period,
msg.vif = vif;
pstrSetBeaconParam->interval = interval;
pstrSetBeaconParam->dtim_period = dtim_period;
-   pstrSetBeaconParam->head_len = u32HeadLen;
-   pstrSetBeaconParam->head = kmemdup(pu8Head, u32HeadLen, GFP_KERNEL);
+   pstrSetBeaconParam->head_len = head_len;
+   pstrSetBeaconParam->head = kmemdup(pu8Head, head_len, GFP_KERNEL);
if (!pstrSetBeaconParam->head) {
result = -ENOMEM;
goto ERRORHANDLER;
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 58b73d6..0275028 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -344,7 +344,7 @@ s32 wilc_hif_set_cfg(struct wilc_vif *vif,
 s32 wilc_init(struct net_device *dev, struct host_if_drv **phWFIDrv);
 s32 wilc_deinit(struct wilc_vif *vif);
 int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period,
-   u32 u32HeadLen, u8 *pu8Head, u32 u32TailLen, u8 *pu8Tail);
+   u32 head_len, u8 *pu8Head, u32 u32TailLen, u8 *pu8Tail);
 int wilc_del_beacon(struct wilc_vif *vif);
 int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param);
 int wilc_del_allstation(struct wilc_vif *vif, u8 mac_addr[][ETH_ALEN]);
-- 
2.6.4

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


RE: [PATCH V5 4/9] Drivers: hv: ring_buffer: enhance hv_ringbuffer_read() to support hvsock

2016-01-03 Thread Dexuan Cui
> -Original Message-
> From: David Miller [mailto:da...@davemloft.net]
> Sent: Saturday, January 2, 2016 12:30
> To: Dexuan Cui 
> Cc: gre...@linuxfoundation.org; step...@networkplumber.org;
> net...@vger.kernel.org; linux-ker...@vger.kernel.org; driverdev-
> de...@linuxdriverproject.org; o...@aepfle.de; a...@canonical.com;
> jasow...@redhat.com; KY Srinivasan ; pebo...@tiscali.nl;
> stefa...@redhat.com; vkuzn...@redhat.com; dan.carpen...@oracle.com
> Subject: Re: [PATCH V5 4/9] Drivers: hv: ring_buffer: enhance
> hv_ringbuffer_read() to support hvsock
> 
> From: Dexuan Cui 
> Date: Thu, 24 Dec 2015 06:14:36 -0800
> 
> > +#define HV_RINGBUFFER_READ_FLAG_RAW(1 << 0)
> > +#define HV_RINGBUFFER_READ_FLAG_HVSOCK (1 << 1)
> 
> Please use BIT().

Hi David, 
Thanks for the suggestion!  I'll fix it.

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


can we discuss?

2016-01-03 Thread Thomas Frederick

Happy New Year!!!
Do you need to better your business in the new year?

No matter you are selling products or services, we can generate you leads
of the buyers.

Please reply for pricing and details.
Thomas Frederick
contact: martwe...@sina.com

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


Re: [RFC PATCH v0] Add tw5864 driver

2016-01-03 Thread Andrey Utkin
On Sun, Jan 3, 2016 at 5:47 AM, Joe Perches  wrote:
> several of these have unnecessary parentheses

Thanks, fixed.

> Maybe use bool a bit more

Thanks, fixed.

> or maybe just use fls

Thanks, fls() fit greatly, rewritten the function with compatibility testing.

>> +static inline int bs_size_ue(unsigned int val)
>> +{
>> + int i_size = 0;
>> + static const int i_size0_254[255] = {
>
> Same sort of thing

Dropped this procedure because it is not used.
Thanks.

>> diff --git a/drivers/staging/media/tw5864/tw5864-config.c 
>> b/drivers/staging/media/tw5864/tw5864-config.c
> []
>> +u8 tw_indir_readb(struct tw5864_dev *dev, u16 addr)
>> +{
>> + int timeout = 3;
>
> misleading name, retries would be more proper,
> or maybe use real timed loops.

Thanks, renamed to "retries".

> This seems a little repetitive.

Thanks, reworked.

> u16?

Thanks, fixed.

> odd indentation

Indeed. For some mysterious reason, vim + syntastic insists on this way. Fixed.

>> +#ifdef DEBUG
>> + dev_dbg(&input->root->pci->dev,
>> + "input %d, frame md stats: min %u, max %u, avg %u, cells above 
>> threshold: %u\n",
>> + input->input_number, min, max, sum / md_cells,
>> + cnt_above_thresh);
>> +#endif
>
> unnecessary #ifdef

Not quite. This debug printout works with variables which are declared
in another "#ifdef DEBUG" clause. And it turns out that dev_dbg is
compiled not only if DEBUG is declared, so when I remove this ifdef, I
get "undefined variable" errors. It seems it is compiled if this
condition is met:

#if (defined DEBUG) || (defined CONFIG_DYNAMIC_DEBUG)

so I can wrap my stats variables into this statement instead. But such
change is not equivalent - I guess CONFIG_DYNAMIC_DEBUG is common to
be enabled, so debug stats will be always calculated, even when module
is not under debug. Except if I use DEFINE_DYNAMIC_DEBUG_METADATA etc.
in my code. Please let me know if this can be sorted out in cleaner
way.



On Sun, Jan 3, 2016 at 7:38 AM, Leon Romanovsky  wrote:
> On Sun, Jan 03, 2016 at 03:41:42AM +0200, Andrey Utkin wrote:
> 
>> +/*
>> + *  TW5864 driver - Exp-Golomb code functions
>> + *
>> + *  Copyright (C) 2015 Bluecherry, LLC 
>> + *  Copyright (C) 2015 Andrey Utkin 
>
> I doubt that you have contract with your employer which permits you to
> claim copyright on the work/product.

Thank you for commenting.
I have previously asked my employer to review copyright statment, and
he told this is fine.
Now I have requrested him again with reference to your comment.

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


[PATCH] staging-slicoss: Replace variable initialisations by assignments in slic_if_init()

2016-01-03 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sun, 3 Jan 2016 17:25:59 +0100

Replace explicit initialisation for two local variables at the beginning
by assignments.

Signed-off-by: Markus Elfring 
---
 drivers/staging/slicoss/slicoss.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/slicoss/slicoss.c 
b/drivers/staging/slicoss/slicoss.c
index b23a2d1..8fdcac8 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -2301,9 +2301,9 @@ static int slic_adapter_allocresources(struct adapter 
*adapter,
  */
 static int slic_if_init(struct adapter *adapter, unsigned long *flags)
 {
-   struct sliccard *card = adapter->card;
+   struct sliccard *card;
struct net_device *dev = adapter->netdev;
-   __iomem struct slic_regs *slic_regs = adapter->slic_regs;
+   __iomem struct slic_regs *slic_regs;
struct slic_shmem *pshmem;
int rc;
 
@@ -2348,6 +2348,7 @@ static int slic_if_init(struct adapter *adapter, unsigned 
long *flags)
adapter->queues_initialized = 1;
}
 
+   slic_regs = adapter->slic_regs;
slic_reg32_write(&slic_regs->slic_icr, ICR_INT_OFF, FLUSH);
mdelay(1);
 
@@ -2374,6 +2375,7 @@ static int slic_if_init(struct adapter *adapter, unsigned 
long *flags)
}
 
adapter->state = ADAPT_UP;
+   card = adapter->card;
if (!card->loadtimerset) {
setup_timer(&card->loadtimer, &slic_timer_load_check,
(ulong)card);
-- 
2.6.3

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


Re: [PATCH] staging-slicoss: Replace variable initialisations by assignments in slic_if_init()

2016-01-03 Thread Julia Lawall
On Sun, 3 Jan 2016, SF Markus Elfring wrote:

> From: Markus Elfring 
> Date: Sun, 3 Jan 2016 17:25:59 +0100
> 
> Replace explicit initialisation for two local variables at the beginning
> by assignments.

Why?

julia

> Signed-off-by: Markus Elfring 
> ---
>  drivers/staging/slicoss/slicoss.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/slicoss/slicoss.c 
> b/drivers/staging/slicoss/slicoss.c
> index b23a2d1..8fdcac8 100644
> --- a/drivers/staging/slicoss/slicoss.c
> +++ b/drivers/staging/slicoss/slicoss.c
> @@ -2301,9 +2301,9 @@ static int slic_adapter_allocresources(struct adapter 
> *adapter,
>   */
>  static int slic_if_init(struct adapter *adapter, unsigned long *flags)
>  {
> - struct sliccard *card = adapter->card;
> + struct sliccard *card;
>   struct net_device *dev = adapter->netdev;
> - __iomem struct slic_regs *slic_regs = adapter->slic_regs;
> + __iomem struct slic_regs *slic_regs;
>   struct slic_shmem *pshmem;
>   int rc;
>  
> @@ -2348,6 +2348,7 @@ static int slic_if_init(struct adapter *adapter, 
> unsigned long *flags)
>   adapter->queues_initialized = 1;
>   }
>  
> + slic_regs = adapter->slic_regs;
>   slic_reg32_write(&slic_regs->slic_icr, ICR_INT_OFF, FLUSH);
>   mdelay(1);
>  
> @@ -2374,6 +2375,7 @@ static int slic_if_init(struct adapter *adapter, 
> unsigned long *flags)
>   }
>  
>   adapter->state = ADAPT_UP;
> + card = adapter->card;
>   if (!card->loadtimerset) {
>   setup_timer(&card->loadtimer, &slic_timer_load_check,
>   (ulong)card);
> -- 
> 2.6.3
> 
> --
> 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


[PATCH 01/29] staging/lustre/lnet: Make lnet_ping static

2016-01-03 Thread green
From: Oleg Drokin 

It's not used anywhere outside of api-ni.c anyway.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/include/linux/lnet/lib-lnet.h | 2 --
 drivers/staging/lustre/lnet/lnet/api-ni.c| 7 +--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h 
b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
index b67a660..40acddd 100644
--- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
+++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
@@ -662,8 +662,6 @@ void lnet_swap_pinginfo(lnet_ping_info_t *info);
 
 int lnet_ping_target_init(void);
 void lnet_ping_target_fini(void);
-int lnet_ping(lnet_process_id_t id, int timeout_ms,
- lnet_process_id_t *ids, int n_ids);
 
 int lnet_parse_ip2nets(char **networksp, char *ip2nets);
 int lnet_parse_routes(char *route_str, int *im_a_router);
diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c 
b/drivers/staging/lustre/lnet/lnet/api-ni.c
index 362282f..de453ce 100644
--- a/drivers/staging/lustre/lnet/lnet/api-ni.c
+++ b/drivers/staging/lustre/lnet/lnet/api-ni.c
@@ -61,6 +61,9 @@ static int rnet_htable_size = LNET_REMOTE_NETS_HASH_DEFAULT;
 module_param(rnet_htable_size, int, 0444);
 MODULE_PARM_DESC(rnet_htable_size, "size of remote network hash table");
 
+static int lnet_ping(lnet_process_id_t id, int timeout_ms,
+lnet_process_id_t *ids, int n_ids);
+
 static char *
 lnet_get_routes(void)
 {
@@ -1672,8 +1675,8 @@ lnet_ping_target_fini(void)
cfs_restore_sigs(blocked);
 }
 
-int
-lnet_ping(lnet_process_id_t id, int timeout_ms, lnet_process_id_t *ids, int 
n_ids)
+static int lnet_ping(lnet_process_id_t id, int timeout_ms,
+lnet_process_id_t *ids, int n_ids)
 {
lnet_handle_eq_t eqh;
lnet_handle_md_t mdh;
-- 
2.1.0

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


[PATCH 02/29] staging/lustre/lnet: Get rid of IOC_LIBCFS_DEBUG_PEER hack

2016-01-03 Thread green
From: Oleg Drokin 

IOC_LIBCFS_DEBUG_PEER was added back in the stone ages to print debug
statistics on a peer when peer timeout happens.
Redo it properly as a separate LNet API call,
also get rid of "ioctl" forwarding into the underlying LNDs,
since no current LNDs implement this function anymore.

Signed-off-by: Oleg Drokin 
---
 .../lustre/include/linux/libcfs/libcfs_ioctl.h |  2 +-
 drivers/staging/lustre/include/linux/lnet/api.h|  1 +
 drivers/staging/lustre/lnet/lnet/api-ni.c  | 38 --
 drivers/staging/lustre/lustre/ptlrpc/client.c  |  2 +-
 4 files changed, 10 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h 
b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
index 485ab26..7c5e5c8 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
@@ -123,7 +123,7 @@ struct libcfs_ioctl_handler {
 #define IOC_LIBCFS_CONFIGURE  _IOWR('e', 59, long)
 #define IOC_LIBCFS_TESTPROTOCOMPAT  _IOWR('e', 60, long)
 #define IOC_LIBCFS_PING_IOWR('e', 61, long)
-#define IOC_LIBCFS_DEBUG_PEER_IOWR('e', 62, long)
+/* #define IOC_LIBCFS_DEBUG_PEER _IOWR('e', 62, long) */
 #define IOC_LIBCFS_LNETST_IOWR('e', 63, long)
 /* lnd ioctls */
 #define IOC_LIBCFS_REGISTER_MYNID_IOWR('e', 70, long)
diff --git a/drivers/staging/lustre/include/linux/lnet/api.h 
b/drivers/staging/lustre/include/linux/lnet/api.h
index 75285fd..fa5fad3 100644
--- a/drivers/staging/lustre/include/linux/lnet/api.h
+++ b/drivers/staging/lustre/include/linux/lnet/api.h
@@ -197,6 +197,7 @@ int LNetGet(lnet_nid_tself,
 int LNetSetLazyPortal(int portal);
 int LNetClearLazyPortal(int portal);
 int LNetCtl(unsigned int cmd, void *arg);
+void LNetDebugPeer(lnet_process_id_t id);
 
 /** @} lnet_misc */
 
diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c 
b/drivers/staging/lustre/lnet/lnet/api-ni.c
index de453ce..94ccef5 100644
--- a/drivers/staging/lustre/lnet/lnet/api-ni.c
+++ b/drivers/staging/lustre/lnet/lnet/api-ni.c
@@ -1316,17 +1316,10 @@ LNetNIFini(void)
 EXPORT_SYMBOL(LNetNIFini);
 
 /**
- * This is an ugly hack to export IOC_LIBCFS_DEBUG_PEER and
- * IOC_LIBCFS_PORTALS_COMPATIBILITY commands to users, by tweaking the LNet
- * internal ioctl handler.
+ * LNet ioctl handler.
  *
  * IOC_LIBCFS_PORTALS_COMPATIBILITY is now deprecated, don't use it.
  *
- * \param cmd IOC_LIBCFS_DEBUG_PEER to print debugging data about a peer.
- * The data will be printed to system console. Don't use it excessively.
- * \param arg A pointer to lnet_process_id_t, process ID of the peer.
- *
- * \return Always return 0 when called by users directly (i.e., not via ioctl).
  */
 int
 LNetCtl(unsigned int cmd, void *arg)
@@ -1396,29 +1389,6 @@ LNetCtl(unsigned int cmd, void *arg)
data->ioc_count = rc;
return 0;
 
-   case IOC_LIBCFS_DEBUG_PEER: {
-   /* CAVEAT EMPTOR: this one designed for calling directly; not
-* via an ioctl */
-   id = *((lnet_process_id_t *) arg);
-
-   lnet_debug_peer(id.nid);
-
-   ni = lnet_net2ni(LNET_NIDNET(id.nid));
-   if (ni == NULL) {
-   CDEBUG(D_WARNING, "No NI for %s\n", libcfs_id2str(id));
-   } else {
-   if (ni->ni_lnd->lnd_ctl == NULL) {
-   CDEBUG(D_WARNING, "No ctl for %s\n",
-  libcfs_id2str(id));
-   } else {
-   (void)ni->ni_lnd->lnd_ctl(ni, cmd, arg);
-   }
-
-   lnet_ni_decref(ni);
-   }
-   return 0;
-   }
-
default:
ni = lnet_net2ni(data->ioc_net);
if (ni == NULL)
@@ -1436,6 +1406,12 @@ LNetCtl(unsigned int cmd, void *arg)
 }
 EXPORT_SYMBOL(LNetCtl);
 
+void LNetDebugPeer(lnet_process_id_t id)
+{
+   lnet_debug_peer(id.nid);
+}
+EXPORT_SYMBOL(LNetDebugPeer);
+
 /**
  * Retrieve the lnet_process_id_t ID of LNet interface at \a index. Note that
  * all interfaces share a same PID, as requested by LNetNIInit().
diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c 
b/drivers/staging/lustre/lustre/ptlrpc/client.c
index efdda09..8b54463 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/client.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
@@ -1883,7 +1883,7 @@ int ptlrpc_expire_one_request(struct ptlrpc_request *req, 
int async_unlink)
  (s64)req->rq_sent, (s64)req->rq_real_sent);
 
if (imp != NULL && obd_debug_peer_on_timeout)
-   LNetCtl(IOC_LIBCFS_DEBUG_PEER, &imp->imp_connection->c_peer);
+   LNetDebugPeer(imp->imp_connection->c_peer);
 
ptlrpc_unregister_reply(req, async_unlink);
ptlrpc_unregister_bulk(req, asyn

[PATCH 06/29] staging/lustre: Add __user attributes to libcfs_ioctl_get/popdata args

2016-01-03 Thread green
From: Oleg Drokin 

Just make clear which pointers are from userspace and which are not in
libcfs_ioctl_getdata/libcfs_ioctl_popdata and their callers.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h | 4 ++--
 drivers/staging/lustre/lustre/libcfs/linux/linux-module.c  | 6 +++---
 drivers/staging/lustre/lustre/libcfs/module.c  | 5 +++--
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h 
b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
index 3b16fce..0c31bf9 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
@@ -207,7 +207,7 @@ static inline int libcfs_ioctl_is_invalid(struct 
libcfs_ioctl_data *data)
 
 int libcfs_register_ioctl(struct libcfs_ioctl_handler *hand);
 int libcfs_deregister_ioctl(struct libcfs_ioctl_handler *hand);
-int libcfs_ioctl_getdata(char *buf, char *end, void *arg);
-int libcfs_ioctl_popdata(void *arg, void *buf, int size);
+int libcfs_ioctl_getdata(char *buf, char *end, void __user *arg);
+int libcfs_ioctl_popdata(void __user *arg, void *buf, int size);
 
 #endif /* __LIBCFS_IOCTL_H__ */
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c 
b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
index 70a99cf0..552a606 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
@@ -40,7 +40,7 @@
 
 #define LNET_MINOR 240
 
-int libcfs_ioctl_getdata(char *buf, char *end, void *arg)
+int libcfs_ioctl_getdata(char *buf, char *end, void __user *arg)
 {
struct libcfs_ioctl_hdr   *hdr;
struct libcfs_ioctl_data  *data;
@@ -88,9 +88,9 @@ int libcfs_ioctl_getdata(char *buf, char *end, void *arg)
return 0;
 }
 
-int libcfs_ioctl_popdata(void *arg, void *data, int size)
+int libcfs_ioctl_popdata(void __user *arg, void *data, int size)
 {
-   if (copy_to_user((char *)arg, data, size))
+   if (copy_to_user(arg, data, size))
return -EFAULT;
return 0;
 }
diff --git a/drivers/staging/lustre/lustre/libcfs/module.c 
b/drivers/staging/lustre/lustre/libcfs/module.c
index 329d78c..2aa142f 100644
--- a/drivers/staging/lustre/lustre/libcfs/module.c
+++ b/drivers/staging/lustre/lustre/libcfs/module.c
@@ -242,7 +242,7 @@ int libcfs_deregister_ioctl(struct libcfs_ioctl_handler 
*hand)
 EXPORT_SYMBOL(libcfs_deregister_ioctl);
 
 static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, unsigned long cmd,
-   void *arg, struct libcfs_ioctl_data *data)
+   void __user *arg, struct libcfs_ioctl_data *data)
 {
int err = -EINVAL;
 
@@ -296,7 +296,8 @@ static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, 
unsigned long cmd,
return err;
 }
 
-static int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd, void 
*arg)
+static int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd,
+   void __user *arg)
 {
char*buf;
struct libcfs_ioctl_data *data;
-- 
2.1.0

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


[PATCH 00/29] Clean up Lustre userspace accesses

2016-01-03 Thread green
From: Oleg Drokin 

This patch series is aimed at cleaning up lustre<->userspace communications,
sprinkling around __user attributes where needed to make sparse happy
and so on (mostly in various ioctl code paths).
This activity also uncovered a couple of bugs that are fixed too
(even if some preceeding cleanups are unacceptable, please apply
the fixes out of order, they should work just fine and are independent).

After the serie is applied, the only remaining address-space warning from
sparse left are:
drivers/staging/lustre/lnet/selftest/console.c:1464:41: warning: cast removes 
address space of expression
drivers/staging/lustre/lnet/selftest/console.c:1466:41: warning: cast removes 
address space of expression
drivers/staging/lustre/lustre/obdecho/echo_client.c:1586:22: warning: cast 
removes address space of expression

These three just cast a "userspace pointer" argument into an integer,
so I am not sure why sparse is unhappy as that should be pretty safe.

drivers/staging/lustre/lnet/selftest/conrpc.c:492:30: error: incompatible types 
in comparison expression (different address spaces)

This one actually compares two userspace pointers, just one is marked as __user
for accessing the userspace stuff and one is not, so that we can actually
copy into it (and then perform some comparisons). I am not sure how to
address this one outside of some ugly casts.

drivers/staging/lustre/lnet/lnet/lib-socket.c:175:29: warning: incorrect type 
in assignment (different address spaces)
drivers/staging/lustre/lustre/obdclass/obd_config.c:1020:76: warning: incorrect 
type in argument 2 (different address spaces)

These two are calling into the kernel from within a kernel for ioctl or
io purposes, but they do set_fs(KERNEL_DS); so that the kernel address space
is usable with userspace-access funcitons so all should be fine, just
need to find how to silence sparse about these I guess?

Please consider.

Frank Zago (1):
  staging/lustre: Add __user annotations in lnetselftest code

John L. Hammond (1):
  staging/lustre/obdecho: remove userspace LSM handling

Oleg Drokin (27):
  staging/lustre/lnet: Make lnet_ping static
  staging/lustre/lnet: Get rid of IOC_LIBCFS_DEBUG_PEER hack
  staging/lustre/lnet: Get rid of IOC_LIBCFS_PORTALS_COMPATIBILITY ioctl
  staging/lustre/obdecho: Remove unused ioctls
  staging/lustre: Add __user attributes to libcfs_ioctl_get/popdata args
  staging/lustre: Change ioctl user pointers in libcfs_ioctl_data
  staging/lustre: Update user pointers in struct obd_ioctl_data
  staging/lustre: Mark obd_ioctl_popdata/getdata argument as __user
  staging/lustre/lnet: Properly mark userspace pointer of lnet_ping()
  staging/lustre: Get rid of an ugly statfs hack in lov_iocontrol
  staging/lustre: Properly mark obd_iocontrol argument as __user
  staging/lustre: Properly mark argument to p_ioctl in cfs_psdev_ops as
__user
  staging/lustre: Declare lprocfs_write_frac_u64_helper argument as
__user
  staging/lustre/osc: Do not use lprocfs_write_helper in sysfs store
methods
  staging/lustre/llite: Properly mark ll_obd_statfs argument as __user
  staging/lustre/llite: Fix improper userspace access in ll_fiemap
  staging/lustre: Declare lov_getstripe lump argument as __user
  staging/lustre/llite: Update llite_lib.c with proper __user attributes
  staging/lustre/osc: Mark osc_getstripe user pointer argument as __user
  staging/lustre/lloop: Properly mark userspace pointers in
lo/lloop_ioctl
  staging/lustre: Properly mark lmv_fid2path uarg argment as __user
  staging/lustre: Mark lmv_hsm_ct_register/unregister uarg as __user
  staging/lustre/llite: Update all file.c user pointer casts to __user
  staging/lustre: Properly cast ll_fid2path argument to __user in
ll_file_ioctl
  staging/lustre: Properly cast ll_fid2path argument to __user in
ll_dir_ioctl
  staging/lustre: Properly cast ll_getname argument to __user in
ll_dir_ioctl
  staging/lustre/llite: Update ll_dir_ioctl pointer casts with __user

 .../staging/lustre/include/linux/libcfs/libcfs.h   |   2 +-
 .../lustre/include/linux/libcfs/libcfs_ioctl.h |  12 +-
 drivers/staging/lustre/include/linux/lnet/api.h|   1 +
 .../staging/lustre/include/linux/lnet/lib-lnet.h   |   2 -
 drivers/staging/lustre/include/linux/lnet/lnetst.h | 104 +++
 drivers/staging/lustre/lnet/lnet/api-ni.c  |  53 +---
 drivers/staging/lustre/lnet/selftest/conrpc.c  |   4 +-
 drivers/staging/lustre/lnet/selftest/conrpc.h  |   5 +-
 drivers/staging/lustre/lnet/selftest/console.c |  96 +++---
 drivers/staging/lustre/lnet/selftest/console.h |  56 ++--
 .../staging/lustre/lustre/include/lprocfs_status.h |   2 +-
 drivers/staging/lustre/lustre/include/lustre_lib.h |  16 +-
 drivers/staging/lustre/lustre/include/obd.h|   3 +-
 drivers/staging/lustre/lustre/include/obd_class.h  |   2 +-
 .../lustre/lustre/libcfs/linux/linux-module.c  |   8 +-
 drivers/staging/lustre/lustre/libcfs/module.c  |   5 +-
 drivers/staging

[PATCH 03/29] staging/lustre/lnet: Get rid of IOC_LIBCFS_PORTALS_COMPATIBILITY ioctl

2016-01-03 Thread green
From: Oleg Drokin 

This has been unused for ages and could be safely removed now.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h |  2 +-
 drivers/staging/lustre/lnet/lnet/api-ni.c  |  6 --
 drivers/staging/lustre/lustre/ptlrpc/events.c  | 11 ---
 3 files changed, 1 insertion(+), 18 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h 
b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
index 7c5e5c8..3b16fce 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
@@ -118,7 +118,7 @@ struct libcfs_ioctl_handler {
 #define IOC_LIBCFS_GET_ROUTE  _IOWR('e', 54, long)
 #define IOC_LIBCFS_NOTIFY_ROUTER  _IOWR('e', 55, long)
 #define IOC_LIBCFS_UNCONFIGURE  _IOWR('e', 56, long)
-#define IOC_LIBCFS_PORTALS_COMPATIBILITY   _IOWR('e', 57, long)
+/* #define IOC_LIBCFS_PORTALS_COMPATIBILITY   _IOWR('e', 57, long) */
 #define IOC_LIBCFS_LNET_DIST  _IOWR('e', 58, long)
 #define IOC_LIBCFS_CONFIGURE  _IOWR('e', 59, long)
 #define IOC_LIBCFS_TESTPROTOCOMPAT  _IOWR('e', 60, long)
diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c 
b/drivers/staging/lustre/lnet/lnet/api-ni.c
index 94ccef5..80b170e 100644
--- a/drivers/staging/lustre/lnet/lnet/api-ni.c
+++ b/drivers/staging/lustre/lnet/lnet/api-ni.c
@@ -1318,8 +1318,6 @@ EXPORT_SYMBOL(LNetNIFini);
 /**
  * LNet ioctl handler.
  *
- * IOC_LIBCFS_PORTALS_COMPATIBILITY is now deprecated, don't use it.
- *
  */
 int
 LNetCtl(unsigned int cmd, void *arg)
@@ -1360,10 +1358,6 @@ LNetCtl(unsigned int cmd, void *arg)
return lnet_notify(NULL, data->ioc_nid, data->ioc_flags,
   jiffies - secs_passed * HZ);
 
-   case IOC_LIBCFS_PORTALS_COMPATIBILITY:
-   /* This can be removed once lustre stops calling it */
-   return 0;
-
case IOC_LIBCFS_LNET_DIST:
rc = LNetDist(data->ioc_nid, &data->ioc_nid, &data->ioc_u32[1]);
if (rc < 0 && rc != -EHOSTUNREACH)
diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c 
b/drivers/staging/lustre/lustre/ptlrpc/events.c
index 9901569..07e76a2 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/events.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/events.c
@@ -438,14 +438,11 @@ int ptlrpc_uuid_to_peer(struct obd_uuid *uuid,
__u32 best_order = 0;
int count = 0;
int rc = -ENOENT;
-   int portals_compatibility;
int dist;
__u32 order;
lnet_nid_t dst_nid;
lnet_nid_t src_nid;
 
-   portals_compatibility = LNetCtl(IOC_LIBCFS_PORTALS_COMPATIBILITY, NULL);
-
peer->pid = LUSTRE_SRV_LNET_PID;
 
/* Choose the matching UUID that's closest */
@@ -466,14 +463,6 @@ int ptlrpc_uuid_to_peer(struct obd_uuid *uuid,
best_dist = dist;
best_order = order;
 
-   if (portals_compatibility > 1) {
-   /* Strong portals compatibility: Zero the nid's
-* NET, so if I'm reading new config logs, or
-* getting configured by (new) lconf I can
-* still talk to old servers. */
-   dst_nid = LNET_MKNID(0, LNET_NIDADDR(dst_nid));
-   src_nid = LNET_MKNID(0, LNET_NIDADDR(src_nid));
-   }
peer->nid = dst_nid;
*self = src_nid;
rc = 0;
-- 
2.1.0

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


[PATCH 05/29] staging/lustre/obdecho: remove userspace LSM handling

2016-01-03 Thread green
From: "John L. Hammond" 

In lustre/obdecho/echo_client.c, remove handling of lov_stripe_md
passed from userspace (since userspace never passes it). Remove the
LOV specific code (ed_next_islov) from the echo client (since it
doesn't work).

Remove echo_get_stripe_off_id() and all calls to it since the stripe
count of the passed in lsm is always 0 and the funciton does nothing
in this case. Remove the then unused lsm parameters of
echo_client_page_debug_setup() and echo_client_page_debug_check().

In the OBD_IOC_GETATTR and OBD_IOC_SETATTR cases of
echo_client_iocontrol() do not set the oi_md member of struct obd_info
since only LOV OBD methods access it.

Signed-off-by: John L. Hammond 
Reviewed-on: http://review.whamcloud.com/12446
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5814
Reviewed-by: Bobi Jam 
Reviewed-by: Andreas Dilger 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/obd.h|   1 -
 .../staging/lustre/lustre/obdecho/echo_client.c| 180 -
 2 files changed, 31 insertions(+), 150 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/obd.h 
b/drivers/staging/lustre/lustre/include/obd.h
index 8829dc3..2ad2d5e 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -375,7 +375,6 @@ struct echo_client_obd {
spinlock_t  ec_lock;
struct list_head   ec_objects;
struct list_head   ec_locks;
-   int   ec_nstripes;
__u64   ec_unique;
 };
 
diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c 
b/drivers/staging/lustre/lustre/obdecho/echo_client.c
index 0d2fb86..c8931dc 100644
--- a/drivers/staging/lustre/lustre/obdecho/echo_client.c
+++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c
@@ -60,7 +60,6 @@ struct echo_device {
struct cl_siteed_site_myself;
struct cl_site   *ed_site;
struct lu_device   *ed_next;
-   int  ed_next_islov;
 };
 
 struct echo_object {
@@ -767,14 +766,6 @@ static struct lu_device *echo_device_alloc(const struct 
lu_env *env,
if (rc)
goto out;
 
-   /* Tricky case, I have to determine the obd type since
-* CLIO uses the different parameters to initialize
-* objects for lov & osc. */
-   if (strcmp(tgt_type_name, LUSTRE_LOV_NAME) == 0)
-   ed->ed_next_islov = 1;
-   else
-   LASSERT(strcmp(tgt_type_name,
-  LUSTRE_OSC_NAME) == 0);
} else {
LASSERT(strcmp(tgt_type_name, LUSTRE_OST_NAME) == 0);
}
@@ -960,20 +951,11 @@ static struct echo_object *cl_echo_object_find(struct 
echo_device *d,
info = echo_env_info(env);
conf = &info->eti_conf;
if (d->ed_next) {
-   if (!d->ed_next_islov) {
-   struct lov_oinfo *oinfo = lsm->lsm_oinfo[0];
-
-   LASSERT(oinfo != NULL);
-   oinfo->loi_oi = lsm->lsm_oi;
-   conf->eoc_cl.u.coc_oinfo = oinfo;
-   } else {
-   struct lustre_md *md;
+   struct lov_oinfo *oinfo = lsm->lsm_oinfo[0];
 
-   md = &info->eti_md;
-   memset(md, 0, sizeof(*md));
-   md->lsm = lsm;
-   conf->eoc_cl.u.coc_md = md;
-   }
+   LASSERT(oinfo);
+   oinfo->loi_oi = lsm->lsm_oi;
+   conf->eoc_cl.u.coc_oinfo = oinfo;
}
conf->eoc_md = lsmp;
 
@@ -1219,38 +1201,8 @@ out:
 
 static u64 last_object_id;
 
-static int
-echo_copyin_lsm(struct echo_device *ed, struct lov_stripe_md *lsm,
-   struct lov_stripe_md __user *ulsm, int ulsm_nob)
-{
-   struct echo_client_obd *ec = ed->ed_ec;
-   struct lov_oinfo **p;
-   int  i;
-
-   if (ulsm_nob < sizeof(*lsm))
-   return -EINVAL;
-
-   if (copy_from_user(lsm, ulsm, sizeof(*lsm)))
-   return -EFAULT;
-
-   if (lsm->lsm_stripe_count > ec->ec_nstripes ||
-   lsm->lsm_magic != LOV_MAGIC ||
-   (lsm->lsm_stripe_size & (~CFS_PAGE_MASK)) != 0 ||
-   ((__u64)lsm->lsm_stripe_size * lsm->lsm_stripe_count > ~0UL))
-   return -EINVAL;
-
-   for (i = 0, p = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++, p++) {
-   struct lov_oinfo __user *up;
-   if (get_user(up, ulsm->lsm_oinfo + i) ||
-   copy_from_user(*p, up, sizeof(struct lov_oinfo)))
-   return -EFAULT;
-   }
-   return 0;
-}
-
 static int echo_create_object(const struct lu_env *env, struct echo_device *ed,
- int on_target, struct obdo *oa, void *ulsm,
- int ulsm_nob, struct obd_trans_in

[PATCH 27/29] staging/lustre: Properly cast ll_getname argument to __user in ll_dir_ioctl

2016-01-03 Thread green
From: Oleg Drokin 

This makes sparse happy.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/llite/dir.c 
b/drivers/staging/lustre/lustre/llite/dir.c
index 8cd594c..7e54650 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -1447,7 +1447,7 @@ free_lmv:
 
if (cmd == IOC_MDC_GETFILEINFO ||
cmd == IOC_MDC_GETFILESTRIPE) {
-   filename = ll_getname((const char *)arg);
+   filename = ll_getname((const char __user *)arg);
if (IS_ERR(filename))
return PTR_ERR(filename);
 
-- 
2.1.0

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


[PATCH 08/29] staging/lustre: Update user pointers in struct obd_ioctl_data

2016-01-03 Thread green
From: Oleg Drokin 

Make them void __user * instead of char * (or char __user *),
void * removes the necessity of explicit casts to proper type
where people also need to remember __user qualifiers, so I think
it works better here.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lustre_lib.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_lib.h 
b/drivers/staging/lustre/lustre/include/lustre_lib.h
index 7daf954..3d75a82 100644
--- a/drivers/staging/lustre/lustre/include/lustre_lib.h
+++ b/drivers/staging/lustre/lustre/include/lustre_lib.h
@@ -153,9 +153,9 @@ struct obd_ioctl_data {
 
/* buffers the kernel will treat as user pointers */
__u32  ioc_plen1;
-   char  *ioc_pbuf1;
+   void __user *ioc_pbuf1;
__u32  ioc_plen2;
-   char  *ioc_pbuf2;
+   void __user *ioc_pbuf2;
 
/* inline buffers for various arguments */
__u32  ioc_inllen1;
-- 
2.1.0

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


[PATCH 22/29] staging/lustre: Properly mark lmv_fid2path uarg argment as __user

2016-01-03 Thread green
From: Oleg Drokin 

This makes sparse happy too.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/lmv/lmv_obd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c 
b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index 58b00cb..6889b69 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -662,7 +662,8 @@ out_local:
return rc;
 }
 
-static int lmv_fid2path(struct obd_export *exp, int len, void *karg, void 
*uarg)
+static int lmv_fid2path(struct obd_export *exp, int len, void *karg,
+   void __user *uarg)
 {
struct obd_device   *obddev = class_exp2obd(exp);
struct lmv_obd  *lmv = &obddev->u.lmv;
-- 
2.1.0

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


[PATCH 25/29] staging/lustre: Properly cast ll_fid2path argument to __user in ll_file_ioctl

2016-01-03 Thread green
From: Oleg Drokin 

When calling ll_fid2path, it expects a userspace pointer.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/llite/file.c 
b/drivers/staging/lustre/lustre/llite/file.c
index 6fef267..b9f58bf 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -2296,7 +2296,7 @@ ll_file_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
return 0;
}
case OBD_IOC_FID2PATH:
-   return ll_fid2path(inode, (void *)arg);
+   return ll_fid2path(inode, (void __user *)arg);
case LL_IOC_DATA_VERSION: {
struct ioc_data_version idv;
int rc;
-- 
2.1.0

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


[PATCH 14/29] staging/lustre: Declare lprocfs_write_frac_u64_helper argument as __user

2016-01-03 Thread green
From: Oleg Drokin 

The buffer that lprocfs_write_frac_u64_helper is working on is
presumed to be a userspace one, so it's not suitable for use
on kernel buffers.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lprocfs_status.h  | 2 +-
 drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h 
b/drivers/staging/lustre/lustre/include/lprocfs_status.h
index 0ac8e0e..fb13094 100644
--- a/drivers/staging/lustre/lustre/include/lprocfs_status.h
+++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h
@@ -608,7 +608,7 @@ int lprocfs_write_helper(const char __user *buffer, 
unsigned long count,
 int *val);
 int lprocfs_write_u64_helper(const char __user *buffer,
 unsigned long count, __u64 *val);
-int lprocfs_write_frac_u64_helper(const char *buffer,
+int lprocfs_write_frac_u64_helper(const char __user *buffer,
  unsigned long count,
  __u64 *val, int mult);
 char *lprocfs_find_named_value(const char *buffer, const char *name,
diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c 
b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index 51fe15f..b65ad93 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -1319,8 +1319,8 @@ int lprocfs_write_u64_helper(const char __user *buffer, 
unsigned long count,
 }
 EXPORT_SYMBOL(lprocfs_write_u64_helper);
 
-int lprocfs_write_frac_u64_helper(const char *buffer, unsigned long count,
- __u64 *val, int mult)
+int lprocfs_write_frac_u64_helper(const char __user *buffer,
+ unsigned long count, __u64 *val, int mult)
 {
char kernbuf[22], *end, *pbuf;
__u64 whole, frac = 0, units;
-- 
2.1.0

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


[PATCH 17/29] staging/lustre/llite: Fix improper userspace access in ll_fiemap

2016-01-03 Thread green
From: Oleg Drokin 

Cannot use memcpy, but use copy_to/from_user instead

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/file.c | 21 ++---
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/file.c 
b/drivers/staging/lustre/lustre/llite/file.c
index 08eba8b..56dcfc1 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -3033,19 +3033,26 @@ static int ll_fiemap(struct inode *inode, struct 
fiemap_extent_info *fieinfo,
fiemap->fm_extent_count = fieinfo->fi_extents_max;
fiemap->fm_start = start;
fiemap->fm_length = len;
-   if (extent_count > 0)
-   memcpy(&fiemap->fm_extents[0], fieinfo->fi_extents_start,
-  sizeof(struct ll_fiemap_extent));
+   if (extent_count > 0 &&
+   copy_from_user(&fiemap->fm_extents[0], fieinfo->fi_extents_start,
+  sizeof(struct ll_fiemap_extent)) != 0) {
+   rc = -EFAULT;
+   goto out;
+   }
 
rc = ll_do_fiemap(inode, fiemap, num_bytes);
 
fieinfo->fi_flags = fiemap->fm_flags;
fieinfo->fi_extents_mapped = fiemap->fm_mapped_extents;
-   if (extent_count > 0)
-   memcpy(fieinfo->fi_extents_start, &fiemap->fm_extents[0],
-  fiemap->fm_mapped_extents *
-  sizeof(struct ll_fiemap_extent));
+   if (extent_count > 0 &&
+   copy_to_user(fieinfo->fi_extents_start, &fiemap->fm_extents[0],
+fiemap->fm_mapped_extents *
+sizeof(struct ll_fiemap_extent)) != 0) {
+   rc = -EFAULT;
+   goto out;
+   }
 
+out:
kvfree(fiemap);
return rc;
 }
-- 
2.1.0

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


[PATCH 07/29] staging/lustre: Change ioctl user pointers in libcfs_ioctl_data

2016-01-03 Thread green
From: Oleg Drokin 

Make them void __user * instead of char * (or char __user *),
void * removes the necessity of explicit casts to proper type
where people also need to remember __user qualifiers, so I think
it works better here.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h 
b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
index 0c31bf9..05f2191 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
@@ -61,9 +61,9 @@ struct libcfs_ioctl_data {
char *ioc_inlbuf2;
 
__u32 ioc_plen1; /* buffers in userspace */
-   char *ioc_pbuf1;
+   void __user *ioc_pbuf1;
__u32 ioc_plen2; /* buffers in userspace */
-   char *ioc_pbuf2;
+   void __user *ioc_pbuf2;
 
char ioc_bulk[0];
 };
-- 
2.1.0

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


[PATCH 04/29] staging/lustre/obdecho: Remove unused ioctls

2016-01-03 Thread green
From: Oleg Drokin 

Remove long unused ECHO_IOC_GET_STRIPE, ECHO_IOC_SET_STRIPE,
ECHO_IOC_ENQUEUE and ECHO_IOC_CANCEL ioctls.

Signed-off-by: John L. Hammond 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lustre_lib.h |   8 +-
 .../staging/lustre/lustre/obdecho/echo_client.c| 163 -
 2 files changed, 4 insertions(+), 167 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_lib.h 
b/drivers/staging/lustre/lustre/include/lustre_lib.h
index 428469f..7daf954 100644
--- a/drivers/staging/lustre/lustre/include/lustre_lib.h
+++ b/drivers/staging/lustre/lustre/include/lustre_lib.h
@@ -365,10 +365,10 @@ static inline void obd_ioctl_freedata(char *buf, int len)
 /* OBD_IOC_LLOG_CATINFO is deprecated */
 #define OBD_IOC_LLOG_CATINFO  _IOWR('f', 196, OBD_IOC_DATA_TYPE)
 
-#define ECHO_IOC_GET_STRIPE_IOWR('f', 200, OBD_IOC_DATA_TYPE)
-#define ECHO_IOC_SET_STRIPE_IOWR('f', 201, OBD_IOC_DATA_TYPE)
-#define ECHO_IOC_ENQUEUE  _IOWR('f', 202, OBD_IOC_DATA_TYPE)
-#define ECHO_IOC_CANCEL_IOWR('f', 203, OBD_IOC_DATA_TYPE)
+/* #define ECHO_IOC_GET_STRIPE_IOWR('f', 200, OBD_IOC_DATA_TYPE) */
+/* #define ECHO_IOC_SET_STRIPE_IOWR('f', 201, OBD_IOC_DATA_TYPE) */
+/* #define ECHO_IOC_ENQUEUE   _IOWR('f', 202, OBD_IOC_DATA_TYPE) */
+/* #define ECHO_IOC_CANCEL_IOWR('f', 203, OBD_IOC_DATA_TYPE) */
 
 #define OBD_IOC_GET_OBJ_VERSION_IOR('f', 210, OBD_IOC_DATA_TYPE)
 
diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c 
b/drivers/staging/lustre/lustre/obdecho/echo_client.c
index 7b53f7d..0d2fb86 100644
--- a/drivers/staging/lustre/lustre/obdecho/echo_client.c
+++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c
@@ -162,9 +162,6 @@ struct echo_object_conf *cl2echo_conf(const struct 
cl_object_conf *c)
 static struct echo_object *cl_echo_object_find(struct echo_device *d,
   struct lov_stripe_md **lsm);
 static int cl_echo_object_put(struct echo_object *eco);
-static int cl_echo_enqueue(struct echo_object *eco, u64 start,
-  u64 end, int mode, __u64 *cookie);
-static int cl_echo_cancel(struct echo_device *d, __u64 cookie);
 static int cl_echo_object_brw(struct echo_object *eco, int rw, u64 offset,
  struct page **pages, int npages, int async);
 
@@ -1076,36 +1073,6 @@ static int cl_echo_enqueue0(struct lu_env *env, struct 
echo_object *eco,
return rc;
 }
 
-static int cl_echo_enqueue(struct echo_object *eco, u64 start, u64 end,
-  int mode, __u64 *cookie)
-{
-   struct echo_thread_info *info;
-   struct lu_env *env;
-   struct cl_io *io;
-   int refcheck;
-   int result;
-
-   env = cl_env_get(&refcheck);
-   if (IS_ERR(env))
-   return PTR_ERR(env);
-
-   info = echo_env_info(env);
-   io = &info->eti_io;
-
-   io->ci_ignore_layout = 1;
-   result = cl_io_init(env, io, CIT_MISC, echo_obj2cl(eco));
-   if (result < 0)
-   goto out;
-   LASSERT(result == 0);
-
-   result = cl_echo_enqueue0(env, eco, start, end, mode, cookie, 0);
-   cl_io_fini(env, io);
-
-out:
-   cl_env_put(env, &refcheck);
-   return result;
-}
-
 static int cl_echo_cancel0(struct lu_env *env, struct echo_device *ed,
   __u64 cookie)
 {
@@ -1137,22 +1104,6 @@ static int cl_echo_cancel0(struct lu_env *env, struct 
echo_device *ed,
return 0;
 }
 
-static int cl_echo_cancel(struct echo_device *ed, __u64 cookie)
-{
-   struct lu_env *env;
-   int refcheck;
-   int rc;
-
-   env = cl_env_get(&refcheck);
-   if (IS_ERR(env))
-   return PTR_ERR(env);
-
-   rc = cl_echo_cancel0(env, ed, cookie);
-
-   cl_env_put(env, &refcheck);
-   return rc;
-}
-
 static int cl_echo_async_brw(const struct lu_env *env, struct cl_io *io,
 enum cl_req_type unused, struct cl_2queue *queue)
 {
@@ -1269,29 +1220,6 @@ out:
 static u64 last_object_id;
 
 static int
-echo_copyout_lsm(struct lov_stripe_md *lsm, void *_ulsm, int ulsm_nob)
-{
-   struct lov_stripe_md *ulsm = _ulsm;
-   struct lov_oinfo **p;
-   int nob, i;
-
-   nob = offsetof(struct lov_stripe_md, lsm_oinfo[lsm->lsm_stripe_count]);
-   if (nob > ulsm_nob)
-   return -EINVAL;
-
-   if (copy_to_user(ulsm, lsm, sizeof(*ulsm)))
-   return -EFAULT;
-
-   for (i = 0, p = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++, p++) {
-   struct lov_oinfo __user *up;
-   if (get_user(up, ulsm->lsm_oinfo + i) ||
-   copy_to_user(up, *p, sizeof(struct lov_oinfo)))
-   return -EFAULT;
-   }
-   return 0;
-}
-
-static int
 echo_copyin_lsm(struct echo_device *ed, struct lov_stripe_md *lsm,
struct lov_stripe_md __user *ulsm, int ulsm_

[PATCH 24/29] staging/lustre/llite: Update all file.c user pointer casts to __user

2016-01-03 Thread green
From: Oleg Drokin 

unsigned long user address must be casted with __user attribute
to make sparse happy when used with userspace access functions.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/file.c | 47 +++---
 1 file changed, 24 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/file.c 
b/drivers/staging/lustre/lustre/llite/file.c
index 56dcfc1..6fef267 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -1307,7 +1307,7 @@ static int ll_lov_recreate_obj(struct inode *inode, 
unsigned long arg)
if (!capable(CFS_CAP_SYS_ADMIN))
return -EPERM;
 
-   if (copy_from_user(&ucreat, (struct ll_recreate_obj *)arg,
+   if (copy_from_user(&ucreat, (struct ll_recreate_obj __user *)arg,
   sizeof(ucreat)))
return -EFAULT;
 
@@ -1325,7 +1325,7 @@ static int ll_lov_recreate_fid(struct inode *inode, 
unsigned long arg)
if (!capable(CFS_CAP_SYS_ADMIN))
return -EPERM;
 
-   if (copy_from_user(&fid, (struct lu_fid *)arg, sizeof(fid)))
+   if (copy_from_user(&fid, (struct lu_fid __user *)arg, sizeof(fid)))
return -EFAULT;
 
fid_to_ostid(&fid, &oi);
@@ -1472,7 +1472,7 @@ static int ll_lov_setea(struct inode *inode, struct file 
*file,
if (lump == NULL)
return -ENOMEM;
 
-   if (copy_from_user(lump, (struct lov_user_md *)arg, lum_size)) {
+   if (copy_from_user(lump, (struct lov_user_md __user *)arg, lum_size)) {
kvfree(lump);
return -EFAULT;
}
@@ -1488,12 +1488,12 @@ static int ll_lov_setea(struct inode *inode, struct 
file *file,
 static int ll_lov_setstripe(struct inode *inode, struct file *file,
unsigned long arg)
 {
-   struct lov_user_md_v3lumv3;
-   struct lov_user_md_v1   *lumv1 = (struct lov_user_md_v1 *)&lumv3;
-   struct lov_user_md_v1   *lumv1p = (struct lov_user_md_v1 *)arg;
-   struct lov_user_md_v3   *lumv3p = (struct lov_user_md_v3 *)arg;
-   int  lum_size, rc;
-   int  flags = FMODE_WRITE;
+   struct lov_user_md_v3 lumv3;
+   struct lov_user_md_v1 *lumv1 = (struct lov_user_md_v1 *)&lumv3;
+   struct lov_user_md_v1 __user *lumv1p = (void __user *)arg;
+   struct lov_user_md_v3 __user *lumv3p = (void __user *)arg;
+   int lum_size, rc;
+   int flags = FMODE_WRITE;
 
/* first try with v1 which is smaller than v3 */
lum_size = sizeof(struct lov_user_md_v1);
@@ -1826,7 +1826,7 @@ static int ll_ioctl_fiemap(struct inode *inode, unsigned 
long arg)
ret_bytes += (fiemap_s->fm_mapped_extents *
 sizeof(struct ll_fiemap_extent));
 
-   if (copy_to_user((void *)arg, fiemap_s, ret_bytes))
+   if (copy_to_user((void __user *)arg, fiemap_s, ret_bytes))
rc = -EFAULT;
 
 error:
@@ -2211,14 +2211,14 @@ ll_file_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
switch (cmd) {
case LL_IOC_GETFLAGS:
/* Get the current value of the file flags */
-   return put_user(fd->fd_flags, (int *)arg);
+   return put_user(fd->fd_flags, (int __user *)arg);
case LL_IOC_SETFLAGS:
case LL_IOC_CLRFLAGS:
/* Set or clear specific file flags */
/* XXX This probably needs checks to ensure the flags are
 * not abused, and to handle any flag side effects.
 */
-   if (get_user(flags, (int *) arg))
+   if (get_user(flags, (int __user *)arg))
return -EFAULT;
 
if (cmd == LL_IOC_SETFLAGS) {
@@ -2242,8 +2242,8 @@ ll_file_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
struct file *file2;
struct lustre_swap_layouts lsl;
 
-   if (copy_from_user(&lsl, (char *)arg,
-  sizeof(struct lustre_swap_layouts)))
+   if (copy_from_user(&lsl, (char __user *)arg,
+  sizeof(struct lustre_swap_layouts)))
return -EFAULT;
 
if ((file->f_flags & O_ACCMODE) == 0) /* O_RDONLY */
@@ -2272,7 +2272,7 @@ ll_file_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
return ll_iocontrol(inode, file, cmd, arg);
case FSFILT_IOC_GETVERSION_OLD:
case FSFILT_IOC_GETVERSION:
-   return put_user(inode->i_generation, (int *)arg);
+   return put_user(inode->i_generation, (int __user *)arg);
case LL_IOC_GROUP_LOCK:
return ll_get_grouplock(inode, file, arg);
case LL_IOC_GROUP_UNLOCK:
@@ -2289,7 +2289,7 @@ ll_file_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)

[PATCH 12/29] staging/lustre: Properly mark obd_iocontrol argument as __user

2016-01-03 Thread green
From: Oleg Drokin 

Also update all methods and calls everywhere.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/obd.h | 2 +-
 drivers/staging/lustre/lustre/include/obd_class.h   | 2 +-
 drivers/staging/lustre/lustre/llite/dir.c   | 6 --
 drivers/staging/lustre/lustre/llite/file.c  | 6 +++---
 drivers/staging/lustre/lustre/lmv/lmv_obd.c | 2 +-
 drivers/staging/lustre/lustre/lov/lov_obd.c | 2 +-
 drivers/staging/lustre/lustre/mdc/mdc_request.c | 2 +-
 drivers/staging/lustre/lustre/obdecho/echo_client.c | 2 +-
 drivers/staging/lustre/lustre/osc/osc_request.c | 2 +-
 9 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/obd.h 
b/drivers/staging/lustre/lustre/include/obd.h
index 2ad2d5e..973c35c 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -964,7 +964,7 @@ struct md_enqueue_info {
 struct obd_ops {
struct module *owner;
int (*iocontrol)(unsigned int cmd, struct obd_export *exp, int len,
-void *karg, void *uarg);
+void *karg, void __user *uarg);
int (*get_info)(const struct lu_env *env, struct obd_export *,
__u32 keylen, void *key, __u32 *vallen, void *val,
struct lov_stripe_md *lsm);
diff --git a/drivers/staging/lustre/lustre/include/obd_class.h 
b/drivers/staging/lustre/lustre/include/obd_class.h
index 97d8039..4f631e6 100644
--- a/drivers/staging/lustre/lustre/include/obd_class.h
+++ b/drivers/staging/lustre/lustre/include/obd_class.h
@@ -1155,7 +1155,7 @@ static inline int obd_adjust_kms(struct obd_export *exp,
 }
 
 static inline int obd_iocontrol(unsigned int cmd, struct obd_export *exp,
-   int len, void *karg, void *uarg)
+   int len, void *karg, void __user *uarg)
 {
int rc;
 
diff --git a/drivers/staging/lustre/lustre/llite/dir.c 
b/drivers/staging/lustre/lustre/llite/dir.c
index 5b7780a..1034784 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -1723,7 +1723,8 @@ out_quotactl:
return -EFAULT;
return 0;
case LL_IOC_GET_CONNECT_FLAGS: {
-   return obd_iocontrol(cmd, sbi->ll_md_exp, 0, NULL, (void *)arg);
+   return obd_iocontrol(cmd, sbi->ll_md_exp, 0, NULL,
+(void __user *)arg);
}
case OBD_IOC_CHANGELOG_SEND:
case OBD_IOC_CHANGELOG_CLEAR:
@@ -1846,7 +1847,8 @@ out_quotactl:
return rc;
}
default:
-   return obd_iocontrol(cmd, sbi->ll_dt_exp, 0, NULL, (void *)arg);
+   return obd_iocontrol(cmd, sbi->ll_dt_exp, 0, NULL,
+(void __user *)arg);
}
 }
 
diff --git a/drivers/staging/lustre/lustre/llite/file.c 
b/drivers/staging/lustre/lustre/llite/file.c
index c92d58b..8b118bc 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -1518,7 +1518,7 @@ static int ll_lov_setstripe(struct inode *inode, struct 
file *file,
ll_layout_refresh(inode, &gen);
lsm = ccc_inode_lsm_get(inode);
rc = obd_iocontrol(LL_IOC_LOV_GETSTRIPE, ll_i2dtexp(inode),
-  0, lsm, (void *)arg);
+  0, lsm, (void __user *)arg);
ccc_inode_lsm_put(inode, lsm);
}
return rc;
@@ -1532,7 +1532,7 @@ static int ll_lov_getstripe(struct inode *inode, unsigned 
long arg)
lsm = ccc_inode_lsm_get(inode);
if (lsm != NULL)
rc = obd_iocontrol(LL_IOC_LOV_GETSTRIPE, ll_i2dtexp(inode), 0,
-  lsm, (void *)arg);
+  lsm, (void __user *)arg);
ccc_inode_lsm_put(inode, lsm);
return rc;
 }
@@ -2497,7 +2497,7 @@ ll_file_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
return err;
 
return obd_iocontrol(cmd, ll_i2dtexp(inode), 0, NULL,
-(void *)arg);
+(void __user *)arg);
}
}
 }
diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c 
b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index bbafe0a..58b00cb 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -864,7 +864,7 @@ static int lmv_hsm_ct_register(struct lmv_obd *lmv, 
unsigned int cmd, int len,
 }
 
 static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp,
-int len, void *karg, void *uarg)
+int len, void *karg, void __user *uarg)
 {
struct obd_device*obddev = class_exp2obd(exp);
struct lmv_

[PATCH 15/29] staging/lustre/osc: Do not use lprocfs_write_helper in sysfs store methods

2016-01-03 Thread green
From: Oleg Drokin 

sysfs store methods provide us with a kernel buffer already, but
lprocfs_write_helper is expecting a user buffer.
Replace lprocfs_write_helper with kstrto[u]int() calls instead in
contention_seconds_store() and lockless_truncate_store()

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/osc/lproc_osc.c | 25 +
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c 
b/drivers/staging/lustre/lustre/osc/lproc_osc.c
index 1091536..b69ec0f 100644
--- a/drivers/staging/lustre/lustre/osc/lproc_osc.c
+++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c
@@ -480,9 +480,19 @@ static ssize_t contention_seconds_store(struct kobject 
*kobj,
struct obd_device *obd = container_of(kobj, struct obd_device,
  obd_kobj);
struct osc_device *od  = obd2osc_dev(obd);
+   int rc;
+   int val;
+
+   rc = kstrtoint(buffer, 10, &val);
+   if (rc)
+   return rc;
+
+   if (val < 0)
+   return -EINVAL;
+
+   od->od_contention_time = val;
 
-   return lprocfs_write_helper(buffer, count, &od->od_contention_time) ?:
-   count;
+   return count;
 }
 LUSTRE_RW_ATTR(contention_seconds);
 
@@ -505,9 +515,16 @@ static ssize_t lockless_truncate_store(struct kobject 
*kobj,
struct obd_device *obd = container_of(kobj, struct obd_device,
  obd_kobj);
struct osc_device *od  = obd2osc_dev(obd);
+   int rc;
+   unsigned int val;
 
-   return lprocfs_write_helper(buffer, count, &od->od_lockless_truncate) ?:
-   count;
+   rc = kstrtouint(buffer, 10, &val);
+   if (rc)
+   return rc;
+
+   od->od_lockless_truncate = val;
+
+   return count;
 }
 LUSTRE_RW_ATTR(lockless_truncate);
 
-- 
2.1.0

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


[PATCH 26/29] staging/lustre: Properly cast ll_fid2path argument to __user in ll_dir_ioctl

2016-01-03 Thread green
From: Oleg Drokin 

This makes sparse happier.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/llite/dir.c 
b/drivers/staging/lustre/lustre/llite/dir.c
index 22c59e5..8cd594c 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -1735,7 +1735,7 @@ out_quotactl:
sizeof(struct ioc_changelog));
return rc;
case OBD_IOC_FID2PATH:
-   return ll_fid2path(inode, (void *)arg);
+   return ll_fid2path(inode, (void __user *)arg);
case LL_IOC_HSM_REQUEST: {
struct hsm_user_request *hur;
ssize_t  totalsize;
-- 
2.1.0

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


[PATCH 09/29] staging/lustre: Mark obd_ioctl_popdata/getdata argument as __user

2016-01-03 Thread green
From: Oleg Drokin 

arg is a userspace pointer and marking it as such makes sparse happy.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lustre_lib.h |  4 ++--
 drivers/staging/lustre/lustre/llite/dir.c  |  4 ++--
 drivers/staging/lustre/lustre/obdclass/class_obd.c | 14 --
 .../staging/lustre/lustre/obdclass/linux/linux-module.c|  8 
 4 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_lib.h 
b/drivers/staging/lustre/lustre/include/lustre_lib.h
index 3d75a82..cfccf7c 100644
--- a/drivers/staging/lustre/lustre/include/lustre_lib.h
+++ b/drivers/staging/lustre/lustre/include/lustre_lib.h
@@ -252,8 +252,8 @@ static inline int obd_ioctl_is_invalid(struct 
obd_ioctl_data *data)
 #include "obd_support.h"
 
 /* function defined in lustre/obdclass//-module.c */
-int obd_ioctl_getdata(char **buf, int *len, void *arg);
-int obd_ioctl_popdata(void *arg, void *data, int len);
+int obd_ioctl_getdata(char **buf, int *len, void __user *arg);
+int obd_ioctl_popdata(void __user *arg, void *data, int len);
 
 static inline void obd_ioctl_freedata(char *buf, int len)
 {
diff --git a/drivers/staging/lustre/lustre/llite/dir.c 
b/drivers/staging/lustre/lustre/llite/dir.c
index 7b35531..5b7780a 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -1278,7 +1278,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int 
cmd, unsigned long arg)
char *filename;
struct md_op_data *op_data;
 
-   rc = obd_ioctl_getdata(&buf, &len, (void *)arg);
+   rc = obd_ioctl_getdata(&buf, &len, (void __user *)arg);
if (rc)
return rc;
data = (void *)buf;
@@ -1320,7 +1320,7 @@ out_free:
int  len;
int  rc;
 
-   rc = obd_ioctl_getdata(&buf, &len, (void *)arg);
+   rc = obd_ioctl_getdata(&buf, &len, (void __user *)arg);
if (rc)
return rc;
 
diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c 
b/drivers/staging/lustre/lustre/obdclass/class_obd.c
index 0975e44..65cf46c 100644
--- a/drivers/staging/lustre/lustre/obdclass/class_obd.c
+++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c
@@ -180,7 +180,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
}
 
CDEBUG(D_IOCTL, "cmd = %x\n", cmd);
-   if (obd_ioctl_getdata(&buf, &len, (void *)arg)) {
+   if (obd_ioctl_getdata(&buf, &len, (void __user *)arg)) {
CERROR("OBD ioctl: data error\n");
return -EINVAL;
}
@@ -227,7 +227,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
memcpy(data->ioc_bulk, BUILD_VERSION,
   strlen(BUILD_VERSION) + 1);
 
-   err = obd_ioctl_popdata((void *)arg, data, len);
+   err = obd_ioctl_popdata((void __user *)arg, data, len);
if (err)
err = -EFAULT;
goto out;
@@ -246,7 +246,8 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
goto out;
}
 
-   err = obd_ioctl_popdata((void *)arg, data, sizeof(*data));
+   err = obd_ioctl_popdata((void __user *)arg, data,
+   sizeof(*data));
if (err)
err = -EFAULT;
goto out;
@@ -283,7 +284,8 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
 
CDEBUG(D_IOCTL, "device name %s, dev %d\n", data->ioc_inlbuf1,
   dev);
-   err = obd_ioctl_popdata((void *)arg, data, sizeof(*data));
+   err = obd_ioctl_popdata((void __user *)arg, data,
+   sizeof(*data));
if (err)
err = -EFAULT;
goto out;
@@ -330,7 +332,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
 (int)index, status, obd->obd_type->typ_name,
 obd->obd_name, obd->obd_uuid.uuid,
 atomic_read(&obd->obd_refcount));
-   err = obd_ioctl_popdata((void *)arg, data, len);
+   err = obd_ioctl_popdata((void __user *)arg, data, len);
 
err = 0;
goto out;
@@ -388,7 +390,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
if (err)
goto out;
 
-   err = obd_ioctl_popdata((void *)arg, data, len);
+   err = obd_ioctl_popdata((void __user *)arg, data, len);
if (err)
err = -EFAULT;
goto out;
diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c 
b/drivers/staging/

[PATCH 23/29] staging/lustre: Mark lmv_hsm_ct_register/unregister uarg as __user

2016-01-03 Thread green
From: Oleg Drokin 

Since it is a userspace pointer, this makes things neater and
sparse happier.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/lmv/lmv_obd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c 
b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index 6889b69..d6dede5 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -793,7 +793,8 @@ static void lmv_hsm_req_build(struct lmv_obd *lmv,
 }
 
 static int lmv_hsm_ct_unregister(struct lmv_obd *lmv, unsigned int cmd, int 
len,
-struct lustre_kernelcomm *lk, void *uarg)
+struct lustre_kernelcomm *lk,
+void __user *uarg)
 {
int i, rc = 0;
 
@@ -813,7 +814,7 @@ static int lmv_hsm_ct_unregister(struct lmv_obd *lmv, 
unsigned int cmd, int len,
 }
 
 static int lmv_hsm_ct_register(struct lmv_obd *lmv, unsigned int cmd, int len,
-  struct lustre_kernelcomm *lk, void *uarg)
+  struct lustre_kernelcomm *lk, void __user *uarg)
 {
struct file *filp;
int  i, j, err;
-- 
2.1.0

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


[PATCH 10/29] staging/lustre/lnet: Properly mark userspace pointer of lnet_ping()

2016-01-03 Thread green
From: Oleg Drokin 

This also happens to silence sparce warnings about different
address spaces.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lnet/lnet/api-ni.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c 
b/drivers/staging/lustre/lnet/lnet/api-ni.c
index 80b170e..d33fbdf 100644
--- a/drivers/staging/lustre/lnet/lnet/api-ni.c
+++ b/drivers/staging/lustre/lnet/lnet/api-ni.c
@@ -62,7 +62,7 @@ module_param(rnet_htable_size, int, 0444);
 MODULE_PARM_DESC(rnet_htable_size, "size of remote network hash table");
 
 static int lnet_ping(lnet_process_id_t id, int timeout_ms,
-lnet_process_id_t *ids, int n_ids);
+lnet_process_id_t __user *ids, int n_ids);
 
 static char *
 lnet_get_routes(void)
@@ -1376,7 +1376,7 @@ LNetCtl(unsigned int cmd, void *arg)
id.nid = data->ioc_nid;
id.pid = data->ioc_u32[0];
rc = lnet_ping(id, data->ioc_u32[1], /* timeout */
-  (lnet_process_id_t *)data->ioc_pbuf1,
+  data->ioc_pbuf1,
   data->ioc_plen1/sizeof(lnet_process_id_t));
if (rc < 0)
return rc;
@@ -1646,7 +1646,7 @@ lnet_ping_target_fini(void)
 }
 
 static int lnet_ping(lnet_process_id_t id, int timeout_ms,
-lnet_process_id_t *ids, int n_ids)
+lnet_process_id_t __user *ids, int n_ids)
 {
lnet_handle_eq_t eqh;
lnet_handle_md_t mdh;
-- 
2.1.0

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


[PATCH 29/29] staging/lustre: Add __user annotations in lnetselftest code

2016-01-03 Thread green
From: Frank Zago 

This fixes a bunch of sparse warnings.

There is no code change.

Signed-off-by: frank zago 
Reviewed-on: http://review.whamcloud.com/11819
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5396
Reviewed-by: James Simmons 
Reviewed-by: Dmitry Eremin 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/include/linux/lnet/lnetst.h | 104 ++---
 drivers/staging/lustre/lnet/selftest/conrpc.c  |   4 +-
 drivers/staging/lustre/lnet/selftest/conrpc.h  |   5 +-
 drivers/staging/lustre/lnet/selftest/console.c |  96 ++-
 drivers/staging/lustre/lnet/selftest/console.h |  56 +--
 5 files changed, 138 insertions(+), 127 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/lnet/lnetst.h 
b/drivers/staging/lustre/include/linux/lnet/lnetst.h
index fd1e0fd..4170445 100644
--- a/drivers/staging/lustre/include/linux/lnet/lnetst.h
+++ b/drivers/staging/lustre/include/linux/lnet/lnetst.h
@@ -245,20 +245,20 @@ typedef struct {
int  lstio_ses_force;   /* IN: force create ? */
/** IN: session features */
unsigned lstio_ses_feats;
-   lst_sid_t   *lstio_ses_idp; /* OUT: session id */
+   lst_sid_t __user *lstio_ses_idp;/* OUT: session id */
int  lstio_ses_nmlen;   /* IN: name length */
-   char*lstio_ses_namep;   /* IN: session name */
+   char __user  *lstio_ses_namep;  /* IN: session name */
 } lstio_session_new_args_t;
 
 /* query current session */
 typedef struct {
-   lst_sid_t   *lstio_ses_idp; /* OUT: session id */
-   int *lstio_ses_keyp;/* OUT: local key */
+   lst_sid_t __user*lstio_ses_idp; /* OUT: session id */
+   int __user  *lstio_ses_keyp;/* OUT: local key */
/** OUT: session features */
-   unsigned*lstio_ses_featp;
-   lstcon_ndlist_ent_t *lstio_ses_ndinfo;  /* OUT: */
+   unsigned __user *lstio_ses_featp;
+   lstcon_ndlist_ent_t __user *lstio_ses_ndinfo;   /* OUT: */
int  lstio_ses_nmlen;   /* IN: name length */
-   char*lstio_ses_namep;   /* OUT: session name */
+   char __user *lstio_ses_namep;   /* OUT: session name */
 } lstio_session_info_args_t;
 
 /* delete a session */
@@ -283,26 +283,26 @@ typedef struct {
int  lstio_dbg_timeout; /* IN: timeout of
   debug */
int  lstio_dbg_nmlen;   /* IN: len of name */
-   char*lstio_dbg_namep;   /* IN: name of
+   char __user *lstio_dbg_namep;   /* IN: name of
   group|batch */
int  lstio_dbg_count;   /* IN: # of test nodes
   to debug */
-   lnet_process_id_t   *lstio_dbg_idsp;/* IN: id of test
+   lnet_process_id_t __user *lstio_dbg_idsp;   /* IN: id of test
   nodes */
-   struct list_head*lstio_dbg_resultp; /* OUT: list head of
+   struct list_head __user *lstio_dbg_resultp; /* OUT: list head of
result buffer */
 } lstio_debug_args_t;
 
 typedef struct {
-   int  lstio_grp_key; /* IN: session key */
-   int  lstio_grp_nmlen;   /* IN: name length */
-   char*lstio_grp_namep;   /* IN: group name */
+   int  lstio_grp_key; /* IN: session key */
+   int  lstio_grp_nmlen;   /* IN: name length */
+   char __user *lstio_grp_namep;   /* IN: group name */
 } lstio_group_add_args_t;
 
 typedef struct {
-   int  lstio_grp_key; /* IN: session key */
-   int  lstio_grp_nmlen;   /* IN: name length */
-   char*lstio_grp_namep;   /* IN: group name */
+   int  lstio_grp_key; /* IN: session key */
+   int  lstio_grp_nmlen;   /* IN: name length */
+   char __user *lstio_grp_namep;   /* IN: group name */
 } lstio_group_del_args_t;
 
 #define LST_GROUP_CLEAN1   /* remove inactive nodes in the 
group */
@@ -315,22 +315,22 @@ typedef struct {
int  lstio_grp_opc; /* IN: OPC */
int  lstio_grp_args;/* IN: arguments */
int  lstio_grp_nmlen;   /* IN: name length */
-   char*lstio_grp_namep;   /* IN: group name */
+   char __user *lstio_grp_namep;   /* IN: group name */
int

[PATCH 18/29] staging/lustre: Declare lov_getstripe lump argument as __user

2016-01-03 Thread green
From: Oleg Drokin 

This is a user pointer, so that makes sparse a lot happier.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/lov/lov_internal.h | 2 +-
 drivers/staging/lustre/lustre/lov/lov_pack.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h 
b/drivers/staging/lustre/lustre/lov/lov_internal.h
index 2d00bad..f8e92fe 100644
--- a/drivers/staging/lustre/lustre/lov/lov_internal.h
+++ b/drivers/staging/lustre/lustre/lov/lov_internal.h
@@ -197,7 +197,7 @@ int lov_packmd(struct obd_export *exp, struct lov_mds_md 
**lmm,
 int lov_unpackmd(struct obd_export *exp, struct lov_stripe_md **lsmp,
 struct lov_mds_md *lmm, int lmm_bytes);
 int lov_getstripe(struct obd_export *exp,
- struct lov_stripe_md *lsm, struct lov_user_md *lump);
+ struct lov_stripe_md *lsm, struct lov_user_md __user *lump);
 int lov_alloc_memmd(struct lov_stripe_md **lsmp, __u16 stripe_count,
int pattern, int magic);
 int lov_free_memmd(struct lov_stripe_md **lsmp);
diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c 
b/drivers/staging/lustre/lustre/lov/lov_pack.c
index 6b2d100..a78211f 100644
--- a/drivers/staging/lustre/lustre/lov/lov_pack.c
+++ b/drivers/staging/lustre/lustre/lov/lov_pack.c
@@ -376,7 +376,7 @@ int lov_unpackmd(struct obd_export *exp,  struct 
lov_stripe_md **lsmp,
  * lmm_magic must be LOV_USER_MAGIC.
  */
 int lov_getstripe(struct obd_export *exp, struct lov_stripe_md *lsm,
- struct lov_user_md *lump)
+ struct lov_user_md __user *lump)
 {
/*
 * XXX huge struct allocated on stack.
-- 
2.1.0

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


[PATCH 19/29] staging/lustre/llite: Update llite_lib.c with proper __user attributes

2016-01-03 Thread green
From: Oleg Drokin 

Casts for get/put_user and copy_to/from_user should have __user
attribute for the userspace buffer address.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/llite_lib.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index fa9fd5e..0cffc9b 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -1744,14 +1744,14 @@ int ll_iocontrol(struct inode *inode, struct file *file,
 
ptlrpc_req_finished(req);
 
-   return put_user(flags, (int *)arg);
+   return put_user(flags, (int __user *)arg);
}
case FSFILT_IOC_SETFLAGS: {
struct lov_stripe_md *lsm;
struct obd_info oinfo = { };
struct md_op_data *op_data;
 
-   if (get_user(flags, (int *)arg))
+   if (get_user(flags, (int __user *)arg))
return -EFAULT;
 
op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, 0,
@@ -2219,8 +2219,8 @@ int ll_get_obd_name(struct inode *inode, unsigned int 
cmd, unsigned long arg)
if (!obd)
return -ENOENT;
 
-   if (copy_to_user((void *)arg, obd->obd_name,
-strlen(obd->obd_name) + 1))
+   if (copy_to_user((void __user *)arg, obd->obd_name,
+strlen(obd->obd_name) + 1))
return -EFAULT;
 
return 0;
-- 
2.1.0

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


[PATCH 13/29] staging/lustre: Properly mark argument to p_ioctl in cfs_psdev_ops as __user

2016-01-03 Thread green
From: Oleg Drokin 

This also silents a sparse address space warning

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/include/linux/libcfs/libcfs.h  | 2 +-
 drivers/staging/lustre/lustre/libcfs/linux/linux-module.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h 
b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
index 0d8a91e..d2b20ec 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
@@ -77,7 +77,7 @@ struct cfs_psdev_ops {
int (*p_close)(unsigned long, void *);
int (*p_read)(struct cfs_psdev_file *, char *, unsigned long);
int (*p_write)(struct cfs_psdev_file *, char *, unsigned long);
-   int (*p_ioctl)(struct cfs_psdev_file *, unsigned long, void *);
+   int (*p_ioctl)(struct cfs_psdev_file *, unsigned long, void __user *);
 };
 
 /*
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c 
b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
index 552a606..7593554 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
@@ -161,7 +161,7 @@ static long libcfs_ioctl(struct file *file,
pfile.off = 0;
pfile.private_data = file->private_data;
if (libcfs_psdev_ops.p_ioctl != NULL)
-   rc = libcfs_psdev_ops.p_ioctl(&pfile, cmd, (void *)arg);
+   rc = libcfs_psdev_ops.p_ioctl(&pfile, cmd, (void __user *)arg);
else
rc = -EPERM;
return rc;
-- 
2.1.0

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


[PATCH 28/29] staging/lustre/llite: Update ll_dir_ioctl pointer casts with __user

2016-01-03 Thread green
From: Oleg Drokin 

When casting unsingned long userspace pointer from ioctl argument to
a pointer suitable for use with userspace access functions, need
to remember to add __user attribute, to make sparse happy.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/dir.c | 69 ---
 1 file changed, 35 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/dir.c 
b/drivers/staging/lustre/lustre/llite/dir.c
index 7e54650..f4b412b 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -1252,7 +1252,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int 
cmd, unsigned long arg)
return ll_iocontrol(inode, file, cmd, arg);
case FSFILT_IOC_GETVERSION_OLD:
case FSFILT_IOC_GETVERSION:
-   return put_user(inode->i_generation, (int *)arg);
+   return put_user(inode->i_generation, (int __user *)arg);
/* We need to special case any other ioctls we want to handle,
 * to send them to the MDS/OST as appropriate and to properly
 * network encode the arg field.
@@ -1266,7 +1266,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int 
cmd, unsigned long arg)
if (mdtidx < 0)
return mdtidx;
 
-   if (put_user((int)mdtidx, (int *)arg))
+   if (put_user((int)mdtidx, (int __user *)arg))
return -EFAULT;
 
return 0;
@@ -1363,8 +1363,8 @@ lmv_out_free:
case LL_IOC_LOV_SETSTRIPE: {
struct lov_user_md_v3 lumv3;
struct lov_user_md_v1 *lumv1 = (struct lov_user_md_v1 *)&lumv3;
-   struct lov_user_md_v1 *lumv1p = (struct lov_user_md_v1 *)arg;
-   struct lov_user_md_v3 *lumv3p = (struct lov_user_md_v3 *)arg;
+   struct lov_user_md_v1 __user *lumv1p = (void __user *)arg;
+   struct lov_user_md_v3 __user *lumv3p = (void __user *)arg;
 
int set_default = 0;
 
@@ -1389,7 +1389,7 @@ lmv_out_free:
return rc;
}
case LL_IOC_LMV_GETSTRIPE: {
-   struct lmv_user_md *lump = (struct lmv_user_md *)arg;
+   struct lmv_user_md __user *lump = (void __user *)arg;
struct lmv_user_md lum;
struct lmv_user_md *tmp;
int lum_size;
@@ -1422,7 +1422,7 @@ lmv_out_free:
tmp->lum_objects[0].lum_mds = mdtindex;
memcpy(&tmp->lum_objects[0].lum_fid, ll_inode2fid(inode),
   sizeof(struct lu_fid));
-   if (copy_to_user((void *)arg, tmp, lum_size)) {
+   if (copy_to_user((void __user *)arg, tmp, lum_size)) {
rc = -EFAULT;
goto free_lmv;
}
@@ -1439,7 +1439,7 @@ free_lmv:
case IOC_MDC_GETFILEINFO:
case IOC_MDC_GETFILESTRIPE: {
struct ptlrpc_request *request = NULL;
-   struct lov_user_md *lump;
+   struct lov_user_md __user *lump;
struct lov_mds_md *lmm = NULL;
struct mdt_body *body;
char *filename = NULL;
@@ -1476,11 +1476,11 @@ free_lmv:
 
if (cmd == IOC_MDC_GETFILESTRIPE ||
cmd == LL_IOC_LOV_GETSTRIPE) {
-   lump = (struct lov_user_md *)arg;
+   lump = (struct lov_user_md __user *)arg;
} else {
-   struct lov_user_mds_data *lmdp;
+   struct lov_user_mds_data __user *lmdp;
 
-   lmdp = (struct lov_user_mds_data *)arg;
+   lmdp = (struct lov_user_mds_data __user *)arg;
lump = &lmdp->lmd_lmm;
}
if (copy_to_user(lump, lmm, lmmsize)) {
@@ -1492,7 +1492,7 @@ free_lmv:
}
 skip_lmm:
if (cmd == IOC_MDC_GETFILEINFO || cmd == LL_IOC_MDC_GETINFO) {
-   struct lov_user_mds_data *lmdp;
+   struct lov_user_mds_data __user *lmdp;
lstat_t st = { 0 };
 
st.st_dev = inode->i_sb->s_dev;
@@ -1509,7 +1509,7 @@ skip_lmm:
st.st_ctime   = body->ctime;
st.st_ino = inode->i_ino;
 
-   lmdp = (struct lov_user_mds_data *)arg;
+   lmdp = (struct lov_user_mds_data __user *)arg;
if (copy_to_user(&lmdp->lmd_st, &st, sizeof(st))) {
rc = -EFAULT;
goto out_req;
@@ -1523,14 +1523,14 @@ out_req:
return rc;
}
case IOC_LOV_GETINFO: {
-   struct lov_user_mds_data *lumd;
+   struct lov_user_mds_data __user *lumd;
struct lov_stripe_md *lsm;
-   struct lov_

[PATCH 16/29] staging/lustre/llite: Properly mark ll_obd_statfs argument as __user

2016-01-03 Thread green
From: Oleg Drokin 

Also update all callers.
This fixes a bunch of address space mismatch warnings from sparse.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/dir.c| 2 +-
 drivers/staging/lustre/lustre/llite/file.c   | 2 +-
 drivers/staging/lustre/lustre/llite/llite_internal.h | 2 +-
 drivers/staging/lustre/lustre/llite/llite_lib.c  | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/dir.c 
b/drivers/staging/lustre/lustre/llite/dir.c
index 1034784..22c59e5 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -1433,7 +1433,7 @@ free_lmv:
case LL_IOC_LOV_SWAP_LAYOUTS:
return -EPERM;
case LL_IOC_OBD_STATFS:
-   return ll_obd_statfs(inode, (void *)arg);
+   return ll_obd_statfs(inode, (void __user *)arg);
case LL_IOC_LOV_GETSTRIPE:
case LL_IOC_MDC_GETINFO:
case IOC_MDC_GETFILEINFO:
diff --git a/drivers/staging/lustre/lustre/llite/file.c 
b/drivers/staging/lustre/lustre/llite/file.c
index 8b118bc..08eba8b 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -2278,7 +2278,7 @@ ll_file_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
case LL_IOC_GROUP_UNLOCK:
return ll_put_grouplock(inode, file, arg);
case IOC_OBD_STATFS:
-   return ll_obd_statfs(inode, (void *)arg);
+   return ll_obd_statfs(inode, (void __user *)arg);
 
/* We need to special case any other ioctls we want to handle,
 * to send them to the MDS/OST as appropriate and to properly
diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h 
b/drivers/staging/lustre/lustre/llite/llite_internal.h
index ee8a1d6..532c9a1 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -784,7 +784,7 @@ int ll_show_options(struct seq_file *seq, struct dentry 
*dentry);
 void ll_dirty_page_discard_warn(struct page *page, int ioret);
 int ll_prep_inode(struct inode **inode, struct ptlrpc_request *req,
  struct super_block *, struct lookup_intent *);
-int ll_obd_statfs(struct inode *inode, void *arg);
+int ll_obd_statfs(struct inode *inode, void __user *arg);
 int ll_get_max_mdsize(struct ll_sb_info *sbi, int *max_mdsize);
 int ll_get_default_mdsize(struct ll_sb_info *sbi, int *default_mdsize);
 int ll_process_config(struct lustre_cfg *lcfg);
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 51e5ba6..fa9fd5e 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -2019,7 +2019,7 @@ cleanup:
return rc;
 }
 
-int ll_obd_statfs(struct inode *inode, void *arg)
+int ll_obd_statfs(struct inode *inode, void __user *arg)
 {
struct ll_sb_info *sbi = NULL;
struct obd_export *exp;
-- 
2.1.0

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


[PATCH 11/29] staging/lustre: Get rid of an ugly statfs hack in lov_iocontrol

2016-01-03 Thread green
From: Oleg Drokin 

For some crazy reason ll_obd_statfs decided to decode async flag
passed from userspace and then pass it via a userspace pointer
argument to lov_iocontrol.
This patch moves flags decoding to lov_iocontrol where it belongs.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/llite_lib.c | 4 +---
 drivers/staging/lustre/lustre/lov/lov_obd.c | 4 +++-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 1db93af..51e5ba6 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -2026,7 +2026,6 @@ int ll_obd_statfs(struct inode *inode, void *arg)
char *buf = NULL;
struct obd_ioctl_data *data = NULL;
__u32 type;
-   __u32 flags;
int len = 0, rc;
 
if (!inode) {
@@ -2069,8 +2068,7 @@ int ll_obd_statfs(struct inode *inode, void *arg)
goto out_statfs;
}
 
-   flags = (type & LL_STATFS_NODELAY) ? OBD_STATFS_NODELAY : 0;
-   rc = obd_iocontrol(IOC_OBD_STATFS, exp, len, buf, &flags);
+   rc = obd_iocontrol(IOC_OBD_STATFS, exp, len, buf, NULL);
if (rc)
goto out_statfs;
 out_statfs:
diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c 
b/drivers/staging/lustre/lustre/lov/lov_obd.c
index 6c2bdfe..1dde0b8 100644
--- a/drivers/staging/lustre/lustre/lov/lov_obd.c
+++ b/drivers/staging/lustre/lustre/lov/lov_obd.c
@@ -1420,7 +1420,9 @@ static int lov_iocontrol(unsigned int cmd, struct 
obd_export *exp, int len,
 (int) sizeof(struct obd_uuid
return -EFAULT;
 
-   flags = uarg ? *(__u32 *)uarg : 0;
+   memcpy(&flags, data->ioc_inlbuf1, sizeof(__u32));
+   flags = flags & LL_STATFS_NODELAY ? OBD_STATFS_NODELAY : 0;
+
/* got statfs data */
rc = obd_statfs(NULL, lov->lov_tgts[index]->ltd_exp, &stat_buf,
cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
-- 
2.1.0

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


[PATCH 21/29] staging/lustre/lloop: Properly mark userspace pointers in lo/lloop_ioctl

2016-01-03 Thread green
From: Oleg Drokin 

When casting unsigned long userspace pointer for use with
userspace-accessing functions, need to use __user attribute to make
sparse happy.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/lloop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/lloop.c 
b/drivers/staging/lustre/lustre/llite/lloop.c
index 420d391..e6f8e3d 100644
--- a/drivers/staging/lustre/lustre/llite/lloop.c
+++ b/drivers/staging/lustre/lustre/llite/lloop.c
@@ -636,7 +636,7 @@ static int lo_ioctl(struct block_device *bdev, fmode_t mode,
else
fid_zero(&fid);
 
-   if (copy_to_user((struct lu_fid *)arg, &fid, sizeof(fid)))
+   if (copy_to_user((void __user *)arg, &fid, sizeof(fid)))
err = -EFAULT;
break;
}
@@ -708,7 +708,7 @@ static enum llioc_iter lloop_ioctl(struct inode *unused, 
struct file *file,
dev = MKDEV(lloop_major, lo->lo_number);
 
/* quit if the used pointer is writable */
-   if (put_user((long)old_encode_dev(dev), (long *)arg)) {
+   if (put_user((long)old_encode_dev(dev), (long __user *)arg)) {
err = -EFAULT;
goto out;
}
-- 
2.1.0

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


[PATCH 20/29] staging/lustre/osc: Mark osc_getstripe user pointer argument as __user

2016-01-03 Thread green
From: Oleg Drokin 

This shuts some sparse address space mismatch warnings

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/osc/osc_request.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c 
b/drivers/staging/lustre/lustre/osc/osc_request.c
index 6eb678c..3ae00fc 100644
--- a/drivers/staging/lustre/lustre/osc/osc_request.c
+++ b/drivers/staging/lustre/lustre/osc/osc_request.c
@@ -2534,7 +2534,8 @@ static int osc_statfs(const struct lu_env *env, struct 
obd_export *exp,
  * the maximum number of OST indices which will fit in the user buffer.
  * lmm_magic must be LOV_MAGIC (we only use 1 slot here).
  */
-static int osc_getstripe(struct lov_stripe_md *lsm, struct lov_user_md *lump)
+static int osc_getstripe(struct lov_stripe_md *lsm,
+struct lov_user_md __user *lump)
 {
/* we use lov_user_md_v3 because it is larger than lov_user_md_v1 */
struct lov_user_md_v3 lum, *lumk;
-- 
2.1.0

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


[PATCH] drivers: staging: octeon-usb: octeon-hcd.c: fixed coding style related warnings

2016-01-03 Thread Saatvik Arya
fixed coding style warnings related to comment blocks

Signed-off-by: Saatvik Arya 
---
 drivers/staging/octeon-usb/octeon-hcd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/octeon-usb/octeon-hcd.c 
b/drivers/staging/octeon-usb/octeon-hcd.c
index 6f28717..16d4587 100644
--- a/drivers/staging/octeon-usb/octeon-hcd.c
+++ b/drivers/staging/octeon-usb/octeon-hcd.c
@@ -2006,7 +2006,8 @@ static void octeon_usb_urb_complete_callback(struct 
cvmx_usb_state *usb,
urb->hcpriv = NULL;
 
/* For Isochronous transactions we need to update the URB packet status
-  list from data in our private copy */
+* list from data in our private copy
+*/
if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) {
int i;
/*
-- 
2.5.0

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


[PATCH] drivers: staging: xgifb: vgatypes.h: fixed coding style warnings

2016-01-03 Thread Saatvik Arya
fixed warnings about comment block coding style

Signed-off-by: Saatvik Arya 
---
 drivers/staging/xgifb/vgatypes.h | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/xgifb/vgatypes.h b/drivers/staging/xgifb/vgatypes.h
index 61fa10f..de80e5c 100644
--- a/drivers/staging/xgifb/vgatypes.h
+++ b/drivers/staging/xgifb/vgatypes.h
@@ -27,14 +27,16 @@ struct xgi_hw_device_info {
/* of Linear VGA memory */
 
unsigned long ulVideoMemorySize; /* size, in bytes, of the
-   memory on the board */
+ * memory on the board
+ */
 
unsigned char jChipType; /* Used to Identify Graphics Chip */
 /* defined in the data structure type  */
 /* "XGI_CHIP_TYPE" */
 
unsigned char jChipRevision; /* Used to Identify Graphics
-   Chip Revision */
+ * Chip Revision
+ */
 
unsigned char ujVBChipID; /* the ID of video bridge */
  /* defined in the data structure type */
@@ -46,4 +48,3 @@ struct xgi_hw_device_info {
 /* Additional IOCTL for communication xgifb <> X driver*/
 /* If changing this, xgifb.h must also be changed (for xgifb) */
 #endif
-
-- 
2.5.0

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


Re: [PATCH] staging-slicoss: Replace variable initialisations by assignments in slic_if_init()

2016-01-03 Thread SF Markus Elfring
>> Replace explicit initialisation for two local variables at the beginning
>> by assignments.
> 
> Why?

I prefer that assignments for variables like "card" and "slic_regs"
will only be performed immediately before the corresponding content will be
read again (after a few condition checks were executed).

Another description could be this view:
I suggest to move the variable initialisation a bit.

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


Re: [PATCH] staging-slicoss: Replace variable initialisations by assignments in slic_if_init()

2016-01-03 Thread Greg Kroah-Hartman
On Sun, Jan 03, 2016 at 06:48:17PM +0100, SF Markus Elfring wrote:
> >> Replace explicit initialisation for two local variables at the beginning
> >> by assignments.
> > 
> > Why?
> 
> I prefer that assignments for variables like "card" and "slic_regs"
> will only be performed immediately before the corresponding content will be
> read again (after a few condition checks were executed).
> 
> Another description could be this view:
> I suggest to move the variable initialisation a bit.

And like David Miller and others just said, please don't bother us with
pointless patches such as this, if you keep it up, I'll have to add you
to my killfile as patches like this are a waste of everyone's valuable
time.

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


Re: [PATCH 29/29] staging/lustre: Add __user annotations in lnetselftest code

2016-01-03 Thread kbuild test robot
Hi Frank,

[auto build test WARNING on staging/staging-testing]
[also build test WARNING on next-20151231]
[cannot apply to v4.4-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improving the system]

url:
https://github.com/0day-ci/linux/commits/green-linuxhacker-ru/Clean-up-Lustre-userspace-accesses/20160104-011044
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

   include/linux/compiler.h:228:8: sparse: attribute 'no_sanitize_address': 
unknown attribute
>> drivers/staging/lustre/lnet/selftest/conrpc.c:492:30: sparse: incompatible 
>> types in comparison expression (different address spaces)

vim +492 drivers/staging/lustre/lnet/selftest/conrpc.c

d7e09d039 Peng Tao   2013-05-02  476lstcon_rpc_t *crpc;
d7e09d039 Peng Tao   2013-05-02  477srpc_msg_t *msg;
d7e09d039 Peng Tao   2013-05-02  478lstcon_node_t *nd;
b2d201bd1 Greg Kroah-Hartman 2014-07-12  479long dur;
d7e09d039 Peng Tao   2013-05-02  480struct timeval tv;
d7e09d039 Peng Tao   2013-05-02  481int error;
d7e09d039 Peng Tao   2013-05-02  482  
d7e09d039 Peng Tao   2013-05-02  483LASSERT(head_up != NULL);
d7e09d039 Peng Tao   2013-05-02  484  
d7e09d039 Peng Tao   2013-05-02  485next = head_up;
d7e09d039 Peng Tao   2013-05-02  486  
d7e09d039 Peng Tao   2013-05-02  487list_for_each_entry(crpc, 
&trans->tas_rpcs_list, crp_link) {
d7e09d039 Peng Tao   2013-05-02  488if 
(copy_from_user(&tmp, next,
d7e09d039 Peng Tao   2013-05-02  489   
sizeof(struct list_head)))
d7e09d039 Peng Tao   2013-05-02  490return -EFAULT;
d7e09d039 Peng Tao   2013-05-02  491  
d7e09d039 Peng Tao   2013-05-02 @492if (tmp.next == head_up)
d7e09d039 Peng Tao   2013-05-02  493return 0;
d7e09d039 Peng Tao   2013-05-02  494  
d7e09d039 Peng Tao   2013-05-02  495next = tmp.next;
d7e09d039 Peng Tao   2013-05-02  496  
d7e09d039 Peng Tao   2013-05-02  497ent = list_entry(next, 
lstcon_rpc_ent_t, rpe_link);
d7e09d039 Peng Tao   2013-05-02  498  
d7e09d039 Peng Tao   2013-05-02  499LASSERT(crpc->crp_stamp 
!= 0);
d7e09d039 Peng Tao   2013-05-02  500  

:: The code at line 492 was first introduced by commit
:: d7e09d0397e84eefbabfd9cb353221f3c6448d83 staging: add Lustre file system 
client support

:: TO: Peng Tao 
:: CC: Greg Kroah-Hartman 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging-slicoss: Replace variable initialisations by assignments in slic_if_init()

2016-01-03 Thread SF Markus Elfring
>> I prefer that assignments for variables like "card" and "slic_regs"
>> will only be performed immediately before the corresponding content will be
>> read again (after a few condition checks were executed).
>>
>> Another description could be this view:
>> I suggest to move the variable initialisation a bit.
> 
> And like David Miller and others just said, please don't bother us with
> pointless patches such as this, if you keep it up, I'll have to add you
> to my killfile as patches like this are a waste of everyone's valuable time.

I am a bit surprised that you do not like such source code fine-tuning.
Will related software improvements get another chance later (eventually together
with other changes)?

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


Re: [PATCH] staging-slicoss: Replace variable initialisations by assignments in slic_if_init()

2016-01-03 Thread Greg Kroah-Hartman
On Sun, Jan 03, 2016 at 07:16:49PM +0100, SF Markus Elfring wrote:
> >> I prefer that assignments for variables like "card" and "slic_regs"
> >> will only be performed immediately before the corresponding content will be
> >> read again (after a few condition checks were executed).
> >>
> >> Another description could be this view:
> >> I suggest to move the variable initialisation a bit.
> > 
> > And like David Miller and others just said, please don't bother us with
> > pointless patches such as this, if you keep it up, I'll have to add you
> > to my killfile as patches like this are a waste of everyone's valuable time.
> 
> I am a bit surprised that you do not like such source code fine-tuning.

It's moving stuff around for no real reason, why would I like it?
Reading and reviewing and applying this type of stuff takes away from
the time I have to spend reviewing and applying actual code fixes from
other developers who are doing real and useful work.

Remember maintainer's time is our most limited resource right now.  You
are abusing that by wasting their time for no valid reason.

> Will related software improvements get another chance later (eventually 
> together
> with other changes)?

Define "improvements".  Did you fix an obvious bug?  Did you speed up
the code in a measurable way?  Did you make the code easier to
understand somehow?  For this patch you did none of these things.

Code in staging needs to be moved out of staging, and this patch does
nothing toward achieving that goal and it wastes people's time reviewing
it to see if it is correct or not.  Please stop or again, you will end
up in some killfiles, if you haven't already been placed there.

thanks,

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


Re: [PATCH] staging-slicoss: Replace variable initialisations by assignments in slic_if_init()

2016-01-03 Thread SF Markus Elfring
>> I am a bit surprised that you do not like such source code fine-tuning.
> 
> It's moving stuff around for no real reason, why would I like it?

Can such fine-tuning result in positive effects for the run-time behaviour?


> Reading and reviewing and applying this type of stuff takes away from
> the time I have to spend reviewing and applying actual code fixes from
> other developers who are doing real and useful work.

I am aware that a lot of open issues are competing for your precious
software development attention.


> Remember maintainer's time is our most limited resource right now.

That is mostly usual.


> You are abusing that by wasting their time for no valid reason.

I find a couple of my update suggestions still valid. I agree that
the importance of proposed changes is varying.


>> Will related software improvements get another chance later (eventually 
>> together
>> with other changes)?
> 
> Define "improvements".  Did you fix an obvious bug?

Maybe. - It depends on the error classes you are interested in at the moment.


> Did you speed up the code in a measurable way?

My suggestions can result in measurable differences.


> Did you make the code easier to understand somehow?
> For this patch you did none of these things.

Thanks for your view on my approach.

Will it become acceptable to reduce the scope for any more variable
definitions in further function implementations?


> Code in staging needs to be moved out of staging, and this patch does
> nothing toward achieving that goal and it wastes people's time reviewing
> it to see if it is correct or not.

I am curious on the ways the discussed software can evolve further.

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


[PATCH v2 0/2] Staging: panel: Fix checkpatch warnings

2016-01-03 Thread Ksenija Stanojevic
Fix checkpatch.pl warnings in panel.c

Signed-off-by: Ksenija Stanojevic 

Ksenija Stanojevic (2):
  Staging: panel: Fix line over 80 characters
  Staging: panel: Remove space

 drivers/staging/panel/panel.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

-- 
1.9.1

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


[PATCH v2 1/2] Staging: panel: Fix line over 80 characters

2016-01-03 Thread Ksenija Stanojevic
Move statement into line below the comment to follow 80 characters per
line rule.
Found by checkpatch.pl

Signed-off-by: Ksenija Stanojevic 
---
Changes in v2: 
- don't split comment in multiline

 drivers/staging/panel/panel.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index 79ac192..3525919 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -947,7 +947,8 @@ static void lcd_clear_fast_s(void)
lcd_send_serial(0x5F);  /* R/W=W, RS=1 */
lcd_send_serial(' ' & 0x0F);
lcd_send_serial((' ' >> 4) & 0x0F);
-   usleep_range(40, 100);  /* the shortest data takes at least 40 
us */
+   /* the shortest data takes at least 40 us */
+   usleep_range(40, 100);
}
spin_unlock_irq(&pprt_lock);
 
-- 
1.9.1

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


[PATCH v2 2/2] Staging: panel: Remove space

2016-01-03 Thread Ksenija Stanojevic
No space is necessary after a cast, therefore remove it.
Found by checkpatch.pl

Signed-off-by: Ksenija Stanojevic 
---
Changes in v2:
- nothing
 drivers/staging/panel/panel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index 3525919..04d86f3 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -1789,7 +1789,7 @@ static void phys_scan_contacts(void)
gndmask = PNL_PINPUT(r_str(pprt)) & scan_mask_i;
 
/* grounded inputs are signals 40-44 */
-   phys_read |= (pmask_t) gndmask << 40;
+   phys_read |= (pmask_t)gndmask << 40;
 
if (bitmask != gndmask) {
/*
@@ -1805,7 +1805,7 @@ static void phys_scan_contacts(void)
 
w_dtr(pprt, oldval & ~bitval);  /* enable this output */
bitmask = PNL_PINPUT(r_str(pprt)) & ~gndmask;
-   phys_read |= (pmask_t) bitmask << (5 * bit);
+   phys_read |= (pmask_t)bitmask << (5 * bit);
}
w_dtr(pprt, oldval);/* disable all outputs */
}
-- 
1.9.1

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


[PATCH v2 0/5] Staging: panel: TODO fixes

2016-01-03 Thread Ksenija Stanojevic
This patchset is based on checkpatch fixes made by previous patches.
Here I tried to address all suggestions made by Dan and Willy.

Signed-off-by: Ksenija Stanojevic 

Ksenija Stanojevic (5):
  Staging: panel: Use u8 type
  Staging: panel: Remove typedef pmask_t
  Staging: panel: Remove ULL
  Staging: panel: Reduce value range for *name
  Staging: panel: Make statement more readable

 drivers/staging/panel/panel.c | 46 +--
 1 file changed, 22 insertions(+), 24 deletions(-)

-- 
1.9.1

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


[PATCH v2 1/5] Staging: panel: Use u8 type

2016-01-03 Thread Ksenija Stanojevic
Declare om, im, omask and imask as u8 to remove any confusion if
that describes the 8 bits of the data bus on the parallel port.
Also change return type of lcd_write_data() to u8.

Signed-off-by: Ksenija Stanojevic 
---
v2: nothing

 drivers/staging/panel/panel.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index 04d86f3..8bc604d 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -2042,11 +2042,11 @@ static void init_scan_timer(void)
  * corresponding to out and in bits respectively.
  * returns 1 if ok, 0 if error (in which case, nothing is written).
  */
-static int input_name2mask(const char *name, pmask_t *mask, pmask_t *value,
-  char *imask, char *omask)
+static u8 input_name2mask(const char *name, pmask_t *mask, pmask_t *value,
+ u8 *imask, u8 *omask)
 {
static char sigtab[10] = "EeSsPpAaBb";
-   char im, om;
+   u8 im, om;
pmask_t m, v;
 
om = 0ULL;
-- 
1.9.1

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


[PATCH v2 2/5] Staging: panel: Remove typedef pmask_t

2016-01-03 Thread Ksenija Stanojevic
Use __u64 instead of pmask_t and remove pmask_t since is useless.

Signed-off-by: Ksenija Stanojevic 
---
v2: nothing

 drivers/staging/panel/panel.c | 24 +++-
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index 8bc604d..7138ee7 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -172,8 +172,6 @@ static __u8 scan_mask_o;
 /* logical or of the input bits involved in the scan matrix */
 static __u8 scan_mask_i;
 
-typedef __u64 pmask_t;
-
 enum input_type {
INPUT_TYPE_STD,
INPUT_TYPE_KBD,
@@ -188,8 +186,8 @@ enum input_state {
 
 struct logical_input {
struct list_head list;
-   pmask_t mask;
-   pmask_t value;
+   __u64 mask;
+   __u64 value;
enum input_type type;
enum input_state state;
__u8 rise_time, fall_time;
@@ -219,19 +217,19 @@ static LIST_HEAD(logical_inputs); /* list of all defined 
logical inputs */
  * corresponds to the ground.
  * Within each group, bits are stored in the same order as read on the port :
  * BAPSE (busy=4, ack=3, paper empty=2, select=1, error=0).
- * So, each __u64 (or pmask_t) is represented like this :
+ * So, each __u64 is represented like this :
  * 000BAPSEBAPSEBAPSEBAPSEBAPSEBAPSEBAPSEBAPSEBAPSE
  * <-unused-->
  */
 
 /* what has just been read from the I/O ports */
-static pmask_t phys_read;
+static __u64 phys_read;
 /* previous phys_read */
-static pmask_t phys_read_prev;
+static __u64 phys_read_prev;
 /* stabilized phys_read (phys_read|phys_read_prev) */
-static pmask_t phys_curr;
+static __u64 phys_curr;
 /* previous phys_curr */
-static pmask_t phys_prev;
+static __u64 phys_prev;
 /* 0 means that at least one logical signal needs be computed */
 static char inputs_stable;
 
@@ -1789,7 +1787,7 @@ static void phys_scan_contacts(void)
gndmask = PNL_PINPUT(r_str(pprt)) & scan_mask_i;
 
/* grounded inputs are signals 40-44 */
-   phys_read |= (pmask_t)gndmask << 40;
+   phys_read |= (__u64)gndmask << 40;
 
if (bitmask != gndmask) {
/*
@@ -1805,7 +1803,7 @@ static void phys_scan_contacts(void)
 
w_dtr(pprt, oldval & ~bitval);  /* enable this output */
bitmask = PNL_PINPUT(r_str(pprt)) & ~gndmask;
-   phys_read |= (pmask_t)bitmask << (5 * bit);
+   phys_read |= (__u64)bitmask << (5 * bit);
}
w_dtr(pprt, oldval);/* disable all outputs */
}
@@ -2042,12 +2040,12 @@ static void init_scan_timer(void)
  * corresponding to out and in bits respectively.
  * returns 1 if ok, 0 if error (in which case, nothing is written).
  */
-static u8 input_name2mask(const char *name, pmask_t *mask, pmask_t *value,
+static u8 input_name2mask(const char *name, __u64 *mask, __u64 *value,
  u8 *imask, u8 *omask)
 {
static char sigtab[10] = "EeSsPpAaBb";
u8 im, om;
-   pmask_t m, v;
+   __u64 m, v;
 
om = 0ULL;
im = 0ULL;
-- 
1.9.1

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


[PATCH v2 3/5] Staging: panel: Remove ULL

2016-01-03 Thread Ksenija Stanojevic
Remove ULL on om and im, since it's useless.

Signed-off-by: Ksenija Stanojevic 
---
v2: leave ULL on m and v.
 drivers/staging/panel/panel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index 7138ee7..e9641ea 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -2047,8 +2047,8 @@ static u8 input_name2mask(const char *name, __u64 *mask, 
__u64 *value,
u8 im, om;
__u64 m, v;
 
-   om = 0ULL;
-   im = 0ULL;
+   om = 0;
+   im = 0;
m = 0ULL;
v = 0ULL;
while (*name) {
-- 
1.9.1

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


[PATCH v2 4/5] Staging: panel: Reduce value range for *name

2016-01-03 Thread Ksenija Stanojevic
out is 0-9 so it's too much for om, therefore reduce value range for
*name from '0'-'9' to '0'-'7'.

Signed-off-by: Ksenija Stanojevic 
---
v2: nothing
 drivers/staging/panel/panel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index e9641ea..fcfcda7 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -2065,7 +2065,7 @@ static u8 input_name2mask(const char *name, __u64 *mask, 
__u64 *value,
im |= BIT(in);
 
name++;
-   if (isdigit(*name)) {
+   if (*name >= '0' && *name <= '7') {
out = *name - '0';
om |= BIT(out);
} else if (*name == '-') {
-- 
1.9.1

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


Re: [PATCH] staging-slicoss: Replace variable initialisations by assignments in slic_if_init()

2016-01-03 Thread Greg Kroah-Hartman
On Sun, Jan 03, 2016 at 07:50:18PM +0100, SF Markus Elfring wrote:
> >> I am a bit surprised that you do not like such source code fine-tuning.
> > 
> > It's moving stuff around for no real reason, why would I like it?
> 
> Can such fine-tuning result in positive effects for the run-time behaviour?

If you can not benchmark and show the proof, don't even start to claim
such a thing.

> > Did you speed up the code in a measurable way?
> 
> My suggestions can result in measurable differences.

Show the proof please.  That's the only way I will ever accept anything
else from you like this.

> Will it become acceptable to reduce the scope for any more variable
> definitions in further function implementations?

No.

> > Code in staging needs to be moved out of staging, and this patch does
> > nothing toward achieving that goal and it wastes people's time reviewing
> > it to see if it is correct or not.
> 
> I am curious on the ways the discussed software can evolve further.

That's nice, but that's not my concern.

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


[PATCH v2 5/5] Staging: panel: Make code more readable

2016-01-03 Thread Ksenija Stanojevic
Repace 'for' statement by strchr() function to make code more readable.

Signed-off-by: Ksenija Stanojevic 
---
v2: use strchr().
 drivers/staging/panel/panel.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index fcfcda7..1219ff7 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -2043,7 +2043,7 @@ static void init_scan_timer(void)
 static u8 input_name2mask(const char *name, __u64 *mask, __u64 *value,
  u8 *imask, u8 *omask)
 {
-   static char sigtab[10] = "EeSsPpAaBb";
+   const char sigtab[] = "EeSsPpAaBb";
u8 im, om;
__u64 m, v;
 
@@ -2053,13 +2053,13 @@ static u8 input_name2mask(const char *name, __u64 
*mask, __u64 *value,
v = 0ULL;
while (*name) {
int in, out, bit, neg;
+   const char *idx;
 
-   for (in = 0; (in < sizeof(sigtab)) && (sigtab[in] != *name);
-in++)
-   ;
-
-   if (in >= sizeof(sigtab))
+   idx = strchr(sigtab, *name);
+   if (!idx)
return 0;   /* input name not found */
+
+   in = idx - sigtab;
neg = (in & 1); /* odd (lower) names are negated */
in >>= 1;
im |= BIT(in);
-- 
1.9.1

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


Re: staging-slicoss: Replace variable initialisations by assignments in slic_if_init()

2016-01-03 Thread SF Markus Elfring
>> Can such fine-tuning result in positive effects for the run-time behaviour?
> 
> If you can not benchmark and show the proof, don't even start to claim
> such a thing.

Which measurement results would you accept for further discussion?


>> My suggestions can result in measurable differences.
> 
> Show the proof please.

Which information presentations would finally qualify for "the proof"
you request now?

Which test systems will be representative for you?


> That's the only way I will ever accept anything else from you like this.

Are there any update suggestions remaining in the waiting queue
which have a higher chance of acceptance because their value might be
a bit more obvious?

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


Re: staging-slicoss: Replace variable initialisations by assignments in slic_if_init()

2016-01-03 Thread Greg Kroah-Hartman
On Sun, Jan 03, 2016 at 09:10:45PM +0100, SF Markus Elfring wrote:
> >> Can such fine-tuning result in positive effects for the run-time behaviour?
> > 
> > If you can not benchmark and show the proof, don't even start to claim
> > such a thing.
> 
> Which measurement results would you accept for further discussion?

If you don't know how to show your results, then this whole discussion
is pointless.

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


Re: staging-slicoss: Replace variable initialisations by assignments in slic_if_init()

2016-01-03 Thread SF Markus Elfring
>> Which measurement results would you accept for further discussion?
> 
> If you don't know how to show your results, then this whole discussion
> is pointless.

I could show test results. But it could happen that I would choose insufficient
variations for execution environments.

I am unsure about the requested detail and size around test parameters.

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


[PATCHv7 2/5] hdmi: added functions for MPEG InfoFrames

2016-01-03 Thread Enric Balletbo i Serra
The MPEG Source (MS) InfoFrame is in EIA/CEA-861B. It describes aspects of
the compressed video stream that were used to produce the uncompressed
video.

The patch adds functions to work with MPEG InfoFrames.

Signed-off-by: Enric Balletbo i Serra 
---
 drivers/video/hdmi.c | 156 +++
 include/linux/hdmi.h |  24 
 2 files changed, 180 insertions(+)

diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
index 1626892..47121a6 100644
--- a/drivers/video/hdmi.c
+++ b/drivers/video/hdmi.c
@@ -388,6 +388,81 @@ ssize_t hdmi_vendor_infoframe_pack(struct 
hdmi_vendor_infoframe *frame,
 }
 EXPORT_SYMBOL(hdmi_vendor_infoframe_pack);
 
+/**
+ * hdmi_mpeg_infoframe_init() - initialize an HDMI MPEG infoframe
+ * @frame: HDMI MPEG infoframe
+ *
+ * Returns 0 on success or a negative error code on failure.
+ */
+int hdmi_mpeg_infoframe_init(struct hdmi_mpeg_infoframe *frame)
+{
+   memset(frame, 0, sizeof(*frame));
+
+   frame->type = HDMI_INFOFRAME_TYPE_MPEG;
+   frame->version = 1;
+   frame->length = HDMI_MPEG_INFOFRAME_SIZE;
+
+   return 0;
+}
+EXPORT_SYMBOL(hdmi_mpeg_infoframe_init);
+
+/**
+ * hdmi_mpeg_infoframe_pack() - write HDMI MPEG infoframe to binary buffer
+ * @frame: HDMI MPEG infoframe
+ * @buffer: destination buffer
+ * @size: size of buffer
+ *
+ * Packs the information contained in the @frame structure into a binary
+ * representation that can be written into the corresponding controller
+ * registers. Also computes the checksum as required by section 5.3.5 of
+ * the HDMI 1.4 specification.
+ *
+ * Returns the number of bytes packed into the binary buffer or a negative
+ * error code on failure.
+ */
+ssize_t hdmi_mpeg_infoframe_pack(struct hdmi_mpeg_infoframe *frame,
+void *buffer, size_t size)
+{
+   u8 *ptr = buffer;
+   size_t length;
+
+   length = HDMI_INFOFRAME_HEADER_SIZE + frame->length;
+
+   if (size < length)
+   return -ENOSPC;
+
+   memset(buffer, 0, size);
+
+   ptr[0] = frame->type;
+   ptr[1] = frame->version;
+   ptr[2] = frame->length;
+   ptr[3] = 0; /* checksum */
+
+   /* start infoframe payload */
+   ptr += HDMI_INFOFRAME_HEADER_SIZE;
+
+   /*
+* The MPEG Bit Rate is stored as a 32-bit number and is expressed in
+* Hertz. MB#0 contains the least significant byte while MB#3 contains
+* the most significant byte. If the MPEG Bit Rate is unknown or this
+* field doesn’t apply, then all of the bits in Data Bytes 1-4 shall
+* be set to 0.
+*/
+   ptr[0] = frame->bitrate & 0x00ff;
+   ptr[1] = (frame->bitrate & 0xff00) >> 8;
+   ptr[2] = (frame->bitrate & 0x00ff) >> 16;
+   ptr[3] = (frame->bitrate & 0xff00) >> 24;
+
+   ptr[4] = frame->frame_type;
+   if (frame->repeated)
+   ptr[4] |= BIT(4);
+
+   hdmi_infoframe_set_checksum(buffer, length);
+
+   return length;
+}
+EXPORT_SYMBOL(hdmi_mpeg_infoframe_pack);
+
 /*
  * hdmi_vendor_any_infoframe_pack() - write a vendor infoframe to binary buffer
  */
@@ -435,6 +510,9 @@ hdmi_infoframe_pack(union hdmi_infoframe *frame, void 
*buffer, size_t size)
length = hdmi_vendor_any_infoframe_pack(&frame->vendor,
buffer, size);
break;
+   case HDMI_INFOFRAME_TYPE_MPEG:
+   length = hdmi_mpeg_infoframe_pack(&frame->mpeg, buffer, size);
+   break;
default:
WARN(1, "Bad infoframe type %d\n", frame->any.type);
length = -EINVAL;
@@ -457,6 +535,8 @@ static const char *hdmi_infoframe_type_get_name(enum 
hdmi_infoframe_type type)
return "Source Product Description (SPD)";
case HDMI_INFOFRAME_TYPE_AUDIO:
return "Audio";
+   case HDMI_INFOFRAME_TYPE_MPEG:
+   return "MPEG";
}
return "Reserved";
 }
@@ -899,6 +979,41 @@ static void hdmi_audio_infoframe_log(const char *level,
frame->downmix_inhibit ? "Yes" : "No");
 }
 
+static const char *hdmi_mpeg_picture_get_name(enum hdmi_mpeg_frame_type type)
+{
+   switch (type) {
+   case HDMI_MPEG_UNKNOWN_FRAME:
+   return "Unknown";
+   case HDMI_MPEG_I_FRAME:
+   return "Intra-coded picture";
+   case HDMI_MPEG_B_FRAME:
+   return "Bi-predictive picture";
+   case HDMI_MPEG_P_FRAME:
+   return "Predicted picture";
+   }
+   return NULL;
+}
+
+/**
+ * hdmi_mpeg_infoframe_log() - log info of HDMI MPEG infoframe
+ * @level: logging level
+ * @dev: device
+ * @frame: HDMI MPEG infoframe
+ */
+static void hdmi_mpeg_infoframe_log(const char *level,
+struct device *dev,
+struct hdmi_mpeg_infoframe *frame)
+{
+   hdmi_infoframe_log_header(level, dev,
+

[PATCHv7 0/5] Add initial support for slimport anx78xx

2016-01-03 Thread Enric Balletbo i Serra
Hi all,

This is another version of the patch set to introduce the anx7814 transmitter.
Any comments are welcome.

The following series add initial support for the Slimport ANX7814 transmitter, a
ultra-low power Full-HD (1080p60) transmitter designed for portable device.

The driver was originally created and based from the work of Junhua Xia from
Analogix. This driver is a refactor of the original driver and fixes different
coding style lines, and different errors/warnings reported by checkpatch. Also
there were things that I noticed that we need to change like:

 - Convert the numbered GPIO API to the new descriptor based GPIO API.
 - Review the DT binding
 - Add missing MODULE_DEVICE_TABLE(of, ...);
 - Fix Makefiles and Kconfig to build conditionally.
 - Use SIMPLE_DEV_PM_OPS() instead of the deprecated i2c .suspend and
  .resume callbacks.
 - Move to use managed device resources.
 - Remove dead/unused code.
 - And others ...

Enric Balletbo i Serra (5):
  drm/dp: add DPCD definitions from DP 1.1
  hdmi: added functions for MPEG InfoFrames
  of: Add vendor prefix for Analogix Semiconductor, Inc.
  devicetree: Add new ANX7814 SlimPort transmitter binding.
  drm: bridge: anx78xx: Add anx78xx driver support by analogix.

 .../devicetree/bindings/vendor-prefixes.txt|1 +
 .../devicetree/bindings/video/bridge/anx7814.txt   |   39 +
 drivers/gpu/drm/bridge/Kconfig |2 +
 drivers/gpu/drm/bridge/Makefile|1 +
 drivers/gpu/drm/bridge/anx78xx/Kconfig |5 +
 drivers/gpu/drm/bridge/anx78xx/Makefile|4 +
 drivers/gpu/drm/bridge/anx78xx/anx78xx.h   |   44 +
 drivers/gpu/drm/bridge/anx78xx/anx78xx_main.c  |  334 ++
 drivers/gpu/drm/bridge/anx78xx/slimport_tx_drv.c   | 3194 
 drivers/gpu/drm/bridge/anx78xx/slimport_tx_drv.h   |  110 +
 drivers/gpu/drm/bridge/anx78xx/slimport_tx_reg.h   |  737 +
 drivers/video/hdmi.c   |  156 +
 include/drm/drm_dp_helper.h|   10 +
 include/linux/hdmi.h   |   24 +
 14 files changed, 4661 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/video/bridge/anx7814.txt
 create mode 100644 drivers/gpu/drm/bridge/anx78xx/Kconfig
 create mode 100644 drivers/gpu/drm/bridge/anx78xx/Makefile
 create mode 100644 drivers/gpu/drm/bridge/anx78xx/anx78xx.h
 create mode 100644 drivers/gpu/drm/bridge/anx78xx/anx78xx_main.c
 create mode 100644 drivers/gpu/drm/bridge/anx78xx/slimport_tx_drv.c
 create mode 100644 drivers/gpu/drm/bridge/anx78xx/slimport_tx_drv.h
 create mode 100644 drivers/gpu/drm/bridge/anx78xx/slimport_tx_reg.h

-- 
2.1.0

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


[PATCHv7 1/5] drm/dp: add DPCD definitions from DP 1.1

2016-01-03 Thread Enric Balletbo i Serra
Add a number of DPCD definitions from DP 1.1

Signed-off-by: Enric Balletbo i Serra 
---
 include/drm/drm_dp_helper.h | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index bb9d0de..9b0c990 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -73,6 +73,7 @@
 # define DP_ENHANCED_FRAME_CAP (1 << 7)
 
 #define DP_MAX_DOWNSPREAD   0x003
+# define DP_PERCENT_DOWNSPREAD_0_5 (1 << 0)
 # define DP_NO_AUX_HANDSHAKE_LINK_TRAINING  (1 << 6)
 
 #define DP_NORP 0x004
@@ -225,6 +226,7 @@
 # define DP_LINK_BW_1_62   0x06
 # define DP_LINK_BW_2_70x0a
 # define DP_LINK_BW_5_40x14/* 1.2 */
+# define DP_LINK_BW_6_75   0x19
 
 #define DP_LANE_COUNT_SET  0x101
 # define DP_LANE_COUNT_MASK0x0f
@@ -354,6 +356,7 @@
 #define DP_PAYLOAD_ALLOCATE_TIME_SLOT_COUNT 0x1c2
 
 #define DP_SINK_COUNT  0x200
+# define DP_SINK_COUNT_MASK0x3f
 /* prior to 1.2 bit 7 was reserved mbz */
 # define DP_GET_SINK_COUNT(x)  x) & 0x80) >> 1) | ((x) & 0x3f))
 # define DP_SINK_CP_READY  (1 << 6)
@@ -399,6 +402,10 @@
 # define DP_ADJUST_PRE_EMPHASIS_LANE1_MASK   0xc0
 # define DP_ADJUST_PRE_EMPHASIS_LANE1_SHIFT  6
 
+#define DP_SYMBOL_ERROR_COUNT_LANE00x210
+# define DP_ERROR_COUNT_BITS_14_8_MASK 0x7f
+# define DP_ERROR_COUNT_VALID  (1 << 7)
+
 #define DP_TEST_REQUEST0x218
 # define DP_TEST_LINK_TRAINING (1 << 0)
 # define DP_TEST_LINK_VIDEO_PATTERN(1 << 1)
@@ -418,6 +425,8 @@
 #define DP_TEST_CRC_G_Y0x242
 #define DP_TEST_CRC_B_CB   0x244
 
+#define DP_PHY_TEST_PATTERN0x248 /* DPCD >= 1.1 */
+
 #define DP_TEST_SINK_MISC  0x246
 # define DP_TEST_CRC_SUPPORTED (1 << 5)
 # define DP_TEST_COUNT_MASK0xf
@@ -447,6 +456,7 @@
 # define DP_SET_POWER_D00x1
 # define DP_SET_POWER_D30x2
 # define DP_SET_POWER_MASK  0x3
+# define DP_SET_POWER_12_MASK  0x7/* DPCD >= 1.2 */
 
 #define DP_EDP_DPCD_REV0x700/* eDP 1.2 */
 # define DP_EDP_11 0x00
-- 
2.1.0

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


[PATCHv7 4/5] devicetree: Add new ANX7814 SlimPort transmitter binding.

2016-01-03 Thread Enric Balletbo i Serra
The ANX7814 is an ultra-low power Full-HD (1080p60) SlimPort transmitter
designed for portable devices.

You can add support to your board with current binding.

Example:

anx7814: anx7814@38 {
compatible = "analogix,anx7814";
reg = <0x38>;
interrupt-parent = <&gpio0>
interrupts = <1 IRQ_TYPE_LEVEL_HIGH>;
pd-gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>;
reset-gpios = <&gpio0 3 GPIO_ACTIVE_HIGH>;
v10-gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>;
port {
anx7814_in: endpoint {
remote-endpoint = <&hdmi0_out>;
};
};
};

Signed-off-by: Enric Balletbo i Serra 
Acked-by: Rob Herring 
---

Changes since last version (requested by Rob Herring)
- Use just "port" instead of ports.
- Add Acked-by: Rob Herring 

Changes since v5:

- Specify how many ports and how many endpoints for each port
- Simplify to just port (dropping ports)
- For cable det use an interrupt instead (to a gpio controller)

 .../devicetree/bindings/video/bridge/anx7814.txt   | 39 ++
 1 file changed, 39 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/video/bridge/anx7814.txt

diff --git a/Documentation/devicetree/bindings/video/bridge/anx7814.txt 
b/Documentation/devicetree/bindings/video/bridge/anx7814.txt
new file mode 100644
index 000..18e77ff
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/bridge/anx7814.txt
@@ -0,0 +1,39 @@
+Analogix ANX7814 SlimPort (Full-HD Transmitter)
+---
+
+The ANX7814 is an ultra-low power Full-HD (1080p60) SlimPort transmitter
+designed for portable devices.
+
+Required properties:
+
+ - compatible  : "analogix,anx7814"
+ - reg : I2C address of the device
+ - interrupt-parent: Should be the phandle of the interrupt controller
+ that services interrupts for this device
+ - interrupts  : Should contain the cable detection interrupt
+ - pd-gpios: Which GPIO to use for power down
+ - reset-gpios : Which GPIO to use for reset
+
+Optional properties:
+
+ - v10-gpios   : Which GPIO to use for V10 control.
+ - Video port for HDMI output, using the DT bindings defined in [1].
+
+[1]: Documentation/devicetree/bindings/media/video-interfaces.txt
+
+Example:
+
+   anx7814: anx7814@38 {
+   compatible = "analogix,anx7814";
+   reg = <0x38>;
+   interrupt-parent = <&gpio0>
+   interrupts = <1 IRQ_TYPE_LEVEL_HIGH>;
+   pd-gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>;
+   reset-gpios = <&gpio0 3 GPIO_ACTIVE_HIGH>;
+   v10-gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>;
+   port {
+   anx7814_in: endpoint {
+   remote-endpoint = <&hdmi0_out>;
+   };
+   };
+   };
-- 
2.1.0

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


[PATCHv7 3/5] of: Add vendor prefix for Analogix Semiconductor, Inc.

2016-01-03 Thread Enric Balletbo i Serra
Analogix Semiconductor develops analog and mixed-signal devices for digital
media and communications interconnect applications.

Signed-off-by: Enric Balletbo i Serra 
Acked-by: Rob Herring 
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 55df1d4..201d3e1 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -21,6 +21,7 @@ amlogic   Amlogic, Inc.
 ampire Ampire Co., Ltd.
 amsAMS AG
 amstaosAMS-Taos Inc.
+analogix   Analogix Semiconductor, Inc.
 apmApplied Micro Circuits Corporation (APM)
 aptina Aptina Imaging
 arasan Arasan Chip Systems
-- 
2.1.0

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


[PATCHv7 5/5] drm: bridge: anx78xx: Add anx78xx driver support by analogix.

2016-01-03 Thread Enric Balletbo i Serra
At the moment it only supports ANX7814.

The ANX7814 is an ultra-low power Full-HD (1080p60) SlimPort transmitter
designed for portable devices. The ANX7814 transforms the HDMI output of
an application processor to MyDP or DisplayPort.

The driver supports HDMI to DP pass-through mode and works using external
adapters that converts MyDP or DisplayPort to HDMI or DVI.

Signed-off-by: Enric Balletbo i Serra 
---

Changes since last version (requested by Dan Carpenter)
- Fix off by one loops
- Change "errcnt" to retry_cnt
- Replace -1 returns as -1 is never a correct error code.
- Add define AUX_CH_BUFFER_SIZE
- Left out the default case in sp_tx_edid_read as is not reachable.
- Change loop to compare memory, use memcmp instead (sp_check_with_pre_edid)
- Remove unneeded else statement and pull the code in one indent level 
(sp_config_video_output)
- Fix sp_hdmi_audio_samplechg_int function as is off by one.
- Fix precendence error in sp_config_audio_output.

Changes since v5:
- Fix auto build test ERROR (anx78xx->bridge.of_node = client->dev.of_node)
- Remove more magic numbers and use DP_ defines from hdmi.h
- Use common dp/hdmi defines instead of redefine it.
- Improve a bit the documentation of the driver.
- Improve debug messages.
- Use devm to request the irq.

 drivers/gpu/drm/bridge/Kconfig   |2 +
 drivers/gpu/drm/bridge/Makefile  |1 +
 drivers/gpu/drm/bridge/anx78xx/Kconfig   |5 +
 drivers/gpu/drm/bridge/anx78xx/Makefile  |4 +
 drivers/gpu/drm/bridge/anx78xx/anx78xx.h |   44 +
 drivers/gpu/drm/bridge/anx78xx/anx78xx_main.c|  334 +++
 drivers/gpu/drm/bridge/anx78xx/slimport_tx_drv.c | 3194 ++
 drivers/gpu/drm/bridge/anx78xx/slimport_tx_drv.h |  110 +
 drivers/gpu/drm/bridge/anx78xx/slimport_tx_reg.h |  737 +
 9 files changed, 4431 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/anx78xx/Kconfig
 create mode 100644 drivers/gpu/drm/bridge/anx78xx/Makefile
 create mode 100644 drivers/gpu/drm/bridge/anx78xx/anx78xx.h
 create mode 100644 drivers/gpu/drm/bridge/anx78xx/anx78xx_main.c
 create mode 100644 drivers/gpu/drm/bridge/anx78xx/slimport_tx_drv.c
 create mode 100644 drivers/gpu/drm/bridge/anx78xx/slimport_tx_drv.h
 create mode 100644 drivers/gpu/drm/bridge/anx78xx/slimport_tx_reg.h

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 639..1d92bc1 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -41,4 +41,6 @@ config DRM_PARADE_PS8622
---help---
  Parade eDP-LVDS bridge chip driver.
 
+source "drivers/gpu/drm/bridge/anx78xx/Kconfig"
+
 endmenu
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index d4e28be..0e9fdb4 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -4,3 +4,4 @@ obj-$(CONFIG_DRM_DW_HDMI) += dw_hdmi.o
 obj-$(CONFIG_DRM_DW_HDMI_AHB_AUDIO) += dw_hdmi-ahb-audio.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
 obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o
+obj-$(CONFIG_DRM_ANX78XX) += anx78xx/
diff --git a/drivers/gpu/drm/bridge/anx78xx/Kconfig 
b/drivers/gpu/drm/bridge/anx78xx/Kconfig
new file mode 100644
index 000..5be362d
--- /dev/null
+++ b/drivers/gpu/drm/bridge/anx78xx/Kconfig
@@ -0,0 +1,5 @@
+config DRM_ANX78XX
+   tristate "Analogix ANX78XX bridge"
+   help
+ ANX78XX is a HD video transmitter chip over micro-USB
+ connector for smartphone device.
diff --git a/drivers/gpu/drm/bridge/anx78xx/Makefile 
b/drivers/gpu/drm/bridge/anx78xx/Makefile
new file mode 100644
index 000..a843733
--- /dev/null
+++ b/drivers/gpu/drm/bridge/anx78xx/Makefile
@@ -0,0 +1,4 @@
+obj-${CONFIG_DRM_ANX78XX} :=  anx78xx.o
+
+anx78xx-y += anx78xx_main.o
+anx78xx-y += slimport_tx_drv.o
diff --git a/drivers/gpu/drm/bridge/anx78xx/anx78xx.h 
b/drivers/gpu/drm/bridge/anx78xx/anx78xx.h
new file mode 100644
index 000..6548918
--- /dev/null
+++ b/drivers/gpu/drm/bridge/anx78xx/anx78xx.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright(c) 2015, Analogix Semiconductor. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __ANX78xx_H
+#define __ANX78xx_H
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+struct anx78xx_platform_data {
+   struct gpio_desc *gpiod_pd;
+   struct gpio_desc *gpiod_reset;
+   struct gpio_desc *gpiod_v10;
+};
+
+struct anx78xx {
+   struct drm_bridge bridge;
+   struct i2c_client *client;
+   struct anx78xx_platform_data *p