Re: [PATCH] staging: rdma: Fix braces around if/else

2015-10-03 Thread Or Gerlitz

On 10/3/2015 11:55 PM, Martin Kletzander wrote:

Get rid of all ELSE_AFTER_BRACE type errors reported by checkpatch.pl.


Hi Greg,

Is there a way to signal people/tools that a certain driver parks in 
staging on their way **out** of the kernel
and not the other way around? I guess you (nor Doug) don't want to spend 
time on fixing such drivers, right?


Or.



Signed-off-by: Martin Kletzander 
---
There is one warning reported in this patch though.  That's because of
the multiline string and it's pre-existing.  Feel free to let me know
if that should be fixed too, I'd also remove the pointless '#' then.
On the other hand, it'll create more-than-80-columns long line.

  drivers/staging/rdma/ipath/ipath_driver.c| 19 ---
  drivers/staging/rdma/ipath/ipath_file_ops.c  | 12 ++--
  drivers/staging/rdma/ipath/ipath_iba6110.c   |  7 +++
  drivers/staging/rdma/ipath/ipath_init_chip.c | 10 +-
  drivers/staging/rdma/ipath/ipath_intr.c  |  7 +++
  drivers/staging/rdma/ipath/ipath_sysfs.c |  7 +++
  drivers/staging/rdma/ipath/ipath_verbs.c |  4 ++--
  7 files changed, 30 insertions(+), 36 deletions(-)


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


[PATCH V5] staging: dgnc: take a lock when storing value in dgnc_poll_tick

2015-10-03 Thread Salah Triki
Reads of dgnc_poll_tick are protected by dgnc_poll_lock spinlock, but the write
to dgnc_poll_tick is not. It could theoretically race.

Signed-off-by: Salah Triki 
---
 drivers/staging/dgnc/dgnc_driver.c | 2 +-
 drivers/staging/dgnc/dgnc_driver.h | 1 +
 drivers/staging/dgnc/dgnc_sysfs.c  | 9 -
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index 7546aff..b402c9e 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -64,6 +64,7 @@ static const struct file_operations dgnc_BoardFops = {
 uint   dgnc_NumBoards;
 struct dgnc_board  *dgnc_Board[MAXBOARDS];
 DEFINE_SPINLOCK(dgnc_global_lock);
+DEFINE_SPINLOCK(dgnc_poll_lock); /* Poll scheduling lock */
 uint   dgnc_Major;
 intdgnc_poll_tick = 20;/* Poll interval - 20 ms */
 
@@ -75,7 +76,6 @@ static struct class *dgnc_class;
 /*
  * Poller stuff
  */
-static DEFINE_SPINLOCK(dgnc_poll_lock); /* Poll scheduling lock */
 static ulong   dgnc_poll_time; /* Time of next poll */
 static uintdgnc_poll_stop; /* Used to tell poller to stop */
 static struct timer_list dgnc_poll_timer;
diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index 06ece51..c61884c 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -390,6 +390,7 @@ struct channel_t {
 extern uintdgnc_Major; /* Our driver/mgmt major */
 extern int dgnc_poll_tick; /* Poll interval - 20 ms */
 extern spinlock_t  dgnc_global_lock;   /* Driver global spinlock */
+extern spinlock_t  dgnc_poll_lock; /* Poll scheduling lock */
 extern uintdgnc_NumBoards; /* Total number of boards */
 extern struct dgnc_board   *dgnc_Board[MAXBOARDS]; /* Array of board 
structs */
 
diff --git a/drivers/staging/dgnc/dgnc_sysfs.c 
b/drivers/staging/dgnc/dgnc_sysfs.c
index 44db870..48b6056 100644
--- a/drivers/staging/dgnc/dgnc_sysfs.c
+++ b/drivers/staging/dgnc/dgnc_sysfs.c
@@ -56,11 +56,18 @@ static ssize_t dgnc_driver_pollrate_show(struct 
device_driver *ddp, char *buf)
 static ssize_t dgnc_driver_pollrate_store(struct device_driver *ddp,
  const char *buf, size_t count)
 {
+   unsigned long flags;
+   int tick;
int ret;
 
-   ret = sscanf(buf, "%d\n", &dgnc_poll_tick);
+   ret = sscanf(buf, "%d\n", &tick);
if (ret != 1)
return -EINVAL;
+
+   spin_lock_irqsave(&dgnc_poll_lock, flags);
+   dgnc_poll_tick = tick;
+   spin_unlock_irqrestore(&dgnc_poll_lock, flags);
+
return count;
 }
 static DRIVER_ATTR(pollrate, (S_IRUSR | S_IWUSR), dgnc_driver_pollrate_show,
-- 
1.9.1

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


[PATCH] staging: rdma: Fix braces around if/else

2015-10-03 Thread Martin Kletzander
Get rid of all ELSE_AFTER_BRACE type errors reported by checkpatch.pl.

Signed-off-by: Martin Kletzander 
---
There is one warning reported in this patch though.  That's because of
the multiline string and it's pre-existing.  Feel free to let me know
if that should be fixed too, I'd also remove the pointless '#' then.
On the other hand, it'll create more-than-80-columns long line.

 drivers/staging/rdma/ipath/ipath_driver.c| 19 ---
 drivers/staging/rdma/ipath/ipath_file_ops.c  | 12 ++--
 drivers/staging/rdma/ipath/ipath_iba6110.c   |  7 +++
 drivers/staging/rdma/ipath/ipath_init_chip.c | 10 +-
 drivers/staging/rdma/ipath/ipath_intr.c  |  7 +++
 drivers/staging/rdma/ipath/ipath_sysfs.c |  7 +++
 drivers/staging/rdma/ipath/ipath_verbs.c |  4 ++--
 7 files changed, 30 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/rdma/ipath/ipath_driver.c 
b/drivers/staging/rdma/ipath/ipath_driver.c
index 871dbe56216a..46d98980d66a 100644
--- a/drivers/staging/rdma/ipath/ipath_driver.c
+++ b/drivers/staging/rdma/ipath/ipath_driver.c
@@ -490,8 +490,7 @@ static int ipath_init_one(struct pci_dev *pdev, const 
struct pci_device_id *ent)
"Unable to set DMA mask for unit %u: %d\n",
dd->ipath_unit, ret);
goto bail_regions;
-   }
-   else {
+   } else {
ipath_dbg("No 64bit DMA mask, used 32 bit mask\n");
ret = pci_set_consistent_dma_mask(pdev, 
DMA_BIT_MASK(32));
if (ret)
@@ -501,8 +500,7 @@ static int ipath_init_one(struct pci_dev *pdev, const 
struct pci_device_id *ent)
dd->ipath_unit, ret);

}
-   }
-   else {
+   } else {
ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
if (ret)
dev_info(&pdev->dev,
@@ -1229,11 +1227,10 @@ reloop:
ipath_cdbg(PKT, "typ %x, opcode %x (eager, "
   "qp=%x), len %x; ignored\n",
   etype, opcode, qp, tlen);
-   }
-   else if (etype == RCVHQ_RCV_TYPE_EXPECTED)
+   } else if (etype == RCVHQ_RCV_TYPE_EXPECTED) {
ipath_dbg("Bug: Expected TID, opcode %x; ignored\n",
  be32_to_cpu(hdr->bth[0]) >> 24);
-   else {
+   } else {
/*
 * error packet, type of error unknown.
 * Probably type 3, but we don't know, so don't
@@ -1270,8 +1267,9 @@ reloop:
pd->port_seq_cnt = 1;
if (seq != pd->port_seq_cnt)
last = 1;
-   } else if (l == hdrqtail)
+   } else if (l == hdrqtail) {
last = 1;
+   }
/*
 * update head regs on last packet, and every 16 packets.
 * Reduce bus traffic, while still trying to prevent
@@ -1821,15 +1819,14 @@ int ipath_create_rcvhdrq(struct ipath_devdata *dd,
   (unsigned long) pd->port_rcvhdrq_phys,
   (unsigned long) pd->port_rcvhdrq_size,
   pd->port_port);
-   }
-   else
+   } else {
ipath_cdbg(VERBOSE, "reuse port %d rcvhdrq @%p %llx phys; "
   "hdrtailaddr@%p %llx physical\n",
   pd->port_port, pd->port_rcvhdrq,
   (unsigned long long) pd->port_rcvhdrq_phys,
   pd->port_rcvhdrtail_kvaddr, (unsigned long long)
   pd->port_rcvhdrqtailaddr_phys);
-
+   }
/* clear for security and sanity on each use */
memset(pd->port_rcvhdrq, 0, pd->port_rcvhdrq_size);
if (pd->port_rcvhdrtail_kvaddr)
diff --git a/drivers/staging/rdma/ipath/ipath_file_ops.c 
b/drivers/staging/rdma/ipath/ipath_file_ops.c
index c11f6c58ce53..04fe2dc51fe2 100644
--- a/drivers/staging/rdma/ipath/ipath_file_ops.c
+++ b/drivers/staging/rdma/ipath/ipath_file_ops.c
@@ -825,13 +825,13 @@ static void ipath_clean_part_key(struct ipath_portdata 
*pd,
ipath_stats.sps_pkeys[j] =
dd->ipath_pkeys[j] = 0;
pchanged++;
+   } else {
+   ipath_cdbg(VERBOSE, "p%u key %x matches #%d, "
+  "but ref still %d\n", pd->port_port,
+  pd->port_pkeys[i], j,
+  atomic_read(&dd->ipath_pkeyrefs[j]));
+   break;
}
-   else ipat

[PATCH 3/3] Staging: rtl8192u: remove ieee80211_ccmp_null()

2015-10-03 Thread mike dupuis
This is a patch to remove the function ieee80211_ccmp_null().
This function does nothing and can therefore be safely removed.

Signed-off-by: Mike Dupuis 
---
 drivers/staging/rtl8192u/ieee80211/ieee80211_module.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
index 61edd57..af22ee5 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
@@ -175,9 +175,6 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
  ieee->last_packet_time[i] = 0;
}
 
-/* These function were added to load crypte module autoly */
-   ieee80211_ccmp_null();
-
return dev;
 
  failed:
-- 
2.1.4


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


[PATCH 2/3] Staging: rtl8192u: remove ieee80211_wep_null()

2015-10-03 Thread mike dupuis
This is a patch to remove the function ieee80211_wep_null().
This function does nothing and can therefore be safely removed.

Signed-off-by: Mike Dupuis 
---
 drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c | 4 
 drivers/staging/rtl8192u/ieee80211/ieee80211_module.c| 1 -
 2 files changed, 5 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
index 681611d..4c2fb84 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
@@ -273,7 +273,3 @@ void __exit ieee80211_crypto_wep_exit(void)
 {
ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep);
 }
-
-void ieee80211_wep_null(void)
-{
-}
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
index d5faf2f..61edd57 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
@@ -176,7 +176,6 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
}
 
 /* These function were added to load crypte module autoly */
-   ieee80211_wep_null();
ieee80211_ccmp_null();
 
return dev;
-- 
2.1.4


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


[PATCH 1/3] Staging: rtl8192u: remove ieee80211_tkip_null()

2015-10-03 Thread mike dupuis
This is a patch to remove the function ieee80211_tkip_null().
This function does nothing, and can therefore be safely removed.

Signed-off-by: Mike Dupuis 
---
 drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 6 --
 drivers/staging/rtl8192u/ieee80211/ieee80211_module.c | 1 -
 2 files changed, 7 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
index 1f80c52..72d4fc6 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
@@ -769,9 +769,3 @@ void __exit ieee80211_crypto_tkip_exit(void)
 {
ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip);
 }
-
-void ieee80211_tkip_null(void)
-{
-//printk(">%s()\n", __func__);
-   return;
-}
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
index 425b2dd..d5faf2f 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
@@ -176,7 +176,6 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
}
 
 /* These function were added to load crypte module autoly */
-   ieee80211_tkip_null();
ieee80211_wep_null();
ieee80211_ccmp_null();
 
-- 
2.1.4


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


[PATCH 0/3] Staging: rtl8192u: Remove do-nothing functions

2015-10-03 Thread mike dupuis
This is a series of patches to remove three functions that do no
processing in staging/rtl8192u/ieee80211/.

Before:
drivers/staging/rtl8192u/$ grep _null\( *.c
drivers/staging/rtl8192u/$

drivers/staging/rtl8192u/ieee80211/$ grep _null\( *.c
ieee80211_crypt_ccmp.c:void ieee80211_ccmp_null(void)
ieee80211_crypt_tkip.c:void ieee80211_tkip_null(void)
ieee80211_crypt_wep.c:void ieee80211_wep_null(void)
ieee80211_module.c: ieee80211_tkip_null();
ieee80211_module.c: ieee80211_wep_null();
ieee80211_module.c: ieee80211_ccmp_null();
drivers/staging/rtl8192u/ieee80211/$

After:
drivers/staging/rtl8192u/$ grep _null\( *.c
drivers/staging/rtl8192u/$

drivers/staging/rtl8192u/ieee80211/$ grep _null\( *.c
drivers/staging/rtl8192u/ieee80211/$

Mike Dupuis (3):
  Staging: rtl8192u: remove ieee80211_tkip_null()
  Staging: rtl8192u: remove ieee80211_wep_null()
  Staging: rtl8192u: remove ieee80211_ccmp_null()

 drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 6 --
 drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c  | 4 
 drivers/staging/rtl8192u/ieee80211/ieee80211_module.c | 5 -
 3 files changed, 15 deletions(-)

-- 
2.1.4


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [staging:staging-testing 416/970] drivers/staging/wilc1000/wilc_msgqueue.c:78:2-8: preceding lock on line 73

2015-10-03 Thread Julia Lawall
It looks like this is worth checking.  The direct return preceeded by a 
failure path with a goto may also be a problem.

julia

On Wed, 30 Sep 2015, kbuild test robot wrote:

> CC: kbuild-...@01.org
> TO: Leo Kim 
> CC: "Greg Kroah-Hartman" 
> CC: Tony Cho 
> CC: de...@driverdev.osuosl.org
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
> staging-testing
> head:   5b62408ffe42ffce28e94bc5e7a6dec45e6456ee
> commit: 24db713fe5325917690c2c793a6321aa0b11a0c8 [416/970] staging: wilc1000: 
> remove the macro WILC_ERRORREPORT
> :: branch date: 26 minutes ago
> :: commit date: 13 days ago
> 
> >> drivers/staging/wilc1000/wilc_msgqueue.c:78:2-8: preceding lock on line 73
> 
> git remote add staging 
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
> git remote update staging
> git checkout 24db713fe5325917690c2c793a6321aa0b11a0c8
> vim +78 drivers/staging/wilc1000/wilc_msgqueue.c
> 
> bb9c2e7a Chaehyun Lim 2015-08-19  67  if (pHandle->bExiting) {
> 24db713f Leo Kim  2015-09-16  68  PRINT_ER("pHandle 
> fail\n");
> 24db713f Leo Kim  2015-09-16  69  s32RetStatus = -EFAULT;
> 24db713f Leo Kim  2015-09-16  70  goto ERRORHANDLER;
> c5c77ba1 Johnny Kim   2015-05-11  71  }
> c5c77ba1 Johnny Kim   2015-05-11  72  
> c5c77ba1 Johnny Kim   2015-05-11 @73  
> spin_lock_irqsave(&pHandle->strCriticalSection, flags);
> c5c77ba1 Johnny Kim   2015-05-11  74  
> c5c77ba1 Johnny Kim   2015-05-11  75  /* construct a new message */
> 5c07828f Chaehyun Lim 2015-08-17  76  pstrMessage = 
> kmalloc(sizeof(Message), GFP_ATOMIC);
> 7ae43363 Leo Kim  2015-09-16  77  if (!pstrMessage)
> 7ae43363 Leo Kim  2015-09-16 @78  return -ENOMEM;
> c5c77ba1 Johnny Kim   2015-05-11  79  pstrMessage->u32Length = 
> u32SendBufferSize;
> c5c77ba1 Johnny Kim   2015-05-11  80  pstrMessage->pstrNext = NULL;
> d9998a91 Chaehyun Lim 2015-09-08  81  pstrMessage->pvBuffer = 
> kmalloc(u32SendBufferSize, GFP_ATOMIC);
> 
> :: The code at line 78 was first introduced by commit
> :: 7ae433631eacd0f0aaa749baef4c7f6baa5b3936 staging: wilc1000: remove a 
> macro WILC_NULLCHECK
> 
> :: TO: Leo Kim 
> :: CC: Greg Kroah-Hartman 
> 
> ---
> 0-DAY kernel test infrastructureOpen Source Technology Center
> https://lists.01.org/pipermail/kbuild-all   Intel Corporation
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: iio: adc: fix comment block coding style issue

2015-10-03 Thread Hugo Camboulive
This patch to ad7746.c makes the comment block end with a */
on a separate line.

Signed-off-by: Hugo Camboulive 
---
 drivers/staging/iio/cdc/ad7746.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c
index 10fa372..8445ddd 100644
--- a/drivers/staging/iio/cdc/ad7746.c
+++ b/drivers/staging/iio/cdc/ad7746.c
@@ -531,7 +531,7 @@ static int ad7746_write_raw(struct iio_dev *indio_dev,
/* CAPDAC Scale = 21pF_typ / 127
 * CIN Scale = 8.192pF / 2^24
 * Offset Scale = CAPDAC Scale / CIN Scale = 338646
-* */
+*/
 
val /= 338646;
 
-- 
2.6.0

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


Re: [PATCH] staging: lustre: lustre: llite: Added a blank line

2015-10-03 Thread Drokin, Oleg

On Oct 3, 2015, at 7:39 AM, Anjali Menon wrote:

> Added a blank line after declaration to fix the coding
> style warning detected by checkpatch.pl
> 
> WARNING: Missing a blank line after declarations
> 
> Signed-off-by: Anjali Menon 
> ---
> drivers/staging/lustre/lustre/llite/llite_capa.c | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/staging/lustre/lustre/llite/llite_capa.c 
> b/drivers/staging/lustre/lustre/llite/llite_capa.c
> index aec9a44..a626871 100644
> --- a/drivers/staging/lustre/lustre/llite/llite_capa.c
> +++ b/drivers/staging/lustre/lustre/llite/llite_capa.c
> @@ -140,6 +140,7 @@ static void sort_add_capa(struct obd_capa *ocapa, struct 
> list_head *head)
> static inline int obd_capa_open_count(struct obd_capa *oc)

This whole file has been recently removed.
In general at least with Lustre (and probably with other staging code) it's 
best to
base your work on Greg's staging-next (or even staging-testing) tree because 
this
is where the most up to date code is (And this is where Greg tries to apply it 
anyway).

> {
>   struct ll_inode_info *lli = ll_i2info(oc->u.cli.inode);
> +
>   return atomic_read(&lli->lli_open_count);
> }
> 
> -- 
> 1.9.1
> 

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


[PATCH 11/11] staging: dgnc: remove dgnc_init_globals function

2015-10-03 Thread Sudip Mukherjee
The dgnc_init_globals() function is only initializing the timer so
initialize it directly and remove dgnc_init_globals() and change the
comment appropriately.

Signed-off-by: Sudip Mukherjee 
---
 drivers/staging/dgnc/dgnc_driver.c | 18 ++
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index 0886e33..9f5e4b6 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -38,7 +38,6 @@ MODULE_SUPPORTED_DEVICE("dgnc");
  */
 static int dgnc_start(void);
 static int dgnc_finalize_board_init(struct dgnc_board *brd);
-static voiddgnc_init_globals(void);
 static int dgnc_found_board(struct pci_dev *pdev, int id);
 static voiddgnc_cleanup_board(struct dgnc_board *brd);
 static voiddgnc_poll_handler(ulong dummy);
@@ -213,8 +212,8 @@ static int dgnc_start(void)
unsigned long flags;
struct device *dev;
 
-   /* make sure that the globals are init'd before we do anything else */
-   dgnc_init_globals();
+   /* make sure timer is initialized before we do anything else */
+   init_timer(&dgnc_poll_timer);
 
/*
 * Register our base character device into the kernel.
@@ -683,16 +682,3 @@ static void dgnc_poll_handler(ulong dummy)
if (!dgnc_poll_stop)
add_timer(&dgnc_poll_timer);
 }
-
-/*
- * dgnc_init_globals()
- *
- * This is where we initialize the globals from the static insmod
- * configuration variables.  These are declared near the head of
- * this file.
- */
-static void dgnc_init_globals(void)
-{
-   init_timer(&dgnc_poll_timer);
-}
-
-- 
1.9.1

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


[PATCH 08/11] staging: dgnc: remove NULL test

2015-10-03 Thread Sudip Mukherjee
This NULL test is not required as iounmap will validate the argument.

Signed-off-by: Sudip Mukherjee 
---
 drivers/staging/dgnc/dgnc_cls.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index d62b745..75040da 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -1296,6 +1296,5 @@ static void cls_vpd(struct dgnc_board *brd)
}
pr_info("\n");
 
-   if (re_map_vpdbase)
-   iounmap(re_map_vpdbase);
+   iounmap(re_map_vpdbase);
 }
-- 
1.9.1

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


[PATCH 07/11] staging: dgnc: alignment style

2015-10-03 Thread Sudip Mukherjee
checkpatch was warning us that the alignment should match the open
parenthesis.

Signed-off-by: Sudip Mukherjee 
---
 drivers/staging/dgnc/dgnc_cls.c| 14 +++---
 drivers/staging/dgnc/dgnc_driver.c |  2 +-
 drivers/staging/dgnc/dgnc_neo.c|  2 +-
 drivers/staging/dgnc/dgnc_tty.c| 30 +++---
 4 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index e8a7851..d62b745 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -518,7 +518,7 @@ static void cls_param(struct tty_struct *tty)
 * unit is NOT open
 */
if (!(ch->ch_tun.un_flags & UN_ISOPEN) &&
-(un->un_type == DGNC_PRINT))
+   (un->un_type == DGNC_PRINT))
baud = C_BAUD(ch->ch_pun.un_tty) & 0xff;
else
baud = C_BAUD(ch->ch_tun.un_tty) & 0xff;
@@ -532,7 +532,7 @@ static void cls_param(struct tty_struct *tty)
jindex = baud;
 
if ((iindex >= 0) && (iindex < 4) && (jindex >= 0) &&
-   (jindex < 16)) {
+   (jindex < 16)) {
baud = bauds[iindex][jindex];
} else {
baud = 0;
@@ -641,7 +641,7 @@ static void cls_param(struct tty_struct *tty)
 * disable flow control
 */
if ((ch->ch_startc == _POSIX_VDISABLE) ||
-(ch->ch_stopc == _POSIX_VDISABLE))
+   (ch->ch_stopc == _POSIX_VDISABLE))
cls_set_no_output_flow_control(ch);
else
cls_set_ixon_flow_control(ch);
@@ -657,7 +657,7 @@ static void cls_param(struct tty_struct *tty)
 * flow control
 */
if ((ch->ch_startc == _POSIX_VDISABLE) ||
-   (ch->ch_stopc == _POSIX_VDISABLE))
+   (ch->ch_stopc == _POSIX_VDISABLE))
cls_set_no_input_flow_control(ch);
else
cls_set_ixoff_flow_control(ch);
@@ -933,7 +933,7 @@ static void cls_flush_uart_write(struct channel_t *ch)
return;
 
writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_XMIT),
-   &ch->ch_cls_uart->isr_fcr);
+  &ch->ch_cls_uart->isr_fcr);
udelay(10);
 
ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
@@ -979,7 +979,7 @@ static void cls_copy_data_from_queue_to_uart(struct 
channel_t *ch)
 
/* If port is "stopped", don't send any data to the UART */
if ((ch->ch_flags & CH_FORCED_STOP) ||
-(ch->ch_flags & CH_BREAK_SENDING))
+   (ch->ch_flags & CH_BREAK_SENDING))
goto exit_unlock;
 
if (!(ch->ch_flags & (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM)))
@@ -1169,7 +1169,7 @@ static void cls_uart_init(struct channel_t *ch)
readb(&ch->ch_cls_uart->txrx);
 
writeb((UART_FCR_ENABLE_FIFO|UART_FCR_CLEAR_RCVR|UART_FCR_CLEAR_XMIT),
-&ch->ch_cls_uart->isr_fcr);
+  &ch->ch_cls_uart->isr_fcr);
udelay(10);
 
ch->ch_flags |= (CH_FIFO_ENABLED | CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index e476503..21d64b4 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -238,7 +238,7 @@ static int dgnc_start(void)
}
 
dev = device_create(dgnc_class, NULL,
-   MKDEV(dgnc_Major, 0),
+   MKDEV(dgnc_Major, 0),
NULL, "dgnc_mgmt");
if (IS_ERR(dev)) {
rc = PTR_ERR(dev);
diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 0d7ba53..99287bb 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -1390,7 +1390,7 @@ static void neo_copy_data_from_queue_to_uart(struct 
channel_t *ch)
 
/* If port is "stopped", don't send any data to the UART */
if ((ch->ch_flags & CH_FORCED_STOP) ||
-(ch->ch_flags & CH_BREAK_SENDING))
+   (ch->ch_flags & CH_BREAK_SENDING))
goto exit_unlock;
 
/*
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index b40fd67..a2fe41b 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -344,12 +344,12 @@ int dgnc_tty_init(struct dgnc_board *brd)
struct device *classp;
 
classp = tty_register_device(&brd->SerialDriver, i,
-   &(ch->ch_bd->pdev->dev));
+  

[PATCH 05/11] staging: dgnc: remove space after cast

2015-10-03 Thread Sudip Mukherjee
Space is not necessary after typecast.

Signed-off-by: Sudip Mukherjee 
---
 drivers/staging/dgnc/dgnc_cls.c|  6 +++---
 drivers/staging/dgnc/dgnc_driver.c |  6 +++---
 drivers/staging/dgnc/dgnc_mgmt.c   |  6 +++---
 drivers/staging/dgnc/dgnc_neo.c| 12 ++--
 drivers/staging/dgnc/dgnc_tty.c| 24 
 5 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index 32b05bb..e8a7851 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -438,7 +438,7 @@ static void cls_param(struct tty_struct *tty)
if (!tty || tty->magic != TTY_MAGIC)
return;
 
-   un = (struct un_t *) tty->driver_data;
+   un = (struct un_t *)tty->driver_data;
if (!un || un->magic != DGNC_UNIT_MAGIC)
return;
 
@@ -676,7 +676,7 @@ static void cls_param(struct tty_struct *tty)
  */
 static void cls_tasklet(unsigned long data)
 {
-   struct dgnc_board *bd = (struct dgnc_board *) data;
+   struct dgnc_board *bd = (struct dgnc_board *)data;
struct channel_t *ch;
unsigned long flags;
int i;
@@ -904,7 +904,7 @@ static int cls_drain(struct tty_struct *tty, uint seconds)
if (!tty || tty->magic != TTY_MAGIC)
return -ENXIO;
 
-   un = (struct un_t *) tty->driver_data;
+   un = (struct un_t *)tty->driver_data;
if (!un || un->magic != DGNC_UNIT_MAGIC)
return -ENXIO;
 
diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index b47ff6a..e476503 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -453,7 +453,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
 
brd->iobase = pci_resource_start(pdev, 1);
brd->iobase_end = pci_resource_end(pdev, 1);
-   brd->iobase = ((unsigned int) (brd->iobase)) & 0xFFFE;
+   brd->iobase = ((unsigned int)(brd->iobase)) & 0xFFFE;
 
/* Assign the board_ops struct */
brd->bd_ops = &dgnc_cls_ops;
@@ -560,7 +560,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
/* init our poll helper tasklet */
tasklet_init(&brd->helper_tasklet,
 brd->bd_ops->tasklet,
-(unsigned long) brd);
+(unsigned long)brd);
 
spin_lock_irqsave(&dgnc_global_lock, flags);
brd->msgbuf = NULL;
@@ -673,7 +673,7 @@ static void dgnc_poll_handler(ulong dummy)
 
new_time = dgnc_poll_time - jiffies;
 
-   if ((ulong) new_time >= 2 * dgnc_poll_tick)
+   if ((ulong)new_time >= 2 * dgnc_poll_tick)
dgnc_poll_time = jiffies + dgnc_jiffies_from_ms(dgnc_poll_tick);
 
setup_timer(&dgnc_poll_timer, dgnc_poll_handler, 0);
diff --git a/drivers/staging/dgnc/dgnc_mgmt.c b/drivers/staging/dgnc/dgnc_mgmt.c
index 5f46e69..9ec3efe 100644
--- a/drivers/staging/dgnc/dgnc_mgmt.c
+++ b/drivers/staging/dgnc/dgnc_mgmt.c
@@ -96,7 +96,7 @@ int dgnc_mgmt_close(struct inode *inode, struct file *file)
 long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
unsigned long flags;
-   void __user *uarg = (void __user *) arg;
+   void __user *uarg = (void __user *)arg;
 
switch (cmd) {
case DIGI_GETDD:
@@ -142,8 +142,8 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
di.info_bdtype = dgnc_Board[brd]->dpatype;
di.info_bdstate = dgnc_Board[brd]->dpastatus;
di.info_ioport = 0;
-   di.info_physaddr = (ulong) dgnc_Board[brd]->membase;
-   di.info_physsize = (ulong) dgnc_Board[brd]->membase
+   di.info_physaddr = (ulong)dgnc_Board[brd]->membase;
+   di.info_physsize = (ulong)dgnc_Board[brd]->membase
- dgnc_Board[brd]->membase_end;
if (dgnc_Board[brd]->state != BOARD_FAILED)
di.info_nports = dgnc_Board[brd]->nasync;
diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 3dd7342..0d7ba53 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -590,7 +590,7 @@ static void neo_param(struct tty_struct *tty)
if (!tty || tty->magic != TTY_MAGIC)
return;
 
-   un = (struct un_t *) tty->driver_data;
+   un = (struct un_t *)tty->driver_data;
if (!un || un->magic != DGNC_UNIT_MAGIC)
return;
 
@@ -828,7 +828,7 @@ static void neo_param(struct tty_struct *tty)
  */
 static void neo_tasklet(unsigned long data)
 {
-   struct dgnc_board *bd = (struct dgnc_board *) data;
+   struct dgnc_board *bd = (struct dgnc_board *)data;
struct channel_t *ch;
unsigned long flags;
int i;
@@ -1151,7 +1151,7 @@ static void neo_copy_data_from_ua

[PATCH 04/11] staging: dgnc: remove blankline after brace

2015-10-03 Thread Sudip Mukherjee
Blank lines are not needed after opening braces. checkpatch was giving
us warnings about this.

Signed-off-by: Sudip Mukherjee 
---
 drivers/staging/dgnc/dgnc_cls.c|  4 
 drivers/staging/dgnc/dgnc_driver.c |  3 ---
 drivers/staging/dgnc/dgnc_mgmt.c   |  1 -
 drivers/staging/dgnc/dgnc_neo.c| 11 ---
 drivers/staging/dgnc/dgnc_tty.c| 11 ---
 5 files changed, 30 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index db997dd..32b05bb 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -378,7 +378,6 @@ static inline void cls_parse_isr(struct dgnc_board *brd, 
uint port)
 
/* Here we try to figure out what caused the interrupt to happen */
while (1) {
-
isr = readb(&ch->ch_cls_uart->isr_fcr);
 
/* Bail if no pending interrupt on port */
@@ -472,7 +471,6 @@ static void cls_param(struct tty_struct *tty)
ch->ch_old_baud = 0;
return;
} else if (ch->ch_custom_speed) {
-
baud = ch->ch_custom_speed;
/* Handle transition from B0 */
if (ch->ch_flags & CH_BAUD0) {
@@ -704,7 +702,6 @@ static void cls_tasklet(unsigned long data)
 * If board is ready, parse deeper to see if there is anything to do.
 */
if ((state == BOARD_READY) && (ports > 0)) {
-
/* Loop on each port */
for (i = 0; i < ports; i++) {
ch = bd->channels[i];
@@ -999,7 +996,6 @@ static void cls_copy_data_from_queue_to_uart(struct 
channel_t *ch)
n = min(n, qlen);
 
while (n > 0) {
-
/*
 * If RTS Toggle mode is on, turn on RTS now if not already set,
 * and make sure we get an event when the data transfer has
diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index 5cf4837..b47ff6a 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -418,7 +418,6 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
brd->irq = pci_irq;
 
switch (brd->device) {
-
case PCI_DEVICE_CLASSIC_4_DID:
case PCI_DEVICE_CLASSIC_8_DID:
case PCI_DEVICE_CLASSIC_4_422_DID:
@@ -517,7 +516,6 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
dgnc_do_remap(brd);
 
if (brd->re_map_membase) {
-
/* Read and store the dvid after remapping */
brd->dvid = readb(brd->re_map_membase + 0x8D);
 
@@ -610,7 +608,6 @@ static int dgnc_finalize_board_init(struct dgnc_board *brd)
  */
 static void dgnc_do_remap(struct dgnc_board *brd)
 {
-
if (!brd || brd->magic != DGNC_BOARD_MAGIC)
return;
 
diff --git a/drivers/staging/dgnc/dgnc_mgmt.c b/drivers/staging/dgnc/dgnc_mgmt.c
index e8aaf35..5f46e69 100644
--- a/drivers/staging/dgnc/dgnc_mgmt.c
+++ b/drivers/staging/dgnc/dgnc_mgmt.c
@@ -99,7 +99,6 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
void __user *uarg = (void __user *) arg;
 
switch (cmd) {
-
case DIGI_GETDD:
{
/*
diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index fb95282..3dd7342 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -320,7 +320,6 @@ static inline void neo_set_no_output_flow_control(struct 
channel_t *ch)
 /* change UARTs start/stop chars */
 static inline void neo_set_new_start_stop_chars(struct channel_t *ch)
 {
-
/* if hardware flow control is set, then skip this whole thing */
if (ch->ch_digi.digi_flags & (CTSPACE | RTSPACE) || ch->ch_c_cflag & 
CRTSCTS)
return;
@@ -387,7 +386,6 @@ static inline void neo_parse_isr(struct dgnc_board *brd, 
uint port)
 
/* Here we try to figure out what caused the interrupt to happen */
while (1) {
-
isr = readb(&ch->ch_neo_uart->isr_fcr);
 
/* Bail if no pending interrupt */
@@ -626,7 +624,6 @@ static void neo_param(struct tty_struct *tty)
return;
 
} else if (ch->ch_custom_speed) {
-
baud = ch->ch_custom_speed;
/* Handle transition from B0 */
if (ch->ch_flags & CH_BAUD0) {
@@ -954,7 +951,6 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)
 
/* Loop on each port */
while ((uart_poll & 0xff) != 0) {
-
tmp = uart_poll;
 
/* Check current port to see if it has interrupt pending */
@@ -977,7 +973,6 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)
 
/* Switch on type of interrupt we have */
switch (type) {
-
case UART_17158_RXRDY_TIMEOUT:
/*
 * RXRDY Time-out is cleared by reading data in the
@@ -1141

[PATCH 06/11] staging: dgnc: change style of NULL comparison

2015-10-03 Thread Sudip Mukherjee
Change the NULL comparison style as warned by checkpatch.

Signed-off-by: Sudip Mukherjee 
---
 drivers/staging/dgnc/dgnc_tty.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index 35f3ec4..b40fd67 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -1469,7 +1469,7 @@ static int dgnc_tty_chars_in_buffer(struct tty_struct 
*tty)
uint chars = 0;
unsigned long flags;
 
-   if (tty == NULL)
+   if (!tty)
return 0;
 
un = tty->driver_data;
@@ -1570,7 +1570,7 @@ static int dgnc_tty_write_room(struct tty_struct *tty)
int ret = 0;
unsigned long flags;
 
-   if (tty == NULL || dgnc_TmpWriteBuf == NULL)
+   if (!tty || !dgnc_TmpWriteBuf)
return 0;
 
un = tty->driver_data;
@@ -1649,7 +1649,7 @@ static int dgnc_tty_write(struct tty_struct *tty,
ushort tmask;
uint remain;
 
-   if (tty == NULL || dgnc_TmpWriteBuf == NULL)
+   if (!tty || !dgnc_TmpWriteBuf)
return 0;
 
un = tty->driver_data;
-- 
1.9.1

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


[PATCH 10/11] staging: dgnc: remove initialization of global

2015-10-03 Thread Sudip Mukherjee
globals variable will be initialied to 0 and the global pointers will be
to NULL. No need to initialize them separately.

Signed-off-by: Sudip Mukherjee 
---
 drivers/staging/dgnc/dgnc_driver.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index 21d64b4..0886e33 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -693,13 +693,6 @@ static void dgnc_poll_handler(ulong dummy)
  */
 static void dgnc_init_globals(void)
 {
-   int i = 0;
-
-   dgnc_NumBoards  = 0;
-
-   for (i = 0; i < MAXBOARDS; i++)
-   dgnc_Board[i] = NULL;
-
init_timer(&dgnc_poll_timer);
 }
 
-- 
1.9.1

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


[PATCH 02/11] staging: dgnc: remove multiple blank lines

2015-10-03 Thread Sudip Mukherjee
checkpatch warns us about multiple blank lines which are not needed.
Remove them.

Signed-off-by: Sudip Mukherjee 
---
 drivers/staging/dgnc/dgnc_driver.c | 10 
 drivers/staging/dgnc/dgnc_mgmt.c   |  5 
 drivers/staging/dgnc/dgnc_neo.c| 37 ---
 drivers/staging/dgnc/dgnc_sysfs.c  | 37 ---
 drivers/staging/dgnc/dgnc_tty.c| 51 --
 5 files changed, 140 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index 7546aff..38efea2 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -13,7 +13,6 @@
  * PURPOSE.  See the GNU General Public License for more details.
  */
 
-
 #include 
 #include 
 #include 
@@ -57,7 +56,6 @@ static const struct file_operations dgnc_BoardFops = {
.release=   dgnc_mgmt_close
 };
 
-
 /*
  * Globals
  */
@@ -80,7 +78,6 @@ static ulong  dgnc_poll_time; /* Time of next poll */
 static uintdgnc_poll_stop; /* Used to tell poller to stop */
 static struct timer_list dgnc_poll_timer;
 
-
 static const struct pci_device_id dgnc_pci_tbl[] = {
{PCI_DEVICE(DIGI_VID, PCI_DEVICE_CLASSIC_4_DID), .driver_data = 0},
{PCI_DEVICE(DIGI_VID, PCI_DEVICE_CLASSIC_4_422_DID), .driver_data = 1},
@@ -355,13 +352,11 @@ static void dgnc_cleanup_board(struct dgnc_board *brd)
}
}
 
-
dgnc_Board[brd->boardnum] = NULL;
 
kfree(brd);
 }
 
-
 /*
  * dgnc_found_board()
  *
@@ -422,7 +417,6 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
pci_irq = pdev->irq;
brd->irq = pci_irq;
 
-
switch (brd->device) {
 
case PCI_DEVICE_CLASSIC_4_DID:
@@ -442,7 +436,6 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
 * 4Memory Mapped UARTs and Status
 */
 
-
/* get the PCI Base Address Registers */
brd->membase = pci_resource_start(pdev, 4);
 
@@ -483,7 +476,6 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
 
break;
 
-
case PCI_DEVICE_NEO_4_DID:
case PCI_DEVICE_NEO_8_DID:
case PCI_DEVICE_NEO_2DB9_DID:
@@ -593,7 +585,6 @@ failed:
 
 }
 
-
 static int dgnc_finalize_board_init(struct dgnc_board *brd)
 {
int rc = 0;
@@ -628,7 +619,6 @@ static void dgnc_do_remap(struct dgnc_board *brd)
brd->re_map_membase = ioremap(brd->membase, 0x1000);
 }
 
-
 /*
 *
 * Function:
diff --git a/drivers/staging/dgnc/dgnc_mgmt.c b/drivers/staging/dgnc/dgnc_mgmt.c
index 81c793a..81f0da2 100644
--- a/drivers/staging/dgnc/dgnc_mgmt.c
+++ b/drivers/staging/dgnc/dgnc_mgmt.c
@@ -32,11 +32,9 @@
 #include "dgnc_pci.h"
 #include "dgnc_mgmt.h"
 
-
 /* Our "in use" variables, to enforce 1 open only */
 static int dgnc_mgmt_in_use[MAXMGMTDEVICES];
 
-
 /*
  * dgnc_mgmt_open()
  *
@@ -67,7 +65,6 @@ int dgnc_mgmt_open(struct inode *inode, struct file *file)
return 0;
 }
 
-
 /*
  * dgnc_mgmt_close()
  *
@@ -90,7 +87,6 @@ int dgnc_mgmt_close(struct inode *inode, struct file *file)
return 0;
 }
 
-
 /*
  * dgnc_mgmt_ioctl()
  *
@@ -256,7 +252,6 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
break;
}
 
-
}
 
return 0;
diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 900e3ae..09d3de7 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -13,7 +13,6 @@
  * PURPOSE.  See the GNU General Public License for more details.
  */
 
-
 #include 
 #include/* For jiffies, task states */
 #include /* For tasklet and interrupt structs/defines */
@@ -57,7 +56,6 @@ static uint neo_get_uart_bytes_left(struct channel_t *ch);
 static void neo_send_immediate_char(struct channel_t *ch, unsigned char c);
 static irqreturn_t neo_intr(int irq, void *voidbrd);
 
-
 struct board_ops dgnc_neo_ops = {
.tasklet =  neo_tasklet,
.intr = neo_intr,
@@ -81,7 +79,6 @@ struct board_ops dgnc_neo_ops = {
 
 static uint dgnc_offset_table[8] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 
0x80 };
 
-
 /*
  * This function allows calls to ensure that all outstanding
  * PCI writes have been completed, by doing a PCI read against
@@ -100,7 +97,6 @@ static inline void neo_set_cts_flow_control(struct channel_t 
*ch)
unsigned char ier = readb(&ch->ch_neo_uart->ier);
unsigned char efr = readb(&ch->ch_neo_uart->efr);
 
-
/* Turn on auto CTS flow control */
 #if 1
ier |= UART_17158_IER_CTSDSR;
@@ -131,7 +127,6 @@ static inline void neo_set_cts_flow_control(struct 
channel_t *ch)
neo_pci_posting_flush(ch->ch_bd);
 }
 
-
 static inline void neo_set_rts_flow_control(struct channel_t *ch)
 {
unsigned char 

[PATCH 03/11] staging: dgnc: remove blankline before brace

2015-10-03 Thread Sudip Mukherjee
Blank lines are not needed before closing braces. checkpatch was giving
warning about this.

Signed-off-by: Sudip Mukherjee 
---
 drivers/staging/dgnc/dgnc_cls.c| 7 ---
 drivers/staging/dgnc/dgnc_driver.c | 2 --
 drivers/staging/dgnc/dgnc_mgmt.c   | 1 -
 drivers/staging/dgnc/dgnc_neo.c| 1 -
 drivers/staging/dgnc/dgnc_sysfs.c  | 1 -
 drivers/staging/dgnc/dgnc_tty.c| 4 
 6 files changed, 16 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index 24fc28c..db997dd 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -115,7 +115,6 @@ static inline void cls_set_cts_flow_control(struct 
channel_t *ch)
&ch->ch_cls_uart->isr_fcr);
 
ch->ch_t_tlevel = 16;
-
 }
 
 static inline void cls_set_ixon_flow_control(struct channel_t *ch)
@@ -161,7 +160,6 @@ static inline void cls_set_ixon_flow_control(struct 
channel_t *ch)
writeb((UART_FCR_ENABLE_FIFO | UART_16654_FCR_RXTRIGGER_16 |
UART_16654_FCR_TXTRIGGER_16 | UART_FCR_CLEAR_RCVR),
&ch->ch_cls_uart->isr_fcr);
-
 }
 
 static inline void cls_set_no_output_flow_control(struct channel_t *ch)
@@ -205,7 +203,6 @@ static inline void cls_set_no_output_flow_control(struct 
channel_t *ch)
ch->ch_r_watermark = 0;
ch->ch_t_tlevel = 16;
ch->ch_r_tlevel = 16;
-
 }
 
 static inline void cls_set_rts_flow_control(struct channel_t *ch)
@@ -244,7 +241,6 @@ static inline void cls_set_rts_flow_control(struct 
channel_t *ch)
 
ch->ch_r_watermark = 4;
ch->ch_r_tlevel = 8;
-
 }
 
 static inline void cls_set_ixoff_flow_control(struct channel_t *ch)
@@ -286,7 +282,6 @@ static inline void cls_set_ixoff_flow_control(struct 
channel_t *ch)
writeb((UART_FCR_ENABLE_FIFO | UART_16654_FCR_RXTRIGGER_16 |
UART_16654_FCR_TXTRIGGER_16 | UART_FCR_CLEAR_RCVR),
&ch->ch_cls_uart->isr_fcr);
-
 }
 
 static inline void cls_set_no_input_flow_control(struct channel_t *ch)
@@ -325,7 +320,6 @@ static inline void cls_set_no_input_flow_control(struct 
channel_t *ch)
 
ch->ch_t_tlevel = 16;
ch->ch_r_tlevel = 16;
-
 }
 
 /*
@@ -746,7 +740,6 @@ static void cls_tasklet(unsigned long data)
}
 
spin_unlock_irqrestore(&bd->bd_intr_lock, flags);
-
 }
 
 /*
diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index 38efea2..5cf4837 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -530,7 +530,6 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
dev_err(&brd->pdev->dev,
"Didn't find any compatible Neo/Classic PCI boards.\n");
return -ENXIO;
-
}
 
/*
@@ -582,7 +581,6 @@ failed:
brd->dpastatus = BD_NOFEP;
 
return -ENXIO;
-
 }
 
 static int dgnc_finalize_board_init(struct dgnc_board *brd)
diff --git a/drivers/staging/dgnc/dgnc_mgmt.c b/drivers/staging/dgnc/dgnc_mgmt.c
index 81f0da2..e8aaf35 100644
--- a/drivers/staging/dgnc/dgnc_mgmt.c
+++ b/drivers/staging/dgnc/dgnc_mgmt.c
@@ -251,7 +251,6 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
 
break;
}
-
}
 
return 0;
diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 09d3de7..fb95282 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -901,7 +901,6 @@ static void neo_tasklet(unsigned long data)
 
/* Allow interrupt routine to access the interrupt register again */
spin_unlock_irqrestore(&bd->bd_intr_lock, flags);
-
 }
 
 /*
diff --git a/drivers/staging/dgnc/dgnc_sysfs.c 
b/drivers/staging/dgnc/dgnc_sysfs.c
index ca20009..2e8fb91 100644
--- a/drivers/staging/dgnc/dgnc_sysfs.c
+++ b/drivers/staging/dgnc/dgnc_sysfs.c
@@ -688,7 +688,6 @@ void dgnc_create_tty_sysfs(struct un_t *un, struct device 
*c)
}
 
dev_set_drvdata(c, un);
-
 }
 
 void dgnc_remove_tty_sysfs(struct device *c)
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index 6752e38..4a88e1b 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -353,7 +353,6 @@ int dgnc_tty_init(struct dgnc_board *brd)
ch->ch_pun.un_sysfs = classp;
dgnc_create_tty_sysfs(&ch->ch_pun, classp);
}
-
}
 
return 0;
@@ -1319,7 +1318,6 @@ static void dgnc_tty_hangup(struct tty_struct *tty)
 
/* flush the transmit queues */
dgnc_tty_flush_buffer(tty);
-
 }
 
 /*
@@ -1929,7 +1927,6 @@ static int dgnc_tty_send_break(struct tty_struct *tty, 
int msec)
spin_unlock_irqrestore(&ch->ch_lock, flags);
 
return 0;
-
 }
 
 /*
@@ -2678,7 +2675,6 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, 
unsigned int cmd,
ch->ch_pun.un_flags &= 
~(UN_LOW|UN_E

[PATCH 09/11] staging: dgnc: remove parenthesis

2015-10-03 Thread Sudip Mukherjee
checkpatch was warning us about extra unneeded parenthesis.

Signed-off-by: Sudip Mukherjee 
---
 drivers/staging/dgnc/dgnc_neo.c   |  2 +-
 drivers/staging/dgnc/dgnc_sysfs.c | 48 +++
 drivers/staging/dgnc/dgnc_tty.c   | 14 ++--
 3 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 99287bb..8106f52 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -1792,6 +1792,6 @@ static void neo_vpd(struct dgnc_board *brd)
/* Search for the serial number */
for (i = 0; i < NEO_VPD_IMAGEBYTES - 3; i++)
if (brd->vpd[i] == 'S' && brd->vpd[i + 1] == 'N')
-   strncpy(brd->serial_num, &(brd->vpd[i + 3]), 9);
+   strncpy(brd->serial_num, &brd->vpd[i + 3], 9);
}
 }
diff --git a/drivers/staging/dgnc/dgnc_sysfs.c 
b/drivers/staging/dgnc/dgnc_sysfs.c
index 2e8fb91..236a824 100644
--- a/drivers/staging/dgnc/dgnc_sysfs.c
+++ b/drivers/staging/dgnc/dgnc_sysfs.c
@@ -336,18 +336,18 @@ void dgnc_create_ports_sysfiles(struct dgnc_board *bd)
int rc = 0;
 
dev_set_drvdata(&bd->pdev->dev, bd);
-   rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_state);
-   rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_baud);
-   rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_msignals);
-   rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_iflag);
-   rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_cflag);
-   rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_oflag);
-   rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_lflag);
-   rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_digi_flag);
-   rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_rxcount);
-   rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_txcount);
-   rc |= device_create_file(&(bd->pdev->dev), &dev_attr_vpd);
-   rc |= device_create_file(&(bd->pdev->dev), &dev_attr_serial_number);
+   rc |= device_create_file(&bd->pdev->dev, &dev_attr_ports_state);
+   rc |= device_create_file(&bd->pdev->dev, &dev_attr_ports_baud);
+   rc |= device_create_file(&bd->pdev->dev, &dev_attr_ports_msignals);
+   rc |= device_create_file(&bd->pdev->dev, &dev_attr_ports_iflag);
+   rc |= device_create_file(&bd->pdev->dev, &dev_attr_ports_cflag);
+   rc |= device_create_file(&bd->pdev->dev, &dev_attr_ports_oflag);
+   rc |= device_create_file(&bd->pdev->dev, &dev_attr_ports_lflag);
+   rc |= device_create_file(&bd->pdev->dev, &dev_attr_ports_digi_flag);
+   rc |= device_create_file(&bd->pdev->dev, &dev_attr_ports_rxcount);
+   rc |= device_create_file(&bd->pdev->dev, &dev_attr_ports_txcount);
+   rc |= device_create_file(&bd->pdev->dev, &dev_attr_vpd);
+   rc |= device_create_file(&bd->pdev->dev, &dev_attr_serial_number);
if (rc)
dev_err(&bd->pdev->dev, "dgnc: sysfs device_create_file 
failed!\n");
 }
@@ -355,18 +355,18 @@ void dgnc_create_ports_sysfiles(struct dgnc_board *bd)
 /* removes all the sys files created for that port */
 void dgnc_remove_ports_sysfiles(struct dgnc_board *bd)
 {
-   device_remove_file(&(bd->pdev->dev), &dev_attr_ports_state);
-   device_remove_file(&(bd->pdev->dev), &dev_attr_ports_baud);
-   device_remove_file(&(bd->pdev->dev), &dev_attr_ports_msignals);
-   device_remove_file(&(bd->pdev->dev), &dev_attr_ports_iflag);
-   device_remove_file(&(bd->pdev->dev), &dev_attr_ports_cflag);
-   device_remove_file(&(bd->pdev->dev), &dev_attr_ports_oflag);
-   device_remove_file(&(bd->pdev->dev), &dev_attr_ports_lflag);
-   device_remove_file(&(bd->pdev->dev), &dev_attr_ports_digi_flag);
-   device_remove_file(&(bd->pdev->dev), &dev_attr_ports_rxcount);
-   device_remove_file(&(bd->pdev->dev), &dev_attr_ports_txcount);
-   device_remove_file(&(bd->pdev->dev), &dev_attr_vpd);
-   device_remove_file(&(bd->pdev->dev), &dev_attr_serial_number);
+   device_remove_file(&bd->pdev->dev, &dev_attr_ports_state);
+   device_remove_file(&bd->pdev->dev, &dev_attr_ports_baud);
+   device_remove_file(&bd->pdev->dev, &dev_attr_ports_msignals);
+   device_remove_file(&bd->pdev->dev, &dev_attr_ports_iflag);
+   device_remove_file(&bd->pdev->dev, &dev_attr_ports_cflag);
+   device_remove_file(&bd->pdev->dev, &dev_attr_ports_oflag);
+   device_remove_file(&bd->pdev->dev, &dev_attr_ports_lflag);
+   device_remove_file(&bd->pdev->dev, &dev_attr_ports_digi_flag);
+   device_remove_file(&bd->pdev->dev, &dev_attr_ports_rxcount);
+   device_remove_file(&bd->pdev->dev, &dev_attr_ports_txcount);
+   device_remove_file(&bd->pdev->dev, &dev_attr_vpd);
+   device_remove_file(&bd->pdev->dev, &dev_attr_serial_number);
 }
 

[PATCH 01/11] staging: dgnc: remove unused variables

2015-10-03 Thread Sudip Mukherjee
These variables were only assigned some values but were never used.

Signed-off-by: Sudip Mukherjee 
---
 drivers/staging/dgnc/dgnc_cls.c |  4 +---
 drivers/staging/dgnc/dgnc_tty.c | 11 ++-
 2 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index 76fe4b2..24fc28c 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -854,10 +854,8 @@ static void cls_copy_data_from_uart_to_queue(struct 
channel_t *ch)
 * Discard character if we are ignoring the error mask.
*/
if (linestatus & error_mask)  {
-   unsigned char discard;
-
linestatus = 0;
-   discard = readb(&ch->ch_cls_uart->txrx);
+   readb(&ch->ch_cls_uart->txrx);
continue;
}
 
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index fbfe79a..45f98db 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -1349,12 +1349,10 @@ static void dgnc_tty_hangup(struct tty_struct *tty)
  */
 static void dgnc_tty_close(struct tty_struct *tty, struct file *file)
 {
-   struct ktermios *ts;
struct dgnc_board *bd;
struct channel_t *ch;
struct un_t *un;
unsigned long flags;
-   int rc = 0;
 
if (!tty || tty->magic != TTY_MAGIC)
return;
@@ -1371,8 +1369,6 @@ static void dgnc_tty_close(struct tty_struct *tty, struct 
file *file)
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
return;
 
-   ts = &tty->termios;
-
spin_lock_irqsave(&ch->ch_lock, flags);
 
/*
@@ -1434,7 +1430,7 @@ static void dgnc_tty_close(struct tty_struct *tty, struct 
file *file)
/* wait for output to drain */
/* This will also return if we take an interrupt */
 
-   rc = bd->bd_ops->drain(tty, 0);
+   bd->bd_ops->drain(tty, 0);
 
dgnc_tty_flush_buffer(tty);
tty_ldisc_flush(tty);
@@ -1685,7 +1681,6 @@ static int dgnc_tty_write(struct tty_struct *tty,
struct channel_t *ch = NULL;
struct un_t *un = NULL;
int bufcount = 0, n = 0;
-   int orig_count = 0;
unsigned long flags;
ushort head;
ushort tail;
@@ -1711,7 +1706,6 @@ static int dgnc_tty_write(struct tty_struct *tty,
 * This helps to figure out if we should ask the FEP
 * to send us an event when it has more space available.
 */
-   orig_count = count;
 
spin_lock_irqsave(&ch->ch_lock, flags);
 
@@ -1979,7 +1973,6 @@ static void dgnc_tty_wait_until_sent(struct tty_struct 
*tty, int timeout)
struct dgnc_board *bd;
struct channel_t *ch;
struct un_t *un;
-   int rc;
 
if (!tty || tty->magic != TTY_MAGIC)
return;
@@ -1996,7 +1989,7 @@ static void dgnc_tty_wait_until_sent(struct tty_struct 
*tty, int timeout)
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
return;
 
-   rc = bd->bd_ops->drain(tty, 0);
+   bd->bd_ops->drain(tty, 0);
 }
 
 
-- 
1.9.1

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


[PATCH] staging: wlan-ng: prism2sta: replace memcmp with ether_addr_equal

2015-10-03 Thread Maciek Borzecki
Replace memcmp() with ether_addr_equal(). In every location where the
replacement was done, the addresses accessed are
__aligned(2). Structures accessed either stack or heap allocated, no
direct memory casts to possibly unaligned structs are used.

Involved structures:

typedef struct hfa384x_authenticateStation_data {
u8 address[ETH_ALEN];   /* 0 offset */
...
} __packed hfa384x_authenticateStation_data_t;

struct prism2sta_authlist {
unsigned int cnt;
u8 addr[WLAN_AUTH_MAX][ETH_ALEN]; /* 4 bytes offset,
 addresses start
 at u16 boundary */
u8 assoc[WLAN_AUTH_MAX];
};

struct prism2sta_accesslist {
unsigned int modify;
unsigned int cnt;
u8 addr[WLAN_ACCESS_MAX][ETH_ALEN]; /* 8 bytes offset,
   multiple of u16 */
...
u8 addr1[WLAN_ACCESS_MAX][ETH_ALEN]; /* starts at u32 boundary,
struct not packed */
};

typedef struct hfa384x_AssocStatus {
u16 assocstatus;
u8 sta_addr[ETH_ALEN];/* 2 bytes offset,
 struct is packed */
u8 old_ap_addr[ETH_ALEN]; /* 8 bytes offset */
...
} __packed hfa384x_AssocStatus_t;

The patch resolves the following checkpatch warnings:

  WARNING: Prefer ether_addr_equal() or ether_addr_equal_unaligned()
   over memcmp()

Signed-off-by: Maciek Borzecki 
---
 drivers/staging/wlan-ng/prism2sta.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wlan-ng/prism2sta.c 
b/drivers/staging/wlan-ng/prism2sta.c
index 
0329c521d17c5c0ee5baa237c81383021daefe24..2b7efe05cc8f4e30c8b43c27fccda988ad9b756e
 100644
--- a/drivers/staging/wlan-ng/prism2sta.c
+++ b/drivers/staging/wlan-ng/prism2sta.c
@@ -1483,7 +1483,7 @@ static void prism2sta_inf_assocstatus(wlandevice_t 
*wlandev,
 */
 
for (i = 0; i < hw->authlist.cnt; i++)
-   if (memcmp(rec.sta_addr, hw->authlist.addr[i], ETH_ALEN) == 0)
+   if (ether_addr_equal(rec.sta_addr, hw->authlist.addr[i]))
break;
 
if (i >= hw->authlist.cnt) {
@@ -1565,8 +1565,8 @@ static void prism2sta_inf_authreq_defer(wlandevice_t 
*wlandev,
 */
 
for (i = 0; i < hw->authlist.cnt; i++)
-   if (memcmp(rec.address, hw->authlist.addr[i],
-  ETH_ALEN) == 0) {
+   if (ether_addr_equal(rec.address,
+hw->authlist.addr[i])) {
rec.status = P80211ENUM_status_successful;
break;
}
@@ -1603,7 +1603,7 @@ static void prism2sta_inf_authreq_defer(wlandevice_t 
*wlandev,
}
 
for (i = 0; i < cnt; i++, addr += ETH_ALEN)
-   if (memcmp(rec.address, addr, ETH_ALEN) == 0) {
+   if (ether_addr_equal(rec.address, addr)) {
rec.status = P80211ENUM_status_successful;
break;
}
@@ -1633,7 +1633,7 @@ static void prism2sta_inf_authreq_defer(wlandevice_t 
*wlandev,
rec.status = P80211ENUM_status_successful;
 
for (i = 0; i < cnt; i++, addr += ETH_ALEN)
-   if (memcmp(rec.address, addr, ETH_ALEN) == 0) {
+   if (ether_addr_equal(rec.address, addr)) {
rec.status = P80211ENUM_status_unspec_failure;
break;
}
@@ -1654,8 +1654,8 @@ static void prism2sta_inf_authreq_defer(wlandevice_t 
*wlandev,
 
if (rec.status == P80211ENUM_status_successful) {
for (i = 0; i < hw->authlist.cnt; i++)
-   if (memcmp(rec.address, hw->authlist.addr[i], ETH_ALEN)
-   == 0)
+   if (ether_addr_equal(rec.address,
+hw->authlist.addr[i]))
break;
 
if (i >= hw->authlist.cnt) {
-- 
2.6.0

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


[PATCH] staging: lustre: lustre: llite: Added a blank line

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

WARNING: Missing a blank line after declarations

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

diff --git a/drivers/staging/lustre/lustre/llite/llite_capa.c 
b/drivers/staging/lustre/lustre/llite/llite_capa.c
index aec9a44..a626871 100644
--- a/drivers/staging/lustre/lustre/llite/llite_capa.c
+++ b/drivers/staging/lustre/lustre/llite/llite_capa.c
@@ -140,6 +140,7 @@ static void sort_add_capa(struct obd_capa *ocapa, struct 
list_head *head)
 static inline int obd_capa_open_count(struct obd_capa *oc)
 {
struct ll_inode_info *lli = ll_i2info(oc->u.cli.inode);
+
return atomic_read(&lli->lli_open_count);
 }
 
-- 
1.9.1

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


Re: [PATCH] Add driver for Bosto 14WA graphics tablet

2015-10-03 Thread Greg KH
On Sat, Oct 03, 2015 at 09:41:40PM +1300, Leslie Viljoen wrote:
> Add support for the Bosto 14WA graphics tablet. This is originally based
> off the hanwang.c tablet driver since the chip is similar. Unfortunately
> the usbhid driver grabs the tablet first so that has to be unbound for
> this driver to work.

If you need to "unbind" the hid driver, also include as part of your
patch a new hid driver quirk entry to prevent the device from ever being
bound to the hid driver, as that's what it is there for.

Also, be sure to cc the proper mailing list (i.e. linux-input), for
stuff like this.

thanks,

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


Re: [PATCH] Add driver for Bosto 14WA graphics tablet

2015-10-03 Thread Leslie Viljoen
Please disregard this patch for now - I made a bunch of style fixes
and I think I've killed it. I'll have to go over it and find what I've
broken. Sorry for the noise.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [patch] iio: accel: sca3000: memory corruption in sca3000_read_first_n_hw_rb()

2015-10-03 Thread Jonathan Cameron
On 15/08/15 21:05, Jonathan Cameron wrote:
> On 08/08/15 20:16, Dan Carpenter wrote:
>> "num_read" is in byte units but we are write u16s so we end up write
>> twice as much as intended.
>>
>> Signed-off-by: Dan Carpenter 
> Hi Dan,
> 
> This is fine. Given it's an old bug, Greg is not going to take this
> sort of fix until after the merge window.   I won't be doing another
> pull to him to go in during the merge window.  Hence fastest route
> will be as a fix post 4.3-rc1.
> 
> Give me a poke if I haven't picked it up and sent it on by rc2 or so.
> 
> Thanks and good find.
> 
> Jonathan
Nearly forgot this one!

Anyhow, applied to the fixes-togreg branch of iio.git and marked for stable.

Jonathan
>>
>> diff --git a/drivers/staging/iio/accel/sca3000_ring.c 
>> b/drivers/staging/iio/accel/sca3000_ring.c
>> index 23685e7..bd2c69f 100644
>> --- a/drivers/staging/iio/accel/sca3000_ring.c
>> +++ b/drivers/staging/iio/accel/sca3000_ring.c
>> @@ -116,7 +116,7 @@ static int sca3000_read_first_n_hw_rb(struct iio_buffer 
>> *r,
>>  if (ret)
>>  goto error_ret;
>>  
>> -for (i = 0; i < num_read; i++)
>> +for (i = 0; i < num_read / sizeof(u16); i++)
>>  *(((u16 *)rx) + i) = be16_to_cpup((__be16 *)rx + i);
>>  
>>  if (copy_to_user(buf, rx, num_read))
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
>> the body of a message to majord...@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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


[PATCH 1/2] drivers: staging: wilc1000: Move spin lock to the start of critical section

2015-10-03 Thread Chandra S Gorentla
The spin_lock_irqsave is moved to just beginning of critical section.
This change moves a couple of return statements out of the lock.

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

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

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


[PATCH 2/2] drivers: staging: wilc1000: Call kfree only for error cases

2015-10-03 Thread Chandra S Gorentla
 - kfree is being called for the members of the queue without
   de-queuing them; they are just inserted within this function;
   they are supposed to be de-queued and freed in a function
   for receiving the queue items
 - goto statements are removed
 - After kfree correction, there is no need for target block
   of goto statement; hence it is removed

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

diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
b/drivers/staging/wilc1000/wilc_msgqueue.c
index 284a3f5..eae90be 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -56,32 +56,30 @@ int wilc_mq_destroy(WILC_MsgQueueHandle *pHandle)
 int wilc_mq_send(WILC_MsgQueueHandle *pHandle,
 const void *pvSendBuffer, u32 u32SendBufferSize)
 {
-   int result = 0;
unsigned long flags;
Message *pstrMessage = NULL;
 
if ((!pHandle) || (u32SendBufferSize == 0) || (!pvSendBuffer)) {
PRINT_ER("pHandle or pvSendBuffer is null\n");
-   result = -EFAULT;
-   goto ERRORHANDLER;
+   return -EFAULT;
}
 
if (pHandle->bExiting) {
PRINT_ER("pHandle fail\n");
-   result = -EFAULT;
-   goto ERRORHANDLER;
+   return -EFAULT;
}
 
/* construct a new message */
pstrMessage = kmalloc(sizeof(Message), GFP_ATOMIC);
if (!pstrMessage)
return -ENOMEM;
+
pstrMessage->u32Length = u32SendBufferSize;
pstrMessage->pstrNext = NULL;
pstrMessage->pvBuffer = kmalloc(u32SendBufferSize, GFP_ATOMIC);
if (!pstrMessage->pvBuffer) {
-   result = -ENOMEM;
-   goto ERRORHANDLER;
+   kfree(pstrMessage);
+   return -ENOMEM;
}
memcpy(pstrMessage->pvBuffer, pvSendBuffer, u32SendBufferSize);
 
@@ -102,15 +100,7 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle,
spin_unlock_irqrestore(&pHandle->strCriticalSection, flags);
 
up(&pHandle->hSem);
-
-ERRORHANDLER:
-   /* error occured, free any allocations */
-   if (pstrMessage) {
-   kfree(pstrMessage->pvBuffer);
-   kfree(pstrMessage);
-   }
-
-   return result;
+   return 0;
 }
 
 /*!
-- 
2.1.4

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


[PATCH] Add driver for Bosto 14WA graphics tablet

2015-10-03 Thread Leslie Viljoen
Add support for the Bosto 14WA graphics tablet. This is originally based
off the hanwang.c tablet driver since the chip is similar. Unfortunately
the usbhid driver grabs the tablet first so that has to be unbound for
this driver to work.

Signed-off-by: Leslie Viljoen 

---
 drivers/input/tablet/bosto_14wa.c | 551 ++
 1 file changed, 551 insertions(+)
 create mode 100644 drivers/input/tablet/bosto_14wa.c

diff --git a/drivers/input/tablet/bosto_14wa.c
b/drivers/input/tablet/bosto_14wa.c
new file mode 100644
index 000..d0cdbce
--- /dev/null
+++ b/drivers/input/tablet/bosto_14wa.c
@@ -0,0 +1,551 @@
+/*
+ *  USB Bosto tablet support
+ *
+ *  Original Copyright (c) 2010 Xing Wei 
+ *
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DRIVER_DESC "USB Bosto(2nd Gen) tablet driver"
+#define DRIVER_LICENSE  "GPL"
+
+MODULE_AUTHOR("Xing Wei ");
+MODULE_AUTHOR("Aidan Walton ");
+MODULE_AUTHOR("Leslie Viljoen ");
+MODULE_AUTHOR("Tomasz Flis ");
+
+MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_LICENSE(DRIVER_LICENSE);
+
+#define USB_VENDOR_ID_HANWANG  0x0b57
+#define USB_PRODUCT_BOSTO14WA  0x9018
+
+#define BOSTO_TABLET_INT_CLASS 0x0003
+#define BOSTO_TABLET_INT_SUB_CLASS 0x0001
+#define BOSTO_TABLET_INT_PROTOCOL  0x0002
+
+/* Delay between TOOL_IN event and first reported pressure > 0 (in ms).
+ * Used to suppress settle time for pen ABS positions.
+ */
+#define PEN_WRITE_DELAY  230
+#define PKGLEN_MAX10
+#define MAX_DEVICE_NAME   64
+#define MAX_PHYS_ADDRESS  32
+#define NO_ERROR   0
+
+/* device IDs */
+#define STYLUS_DEVICE_ID 0x02
+#define TOUCH_DEVICE_ID  0x03
+#define CURSOR_DEVICE_ID 0x06
+#define ERASER_DEVICE_ID 0x0A
+#define PAD_DEVICE_ID0x0F
+
+enum bosto_tablet_type {
+ BOSTO_14WA
+};
+
+struct bosto {
+ unsigned char *data;
+ dma_addr_t data_dma;
+ struct input_dev *stylus;
+ struct input_dev *eraser;
+ struct usb_device *usbdev;
+ struct urb *urb0;
+ struct urb *urb1;
+ const struct bosto_features *features;
+ unsigned int current_tool;
+ unsigned int current_id;
+ char stylus_name[MAX_DEVICE_NAME];
+ char eraser_name[MAX_DEVICE_NAME];
+ char phys[MAX_PHYS_ADDRESS];
+};
+
+struct bosto_features {
+ unsigned short pid;
+ char *name;
+ enum bosto_tablet_type type;
+ int pkg_len;
+ int max_x;
+ int max_y;
+ int max_tilt_x;
+ int max_tilt_y;
+ int max_pressure;
+};
+
+static const struct bosto_features features_array[] = {
+ { USB_PRODUCT_BOSTO14WA, "Bosto Kingtee 14WA", BOSTO_14WA, PKGLEN_MAX,
+ 0x27de, 0x1cfe, 0x3f, 0x7f, 2048 },
+};
+
+static const int hw_eventtypes[] = {
+ EV_KEY, EV_ABS, EV_MSC,
+};
+
+static const int hw_absevents[] = {
+ ABS_X, ABS_Y, ABS_PRESSURE, ABS_MISC
+};
+
+static const int hw_btnevents[] = {
+ BTN_DIGI, BTN_TOUCH, BTN_STYLUS, BTN_STYLUS2, BTN_TOOL_PEN,
+ BTN_TOOL_BRUSH, BTN_TOOL_RUBBER, BTN_TOOL_PENCIL, BTN_TOOL_AIRBRUSH,
+ BTN_TOOL_FINGER, BTN_TOOL_MOUSE
+};
+
+static const int hw_mscevents[] = {
+ MSC_SERIAL,
+};
+
+static struct input_dev *get_current_input(struct bosto *bosto)
+{
+ return (bosto->current_id == ERASER_DEVICE_ID) ? bosto->eraser :
bosto->stylus;
+}
+
+static void bosto_tool_out(struct bosto *bosto)
+{
+ struct input_dev *input_dev;
+
+ input_dev = get_current_input(bosto);
+ input_report_key(input_dev, bosto->current_tool, 0);
+ bosto->current_id = 0;
+}
+
+static void bosto_tool_in(struct bosto *bosto, unsigned long *stamp,
u8 pen_end)
+{
+ unsigned int id, tool;
+ struct input_dev *input_dev;
+
+ /* Time stamp the 'TOOL IN' event and add delay. */
+ *stamp = jiffies + PEN_WRITE_DELAY * HZ / 1000;
+
+ switch (pen_end & 0xf0) {
+ /* Stylus Tip in prox */
+ case 0x20:
+ id = STYLUS_DEVICE_ID;
+ tool = BTN_TOOL_PEN;
+ break;
+
+ /* Stylus Eraser in prox */
+ case 0xa0:
+ id = ERASER_DEVICE_ID;
+ tool = BTN_TOOL_RUBBER;
+ break;
+
+ default:
+ id = 0;
+ tool = BTN_TOOL_PEN;
+ break;
+ }
+
+ bosto->current_id = id;
+ bosto->current_tool = tool;
+ input_dev = get_current_input(bosto);
+ input_report_abs(input_dev, ABS_MISC, id);
+ input_report_key(input_dev, tool, 1);
+}
+
+static void bosto_pen_float(struct bosto *bosto, u16 *p, u16 *x, u16 *y,
+ u8 *data)
+{
+ struct input_dev *input_dev;
+ *x = (data[1] << 8) | data[2];  /* Set x ABS */
+ *y = (data[3] << 8) | data[4];  /* Set y ABS */
+ *p = 0;
+
+ input_dev = get_current_input(bosto);
+ input_report_key(input_dev, bosto->current_tool, 1);
+