[PATCH 01/02] linux-next: staging: gdm72xx: coding style fixes

2014-04-17 Thread Alexandr Terekhov
Fix:
- unnecessary whitespace before a quoted newline
- using `time_before` instread of comparisons of jiffies
- enclosing macro in parenthesis
- line over 80 characters

Signed-off-by: Alexandr Terekhov  

diff --git a/drivers/staging/gdm72xx/gdm_qos.c 
b/drivers/staging/gdm72xx/gdm_qos.c
index 50d43ad..245109e 100644
--- a/drivers/staging/gdm72xx/gdm_qos.c
+++ b/drivers/staging/gdm72xx/gdm_qos.c
@@ -377,7 +377,7 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int 
size)
index = get_csr(qcb, SFID, 1);
if (index == -1) {
netdev_err(nic->netdev,
-  "QoS ERROR: csr Update Error / Wrong index (%d) \n",
+  "QoS ERROR: csr Update Error / Wrong index (%d)\n",
   index);
return;
}
diff --git a/drivers/staging/gdm72xx/gdm_usb.c 
b/drivers/staging/gdm72xx/gdm_usb.c
index 20539d8..ac8616d 100644
--- a/drivers/staging/gdm72xx/gdm_usb.c
+++ b/drivers/staging/gdm72xx/gdm_usb.c
@@ -730,7 +730,7 @@ static int k_mode_thread(void *arg)
spin_unlock_irqrestore(&k_lock, flags2);
 
expire = jiffies + K_WAIT_TIME;
-   while (jiffies < expire)
+   while (time_before(jiffies, expire))
schedule_timeout(K_WAIT_TIME);
 
spin_lock_irqsave(&rx->lock, flags);
@@ -759,8 +759,7 @@ static int k_mode_thread(void *arg)
spin_lock_irqsave(&k_lock, flags2);
}
wait_event_interruptible_lock_irq(k_wait,
- !list_empty(&k_list) || 
k_mode_stop,
- k_lock);
+   !list_empty(&k_list) || k_mode_stop, k_lock);
spin_unlock_irqrestore(&k_lock, flags2);
}
return 0;
diff --git a/drivers/staging/gdm72xx/usb_ids.h 
b/drivers/staging/gdm72xx/usb_ids.h
index b34616b..b215f9a 100644
--- a/drivers/staging/gdm72xx/usb_ids.h
+++ b/drivers/staging/gdm72xx/usb_ids.h
@@ -32,8 +32,8 @@
 #define BL_PID_MASK0xffc0
 
 #define USB_DEVICE_BOOTLOADER(vid, pid)\
-   {USB_DEVICE((vid), ((pid)&BL_PID_MASK)|B_DOWNLOAD)},\
-   {USB_DEVICE((vid), ((pid)&BL_PID_MASK)|B_DOWNLOAD|B_DIFF_DL_DRV)}
+   ({USB_DEVICE((vid), ((pid)&BL_PID_MASK)|B_DOWNLOAD)},   \
+   {USB_DEVICE((vid), ((pid)&BL_PID_MASK)|B_DOWNLOAD|B_DIFF_DL_DRV)})
 
 #define USB_DEVICE_CDC_DATA(vid, pid)  \
{USB_DEVICE_INTF((vid), (pid), USB_CLASS_CDC_DATA)}

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


[PATCH 02/02] linux-next: staging: gdm72xx: Fix naked sscanf

2014-04-17 Thread Alexandr Terekhov
Fix naked sscanf

Signed-off-by: Alexandr Terekhov  

diff --git a/drivers/staging/gdm72xx/gdm_wimax.c 
b/drivers/staging/gdm72xx/gdm_wimax.c
index 05ce2a2..7f60da3 100644
--- a/drivers/staging/gdm72xx/gdm_wimax.c
+++ b/drivers/staging/gdm72xx/gdm_wimax.c
@@ -285,6 +285,7 @@ static void __gdm_wimax_event_send(struct work_struct *work)
int idx;
unsigned long flags;
struct evt_entry *e;
+   int rc;
 
spin_lock_irqsave(&wm_event.evt_lock, flags);
 
@@ -292,7 +293,10 @@ static void __gdm_wimax_event_send(struct work_struct 
*work)
e = list_entry(wm_event.evtq.next, struct evt_entry, list);
spin_unlock_irqrestore(&wm_event.evt_lock, flags);
 
-   sscanf(e->dev->name, "wm%d", &idx);
+   rc = sscanf(e->dev->name, "wm%d", &idx);
+   if (0 == rc)
+   pr_err("%s: sscanf() returned zero\n", __func__);
+
netlink_send(wm_event.sock, idx, 0, e->evt_data, e->size);
 
spin_lock_irqsave(&wm_event.evt_lock, flags);
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 01/01] linux-next: staging: lustre: fix integer as NULL pointer warnings

2014-05-31 Thread Alexandr Terekhov
Fix several sparse warnings "Using plain integer as NULL pointer"

Signed-off-by: Alexandr Terekhov 

 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 4 ++--
 drivers/staging/lustre/lustre/obdclass/obd_mount.c | 4 ++--
 drivers/staging/lustre/lustre/obdecho/lproc_echo.c | 4 ++--
 drivers/staging/lustre/lustre/osc/osc_dev.c| 2 +-
 drivers/staging/lustre/lustre/ptlrpc/import.c  | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
index a4cec5e..c55d72f 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
@@ -89,7 +89,7 @@ int ldlm_proc_setup(void)
 {
int rc;
struct lprocfs_vars list[] = {
-   { "dump_namespaces", &ldlm_dump_ns_fops, 0, 0222 },
+   { "dump_namespaces", &ldlm_dump_ns_fops, NULL, 0222 },
{ "dump_granted_max", &ldlm_rw_uint_fops,
  &ldlm_dump_granted_max },
{ "cancel_unused_locks_before_replay", &ldlm_rw_uint_fops,
@@ -322,7 +322,7 @@ void ldlm_namespace_proc_unregister(struct ldlm_namespace 
*ns)
snprintf(lock_name, MAX_STRING_SIZE, name); \
lock_vars[0].data = var;\
lock_vars[0].fops = ops;\
-   lprocfs_add_vars(ns_pde, lock_vars, 0); \
+   lprocfs_add_vars(ns_pde, lock_vars, NULL);  \
} while (0)
 
 int ldlm_namespace_proc_register(struct ldlm_namespace *ns)
diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c 
b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
index 419a323..a034aee 100644
--- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c
+++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
@@ -383,7 +383,7 @@ int lustre_start_mgc(struct super_block *sb)
/* Start the MGC */
rc = lustre_start_simple(mgcname, LUSTRE_MGC_NAME,
 (char *)uuid->uuid, LUSTRE_MGS_OBDNAME,
-niduuid, 0, 0);
+niduuid, NULL, NULL);
OBD_FREE_PTR(uuid);
if (rc)
GOTO(out_free, rc);
@@ -482,7 +482,7 @@ static int lustre_stop_mgc(struct super_block *sb)
 {
struct lustre_sb_info *lsi = s2lsi(sb);
struct obd_device *obd;
-   char *niduuid = 0, *ptr = 0;
+   char *niduuid = NULL, *ptr = NULL;
int i, rc = 0, len = 0;
 
if (!lsi)
diff --git a/drivers/staging/lustre/lustre/obdecho/lproc_echo.c 
b/drivers/staging/lustre/lustre/obdecho/lproc_echo.c
index b9abac1..8fe9245 100644
--- a/drivers/staging/lustre/lustre/obdecho/lproc_echo.c
+++ b/drivers/staging/lustre/lustre/obdecho/lproc_echo.c
@@ -39,13 +39,13 @@
 #ifdef LPROCFS
 LPROC_SEQ_FOPS_RO_TYPE(echo, uuid);
 static struct lprocfs_vars lprocfs_echo_obd_vars[] = {
-   { "uuid",&echo_uuid_fops,   0, 0 },
+   { "uuid",&echo_uuid_fops,   NULL, 0 },
{ 0 }
 };
 
 LPROC_SEQ_FOPS_RO_TYPE(echo, numrefs);
 static struct lprocfs_vars lprocfs_echo_module_vars[] = {
-   { "num_refs", &echo_numrefs_fops, 0, 0 },
+   { "num_refs", &echo_numrefs_fops, NULL, 0 },
{ 0 }
 };
 
diff --git a/drivers/staging/lustre/lustre/osc/osc_dev.c 
b/drivers/staging/lustre/lustre/osc/osc_dev.c
index 6a64839..a7c1ec0 100644
--- a/drivers/staging/lustre/lustre/osc/osc_dev.c
+++ b/drivers/staging/lustre/lustre/osc/osc_dev.c
@@ -193,7 +193,7 @@ static int osc_device_init(const struct lu_env *env, struct 
lu_device *d,
 static struct lu_device *osc_device_fini(const struct lu_env *env,
 struct lu_device *d)
 {
-   return 0;
+   return NULL;
 }
 
 static struct lu_device *osc_device_free(const struct lu_env *env,
diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c 
b/drivers/staging/lustre/lustre/ptlrpc/import.c
index 1c73194..8573f32 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/import.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/import.c
@@ -645,7 +645,7 @@ int ptlrpc_connect_import(struct obd_import *imp)
if (rc)
GOTO(out, rc);
 
-   rc = sptlrpc_import_sec_adapt(imp, NULL, 0);
+   rc = sptlrpc_import_sec_adapt(imp, NULL, NULL);
if (rc)
GOTO(out, rc);
 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel