Re: [PATCH 08/12] staging: wilc1000: use s8 instead of int8_t

2015-10-02 Thread Chaehyun Lim
On Fri, Oct 2, 2015 at 3:06 PM, Dan Carpenter  wrote:
> On Fri, Oct 02, 2015 at 07:56:28AM +0900, Chaehyun Lim wrote:
>> On Fri, Oct 2, 2015 at 12:40 AM, Dan Carpenter  
>> wrote:
>> > On Thu, Oct 01, 2015 at 10:43:55PM +0900, Chaehyun Lim wrote:
>> >> This patch replaces int8_t with s8 that is a preferred type.
>> >>
>> >
>> > It would be better to just use int.
>>
>> I always appreciate your comment. I've sent a patch before after
>> changing by int, but it was rejected.
>
> Probably your changelog was bad.  Using s8 is hopefully a sign that you
> are doing something very hardware specific.  In this case, it is just a
> index.
>
> Write the changelog.  "The int8_t should just be int.  It's used as an
> index into an array or -1 for not found."
>
Thank you for your comment. I'll make v2 patch after applying your suggestion.

regards
Chaehyun Lim

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


[PATCH V2 01/12] staging: wilc1000: remove wilc_platform.h

2015-10-02 Thread Chaehyun Lim
This patch removes wilc_platform.h file that is not used anywhere.

Signed-off-by: Chaehyun Lim 
---
V2: resend because 08/12 patch is changed.

 drivers/staging/wilc1000/wilc_platform.h | 28 
 1 file changed, 28 deletions(-)
 delete mode 100644 drivers/staging/wilc1000/wilc_platform.h

diff --git a/drivers/staging/wilc1000/wilc_platform.h 
b/drivers/staging/wilc1000/wilc_platform.h
deleted file mode 100644
index 6ec1aa3..000
--- a/drivers/staging/wilc1000/wilc_platform.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef __WILC_platform_H__
-#define __WILC_platform_H__
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include "linux/string.h"
-/**
- *  OS specific types
- ***/
-
-
-
-
-
-
-/***
- *  others
- /
-
-#endif
-- 
2.6.0

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


[PATCH V2 04/12] staging: wilc1000: fix indentation level

2015-10-02 Thread Chaehyun Lim
This patch removes unnecessary block braces and fix indentation.

Signed-off-by: Chaehyun Lim 
---
V2: resend because 08/12 patch is changed.

 drivers/staging/wilc1000/linux_wlan.c | 32 +++-
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index bd83da1..a6642d4 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1967,28 +1967,26 @@ static void __exit exit_wilc_driver(void)
}
}
 
-   {
-   #ifndef WILC_SDIO
-   PRINT_D(INIT_DBG, "SPI unregsiter...\n");
-   spi_unregister_driver(&wilc_bus);
-   #else
-   PRINT_D(INIT_DBG, "SDIO unregsiter...\n");
-   sdio_unregister_driver(&wilc_bus);
-   #endif
+#ifndef WILC_SDIO
+   PRINT_D(INIT_DBG, "SPI unregsiter...\n");
+   spi_unregister_driver(&wilc_bus);
+#else
+   PRINT_D(INIT_DBG, "SDIO unregsiter...\n");
+   sdio_unregister_driver(&wilc_bus);
+#endif
 
-   if (g_linux_wlan != NULL) {
-   kfree(g_linux_wlan);
-   g_linux_wlan = NULL;
-   }
-   printk("Module_exit Done.\n");
+   if (g_linux_wlan != NULL) {
+   kfree(g_linux_wlan);
+   g_linux_wlan = NULL;
+   }
+   printk("Module_exit Done.\n");
 
 #if defined(WILC_DEBUGFS)
-   wilc_debugfs_remove();
+   wilc_debugfs_remove();
 #endif
 
-   linux_wlan_device_detection(0);
-   linux_wlan_device_power(0);
-   }
+   linux_wlan_device_detection(0);
+   linux_wlan_device_power(0);
 }
 module_exit(exit_wilc_driver);
 
-- 
2.6.0

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


[PATCH V2 03/12] staging: wilc1000: remove if defined codes of USE_OLD_SPI_SW

2015-10-02 Thread Chaehyun Lim
This patch removes if defined codes of USE_OLD_SPI_SW.
This macro is deleted because it is commented out.

Signed-off-by: Chaehyun Lim 
---
V2: resend because 08/12 patch is changed.

 drivers/staging/wilc1000/wilc_spi.c | 125 
 1 file changed, 125 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index 0e06fc2..8acf648 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -756,22 +756,6 @@ static int spi_internal_write(u32 adr, u32 dat)
 {
int result;
 
-#if defined USE_OLD_SPI_SW
-   /**
-*  Command
-**/
-   result = spi_cmd(CMD_INTERNAL_WRITE, adr, dat, 4, 0);
-   if (result != N_OK) {
-   PRINT_ER("[wilc spi]: Failed internal write cmd...\n");
-   return 0;
-   }
-
-   result = spi_cmd_rsp(CMD_INTERNAL_WRITE, 0);
-   if (result != N_OK) {
-   PRINT_ER("[wilc spi]: Failed internal write cmd response...\n");
-   }
-#else
-
 #ifdef BIG_ENDIAN
dat = BYTE_SWAP(dat);
 #endif
@@ -780,7 +764,6 @@ static int spi_internal_write(u32 adr, u32 dat)
PRINT_ER("[wilc spi]: Failed internal write cmd...\n");
}
 
-#endif
return result;
 }
 
@@ -788,35 +771,11 @@ static int spi_internal_read(u32 adr, u32 *data)
 {
int result;
 
-#if defined USE_OLD_SPI_SW
-   result = spi_cmd(CMD_INTERNAL_READ, adr, 0, 4, 0);
-   if (result != N_OK) {
-   PRINT_ER("[wilc spi]: Failed internal read cmd...\n");
-   return 0;
-   }
-
-   result = spi_cmd_rsp(CMD_INTERNAL_READ, 0);
-   if (result != N_OK) {
-   PRINT_ER("[wilc spi]: Failed internal read cmd response...\n");
-   return 0;
-   }
-
-   /**
-*  Data
-**/
-   result = spi_data_read((u8 *)data, 4);
-   if (result != N_OK) {
-   PRINT_ER("[wilc spi]: Failed internal read data...\n");
-   return 0;
-   }
-#else
result = spi_cmd_complete(CMD_INTERNAL_READ, adr, (u8 *)data, 4, 0);
if (result != N_OK) {
PRINT_ER("[wilc spi]: Failed internal read cmd...\n");
return 0;
}
-#endif
-
 
 #ifdef BIG_ENDIAN
*data = BYTE_SWAP(*data);
@@ -837,24 +796,6 @@ static int spi_write_reg(u32 addr, u32 data)
u8 cmd = CMD_SINGLE_WRITE;
u8 clockless = 0;
 
-
-#if defined USE_OLD_SPI_SW
-   {
-   result = spi_cmd(cmd, addr, data, 4, 0);
-   if (result != N_OK) {
-   PRINT_ER("[wilc spi]: Failed cmd, write reg 
(%08x)...\n", addr);
-   return 0;
-   }
-
-   result = spi_cmd_rsp(cmd, 0);
-   if (result != N_OK) {
-   PRINT_ER("[wilc spi]: Failed cmd response, write reg 
(%08x)...\n", addr);
-   return 0;
-   }
-
-   return 1;
-   }
-#else
 #ifdef BIG_ENDIAN
data = BYTE_SWAP(data);
 #endif
@@ -870,8 +811,6 @@ static int spi_write_reg(u32 addr, u32 data)
}
 
return result;
-#endif
-
 }
 
 static int spi_write(u32 addr, u8 *buf, u32 size)
@@ -885,28 +824,11 @@ static int spi_write(u32 addr, u8 *buf, u32 size)
if (size <= 4)
return 0;
 
-#if defined USE_OLD_SPI_SW
-   /**
-*  Command
-**/
-   result = spi_cmd(cmd, addr, 0, size, 0);
-   if (result != N_OK) {
-   PRINT_ER("[wilc spi]: Failed cmd, write block (%08x)...\n", 
addr);
-   return 0;
-   }
-
-   result = spi_cmd_rsp(cmd, 0);
-   if (result != N_OK) {
-   PRINT_ER("[wilc spi ]: Failed cmd response, write block 
(%08x)...\n", addr);
-   return 0;
-   }
-#else
result = spi_cmd_complete(cmd, addr, NULL, size, 0);
if (result != N_OK) {
PRINT_ER("[wilc spi]: Failed cmd, write block (%08x)...\n", 
addr);
return 0;
}
-#endif
 
/**
 *  Data
@@ -925,24 +847,6 @@ static int spi_read_reg(u32 addr, u32 *data)
u8 cmd = CMD_SINGLE_READ;
u8 clockless = 0;
 
-#if defined USE_OLD_SPI_SW
-   result = spi_cmd(cmd, addr, 0, 4, 0);
-   if (result != N_OK) {
-   PRINT_ER("[wilc spi]: Failed cmd, read reg (%08x)...\n", addr);
-   return 0;
-   }
-   result = spi_cmd_rsp(cmd, 0);
-   if (result != N_OK) {
-   PRINT_ER("[wilc spi]: Failed cmd response, read reg 
(%08x)...\n", addr);
-   return 0;
-   }
-
-   result = spi_data_read((u8 *)data, 4);
-   if (result != N_OK) {
-   PRINT_ER("[wilc spi]: Failed data read...\n");
-   return 0;
-   }
-#else
if (addr < 0x30) {
/* PRINT_ER("* read addr %d\n\n", addr); */
/* Clockless register*/
@@ -955,8 +859,6 @@ static 

[PATCH V2 02/12] staging: wilc1000: remove commented codes

2015-10-02 Thread Chaehyun Lim
This patch removes commented codes that is not used in this driver.

Signed-off-by: Chaehyun Lim 
---
V2: resend because 08/12 patch is changed.

 drivers/staging/wilc1000/linux_wlan.c | 3 ---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 -
 drivers/staging/wilc1000/wilc_wlan.c  | 4 
 drivers/staging/wilc1000/wilc_wlan_if.h   | 3 ---
 4 files changed, 11 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 701d317..bd83da1 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1967,9 +1967,6 @@ static void __exit exit_wilc_driver(void)
}
}
 
