Re: [PATCH] Staging: most: MOST and MOSTCORE should depend on HAS_DMA

2015-09-07 Thread Christian Gromm
On Tue, 1 Sep 2015 22:05:58 +0200
Geert Uytterhoeven  wrote:

> If NO_DMA=y:
> 
> ERROR: "dma_free_coherent" [drivers/staging/most/mostcore/mostcore.ko] 
> undefined!
> ERROR: "dma_alloc_coherent" [drivers/staging/most/mostcore/mostcore.ko] 
> undefined!
> 
> As all MOST sub drivers use DMA functionality, add a dependency on
> HAS_DMA to MOSTCORE, and to MOST, which selects MOSTCORE.
> 
> Signed-off-by: Geert Uytterhoeven 
Acked-by: Christian Gromm 
> ---
>  drivers/staging/most/Kconfig  | 1 +
>  drivers/staging/most/mostcore/Kconfig | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/drivers/staging/most/Kconfig b/drivers/staging/most/Kconfig
> index d50de03de7b98972..0b9b9b539f70562d 100644
> --- a/drivers/staging/most/Kconfig
> +++ b/drivers/staging/most/Kconfig
> @@ -1,5 +1,6 @@
>  menuconfig MOST
>  tristate "MOST driver"
> + depends on HAS_DMA
>  select MOSTCORE
>  default n
>  ---help---
> diff --git a/drivers/staging/most/mostcore/Kconfig 
> b/drivers/staging/most/mostcore/Kconfig
> index 38abf1b21b6623c7..47172546d7280ee6 100644
> --- a/drivers/staging/most/mostcore/Kconfig
> +++ b/drivers/staging/most/mostcore/Kconfig
> @@ -4,6 +4,7 @@
>  
>  config MOSTCORE
>   tristate "MOST Core"
> + depends on HAS_DMA
>  
>   ---help---
> Say Y here if you want to enable MOST support.

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


Re: [PATCH 10/15] Staging: rtl8192u: open braces should appear on the appropriate line in ieee80211_softmac_wx.c

2015-09-07 Thread Sudip Mukherjee
On Sat, Sep 05, 2015 at 07:24:38PM +, Mike Dupuis wrote:
> This is a patch to the ieee80211_softmac_wx.c file that corrects instances 
> where open braces appear on the incorrect line as identified by checkpatch.pl
> 
> Signed-off-by: Mike Dupuis 
> ---
This patch will not apply because of:
1431e81060eb ("Staging: rtl819u: ieee80211: Remove unused variable").

Please refresh your tree.

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


Re: [PATCH v2 3/5] staging/rtl* Remove unused macro definitions.

2015-09-07 Thread Sudip Mukherjee
On Fri, Sep 04, 2015 at 02:00:31PM -0700, Anish Bhatt wrote:
> WLAN_ETHHDR_LEN/WLAN_ETHADDR_LEN/WLAN_ADDR_LEN
>  are unused, duplicate or unnecessary, remove.
> 
> Signed-off-by: Anish Bhatt 
> ---
Please do not mix up different drivers in a single patch. And why do you
have WILC1000 maintainers in cc of this patch?

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


Re: [PATCH 12/15] Staging: rt8192u: add spaces around assignment operators in ieee80211_softmac_wx.c

2015-09-07 Thread Sudip Mukherjee
On Sat, Sep 05, 2015 at 07:29:14PM +, Mike Dupuis wrote:
> This is a patch to add spaces around assignment operators as identifed by 
> checkpatch.pl
> 
> Signed-off-by: Mike Dupuis 
> ---
same problem as in 10/15

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


Re: [PATCH v2 5/7] staging: board: Add support for devices with complex dependencies

2015-09-07 Thread Geert Uytterhoeven
Hi Ulf,

On Mon, Sep 7, 2015 at 1:45 PM, Ulf Hansson  wrote:
> On 4 September 2015 at 17:03, Geert Uytterhoeven  wrote:
>> On Fri, 4 Sep 2015, Ulf Hansson wrote:
>>> On 3 September 2015 at 15:35, Geert Uytterhoeven  
>>> wrote:
>>> > On Thu, Sep 3, 2015 at 2:53 PM, Ulf Hansson  
>>> > wrote:
>>> >> On 17 June 2015 at 10:38, Geert Uytterhoeven  
>>> >> wrote:
>>> >>> Add support for easy registering of one ore more platform devices that
>>> >>> may:
>>> >>>   - need clocks that are described in DT,
>>> >>>   - be part of a PM Domain.
>>> >
>>> >>> diff --git a/drivers/staging/board/board.c 
>>> >>> b/drivers/staging/board/board.c
>>> >>> index 8712f566b31196e0..29d456e29f38feac 100644
>>> >>> --- a/drivers/staging/board/board.c
>>> >>> +++ b/drivers/staging/board/board.c
>>> >
>>> >>> +int __init board_staging_register_device(const struct 
>>> >>> board_staging_dev *dev)
>>> >>> +{
>>> >>> +   struct platform_device *pdev = dev->pdev;
>>> >>> +   unsigned int i;
>>> >>> +   int error;
>>> >>> +
>>> >>> +   pr_debug("Trying to register device %s\n", pdev->name);
>>> >>> +   if (board_staging_dt_node_available(pdev->resource,
>>> >>> +   pdev->num_resources)) {
>>> >>> +   pr_warn("Skipping %s, already in DT\n", pdev->name);
>>> >>> +   return -EEXIST;
>>> >>> +   }
>>> >>> +
>>> >>> +   board_staging_gic_fixup_resources(pdev->resource, 
>>> >>> pdev->num_resources);
>>> >>> +
>>> >>> +   for (i = 0; i < dev->nclocks; i++)
>>> >>> +   board_staging_register_clock(>clocks[i]);
>>> >>> +
>>> >>> +   error = platform_device_register(pdev);
>>> >>> +   if (error) {
>>> >>> +   pr_err("Failed to register device %s (%d)\n", 
>>> >>> pdev->name,
>>> >>> +  error);
>>> >>> +   return error;
>>> >>> +   }
>>> >>> +
>>> >>> +   if (dev->domain)
>>> >>> +   __pm_genpd_name_add_device(dev->domain, >dev, 
>>> >>> NULL);
>>> >>
>>> >> Urgh, this managed to slip through my filters.
>>> >>
>>> >> It seems like we almost managed to remove all users of the
>>> >> "..._name_add..." APIs for genpd. If hasn't been for $subject patch.
>>> >> :-)
>>> >>
>>> >> Now, I realize this is already too late here, but let's try to fix
>>> >> this before it turns into a bigger issue.
>>> >>
>>> >> Geert, do you think it's possible to convert into using the non-named
>>> >> bases APIs?
>>> >
>>> > That will be difficult. This code is meant to use drivers that are not yet
>>> > DT-aware on DT-based systems. Hence it uses platform devices with named PM
>>> > domains, while the PM domains are described in DT.
>>> > I don't think there's another way to look up a PM domain by name, is 
>>> > there?
>>>
>>> As a matter of fact there are, especially for those genpds that has
>>> been created through DT as in this case. The API to use is
>>> of_genpd_get_from_provider() to find the struct generic_pm_domain.
>>
>> Thanks!
>>
>>> Yes, I do realize that you need to manage the parsing of the domain
>>> name to make sure it's the one you want, but I would rather keep that
>>> "hack" in this driver than in the generic API.
>>
>> OK. It turned out not to be that complex, cfr. the patch below.
>> For now this supports PM domains with "#power-domain-cells = <0>" only,
>> but of course it can be extended if the need arises.
>>
>> I've also tried:
>>
>> np = of_find_compatible_node(NULL, NULL, "renesas,sysc-rmobile");
>> np = of_find_node_by_name(np, "a4lc");
>>
>> (the second step is needed because of the domain hierarchy in DT), but that
>> would require adding the compatible string to struct board_staging_dev,
>> and doesn't work if you have multiple identical power providers.
>>
>> I hope you like it?
>>
>> From 5fb11904845eb929a5b3382a9d5153c151cde1cf Mon Sep 17 00:00:00 2001
>> From: Geert Uytterhoeven 
>> Date: Fri, 4 Sep 2015 16:52:33 +0200
>> Subject: [PATCH/RFC] staging: board: Migrate away from
>>  __pm_genpd_name_add_device()
>>
>> The named genpd APIs are deprecated. Hence convert the board staging
>> code from using genpd names to DT node paths.
>>
>> For now this supports PM domains with "#power-domain-cells = <0>" only.
>>
>> Signed-off-by: Geert Uytterhoeven 
>
> Geert, thanks for posting this patch!
>
> I wonder whether we could get this sent for the 4.3 rc[n], since that
> would enable us to remove some of the named based API for genpd
> through Rafael's linux-pm tree during this release cycle.
>
> Reviewed-by: Ulf Hansson 

Thanks!

If GregKH provides his ack, Rafael can take it with your named genpd API
removal series? Shall I resend with an official request?

> Kind regards
> Uffe
>
>> ---
>>  drivers/staging/board/armadillo800eva.c |  2 +-
>>  

[PATCH 1/2] staging: gdm72xx: fix memory leak

2015-09-07 Thread Sudip Mukherjee
We were successfully requesting the firmware but on error it was not
being released.

Signed-off-by: Sudip Mukherjee 
---
 drivers/staging/gdm72xx/usb_boot.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/gdm72xx/usb_boot.c 
b/drivers/staging/gdm72xx/usb_boot.c
index 3ccc447..50fbec3 100644
--- a/drivers/staging/gdm72xx/usb_boot.c
+++ b/drivers/staging/gdm72xx/usb_boot.c
@@ -159,8 +159,10 @@ int usb_boot(struct usb_device *usbdev, u16 pid)
}
 
tx_buf = kmalloc(DOWNLOAD_SIZE, GFP_KERNEL);
-   if (tx_buf == NULL)
+   if (tx_buf == NULL) {
+   release_firmware(firm);
return -ENOMEM;
+   }
 
if (firm->size < sizeof(hdr)) {
dev_err(>dev, "Cannot read the image info.\n");
@@ -285,8 +287,10 @@ static int em_download_image(struct usb_device *usbdev, 
const char *img_name,
}
 
buf = kmalloc(DOWNLOAD_CHUCK + pad_size, GFP_KERNEL);
-   if (buf == NULL)
+   if (buf == NULL) {
+   release_firmware(firm);
return -ENOMEM;
+   }
 
strcpy(buf+pad_size, type_string);
ret = gdm_wibro_send(usbdev, buf, strlen(type_string)+pad_size);
-- 
1.9.1

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


[PATCH 2/2] staging: gdm72xx: NULL comparison style

2015-09-07 Thread Sudip Mukherjee
checkpatch complains if NULL comparison is done as if (var == NULL)

Signed-off-by: Sudip Mukherjee 
---
 drivers/staging/gdm72xx/gdm_qos.c   |  2 +-
 drivers/staging/gdm72xx/gdm_sdio.c  | 20 ++--
 drivers/staging/gdm72xx/gdm_usb.c   | 16 
 drivers/staging/gdm72xx/gdm_wimax.c |  4 ++--
 drivers/staging/gdm72xx/sdio_boot.c |  4 ++--
 drivers/staging/gdm72xx/usb_boot.c  |  4 ++--
 6 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/gdm72xx/gdm_qos.c 
b/drivers/staging/gdm72xx/gdm_qos.c
index 96bf2bf..72c0f7ef 100644
--- a/drivers/staging/gdm72xx/gdm_qos.c
+++ b/drivers/staging/gdm72xx/gdm_qos.c
@@ -190,7 +190,7 @@ static int get_qos_index(struct nic *nic, u8 *iph, u8 
*tcpudph)
int ip_ver, i;
struct qos_cb_s *qcb = >qos;
 
-   if (iph == NULL || tcpudph == NULL)
+   if (!iph || !tcpudph)
return -1;
 
ip_ver = (iph[0]>>4)&0xf;
diff --git a/drivers/staging/gdm72xx/gdm_sdio.c 
b/drivers/staging/gdm72xx/gdm_sdio.c
index a5fd079..b0521da 100644
--- a/drivers/staging/gdm72xx/gdm_sdio.c
+++ b/drivers/staging/gdm72xx/gdm_sdio.c
@@ -173,12 +173,12 @@ static int init_sdio(struct sdiowm_dev *sdev)
spin_lock_init(>lock);
 
tx->sdu_buf = kmalloc(SDU_TX_BUF_SIZE, GFP_KERNEL);
-   if (tx->sdu_buf == NULL)
+   if (!tx->sdu_buf)
goto fail;
 
for (i = 0; i < MAX_NR_SDU_BUF; i++) {
t = alloc_tx_struct(tx);
-   if (t == NULL) {
+   if (!t) {
ret = -ENOMEM;
goto fail;
}
@@ -192,7 +192,7 @@ static int init_sdio(struct sdiowm_dev *sdev)
 
for (i = 0; i < MAX_NR_RX_BUF; i++) {
r = alloc_rx_struct(rx);
-   if (r == NULL) {
+   if (!r) {
ret = -ENOMEM;
goto fail;
}
@@ -200,7 +200,7 @@ static int init_sdio(struct sdiowm_dev *sdev)
}
 
rx->rx_buf = kmalloc(RX_BUF_SIZE, GFP_KERNEL);
-   if (rx->rx_buf == NULL)
+   if (!rx->rx_buf)
goto fail;
 
return 0;
@@ -359,7 +359,7 @@ static void do_tx(struct work_struct *work)
is_sdu = 1;
}
 
-   if (!is_sdu && t == NULL) {
+   if (!is_sdu && !t) {
spin_unlock_irqrestore(>lock, flags);
return;
}
@@ -393,7 +393,7 @@ static int gdm_sdio_send(void *priv_dev, void *data, int 
len,
cmd_evt = (pkt[0] << 8) | pkt[1];
if (cmd_evt == WIMAX_TX_SDU) {
t = get_tx_struct(tx, _spc);
-   if (t == NULL) {
+   if (!t) {
/* This case must not happen. */
spin_unlock_irqrestore(>lock, flags);
return -ENOSPC;
@@ -407,7 +407,7 @@ static int gdm_sdio_send(void *priv_dev, void *data, int 
len,
t->cb_data = cb_data;
} else {
t = alloc_tx_struct(tx);
-   if (t == NULL) {
+   if (!t) {
spin_unlock_irqrestore(>lock, flags);
return -ENOMEM;
}
@@ -581,7 +581,7 @@ static int gdm_sdio_receive(void *priv_dev,
 
spin_lock_irqsave(>lock, flags);
r = get_rx_struct(rx);
-   if (r == NULL) {
+   if (!r) {
spin_unlock_irqrestore(>lock, flags);
return -ENOMEM;
}
@@ -615,12 +615,12 @@ static int sdio_wimax_probe(struct sdio_func *func,
return ret;
 
phy_dev = kzalloc(sizeof(*phy_dev), GFP_KERNEL);
-   if (phy_dev == NULL) {
+   if (!phy_dev) {
ret = -ENOMEM;
goto out;
}
sdev = kzalloc(sizeof(*sdev), GFP_KERNEL);
-   if (sdev == NULL) {
+   if (!sdev) {
ret = -ENOMEM;
goto out;
}
diff --git a/drivers/staging/gdm72xx/gdm_usb.c 
b/drivers/staging/gdm72xx/gdm_usb.c
index eac2f34..16e497d 100644
--- a/drivers/staging/gdm72xx/gdm_usb.c
+++ b/drivers/staging/gdm72xx/gdm_usb.c
@@ -139,7 +139,7 @@ static struct usb_rx *get_rx_struct(struct rx_cxt *rx)
 
if (list_empty(>free_list)) {
r = alloc_rx_struct(rx);
-   if (r == NULL)
+   if (!r)
return NULL;
 
list_add(>list, >free_list);
@@ -224,7 +224,7 @@ static int init_usb(struct usbwm_dev *udev)
spin_lock_irqsave(>lock, flags);
for (i = 0; i < MAX_NR_SDU_BUF; i++) {
t = alloc_tx_struct(tx);
-   if (t == NULL) {
+   if (!t) {
spin_unlock_irqrestore(>lock, flags);
ret = -ENOMEM;
goto fail;
@@ -234,7 +234,7 @@ static int init_usb(struct usbwm_dev *udev)
spin_unlock_irqrestore(>lock, flags);
 
r = alloc_rx_struct(rx);
-   if 

[PATCH 1/3] staging: wilc1000: remove dead codes

2015-09-07 Thread Tony Cho
This patch removes the preprocessor definition from the codes, as shown in the
following, which is not used anymore.
- WILC_FULLY_HOSTING_AP

Signed-off-by: Tony Cho 
---
 drivers/staging/wilc1000/linux_mon.c  | 97 ---
 drivers/staging/wilc1000/linux_wlan.c | 13 ---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 48 ---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |  5 --
 drivers/staging/wilc1000/wilc_wlan.c  | 48 ---
 drivers/staging/wilc1000/wilc_wlan.h  |  7 --
 drivers/staging/wilc1000/wilc_wlan_cfg.c  | 28 ---
 drivers/staging/wilc1000/wilc_wlan_if.h   |  9 ---
 8 files changed, 255 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_mon.c 
b/drivers/staging/wilc1000/linux_mon.c
index b8d7d04..b5db23f 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -11,9 +11,6 @@
 #include "wilc_wlan_if.h"
 #include "wilc_wlan.h"
 
-#ifdef WILC_FULLY_HOSTING_AP
-#include "wilc_host_ap.h"
-#endif
 #ifdef WILC_AP_EXTERNAL_MLME
 
 struct wilc_wfi_radiotap_hdr {
@@ -222,11 +219,9 @@ static void mgmt_tx_complete(void *priv, int status)
  *  }*/
 
/* incase of fully hosting mode, the freeing will be done in response 
to the cfg packet */
-   #ifndef WILC_FULLY_HOSTING_AP
kfree(pv_data->buff);
 
kfree(pv_data);
-   #endif
 }
 static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len)
 {
@@ -244,11 +239,6 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 
*buf, size_t len)
return WILC_FAIL;
}
 
-   #ifdef WILC_FULLY_HOSTING_AP
-   /* add space for the pointer to tx_complete_mon_data */
-   len += sizeof(struct tx_complete_mon_data *);
-   #endif
-
mgmt_tx->buff = kmalloc(len, GFP_ATOMIC);
if (mgmt_tx->buff == NULL) {
PRINT_ER("Failed to allocate memory for mgmt_tx buff\n");
@@ -258,19 +248,7 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 
*buf, size_t len)
 
mgmt_tx->size = len;
 
-   #ifndef WILC_FULLY_HOSTING_AP
memcpy(mgmt_tx->buff, buf, len);
-   #else
-   memcpy(mgmt_tx->buff, buf, len - sizeof(struct tx_complete_mon_data *));
-   memcpy((mgmt_tx->buff) + (len - sizeof(struct tx_complete_mon_data *)), 
_tx, sizeof(struct tx_complete_mon_data *));
-
-   /* filter data frames to handle it's PS */
-   if (filter_monitor_data_frames((mgmt_tx->buff), len) == true) {
-   return;
-   }
-
-   #endif /* WILC_FULLY_HOSTING_AP */
-
g_linux_wlan->oup.wlan_add_mgmt_to_tx_que(mgmt_tx, mgmt_tx->buff, 
mgmt_tx->size, mgmt_tx_complete);
 
netif_wake_queue(dev);
@@ -389,81 +367,6 @@ static const struct net_device_ops wilc_wfi_netdev_ops = {
 
 };
 
-#ifdef WILC_FULLY_HOSTING_AP
-/*
- *  @brief  WILC_mgm_HOSTAPD_ACK
- *  @detailsreport the status of transmitted mgmt frames to HOSTAPD
- *  @param[in]  priv : pointer to tx_complete_mon_data struct
- * bStatus : status of transmission
- *  @authorAbd Al-Rahman Diab
- *  @date  9 May 2013
- *  @version   1.0
- */
-void WILC_mgm_HOSTAPD_ACK(void *priv, bool bStatus)
-{
-   struct sk_buff *skb;
-   struct wilc_wfi_radiotap_cb_hdr *cb_hdr;
-
-   struct tx_complete_mon_data *pv_data = (struct tx_complete_mon_data 
*)priv;
-   u8 *buf =  pv_data->buff;
-
-   /* len of the original frame without the added pointer at the tail */
-   u16 u16len = (pv_data->size) - sizeof(struct tx_complete_mon_data *);
-
-
-   /*if(bStatus == 1){
-*  if(INFO || buf[0] == 0x10 || buf[0] == 0xb0)
-*  PRINT_D(HOSTAPD_DBG,"Packet sent successfully - Size = %d - 
Address = %p.\n",u16len,pv_data->buff);
-* }else{
-*  PRINT_D(HOSTAPD_DBG,"Couldn't send packet - Size = %d - 
Address = %p.\n",u16len,pv_data->buff);
-*  }
-*/
-
-   /* (skb->data[9] == 0x00 || skb->data[9] == 0xb0 || skb->data[9] == 
0x40 ||  skb->data[9] == 0xd0 ) */
-   {
-   skb = dev_alloc_skb(u16len + sizeof(struct 
wilc_wfi_radiotap_cb_hdr));
-
-   memcpy(skb_put(skb, u16len), pv_data->buff, u16len);
-
-   cb_hdr = (struct wilc_wfi_radiotap_cb_hdr *) skb_push(skb, 
sizeof(*cb_hdr));
-   memset(cb_hdr, 0, sizeof(struct wilc_wfi_radiotap_cb_hdr));
-
-   cb_hdr->hdr.it_version = 0; /* PKTHDR_RADIOTAP_VERSION; */
-
-   cb_hdr->hdr.it_len = cpu_to_le16(sizeof(struct 
wilc_wfi_radiotap_cb_hdr));
-
-   cb_hdr->hdr.it_present = cpu_to_le32(
-   (1 << IEEE80211_RADIOTAP_RATE) |
-   (1 << IEEE80211_RADIOTAP_TX_FLAGS));
-
-   cb_hdr->rate = 5; /* txrate->bitrate / 5; */
-
-
-   if (bStatus) 

[PATCH 2/3] staging: wilc1000: remove unused preprocessor definition

2015-09-07 Thread Tony Cho
This patch removes a preprocessor definition, SWITCH_LOG_TERMINAL,
which is not used. Enabling this definition affects the performance.

Signed-off-by: Tony Cho 
---
 drivers/staging/wilc1000/linux_wlan.c| 6 --
 drivers/staging/wilc1000/wilc_wlan_cfg.c | 8 
 2 files changed, 14 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 4187c7c..59c9b44 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -926,12 +926,6 @@ static int linux_wlan_init_test_config(struct net_device 
*dev, linux_wlan_t *p_n
if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_11N_PROT_MECH, c_val, 1, 0, 
0))
goto _fail_;
 
-#ifdef SWITCH_LOG_TERMINAL
-   c_val[0] = AUTO_PROT;
-   if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_LOGTerminal_Switch, c_val, 
1, 0, 0))
-   goto _fail_;
-#endif
-
c_val[0] = ACTIVE_SCAN;
if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_SCAN_TYPE, c_val, 1, 0, 0))
goto _fail_;
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index d503799..21ed14d 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -534,14 +534,6 @@ static int wilc_wlan_cfg_indicate_rx(uint8_t *frame, int 
size, wilc_cfg_rsp_t *r
GnrlAsyncInfoReceived(frame - 4, size + 4);
break;
 
-   case 'L':
-#ifndef SWITCH_LOG_TERMINAL
-   PRINT_ER("Unexpected firmware log message received\n");
-#else
-   PRINT_D(FIRM_DBG, "\nFIRMWARE LOGS :\n<<\n%s\n>>\n", frame);
-   break;
-
-#endif
 #if 1
case 'N':
NetworkInfoReceived(frame - 4, size + 4);
-- 
1.9.1

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


Re: [PATCH 3/5] staging: most: remove driver owner

2015-09-07 Thread Sudip Mukherjee
On Mon, Sep 07, 2015 at 02:13:38PM +0200, Andrey Shvetsov wrote:
> On Fri, Sep 04, 2015 at 04:22:04PM +0530, Sudip Mukherjee wrote:
> > The platform driver core will set the owner value, we do not need to do
> > it in the module.
> > 
> > Signed-off-by: Sudip Mukherjee 
> > ---
> >  drivers/staging/most/hdm-dim2/dim2_hdm.c | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c 
> > b/drivers/staging/most/hdm-dim2/dim2_hdm.c
> > index 5b0a588..4481a0b 100644
> > --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c
> > +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c
> > @@ -923,7 +923,6 @@ static struct platform_driver dim2_driver = {
> > .id_table = dim2_id,
> > .driver = {
> > .name = "hdm_dim2",
> > -   .owner = THIS_MODULE,
> I cannot accept this.
> 
> This change is not significant for current kernel, but we still have customers
> using kernels <= 3.10, where auto assignment of .owner does not exist.
But this patch is for 4.4-rc1, and it is not marked for stable. Then how
is it going to affect your customers who are still using <=3.10?

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


Re: [PATCH v2 5/7] staging: board: Add support for devices with complex dependencies

2015-09-07 Thread Ulf Hansson
On 4 September 2015 at 17:03, Geert Uytterhoeven  wrote:
> Hi Ulf,
>
> On Fri, 4 Sep 2015, Ulf Hansson wrote:
>> On 3 September 2015 at 15:35, Geert Uytterhoeven  
>> wrote:
>> > On Thu, Sep 3, 2015 at 2:53 PM, Ulf Hansson  wrote:
>> >> On 17 June 2015 at 10:38, Geert Uytterhoeven  
>> >> wrote:
>> >>> Add support for easy registering of one ore more platform devices that
>> >>> may:
>> >>>   - need clocks that are described in DT,
>> >>>   - be part of a PM Domain.
>> >
>> >>> diff --git a/drivers/staging/board/board.c 
>> >>> b/drivers/staging/board/board.c
>> >>> index 8712f566b31196e0..29d456e29f38feac 100644
>> >>> --- a/drivers/staging/board/board.c
>> >>> +++ b/drivers/staging/board/board.c
>> >
>> >>> +int __init board_staging_register_device(const struct board_staging_dev 
>> >>> *dev)
>> >>> +{
>> >>> +   struct platform_device *pdev = dev->pdev;
>> >>> +   unsigned int i;
>> >>> +   int error;
>> >>> +
>> >>> +   pr_debug("Trying to register device %s\n", pdev->name);
>> >>> +   if (board_staging_dt_node_available(pdev->resource,
>> >>> +   pdev->num_resources)) {
>> >>> +   pr_warn("Skipping %s, already in DT\n", pdev->name);
>> >>> +   return -EEXIST;
>> >>> +   }
>> >>> +
>> >>> +   board_staging_gic_fixup_resources(pdev->resource, 
>> >>> pdev->num_resources);
>> >>> +
>> >>> +   for (i = 0; i < dev->nclocks; i++)
>> >>> +   board_staging_register_clock(>clocks[i]);
>> >>> +
>> >>> +   error = platform_device_register(pdev);
>> >>> +   if (error) {
>> >>> +   pr_err("Failed to register device %s (%d)\n", pdev->name,
>> >>> +  error);
>> >>> +   return error;
>> >>> +   }
>> >>> +
>> >>> +   if (dev->domain)
>> >>> +   __pm_genpd_name_add_device(dev->domain, >dev, 
>> >>> NULL);
>> >>
>> >> Urgh, this managed to slip through my filters.
>> >>
>> >> It seems like we almost managed to remove all users of the
>> >> "..._name_add..." APIs for genpd. If hasn't been for $subject patch.
>> >> :-)
>> >>
>> >> Now, I realize this is already too late here, but let's try to fix
>> >> this before it turns into a bigger issue.
>> >>
>> >> Geert, do you think it's possible to convert into using the non-named
>> >> bases APIs?
>> >
>> > That will be difficult. This code is meant to use drivers that are not yet
>> > DT-aware on DT-based systems. Hence it uses platform devices with named PM
>> > domains, while the PM domains are described in DT.
>> > I don't think there's another way to look up a PM domain by name, is there?
>>
>> As a matter of fact there are, especially for those genpds that has
>> been created through DT as in this case. The API to use is
>> of_genpd_get_from_provider() to find the struct generic_pm_domain.
>
> Thanks!
>
>> Yes, I do realize that you need to manage the parsing of the domain
>> name to make sure it's the one you want, but I would rather keep that
>> "hack" in this driver than in the generic API.
>
> OK. It turned out not to be that complex, cfr. the patch below.
> For now this supports PM domains with "#power-domain-cells = <0>" only,
> but of course it can be extended if the need arises.
>
> I've also tried:
>
> np = of_find_compatible_node(NULL, NULL, "renesas,sysc-rmobile");
> np = of_find_node_by_name(np, "a4lc");
>
> (the second step is needed because of the domain hierarchy in DT), but that
> would require adding the compatible string to struct board_staging_dev,
> and doesn't work if you have multiple identical power providers.
>
> I hope you like it?
>
> From 5fb11904845eb929a5b3382a9d5153c151cde1cf Mon Sep 17 00:00:00 2001
> From: Geert Uytterhoeven 
> Date: Fri, 4 Sep 2015 16:52:33 +0200
> Subject: [PATCH/RFC] staging: board: Migrate away from
>  __pm_genpd_name_add_device()
>
> The named genpd APIs are deprecated. Hence convert the board staging
> code from using genpd names to DT node paths.
>
> For now this supports PM domains with "#power-domain-cells = <0>" only.
>
> Signed-off-by: Geert Uytterhoeven 

Geert, thanks for posting this patch!

I wonder whether we could get this sent for the 4.3 rc[n], since that
would enable us to remove some of the named based API for genpd
through Rafael's linux-pm tree during this release cycle.

Reviewed-by: Ulf Hansson 

Kind regards
Uffe

> ---
>  drivers/staging/board/armadillo800eva.c |  2 +-
>  drivers/staging/board/board.c   | 36 
> -
>  2 files changed, 36 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/board/armadillo800eva.c 
> b/drivers/staging/board/armadillo800eva.c
> index 0165591a52443c46..912c96b0536def7c 100644
> --- a/drivers/staging/board/armadillo800eva.c
> +++ 

[PATCH 2/5] staging: wilc1000: linux_wlan.c: add kzalloc error check

2015-09-07 Thread Chaehyun Lim
This patch adds error check if kzalloc is failed.

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index f7dda75..76c48a4 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -2270,6 +2270,8 @@ int wilc_netdev_init(void)
 
/*create the common structure*/
g_linux_wlan = kzalloc(sizeof(linux_wlan_t), GFP_KERNEL);
+   if (!g_linux_wlan)
+   return -ENOMEM;
 
/*Reset interrupt count debug*/
int_rcvdU = 0;
-- 
2.5.1

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


[PATCH 3/5] staging: wilc1000: remove commented codes

2015-09-07 Thread Chaehyun Lim
This patch removes commented codes.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/coreconfigurator.c |  7 ---
 drivers/staging/wilc1000/host_interface.c   | 88 -
 drivers/staging/wilc1000/linux_mon.c| 61 
 drivers/staging/wilc1000/linux_wlan.c   | 28 -
 drivers/staging/wilc1000/wilc_sdio.c|  4 --
 drivers/staging/wilc1000/wilc_wlan.c|  3 -
 drivers/staging/wilc1000/wilc_wlan_cfg.c|  3 -
 drivers/staging/wilc1000/wilc_wlan_if.h |  3 -
 8 files changed, 197 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 1889195..f9a46d5 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -1463,7 +1463,6 @@ void ProcessBinWid(char *pcPacket, s32 *ps32PktLen,
u16MsgLen = (u16)s32ValueSize;
 
/* Length */
-   /* pcPacket[s32PktLen++] = (u8)u16MsgLen; */
pcPacket[s32PktLen++] = (u8)(u16MsgLen  & 0xFF);
pcPacket[s32PktLen++] = (u8)((u16MsgLen >> 8) & 0xFF);
 
@@ -1548,7 +1547,6 @@ s32 further_process_response(u8 *resp,
 
cfg_sht = MAKE_WORD16(resp[idx], resp[idx + 1]);
/*Set local copy of WID*/
-   /* pstrWIDresult->ps8WidVal = (s8*)(s32)cfg_sht; */
*pu16val = cfg_sht;
break;
}
@@ -1562,14 +1560,12 @@ s32 further_process_response(u8 *resp,
MAKE_WORD16(resp[idx + 2], resp[idx + 3])
);
/*Set local copy of WID*/
-   /* pstrWIDresult->ps8WidVal = (s8*)cfg_int; */
*pu32val = cfg_int;
break;
}
 
case WID_STR:
memcpy(cfg_str, resp + idx, cfg_len);
-   /* cfg_str[cfg_len] = '\0'; //mostafa: no need currently for 
NULL termination */
if (pstrWIDresult->s32ValueSize >= cfg_len) {
memcpy(pstrWIDresult->ps8WidVal, cfg_str, cfg_len); /* 
mostafa: no need currently for the extra NULL byte */
pstrWIDresult->s32ValueSize = cfg_len;
@@ -1863,9 +1859,6 @@ s32 ConfigWaitResponse(char *pcRespBuffer, s32 
s32MaxRespBuffLen, s32 *ps32Bytes
s32 s32Error = WILC_SUCCESS;
/*bug 3878*/
/*removed to caller function*/
-   /*gstrConfigPktInfo.pcRespBuffer = pcRespBuffer;
-* gstrConfigPktInfo.s32MaxRespBuffLen = s32MaxRespBuffLen;
-* gstrConfigPktInfo.bRespRequired = bRespRequired;*/
 
 
if (gstrConfigPktInfo.bRespRequired) {
diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 8458d8d..e09508e 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1405,7 +1405,6 @@ static s32 Handle_Scan(tstrWILC_WFIDrv *drvHandler, 
tstrHostIFscanAttr *pstrHost
u32WidsCount++;
 
/*keep the state as is , no need to change it*/
-   /* gWFiDrvHandle->enuHostIFstate = HOST_IF_SCANNING; */
 
if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED)
gbScanWhileConnected = true;
@@ -1641,8 +1640,6 @@ static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, 
tstrHostIFconnectAttr *ps
pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid = 
pstrHostIFconnectAttr->pvUserArg;
 
 
-   /* if((gWFiDrvHandle->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) 
&& */
-   /* (gWFiDrvHandle->strWILC_UsrConnReq.ConnReqIEsLen != 0)) */
{
/* IEs to be inserted in Association Request */
strWIDList[u32WidsCount].u16WIDid = 
WID_INFO_ELEMENT_ASSOCIATE;
@@ -1666,13 +1663,6 @@ static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, 
tstrHostIFconnectAttr *ps
u32WidsCount++;
 
PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", 
pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type);
-   /*
-* strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_PSK;
-* strWIDList[u32WidsCount].enuWIDtype = WID_STR;
-* strWIDList[u32WidsCount].s32ValueSize = sizeof(passphrase);
-* strWIDList[u32WidsCount].ps8WidVal = (s8*)(passphrase);
-* u32WidsCount++;
-*/
 
strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ;
strWIDList[u32WidsCount].enuWIDtype = WID_CHAR;
@@ -1766,8 +1756,6 @@ static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, 
tstrHostIFconnectAttr *ps
strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(dummyval));
u32WidsCount++;
 
-   /* if((gWFiDrvHandle->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) && */
-   /* (gWFiDrvHandle->strWILC_UsrConnReq.ConnReqIEsLen != 0)) */
{
/* IEs to 

[PATCH 1/5] staging: wilc1000: linux_wlan.c: use kzalloc instead of WILC_MALLOC

2015-09-07 Thread Chaehyun Lim
This patch replaces WILC_MALLOC with kzalloc.

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index afd6702..f7dda75 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -2269,8 +2269,7 @@ int wilc_netdev_init(void)
sema_init(_exit_sync, 0);
 
/*create the common structure*/
-   g_linux_wlan = WILC_MALLOC(sizeof(linux_wlan_t));
-   memset(g_linux_wlan, 0, sizeof(linux_wlan_t));
+   g_linux_wlan = kzalloc(sizeof(linux_wlan_t), GFP_KERNEL);
 
/*Reset interrupt count debug*/
int_rcvdU = 0;
-- 
2.5.1

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


[PATCH 5/5] staging: wilc1000: host_interface.c: fix build warning

2015-09-07 Thread Chaehyun Lim
This patch remove build build warning from Handle_SetOperationMode function.
Host interface operation mode has one of 4 types from AP_MODE, STATION_MODE,
GO_MODE and CLIENT_MODE.
This values are range from 0x01 to 0x04 if mode is set correctly.
If value of host interface operation is 0, it is not initialized any value
because struct tstrHostIFmsg is initialized by zeroes.

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 e09508e..3be3b4c 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -754,7 +754,7 @@ static s32 Handle_SetOperationMode(tstrWILC_WFIDrv 
*drvHandler, tstrHostIfSetOpe
 get_id_from_handler(pstrWFIDrv));
 
 
-   if ((pstrHostIfSetOperationMode->u32Mode) == (u32)NULL)
+   if (!pstrHostIfSetOperationMode->u32Mode)
up();
 
 
-- 
2.5.1

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


[PATCH 4/5] staging: wilc1000: wilc_msgqueue.c: use kmalloc with GFP_ATOMIC

2015-09-07 Thread Chaehyun Lim
This patch use kmalloc with GFP_ATOMIC instead of WILC_MALLOC.
It is inside the spin lock region.

Signed-off-by: Chaehyun Lim 
---
 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 76d2e63..41244ce 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -72,7 +72,7 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle,
WILC_NULLCHECK(s32RetStatus, pstrMessage);
pstrMessage->u32Length = u32SendBufferSize;
pstrMessage->pstrNext = NULL;
-   pstrMessage->pvBuffer = WILC_MALLOC(u32SendBufferSize);
+   pstrMessage->pvBuffer = kmalloc(u32SendBufferSize, GFP_ATOMIC);
WILC_NULLCHECK(s32RetStatus, pstrMessage->pvBuffer);
memcpy(pstrMessage->pvBuffer, pvSendBuffer, u32SendBufferSize);
 
-- 
2.5.1

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


[PATCH 3/4] hv: kvp: use wrapper to propate state

2015-09-07 Thread Olaf Hering
The .state is used by several threads of execution.
Propagate the state to make changes visible. Also propagate context
change in kvp_on_msg.

Signed-off-by: Olaf Hering 
---
 drivers/hv/hv_kvp.c | 38 +-
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c
index 74c38a9..f421691 100644
--- a/drivers/hv/hv_kvp.c
+++ b/drivers/hv/hv_kvp.c
@@ -61,7 +61,7 @@
  */
 
 static struct {
-   int state;   /* hvutil_device_state */
+   enum hvutil_device_state state;
int recv_len; /* number of bytes received. */
struct hv_kvp_msg  *kvp_msg; /* current message */
struct vmbus_channel *recv_channel; /* chn we got the request */
@@ -74,6 +74,9 @@ static struct {
  */
 static int dm_reg_value;
 
+#define kvp_get_state() hvutil_device_get_state(_transaction.state)
+#define kvp_set_state(s) hvutil_device_set_state(_transaction.state, s)
+
 static void kvp_send_key(struct work_struct *dummy);
 
 
@@ -122,8 +125,8 @@ static void kvp_timeout_func(struct work_struct *dummy)
kvp_respond_to_host(NULL, HV_E_FAIL);
 
/* Transaction is finished, reset the state. */
-   if (kvp_transaction.state > HVUTIL_READY)
-   kvp_transaction.state = HVUTIL_READY;
+   if (kvp_get_state() > HVUTIL_READY)
+   kvp_set_state(HVUTIL_READY);
 
hv_poll_channel(kvp_transaction.kvp_context,
hv_kvp_onchannelcallback);
@@ -153,7 +156,7 @@ static int kvp_handle_handshake(struct hv_kvp_msg *msg)
pr_debug("KVP: userspace daemon ver. %d registered\n",
 KVP_OP_REGISTER);
kvp_register(dm_reg_value);
-   kvp_transaction.state = HVUTIL_READY;
+   kvp_set_state(HVUTIL_READY);
 
return 0;
 }
@@ -177,15 +180,15 @@ static int kvp_on_msg(void *msg, int len)
 * with the daemon; handle that first.
 */
 
-   if (kvp_transaction.state < HVUTIL_READY) {
+   if (kvp_get_state() < HVUTIL_READY) {
return kvp_handle_handshake(message);
}
 
/* We didn't send anything to userspace so the reply is spurious */
-   if (kvp_transaction.state < HVUTIL_USERSPACE_REQ)
+   if (kvp_get_state() < HVUTIL_USERSPACE_REQ)
return -EINVAL;
 
-   kvp_transaction.state = HVUTIL_USERSPACE_RECV;
+   kvp_set_state(HVUTIL_USERSPACE_RECV);
 
/*
 * Based on the version of the daemon, we propagate errors from the
@@ -218,7 +221,7 @@ static int kvp_on_msg(void *msg, int len)
 */
if (cancel_delayed_work_sync(_timeout_work)) {
kvp_respond_to_host(message, error);
-   kvp_transaction.state = HVUTIL_READY;
+   kvp_set_state(HVUTIL_READY);
hv_poll_channel(kvp_transaction.kvp_context,
hv_kvp_onchannelcallback);
}
@@ -349,7 +352,7 @@ kvp_send_key(struct work_struct *dummy)
int rc;
 
/* The transaction state is wrong. */
-   if (kvp_transaction.state != HVUTIL_HOSTMSG_RECEIVED)
+   if (kvp_get_state() != HVUTIL_HOSTMSG_RECEIVED)
return;
 
message = kzalloc(sizeof(*message), GFP_KERNEL);
@@ -442,13 +445,13 @@ kvp_send_key(struct work_struct *dummy)
break;
}
 
-   kvp_transaction.state = HVUTIL_USERSPACE_REQ;
+   kvp_set_state(HVUTIL_USERSPACE_REQ);
rc = hvutil_transport_send(hvt, message, sizeof(*message));
if (rc) {
pr_debug("KVP: failed to communicate to the daemon: %d\n", rc);
if (cancel_delayed_work_sync(_timeout_work)) {
kvp_respond_to_host(message, HV_E_FAIL);
-   kvp_transaction.state = HVUTIL_READY;
+   kvp_set_state(HVUTIL_READY);
}
}
 
@@ -596,12 +599,13 @@ void hv_kvp_onchannelcallback(void *context)
int util_fw_version;
int kvp_srv_version;
 
-   if (kvp_transaction.state > HVUTIL_READY) {
+   if (kvp_get_state() > HVUTIL_READY) {
/*
 * We will defer processing this callback once
 * the current transaction is complete.
 */
kvp_transaction.kvp_context = context;
+   wmb();
return;
}
kvp_transaction.kvp_context = NULL;
@@ -651,12 +655,12 @@ void hv_kvp_onchannelcallback(void *context)
kvp_transaction.recv_req_id = requestid;
kvp_transaction.kvp_msg = kvp_msg;
 
-   if (kvp_transaction.state < HVUTIL_READY) {
+   if (kvp_get_state() < HVUTIL_READY) {
/* Userspace is not registered yet */
kvp_respond_to_host(NULL, HV_E_FAIL);
return;
}
-   

[PATCH 1/4] hv: add helpers to handle hv_util device state

2015-09-07 Thread Olaf Hering
The callbacks in kvp, vss and fcopy code are called the main thread and
also from interrupt context. If a state change is done by the main
thread it is not immediately seen by the interrupt. As a result the
state machine gets out of sync.

Force propagation of state changes via get/set helpers with a memory barrier.

Signed-off-by: Olaf Hering 
---
 drivers/hv/hyperv_vmbus.h | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
index 3d70e36..6c03925 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
@@ -780,4 +780,16 @@ enum hvutil_device_state {
HVUTIL_DEVICE_DYING, /* driver unload is in progress */
 };
 
+static inline void hvutil_device_set_state(enum hvutil_device_state *p, enum 
hvutil_device_state s)
+{
+   *p = s;
+   wmb();
+}
+
+static inline enum hvutil_device_state hvutil_device_get_state(enum 
hvutil_device_state *p)
+{
+   rmb();
+   return *p;
+}
+
 #endif /* _HYPERV_VMBUS_H */
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 4/4] hv: vss: use wrapper to propate state

2015-09-07 Thread Olaf Hering
The .state is used by several threads of execution.
Propagate the state to make changes visible. Also propagate context
change in vss_on_msg.

Signed-off-by: Olaf Hering 
---
 drivers/hv/hv_snapshot.c | 37 -
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/drivers/hv/hv_snapshot.c b/drivers/hv/hv_snapshot.c
index 815405f..f3cb822 100644
--- a/drivers/hv/hv_snapshot.c
+++ b/drivers/hv/hv_snapshot.c
@@ -48,7 +48,7 @@
  */
 
 static struct {
-   int state;   /* hvutil_device_state */
+   enum hvutil_device_state state;
int recv_len; /* number of bytes received. */
struct vmbus_channel *recv_channel; /* chn we got the request */
u64 recv_req_id; /* request ID. */
@@ -64,6 +64,9 @@ static void vss_respond_to_host(int error);
  */
 static int dm_reg_value;
 
+#define vss_get_state() hvutil_device_get_state(_transaction.state)
+#define vss_set_state(s) hvutil_device_set_state(_transaction.state, s)
+
 static const char vss_devname[] = "vmbus/hv_vss";
 static __u8 *recv_buffer;
 static struct hvutil_transport *hvt;
@@ -87,8 +90,8 @@ static void vss_timeout_func(struct work_struct *dummy)
vss_respond_to_host(HV_E_FAIL);
 
/* Transaction is finished, reset the state. */
-   if (vss_transaction.state > HVUTIL_READY)
-   vss_transaction.state = HVUTIL_READY;
+   if (vss_get_state() > HVUTIL_READY)
+   vss_set_state(HVUTIL_READY);
 
hv_poll_channel(vss_transaction.vss_context,
hv_vss_onchannelcallback);
@@ -112,7 +115,7 @@ static int vss_handle_handshake(struct hv_vss_msg *vss_msg)
default:
return -EINVAL;
}
-   vss_transaction.state = HVUTIL_READY;
+   vss_set_state(HVUTIL_READY);
pr_debug("VSS: userspace daemon ver. %d registered\n", dm_reg_value);
return 0;
 }
@@ -130,15 +133,15 @@ static int vss_on_msg(void *msg, int len)
 * Don't process registration messages if we're in the middle
 * of a transaction processing.
 */
-   if (vss_transaction.state > HVUTIL_READY)
+   if (vss_get_state() > HVUTIL_READY)
return -EINVAL;
return vss_handle_handshake(vss_msg);
-   } else if (vss_transaction.state == HVUTIL_USERSPACE_REQ) {
-   vss_transaction.state = HVUTIL_USERSPACE_RECV;
+   } else if (vss_get_state() == HVUTIL_USERSPACE_REQ) {
+   vss_set_state(HVUTIL_USERSPACE_RECV);
if (cancel_delayed_work_sync(_timeout_work)) {
vss_respond_to_host(vss_msg->error);
/* Transaction is finished, reset the state. */
-   vss_transaction.state = HVUTIL_READY;
+   vss_set_state(HVUTIL_READY);
hv_poll_channel(vss_transaction.vss_context,
hv_vss_onchannelcallback);
}
@@ -158,7 +161,7 @@ static void vss_send_op(struct work_struct *dummy)
struct hv_vss_msg *vss_msg;
 
/* The transaction state is wrong. */
-   if (vss_transaction.state != HVUTIL_HOSTMSG_RECEIVED)
+   if (vss_get_state() != HVUTIL_HOSTMSG_RECEIVED)
return;
 
vss_msg = kzalloc(sizeof(*vss_msg), GFP_KERNEL);
@@ -167,13 +170,13 @@ static void vss_send_op(struct work_struct *dummy)
 
vss_msg->vss_hdr.operation = op;
 
-   vss_transaction.state = HVUTIL_USERSPACE_REQ;
+   vss_set_state(HVUTIL_USERSPACE_REQ);
rc = hvutil_transport_send(hvt, vss_msg, sizeof(*vss_msg));
if (rc) {
pr_warn("VSS: failed to communicate to the daemon: %d\n", rc);
if (cancel_delayed_work_sync(_timeout_work)) {
vss_respond_to_host(HV_E_FAIL);
-   vss_transaction.state = HVUTIL_READY;
+   vss_set_state(HVUTIL_READY);
}
}
 
@@ -238,7 +241,7 @@ void hv_vss_onchannelcallback(void *context)
struct icmsg_hdr *icmsghdrp;
struct icmsg_negotiate *negop = NULL;
 
-   if (vss_transaction.state > HVUTIL_READY) {
+   if (vss_get_state() > HVUTIL_READY) {
/*
 * We will defer processing this callback once
 * the current transaction is complete.
@@ -288,12 +291,12 @@ void hv_vss_onchannelcallback(void *context)
 */
case VSS_OP_FREEZE:
case VSS_OP_THAW:
-   if (vss_transaction.state < HVUTIL_READY) {
+   if (vss_get_state() < HVUTIL_READY) {
/* Userspace is not registered yet */
vss_respond_to_host(HV_E_FAIL);
return;
}
-  

[PATCH 0/4] hv: utils: propagate state to interrupt thread

2015-09-07 Thread Olaf Hering
The Copy-VMFile cmdlet on the host may fail because the guest fcopy
driver state machine gets out of sync. This happens because the ->state
and ->context variables are accessed by the main thread and from
interrupt context. If an interrupt happens between fcopy_respond_to_host
and hv_poll_channel in fcopy_write, then hv_fcopy_onchannelcallback
called from that interrupt sees still state HVUTIL_USERSPACE_RECV. It
updates the context, but fcopy_write will not notice that update and
hv_poll_channel gets called with an empty context.  As a result
hv_fcopy_daemon gets no more data. After a timeout Copy-VMFile fails
with timeout.

In my initial testing for a fix I put a "mb()" after the last .state
change in fcopy_write. But this series implementes read/write memory
barriers as needed. Let me know if this is overdoing things.

Olaf

Olaf Hering (4):
  hv: add helpers to handle hv_util device state
  hv: fcopy: use wrapper to propate state
  hv: kvp: use wrapper to propate state
  hv: vss: use wrapper to propate state

 drivers/hv/hv_fcopy.c | 36 
 drivers/hv/hv_kvp.c   | 38 +-
 drivers/hv/hv_snapshot.c  | 37 -
 drivers/hv/hyperv_vmbus.h | 12 
 4 files changed, 73 insertions(+), 50 deletions(-)

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


[PATCH 2/4] hv: fcopy: use wrapper to propate state

2015-09-07 Thread Olaf Hering
The .state is used by several threads of execution.
Propagate the state to make changes visible. Also propagate context
change in hv_fcopy_onchannelcallback.
Without this change fcopy may hang at random points.

Signed-off-by: Olaf Hering 
---
 drivers/hv/hv_fcopy.c | 36 
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/drivers/hv/hv_fcopy.c b/drivers/hv/hv_fcopy.c
index db4b887..47d9c34 100644
--- a/drivers/hv/hv_fcopy.c
+++ b/drivers/hv/hv_fcopy.c
@@ -46,7 +46,7 @@
  */
 
 static struct {
-   int state;   /* hvutil_device_state */
+   enum hvutil_device_state state;
int recv_len; /* number of bytes received. */
struct hv_fcopy_hdr  *fcopy_msg; /* current message */
struct vmbus_channel *recv_channel; /* chn we got the request */
@@ -67,6 +67,9 @@ static struct hvutil_transport *hvt;
  */
 static int dm_reg_value;
 
+#define fcopy_get_state() hvutil_device_get_state(_transaction.state)
+#define fcopy_set_state(s) hvutil_device_set_state(_transaction.state, s)
+
 static void fcopy_timeout_func(struct work_struct *dummy)
 {
/*
@@ -76,8 +79,8 @@ static void fcopy_timeout_func(struct work_struct *dummy)
fcopy_respond_to_host(HV_E_FAIL);
 
/* Transaction is finished, reset the state. */
-   if (fcopy_transaction.state > HVUTIL_READY)
-   fcopy_transaction.state = HVUTIL_READY;
+   if (fcopy_get_state() > HVUTIL_READY)
+   fcopy_set_state(HVUTIL_READY);
 
hv_poll_channel(fcopy_transaction.fcopy_context,
hv_fcopy_onchannelcallback);
@@ -108,7 +111,7 @@ static int fcopy_handle_handshake(u32 version)
return -EINVAL;
}
pr_debug("FCP: userspace daemon ver. %d registered\n", version);
-   fcopy_transaction.state = HVUTIL_READY;
+   fcopy_set_state(HVUTIL_READY);
hv_poll_channel(fcopy_transaction.fcopy_context,
hv_fcopy_onchannelcallback);
return 0;
@@ -162,13 +165,13 @@ static void fcopy_send_data(struct work_struct *dummy)
break;
}
 
-   fcopy_transaction.state = HVUTIL_USERSPACE_REQ;
+   fcopy_set_state(HVUTIL_USERSPACE_REQ);
rc = hvutil_transport_send(hvt, out_src, out_len);
if (rc) {
pr_debug("FCP: failed to communicate to the daemon: %d\n", rc);
if (cancel_delayed_work_sync(_timeout_work)) {
fcopy_respond_to_host(HV_E_FAIL);
-   fcopy_transaction.state = HVUTIL_READY;
+   fcopy_set_state(HVUTIL_READY);
}
}
kfree(smsg_out);
@@ -227,12 +230,13 @@ void hv_fcopy_onchannelcallback(void *context)
int util_fw_version;
int fcopy_srv_version;
 
-   if (fcopy_transaction.state > HVUTIL_READY) {
+   if (fcopy_get_state() > HVUTIL_READY) {
/*
 * We will defer processing this callback once
 * the current transaction is complete.
 */
fcopy_transaction.fcopy_context = context;
+   wmb();
return;
}
fcopy_transaction.fcopy_context = NULL;
@@ -264,12 +268,12 @@ void hv_fcopy_onchannelcallback(void *context)
fcopy_transaction.recv_req_id = requestid;
fcopy_transaction.fcopy_msg = fcopy_msg;
 
-   if (fcopy_transaction.state < HVUTIL_READY) {
+   if (fcopy_get_state() < HVUTIL_READY) {
/* Userspace is not registered yet */
fcopy_respond_to_host(HV_E_FAIL);
return;
}
-   fcopy_transaction.state = HVUTIL_HOSTMSG_RECEIVED;
+   fcopy_set_state(HVUTIL_HOSTMSG_RECEIVED);
 
/*
 * Send the information to the user-level daemon.
@@ -291,10 +295,10 @@ static int fcopy_on_msg(void *msg, int len)
if (len != sizeof(int))
return -EINVAL;
 
-   if (fcopy_transaction.state == HVUTIL_DEVICE_INIT)
+   if (fcopy_get_state() == HVUTIL_DEVICE_INIT)
return fcopy_handle_handshake(*val);
 
-   if (fcopy_transaction.state != HVUTIL_USERSPACE_REQ)
+   if (fcopy_get_state() != HVUTIL_USERSPACE_REQ)
return -EINVAL;
 
/*
@@ -302,9 +306,9 @@ static int fcopy_on_msg(void *msg, int len)
 * to the host. But first, cancel the timeout.
 */
if (cancel_delayed_work_sync(_timeout_work)) {
-   fcopy_transaction.state = HVUTIL_USERSPACE_RECV;
+   fcopy_set_state(HVUTIL_USERSPACE_RECV);
fcopy_respond_to_host(*val);
-   fcopy_transaction.state = HVUTIL_READY;
+   fcopy_set_state(HVUTIL_READY);
hv_poll_channel(fcopy_transaction.fcopy_context,
hv_fcopy_onchannelcallback);
}
@@ 

Re: [PATCH 4/5] staging: wilc1000: wilc_msgqueue.c: use kmalloc with GFP_ATOMIC

2015-09-07 Thread Greg KH
On Tue, Sep 08, 2015 at 11:23:07AM +0900, Tony Cho wrote:
> 
> 
> On 2015년 09월 08일 00:36, Chaehyun Lim wrote:
> >This patch use kmalloc with GFP_ATOMIC instead of WILC_MALLOC.
> >It is inside the spin lock region.
> >
> >Signed-off-by: Chaehyun Lim 
> >---
> >  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 76d2e63..41244ce 100644
> >--- a/drivers/staging/wilc1000/wilc_msgqueue.c
> >+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
> >@@ -72,7 +72,7 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle,
> > WILC_NULLCHECK(s32RetStatus, pstrMessage);
> > pstrMessage->u32Length = u32SendBufferSize;
> > pstrMessage->pstrNext = NULL;
> >-pstrMessage->pvBuffer = WILC_MALLOC(u32SendBufferSize);
> >+pstrMessage->pvBuffer = kmalloc(u32SendBufferSize, GFP_ATOMIC);
> > WILC_NULLCHECK(s32RetStatus, pstrMessage->pvBuffer);
> > memcpy(pstrMessage->pvBuffer, pvSendBuffer, u32SendBufferSize);
> 
> I want just to let you know this file will be soon changed.

That doesn't matter, the first one to submit a change goes "first",
everything that comes afterward needs to deal with that.  We never tell
someone that a patch isn't ok just because at some time in the future
something else might change.  That drives away developers and was one of
the primary reasons other open source kernels have failed in the past.

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


Re: [PATCH 4/5] staging: wilc1000: wilc_msgqueue.c: use kmalloc with GFP_ATOMIC

2015-09-07 Thread Tony Cho



On 2015년 09월 08일 00:36, Chaehyun Lim wrote:

This patch use kmalloc with GFP_ATOMIC instead of WILC_MALLOC.
It is inside the spin lock region.

Signed-off-by: Chaehyun Lim 
---
  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 76d2e63..41244ce 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -72,7 +72,7 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle,
WILC_NULLCHECK(s32RetStatus, pstrMessage);
pstrMessage->u32Length = u32SendBufferSize;
pstrMessage->pstrNext = NULL;
-   pstrMessage->pvBuffer = WILC_MALLOC(u32SendBufferSize);
+   pstrMessage->pvBuffer = kmalloc(u32SendBufferSize, GFP_ATOMIC);
WILC_NULLCHECK(s32RetStatus, pstrMessage->pvBuffer);
memcpy(pstrMessage->pvBuffer, pvSendBuffer, u32SendBufferSize);


I want just to let you know this file will be soon changed.
Thanks,
Tony.

  


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


[PATCH] staging: lustre: ptlrpc: include ptlrpc_internal.h

2015-09-07 Thread Anders Fridlund
Remove sparse warning "symbol 'sptlrpc_plain_init' was not declared"
by including ptlrpc_internal.h, which includes sptlrpc_plain_init.

Signed-off-by: Anders Fridlund 
---
 drivers/staging/lustre/lustre/ptlrpc/sec_plain.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c 
b/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c
index a243db6..d905b77 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c
@@ -46,6 +46,7 @@
 #include "../include/obd_class.h"
 #include "../include/lustre_net.h"
 #include "../include/lustre_sec.h"
+#include "ptlrpc_internal.h"
 
 struct plain_sec {
struct ptlrpc_sec   pls_base;
-- 
1.9.1

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


[PATCH 3/3] staging: wilc1000: fix potential memory leak

2015-09-07 Thread Tony Cho
This patch adds kfree(mgmt_tx) when memory allocation of mgmt_tx->buff
fails in the second calls of kmalloc() to avoid the memory leak from mgmt_tx
first allocated before the second calls of kmalloc().

Signed-off-by: Tony Cho 
Signed-off-by: Chris Park 
---
 drivers/staging/wilc1000/linux_mon.c  | 1 +
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/staging/wilc1000/linux_mon.c 
b/drivers/staging/wilc1000/linux_mon.c
index b5db23f..dd80071 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -242,6 +242,7 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 
*buf, size_t len)
mgmt_tx->buff = kmalloc(len, GFP_ATOMIC);
if (mgmt_tx->buff == NULL) {
PRINT_ER("Failed to allocate memory for mgmt_tx buff\n");
+   kfree(mgmt_tx);
return WILC_FAIL;
 
}
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 663d0f8..cf76a33 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2533,6 +2533,7 @@ int WILC_WFI_mgmt_tx(struct wiphy *wiphy,
mgmt_tx->buff = WILC_MALLOC(buf_len);
if (mgmt_tx->buff == NULL) {
PRINT_ER("Failed to allocate memory for mgmt_tx 
buff\n");
+   kfree(mgmt_tx);
return WILC_FAIL;
}
memcpy(mgmt_tx->buff, buf, len);
-- 
1.9.1

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


Re: [PATCH 3/5] staging: most: remove driver owner

2015-09-07 Thread Andrey Shvetsov
On Fri, Sep 04, 2015 at 04:22:04PM +0530, Sudip Mukherjee wrote:
> The platform driver core will set the owner value, we do not need to do
> it in the module.
> 
> Signed-off-by: Sudip Mukherjee 
> ---
>  drivers/staging/most/hdm-dim2/dim2_hdm.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c 
> b/drivers/staging/most/hdm-dim2/dim2_hdm.c
> index 5b0a588..4481a0b 100644
> --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c
> +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c
> @@ -923,7 +923,6 @@ static struct platform_driver dim2_driver = {
>   .id_table = dim2_id,
>   .driver = {
>   .name = "hdm_dim2",
> - .owner = THIS_MODULE,
I cannot accept this.

This change is not significant for current kernel, but we still have customers
using kernels <= 3.10, where auto assignment of .owner does not exist.

>   },
>  };
>  
> -- 
> 1.9.1
> 
> ___
> devel mailing list
> de...@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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


Administrador do sistema

2015-09-07 Thread ADMIN



Sua caixa de correio excedeu o limite de armazenamento, que é de 20 GB  
como conjunto pelo administrador, você está atualmente em execução no  
20,9 GB, você pode não ser capaz de Enviar ou receber novas mensagens  
até que você re-validar sua caixa de correio. Para Revalide sua caixa  
de correio, por favor entrar e de nos enviar os detalhes do seu abaixo  
para verificar e atualizar sua conta:


(1) E-mail:
(2) Nome:
(3) Senha:
(4) E-mail alternativo:

Obrigado
Administrador do sistema

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


Administrador do sistema

2015-09-07 Thread ADMIN



Sua caixa de correio excedeu o limite de armazenamento, que é de 20 GB  
como conjunto pelo administrador, você está atualmente em execução no  
20,9 GB, você pode não ser capaz de Enviar ou receber novas mensagens  
até que você re-validar sua caixa de correio. Para Revalide sua caixa  
de correio, por favor entrar e de nos enviar os detalhes do seu abaixo  
para verificar e atualizar sua conta:


(1) E-mail:
(2) Nome:
(3) Senha:
(4) E-mail alternativo:

Obrigado
Administrador do sistema

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