[PATCH] ion_chunk_heap.c: Fixed line over 80 characters

2015-06-21 Thread Guillermo O. Freschi
Simple style fix.

Signed-off-by: Guillermo O. Freschi 
---
 drivers/staging/android/ion/ion_chunk_heap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion_chunk_heap.c 
b/drivers/staging/android/ion/ion_chunk_heap.c
index 5474615..0813163 100644
--- a/drivers/staging/android/ion/ion_chunk_heap.c
+++ b/drivers/staging/android/ion/ion_chunk_heap.c
@@ -173,8 +173,8 @@ struct ion_heap *ion_chunk_heap_create(struct 
ion_platform_heap *heap_data)
chunk_heap->heap.ops = &chunk_heap_ops;
chunk_heap->heap.type = ION_HEAP_TYPE_CHUNK;
chunk_heap->heap.flags = ION_HEAP_FLAG_DEFER_FREE;
-   pr_debug("%s: base %lu size %zu align %ld\n", __func__, 
chunk_heap->base,
-   heap_data->size, heap_data->align);
+   pr_debug("%s: base %lu size %zu align %ld\n", __func__,
+   chunk_heap->base, heap_data->size, heap_data->align);
 
return &chunk_heap->heap;
 
-- 
2.1.4

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


[PATCH] staging : Comedi : comedi_fops : Fixed the return error code

2015-06-21 Thread Santosh
This patch fixes the checkpatch.pl warning:

WARNING: ENOSYS means 'invalid syscall nr' and nothing else

Regards,

Santosh Pai

>From 502464417255edb52a1db71146e2f33e67df87ce Mon Sep 17 00:00:00 2001
From: sanpai 
Date: Sun, 21 Jun 2015 15:05:00 +0530
Subject: [PATCH] staging : Comedi : comedi_fops : Fixed the return error code

try_module_get fails when the reference count of the module is not
allowed to be incremented ,and hence -EPERM is returned.