-   /* WILC_WFI_deinit_mon_interface(); */
-
-   /* if(g_linux_wlan->open_ifcs==0) */
{
#ifndef WILC_SDIO
PRINT_D(INIT_DBG, "SPI unregsiter...\n");
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index d3a03c6..4878f12 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -185,7 +185,6 @@ typedef struct {
struct task_struct *txq_thread;
 
unsigned char eth_src_address[NUM_CONCURRENT_IFC][6];
-   /* unsigned char eth_dst_address[6]; */
 
const struct firmware *wilc_firmware;
 
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 428e94f..de70c59 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -142,7 +142,6 @@ static void wilc_wlan_txq_remove(struct txq_entry_t *tqe)
 {
 
wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan;
-   /* unsigned long flags; */
if (tqe == p->txq_head) {
 
p->txq_head = tqe->next;
@@ -848,8 +847,6 @@ static int wilc_wlan_handle_txq(u32 *pu32TxqCount)
i = 0;
sum = 0;
do {
-   /* if ((tqe != NULL) && (i < (8)) && */
-   /* if ((tqe != NULL) && (i < (WILC_VMM_TBL_SIZE-1)) && 
*/
if ((tqe != NULL) && (i < (WILC_VMM_TBL_SIZE - 1)) /* 
reserve last entry to 0 */) {
 
if (tqe->type == WILC_CFG_PKT) {
@@ -972,7 +969,6 @@ static int wilc_wlan_handle_txq(u32 *pu32TxqCount)
 *  Get the entries
 **/
entries = ((reg >> 3) & 0x3f);
-   /* entries = ((reg>>3)&0x2f); */
break;
} else {
release_bus(RELEASE_ALLOW_SLEEP);
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h 
b/drivers/staging/wilc1000/wilc_wlan_if.h
index 7aa317d..75c1ebc 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -10,9 +10,6 @@
 #ifndef WILC_WLAN_IF_H
 #define WILC_WLAN_IF_H
 
-/* #define MEMORY_STATIC */
-/* #define USE_OLD_SPI_SW */
-
 #include 
 #include "linux_wlan_common.h"
 
-- 
2.6.0

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


[PATCH V2 10/12] staging: wilc1000: set_channel: fix data type of s32Error

2015-10-02 Thread Chaehyun Lim
This patch changes data type of s32Error variable from s32 to int
because return type of this function is int.

Signed-off-by: Chaehyun Lim 
---
V2: resend because 08/12 patch is changed.

 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index f98a807..692fef5 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -663,7 +663,7 @@ static int set_channel(struct wiphy *wiphy,
 {
u32 channelnum = 0;
struct wilc_priv *priv;
-   s32 s32Error = 0;
+   int s32Error = 0;
 
priv = wiphy_priv(wiphy);
 
-- 
2.6.0

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


[PATCH V2 09/12] staging: wilc1000: set_channel: remove blank line after open brace

2015-10-02 Thread Chaehyun Lim
This patch removes blank line after open brace '{' found by
checkpatch.pl

CHECK: Blank lines aren't necessary after an open brace '{'
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:664:

Signed-off-by: Chaehyun Lim 
---
V2: resend because 08/12 patch is changed.

 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 3c8c2e1..f98a807 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -661,7 +661,6 @@ static void CfgConnectResult(tenuConnDisconnEvent 
enuConnDisconnEvent,
 static int set_channel(struct wiphy *wiphy,
   struct cfg80211_chan_def *chandef)
 {
-
u32 channelnum = 0;
struct wilc_priv *priv;
s32 s32Error = 0;
-- 
2.6.0

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


[PATCH V2 05/12] staging: wilc1000: remove #if 1 and #endif

2015-10-02 Thread Chaehyun Lim
This patch removes #if 1 and #endif, which is encapsulated
some codes.

Signed-off-by: Chaehyun Lim 
---
V2: resend because 08/12 patch is changed.

 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 755a817..d781003 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -3415,7 +3415,6 @@ int WILC_WFI_update_stats(struct wiphy *wiphy, u32 
pktlen, u8 changed)
struct wilc_priv *priv;
 
priv = wiphy_priv(wiphy);
-#if 1
switch (changed) {
 
case WILC_WFI_RX_PKT:
@@ -3438,7 +3437,6 @@ int WILC_WFI_update_stats(struct wiphy *wiphy, u32 
pktlen, u8 changed)
default:
break;
}
-#endif
return 0;
 }
 
-- 
2.6.0

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


[PATCH V2 12/12] staging: wilc1000: rename u8CurrChannel

2015-10-02 Thread Chaehyun Lim
This patch replaces u8CurrChannel with curr_channel to avoid camelcase.

Signed-off-by: Chaehyun Lim 
---
V2: resend because 08/12 patch is changed.

 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 1b31fec..f1e2d06 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -97,7 +97,7 @@ struct p2p_mgmt_data {
 /*Global variable used to state the current  connected STA channel*/
 u8 u8WLANChannel = INVALID_CHANNEL;
 
-u8 u8CurrChannel;
+u8 curr_channel;
 
 u8 u8P2P_oui[] = {0x50, 0x6f, 0x9A, 0x09};
 u8 u8P2Plocalrandom = 0x01;
@@ -670,7 +670,7 @@ static int set_channel(struct wiphy *wiphy,
channelnum = ieee80211_frequency_to_channel(chandef->chan->center_freq);
PRINT_D(CFG80211_DBG, "Setting channel %d with frequency %d\n", 
channelnum, chandef->chan->center_freq);
 
-   u8CurrChannel = channelnum;
+   curr_channel = channelnum;
result = host_int_set_mac_chnl_num(priv->hWILCWFIDrv, channelnum);
 
if (result != 0)
@@ -996,7 +996,7 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
PRINT_INFO(CFG80211_DBG, "Group encryption value = %s\n Cipher Group = 
%s\n WPA version = %s\n",
   pcgroup_encrypt_val, pccipher_group, pcwpa_version);
 
-   u8CurrChannel = pstrNetworkInfo->u8channel;
+   curr_channel = pstrNetworkInfo->u8channel;
 
if (!pstrWFIDrv->u8P2PConnect) {
u8WLANChannel = pstrNetworkInfo->u8channel;
@@ -2093,7 +2093,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, 
u32 size)
PRINT_D(GENERIC_DBG, "Rx Frame Type:%x\n", buff[FRAME_TYPE_ID]);
 
/*Upper layer is informed that the frame is received on this 
freq*/
-   s32Freq = ieee80211_channel_to_frequency(u8CurrChannel, 
IEEE80211_BAND_2GHZ);
+   s32Freq = ieee80211_channel_to_frequency(curr_channel, 
IEEE80211_BAND_2GHZ);
 
if (ieee80211_is_action(buff[FRAME_TYPE_ID])) {
PRINT_D(GENERIC_DBG, "Rx Action Frame Type: %x %x\n", 
buff[ACTION_SUBTYPE_ID], buff[P2P_PUB_ACTION_SUBTYPE]);
@@ -2273,7 +2273,7 @@ static int remain_on_channel(struct wiphy *wiphy,
return s32Error;
}
 
-   u8CurrChannel = chan->hw_value;
+   curr_channel = chan->hw_value;
 
/*Setting params needed by WILC_WFI_RemainOnChannelExpired()*/
priv->strRemainOnChanParams.pstrListenChan = chan;
@@ -2394,7 +2394,7 @@ static int mgmt_tx(struct wiphy *wiphy,
PRINT_D(GENERIC_DBG, "Setting channel: %d\n", 
chan->hw_value);
host_int_set_mac_chnl_num(priv->hWILCWFIDrv, 
chan->hw_value);
/*Save the current channel after we tune to it*/
-   u8CurrChannel = chan->hw_value;
+   curr_channel = chan->hw_value;
} else if (ieee80211_is_action(mgmt->frame_control))   {
PRINT_D(GENERIC_DBG, "ACTION FRAME:%x\n", 
(u16)mgmt->frame_control);
 
@@ -2409,7 +2409,7 @@ static int mgmt_tx(struct wiphy *wiphy,
PRINT_D(GENERIC_DBG, "Setting channel: 
%d\n", chan->hw_value);

host_int_set_mac_chnl_num(priv->hWILCWFIDrv, chan->hw_value);
/*Save the current channel after we 
tune to it*/
-   u8CurrChannel = chan->hw_value;
+   curr_channel = chan->hw_value;
}
switch (buf[ACTION_SUBTYPE_ID]) {
case GAS_INTIAL_REQ:
-- 
2.6.0

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


[PATCH V2 08/12] staging: wilc1000: use int instead of int8_t

2015-10-02 Thread Chaehyun Lim
This patch replaces int8_t with int.
The int8_t should be int. It's used as an index into an array
or -1 for not found.

Suggested-by: Dan Carpenter 
Signed-off-by: Chaehyun Lim 
---
V2: replaces s8 with int suggested by dan.

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index d781003..3c8c2e1 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -263,9 +263,9 @@ static void clear_duringIP(unsigned long arg)
g_obtainingIP = false;
 }
 
-int8_t is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid)
+int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid)
 {
-   int8_t state = -1;
+   int state = -1;
int i;
 
if (u32LastScannedNtwrksCountShadow == 0) {
@@ -288,7 +288,7 @@ int8_t is_network_in_shadow(tstrNetworkInfo 
*pstrNetworkInfo, void *pUserVoid)
 
 void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, 
void *pJoinParams)
 {
-   int8_t ap_found = is_network_in_shadow(pstrNetworkInfo, pUserVoid);
+   int ap_found = is_network_in_shadow(pstrNetworkInfo, pUserVoid);
u32 ap_index = 0;
u8 rssi_index = 0;
 
-- 
2.6.0

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


[PATCH V2 06/12] staging: wilc1000: remove unnecessary comment

2015-10-02 Thread Chaehyun Lim
This patch removes unnecessary comment.

Signed-off-by: Chaehyun Lim 
---
V2: resend because 08/12 patch is changed.

 drivers/staging/wilc1000/host_interface.c |  6 --
 drivers/staging/wilc1000/host_interface.h | 16 
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 23 ++-
 drivers/staging/wilc1000/wilc_wlan.c  |  2 --
 4 files changed, 14 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index be01de5..49823c1 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -12,9 +12,6 @@ extern u8 connecting;
 extern struct timer_list hDuringIpTimer;
 
 extern u8 g_wilc_initialized;
-/*/
-/* Macros  
 */
-/*/
 
 /* Message types of the Host IF Message Queue*/
 #define HOST_IF_MSG_SCAN0
@@ -63,9 +60,6 @@ extern u8 g_wilc_initialized;
 #define BA_SESSION_DEFAULT_BUFFER_SIZE  16
 #define BA_SESSION_DEFAULT_TIMEOUT  1000
 #define BLOCK_ACK_REQ_SIZE  0x14
-/*/
-/* Type 
Definitions */
-/*/
 
 /*!
  *  @struct cfg_param_attr
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 56ba042..fb5cb8a 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -11,9 +11,6 @@
 #define HOST_INT_H
 
 #include "coreconfigurator.h"
-/*/
-/* Macros  
 */
-/*/
 
 #define IP_ALEN  4
 
@@ -38,10 +35,10 @@
 #define REMOVEKEY  0x2
 #define DEFAULTKEY 0x4
 #define ADDKEY_AP  0x8
-#define MAX_NUM_SCANNED_NETWORKS   100 /* 30   // 
rachel */
+#define MAX_NUM_SCANNED_NETWORKS   100
 #define MAX_NUM_SCANNED_NETWORKS_SHADOW130
-#define MAX_NUM_PROBED_SSID10  /*One more than the number 
of scanned ssids*/
-#define CHANNEL_SCAN_TIME  250 /* 250 */
+#define MAX_NUM_PROBED_SSID10
+#define CHANNEL_SCAN_TIME  250
 
 #define TX_MIC_KEY_LEN 8
 #define RX_MIC_KEY_LEN 8
@@ -56,7 +53,7 @@
 #define PMKID_LEN  16
 #define WILC_MAX_NUM_PMKIDS16
 #define WILC_SUPP_MCS_SET_SIZE 16
-#define WILC_ADD_STA_LENGTH40 /* Not including the rates 
field cause it has variable length*/
+#define WILC_ADD_STA_LENGTH40
 #define SCAN_EVENT_DONE_ABORTED
 #define NUM_CONCURRENT_IFC 2
 
@@ -1202,9 +1199,4 @@ void host_int_freeJoinParams(void *pJoinParams);
 
 s32 host_int_get_statistics(tstrWILC_WFIDrv *hWFIDrv, tstrStatistics 
*pstrStatistics);
 
-/*/
-/* 
 */
-/* EOF 
 */
-/* 
 */
-/*/
 #endif
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 4878f12..b8a0d56 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -8,12 +8,10 @@
 #ifndef WILC_WFI_NETDEVICE
 #define WILC_WFI_NETDEVICE
 
-/* These are the flags in the statusword */
 #define WILC_WFI_RX_INTR 0x0001
 #define WILC_WFI_TX_INTR 0x0002
 
-/* Default timeout period */
-#define WILC_WFI_TIMEOUT 5   /* In jiffies */
+#define WILC_WFI_TIMEOUT 5
 #define WILC_MAX_NUM_PMKIDS  16
 #define PMKID_LEN  16
 #define PMKID_FOUND 1
@@ -24,16 +22,16 @@
 #include 
 #include 
 #include 
-#include  /* kmalloc() */
-#include   /* error codes */
-#in

[PATCH V2 11/12] staging: wilc1000: set_channel: rename s32Error

2015-10-02 Thread Chaehyun Lim
This patch replaces s32Error with result to avoid camelcase.

Signed-off-by: Chaehyun Lim 
---
V2: resend because 08/12 patch is changed.

 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 692fef5..1b31fec 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -663,7 +663,7 @@ static int set_channel(struct wiphy *wiphy,
 {
u32 channelnum = 0;
struct wilc_priv *priv;
-   int s32Error = 0;
+   int result = 0;
 
priv = wiphy_priv(wiphy);
 
@@ -671,12 +671,12 @@ static int set_channel(struct wiphy *wiphy,
PRINT_D(CFG80211_DBG, "Setting channel %d with frequency %d\n", 
channelnum, chandef->chan->center_freq);
 
u8CurrChannel = channelnum;
-   s32Error   = host_int_set_mac_chnl_num(priv->hWILCWFIDrv, channelnum);
+   result = host_int_set_mac_chnl_num(priv->hWILCWFIDrv, channelnum);
 
-   if (s32Error != 0)
+   if (result != 0)
PRINT_ER("Error in setting channel %d\n", channelnum);
 
-   return s32Error;
+   return result;
 }
 
 /**
-- 
2.6.0

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


[PATCH V2 07/12] staging: wilc1000: use ARRAY_SIZE macro

2015-10-02 Thread Chaehyun Lim
This patch uses ARRAY_SIZE macro found by checkpatch.pl

WARNING: Prefer ARRAY_SIZE(wb)
drivers/staging/wilc1000/wilc_spi.c:400
drivers/staging/wilc1000/wilc_spi.c:402

Signed-off-by: Chaehyun Lim 
---
V2: resend because 08/12 patch is changed.

 drivers/staging/wilc1000/wilc_spi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index 8acf648..599508b 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -397,9 +397,9 @@ static int spi_cmd_complete(u8 cmd, u32 adr, u8 *b, u32 sz, 
u8 clockless)
}
 #undef NUM_DUMMY_BYTES
 
-   if (len2 > (sizeof(wb) / sizeof(wb[0]))) {
+   if (len2 > ARRAY_SIZE(wb)) {
PRINT_ER("[wilc spi]: spi buffer size too small (%d) (%zu)\n",
-len2, (sizeof(wb) / sizeof(wb[0])));
+len2, ARRAY_SIZE(wb));
result = N_FAIL;
return result;
}
-- 
2.6.0

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


Re: [PATCH V2 08/12] staging: wilc1000: use int instead of int8_t

2015-10-02 Thread Chaehyun Lim
On Fri, Oct 2, 2015 at 5:02 PM, Arend van Spriel  wrote:
> On 10/02/2015 09:41 AM, Chaehyun Lim wrote:
>>
>> This patch replaces int8_t with int.
>> The int8_t should be int. It's used as an index into an array
>> or -1 for not found.
>
>
> Please consider using bool instead. See my previous emails.

Thank you for your comment.

As said by dan, return value is used for array index in
add_network_to_shadow function.
so it cannot simply changed by bool.

Thanks
Chaehyun Lim

>
> Regards,
> Arend
>
>
>> Suggested-by: Dan Carpenter 
>> Signed-off-by: Chaehyun Lim 
>> ---
>> V2: replaces s8 with int suggested by dan.
>>
>>   drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
>> b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
>> index d781003..3c8c2e1 100644
>> --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
>> +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
>> @@ -263,9 +263,9 @@ static void clear_duringIP(unsigned long arg)
>> g_obtainingIP = false;
>>   }
>>
>> -int8_t is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void
>> *pUserVoid)
>> +int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void
>> *pUserVoid)
>>   {
>> -   int8_t state = -1;
>> +   int state = -1;
>> int i;
>>
>> if (u32LastScannedNtwrksCountShadow == 0) {
>> @@ -288,7 +288,7 @@ int8_t is_network_in_shadow(tstrNetworkInfo
>> *pstrNetworkInfo, void *pUserVoid)
>>
>>   void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void
>> *pUserVoid, void *pJoinParams)
>>   {
>> -   int8_t ap_found = is_network_in_shadow(pstrNetworkInfo,
>> pUserVoid);
>> +   int ap_found = is_network_in_shadow(pstrNetworkInfo, pUserVoid);
>> u32 ap_index = 0;
>> u8 rssi_index = 0;
>>
>>
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] x86: guest: rely on leaf 0x40000001 to detect Hyper-V

2015-10-02 Thread Paolo Bonzini
The specification says that "Microsoft Hv" is actually a vendor ID field
that is only used for reporting and diagnostic purposes.  The actual
field that you need to check is the interface ID that you get in eax
when querying the HYPERV_CPUID_INTERFACE.

Change ms_hyperv_platform to actually do what the specification suggests.
This roughy matches what Windows looks for, though Windows actually
ignores HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS completely.

Signed-off-by: Paolo Bonzini 
---
 arch/x86/kernel/cpu/mshyperv.c | 14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index 381c8b9b3a33..7910e7fd705b 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -116,18 +116,16 @@ static void hv_machine_crash_shutdown(struct pt_regs 
*regs)
 static uint32_t  __init ms_hyperv_platform(void)
 {
u32 eax;
-   u32 hyp_signature[3];
 
if (!boot_cpu_has(X86_FEATURE_HYPERVISOR))
return 0;
 
-   cpuid(HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS,
- &eax, &hyp_signature[0], &hyp_signature[1], &hyp_signature[2]);
-
-   if (eax >= HYPERV_CPUID_MIN &&
-   eax <= HYPERV_CPUID_MAX &&
-   !memcmp("Microsoft Hv", hyp_signature, 12))
-   return HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS;
+   eax = cpuid_eax(HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS);
+   if (eax >= HYPERV_CPUID_MIN && eax <= HYPERV_CPUID_MAX) {
+   eax = cpuid_eax(HYPERV_CPUID_INTERFACE);
+   if (!memcmp(&eax, "Hv#1", sizeof(eax)))
+   return HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS;
+   }
 
return 0;
 }
-- 
2.5.0

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


Re: [PATCH 03/13] staging: unisys: visorhid: rename to visorinput

2015-10-02 Thread Greg KH
On Thu, Oct 01, 2015 at 12:42:00PM -0400, Benjamin Romer wrote:
> From: Tim Sell 
> 
> This visorhid driver provides a Human Interface Device, but is not at all
> using HID, the protocol.  It's a plain input driver, so for clarity, it is
> being renamed to visorinput.
> 
> Signed-off-by: Tim Sell 
> Signed-off-by: Benjamin Romer 
> ---
>  drivers/staging/unisys/Documentation/overview.txt  |  22 +-
>  drivers/staging/unisys/Kconfig |   2 +-
>  drivers/staging/unisys/Makefile|   2 +-
>  drivers/staging/unisys/visorhid/Kconfig|  10 -
>  drivers/staging/unisys/visorhid/Makefile   |   7 -
>  drivers/staging/unisys/visorhid/keyboardchannel.h  |  32 -
>  drivers/staging/unisys/visorhid/mousechannel.h |  33 -
>  drivers/staging/unisys/visorhid/ultrainputreport.h |  74 ---
>  drivers/staging/unisys/visorhid/visorhid.c | 671 
> -
>  drivers/staging/unisys/visorinput/Kconfig  |  10 +
>  drivers/staging/unisys/visorinput/Makefile |   7 +
>  .../staging/unisys/visorinput/keyboardchannel.h|  32 +
>  drivers/staging/unisys/visorinput/mousechannel.h   |  33 +
>  .../staging/unisys/visorinput/ultrainputreport.h   |  74 +++
>  drivers/staging/unisys/visorinput/visorinput.c | 671 
> +
>  15 files changed, 840 insertions(+), 840 deletions(-)
>  delete mode 100644 drivers/staging/unisys/visorhid/Kconfig
>  delete mode 100644 drivers/staging/unisys/visorhid/Makefile
>  delete mode 100644 drivers/staging/unisys/visorhid/keyboardchannel.h
>  delete mode 100644 drivers/staging/unisys/visorhid/mousechannel.h
>  delete mode 100644 drivers/staging/unisys/visorhid/ultrainputreport.h
>  delete mode 100644 drivers/staging/unisys/visorhid/visorhid.c
>  create mode 100644 drivers/staging/unisys/visorinput/Kconfig
>  create mode 100644 drivers/staging/unisys/visorinput/Makefile
>  create mode 100644 drivers/staging/unisys/visorinput/keyboardchannel.h
>  create mode 100644 drivers/staging/unisys/visorinput/mousechannel.h
>  create mode 100644 drivers/staging/unisys/visorinput/ultrainputreport.h
>  create mode 100644 drivers/staging/unisys/visorinput/visorinput.c

Please generate patches with the -M flag, so that it is easy to see that
you are moving files around, not just removing and adding them somewhere
else.

Can you fix this up and resend the series starting with this patch?

thanks,

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


Re: [PATCH] x86: guest: rely on leaf 0x40000001 to detect Hyper-V

2015-10-02 Thread Vitaly Kuznetsov
Paolo Bonzini  writes:

> The specification says that "Microsoft Hv" is actually a vendor ID field
> that is only used for reporting and diagnostic purposes.  The actual
> field that you need to check is the interface ID that you get in eax
> when querying the HYPERV_CPUID_INTERFACE.
>
> Change ms_hyperv_platform to actually do what the specification suggests.
> This roughy matches what Windows looks for, though Windows actually
> ignores HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS completely.
>
> Signed-off-by: Paolo Bonzini 

Reviewed-by: Vitaly Kuznetsov 

(and it seems K. Y. is missing on the CC: list, fixed).

> ---
>  arch/x86/kernel/cpu/mshyperv.c | 14 ++
>  1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
> index 381c8b9b3a33..7910e7fd705b 100644
> --- a/arch/x86/kernel/cpu/mshyperv.c
> +++ b/arch/x86/kernel/cpu/mshyperv.c
> @@ -116,18 +116,16 @@ static void hv_machine_crash_shutdown(struct pt_regs 
> *regs)
>  static uint32_t  __init ms_hyperv_platform(void)
>  {
>   u32 eax;
> - u32 hyp_signature[3];
>
>   if (!boot_cpu_has(X86_FEATURE_HYPERVISOR))
>   return 0;
>
> - cpuid(HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS,
> -   &eax, &hyp_signature[0], &hyp_signature[1], &hyp_signature[2]);
> -
> - if (eax >= HYPERV_CPUID_MIN &&
> - eax <= HYPERV_CPUID_MAX &&
> - !memcmp("Microsoft Hv", hyp_signature, 12))
> - return HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS;
> + eax = cpuid_eax(HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS);
> + if (eax >= HYPERV_CPUID_MIN && eax <= HYPERV_CPUID_MAX) {
> + eax = cpuid_eax(HYPERV_CPUID_INTERFACE);
> + if (!memcmp(&eax, "Hv#1", sizeof(eax)))
> + return HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS;
> + }
>
>   return 0;
>  }

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


Re: [PATCH 08/12] staging: wilc1000: use s8 instead of int8_t

2015-10-02 Thread Dan Carpenter
On Fri, Oct 02, 2015 at 09:45:44AM +0200, Arend van Spriel wrote:
> On 10/01/2015 03:43 PM, Chaehyun Lim wrote:
> >This patch replaces int8_t with s8 that is a preferred type.
> >
> >Signed-off-by: Chaehyun Lim 
> >---
> >  drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> >diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
> >b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> >index d781003..56c97c9 100644
> >--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> >+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> >@@ -263,9 +263,9 @@ static void clear_duringIP(unsigned long arg)
> > g_obtainingIP = false;
> >  }
> >
> >-int8_t is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void 
> >*pUserVoid)
> >+s8 is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid)
> 
> It seems to make more sense to use bool type here.

That doesn't work, but you're right that the function is poorly named.

It could be renamed to get_ap_index_or_something() in a later patch.
Returning directly is also a good idea.

regards,
dan carpenter

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


[PATCH] staging: octeon: Removed trailing whitespaces

2015-10-02 Thread Anjali Menon
Removed trailing whitespace in the blank line to fix
the coding style error detected by checkpatch.pl

ERROR: trailing whitespace

Signed-off-by: Anjali Menon 
---
 drivers/staging/octeon/ethernet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/octeon/ethernet.c 
b/drivers/staging/octeon/ethernet.c
index 71f8123..a0311fa 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -173,7 +173,7 @@ static void cvm_oct_configure_common_hw(void)
 #ifdef __LITTLE_ENDIAN
{
union cvmx_ipd_ctl_status ipd_ctl_status;
-   
+
ipd_ctl_status.u64 = cvmx_read_csr(CVMX_IPD_CTL_STATUS);
ipd_ctl_status.s.pkt_lend = 1;
ipd_ctl_status.s.wqe_lend = 1;
-- 
1.9.1

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


[PATCH 05/10] staging: wilc1000: rename u8ChNum of host_int_set_mac_chnl_num

2015-10-02 Thread Chaehyun Lim
This patch replaces u8ChNum with channel that is second argument of
host_int_set_mac_chnl_num 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 802d87a..133bb2d 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -5315,7 +5315,7 @@ s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, 
u8 *pu8RxPowerLevel,
  *  @date  8 March 2012
  *  @version   1.0
  */
-int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum)
+int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 channel)
 {
int result = 0;
tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
@@ -5329,7 +5329,7 @@ int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, 
u8 u8ChNum)
/* prepare the set channel message */
memset(&msg, 0, sizeof(struct host_if_msg));
msg.id = HOST_IF_MSG_SET_CHANNEL;
-   msg.body.channel_info.u8SetChan = u8ChNum;
+   msg.body.channel_info.u8SetChan = channel;
msg.drvHandler = hWFIDrv;
 
result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 8bbb59e..139dad0 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -819,7 +819,7 @@ s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, 
u8 *pu8RxPowerLevel,
  *  @date  8 March 2012
  *  @version   1.0
  */
-int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum);
+int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 channel);
 
 /**
  *  @brief  gets the current channel index
-- 
2.6.0

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


[PATCH 08/10] staging: wilc1000: rename s32Error in host_int_wait_msg_queue_idle

2015-10-02 Thread Chaehyun Lim
This patch replaces s32Error with result to avoid camelcase.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index e5b7689..69a4e79 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -5344,7 +5344,7 @@ int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *wfi_drv, 
u8 channel)
 
 int host_int_wait_msg_queue_idle(void)
 {
-   int s32Error = 0;
+   int result = 0;
 
struct host_if_msg msg;
 
@@ -5352,16 +5352,16 @@ int host_int_wait_msg_queue_idle(void)
 
memset(&msg, 0, sizeof(struct host_if_msg));
msg.id = HOST_IF_MSG_Q_IDLE;
-   s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
-   if (s32Error) {
+   result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
+   if (result) {
PRINT_ER("wilc mq send fail\n");
-   s32Error = -EINVAL;
+   result = -EINVAL;
}
 
/* wait untill MSG Q is empty */
down(&hWaitResponse);
 
-   return s32Error;
+   return result;
 
 }
 
-- 
2.6.0

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


[PATCH 06/10] staging: wilc1000: rename hWFIDrv of host_int_set_mac_chnl_num

2015-10-02 Thread Chaehyun Lim
This patch replaces hWFIDrv with wfi_drv that is first argument of
host_int_set_mac_chnl_num 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 133bb2d..d23d2dd 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -5315,10 +5315,10 @@ s32 host_int_get_rx_power_level(tstrWILC_WFIDrv 
*hWFIDrv, u8 *pu8RxPowerLevel,
  *  @date  8 March 2012
  *  @version   1.0
  */
-int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 channel)
+int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *wfi_drv, u8 channel)
 {
int result = 0;
-   tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
+   tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)wfi_drv;
struct host_if_msg msg;
 
if (!pstrWFIDrv) {
@@ -5330,7 +5330,7 @@ int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, 
u8 channel)
memset(&msg, 0, sizeof(struct host_if_msg));
msg.id = HOST_IF_MSG_SET_CHANNEL;
msg.body.channel_info.u8SetChan = channel;
-   msg.drvHandler = hWFIDrv;
+   msg.drvHandler = wfi_drv;
 
result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
if (result) {
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 139dad0..edcaf5a 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -819,7 +819,7 @@ s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, 
u8 *pu8RxPowerLevel,
  *  @date  8 March 2012
  *  @version   1.0
  */
-int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 channel);
+int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *wfi_drv, u8 channel);
 
 /**
  *  @brief  gets the current channel index
-- 
2.6.0

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


[PATCH 01/10] staging: wilc1000: fix return type of host_int_set_mac_chnl_num

2015-10-02 Thread Chaehyun Lim
This patch changes return type of host_int_set_mac_chnl_num from s32 to
int. s32Error gets return value from wilc_mq_send function that
has return type of int. It should be changed return type of
host_int_set_mac_chnl_num function by int as well as data type of
s32Error.

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 2cf82b2..c635b84 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -5315,9 +5315,9 @@ s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, 
u8 *pu8RxPowerLevel,
  *  @date  8 March 2012
  *  @version   1.0
  */
-s32 host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum)
+int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum)
 {
-   s32 s32Error = 0;
+   int s32Error = 0;
tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
struct host_if_msg msg;
 
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index fb5cb8a..8bbb59e 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -819,7 +819,7 @@ s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, 
u8 *pu8RxPowerLevel,
  *  @date  8 March 2012
  *  @version   1.0
  */
-s32 host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum);
+int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum);
 
 /**
  *  @brief  gets the current channel index
-- 
2.6.0

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


[PATCH 04/10] staging: wilc1000: replace PRINT_ER with pr_err

2015-10-02 Thread Chaehyun Lim
This patch replaces PRINT_ER with pr_err.
It would be better to use netdev_err, but it cannot use it in this
function, so just use pr_err.

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 566e618..802d87a 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -5322,7 +5322,7 @@ int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, 
u8 u8ChNum)
struct host_if_msg msg;
 
if (!pstrWFIDrv) {
-   PRINT_ER("driver is null\n");
+   pr_err("driver is null\n");
return -EFAULT;
}
 
@@ -5334,7 +5334,7 @@ int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, 
u8 u8ChNum)
 
result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
if (result) {
-   PRINT_ER("wilc mq send fail\n");
+   pr_err("wilc mq send fail\n");
result = -EINVAL;
}
 
-- 
2.6.0

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


[PATCH 10/10] staging: wilc1000: remove blank lines before close brace

2015-10-02 Thread Chaehyun Lim
This patch removes blank lines before close brace '}'

CHECK: Blank lines aren't necessary before a close brace '}'
drivers/staging/wilc1000/host_interface.c:5366:

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 79014ab..e9b58c7 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -5362,7 +5362,6 @@ int host_int_wait_msg_queue_idle(void)
down(&hWaitResponse);
 
return result;
-
 }
 
 s32 host_int_set_wfi_drv_handler(tstrWILC_WFIDrv *u32address)
-- 
2.6.0

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


[PATCH 03/10] staging: wilc1000: rename s32Error in host_int_set_mac_chnl_num

2015-10-02 Thread Chaehyun Lim
This patch replaces s32Error with result to avoid camelcase.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 65bd325..566e618 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -5317,7 +5317,7 @@ s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, 
u8 *pu8RxPowerLevel,
  */
 int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum)
 {
-   int s32Error = 0;
+   int result = 0;
tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
struct host_if_msg msg;
 
@@ -5332,13 +5332,13 @@ int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, 
u8 u8ChNum)
msg.body.channel_info.u8SetChan = u8ChNum;
msg.drvHandler = hWFIDrv;
 
-   s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
-   if (s32Error) {
+   result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
+   if (result) {
PRINT_ER("wilc mq send fail\n");
-   s32Error = -EINVAL;
+   result = -EINVAL;
}
 
-   return s32Error;
+   return result;
 }
 
 
-- 
2.6.0

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


[PATCH 02/10] staging: wilc1000: fix NULL comparison style

2015-10-02 Thread Chaehyun Lim
This patch changes NULL comparison style to use ! operator found by
checkpatch.pl

CHECK: Comparison to NULL could be written "!pstrWFIDrv"
drivers/staging/wilc1000/host_interface.c:5324:

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 c635b84..65bd325 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -5321,7 +5321,7 @@ int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, 
u8 u8ChNum)
tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
struct host_if_msg msg;
 
-   if (pstrWFIDrv == NULL) {
+   if (!pstrWFIDrv) {
PRINT_ER("driver is null\n");
return -EFAULT;
}
-- 
2.6.0

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


[PATCH 09/10] staging: wilc1000: use pr_err in host_int_wait_msg_queue_idle

2015-10-02 Thread Chaehyun Lim
This patch changes PRINT_ER by pr_err.
It would be better to use netdev_err, but it cannot use it in this
function, so just use pr_err.

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 69a4e79..79014ab 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -5354,7 +5354,7 @@ int host_int_wait_msg_queue_idle(void)
msg.id = HOST_IF_MSG_Q_IDLE;
result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
if (result) {
-   PRINT_ER("wilc mq send fail\n");
+   pr_err("wilc mq send fail\n");
result = -EINVAL;
}
 
-- 
2.6.0

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


[PATCH 07/10] staging: wilc1000: fix return type of host_int_wait_msg_queue_idle

2015-10-02 Thread Chaehyun Lim
This patch changes return type of host_int_wait_msg_queue_idle from s32
to int. s32Error gets return value from wilc_mq_send that has return
type of int. It should be changed return type of
host_int_wait_msg_queue_idle by int as well as data type of s32Error.

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 d23d2dd..e5b7689 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -5342,9 +5342,9 @@ int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *wfi_drv, 
u8 channel)
 }
 
 
-s32 host_int_wait_msg_queue_idle(void)
+int host_int_wait_msg_queue_idle(void)
 {
-   s32 s32Error = 0;
+   int s32Error = 0;
 
struct host_if_msg msg;
 
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index edcaf5a..bc8acde 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -648,7 +648,7 @@ s32 host_int_set_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 
*pu8MacAddress);
  *  @date  19 march 2014
  *  @version   1.0
  */
-s32 host_int_wait_msg_queue_idle(void);
+int host_int_wait_msg_queue_idle(void);
 
 /**
  *  @brief  sets a start scan request
-- 
2.6.0

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


[PATCH 2/3] drivers: staging: wilc1000: Remove ineffective code

2015-10-02 Thread Chandra S Gorentla
The value of 'result' is not modified from 0 after initialization.
Hence no need to check it.

Signed-off-by: Chandra S Gorentla 
---
 drivers/staging/wilc1000/wilc_msgqueue.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
b/drivers/staging/wilc1000/wilc_msgqueue.c
index 1b73b63..a9c28ad 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -145,11 +145,6 @@ int wilc_mq_recv(WILC_MsgQueueHandle *pHandle,
down(&pHandle->hSem);
 
/* other non-timeout scenarios */
-   if (result) {
-   PRINT_ER("Non-timeout\n");
-   return result;
-   }
-
if (pHandle->bExiting) {
PRINT_ER("pHandle fail\n");
return -EFAULT;
-- 
2.1.4

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


[PATCH 3/3] drivers: staging: wilc1000: Do not return from function with lock is on

2015-10-02 Thread Chandra S Gorentla
There are a couple of return statements before unlock.  Lock is moved
to a location just before queue manipulation.

Signed-off-by: Chandra S Gorentla 
---
 drivers/staging/wilc1000/wilc_msgqueue.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
b/drivers/staging/wilc1000/wilc_msgqueue.c
index a9c28ad..2fa3792 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -72,8 +72,6 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle,
goto ERRORHANDLER;
}
 
-   spin_lock_irqsave(&pHandle->strCriticalSection, flags);
-
/* construct a new message */
pstrMessage = kmalloc(sizeof(Message), GFP_ATOMIC);
if (!pstrMessage)
@@ -88,6 +86,8 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle,
memcpy(pstrMessage->pvBuffer, pvSendBuffer, u32SendBufferSize);
 
/* add it to the message queue */
+   spin_lock_irqsave(&pHandle->strCriticalSection, flags);
+
if (!pHandle->pstrMessageList) {
pHandle->pstrMessageList  = pstrMessage;
} else {
-- 
2.1.4

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


[PATCH 1/3] drivers: staging: wilc1000: Check for errors before kfree

2015-10-02 Thread Chandra S Gorentla
During the clean-up of the function, it is need to check if
errors occurred, not the memory pointer.

Signed-off-by: Chandra S Gorentla 
---
 drivers/staging/wilc1000/wilc_msgqueue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
b/drivers/staging/wilc1000/wilc_msgqueue.c
index d5ebd6d..1b73b63 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -105,7 +105,7 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle,
 
 ERRORHANDLER:
/* error occured, free any allocations */
-   if (pstrMessage) {
+   if (result) {
kfree(pstrMessage->pvBuffer);
kfree(pstrMessage);
}
-- 
2.1.4

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


Re: [PATCH 1/3] drivers: staging: wilc1000: Check for errors before kfree

2015-10-02 Thread Dan Carpenter
On Fri, Oct 02, 2015 at 06:47:35PM +0530, Chandra S Gorentla wrote:
> During the clean-up of the function, it is need to check if
> errors occurred, not the memory pointer.
>

The bug here is that we have a use after free on the success path.  It
should have been mentioned in the changelog.

Anyway, this patch is buggy.  If result == -EFAULT then it will crash.
Also this patch is really ugly.  There is someone who is going to send a
correct fix (just add a return 0).

This driver usese "do everything" style error handling.  It is a bug
prone anti-pattern because doing everything is more complicated than
doing one thing.  You can easily see it is bug prone, because it made
you introduce a bug, right?

Instead the error handling should look like this:

return 0;

err_free_msg:
kfree(pstrMessage);

return ret;

There are no error paths where we need to free "pstrMessage->pvBuffer"
but if we were to add one it would look like this:

return 0;

err_pvbuffer:
kfree(pstrMessage->pvBuffer);
err_msg:
kfree(pstrMessage);

return ret;

This is a minimal, uncomplicated, no indenting, no if statement way of
unwinding.

regards,
dan carpenter

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


Re: [PATCH 03/13] staging: unisys: visorhid: rename to visorinput

2015-10-02 Thread Ben Romer

On 10/02/2015 05:40 AM, Greg KH wrote:

Please generate patches with the -M flag, so that it is easy to see that
you are moving files around, not just removing and adding them somewhere
else.

Can you fix this up and resend the series starting with this patch?


Will do, do I need to v2 them? Or just resend from there?

-- Ben

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


Re: [PATCH 03/13] staging: unisys: visorhid: rename to visorinput

2015-10-02 Thread Greg KH
On Fri, Oct 02, 2015 at 10:05:34AM -0400, Ben Romer wrote:
> On 10/02/2015 05:40 AM, Greg KH wrote:
> >Please generate patches with the -M flag, so that it is easy to see that
> >you are moving files around, not just removing and adding them somewhere
> >else.
> >
> >Can you fix this up and resend the series starting with this patch?
> 
> Will do, do I need to v2 them? Or just resend from there?

A whole new series is good, as the numbering and base is now different.

thanks,

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


RE: [PATCH] x86: guest: rely on leaf 0x40000001 to detect Hyper-V

2015-10-02 Thread KY Srinivasan


> -Original Message-
> From: Paolo Bonzini [mailto:paolo.bonz...@gmail.com] On Behalf Of Paolo
> Bonzini
> Sent: Friday, October 2, 2015 2:27 AM
> To: linux-ker...@vger.kernel.org
> Cc: KY Srinivasan ; Haiyang Zhang
> ; x...@kernel.org; de...@linuxdriverproject.org;
> alex.william...@redhat.com
> Subject: [PATCH] x86: guest: rely on leaf 0x4001 to detect Hyper-V
> 
> The specification says that "Microsoft Hv" is actually a vendor ID field
> that is only used for reporting and diagnostic purposes.  The actual
> field that you need to check is the interface ID that you get in eax
> when querying the HYPERV_CPUID_INTERFACE.
> 
> Change ms_hyperv_platform to actually do what the specification suggests.
> This roughy matches what Windows looks for, though Windows actually
> ignores HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS completely.
> 
> Signed-off-by: Paolo Bonzini 

Thanks Paolo.

Signed-off-by: K. Y. Srinivasan 
> ---
>  arch/x86/kernel/cpu/mshyperv.c | 14 ++
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/mshyperv.c
> b/arch/x86/kernel/cpu/mshyperv.c
> index 381c8b9b3a33..7910e7fd705b 100644
> --- a/arch/x86/kernel/cpu/mshyperv.c
> +++ b/arch/x86/kernel/cpu/mshyperv.c
> @@ -116,18 +116,16 @@ static void hv_machine_crash_shutdown(struct
> pt_regs *regs)
>  static uint32_t  __init ms_hyperv_platform(void)
>  {
>   u32 eax;
> - u32 hyp_signature[3];
> 
>   if (!boot_cpu_has(X86_FEATURE_HYPERVISOR))
>   return 0;
> 
> - cpuid(HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS,
> -   &eax, &hyp_signature[0], &hyp_signature[1],
> &hyp_signature[2]);
> -
> - if (eax >= HYPERV_CPUID_MIN &&
> - eax <= HYPERV_CPUID_MAX &&
> - !memcmp("Microsoft Hv", hyp_signature, 12))
> - return HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS;
> + eax =
> cpuid_eax(HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS);
> + if (eax >= HYPERV_CPUID_MIN && eax <= HYPERV_CPUID_MAX) {
> + eax = cpuid_eax(HYPERV_CPUID_INTERFACE);
> + if (!memcmp(&eax, "Hv#1", sizeof(eax)))
> + return
> HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS;
> + }
> 
>   return 0;
>  }
> --
> 2.5.0

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


[PATCH] rtlwifi: rtl8821ae: Fix system lockups on boot

2015-10-02 Thread Larry Finger
In commit 1277fa2ab2f9, the code that cleared all interrupt enable
bits before setting them was removed for all PCI drivers. This fixed an
issue that caused TX to be blocked for 3-5 seconds. On some RTL8821AE units,
this change causes soft lockups to occur on boot. For that reason, the portion
of the earlier commit that applied to rtl8821ae is reverted. Kernels 4.1 and
newer are affected.

See http://marc.info/?l=linux-wireless&m=144373370103285&w=2 and
https://bugzilla.opensuse.org/show_bug.cgi?id=944978 for two cases where
this regression affected user systems. Note that this bug does not appear on
any of the developer's setups. For those users whose systems are affected
by the TX blockage, but do not lock up on boot, a module parameter is added
to disable the interrupt clear

Signed-off-by: Larry Finger 
Cc: Stable  [V4.1+]
---

Kalle,

If possible, please send this patch upstream for inclusion in kernel 4.3.
As noted, the bug affects kernels 4.1 and newer.

This patch applies to wireless-drivers-next, and assumes that the patch that
moved all the Realtek drivers into drivers/net/wireless/realtek has NOT been
applied.

Thanks,

Larry
---
 drivers/net/wireless/rtlwifi/pci.h  |  2 ++
 drivers/net/wireless/rtlwifi/rtl8821ae/hw.c | 17 +
 drivers/net/wireless/rtlwifi/rtl8821ae/sw.c |  5 +
 drivers/net/wireless/rtlwifi/wifi.h |  3 +++
 4 files changed, 27 insertions(+)

diff --git a/drivers/net/wireless/rtlwifi/pci.h 
b/drivers/net/wireless/rtlwifi/pci.h
index d4567d1..5da6703 100644
--- a/drivers/net/wireless/rtlwifi/pci.h
+++ b/drivers/net/wireless/rtlwifi/pci.h
@@ -247,6 +247,8 @@ struct rtl_pci {
/* MSI support */
bool msi_support;
bool using_msi;
+   /* interrupt clear before set */
+   bool int_clear;
 };
 
 struct mp_adapter {
diff --git a/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c 
b/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c
index b7f18e21..6e9418e 100644
--- a/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c
@@ -2253,11 +2253,28 @@ void rtl8821ae_set_qos(struct ieee80211_hw *hw, int aci)
}
 }
 
+static void rtl8821ae_clear_interrupt(struct ieee80211_hw *hw)
+{
+   struct rtl_priv *rtlpriv = rtl_priv(hw);
+   u32 tmp = rtl_read_dword(rtlpriv, REG_HISR);
+
+   rtl_write_dword(rtlpriv, REG_HISR, tmp);
+
+   tmp = rtl_read_dword(rtlpriv, REG_HISRE);
+   rtl_write_dword(rtlpriv, REG_HISRE, tmp);
+
+   tmp = rtl_read_dword(rtlpriv, REG_HSISR);
+   rtl_write_dword(rtlpriv, REG_HSISR, tmp);
+}
+
 void rtl8821ae_enable_interrupt(struct ieee80211_hw *hw)
 {
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
 
+   if (!rtlpci->int_clear)
+   rtl8821ae_clear_interrupt(hw);/*clear it here first*/
+
rtl_write_dword(rtlpriv, REG_HIMR, rtlpci->irq_mask[0] & 0x);
rtl_write_dword(rtlpriv, REG_HIMRE, rtlpci->irq_mask[1] & 0x);
rtlpci->irq_enabled = true;
diff --git a/drivers/net/wireless/rtlwifi/rtl8821ae/sw.c 
b/drivers/net/wireless/rtlwifi/rtl8821ae/sw.c
index a4988121..8ee141a 100644
--- a/drivers/net/wireless/rtlwifi/rtl8821ae/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8821ae/sw.c
@@ -96,6 +96,7 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw)
 
rtl8821ae_bt_reg_init(hw);
rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support;
+   rtlpci->int_clear = rtlpriv->cfg->mod_params->int_clear;
rtlpriv->btcoexist.btc_ops = rtl_btc_get_ops_pointer();
 
rtlpriv->dm.dm_initialgain_enable = 1;
@@ -167,6 +168,7 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw)
rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps;
rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps;
rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support;
+   rtlpci->msi_support = rtlpriv->cfg->mod_params->int_clear;
if (rtlpriv->cfg->mod_params->disable_watchdog)
pr_info("watchdog disabled\n");
rtlpriv->psc.reg_fwctrl_lps = 3;
@@ -308,6 +310,7 @@ static struct rtl_mod_params rtl8821ae_mod_params = {
.swctrl_lps = false,
.fwctrl_lps = true,
.msi_support = true,
+   .int_clear = true,
.debug = DBG_EMERG,
.disable_watchdog = 0,
 };
@@ -437,6 +440,7 @@ module_param_named(fwlps, rtl8821ae_mod_params.fwctrl_lps, 
bool, 0444);
 module_param_named(msi, rtl8821ae_mod_params.msi_support, bool, 0444);
 module_param_named(disable_watchdog, rtl8821ae_mod_params.disable_watchdog,
   bool, 0444);
+module_param_named(int_clear, rtl8821ae_mod_params.int_clear, bool, 0444);
 MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n");
 MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n");
 MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n");
@@ -444,6 +448,7 @@ MOD

[PATCH 01/11] staging: unisys: visorhid: rename to visorinput

2015-10-02 Thread Benjamin Romer
From: Tim Sell 

This visorhid driver provides a Human Interface Device, but is not at all
using HID, the protocol.  It's a plain input driver, so for clarity, it is
being renamed to visorinput.

Signed-off-by: Tim Sell 
Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/Documentation/overview.txt  | 22 +++---
 drivers/staging/unisys/Kconfig |  2 +-
 drivers/staging/unisys/Makefile|  2 +-
 drivers/staging/unisys/visorhid/Kconfig| 10 ---
 drivers/staging/unisys/visorhid/Makefile   |  7 --
 drivers/staging/unisys/visorinput/Kconfig  | 10 +++
 drivers/staging/unisys/visorinput/Makefile |  7 ++
 .../{visorhid => visorinput}/keyboardchannel.h |  0
 .../unisys/{visorhid => visorinput}/mousechannel.h |  0
 .../{visorhid => visorinput}/ultrainputreport.h|  0
 .../visorhid.c => visorinput/visorinput.c} | 90 +++---
 11 files changed, 75 insertions(+), 75 deletions(-)
 delete mode 100644 drivers/staging/unisys/visorhid/Kconfig
 delete mode 100644 drivers/staging/unisys/visorhid/Makefile
 create mode 100644 drivers/staging/unisys/visorinput/Kconfig
 create mode 100644 drivers/staging/unisys/visorinput/Makefile
 rename drivers/staging/unisys/{visorhid => visorinput}/keyboardchannel.h (100%)
 rename drivers/staging/unisys/{visorhid => visorinput}/mousechannel.h (100%)
 rename drivers/staging/unisys/{visorhid => visorinput}/ultrainputreport.h 
(100%)
 rename drivers/staging/unisys/{visorhid/visorhid.c => visorinput/visorinput.c} 
(88%)

diff --git a/drivers/staging/unisys/Documentation/overview.txt 
b/drivers/staging/unisys/Documentation/overview.txt
index 25f93f2..c2d8dd4 100644
--- a/drivers/staging/unisys/Documentation/overview.txt
+++ b/drivers/staging/unisys/Documentation/overview.txt
@@ -12,7 +12,7 @@ normally be unsharable, specifically:
 
 * visornic - network interface
 * visorhba - scsi disk adapter
-* visorhid - keyboard and mouse
+* visorinput - keyboard and mouse
 
 These drivers conform to the standard Linux bus/device model described
 within Documentation/driver-model/, and utilize a driver named visorbus to
@@ -44,7 +44,7 @@ NOT covered in this document:
 * Because the s-Par back-end provides a standard EFI framebuffer to each
   guest, the already-existing efifb Linux driver is used to provide guest
   video access. Thus, the only s-Par-unique support that is necessary to
-  provide a guest graphics console are for keyboard and mouse (via visorhid).
+  provide a guest graphics console are for keyboard and mouse (via visorinput).
 
 
 2. Driver Descriptions
@@ -296,13 +296,13 @@ i.e.:
 alias visorbus:8cd5994d-c58e-11da-95a9-00e08161165f visornic
 
 
-2.4. visorhid
--
+2.4. visorinput
+---
 
-The visorhid driver registers with visorbus as the function driver to
+The visorinput driver registers with visorbus as the function driver to
 handle human input devices, specified using the
 SPAR_KEYBOARD_CHANNEL_PROTOCOL_UUID and SPAR_MOUSE_CHANNEL_PROTOCOL_UUID
-types in the visorbus_register_visor_driver() call. visorhid uses
+types in the visorbus_register_visor_driver() call. visorinput uses
 input_register_device() to expose devices of class input
 (e.g., /sys/class/input/) for virtual keyboard and virtual mouse devices.
 A s-Par virtual keyboard device maps 1-to-1 with a Linux input device
@@ -312,7 +312,7 @@ devices created for it: 1 named "visor Wheel", and 1 named 
"visor Mouse".
 By registering as input class devices, modern versions of X will
 automatically find and properly use s-Par virtual keyboard and mouse devices.
 As the s-Par back-end reports keyboard and mouse activity via events on the
-virtual device channel, the visorhid driver delivers the activity to the
+virtual device channel, the visorinput driver delivers the activity to the
 Linux environment by calling input_report_key() and input_report_abs().
 
 You can interact with the guest console using the usyscon Partition Desktop
@@ -322,7 +322,7 @@ usyscon_partitiondesktop-*.rpm, or into a Windows 
environment via
 PartitionDesktop.msi, you will be able to launch a console for your guest
 Linux environment by clicking the console icon in the s-Par web UI.
 
-When compiled as a module, visorhid can be autoloaded by visorbus in
+When compiled as a module, visorinput can be autoloaded by visorbus in
 standard udev/systemd environments, as it includes the modules.alias
 definition:
 
@@ -331,8 +331,8 @@ definition:
 
 i.e.:
 
-alias visorbus:c73416d0-b0b8-44af-b304-9d2ae99f1b3d visorhid
-alias visorbus:addf07d4-94a9-46e2-81c3-61abcdbdbd87 visorhid
+alias visorbus:c73416d0-b0b8-44af-b304-9d2ae99f1b3d visorinput
+alias visorbus:addf07d4-94a9-46e2-81c3-61abcdbdbd87 visorinput
 
 
 3. Minimum Required Driver Set
@@ -352,5 +352,5 @@ the s-Par back-end, which is the default configuration.  
However, for
 configurations where the Linux guest is provided with an SR-IOV NIC
 for example, visornic 

[PATCH 02/11] staging: unisys: visorinput: subsume .h files directly into visorinput.c

2015-10-02 Thread Benjamin Romer
From: Tim Sell 

keyboardchannel.h and mousechannel.h are now included within
visorinput.c directly.

Signed-off-by: Tim Sell 
Signed-off-by: Benjamin Romer 
---
 .../staging/unisys/visorinput/keyboardchannel.h| 32 -
 drivers/staging/unisys/visorinput/mousechannel.h   | 33 --
 drivers/staging/unisys/visorinput/visorinput.c | 19 +++--
 3 files changed, 17 insertions(+), 67 deletions(-)
 delete mode 100644 drivers/staging/unisys/visorinput/keyboardchannel.h
 delete mode 100644 drivers/staging/unisys/visorinput/mousechannel.h

diff --git a/drivers/staging/unisys/visorinput/keyboardchannel.h 
b/drivers/staging/unisys/visorinput/keyboardchannel.h
deleted file mode 100644
index 2ed2602..000
--- a/drivers/staging/unisys/visorinput/keyboardchannel.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 2010 - 2015 UNISYS CORPORATION
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
- * NON INFRINGEMENT.  See the GNU General Public License for more
- * details.
- */
-
-#ifndef __SPAR_KEYBOARDCHANNEL_H__
-#define __SPAR_KEYBOARDCHANNEL_H__
-
-#include 
-#include 
-
-#include "channel.h"
-#include "ultrainputreport.h"
-
-/* {c73416d0-b0b8-44af-b304-9d2ae99f1b3d} */
-#define SPAR_KEYBOARD_CHANNEL_PROTOCOL_UUID\
-   UUID_LE(0xc73416d0, 0xb0b8, 0x44af, \
-   0xb3, 0x4, 0x9d, 0x2a, 0xe9, 0x9f, 0x1b, 0x3d)
-#define SPAR_KEYBOARD_CHANNEL_PROTOCOL_UUID_STR 
"c73416d0-b0b8-44af-b304-9d2ae99f1b3d"
-#define SPAR_KEYBOARD_CHANNEL_PROTOCOL_VERSIONID 1
-#define KEYBOARD_MAXINPUTREPORTS 50
-
-#endif
diff --git a/drivers/staging/unisys/visorinput/mousechannel.h 
b/drivers/staging/unisys/visorinput/mousechannel.h
deleted file mode 100644
index 256477a..000
--- a/drivers/staging/unisys/visorinput/mousechannel.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 2010 - 2015 UNISYS CORPORATION
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
- * NON INFRINGEMENT.  See the GNU General Public License for more
- * details.
- */
-
-#ifndef __SPAR_MOUSECHANNEL_H__
-#define __SPAR_MOUSECHANNEL_H__
-
-#include 
-#include 
-
-#include "channel.h"
-#include "ultrainputreport.h"
-
-/* {addf07d4-94a9-46e2-81c3-61abcdbdbd87} */
-#define SPAR_MOUSE_CHANNEL_PROTOCOL_UUID  \
-   UUID_LE(0xaddf07d4, 0x94a9, 0x46e2, \
-   0x81, 0xc3, 0x61, 0xab, 0xcd, 0xbd, 0xbd, 0x87)
-#define SPAR_MOUSE_CHANNEL_PROTOCOL_UUID_STR \
-   "addf07d4-94a9-46e2-81c3-61abcdbdbd87"
-#define SPAR_MOUSE_CHANNEL_PROTOCOL_VERSIONID 1
-#define MOUSE_MAXINPUTREPORTS 50
-
-#endif
diff --git a/drivers/staging/unisys/visorinput/visorinput.c 
b/drivers/staging/unisys/visorinput/visorinput.c
index e1c328e..4c5b594 100644
--- a/drivers/staging/unisys/visorinput/visorinput.c
+++ b/drivers/staging/unisys/visorinput/visorinput.c
@@ -25,11 +25,26 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
-#include "keyboardchannel.h"
-#include "mousechannel.h"
 #include "version.h"
 #include "visorbus.h"
+#include "channel.h"
+#include "ultrainputreport.h"
+
+/* Keyboard channel {c73416d0-b0b8-44af-b304-9d2ae99f1b3d} */
+#define SPAR_KEYBOARD_CHANNEL_PROTOCOL_UUID\
+   UUID_LE(0xc73416d0, 0xb0b8, 0x44af, \
+   0xb3, 0x4, 0x9d, 0x2a, 0xe9, 0x9f, 0x1b, 0x3d)
+#define SPAR_KEYBOARD_CHANNEL_PROTOCOL_UUID_STR 
"c73416d0-b0b8-44af-b304-9d2ae99f1b3d"
+
+/* Mouse channel {addf07d4-94a9-46e2-81c3-61abcdbdbd87} */
+#define SPAR_MOUSE_CHANNEL_PROTOCOL_UUID  \
+   UUID_LE(0xaddf07d4, 0x94a9, 0x46e2, \
+   0x81, 0xc3, 0x61, 0xab, 0xcd, 0xbd, 0xbd, 0x87)
+#define SPAR_MOUSE_CHANNEL_PROTOCOL_UUID_STR \
+   "addf07d4-94a9-46e2-81c3-61abcdbdbd87"
 
 #define PIXELS_ACROSS_DEFAULT  800
 #define PIXELS_DOWN_DEFAULT600
-- 
2.1.4

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


[PATCH 07/11] staging: unisys: visorinput: comment tweaks - s/gizmo/input node/g

2015-10-02 Thread Benjamin Romer
From: Tim Sell 

Just a simple search and replace in the comments.

Signed-off-by: Tim Sell 
Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/visorinput/visorinput.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/unisys/visorinput/visorinput.c 
b/drivers/staging/unisys/visorinput/visorinput.c
index 976effa..adc2cc9 100644
--- a/drivers/staging/unisys/visorinput/visorinput.c
+++ b/drivers/staging/unisys/visorinput/visorinput.c
@@ -217,8 +217,8 @@ static const unsigned char 
visorkbd_ext_keycode[KEYCODE_TABLE_BYTES] = {
 };
 
 /*
- * register_client_keyboard() initializes and returns a Linux gizmo that we
- * can use to deliver keyboard inputs to Linux.  We of course do this when
+ * register_client_keyboard() initializes and returns a Linux input node that
+ * we can use to deliver keyboard inputs to Linux.  We of course do this when
  * we see keyboard inputs coming in on a keyboard channel.
  */
 static struct input_dev *
@@ -337,7 +337,7 @@ devdata_create(struct visor_device *dev, enum 
visorinput_device_type devtype)
 
/*
 * This is an input device in a client guest partition,
-* so we need to create whatever gizmos are necessary to
+* so we need to create whatever input nodes are necessary to
 * deliver our inputs to the guest OS.
 */
switch (devtype) {
-- 
2.1.4

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


[PATCH 03/11] staging: unisys: visorinput: re-order declarations for consistency

2015-10-02 Thread Benjamin Romer
From: Tim Sell 

In order to be more consistent with kernel conventions used elsewhere,
I have re-ordered declarations in visorinput.c to follow this general
order (where possible):
* #defines
* struct/enum/union declarations
* static declarations (const if possible for all of them)
* forward function declarations where absolutely necessary

Exceptions were made for the static declarations like the driver
declaration, given that it depends on previously-defined callbacks.
So such declarations are at the end of visorinput.c.

Signed-off-by: Tim Sell 
Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/visorinput/visorinput.c | 242 -
 1 file changed, 115 insertions(+), 127 deletions(-)

diff --git a/drivers/staging/unisys/visorinput/visorinput.c 
b/drivers/staging/unisys/visorinput/visorinput.c
index 4c5b594..a15924c 100644
--- a/drivers/staging/unisys/visorinput/visorinput.c
+++ b/drivers/staging/unisys/visorinput/visorinput.c
@@ -49,47 +49,6 @@
 #define PIXELS_ACROSS_DEFAULT  800
 #define PIXELS_DOWN_DEFAULT600
 
-static const uuid_le spar_keyboard_channel_protocol_uuid =
-   SPAR_KEYBOARD_CHANNEL_PROTOCOL_UUID;
-static const uuid_le spar_mouse_channel_protocol_uuid =
-   SPAR_MOUSE_CHANNEL_PROTOCOL_UUID;
-static int visorinput_probe(struct visor_device *dev);
-static void visorinput_remove(struct visor_device *dev);
-static void visorinput_channel_interrupt(struct visor_device *dev);
-static int visorinput_pause(struct visor_device *dev,
- visorbus_state_complete_func complete_func);
-static int visorinput_resume(struct visor_device *dev,
-  visorbus_state_complete_func complete_func);
-static struct input_dev *register_client_keyboard(void);
-static struct input_dev *register_client_mouse(void);
-static void unregister_client_input(struct input_dev *visorinput_dev);
-
-/* GUIDS for all channel types supported by this driver. */
-static struct visor_channeltype_descriptor visorinput_channel_types[] = {
-   { SPAR_KEYBOARD_CHANNEL_PROTOCOL_UUID, "keyboard"},
-   { SPAR_MOUSE_CHANNEL_PROTOCOL_UUID, "mouse"},
-   { NULL_UUID_LE, NULL }
-};
-MODULE_DEVICE_TABLE(visorbus, visorinput_channel_types);
-MODULE_ALIAS("visorbus:" SPAR_MOUSE_CHANNEL_PROTOCOL_UUID_STR);
-MODULE_ALIAS("visorbus:" SPAR_KEYBOARD_CHANNEL_PROTOCOL_UUID_STR);
-
-/** This is used to tell the visor bus driver which types of visor devices
- *  we support, and what functions to call when a visor device that we support
- *  is attached or removed.
- */
-static struct visor_driver visorinput_driver = {
-   .name = "visorinput",
-   .vertag = NULL,
-   .owner = THIS_MODULE,
-   .channel_types = visorinput_channel_types,
-   .probe = visorinput_probe,
-   .remove = visorinput_remove,
-   .channel_interrupt = visorinput_channel_interrupt,
-   .pause = visorinput_pause,
-   .resume = visorinput_resume,
-};
-
 enum visorinput_device_type {
visorinput_keyboard,
visorinput_mouse,
@@ -107,6 +66,11 @@ struct visorinput_devdata {
bool paused;
 };
 
+static const uuid_le spar_keyboard_channel_protocol_uuid =
+   SPAR_KEYBOARD_CHANNEL_PROTOCOL_UUID;
+static const uuid_le spar_mouse_channel_protocol_uuid =
+   SPAR_MOUSE_CHANNEL_PROTOCOL_UUID;
+
 /* Borrowed from drivers/input/keyboard/atakbd.c */
 /* This maps 1-byte scancodes to keycodes. */
 static unsigned char visorkbd_keycode[256] = { /* American layout */
@@ -243,92 +207,6 @@ static unsigned char visorkbd_ext_keycode[256] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 */
 };
 
-static struct visorinput_devdata *
-devdata_create(struct visor_device *dev, enum visorinput_device_type devtype)
-{
-   struct visorinput_devdata *devdata = NULL;
-
-   devdata = kzalloc(sizeof(*devdata), GFP_KERNEL);
-   if (!devdata)
-   return NULL;
-   devdata->dev = dev;
-
-   /* This is an input device in a client guest partition,
-* so we need to create whatever gizmos are necessary to
-* deliver our inputs to the guest OS.
-*/
-   switch (devtype) {
-   case visorinput_keyboard:
-   devdata->visorinput_dev = register_client_keyboard();
-   if (!devdata->visorinput_dev)
-   goto cleanups_register;
-   break;
-   case visorinput_mouse:
-   devdata->visorinput_dev = register_client_mouse();
-   if (!devdata->visorinput_dev)
-   goto cleanups_register;
-   break;
-   }
-
-   init_rwsem(&devdata->lock_visor_dev);
-
-   return devdata;
-
-cleanups_register:
-   kfree(devdata);
-   return NULL;
-}
-
-static int
-visorinput_probe(struct visor_device *dev)
-{
-   struct visorinput_devdata *devdata = NULL;
-   uuid_le guid;
-   enum visorinput_device_type devtype;
-
-   guid = visorchannel_get_uuid(dev->visorchannel);

[PATCH 00/11] staging: unisys: rename visorhid, additional fixes

2015-10-02 Thread Benjamin Romer
This patch series moves the visorhid driver to visorinput, and then fixes
several other issues discovered by Benjamin Tissoires of Red Hat.

Tim Sell (11):
  staging: unisys: visorhid: rename to visorinput
  staging: unisys: visorinput: subsume .h files directly into
visorinput.c
  staging: unisys: visorinput: re-order declarations for consistency
  staging: unisys: visorinput: add INPUT to dependent driver list
  staging: unisys: visorinput: make structs & arrays const where
possible
  staging: unisys: visorinput: correct code comments per kernel
conventions
  staging: unisys: visorinput: comment tweaks - s/gizmo/input node/g
  staging: unisys: visorinput: change input bus type to BUS_VIRTUAL (6)
  staging: unisys: visorinput: register & use input_dev open() and
close()
  staging: unisys: visorinput: remove extraneous mouse logic
  staging: unisys: visorinput: remove extraneous do_key function

 drivers/staging/unisys/Documentation/overview.txt  |  22 +-
 drivers/staging/unisys/Kconfig |   2 +-
 drivers/staging/unisys/Makefile|   2 +-
 drivers/staging/unisys/visorhid/Kconfig|  10 -
 drivers/staging/unisys/visorhid/Makefile   |   7 -
 drivers/staging/unisys/visorhid/keyboardchannel.h  |  32 --
 drivers/staging/unisys/visorhid/mousechannel.h |  33 --
 drivers/staging/unisys/visorinput/Kconfig  |  10 +
 drivers/staging/unisys/visorinput/Makefile |   7 +
 .../{visorhid => visorinput}/ultrainputreport.h|   0
 .../visorhid.c => visorinput/visorinput.c} | 419 -
 11 files changed, 268 insertions(+), 276 deletions(-)
 delete mode 100644 drivers/staging/unisys/visorhid/Kconfig
 delete mode 100644 drivers/staging/unisys/visorhid/Makefile
 delete mode 100644 drivers/staging/unisys/visorhid/keyboardchannel.h
 delete mode 100644 drivers/staging/unisys/visorhid/mousechannel.h
 create mode 100644 drivers/staging/unisys/visorinput/Kconfig
 create mode 100644 drivers/staging/unisys/visorinput/Makefile
 rename drivers/staging/unisys/{visorhid => visorinput}/ultrainputreport.h 
(100%)
 rename drivers/staging/unisys/{visorhid/visorhid.c => visorinput/visorinput.c} 
(65%)

-- 
2.1.4

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


[PATCH 06/11] staging: unisys: visorinput: correct code comments per kernel conventions

2015-10-02 Thread Benjamin Romer
From: Tim Sell 

Multi-line comments were modified to conform to kernel conventions:

/*
 * multi-line
 * comments
 */

doc-test /** */ for some comments was removed.

Signed-off-by: Tim Sell 
Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/visorinput/visorinput.c | 47 --
 1 file changed, 29 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/unisys/visorinput/visorinput.c 
b/drivers/staging/unisys/visorinput/visorinput.c
index 52d01e4..976effa 100644
--- a/drivers/staging/unisys/visorinput/visorinput.c
+++ b/drivers/staging/unisys/visorinput/visorinput.c
@@ -14,7 +14,8 @@
  * details.
  */
 
-/* This driver lives in a generic guest Linux partition, and registers to
+/*
+ * This driver lives in a generic guest Linux partition, and registers to
  * receive keyboard and mouse channels from the visorbus driver.  It reads
  * inputs from such channels, and delivers it to the Linux OS in the
  * standard way the Linux expects for input drivers.
@@ -55,14 +56,14 @@ enum visorinput_device_type {
visorinput_mouse,
 };
 
-/*  This is the private data that we store for each device.
- *  A pointer to this struct is maintained via
- *  dev_get_drvdata() / dev_set_drvdata() for each struct device.
+/*
+ * This is the private data that we store for each device.
+ * A pointer to this struct is maintained via
+ * dev_get_drvdata() / dev_set_drvdata() for each struct device.
  */
 struct visorinput_devdata {
struct visor_device *dev;
-   /** lock for dev */
-   struct rw_semaphore lock_visor_dev;
+   struct rw_semaphore lock_visor_dev; /* lock for dev */
struct input_dev *visorinput_dev;
bool paused;
unsigned int keycode_table_bytes; /* size of following array */
@@ -75,8 +76,10 @@ static const uuid_le spar_keyboard_channel_protocol_uuid =
 static const uuid_le spar_mouse_channel_protocol_uuid =
SPAR_MOUSE_CHANNEL_PROTOCOL_UUID;
 
-/* Borrowed from drivers/input/keyboard/atakbd.c */
-/* This maps 1-byte scancodes to keycodes. */
+/*
+ * Borrowed from drivers/input/keyboard/atakbd.c
+ * This maps 1-byte scancodes to keycodes.
+ */
 static const unsigned char visorkbd_keycode[KEYCODE_TABLE_BYTES] = {
/* American layout */
[0] = KEY_GRAVE,
@@ -193,7 +196,8 @@ static const unsigned char 
visorkbd_keycode[KEYCODE_TABLE_BYTES] = {
[113] = KEY_MUTE
 };
 
-/* This maps the  in extended scancodes of the form "0xE0 " into
+/*
+ * This maps the  in extended scancodes of the form "0xE0 " into
  * keycodes.
  */
 static const unsigned char visorkbd_ext_keycode[KEYCODE_TABLE_BYTES] = {
@@ -212,7 +216,8 @@ static const unsigned char 
visorkbd_ext_keycode[KEYCODE_TABLE_BYTES] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 */
 };
 
-/* register_client_keyboard() initializes and returns a Linux gizmo that we
+/*
+ * register_client_keyboard() initializes and returns a Linux gizmo that we
  * can use to deliver keyboard inputs to Linux.  We of course do this when
  * we see keyboard inputs coming in on a keyboard channel.
  */
@@ -299,7 +304,8 @@ register_client_mouse(void)
return NULL;
}
 
-   /* Sending top-left and bottom-right positions is ABSOLUTELY
+   /*
+* Sending top-left and bottom-right positions is ABSOLUTELY
 * REQUIRED if we want X to move the mouse to the exact points
 * we tell it.  I have NO IDEA why.
 */
@@ -329,7 +335,8 @@ devdata_create(struct visor_device *dev, enum 
visorinput_device_type devtype)
return NULL;
devdata->dev = dev;
 
-   /* This is an input device in a client guest partition,
+   /*
+* This is an input device in a client guest partition,
 * so we need to create whatever gizmos are necessary to
 * deliver our inputs to the guest OS.
 */
@@ -400,9 +407,10 @@ visorinput_remove(struct visor_device *dev)
 
visorbus_disable_channel_interrupts(dev);
 
-   /* due to above, at this time no thread of execution will be
-   * in visorinput_channel_interrupt()
-   */
+   /*
+* due to above, at this time no thread of execution will be
+* in visorinput_channel_interrupt()
+*/
 
down_write(&devdata->lock_visor_dev);
dev_set_drvdata(&dev->device, NULL);
@@ -417,7 +425,8 @@ do_key(struct input_dev *inpt, int keycode, int down)
input_report_key(inpt, keycode, down);
 }
 
-/* Make it so the current locking state of the locking key indicated by
+/*
+ * Make it so the current locking state of the locking key indicated by
  *  is as indicated by  (1=locked, 0=unlocked).
  */
 static void
@@ -457,7 +466,8 @@ handle_locking_key(struct input_dev *visorinput_dev,
}
 }
 
-/*  is either a 1-byte scancode, or an extended 16-bit scancode
+/*
+ *  is either a 1-byte scancode, or an extended 16-bit scancode
  * with 0xE0 in the low byte and the extended scanco

[PATCH 08/11] staging: unisys: visorinput: change input bus type to BUS_VIRTUAL (6)

2015-10-02 Thread Benjamin Romer
From: Tim Sell 

BUS_HOST wasn't really appropriate, so I changed to BUS_VIRTUAL, which is
what virtio uses.

Signed-off-by: Tim Sell 
Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/visorinput/visorinput.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/visorinput/visorinput.c 
b/drivers/staging/unisys/visorinput/visorinput.c
index adc2cc9..d47cc2b 100644
--- a/drivers/staging/unisys/visorinput/visorinput.c
+++ b/drivers/staging/unisys/visorinput/visorinput.c
@@ -234,7 +234,7 @@ register_client_keyboard(unsigned char *keycode_table)
 
visorinput_dev->name = "visor Keyboard";
visorinput_dev->phys = "visorkbd:input0";
-   visorinput_dev->id.bustype = BUS_HOST;
+   visorinput_dev->id.bustype = BUS_VIRTUAL;
visorinput_dev->id.vendor = 0x0001;
visorinput_dev->id.product = 0x0001;
visorinput_dev->id.version = 0x0100;
@@ -277,7 +277,7 @@ register_client_mouse(void)
 
visorinput_dev->name = "visor Mouse";
visorinput_dev->phys = "visormou:input0";
-   visorinput_dev->id.bustype = BUS_HOST;
+   visorinput_dev->id.bustype = BUS_VIRTUAL;
visorinput_dev->id.vendor = 0x0001;
visorinput_dev->id.product = 0x0002;
visorinput_dev->id.version = 0x0100;
-- 
2.1.4

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


[PATCH 10/11] staging: unisys: visorinput: remove extraneous mouse logic

2015-10-02 Thread Benjamin Romer
From: Tim Sell 

Removes a cursor positioning hack that no longer seems to be required.

Signed-off-by: Tim Sell 
Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/visorinput/visorinput.c | 12 
 1 file changed, 12 deletions(-)

diff --git a/drivers/staging/unisys/visorinput/visorinput.c 
b/drivers/staging/unisys/visorinput/visorinput.c
index 103f72b..a002e07 100644
--- a/drivers/staging/unisys/visorinput/visorinput.c
+++ b/drivers/staging/unisys/visorinput/visorinput.c
@@ -350,18 +350,6 @@ register_client_mouse(void *devdata /* opaque on purpose 
*/)
return NULL;
}
 
-   /*
-* Sending top-left and bottom-right positions is ABSOLUTELY
-* REQUIRED if we want X to move the mouse to the exact points
-* we tell it.  I have NO IDEA why.
-*/
-   input_report_abs(visorinput_dev, ABS_X, 0);
-   input_report_abs(visorinput_dev, ABS_Y, 0);
-   input_sync(visorinput_dev);
-   input_report_abs(visorinput_dev, ABS_X, xres - 1);
-   input_report_abs(visorinput_dev, ABS_Y, yres - 1);
-   input_sync(visorinput_dev);
-
input_set_capability(visorinput_dev, EV_REL, REL_WHEEL);
 
return visorinput_dev;
-- 
2.1.4

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


[PATCH 09/11] staging: unisys: visorinput: register & use input_dev open() and close()

2015-10-02 Thread Benjamin Romer
From: Tim Sell 

Registration of visorinput_open() and visorinput_close() for each device
allow us to eliminate unnecessary activity when nobody in user-land
cares.

Signed-off-by: Tim Sell 
Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/visorinput/visorinput.c | 55 +++---
 1 file changed, 50 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/unisys/visorinput/visorinput.c 
b/drivers/staging/unisys/visorinput/visorinput.c
index d47cc2b..103f72b 100644
--- a/drivers/staging/unisys/visorinput/visorinput.c
+++ b/drivers/staging/unisys/visorinput/visorinput.c
@@ -66,6 +66,7 @@ struct visorinput_devdata {
struct rw_semaphore lock_visor_dev; /* lock for dev */
struct input_dev *visorinput_dev;
bool paused;
+   unsigned int opened;
unsigned int keycode_table_bytes; /* size of following array */
/* for keyboard devices: visorkbd_keycode[] + visorkbd_ext_keycode[] */
unsigned char keycode_table[0];
@@ -216,13 +217,50 @@ static const unsigned char 
visorkbd_ext_keycode[KEYCODE_TABLE_BYTES] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 */
 };
 
+static int visorinput_open(struct input_dev *visorinput_dev)
+{
+   struct visorinput_devdata *devdata = input_get_drvdata(visorinput_dev);
+
+   if (!devdata) {
+   pr_err("%s input_get_drvdata(%p) returned NULL\n",
+  __func__, visorinput_dev);
+   return -EINVAL;
+   }
+   devdata->opened++;
+   dev_dbg(&visorinput_dev->dev, "%s opened %d\n", __func__,
+   devdata->opened);
+   if (devdata->opened == 1)
+   visorbus_enable_channel_interrupts(devdata->dev);
+   return 0;
+}
+
+static void visorinput_close(struct input_dev *visorinput_dev)
+{
+   struct visorinput_devdata *devdata = input_get_drvdata(visorinput_dev);
+
+   if (!devdata) {
+   pr_err("%s input_get_drvdata(%p) returned NULL\n",
+  __func__, visorinput_dev);
+   return;
+   }
+   if (devdata->opened) {
+   devdata->opened--;
+   dev_dbg(&visorinput_dev->dev, "%s closed %d\n", __func__,
+   devdata->opened);
+   if (devdata->opened == 0)
+   visorbus_disable_channel_interrupts(devdata->dev);
+   } else
+   dev_err(&visorinput_dev->dev, "%s not open\n", __func__);
+}
+
 /*
  * register_client_keyboard() initializes and returns a Linux input node that
  * we can use to deliver keyboard inputs to Linux.  We of course do this when
  * we see keyboard inputs coming in on a keyboard channel.
  */
 static struct input_dev *
-register_client_keyboard(unsigned char *keycode_table)
+register_client_keyboard(void *devdata,  /* opaque on purpose */
+unsigned char *keycode_table)
 
 {
int i, error;
@@ -255,6 +293,10 @@ register_client_keyboard(unsigned char *keycode_table)
set_bit(keycode_table[i + KEYCODE_TABLE_BYTES],
visorinput_dev->keybit);
 
+   visorinput_dev->open = visorinput_open;
+   visorinput_dev->close = visorinput_close;
+   input_set_drvdata(visorinput_dev, devdata); /* pre input_register! */
+
error = input_register_device(visorinput_dev);
if (error) {
input_free_device(visorinput_dev);
@@ -264,7 +306,7 @@ register_client_keyboard(unsigned char *keycode_table)
 }
 
 static struct input_dev *
-register_client_mouse(void)
+register_client_mouse(void *devdata /* opaque on purpose */)
 {
int error;
struct input_dev *visorinput_dev = NULL;
@@ -298,6 +340,10 @@ register_client_mouse(void)
input_set_abs_params(visorinput_dev, ABS_X, 0, xres, 0, 0);
input_set_abs_params(visorinput_dev, ABS_Y, 0, yres, 0, 0);
 
+   visorinput_dev->open = visorinput_open;
+   visorinput_dev->close = visorinput_close;
+   input_set_drvdata(visorinput_dev, devdata); /* pre input_register! */
+
error = input_register_device(visorinput_dev);
if (error) {
input_free_device(visorinput_dev);
@@ -348,12 +394,12 @@ devdata_create(struct visor_device *dev, enum 
visorinput_device_type devtype)
memcpy(devdata->keycode_table + KEYCODE_TABLE_BYTES,
   visorkbd_ext_keycode, KEYCODE_TABLE_BYTES);
devdata->visorinput_dev = register_client_keyboard
-   (devdata->keycode_table);
+   (devdata, devdata->keycode_table);
if (!devdata->visorinput_dev)
goto cleanups_register;
break;
case visorinput_mouse:
-   devdata->visorinput_dev = register_client_mouse();
+   devdata->visorinput_dev = register_client_mouse(devdata);
if (!devdata->visorinput_dev)
goto cleanups_register;
  

[PATCH 04/11] staging: unisys: visorinput: add INPUT to dependent driver list

2015-10-02 Thread Benjamin Romer
From: Tim Sell 

Add the renamed driver to the Kconfig.

Signed-off-by: Tim Sell 
Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/visorinput/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/unisys/visorinput/Kconfig 
b/drivers/staging/unisys/visorinput/Kconfig
index d83deb4..6baba27 100644
--- a/drivers/staging/unisys/visorinput/Kconfig
+++ b/drivers/staging/unisys/visorinput/Kconfig
@@ -4,7 +4,7 @@
 
 config UNISYS_VISORINPUT
tristate "Unisys visorinput driver"
-   depends on UNISYSSPAR && UNISYS_VISORBUS && FB
+   depends on UNISYSSPAR && UNISYS_VISORBUS && FB && INPUT
---help---
If you say Y here, you will enable the Unisys visorinput driver.
 
-- 
2.1.4

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


[PATCH 11/11] staging: unisys: visorinput: remove extraneous do_key function

2015-10-02 Thread Benjamin Romer
From: Tim Sell 

do_key() is no longer needed.

Signed-off-by: Tim Sell 
Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/visorinput/visorinput.c | 18 ++
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/unisys/visorinput/visorinput.c 
b/drivers/staging/unisys/visorinput/visorinput.c
index a002e07..3a1b24f 100644
--- a/drivers/staging/unisys/visorinput/visorinput.c
+++ b/drivers/staging/unisys/visorinput/visorinput.c
@@ -452,12 +452,6 @@ visorinput_remove(struct visor_device *dev)
kfree(devdata);
 }
 
-static void
-do_key(struct input_dev *inpt, int keycode, int down)
-{
-   input_report_key(inpt, keycode, down);
-}
-
 /*
  * Make it so the current locking state of the locking key indicated by
  *  is as indicated by  (1=locked, 0=unlocked).
@@ -490,9 +484,9 @@ handle_locking_key(struct input_dev *visorinput_dev,
int old_state = (test_bit(led, visorinput_dev->led) != 0);
 
if (old_state != desired_state) {
-   do_key(visorinput_dev, keycode, 1);
+   input_report_key(visorinput_dev, keycode, 1);
input_sync(visorinput_dev);
-   do_key(visorinput_dev, keycode, 0);
+   input_report_key(visorinput_dev, keycode, 0);
input_sync(visorinput_dev);
__change_bit(led, visorinput_dev->led);
}
@@ -563,17 +557,17 @@ visorinput_channel_interrupt(struct visor_device *dev)
keycode = scancode_to_keycode(scancode);
switch (r.activity.action) {
case inputaction_key_down:
-   do_key(visorinput_dev, keycode, 1);
+   input_report_key(visorinput_dev, keycode, 1);
input_sync(visorinput_dev);
break;
case inputaction_key_up:
-   do_key(visorinput_dev, keycode, 0);
+   input_report_key(visorinput_dev, keycode, 0);
input_sync(visorinput_dev);
break;
case inputaction_key_down_up:
-   do_key(visorinput_dev, keycode, 1);
+   input_report_key(visorinput_dev, keycode, 1);
input_sync(visorinput_dev);
-   do_key(visorinput_dev, keycode, 0);
+   input_report_key(visorinput_dev, keycode, 0);
input_sync(visorinput_dev);
break;
case inputaction_set_locking_key_state:
-- 
2.1.4

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


[PATCH 05/11] staging: unisys: visorinput: make structs & arrays const where possible

2015-10-02 Thread Benjamin Romer
From: Tim Sell 

This also gave me a warning with the assignment:

visorinput_dev->keycode = visorkbd_keycode;

because input_dev->keycode is NOT static but visorkbd_keycode now is, so
I went ahead and also added logic to stash away non-static copies of
visorkbd_keycode[] and visorkbd_ext_keycode[] within visorinput_devdata,
and use the copy to assign to visorinput_dev->keycode.  This change is
also technically required, because user-space can remap keys, and we
don't want this to be shared with the other keyboard devices running on
the same system.

Signed-off-by: Tim Sell 
Signed-off-by: Benjamin Romer 
---
 drivers/staging/unisys/visorinput/visorinput.c | 42 ++
 1 file changed, 29 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/unisys/visorinput/visorinput.c 
b/drivers/staging/unisys/visorinput/visorinput.c
index a15924c..52d01e4 100644
--- a/drivers/staging/unisys/visorinput/visorinput.c
+++ b/drivers/staging/unisys/visorinput/visorinput.c
@@ -48,6 +48,7 @@
 
 #define PIXELS_ACROSS_DEFAULT  800
 #define PIXELS_DOWN_DEFAULT600
+#define KEYCODE_TABLE_BYTES256
 
 enum visorinput_device_type {
visorinput_keyboard,
@@ -64,6 +65,9 @@ struct visorinput_devdata {
struct rw_semaphore lock_visor_dev;
struct input_dev *visorinput_dev;
bool paused;
+   unsigned int keycode_table_bytes; /* size of following array */
+   /* for keyboard devices: visorkbd_keycode[] + visorkbd_ext_keycode[] */
+   unsigned char keycode_table[0];
 };
 
 static const uuid_le spar_keyboard_channel_protocol_uuid =
@@ -73,7 +77,8 @@ static const uuid_le spar_mouse_channel_protocol_uuid =
 
 /* Borrowed from drivers/input/keyboard/atakbd.c */
 /* This maps 1-byte scancodes to keycodes. */
-static unsigned char visorkbd_keycode[256] = { /* American layout */
+static const unsigned char visorkbd_keycode[KEYCODE_TABLE_BYTES] = {
+   /* American layout */
[0] = KEY_GRAVE,
[1] = KEY_ESC,
[2] = KEY_1,
@@ -191,7 +196,7 @@ static unsigned char visorkbd_keycode[256] = {  /* 
American layout */
 /* This maps the  in extended scancodes of the form "0xE0 " into
  * keycodes.
  */
-static unsigned char visorkbd_ext_keycode[256] = {
+static const unsigned char visorkbd_ext_keycode[KEYCODE_TABLE_BYTES] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00 */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 */
0, 0, 0, 0, KEY_KPENTER, KEY_RIGHTCTRL, 0, 0,   /* 0x18 */
@@ -212,7 +217,8 @@ static unsigned char visorkbd_ext_keycode[256] = {
  * we see keyboard inputs coming in on a keyboard channel.
  */
 static struct input_dev *
-register_client_keyboard(void)
+register_client_keyboard(unsigned char *keycode_table)
+
 {
int i, error;
struct input_dev *visorinput_dev = NULL;
@@ -234,15 +240,15 @@ register_client_keyboard(void)
visorinput_dev->ledbit[0] = BIT_MASK(LED_CAPSL) |
BIT_MASK(LED_SCROLLL) |
BIT_MASK(LED_NUML);
-   visorinput_dev->keycode = visorkbd_keycode;
-   visorinput_dev->keycodesize = sizeof(unsigned char);
-   visorinput_dev->keycodemax = ARRAY_SIZE(visorkbd_keycode);
-
-   for (i = 1; i < ARRAY_SIZE(visorkbd_keycode); i++)
-   set_bit(visorkbd_keycode[i], visorinput_dev->keybit);
+   visorinput_dev->keycode = keycode_table;
+   visorinput_dev->keycodesize = 1; /* sizeof(unsigned char) */
+   visorinput_dev->keycodemax = KEYCODE_TABLE_BYTES;
 
-   for (i = 1; i < ARRAY_SIZE(visorkbd_ext_keycode); i++)
-   set_bit(visorkbd_ext_keycode[i], visorinput_dev->keybit);
+   for (i = 1; i < visorinput_dev->keycodemax; i++)
+   set_bit(keycode_table[i], visorinput_dev->keybit);
+   for (i = 1; i < visorinput_dev->keycodemax; i++)
+   set_bit(keycode_table[i + KEYCODE_TABLE_BYTES],
+   visorinput_dev->keybit);
 
error = input_register_device(visorinput_dev);
if (error) {
@@ -313,8 +319,12 @@ static struct visorinput_devdata *
 devdata_create(struct visor_device *dev, enum visorinput_device_type devtype)
 {
struct visorinput_devdata *devdata = NULL;
+   unsigned int extra_bytes = 0;
 
-   devdata = kzalloc(sizeof(*devdata), GFP_KERNEL);
+   if (devtype == visorinput_keyboard)
+   /* allocate room for devdata->keycode_table, filled in below */
+   extra_bytes = KEYCODE_TABLE_BYTES * 2;
+   devdata = kzalloc(sizeof(*devdata) + extra_bytes, GFP_KERNEL);
if (!devdata)
return NULL;
devdata->dev = dev;
@@ -325,7 +335,13 @@ devdata_create(struct visor_device *dev, enum 
visorinput_device_type devtype)
 */
switch (devtype) {
case visorinput_keyboard:
-   devdata->visorinput_dev = register_client_keyboard();
+   devdata->keycod

RE: [PATCH] x86: guest: rely on leaf 0x40000001 to detect Hyper-V

2015-10-02 Thread Thomas Gleixner
On Fri, 2 Oct 2015, KY Srinivasan wrote:
> > Change ms_hyperv_platform to actually do what the specification suggests.
> > This roughy matches what Windows looks for, though Windows actually
> > ignores HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS completely.
> > 
> > Signed-off-by: Paolo Bonzini 
> 
> Thanks Paolo.
> 
> Signed-off-by: K. Y. Srinivasan 

Does that mean Acked-by or Reviewed-by? SOB certainly does not apply
here.

Thanks,

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


RE: [PATCH] x86: guest: rely on leaf 0x40000001 to detect Hyper-V

2015-10-02 Thread KY Srinivasan


> -Original Message-
> From: Thomas Gleixner [mailto:t...@linutronix.de]
> Sent: Friday, October 2, 2015 1:07 PM
> To: KY Srinivasan 
> Cc: Paolo Bonzini ; linux-ker...@vger.kernel.org;
> Haiyang Zhang ; x...@kernel.org;
> de...@linuxdriverproject.org; alex.william...@redhat.com
> Subject: RE: [PATCH] x86: guest: rely on leaf 0x4001 to detect Hyper-V
> 
> On Fri, 2 Oct 2015, KY Srinivasan wrote:
> > > Change ms_hyperv_platform to actually do what the specification
> suggests.
> > > This roughy matches what Windows looks for, though Windows actually
> > > ignores HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS completely.
> > >
> > > Signed-off-by: Paolo Bonzini 
> >
> > Thanks Paolo.
> >
> > Signed-off-by: K. Y. Srinivasan 
> 
> Does that mean Acked-by or Reviewed-by? SOB certainly does not apply
> here.
Thomas,

I have reviewed the patch and am acking this change.

Regards,

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


[PATCH] staging/lustre: Make nrs_policy_get_info_locked() static

2015-10-02 Thread Rocco Folino
This patch fixes the warning generated by sparse: "symbol 
'nrs_policy_get_info_locked' was not
declared. Should it be static?" by declaring the function static.

Signed-off-by: Rocco Folino 
---
 drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c 
b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
index 3a212b4be9a1..6cf9b92c7c05 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
@@ -452,7 +452,7 @@ static const char *nrs_state2str(enum ptlrpc_nrs_pol_state 
state)
  * \param[in] policy The policy
  * \param[out] info  Holds returned status information
  */
-void nrs_policy_get_info_locked(struct ptlrpc_nrs_policy *policy,
+static void nrs_policy_get_info_locked(struct ptlrpc_nrs_policy *policy,
struct ptlrpc_nrs_pol_info *info)
 {
LASSERT(policy != NULL);
--
2.4.3

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


Re: [PATCH] staging/lustre: Make nrs_policy_get_info_locked() static

2015-10-02 Thread Arnd Bergmann
On Friday 02 October 2015 23:54:26 Rocco Folino wrote:
> This patch fixes the warning generated by sparse: "symbol 
> 'nrs_policy_get_info_locked' was not
> declared. Should it be static?" by declaring the function static.
> 
> Signed-off-by: Rocco Folino 
> 

Reviewed-by: Arnd Bergmann 

This probably triggered a sparse warning after the unused declaration was
removed in my "staging/lustre: remove lots of dead code".
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging/lustre: Make nrs_policy_get_info_locked() static

2015-10-02 Thread kbuild test robot
Hi Rocco,

[auto build test results on v4.3-rc3 -- if it's inappropriate base, please 
ignore]

config: sparc64-allyesconfig (attached as .config)
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc64 

All error/warnings (new ones prefixed by >>):

>> drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c:456:13: error: static 
>> declaration of 'nrs_policy_get_info_locked' follows non-static declaration
static void nrs_policy_get_info_locked(struct ptlrpc_nrs_policy *policy,
^
   In file included from 
drivers/staging/lustre/lustre/ptlrpc/../include/lustre_lib.h:64:0,
from 
drivers/staging/lustre/lustre/ptlrpc/../include/obd.h:52,
from drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c:40:
   drivers/staging/lustre/lustre/ptlrpc/../include/lustre_net.h:1542:6: note: 
previous declaration of 'nrs_policy_get_info_locked' was here
void nrs_policy_get_info_locked(struct ptlrpc_nrs_policy *policy,
 ^

vim +/nrs_policy_get_info_locked +456 
drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c

   450   *
   451   * Information is copied in \a info.
   452   *
   453   * \param[in] policy The policy
   454   * \param[out] info  Holds returned status information
   455   */
 > 456  static void nrs_policy_get_info_locked(struct ptlrpc_nrs_policy *policy,
   457  struct ptlrpc_nrs_pol_info *info)
   458  {
   459  LASSERT(policy != NULL);

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


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


Re: [PATCH] staging/lustre: Make nrs_policy_get_info_locked() static

2015-10-02 Thread Arnd Bergmann
On Saturday 03 October 2015 06:10:12 kbuild test robot wrote:
> >> drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c:456:13: error: static 
> >> declaration of 'nrs_policy_get_info_locked' follows non-static declaration
> static void nrs_policy_get_info_locked(struct ptlrpc_nrs_policy *policy,
> ^
>In file included from 
> drivers/staging/lustre/lustre/ptlrpc/../include/lustre_lib.h:64:0,
> from 
> drivers/staging/lustre/lustre/ptlrpc/../include/obd.h:52,
> from 
> drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c:40:
>drivers/staging/lustre/lustre/ptlrpc/../include/lustre_net.h:1542:6: note: 
> previous declaration of 'nrs_policy_get_info_locked' was here
> void nrs_policy_get_info_locked(struct ptlrpc_nrs_policy *policy,
>  ^
> 

fwiw, the patch should be fine on staging-testing, just not on mainline at the 
moment.

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


Bosto 14WA graphics tablet driver

2015-10-02 Thread Leslie Viljoen
Hi!

I'm one of the authors of a driver for a Bosto 14WA graphics tablet
that I'd like to submit to the kernel:
https://github.com/lesliev/bosto_14wa

I've no idea of the quality of it so I suppose it had to go into "staging"?
It was hacked together from an older driver for a similar chip.

I'm busy reading all the guides and cloning the kernel source tree so
it may be I still have quite a lot of work to do to get it into an
acceptable state.

http://lxr.linux.no/source/Documentation/CodingStyle is not working
for me right now.

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


[PATCH 02/14] staging: comedi: multiq3: tidy up multiq3_ai_insn_read()

2015-10-02 Thread H Hartley Sweeten
For aesthetics, use the proper symbol when reading the A/D data register
to get the 16-bit sample data.

Use the comedi_offset_munge() to do the 2's complement to offset binary
munging of the sample data.

Tidy up the function a bit.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/multiq3.c | 24 ++--
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/comedi/drivers/multiq3.c 
b/drivers/staging/comedi/drivers/multiq3.c
index 42ef1a6..fabc321 100644
--- a/drivers/staging/comedi/drivers/multiq3.c
+++ b/drivers/staging/comedi/drivers/multiq3.c
@@ -100,14 +100,14 @@ static int multiq3_ai_status(struct comedi_device *dev,
 
 static int multiq3_ai_insn_read(struct comedi_device *dev,
struct comedi_subdevice *s,
-   struct comedi_insn *insn, unsigned int *data)
+   struct comedi_insn *insn,
+   unsigned int *data)
 {
-   int n;
-   int chan;
-   unsigned int hi, lo;
+   unsigned int chan = CR_CHAN(insn->chanspec);
+   unsigned int val;
int ret;
+   int i;
 
-   chan = CR_CHAN(insn->chanspec);
outw(MULTIQ3_CONTROL_MUST | MULTIQ3_AD_MUX_EN | (chan << 3),
 dev->iobase + MULTIQ3_CONTROL);
 
@@ -116,7 +116,7 @@ static int multiq3_ai_insn_read(struct comedi_device *dev,
if (ret)
return ret;
 
-   for (n = 0; n < insn->n; n++) {
+   for (i = 0; i < insn->n; i++) {
outw(0, dev->iobase + MULTIQ3_AD_CS);
 
ret = comedi_timeout(dev, s, insn, multiq3_ai_status,
@@ -124,12 +124,16 @@ static int multiq3_ai_insn_read(struct comedi_device *dev,
if (ret)
return ret;
 
-   hi = inb(dev->iobase + MULTIQ3_AD_CS);
-   lo = inb(dev->iobase + MULTIQ3_AD_CS);
-   data[n] = (((hi << 8) | lo) + 0x1000) & 0x1fff;
+   /* get a 16-bit sample; mask it to the subdevice resolution */
+   val = inb(dev->iobase + MULTIQ3_AD_DATA) << 8;
+   val |= inb(dev->iobase + MULTIQ3_AD_DATA);
+   val &= s->maxdata;
+
+   /* munge the 2's complement value to offset binary */
+   data[i] = comedi_offset_munge(s, val);
}
 
-   return n;
+   return insn->n;
 }
 
 static int multiq3_ao_insn_write(struct comedi_device *dev,
-- 
2.5.1

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


[PATCH 00/14] staging: comedi: multiq3: cleaup driver

2015-10-02 Thread H Hartley Sweeten
Cleanup this driver a bit and add support for the 8254 counter/timer.

H Hartley Sweeten (14):
  staging: comedi: multiq3: tidy up multi-line comments
  staging: comedi: multiq3: tidy up multiq3_ai_insn_read()
  staging: comedi: multiq3: tidy up subdevice init
  staging: comedi: multiq3: tidy up register map defines
  staging: comedi: multiq3: tidy up status register bit defines
  staging: comedi: multiq3: introduce multiq3_set_ctrl()
  staging: comedi: multiq3: tidy up control register bit defines
  staging: comedi: multiq3: document the encoder chip commands
  staging: comedi: multiq3: allow user to reset encoder channels
  staging: comedi: multiq3: remove unnecessary define
  staging: comedi: multiq3: tidy up multiq3_encoder_insn_read()
  staging: comedi: multiq3: remove unnecessary include
  staging: comedi: multiq3: add 8254 counter/timer subdevice support
  staging: comedi: multiq3: update the MODULE_DESCRIPTION

 drivers/staging/comedi/drivers/multiq3.c | 492 +--
 1 file changed, 337 insertions(+), 155 deletions(-)

-- 
2.5.1

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


[PATCH 01/14] staging: comedi: multiq3: tidy up multi-line comments

2015-10-02 Thread H Hartley Sweeten
Reformat the multi-line comments in the kernel CodingStyle.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/multiq3.c | 54 +++-
 1 file changed, 32 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/comedi/drivers/multiq3.c 
b/drivers/staging/comedi/drivers/multiq3.c
index 8471219..42ef1a6 100644
--- a/drivers/staging/comedi/drivers/multiq3.c
+++ b/drivers/staging/comedi/drivers/multiq3.c
@@ -1,28 +1,38 @@
 /*
-   comedi/drivers/multiq3.c
-   Hardware driver for Quanser Consulting MultiQ-3 board
-
-   COMEDI - Linux Control and Measurement Device Interface
-   Copyright (C) 1999 Anders Blomdell 
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   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.
+ * multiq3.c
+ * Hardware driver for Quanser Consulting MultiQ-3 board
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 1999 Anders Blomdell 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
  */
-/*
-Driver: multiq3
-Description: Quanser Consulting MultiQ-3
-Author: Anders Blomdell 
-Status: works
-Devices: [Quanser Consulting] MultiQ-3 (multiq3)
 
-*/
+/*
+ * Driver: multiq3
+ * Description: Quanser Consulting MultiQ-3
+ * Devices: [Quanser Consulting] MultiQ-3 (multiq3)
+ * Author: Anders Blomdell 
+ * Status: works
+ *
+ * Configuration Options:
+ *  [0] - I/O port base address
+ *  [1] - IRQ (not used)
+ *  [2] - Number of optional encoder chips installed on board
+ *   0 = none
+ *   1 = 2 inputs (Model -2E)
+ *   2 = 4 inputs (Model -4E)
+ *   3 = 6 inputs (Model -6E)
+ *   4 = 8 inputs (Model -8E)
+ */
 
 #include 
 #include 
-- 
2.5.1

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


[PATCH 04/14] staging: comedi: multiq3: tidy up register map defines

2015-10-02 Thread H Hartley Sweeten
For auesthetics, rename the register map defines. Convert the offset
values to hex and add some whitespace.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/multiq3.c | 70 
 1 file changed, 35 insertions(+), 35 deletions(-)

diff --git a/drivers/staging/comedi/drivers/multiq3.c 
b/drivers/staging/comedi/drivers/multiq3.c
index 1cfd7fa..bf4ab32 100644
--- a/drivers/staging/comedi/drivers/multiq3.c
+++ b/drivers/staging/comedi/drivers/multiq3.c
@@ -39,18 +39,18 @@
 #include "../comedidev.h"
 
 /*
- * MULTIQ-3 port offsets
+ * Register map
  */
-#define MULTIQ3_DIGIN_PORT 0
-#define MULTIQ3_DIGOUT_PORT 0
-#define MULTIQ3_DAC_DATA 2
-#define MULTIQ3_AD_DATA 4
-#define MULTIQ3_AD_CS 4
-#define MULTIQ3_STATUS 6
-#define MULTIQ3_CONTROL 6
-#define MULTIQ3_CLK_DATA 8
-#define MULTIQ3_ENC_DATA 12
-#define MULTIQ3_ENC_CONTROL 14
+#define MULTIQ3_DI_REG 0x00
+#define MULTIQ3_DO_REG 0x00
+#define MULTIQ3_AO_REG 0x02
+#define MULTIQ3_AI_REG 0x04
+#define MULTIQ3_AI_CONV_REG0x04
+#define MULTIQ3_STATUS_REG 0x06
+#define MULTIQ3_CTRL_REG   0x06
+#define MULTIQ3_CLK_REG0x08
+#define MULTIQ3_ENC_DATA_REG   0x0c
+#define MULTIQ3_ENC_CTRL_REG   0x0e
 
 /*
  * flags for CONTROL register
@@ -92,7 +92,7 @@ static int multiq3_ai_status(struct comedi_device *dev,
 {
unsigned int status;
 
-   status = inw(dev->iobase + MULTIQ3_STATUS);
+   status = inw(dev->iobase + MULTIQ3_STATUS_REG);
if (status & context)
return 0;
return -EBUSY;
@@ -109,7 +109,7 @@ static int multiq3_ai_insn_read(struct comedi_device *dev,
int i;
 
outw(MULTIQ3_CONTROL_MUST | MULTIQ3_AD_MUX_EN | (chan << 3),
-dev->iobase + MULTIQ3_CONTROL);
+dev->iobase + MULTIQ3_CTRL_REG);
 
ret = comedi_timeout(dev, s, insn, multiq3_ai_status,
 MULTIQ3_STATUS_EOC);
@@ -117,7 +117,7 @@ static int multiq3_ai_insn_read(struct comedi_device *dev,
return ret;
 
for (i = 0; i < insn->n; i++) {
-   outw(0, dev->iobase + MULTIQ3_AD_CS);
+   outw(0, dev->iobase + MULTIQ3_AI_CONV_REG);
 
ret = comedi_timeout(dev, s, insn, multiq3_ai_status,
 MULTIQ3_STATUS_EOC_I);
@@ -125,8 +125,8 @@ static int multiq3_ai_insn_read(struct comedi_device *dev,
return ret;
 
/* get a 16-bit sample; mask it to the subdevice resolution */
-   val = inb(dev->iobase + MULTIQ3_AD_DATA) << 8;
-   val |= inb(dev->iobase + MULTIQ3_AD_DATA);
+   val = inb(dev->iobase + MULTIQ3_AI_REG) << 8;
+   val |= inb(dev->iobase + MULTIQ3_AI_REG);
val &= s->maxdata;
 
/* munge the 2's complement value to offset binary */
@@ -148,9 +148,9 @@ static int multiq3_ao_insn_write(struct comedi_device *dev,
for (i = 0; i < insn->n; i++) {
val = data[i];
outw(MULTIQ3_CONTROL_MUST | MULTIQ3_DA_LOAD | chan,
-dev->iobase + MULTIQ3_CONTROL);
-   outw(val, dev->iobase + MULTIQ3_DAC_DATA);
-   outw(MULTIQ3_CONTROL_MUST, dev->iobase + MULTIQ3_CONTROL);
+dev->iobase + MULTIQ3_CTRL_REG);
+   outw(val, dev->iobase + MULTIQ3_AO_REG);
+   outw(MULTIQ3_CONTROL_MUST, dev->iobase + MULTIQ3_CTRL_REG);
}
s->readback[chan] = val;
 
@@ -161,7 +161,7 @@ static int multiq3_di_insn_bits(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
 {
-   data[1] = inw(dev->iobase + MULTIQ3_DIGIN_PORT);
+   data[1] = inw(dev->iobase + MULTIQ3_DI_REG);
 
return insn->n;
 }
@@ -172,7 +172,7 @@ static int multiq3_do_insn_bits(struct comedi_device *dev,
unsigned int *data)
 {
if (comedi_dio_update_state(s, data))
-   outw(s->state, dev->iobase + MULTIQ3_DIGOUT_PORT);
+   outw(s->state, dev->iobase + MULTIQ3_DO_REG);
 
data[1] = s->state;
 
@@ -190,12 +190,12 @@ static int multiq3_encoder_insn_read(struct comedi_device 
*dev,
int n;
 
for (n = 0; n < insn->n; n++) {
-   outw(control, dev->iobase + MULTIQ3_CONTROL);
-   outb(MULTIQ3_BP_RESET, dev->iobase + MULTIQ3_ENC_CONTROL);
-   outb(MULTIQ3_TRSFRCNTR_OL, dev->iobase + MULTIQ3_ENC_CONTROL);
-   value = inb(dev->iobase + MULTIQ3_ENC_DATA);
-   value |= (inb(dev->iobase + MULTIQ3_ENC_DATA) << 8);
-   value |= (inb(dev->iobase + MULTIQ3_ENC_DATA) << 16);
+   outw(control, dev->iobase + MULTIQ3_CTRL_REG);
+

[PATCH 03/14] staging: comedi: multiq3: tidy up subdevice init

2015-10-02 Thread H Hartley Sweeten
For aesthetics, add some whitespace to the subdevice init and rearrange
the initialization a bit.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/multiq3.c | 77 
 1 file changed, 38 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/comedi/drivers/multiq3.c 
b/drivers/staging/comedi/drivers/multiq3.c
index fabc321..1cfd7fa 100644
--- a/drivers/staging/comedi/drivers/multiq3.c
+++ b/drivers/staging/comedi/drivers/multiq3.c
@@ -235,55 +235,54 @@ static int multiq3_attach(struct comedi_device *dev,
if (ret)
return ret;
 
+   /* Analog Input subdevice */
s = &dev->subdevices[0];
-   /* ai subdevice */
-   s->type = COMEDI_SUBD_AI;
-   s->subdev_flags = SDF_READABLE | SDF_GROUND;
-   s->n_chan = 8;
-   s->insn_read = multiq3_ai_insn_read;
-   s->maxdata = 0x1fff;
-   s->range_table = &range_bipolar5;
-
+   s->type = COMEDI_SUBD_AI;
+   s->subdev_flags = SDF_READABLE | SDF_GROUND;
+   s->n_chan   = 8;
+   s->maxdata  = 0x1fff;
+   s->range_table  = &range_bipolar5;
+   s->insn_read= multiq3_ai_insn_read;
+
+   /* Analog Output subdevice */
s = &dev->subdevices[1];
-   /* ao subdevice */
-   s->type = COMEDI_SUBD_AO;
-   s->subdev_flags = SDF_WRITABLE;
-   s->n_chan = 8;
-   s->maxdata = 0xfff;
-   s->range_table = &range_bipolar5;
-   s->insn_write = multiq3_ao_insn_write;
+   s->type = COMEDI_SUBD_AO;
+   s->subdev_flags = SDF_WRITABLE;
+   s->n_chan   = 8;
+   s->maxdata  = 0x0fff;
+   s->range_table  = &range_bipolar5;
+   s->insn_write   = multiq3_ao_insn_write;
 
ret = comedi_alloc_subdev_readback(s);
if (ret)
return ret;
 
+   /* Digital Input subdevice */
s = &dev->subdevices[2];
-   /* di subdevice */
-   s->type = COMEDI_SUBD_DI;
-   s->subdev_flags = SDF_READABLE;
-   s->n_chan = 16;
-   s->insn_bits = multiq3_di_insn_bits;
-   s->maxdata = 1;
-   s->range_table = &range_digital;
-
+   s->type = COMEDI_SUBD_DI;
+   s->subdev_flags = SDF_READABLE;
+   s->n_chan   = 16;
+   s->maxdata  = 1;
+   s->range_table  = &range_digital;
+   s->insn_bits= multiq3_di_insn_bits;
+
+   /* Digital Output subdevice */
s = &dev->subdevices[3];
-   /* do subdevice */
-   s->type = COMEDI_SUBD_DO;
-   s->subdev_flags = SDF_WRITABLE;
-   s->n_chan = 16;
-   s->insn_bits = multiq3_do_insn_bits;
-   s->maxdata = 1;
-   s->range_table = &range_digital;
-   s->state = 0;
-
+   s->type = COMEDI_SUBD_DO;
+   s->subdev_flags = SDF_WRITABLE;
+   s->n_chan   = 16;
+   s->maxdata  = 1;
+   s->range_table  = &range_digital;
+   s->insn_bits= multiq3_do_insn_bits;
+
+   /* Encoder (Counter) subdevice */
s = &dev->subdevices[4];
-   /* encoder (counter) subdevice */
-   s->type = COMEDI_SUBD_COUNTER;
-   s->subdev_flags = SDF_READABLE | SDF_LSAMPL;
-   s->n_chan = it->options[2] * 2;
-   s->insn_read = multiq3_encoder_insn_read;
-   s->maxdata = 0xff;
-   s->range_table = &range_unknown;
+   s->type = COMEDI_SUBD_COUNTER;
+   s->subdev_flags = SDF_READABLE | SDF_LSAMPL;
+   s->n_chan   = it->options[2] * 2;
+   s->maxdata  = 0x00ff;
+   s->range_table  = &range_unknown;
+   s->insn_read= multiq3_encoder_insn_read;
 
encoder_reset(dev);
 
-- 
2.5.1

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


[PATCH 05/14] staging: comedi: multiq3: tidy up status register bit defines

2015-10-02 Thread H Hartley Sweeten
For aesthetics, move these defines closer to the register define and
use the BIT macro to define the bits.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/multiq3.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/multiq3.c 
b/drivers/staging/comedi/drivers/multiq3.c
index bf4ab32..7fb3a59 100644
--- a/drivers/staging/comedi/drivers/multiq3.c
+++ b/drivers/staging/comedi/drivers/multiq3.c
@@ -47,6 +47,8 @@
 #define MULTIQ3_AI_REG 0x04
 #define MULTIQ3_AI_CONV_REG0x04
 #define MULTIQ3_STATUS_REG 0x06
+#define MULTIQ3_STATUS_EOC BIT(3)
+#define MULTIQ3_STATUS_EOC_I   BIT(4)
 #define MULTIQ3_CTRL_REG   0x06
 #define MULTIQ3_CLK_REG0x08
 #define MULTIQ3_ENC_DATA_REG   0x0c
@@ -65,12 +67,6 @@
 #define MULTIQ3_CONTROL_MUST0x0600
 
 /*
- * flags for STATUS register
- */
-#define MULTIQ3_STATUS_EOC  0x008
-#define MULTIQ3_STATUS_EOC_I0x010
-
-/*
  * flags for encoder control
  */
 #define MULTIQ3_CLOCK_DATA  0x00
-- 
2.5.1

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


[PATCH 08/14] staging: comedi: multiq3: document the encoder chip commands

2015-10-02 Thread H Hartley Sweeten
Add some comments to document the commands that are sent to the
encoder chips.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/multiq3.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/comedi/drivers/multiq3.c 
b/drivers/staging/comedi/drivers/multiq3.c
index dac1879..02d41fc 100644
--- a/drivers/staging/comedi/drivers/multiq3.c
+++ b/drivers/staging/comedi/drivers/multiq3.c
@@ -65,17 +65,17 @@
 #define MULTIQ3_ENC_CTRL_REG   0x0e
 
 /*
- * flags for encoder control
+ * Encoder chip commands (from the programming manual)
  */
-#define MULTIQ3_CLOCK_DATA  0x00
-#define MULTIQ3_CLOCK_SETUP 0x18
-#define MULTIQ3_INPUT_SETUP 0x41
-#define MULTIQ3_QUAD_X4 0x38
-#define MULTIQ3_BP_RESET0x01
-#define MULTIQ3_CNTR_RESET  0x02
-#define MULTIQ3_TRSFRPR_CTR 0x08
-#define MULTIQ3_TRSFRCNTR_OL0x10
-#define MULTIQ3_EFLAG_RESET 0x06
+#define MULTIQ3_CLOCK_DATA 0x00/* FCK frequency divider */
+#define MULTIQ3_CLOCK_SETUP0x18/* xfer PR0 to PSC */
+#define MULTIQ3_INPUT_SETUP0x41/* enable inputs A and B */
+#define MULTIQ3_QUAD_X40x38/* quadrature */
+#define MULTIQ3_BP_RESET   0x01/* reset byte pointer */
+#define MULTIQ3_CNTR_RESET 0x02/* reset counter */
+#define MULTIQ3_TRSFRPR_CTR0x08/* xfre preset reg to counter */
+#define MULTIQ3_TRSFRCNTR_OL   0x10/* xfer CNTR to OL (x and y) */
+#define MULTIQ3_EFLAG_RESET0x06/* reset E bit of flag reg */
 
 #define MULTIQ3_TIMEOUT 30
 
-- 
2.5.1

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


[PATCH 10/14] staging: comedi: multiq3: remove unnecessary define

2015-10-02 Thread H Hartley Sweeten
This define is not needed. Remove it.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/multiq3.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/multiq3.c 
b/drivers/staging/comedi/drivers/multiq3.c
index f789d6e7..b5d2354 100644
--- a/drivers/staging/comedi/drivers/multiq3.c
+++ b/drivers/staging/comedi/drivers/multiq3.c
@@ -77,8 +77,6 @@
 #define MULTIQ3_TRSFRCNTR_OL   0x10/* xfer CNTR to OL (x and y) */
 #define MULTIQ3_EFLAG_RESET0x06/* reset E bit of flag reg */
 
-#define MULTIQ3_TIMEOUT 30
-
 static void multiq3_set_ctrl(struct comedi_device *dev, unsigned int bits)
 {
/*
-- 
2.5.1

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


[PATCH 07/14] staging: comedi: multiq3: tidy up control register bit defines

2015-10-02 Thread H Hartley Sweeten
For aesthetics, move these defines closer to the register define and
use the BIT macro to define the bits.

Add macros to set the bits needed to select the channel for the analog
output, analog input, and encoder (counter) subdevices as well as the
realtime clock registers.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/multiq3.c | 33 +---
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/comedi/drivers/multiq3.c 
b/drivers/staging/comedi/drivers/multiq3.c
index 0662c36..dac1879 100644
--- a/drivers/staging/comedi/drivers/multiq3.c
+++ b/drivers/staging/comedi/drivers/multiq3.c
@@ -50,21 +50,21 @@
 #define MULTIQ3_STATUS_EOC BIT(3)
 #define MULTIQ3_STATUS_EOC_I   BIT(4)
 #define MULTIQ3_CTRL_REG   0x06
+#define MULTIQ3_CTRL_AO_CHAN(x)(((x) & 0x7) << 0)
+#define MULTIQ3_CTRL_RC(x) (((x) & 0x3) << 0)
+#define MULTIQ3_CTRL_AI_CHAN(x)(((x) & 0x7) << 3)
+#define MULTIQ3_CTRL_E_CHAN(x) (((x) & 0x7) << 3)
+#define MULTIQ3_CTRL_ENBIT(6)
+#define MULTIQ3_CTRL_AZBIT(7)
+#define MULTIQ3_CTRL_CAL   BIT(8)
+#define MULTIQ3_CTRL_SHBIT(9)
+#define MULTIQ3_CTRL_CLK   BIT(10)
+#define MULTIQ3_CTRL_LD(3 << 11)
 #define MULTIQ3_CLK_REG0x08
 #define MULTIQ3_ENC_DATA_REG   0x0c
 #define MULTIQ3_ENC_CTRL_REG   0x0e
 
 /*
- * flags for CONTROL register
- */
-#define MULTIQ3_AD_MUX_EN  0x0040
-#define MULTIQ3_AD_AUTOZ   0x0080
-#define MULTIQ3_AD_AUTOCAL 0x0100
-#define MULTIQ3_AD_SH  0x0200
-#define MULTIQ3_AD_CLOCK_4M0x0400
-#define MULTIQ3_DA_LOAD0x1800
-
-/*
  * flags for encoder control
  */
 #define MULTIQ3_CLOCK_DATA  0x00
@@ -85,7 +85,7 @@ static void multiq3_set_ctrl(struct comedi_device *dev, 
unsigned int bits)
 * According to the programming manual, the SH and CLK bits should
 * be kept high at all times.
 */
-   outw(MULTIQ3_AD_SH | MULTIQ3_AD_CLOCK_4M | bits,
+   outw(MULTIQ3_CTRL_SH | MULTIQ3_CTRL_CLK | bits,
 dev->iobase + MULTIQ3_CTRL_REG);
 }
 
@@ -112,7 +112,7 @@ static int multiq3_ai_insn_read(struct comedi_device *dev,
int ret;
int i;
 
-   multiq3_set_ctrl(dev, MULTIQ3_AD_MUX_EN | (chan << 3));
+   multiq3_set_ctrl(dev, MULTIQ3_CTRL_EN | MULTIQ3_CTRL_AI_CHAN(chan));
 
ret = comedi_timeout(dev, s, insn, multiq3_ai_status,
 MULTIQ3_STATUS_EOC);
@@ -150,7 +150,8 @@ static int multiq3_ao_insn_write(struct comedi_device *dev,
 
for (i = 0; i < insn->n; i++) {
val = data[i];
-   multiq3_set_ctrl(dev, MULTIQ3_DA_LOAD | chan);
+   multiq3_set_ctrl(dev, MULTIQ3_CTRL_LD |
+ MULTIQ3_CTRL_AO_CHAN(chan));
outw(val, dev->iobase + MULTIQ3_AO_REG);
multiq3_set_ctrl(dev, 0);
}
@@ -191,7 +192,8 @@ static int multiq3_encoder_insn_read(struct comedi_device 
*dev,
int n;
 
for (n = 0; n < insn->n; n++) {
-   multiq3_set_ctrl(dev, MULTIQ3_AD_MUX_EN | (chan << 3));
+   multiq3_set_ctrl(dev, MULTIQ3_CTRL_EN |
+ MULTIQ3_CTRL_E_CHAN(chan));
outb(MULTIQ3_BP_RESET, dev->iobase + MULTIQ3_ENC_CTRL_REG);
outb(MULTIQ3_TRSFRCNTR_OL, dev->iobase + MULTIQ3_ENC_CTRL_REG);
value = inb(dev->iobase + MULTIQ3_ENC_DATA_REG);
@@ -209,7 +211,8 @@ static void encoder_reset(struct comedi_device *dev)
int chan;
 
for (chan = 0; chan < s->n_chan; chan++) {
-   multiq3_set_ctrl(dev, MULTIQ3_AD_MUX_EN | (chan << 3));
+   multiq3_set_ctrl(dev, MULTIQ3_CTRL_EN |
+ MULTIQ3_CTRL_E_CHAN(chan));
outb(MULTIQ3_EFLAG_RESET, dev->iobase + MULTIQ3_ENC_CTRL_REG);
outb(MULTIQ3_BP_RESET, dev->iobase + MULTIQ3_ENC_CTRL_REG);
outb(MULTIQ3_CLOCK_DATA, dev->iobase + MULTIQ3_ENC_DATA_REG);
-- 
2.5.1

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


[PATCH 06/14] staging: comedi: multiq3: introduce multiq3_set_ctrl()

2015-10-02 Thread H Hartley Sweeten
According to the programming manual. the 'SH' and 'CLK' bits in the
control register need to be kept high at all times. Clarify this by
introducing a helper function to set the control register.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/multiq3.c | 27 +++
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/comedi/drivers/multiq3.c 
b/drivers/staging/comedi/drivers/multiq3.c
index 7fb3a59..0662c36 100644
--- a/drivers/staging/comedi/drivers/multiq3.c
+++ b/drivers/staging/comedi/drivers/multiq3.c
@@ -64,8 +64,6 @@
 #define MULTIQ3_AD_CLOCK_4M0x0400
 #define MULTIQ3_DA_LOAD0x1800
 
-#define MULTIQ3_CONTROL_MUST0x0600
-
 /*
  * flags for encoder control
  */
@@ -81,6 +79,16 @@
 
 #define MULTIQ3_TIMEOUT 30
 
+static void multiq3_set_ctrl(struct comedi_device *dev, unsigned int bits)
+{
+   /*
+* According to the programming manual, the SH and CLK bits should
+* be kept high at all times.
+*/
+   outw(MULTIQ3_AD_SH | MULTIQ3_AD_CLOCK_4M | bits,
+dev->iobase + MULTIQ3_CTRL_REG);
+}
+
 static int multiq3_ai_status(struct comedi_device *dev,
 struct comedi_subdevice *s,
 struct comedi_insn *insn,
@@ -104,8 +112,7 @@ static int multiq3_ai_insn_read(struct comedi_device *dev,
int ret;
int i;
 
-   outw(MULTIQ3_CONTROL_MUST | MULTIQ3_AD_MUX_EN | (chan << 3),
-dev->iobase + MULTIQ3_CTRL_REG);
+   multiq3_set_ctrl(dev, MULTIQ3_AD_MUX_EN | (chan << 3));
 
ret = comedi_timeout(dev, s, insn, multiq3_ai_status,
 MULTIQ3_STATUS_EOC);
@@ -143,10 +150,9 @@ static int multiq3_ao_insn_write(struct comedi_device *dev,
 
for (i = 0; i < insn->n; i++) {
val = data[i];
-   outw(MULTIQ3_CONTROL_MUST | MULTIQ3_DA_LOAD | chan,
-dev->iobase + MULTIQ3_CTRL_REG);
+   multiq3_set_ctrl(dev, MULTIQ3_DA_LOAD | chan);
outw(val, dev->iobase + MULTIQ3_AO_REG);
-   outw(MULTIQ3_CONTROL_MUST, dev->iobase + MULTIQ3_CTRL_REG);
+   multiq3_set_ctrl(dev, 0);
}
s->readback[chan] = val;
 
@@ -181,12 +187,11 @@ static int multiq3_encoder_insn_read(struct comedi_device 
*dev,
 unsigned int *data)
 {
int chan = CR_CHAN(insn->chanspec);
-   int control = MULTIQ3_CONTROL_MUST | MULTIQ3_AD_MUX_EN | (chan << 3);
int value;
int n;
 
for (n = 0; n < insn->n; n++) {
-   outw(control, dev->iobase + MULTIQ3_CTRL_REG);
+   multiq3_set_ctrl(dev, MULTIQ3_AD_MUX_EN | (chan << 3));
outb(MULTIQ3_BP_RESET, dev->iobase + MULTIQ3_ENC_CTRL_REG);
outb(MULTIQ3_TRSFRCNTR_OL, dev->iobase + MULTIQ3_ENC_CTRL_REG);
value = inb(dev->iobase + MULTIQ3_ENC_DATA_REG);
@@ -204,9 +209,7 @@ static void encoder_reset(struct comedi_device *dev)
int chan;
 
for (chan = 0; chan < s->n_chan; chan++) {
-   int control =
-   MULTIQ3_CONTROL_MUST | MULTIQ3_AD_MUX_EN | (chan << 3);
-   outw(control, dev->iobase + MULTIQ3_CTRL_REG);
+   multiq3_set_ctrl(dev, MULTIQ3_AD_MUX_EN | (chan << 3));
outb(MULTIQ3_EFLAG_RESET, dev->iobase + MULTIQ3_ENC_CTRL_REG);
outb(MULTIQ3_BP_RESET, dev->iobase + MULTIQ3_ENC_CTRL_REG);
outb(MULTIQ3_CLOCK_DATA, dev->iobase + MULTIQ3_ENC_DATA_REG);
-- 
2.5.1

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


[PATCH 09/14] staging: comedi: multiq3: allow user to reset encoder channels

2015-10-02 Thread H Hartley Sweeten
Currently this driver resets all the encoder channels when the driver
is first attached. Add a (*insn_config) to the subdevice to allow the
use to reset the channels manually.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/multiq3.c | 44 ++--
 1 file changed, 30 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/comedi/drivers/multiq3.c 
b/drivers/staging/comedi/drivers/multiq3.c
index 02d41fc..f789d6e7 100644
--- a/drivers/staging/comedi/drivers/multiq3.c
+++ b/drivers/staging/comedi/drivers/multiq3.c
@@ -205,22 +205,35 @@ static int multiq3_encoder_insn_read(struct comedi_device 
*dev,
return n;
 }
 
-static void encoder_reset(struct comedi_device *dev)
+static void multiq3_encoder_reset(struct comedi_device *dev,
+ unsigned int chan)
 {
-   struct comedi_subdevice *s = &dev->subdevices[4];
-   int chan;
+   multiq3_set_ctrl(dev, MULTIQ3_CTRL_EN | MULTIQ3_CTRL_E_CHAN(chan));
+   outb(MULTIQ3_EFLAG_RESET, dev->iobase + MULTIQ3_ENC_CTRL_REG);
+   outb(MULTIQ3_BP_RESET, dev->iobase + MULTIQ3_ENC_CTRL_REG);
+   outb(MULTIQ3_CLOCK_DATA, dev->iobase + MULTIQ3_ENC_DATA_REG);
+   outb(MULTIQ3_CLOCK_SETUP, dev->iobase + MULTIQ3_ENC_CTRL_REG);
+   outb(MULTIQ3_INPUT_SETUP, dev->iobase + MULTIQ3_ENC_CTRL_REG);
+   outb(MULTIQ3_QUAD_X4, dev->iobase + MULTIQ3_ENC_CTRL_REG);
+   outb(MULTIQ3_CNTR_RESET, dev->iobase + MULTIQ3_ENC_CTRL_REG);
+}
 
-   for (chan = 0; chan < s->n_chan; chan++) {
-   multiq3_set_ctrl(dev, MULTIQ3_CTRL_EN |
- MULTIQ3_CTRL_E_CHAN(chan));
-   outb(MULTIQ3_EFLAG_RESET, dev->iobase + MULTIQ3_ENC_CTRL_REG);
-   outb(MULTIQ3_BP_RESET, dev->iobase + MULTIQ3_ENC_CTRL_REG);
-   outb(MULTIQ3_CLOCK_DATA, dev->iobase + MULTIQ3_ENC_DATA_REG);
-   outb(MULTIQ3_CLOCK_SETUP, dev->iobase + MULTIQ3_ENC_CTRL_REG);
-   outb(MULTIQ3_INPUT_SETUP, dev->iobase + MULTIQ3_ENC_CTRL_REG);
-   outb(MULTIQ3_QUAD_X4, dev->iobase + MULTIQ3_ENC_CTRL_REG);
-   outb(MULTIQ3_CNTR_RESET, dev->iobase + MULTIQ3_ENC_CTRL_REG);
+static int multiq3_encoder_insn_config(struct comedi_device *dev,
+  struct comedi_subdevice *s,
+  struct comedi_insn *insn,
+  unsigned int *data)
+{
+   unsigned int chan = CR_CHAN(insn->chanspec);
+
+   switch (data[0]) {
+   case INSN_CONFIG_RESET:
+   multiq3_encoder_reset(dev, chan);
+   break;
+   default:
+   return -EINVAL;
}
+
+   return insn->n;
 }
 
 static int multiq3_attach(struct comedi_device *dev,
@@ -228,6 +241,7 @@ static int multiq3_attach(struct comedi_device *dev,
 {
struct comedi_subdevice *s;
int ret;
+   int i;
 
ret = comedi_request_region(dev, it->options[0], 0x10);
if (ret)
@@ -285,8 +299,10 @@ static int multiq3_attach(struct comedi_device *dev,
s->maxdata  = 0x00ff;
s->range_table  = &range_unknown;
s->insn_read= multiq3_encoder_insn_read;
+   s->insn_config  = multiq3_encoder_insn_config;
 
-   encoder_reset(dev);
+   for (i = 0; i < s->n_chan; i++)
+   multiq3_encoder_reset(dev, i);
 
return 0;
 }
-- 
2.5.1

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


[PATCH 11/14] staging: comedi: multiq3: tidy up multiq3_encoder_insn_read()

2015-10-02 Thread H Hartley Sweeten
Encoders are not a "normal" subdevice in comedi. For aesthetics, tidy
up this function and add a couple comments to clarify the function.

Remove the strange munging of the data. The encoder data is decoded
in quadrature and used to increment or decrement a 24-bit counter.
Adding 0x80 to the counter value doesn't make any sense.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/multiq3.c | 26 +-
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/comedi/drivers/multiq3.c 
b/drivers/staging/comedi/drivers/multiq3.c
index b5d2354..955f75a 100644
--- a/drivers/staging/comedi/drivers/multiq3.c
+++ b/drivers/staging/comedi/drivers/multiq3.c
@@ -185,22 +185,30 @@ static int multiq3_encoder_insn_read(struct comedi_device 
*dev,
 struct comedi_insn *insn,
 unsigned int *data)
 {
-   int chan = CR_CHAN(insn->chanspec);
-   int value;
-   int n;
+   unsigned int chan = CR_CHAN(insn->chanspec);
+   unsigned int val;
+   int i;
 
-   for (n = 0; n < insn->n; n++) {
+   for (i = 0; i < insn->n; i++) {
+   /* select encoder channel */
multiq3_set_ctrl(dev, MULTIQ3_CTRL_EN |
  MULTIQ3_CTRL_E_CHAN(chan));
+
+   /* reset the byte pointer */
outb(MULTIQ3_BP_RESET, dev->iobase + MULTIQ3_ENC_CTRL_REG);
+
+   /* latch the data */
outb(MULTIQ3_TRSFRCNTR_OL, dev->iobase + MULTIQ3_ENC_CTRL_REG);
-   value = inb(dev->iobase + MULTIQ3_ENC_DATA_REG);
-   value |= (inb(dev->iobase + MULTIQ3_ENC_DATA_REG) << 8);
-   value |= (inb(dev->iobase + MULTIQ3_ENC_DATA_REG) << 16);
-   data[n] = (value + 0x80) & 0xff;
+
+   /* read the 24-bit encoder data (lsb/mid/msb) */
+   val = inb(dev->iobase + MULTIQ3_ENC_DATA_REG);
+   val |= (inb(dev->iobase + MULTIQ3_ENC_DATA_REG) << 8);
+   val |= (inb(dev->iobase + MULTIQ3_ENC_DATA_REG) << 16);
+
+   data[i] = val;
}
 
-   return n;
+   return insn->n;
 }
 
 static void multiq3_encoder_reset(struct comedi_device *dev,
-- 
2.5.1

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


[PATCH 12/14] staging: comedi: multiq3: remove unnecessary include

2015-10-02 Thread H Hartley Sweeten
This driver does not use interrupts. Remove the include.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/multiq3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/multiq3.c 
b/drivers/staging/comedi/drivers/multiq3.c
index 955f75a..a48de88 100644
--- a/drivers/staging/comedi/drivers/multiq3.c
+++ b/drivers/staging/comedi/drivers/multiq3.c
@@ -35,7 +35,7 @@
  */
 
 #include 
-#include 
+
 #include "../comedidev.h"
 
 /*
-- 
2.5.1

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


[PATCH 13/14] staging: comedi: multiq3: add 8254 counter/timer subdevice support

2015-10-02 Thread H Hartley Sweeten
The board has an 8254 timer/counter. Add support for this subdevice.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/multiq3.c | 147 ++-
 1 file changed, 146 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/multiq3.c 
b/drivers/staging/comedi/drivers/multiq3.c
index a48de88..9934627 100644
--- a/drivers/staging/comedi/drivers/multiq3.c
+++ b/drivers/staging/comedi/drivers/multiq3.c
@@ -38,6 +38,8 @@
 
 #include "../comedidev.h"
 
+#include "comedi_8254.h"   /* just for the register map */
+
 /*
  * Register map
  */
@@ -47,6 +49,8 @@
 #define MULTIQ3_AI_REG 0x04
 #define MULTIQ3_AI_CONV_REG0x04
 #define MULTIQ3_STATUS_REG 0x06
+#define MULTIQ3_STATUS_CT(x)   (((x) == 0) ? BIT(0) :  \
+((x) == 1) ? BIT(2) : BIT(1))
 #define MULTIQ3_STATUS_EOC BIT(3)
 #define MULTIQ3_STATUS_EOC_I   BIT(4)
 #define MULTIQ3_CTRL_REG   0x06
@@ -242,6 +246,126 @@ static int multiq3_encoder_insn_config(struct 
comedi_device *dev,
return insn->n;
 }
 
+static unsigned int multiq3_i8254_read(struct comedi_device *dev,
+  unsigned int reg)
+{
+   /* select the 8254 register then read the value */
+   multiq3_set_ctrl(dev, MULTIQ3_CTRL_RC(reg));
+   return inb(dev->iobase + MULTIQ3_CLK_REG);
+}
+
+static void multiq3_i8254_write(struct comedi_device *dev,
+   unsigned int val, unsigned int reg)
+{
+   /* select the 8254 register then write the value */
+   multiq3_set_ctrl(dev, MULTIQ3_CTRL_RC(reg));
+   outb(val, dev->iobase + MULTIQ3_CLK_REG);
+}
+
+static int multiq3_8254_set_mode(struct comedi_device *dev,
+unsigned int chan, unsigned int mode)
+{
+   unsigned int byte;
+
+   if (mode > (I8254_MODE5 | I8254_BCD))
+   return -EINVAL;
+
+   byte = I8254_CTRL_SEL_CTR(chan) |   /* select counter */
+  I8254_CTRL_LSB_MSB | /* load LSB then MSB */
+  mode;/* mode and BCD|binary */
+   multiq3_i8254_write(dev, byte, I8254_CTRL_REG);
+
+   return 0;
+}
+
+static int multiq3_8254_insn_read(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn,
+ unsigned int *data)
+{
+   unsigned int chan = CR_CHAN(insn->chanspec);
+   unsigned int ctrl = I8254_CTRL_LATCH | I8254_CTRL_SEL_CTR(chan);
+   unsigned int val;
+   int i;
+
+   for (i = 0; i < insn->n; i++) {
+   /* latch counter */
+   multiq3_i8254_write(dev, ctrl, I8254_CTRL_REG);
+
+   /* read LSB then MSB */
+   val = multiq3_i8254_read(dev, chan);
+   val |= (multiq3_i8254_read(dev, chan) << 8);
+
+   data[i] = val;
+   }
+
+   return insn->n;
+}
+
+static int multiq3_8254_insn_write(struct comedi_device *dev,
+  struct comedi_subdevice *s,
+  struct comedi_insn *insn,
+  unsigned int *data)
+{
+   unsigned int chan = CR_CHAN(insn->chanspec);
+
+   if (insn->n) {
+   unsigned int val = data[insn->n - 1];
+
+   /* load LSB then MSB */
+   multiq3_i8254_write(dev, val & 0xff, chan);
+   multiq3_i8254_write(dev, (val >> 8) & 0xff, chan);
+   }
+
+   return insn->n;
+}
+
+static int multiq3_8254_insn_config(struct comedi_device *dev,
+   struct comedi_subdevice *s,
+   struct comedi_insn *insn,
+   unsigned int *data)
+{
+   unsigned int chan = CR_CHAN(insn->chanspec);
+   unsigned int status;
+   int ret;
+
+   switch (data[0]) {
+   case INSN_CONFIG_RESET:
+   ret = multiq3_8254_set_mode(dev, chan,
+   I8254_MODE0 | I8254_BINARY);
+   if (ret)
+   return ret;
+   break;
+   case INSN_CONFIG_SET_COUNTER_MODE:
+   ret = multiq3_8254_set_mode(dev, chan, data[1]);
+   if (ret)
+   return ret;
+   break;
+   case INSN_CONFIG_GET_COUNTER_STATUS:
+   data[1] = 0;
+   status = inw(dev->iobase + MULTIQ3_STATUS_REG);
+   if (status & MULTIQ3_STATUS_CT(chan))
+   data[1] |= COMEDI_COUNTER_TERMINAL_COUNT;
+   data[2] = COMEDI_COUNTER_TERMINAL_COUNT;
+   break;
+   case INSN_CONFIG_8254_READ_STATUS:
+   multiq3_i8254_write(dev, I8254_CTRL_READBACK_STATUS |
+I825

[PATCH 14/14] staging: comedi: multiq3: update the MODULE_DESCRIPTION

2015-10-02 Thread H Hartley Sweeten
Change the MODULE_DESCRIPTION to something more useful than the
generic "Comedi low-level driver".

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/multiq3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/multiq3.c 
b/drivers/staging/comedi/drivers/multiq3.c
index 9934627..1983a6b 100644
--- a/drivers/staging/comedi/drivers/multiq3.c
+++ b/drivers/staging/comedi/drivers/multiq3.c
@@ -467,5 +467,5 @@ static struct comedi_driver multiq3_driver = {
 module_comedi_driver(multiq3_driver);
 
 MODULE_AUTHOR("Comedi http://www.comedi.org";);
-MODULE_DESCRIPTION("Comedi low-level driver");
+MODULE_DESCRIPTION("Comedi driver for Quanser Consulting MultiQ-3 board");
 MODULE_LICENSE("GPL");
-- 
2.5.1

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


[PATCH] staging: rtl8723au: Fix Sparse errors in rtl8723a_cmd.c

2015-10-02 Thread Jacob Kiefer
From: Jacob Kiefer 

This patch fixes the following sparse errors:


  CHECK   drivers/staging/rtl8723au/hal/rtl8723a_cmd.c
...
drivers/staging/rtl8723au/hal/rtl8723a_cmd.c:118:25: warning: incorrect type in 
assignment (different base types)
drivers/staging/rtl8723au/hal/rtl8723a_cmd.c:118:25:expected unsigned int 
[unsigned] [usertype] 
drivers/staging/rtl8723au/hal/rtl8723a_cmd.c:118:25:got restricted __le32 
[usertype] 
drivers/staging/rtl8723au/hal/rtl8723a_cmd.c:130:14: warning: incorrect type in 
assignment (different base types)
drivers/staging/rtl8723au/hal/rtl8723a_cmd.c:130:14:expected unsigned int 
[unsigned] [usertype] mask
drivers/staging/rtl8723au/hal/rtl8723a_cmd.c:130:14:got restricted __le32 
[usertype] 
  CC [M]  drivers/staging/rtl8723au/hal/rtl8723a_cmd.o

Signed-off-by: Jacob Kiefer 
---
 drivers/staging/rtl8723au/hal/rtl8723a_cmd.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c 
b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c
index 9733aa6..111a24d 100644
--- a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c
+++ b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c
@@ -115,9 +115,11 @@ exit:
 
 int rtl8723a_set_rssi_cmd(struct rtw_adapter *padapter, u8 *param)
 {
-   *((u32 *)param) = cpu_to_le32(*((u32 *)param));
+   __le32 leparam;
 
-   FillH2CCmd(padapter, RSSI_SETTING_EID, 3, param);
+   leparam = cpu_to_le32(*((u32 *)param));
+
+   FillH2CCmd(padapter, RSSI_SETTING_EID, 3, (u8 *)&leparam);
 
return _SUCCESS;
 }
@@ -125,10 +127,11 @@ int rtl8723a_set_rssi_cmd(struct rtw_adapter *padapter, 
u8 *param)
 int rtl8723a_set_raid_cmd(struct rtw_adapter *padapter, u32 mask, u8 arg)
 {
u8 buf[5];
+   __le32 lemask;
 
memset(buf, 0, 5);
-   mask = cpu_to_le32(mask);
-   memcpy(buf, &mask, 4);
+   lemask = cpu_to_le32(mask);
+   memcpy(buf, (u32 *)&lemask, 4);
buf[4]  = arg;
 
FillH2CCmd(padapter, MACID_CONFIG_EID, 5, buf);
-- 
1.8.3.2

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


Re: [PATCH 1/3] drivers: staging: wilc1000: Check for errors before kfree

2015-10-02 Thread Chandra Gorentla
On Fri, Oct 02, 2015 at 04:39:11PM +0300, Dan Carpenter wrote:
> On Fri, Oct 02, 2015 at 06:47:35PM +0530, Chandra S Gorentla wrote:
> > During the clean-up of the function, it is need to check if
> > errors occurred, not the memory pointer.
> >
> 
> The bug here is that we have a use after free on the success path.  It
> should have been mentioned in the changelog.
> 
> Anyway, this patch is buggy.  If result == -EFAULT then it will crash.
> Also this patch is really ugly.  There is someone who is going to send a
> correct fix (just add a return 0).
> 
> This driver usese "do everything" style error handling.  It is a bug
> prone anti-pattern because doing everything is more complicated than
> doing one thing.  You can easily see it is bug prone, because it made
> you introduce a bug, right?
> 
> Instead the error handling should look like this:
> 
>   return 0;
> 
> err_free_msg:
>   kfree(pstrMessage);
> 
>   return ret;
> 
> There are no error paths where we need to free "pstrMessage->pvBuffer"
> but if we were to add one it would look like this:
> 
>   return 0;
> 
> err_pvbuffer:
>   kfree(pstrMessage->pvBuffer);
> err_msg:
>   kfree(pstrMessage);
> 
>   return ret;
> 
> This is a minimal, uncomplicated, no indenting, no if statement way of
> unwinding.
> 
> regards,
> dan carpenter
> 
OK.  There is a problem in this patch.  I will correct it, reorganize the
patch series.

Thank you,
chandra

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


[PATCH] IB/hfi1: use offset_in_page macro

2015-10-02 Thread Geliang Tang
Use offset_in_page macro instead of (addr & ~PAGE_MASK).

Signed-off-by: Geliang Tang 
---
 drivers/staging/rdma/hfi1/file_ops.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/file_ops.c 
b/drivers/staging/rdma/hfi1/file_ops.c
index 9a77221..7d28680 100644
--- a/drivers/staging/rdma/hfi1/file_ops.c
+++ b/drivers/staging/rdma/hfi1/file_ops.c
@@ -168,7 +168,7 @@ enum mmap_types {
HFI1_MMAP_TOKEN_SET(TYPE, type) | \
HFI1_MMAP_TOKEN_SET(CTXT, ctxt) | \
HFI1_MMAP_TOKEN_SET(SUBCTXT, subctxt) | \
-   HFI1_MMAP_TOKEN_SET(OFFSET, ((unsigned long)addr & ~PAGE_MASK)))
+   HFI1_MMAP_TOKEN_SET(OFFSET, (offset_in_page(addr
 
 #define EXP_TID_SET(field, value)  \
(((value) & EXP_TID_TID##field##_MASK) <<   \
@@ -1335,9 +1335,9 @@ static int get_base_info(struct file *fp, void __user 
*ubase, __u32 len)
 */
binfo.user_regbase = HFI1_MMAP_TOKEN(UREGS, uctxt->ctxt,
subctxt_fp(fp), 0);
-   offset = uctxt->ctxt - dd->first_user_ctxt) *
+   offset = offset_in_pageuctxt->ctxt - dd->first_user_ctxt) *
HFI1_MAX_SHARED_CTXTS) + subctxt_fp(fp)) *
- sizeof(*dd->events)) & ~PAGE_MASK;
+ sizeof(*dd->events));
binfo.events_bufbase = HFI1_MMAP_TOKEN(EVENTS, uctxt->ctxt,
  subctxt_fp(fp),
  offset);
@@ -1573,7 +1573,7 @@ static int exp_tid_setup(struct file *fp, struct 
hfi1_tid_info *tinfo)
 
vaddr = tinfo->vaddr;
 
-   if (vaddr & ~PAGE_MASK) {
+   if (offset_in_page(vaddr)) {
ret = -EINVAL;
goto bail;
}
-- 
2.5.0


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


[PATCH] IB/ipath: use offset_in_page macro

2015-10-02 Thread Geliang Tang
Use offset_in_page macro instead of (addr & ~PAGE_MASK).

Signed-off-by: Geliang Tang 
---
 drivers/staging/rdma/ipath/ipath_user_sdma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rdma/ipath/ipath_user_sdma.c 
b/drivers/staging/rdma/ipath/ipath_user_sdma.c
index cc04b7b..e82b3ee 100644
--- a/drivers/staging/rdma/ipath/ipath_user_sdma.c
+++ b/drivers/staging/rdma/ipath/ipath_user_sdma.c
@@ -239,7 +239,7 @@ static int ipath_user_sdma_num_pages(const struct iovec 
*iov)
 /* truncate length to page boundary */
 static int ipath_user_sdma_page_length(unsigned long addr, unsigned long len)
 {
-   const unsigned long offset = addr & ~PAGE_MASK;
+   const unsigned long offset = offset_in_page(addr);
 
return ((offset + len) > PAGE_SIZE) ? (PAGE_SIZE - offset) : len;
 }
@@ -298,7 +298,7 @@ static int ipath_user_sdma_pin_pages(const struct 
ipath_devdata *dd,
dma_addr_t dma_addr =
dma_map_page(&dd->pcidev->dev,
 pages[j], 0, flen, DMA_TO_DEVICE);
-   unsigned long fofs = addr & ~PAGE_MASK;
+   unsigned long fofs = offset_in_page(addr);
 
if (dma_mapping_error(&dd->pcidev->dev, dma_addr)) {
ret = -ENOMEM;
-- 
2.5.0


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


[PATCH] RDMA/amso1100: use offset_in_page macro

2015-10-02 Thread Geliang Tang
Use offset_in_page macro instead of (addr & ~PAGE_MASK).

Signed-off-by: Geliang Tang 
---
 drivers/staging/rdma/amso1100/c2_alloc.c| 2 +-
 drivers/staging/rdma/amso1100/c2_provider.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rdma/amso1100/c2_alloc.c 
b/drivers/staging/rdma/amso1100/c2_alloc.c
index 78d247e..039872d 100644
--- a/drivers/staging/rdma/amso1100/c2_alloc.c
+++ b/drivers/staging/rdma/amso1100/c2_alloc.c
@@ -131,7 +131,7 @@ void c2_free_mqsp(__be16 *mqsp)
*mqsp = (__force __be16) head->head;
 
/* Compute the shared_ptr index */
-   idx = ((unsigned long) mqsp & ~PAGE_MASK) >> 1;
+   idx = (offset_in_page(mqsp)) >> 1;
idx -= (unsigned long) &(((struct sp_chunk *) 0)->shared_ptr[0]) >> 1;
 
/* Point this index at the head */
diff --git a/drivers/staging/rdma/amso1100/c2_provider.c 
b/drivers/staging/rdma/amso1100/c2_provider.c
index 25c3f00..956d76b 100644
--- a/drivers/staging/rdma/amso1100/c2_provider.c
+++ b/drivers/staging/rdma/amso1100/c2_provider.c
@@ -359,7 +359,7 @@ static struct ib_mr *c2_reg_phys_mr(struct ib_pd *ib_pd,
 
for (i = 0; i < num_phys_buf; i++) {
 
-   if (buffer_list[i].addr & ~PAGE_MASK) {
+   if (offset_in_page(buffer_list[i].addr)) {
pr_debug("Unaligned Memory Buffer: 0x%x\n",
(unsigned int) buffer_list[i].addr);
return ERR_PTR(-EINVAL);
-- 
2.5.0


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


Re: Bosto 14WA graphics tablet driver

2015-10-02 Thread Leslie Viljoen
I've read some of the guides and attempted to change the style of the
driver's code to "kernel" style.

Now it seems I have to create a patch - but this is a new file, so how
do I send that? Just paste it in here? It would need to go in
drivers/input/tablet.

Also:

1. I don't think I have to compile the whole kernel to check that the
driver compiles or doesn't immediately "oops" - as specified in
http://www.kroah.com/log/linux/maintainer.html

As far as I know this is an external loadable module that doesn't go
in the kernel core.

2. I usually run a "make install" to install this. It takes care of
some housekeeping such as installing udev rules. It also unbinds
usbhid which wrongly grabs the tablet. This is probably supposed to be
done in a better way but I don't know how.

The installation procedure is below, perhaps someone can advise me on
how to improve this?

file: scripts/insert_bosto_14wa
#!/bin/sh
echo -n "$1" > /sys/bus/usb/drivers/usbhid/unbind
echo -n "$2 $3" > /sys/bus/usb/drivers/bosto_14wa/new_id

file: scripts/bosto_14wa.rules
# Rules for hotplugging Bosto 14wa
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0b57",
ATTRS{idProduct}=="9018", RUN="/usr/local/bin/insert_bosto_14wa %k
%s{idVendor} %s{idProduct}"


"make install" does:
cp ./bosto_14wa.ko /lib/modules/$(shell uname -r)
echo bosto_14wa >> /etc/modules
depmod
cp ./scripts/insert_bosto_14wa /usr/local/bin
cp ./scripts/bosto_14wa.rules /etc/udev/rules.d
udevadm control --reload
modprobe bosto_14wa


Thanks in advance for any help!
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: i20: Added a blank line after declaration

2015-10-02 Thread Anjali Menon
Added a blank line after declaration to fix the coding style
warning detected by checkpatch.pl

WARNING: Missing a blank line after declarations

Signed-off-by: Anjali Menon 
---
 drivers/staging/i2o/pci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/i2o/pci.c b/drivers/staging/i2o/pci.c
index 49804c9..18b6c11 100644
--- a/drivers/staging/i2o/pci.c
+++ b/drivers/staging/i2o/pci.c
@@ -458,6 +458,7 @@ static int i2o_pci_probe(struct pci_dev *pdev, const struct 
pci_device_id *id)
 static void i2o_pci_remove(struct pci_dev *pdev)
 {
struct i2o_controller *c;
+
c = pci_get_drvdata(pdev);
 
i2o_iop_remove(c);
-- 
1.9.1

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


Re: Bosto 14WA graphics tablet driver

2015-10-02 Thread Sudip Mukherjee
On Sat, Oct 03, 2015 at 06:10:18PM +1300, Leslie Viljoen wrote:
> I've read some of the guides and attempted to change the style of the
> driver's code to "kernel" style.

Style is almost ok. Some of the parts still needs to be modified but
that will not take more than 10 - 11 patch. I have not built it so don't
know about any build failure or build warnings.
> 
> Now it seems I have to create a patch - but this is a new file, so how
> do I send that? Just paste it in here? It would need to go in
> drivers/input/tablet.
Yes, you will need to create a patch. I will be happy to help you with
the initial patch. But since style is almost ok, you better ask Input
subsystem first. If Dmitry suggests to staging then you can submit here.

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


Re: rtlwifi: rtl8821ae: Fix system lockups on boot

2015-10-02 Thread Kalle Valo

> In commit 1277fa2ab2f9 ("rtlwifi: Remove the clear interrupt routine from all
> drivers"), the code that cleared all interrupt enable bits before setting them
> was removed for all PCI drivers. This fixed an issue that caused TX to be
> blocked for 3-5 seconds. On some RTL8821AE units, this change causes soft
> lockups to occur on boot. For that reason, the portion of the earlier commit
> that applied to rtl8821ae is reverted. Kernels 4.1 and newer are affected.
> 
> See http://marc.info/?l=linux-wireless&m=144373370103285&w=2 and
> https://bugzilla.opensuse.org/show_bug.cgi?id=944978 for two cases where
> this regression affected user systems. Note that this bug does not appear on
> any of the developer's setups. For those users whose systems are affected
> by the TX blockage, but do not lock up on boot, a module parameter is added
> to disable the interrupt clear
> 
> Fixes: 1277fa2ab2f9 ("rtlwifi: Remove the clear interrupt routine from all 
> drivers")
> Signed-off-by: Larry Finger 
> Cc: Stable  [V4.1+]

Thanks, applied to wireless-drivers.git.

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