Signed-off-by: sanpai 
---
 drivers/staging/comedi/comedi_fops.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index 985d94b..d6a37e9 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -2606,7 +2606,7 @@ static int comedi_open(struct inode *inode, struct file *file)
 	}
 	if (dev->attached && dev->use_count == 0) {
 		if (!try_module_get(dev->driver->module)) {
-			rc = -ENOSYS;
+			rc = -EPERM;
 			goto out;
 		}
 		if (dev->open) {
-- 
1.7.9.5

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


Re: [PATCH 09/12] staging: lustre: obdclass: Use !x to check for kzalloc failure

2015-06-21 Thread walter harms


Am 20.06.2015 18:59, schrieb Julia Lawall:
> !x is more normal for kzalloc failure in the kernel.
> 
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // 
> @@
> expression x;
> statement S1, S2;
> @@
> 
> x = kzalloc(...);
> if (
> - x == NULL
> + !x
>  ) S1 else S2
> // 
> 
> Signed-off-by: Julia Lawall 
> 
> ---
>  drivers/staging/lustre/lustre/obdclass/class_obd.c  |2 +-
>  drivers/staging/lustre/lustre/obdclass/genops.c |6 +++---
>  drivers/staging/lustre/lustre/obdclass/llog.c   |6 +++---
>  drivers/staging/lustre/lustre/obdclass/lprocfs_status.c |2 +-
>  drivers/staging/lustre/lustre/obdclass/lustre_peer.c|2 +-
>  drivers/staging/lustre/lustre/obdclass/obd_config.c |   10 +-
>  drivers/staging/lustre/lustre/obdclass/obd_mount.c  |   12 ++--
>  7 files changed, 20 insertions(+), 20 deletions(-)
> 
> diff -u -p a/drivers/staging/lustre/lustre/obdclass/obd_mount.c 
> b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
> --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c
> +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
> @@ -85,7 +85,7 @@ int lustre_process_log(struct super_bloc
>   LASSERT(cfg);
>  
>   bufs = kzalloc(sizeof(*bufs), GFP_NOFS);
> - if (bufs == NULL)
> + if (!bufs)
>   return -ENOMEM;
>  
>   /* mgc_process_config */
> @@ -258,7 +258,7 @@ int lustre_start_mgc(struct super_block
>   mgssec = lsi->lsi_lmd->lmd_mgssec ? lsi->lsi_lmd->lmd_mgssec : "";
>  
>   data = kzalloc(sizeof(*data), GFP_NOFS);
> - if (data == NULL) {
> + if (!data) {
>   rc = -ENOMEM;
>   goto out_free;
>   }
> @@ -885,7 +885,7 @@ static int lmd_parse_mgssec(struct lustr
>   length = tail - ptr;
>  
>   lmd->lmd_mgssec = kzalloc(length + 1, GFP_NOFS);
> - if (lmd->lmd_mgssec == NULL)
> + if (!lmd->lmd_mgssec)
>   return -ENOMEM;
>  
>   memcpy(lmd->lmd_mgssec, ptr, length);
looks like memdup()

> @@ -911,7 +911,7 @@ static int lmd_parse_string(char **handl
>   length = tail - ptr;
>  
>   *handle = kzalloc(length + 1, GFP_NOFS);
> - if (*handle == NULL)
> + if (!*handle)
>   return -ENOMEM;
>  
>   memcpy(*handle, ptr, length);

looks like memdup()


> @@ -941,7 +941,7 @@ static int lmd_parse_mgs(struct lustre_m
>   oldlen = strlen(lmd->lmd_mgs) + 1;
>  
>   mgsnid = kzalloc(oldlen + length + 1, GFP_NOFS);
> - if (mgsnid == NULL)
> + if (!mgsnid)
>   return -ENOMEM;
>  
>   if (lmd->lmd_mgs != NULL) {
> @@ -983,7 +983,7 @@ static int lmd_parse(char *options, stru
>   lmd->lmd_magic = LMD_MAGIC;
>  
>   lmd->lmd_params = kzalloc(4096, GFP_NOFS);
> - if (lmd->lmd_params == NULL)
> + if (!lmd->lmd_params)
>   return -ENOMEM;
>   lmd->lmd_params[0] = '\0';
>  
> diff -u -p a/drivers/staging/lustre/lustre/obdclass/obd_config.c 
> b/drivers/staging/lustre/lustre/obdclass/obd_config.c
> --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c
> +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c
> @@ -835,7 +835,7 @@ int class_add_profile(int proflen, char
>   CDEBUG(D_CONFIG, "Add profile %s\n", prof);
>  
>   lprof = kzalloc(sizeof(*lprof), GFP_NOFS);
> - if (lprof == NULL)
> + if (!lprof)
>   return -ENOMEM;
>   INIT_LIST_HEAD(&lprof->lp_list);
>  
> @@ -979,7 +979,7 @@ struct lustre_cfg *lustre_cfg_rename(str
>   new_len = LUSTRE_CFG_BUFLEN(cfg, 1) + strlen(new_name) - name_len;
>  
>   new_param = kzalloc(new_len, GFP_NOFS);
> - if (new_param == NULL)
> + if (!new_param)
>   return ERR_PTR(-ENOMEM);
>  
>   strcpy(new_param, new_name);
> @@ -987,7 +987,7 @@ struct lustre_cfg *lustre_cfg_rename(str
>   strcat(new_param, value);
>  
>   bufs = kzalloc(sizeof(*bufs), GFP_NOFS);
> - if (bufs == NULL) {
> + if (!bufs) {
>   kfree(new_param);
>   return ERR_PTR(-ENOMEM);
>   }
> @@ -1461,7 +1461,7 @@ int class_config_llog_handler(const stru
>   inst_len = LUSTRE_CFG_BUFLEN(lcfg, 0) +
>  sizeof(clli->cfg_instance) * 2 + 4;
>   inst_name = kzalloc(inst_len, GFP_NOFS);
> - if (inst_name == NULL) {
> + if (!inst_name) {
>   rc = -ENOMEM;
>   goto out;
>   }
> @@ -1639,7 +1639,7 @@ int class_config_dump_handler(const stru
>   int  rc = 0;
>  
>   outstr = kzalloc(256, GFP_NOFS);
> - if (outstr == NULL)
> + if (!outstr)
>   return -ENOMEM;
>  
>   if (rec->lrh_type == OBD_CFG_REC) {
> diff -u -p a/drivers/staging/lustre/lustre/obdclass/lustre_peer.c 
> b/drivers/staging/lustre/lustre/obdclass/lustre_peer.c
> --- a/drivers/staging/lustre/lu

Re: [PATCH 09/12] staging: lustre: obdclass: Use !x to check for kzalloc failure

2015-06-21 Thread Julia Lawall
> > @@ -885,7 +885,7 @@ static int lmd_parse_mgssec(struct lustr
> > length = tail - ptr;
> >  
> > lmd->lmd_mgssec = kzalloc(length + 1, GFP_NOFS);
> > -   if (lmd->lmd_mgssec == NULL)
> > +   if (!lmd->lmd_mgssec)
> > return -ENOMEM;
> >  
> > memcpy(lmd->lmd_mgssec, ptr, length);
> looks like memdup()

kmemdup has the same length for both calls.  There is kstrndup, but it
recalculates the length, which looks unnecessary here.

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


[PATCH v2 0/2] checkpatch fixes

2015-06-21 Thread Peter Karlsson
This patch set includes 2 patches fixing checkpatch warnings about
lines over 80 characters.

Changes since v1:
* Split table lines on 8 bytes instead of 7.
* Better commit message. 

Peter Karlsson (2):
  staging: ft1000-usb: fixed table alignment
  staging: ft1000-usb: shorten lines to under 80 characters

 drivers/staging/ft1000/ft1000-usb/ft1000_debug.c   | 31 +++---
 .../staging/ft1000/ft1000-usb/ft1000_download.c| 21 ++-
 2 files changed, 35 insertions(+), 17 deletions(-)

-- 
1.9.1

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


[PATCH 2/2] staging: ft1000-usb: shorten lines to under 80 characters

2015-06-21 Thread Peter Karlsson
Wrap function arguments to shorten lines to under 80 characters.

Signed-off-by: Peter Karlsson 
---
 drivers/staging/ft1000/ft1000-usb/ft1000_debug.c| 12 
 drivers/staging/ft1000/ft1000-usb/ft1000_download.c | 21 ++---
 2 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c 
b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
index b917953..be5ddb4 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
@@ -260,7 +260,8 @@ void ft1000_destroy_dev(struct net_device *netdev)
/* Make sure we free any memory reserve for slow Queue */
for (i = 0; i < MAX_NUM_APP; i++) {
while (list_empty(&dev->app_info[i].app_sqlist) == 0) {
-   pdpram_blk = 
list_entry(dev->app_info[i].app_sqlist.next, struct dpram_blk, list);
+   pdpram_blk = 
list_entry(dev->app_info[i].app_sqlist.next,
+   struct dpram_blk, list);
list_del(&pdpram_blk->list);
ft1000_free_buffer(pdpram_blk, &freercvpool);
 
@@ -501,10 +502,12 @@ static long ft1000_ioctl(struct file *file, unsigned int 
command,
memcpy(get_stat_data.eui64, info->eui64, EUISZ);
 
if (info->ProgConStat != 0xFF) {
-   ft1000_read_dpram16(ft1000dev, FT1000_MAG_DSP_LED, (u8 
*)&ledStat, FT1000_MAG_DSP_LED_INDX);
+   ft1000_read_dpram16(ft1000dev, FT1000_MAG_DSP_LED,
+   (u8 *)&ledStat, 
FT1000_MAG_DSP_LED_INDX);
get_stat_data.LedStat = ntohs(ledStat);
pr_debug("LedStat = 0x%x\n", get_stat_data.LedStat);
-   ft1000_read_dpram16(ft1000dev, 
FT1000_MAG_DSP_CON_STATE, (u8 *)&conStat, FT1000_MAG_DSP_CON_STATE_INDX);
+   ft1000_read_dpram16(ft1000dev, FT1000_MAG_DSP_CON_STATE,
+   (u8 *)&conStat, 
FT1000_MAG_DSP_CON_STATE_INDX);
get_stat_data.ConStat = ntohs(conStat);
pr_debug("ConStat = 0x%x\n", get_stat_data.ConStat);
} else {
@@ -694,7 +697,8 @@ static long ft1000_ioctl(struct file *file, unsigned int 
command,
if (list_empty(&ft1000dev->app_info[i].app_sqlist) == 0) {
/* pr_debug("Message detected in slow queue\n"); */
spin_lock_irqsave(&free_buff_lock, flags);
-   pdpram_blk = 
list_entry(ft1000dev->app_info[i].app_sqlist.next, struct dpram_blk, list);
+   pdpram_blk = 
list_entry(ft1000dev->app_info[i].app_sqlist.next,
+   struct dpram_blk, list);
list_del(&pdpram_blk->list);
ft1000dev->app_info[i].NumOfMsg--;
/* pr_debug("NumOfMsg for app %d = %d\n", i, 
ft1000dev->app_info[i].NumOfMsg); */
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c 
b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
index 5def347..a72511c 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
@@ -180,7 +180,8 @@ static u16 get_handshake(struct ft1000_usb *ft1000dev, u16 
expected_value)
}
 
status = ft1000_read_dpram16(ft1000dev,
-DWNLD_MAG1_HANDSHAKE_LOC, (u8 
*)&handshake, 1);
+DWNLD_MAG1_HANDSHAKE_LOC,
+(u8 *)&handshake, 1);
handshake = ntohs(handshake);
 
if (status)
@@ -281,12 +282,14 @@ static u16 get_request_type(struct ft1000_usb *ft1000dev)
 
if (ft1000dev->bootmode == 1) {
status = fix_ft1000_read_dpram32(ft1000dev,
-DWNLD_MAG1_TYPE_LOC, (u8 
*)&tempx);
+DWNLD_MAG1_TYPE_LOC,
+(u8 *)&tempx);
tempx = ntohl(tempx);
} else {
tempx = 0;
status = ft1000_read_dpram16(ft1000dev,
-DWNLD_MAG1_TYPE_LOC, (u8 
*)&tempword, 1);
+DWNLD_MAG1_TYPE_LOC,
+(u8 *)&tempword, 1);
tempx |= (tempword << 16);
tempx = ntohl(tempx);
}
@@ -304,7 +307,8 @@ static u16 get_request_type_usb(struct ft1000_usb 
*ft1000dev)
 
if (ft1000dev->bootmode == 1) {
status = fix_ft1000_read_dpram32(ft1000dev,
-DWNLD_M

[PATCH 1/2] staging: ft1000-usb: fixed table alignment

2015-06-21 Thread Peter Karlsson
Fixed alignment to 8 bytes per line.

Signed-off-by: Peter Karlsson 
---
 drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 19 +--
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c 
b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
index faac4e5..b917953 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
@@ -414,12 +414,19 @@ static long ft1000_ioctl(struct file *file, unsigned int 
command,
unsigned long flags;
struct IOCTL_GET_VER get_ver_data;
struct IOCTL_GET_DSP_STAT get_stat_data;
-   u8 ConnectionMsg[] = {0x00, 0x44, 0x10, 0x20, 0x80, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x93, 0x64,
- 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0a,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x02, 0x37, 0x00, 0x00, 0x00, 0x08, 
0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x7f, 0x00,
- 0x00, 0x01, 0x00, 0x00};
+   u8 ConnectionMsg[] = {
+   0x00, 0x44, 0x10, 0x20, 0x80, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x93, 0x64,
+   0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0a,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x02, 0x37, 0x00, 0x00, 0x00, 0x08,
+   0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x7f, 0x00,
+   0x00, 0x01, 0x00, 0x00
+   };
 
unsigned short ledStat = 0;
unsigned short conStat = 0;
-- 
1.9.1

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


[PATCH] staging: rtl8192u: ieee80211_rx: Fix incorrect type in assignments

2015-06-21 Thread Gaston Gonzalez
Fix the following incorrect type in assignments detected by sparse:

drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:571:37: warning: incorrect 
type in assignment (different base types)
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:571:37:expected unsigned 
short [unsigned] [usertype] len
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:571:37:got restricted 
__be16 [usertype] 

drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:1330:45: warning: incorrect 
type in assignment (different base types)
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:1330:45:expected unsigned 
short [unsigned] [usertype] len
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:1330:45:got restricted 
__be16 [usertype] 

drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:1495:40: warning: incorrect 
type in assignment (different base types)
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:1495:40:expected 
restricted __le16 
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:1495:40:got int

drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:1497:40: warning: incorrect 
type in assignment (different base types)
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:1497:40:expected 
restricted __le16 
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:1497:40:got int

drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:1501:45: warning: incorrect 
type in assignment (different base types)
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:1501:45:expected 
restricted __le16 
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:1501:45:got unsigned 
short [unsigned] [usertype] 


Signed-off-by: Gaston Gonzalez 
---
 drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
index b374088..15bcf7e 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
@@ -566,7 +566,7 @@ void ieee80211_indicate_packets(struct ieee80211_device 
*ieee, struct ieee80211_
memcpy(skb_push(sub_skb, ETH_ALEN), prxb->src, 
ETH_ALEN);
memcpy(skb_push(sub_skb, ETH_ALEN), prxb->dst, 
ETH_ALEN);
} else {
-   u16 len;
+   __be16 len;
/* Leave Ethernet header part of hdr and full payload */
len = htons(sub_skb->len);
memcpy(skb_push(sub_skb, 2), &len, 2);
@@ -1325,7 +1325,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct 
sk_buff *skb,
memcpy(skb_push(sub_skb, ETH_ALEN), 
src, ETH_ALEN);
memcpy(skb_push(sub_skb, ETH_ALEN), 
dst, ETH_ALEN);
} else {
-   u16 len;
+   __be16 len;
/* Leave Ethernet header part of hdr 
and full payload */
len = htons(sub_skb->len);
memcpy(skb_push(sub_skb, 2), &len, 2);
@@ -1492,13 +1492,15 @@ static int ieee80211_qos_convert_ac_to_parameters(struct
/* WMM spec P.11: The minimum value for AIFSN shall be 2 */
qos_param->aifs[aci] = (qos_param->aifs[aci] < 2) ? 
2:qos_param->aifs[aci];
 
-   qos_param->cw_min[aci] = ac_params->ecw_min_max & 0x0F;
+   qos_param->cw_min[aci] =
+   cpu_to_le16(ac_params->ecw_min_max & 0x0F);
 
-   qos_param->cw_max[aci] = (ac_params->ecw_min_max & 0xF0) >> 4;
+   qos_param->cw_max[aci] =
+   cpu_to_le16((ac_params->ecw_min_max & 0xF0) >> 4);
 
qos_param->flag[aci] =
(ac_params->aci_aifsn & 0x10) ? 0x01 : 0x00;
-   qos_param->tx_op_limit[aci] = 
le16_to_cpu(ac_params->tx_op_limit);
+   qos_param->tx_op_limit[aci] = ac_params->tx_op_limit;
}
return 0;
 }
-- 
2.4.2

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


[PATCH 1/1] cpu-hotplug: export cpu_hotplug_enable/cpu_hotplug_disable

2015-06-21 Thread K. Y. Srinivasan
From: Vitaly Kuznetsov 

Loaded Hyper-V module will use these functions to disable CPU
hotplug under certain circumstances. Convert cpu_hotplug_disabled
to a counter (protected by cpu_add_remove_lock) to support e.g.
disable -> disable -> enable call sequences.

Signed-off-by: Vitaly Kuznetsov 
Signed-off-by: K. Y. Srinivasan 
---
 Documentation/power/suspend-and-cpuhotplug.txt |6 +++---
 kernel/cpu.c   |   13 -
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/Documentation/power/suspend-and-cpuhotplug.txt 
b/Documentation/power/suspend-and-cpuhotplug.txt
index 2850df3..2fc9095 100644
--- a/Documentation/power/suspend-and-cpuhotplug.txt
+++ b/Documentation/power/suspend-and-cpuhotplug.txt
@@ -72,7 +72,7 @@ More details follow:
 |
 v
Disable regular cpu hotplug
-by setting cpu_hotplug_disabled=1
+by increasing cpu_hotplug_disabled
 |
 v
 Release cpu_add_remove_lock
@@ -89,7 +89,7 @@ Resuming back is likewise, with the counterparts being (in 
the order of
 execution during resume):
 * enable_nonboot_cpus() which involves:
|  Acquire cpu_add_remove_lock
-   |  Reset cpu_hotplug_disabled to 0, thereby enabling regular cpu hotplug
+   |  Decrease cpu_hotplug_disabled, thereby enabling regular cpu hotplug
|  Call _cpu_up() [for all those cpus in the frozen_cpus mask, in a loop]
|  Release cpu_add_remove_lock
v
@@ -120,7 +120,7 @@ after the entire cycle is complete (i.e., suspend + resume).
Acquire cpu_add_remove_lock
 |
 v
-  If cpu_hotplug_disabled is 1
+  If cpu_hotplug_disabled > 0
 return gracefully
 |
 |
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 94bbe46..8f35ee6 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -190,17 +190,19 @@ void cpu_hotplug_done(void)
 void cpu_hotplug_disable(void)
 {
cpu_maps_update_begin();
-   cpu_hotplug_disabled = 1;
+   cpu_hotplug_disabled++;
cpu_maps_update_done();
 }
+EXPORT_SYMBOL_GPL(cpu_hotplug_disable);
 
 void cpu_hotplug_enable(void)
 {
cpu_maps_update_begin();
-   cpu_hotplug_disabled = 0;
+   if (cpu_hotplug_disabled)
+   cpu_hotplug_disabled--;
cpu_maps_update_done();
 }
-
+EXPORT_SYMBOL_GPL(cpu_hotplug_enable);
 #endif /* CONFIG_HOTPLUG_CPU */
 
 /* Need to know about CPUs going up/down? */
@@ -600,7 +602,7 @@ int disable_nonboot_cpus(void)
if (!error) {
BUG_ON(num_online_cpus() > 1);
/* Make sure the CPUs won't be enabled by someone else */
-   cpu_hotplug_disabled = 1;
+   cpu_hotplug_disabled++;
} else {
pr_err("Non-boot CPUs are not disabled\n");
}
@@ -622,7 +624,8 @@ void __ref enable_nonboot_cpus(void)
 
/* Allow everyone to use the CPU hotplug again */
cpu_maps_update_begin();
-   cpu_hotplug_disabled = 0;
+   if (cpu_hotplug_disabled)
+   cpu_hotplug_disabled--;
if (cpumask_empty(frozen_cpus))
goto out;
 
-- 
1.7.4.1

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


[PATCH 3/5] staging: wilc1000: wilc_wfi_netdevice.c: remove braces for single statement block

2015-06-21 Thread Chaehyun Lim
Fix checkpatch warning found by checkpatch.pl
WARNING: braces {} are not necessary for single statement blocks

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.c 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.c
index 9da7674..039e21f 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.c
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.c
@@ -931,10 +931,8 @@ int WILC_WFI_InitModule(void)
/* ret = host_int_init(&priv[0]->hWILCWFIDrv); */
/*copy handle to the other driver*/
/* priv[1]->hWILCWFIDrv = priv[0]->hWILCWFIDrv; */
-   if (ret) {
+   if (ret)
PRINT_ER("Error Init Driver\n");
-   }
-
 
 out:
if (ret)
-- 
1.9.1

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


[PATCH 5/5] staging: wilc1000: wilc_wfi_netdevice.c: move statement after declarations

2015-06-21 Thread Chaehyun Lim
Fix checkpatch warning found by checkpatch.pl
WARNING: Missing a blank line after declarations

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.c 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.c
index 31a796b..170ca65 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.c
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.c
@@ -886,9 +886,10 @@ int WILC_WFI_InitModule(void)
int result, i, ret = -ENOMEM;
struct WILC_WFI_priv *priv[2], *netpriv;
struct wireless_dev *wdev;
-   WILC_WFI_Interrupt = use_napi ? WILC_WFI_NapiInterrupt : 
WILC_WFI_RegularInterrupt;
char buf[IFNAMSIZ];
 
+   WILC_WFI_Interrupt = use_napi ? WILC_WFI_NapiInterrupt : 
WILC_WFI_RegularInterrupt;
+
for (i = 0; i < 2; i++) {
 
/* Allocate the net devices */
-- 
1.9.1

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


[PATCH 4/5] staging: wilc1000: wilc_wfi_netdevice.c: Insert blank line after declarations

2015-06-21 Thread Chaehyun Lim
Fix checkpatch warning found by checkpatch.pl
WARNING: Missing a blank line after declarations

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.c 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.c
index 039e21f..31a796b 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.c
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.c
@@ -207,6 +207,7 @@ struct WILC_WFI_packet *WILC_WFI_DequeueBuf(struct 
net_device *dev)
 static void WILC_WFI_RxInts(struct net_device *dev, int enable)
 {
struct WILC_WFI_priv *priv = netdev_priv(dev);
+
priv->rx_int_enabled = enable;
 }
 
@@ -522,6 +523,7 @@ void WILC_WFI_HwTx(char *buf, int len, struct net_device 
*dev)
 
if (0) {  /* enable this conditional to look at the data */
int i;
+
PRINT_D(RX_DBG, "len is %i", len);
for (i = 14; i < len; i++)
PRINT_D(RX_DBG, "TXdata[%d] %02x\n", i, buf[i] & 0xff);
@@ -677,6 +679,7 @@ int WILC_WFI_Ioctl(struct net_device *dev, struct ifreq 
*rq, int cmd)
 struct net_device_stats *WILC_WFI_Stats(struct net_device *dev)
 {
struct WILC_WFI_priv *priv = netdev_priv(dev);
+
return &priv->stats;
 }
 
-- 
1.9.1

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


[PATCH 1/5] staging: wilc1000: wilc_wfi_netdevice.c: remove prohibited space before semicolon

2015-06-21 Thread Chaehyun Lim
Fix checkpatch warning found by checkpatch.pl
WARNING: space prohibited before semicolon

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.c 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.c
index ab66ce4..01542f4 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.c
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.c
@@ -31,7 +31,7 @@ module_param(timeout, int, 0);
 /*
  * Do we run in NAPI mode?
  */
-static int use_napi ;
+static int use_napi;
 module_param(use_napi, int, 0);
 
 
-- 
1.9.1

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


[PATCH 2/5] staging: wilc1000: wilc_wfi_netdevice.c: remove prohibited space

2015-06-21 Thread Chaehyun Lim
Fix checkpatch warning found by checkpatch.pl
WARNING: space prohibited between function name and open parenthesis '('

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.c 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.c
index 01542f4..9da7674 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.c
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.c
@@ -71,7 +71,7 @@ void WILC_WFI_SetupPool(struct net_device *dev)
 
priv->ppool = NULL;
for (i = 0; i < pool_size; i++) {
-   pkt = kmalloc (sizeof (struct WILC_WFI_packet), GFP_KERNEL);
+   pkt = kmalloc(sizeof(struct WILC_WFI_packet), GFP_KERNEL);
if (pkt == NULL) {
PRINT_D(RX_DBG, "Ran out of memory allocating packet 
pool\n");
return;
@@ -99,7 +99,7 @@ void WILC_WFI_TearDownPool(struct net_device *dev)
 
while ((pkt = priv->ppool)) {
priv->ppool = pkt->next;
-   kfree (pkt);
+   kfree(pkt);
/* FIXME - in-flight packets ? */
}
 }
-- 
1.9.1

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


[PATCH 1/2] staging: sm750fb: remove redundant __func__ in debug statement

2015-06-21 Thread Gujulan Elango, Hari Prasath (H.)
From: Hari Prasath Gujulan Elango 

This patch removes the redundant __func__ from dynamic debug prints as
the pr_xxx set of functions can be dynamically controlled to include
function name as well

Signed-off-by: Hari Prasath Gujulan Elango 
---
 drivers/staging/sm750fb/sm750_accel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/sm750fb/sm750_accel.c 
b/drivers/staging/sm750fb/sm750_accel.c
index 6eee4cd..bf62003 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -100,7 +100,7 @@ int hw_fillrect(struct lynx_accel *accel,
{
/* int time wait and always busy,seems hardware
 * got something error */
-   pr_debug("%s:De engine always bussy\n", __func__);
+   pr_debug("De engine always bussy\n");
return -1;
}
 
-- 
1.9.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2] staging: sm750fb: fix typo in debug statement

2015-06-21 Thread Gujulan Elango, Hari Prasath (H.)
From: Hari Prasath Gujulan Elango 

This patch fixes a typo in the debug statement

Signed-off-by: Hari Prasath Gujulan Elango 
---
 drivers/staging/sm750fb/sm750_accel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/sm750fb/sm750_accel.c 
b/drivers/staging/sm750fb/sm750_accel.c
index bf62003..8ea3a61 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -100,7 +100,7 @@ int hw_fillrect(struct lynx_accel *accel,
{
/* int time wait and always busy,seems hardware
 * got something error */
-   pr_debug("De engine always bussy\n");
+   pr_debug("De engine always busy\n");
return -1;
}
 
-- 
1.9.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 1/6] Staging: comedi: dmm32at: Simplify a trivial if-return sequence

2015-06-21 Thread Abdul, Hussain (H.)
From: Abdul Hussain 

This patch simplify a trivial if-return sequence. Possibly combine with
a preceding function call.

Signed-off-by: Abdul Hussain 
---
 drivers/staging/comedi/drivers/dmm32at.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/dmm32at.c 
b/drivers/staging/comedi/drivers/dmm32at.c
index bb2883c..958c0d4 100644
--- a/drivers/staging/comedi/drivers/dmm32at.c
+++ b/drivers/staging/comedi/drivers/dmm32at.c
@@ -607,11 +607,7 @@ static int dmm32at_attach(struct comedi_device *dev,
 
/* Digital I/O subdevice */
s = &dev->subdevices[2];
-   ret = subdev_8255_init(dev, s, dmm32at_8255_io, DMM32AT_8255_IOBASE);
-   if (ret)
-   return ret;
-
-   return 0;
+   return subdev_8255_init(dev, s, dmm32at_8255_io, DMM32AT_8255_IOBASE);
 }
 
 static struct comedi_driver dmm32at_driver = {
-- 
1.9.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 3/6] Staging: combine: daqboard2000: Simplify a trivial if-return sequence

2015-06-21 Thread Abdul, Hussain (H.)
From: Abdul Hussain 

This patch simplify a trivial if-return sequence. Possibly combine with
a preceding function call.

Signed-off-by: Abdul Hussain 
---
 drivers/staging/comedi/drivers/daqboard2000.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/daqboard2000.c 
b/drivers/staging/comedi/drivers/daqboard2000.c
index 611b0a3..bb8a6b2 100644
--- a/drivers/staging/comedi/drivers/daqboard2000.c
+++ b/drivers/staging/comedi/drivers/daqboard2000.c
@@ -713,12 +713,8 @@ static int daqboard2000_auto_attach(struct comedi_device 
*dev,
return result;
 
s = &dev->subdevices[2];
-   result = subdev_8255_init(dev, s, daqboard2000_8255_cb,
- dioP2ExpansionIO8Bit);
-   if (result)
-   return result;
-
-   return 0;
+   return subdev_8255_init(dev, s, daqboard2000_8255_cb,
+   dioP2ExpansionIO8Bit);
 }
 
 static void daqboard2000_detach(struct comedi_device *dev)
-- 
1.9.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 2/6] Staging: comedi: fl512: Simplify a trivial if-return sequence

2015-06-21 Thread Abdul, Hussain (H.)
From: Abdul Hussain 

This patch simplify a trivial if-return sequence. Possibly combine with
a preceding function call.

Signed-off-by: Abdul Hussain 
---
 drivers/staging/comedi/drivers/fl512.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/fl512.c 
b/drivers/staging/comedi/drivers/fl512.c
index e1f4932..55cae61 100644
--- a/drivers/staging/comedi/drivers/fl512.c
+++ b/drivers/staging/comedi/drivers/fl512.c
@@ -136,11 +136,7 @@ static int fl512_attach(struct comedi_device *dev, struct 
comedi_devconfig *it)
s->range_table  = &range_fl512;
s->insn_write   = fl512_ao_insn_write;
 
-   ret = comedi_alloc_subdev_readback(s);
-   if (ret)
-   return ret;
-
-   return 0;
+   return comedi_alloc_subdev_readback(s);
 }
 
 static struct comedi_driver fl512_driver = {
-- 
1.9.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 4/6] Staging: comedi: dac02: Simplify a trivial if-return sequence

2015-06-21 Thread Abdul, Hussain (H.)
From: Abdul Hussain 

This patch simplify a trivial if-return sequence. Possibly combine with
a preceding function call.

Signed-off-by: Abdul Hussain 
---
 drivers/staging/comedi/drivers/dac02.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/dac02.c 
b/drivers/staging/comedi/drivers/dac02.c
index a6798ad..a562df4 100644
--- a/drivers/staging/comedi/drivers/dac02.c
+++ b/drivers/staging/comedi/drivers/dac02.c
@@ -130,11 +130,7 @@ static int dac02_attach(struct comedi_device *dev, struct 
comedi_devconfig *it)
s->range_table  = &das02_ao_ranges;
s->insn_write   = dac02_ao_insn_write;
 
-   ret = comedi_alloc_subdev_readback(s);
-   if (ret)
-   return ret;
-
-   return 0;
+   return comedi_alloc_subdev_readback(s);
 }
 
 static struct comedi_driver dac02_driver = {
-- 
1.9.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 5/6] Staging: comedi: ni_daq_dio24: Simplify a trivial if-return sequence

2015-06-21 Thread Abdul, Hussain (H.)
From: Abdul Hussain 

This patch simplify a trivial if-return sequence. Possibly combine with
a preceding function call.

Signed-off-by: Abdul Hussain 
---
 drivers/staging/comedi/drivers/ni_daq_dio24.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c 
b/drivers/staging/comedi/drivers/ni_daq_dio24.c
index a208cb3..d9de83a 100644
--- a/drivers/staging/comedi/drivers/ni_daq_dio24.c
+++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c
@@ -55,11 +55,7 @@ static int dio24_auto_attach(struct comedi_device *dev,
 
/* 8255 dio */
s = &dev->subdevices[0];
-   ret = subdev_8255_init(dev, s, NULL, 0x00);
-   if (ret)
-   return ret;
-
-   return 0;
+   return subdev_8255_init(dev, s, NULL, 0x00);
 }
 
 static struct comedi_driver driver_dio24 = {
-- 
1.9.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 6/6] Staging: comedi: s626: Simplify a trivial if-return sequence

2015-06-21 Thread Abdul, Hussain (H.)
From: Abdul Hussain 

This patch simplify a trivial if-return sequence. Possibly combine with
a preceding function call.

Signed-off-by: Abdul Hussain 
---
 drivers/staging/comedi/drivers/s626.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index 781918d..35f0f67 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -2852,11 +2852,7 @@ static int s626_auto_attach(struct comedi_device *dev,
s->insn_read= s626_enc_insn_read;
s->insn_write   = s626_enc_insn_write;
 
-   ret = s626_initialize(dev);
-   if (ret)
-   return ret;
-
-   return 0;
+   return s626_initialize(dev);
 }
 
 static void s626_detach(struct comedi_device *dev)
-- 
1.9.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel