[PATCH] Staging: ks7010: Fixed {} brace warnings for single statement blocks.

2016-11-24 Thread Yamanappagouda Patil
Fixed checkpatch.pl warnings related to {} brace warnings for single
statement blocks.

Signed-off-by: Yamanappagouda Patil 
---
 drivers/staging/ks7010/ks_wlan_net.c | 172 ++-
 1 file changed, 66 insertions(+), 106 deletions(-)

diff --git a/drivers/staging/ks7010/ks_wlan_net.c 
b/drivers/staging/ks7010/ks_wlan_net.c
index 3c58f84..43bba52 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -1290,9 +1290,8 @@ static int ks_wlan_get_power(struct net_device *dev,
struct ks_wlan_private *priv =
(struct ks_wlan_private *)netdev_priv(dev);
 
-   if (priv->sleep_mode == SLP_SLEEP) {
+   if (priv->sleep_mode == SLP_SLEEP)
return -EPERM;
-   }
/* for SLEEP MODE */
if (priv->reg.powermgt > 0)
vwrq->disabled = 0;
@@ -1311,9 +1310,8 @@ static int ks_wlan_get_iwstats(struct net_device *dev,
struct ks_wlan_private *priv =
(struct ks_wlan_private *)netdev_priv(dev);
 
-   if (priv->sleep_mode == SLP_SLEEP) {
+   if (priv->sleep_mode == SLP_SLEEP)
return -EPERM;
-   }
/* for SLEEP MODE */
vwrq->qual = 0; /* not supported */
vwrq->level = priv->wstats.qual.level;
@@ -1361,9 +1359,8 @@ static int ks_wlan_get_aplist(struct net_device *dev,
 
int i;
 
-   if (priv->sleep_mode == SLP_SLEEP) {
+   if (priv->sleep_mode == SLP_SLEEP)
return -EPERM;
-   }
/* for SLEEP MODE */
for (i = 0; i < priv->aplist.size; i++) {
memcpy(address[i].sa_data, &(priv->aplist.ap[i].bssid[0]),
@@ -1395,9 +1392,8 @@ static int ks_wlan_set_scan(struct net_device *dev,
struct iw_scan_req *req = NULL;
DPRINTK(2, "\n");
 
-   if (priv->sleep_mode == SLP_SLEEP) {
+   if (priv->sleep_mode == SLP_SLEEP)
return -EPERM;
-   }
 
/* for SLEEP MODE */
/* specified SSID SCAN */
@@ -1589,9 +1585,8 @@ static int ks_wlan_get_scan(struct net_device *dev,
char *current_ev = extra;
DPRINTK(2, "\n");
 
-   if (priv->sleep_mode == SLP_SLEEP) {
+   if (priv->sleep_mode == SLP_SLEEP)
return -EPERM;
-   }
/* for SLEEP MODE */
if (priv->sme_i.sme_flag & SME_AP_SCAN) {
DPRINTK(2, "flag AP_SCAN\n");
@@ -1664,9 +1659,8 @@ static int ks_wlan_set_genie(struct net_device *dev,
 
DPRINTK(2, "\n");
 
-   if (priv->sleep_mode == SLP_SLEEP) {
+   if (priv->sleep_mode == SLP_SLEEP)
return -EPERM;
-   }
/* for SLEEP MODE */
return 0;
 //  return -EOPNOTSUPP;
@@ -1685,26 +1679,23 @@ static int ks_wlan_set_auth_mode(struct net_device *dev,
 
DPRINTK(2, "index=%d:value=%08X\n", index, value);
 
-   if (priv->sleep_mode == SLP_SLEEP) {
+   if (priv->sleep_mode == SLP_SLEEP)
return -EPERM;
-   }
/* for SLEEP MODE */
switch (index) {
case IW_AUTH_WPA_VERSION:   /* 0 */
switch (value) {
case IW_AUTH_WPA_VERSION_DISABLED:
priv->wpa.version = value;
-   if (priv->wpa.rsn_enabled) {
+   if (priv->wpa.rsn_enabled)
priv->wpa.rsn_enabled = 0;
-   }
priv->need_commit |= SME_RSN;
break;
case IW_AUTH_WPA_VERSION_WPA:
case IW_AUTH_WPA_VERSION_WPA2:
priv->wpa.version = value;
-   if (!(priv->wpa.rsn_enabled)) {
+   if (!(priv->wpa.rsn_enabled))
priv->wpa.rsn_enabled = 1;
-   }
priv->need_commit |= SME_RSN;
break;
default:
@@ -1823,9 +1814,8 @@ static int ks_wlan_get_auth_mode(struct net_device *dev,
int index = (vwrq->flags & IW_AUTH_INDEX);
DPRINTK(2, "index=%d\n", index);
 
-   if (priv->sleep_mode == SLP_SLEEP) {
+   if (priv->sleep_mode == SLP_SLEEP)
return -EPERM;
-   }
 
/* for SLEEP MODE */
/*  WPA (not used ?? wpa_supplicant) */
@@ -1875,18 +1865,17 @@ static int ks_wlan_set_encode_ext(struct net_device 
*dev,
DPRINTK(2, "flags=%04X:: ext_flags=%08X\n", dwrq->flags,
enc->ext_flags);
 
-   if (priv->sleep_mode == SLP_SLEEP) {
+   if (priv->sleep_mode == SLP_SLEEP)
return -EPERM;
-   }
+
/* for SLEEP MODE */
if (index < 1 || index > 4)
return -EINVAL;
else
index--;
 
-   if (dwrq->flags & IW_ENCODE_DISABLED) {
+   if (dwrq->flags & IW_ENCODE_DISABLED)
priv->wpa.key[index].key_len = 0;
-   }
 
if (enc) {
priv->wpa.key[index].ext_flags = enc

[PATCH] staging: ks7010: fixed 'space prohibited after that *' erros.

2016-11-24 Thread Yamanappagouda Patil
Fixed checkpatch.pl errors related to "space prohibited after that '*'
or '&'" in ks_wlan_net.c file.

Signed-off-by: Yamanappagouda Patil 
---
 drivers/staging/ks7010/ks_wlan_net.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/ks7010/ks_wlan_net.c 
b/drivers/staging/ks7010/ks_wlan_net.c
index 43bba52..220364b 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -389,7 +389,7 @@ static int ks_wlan_set_wap(struct net_device *dev, struct 
iw_request_info *info,
/* for SLEEP MODE */
if (priv->reg.operation_mode == MODE_ADHOC ||
priv->reg.operation_mode == MODE_INFRASTRUCTURE) {
-   memcpy(priv->reg.bssid, (u8 *) & ap_addr->sa_data, ETH_ALEN);
+   memcpy(priv->reg.bssid, (u8 *) &ap_addr->sa_data, ETH_ALEN);
 
if (is_valid_ether_addr((u8 *) priv->reg.bssid))
priv->need_commit |= SME_MODE_SET;
@@ -2681,7 +2681,7 @@ static int ks_wlan_set_phy_information_timer(struct 
net_device *dev,
return -EPERM;
/* for SLEEP MODE */
if (*uwrq >= 0 && *uwrq <= 0x)  /* 0-65535 */
-   priv->reg.phy_info_timer = (uint16_t) * uwrq;
+   priv->reg.phy_info_timer = (uint16_t) *uwrq;
else
return -EINVAL;
 
@@ -2818,7 +2818,7 @@ static int ks_wlan_set_tx_gain(struct net_device *dev,
return -EPERM;
/* for SLEEP MODE */
if (*uwrq >= 0 && *uwrq <= 0xFF)/* 0-255 */
-   priv->gain.TxGain = (uint8_t) * uwrq;
+   priv->gain.TxGain = (uint8_t) *uwrq;
else
return -EINVAL;
 
@@ -2861,7 +2861,7 @@ static int ks_wlan_set_rx_gain(struct net_device *dev,
return -EPERM;
/* for SLEEP MODE */
if (*uwrq >= 0 && *uwrq <= 0xFF)/* 0-255 */
-   priv->gain.RxGain = (uint8_t) * uwrq;
+   priv->gain.RxGain = (uint8_t) *uwrq;
else
return -EINVAL;
 
@@ -2904,7 +2904,7 @@ static int ks_wlan_set_region(struct net_device *dev,
return -EPERM;
/* for SLEEP MODE */
if (*uwrq >= 0x9 && *uwrq <= 0xF)   /* 0x9-0xf */
-   priv->region = (uint8_t) * uwrq;
+   priv->region = (uint8_t) *uwrq;
else
return -EINVAL;
 
-- 
2.1.4

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


[patch] staging: lustre: lnet: memory corruption in selftest

2016-11-24 Thread Dan Carpenter
We want sizeof(struct lstcon_node) but instead we're getting the sizeof
a pointer.

Fixes: 8d78f0f2ba76 ("staging: lustre: lnet: cleanup some of the > 80 line 
issues")
Signed-off-by: Dan Carpenter 

diff --git a/drivers/staging/lustre/lnet/selftest/console.c 
b/drivers/staging/lustre/lnet/selftest/console.c
index f2d11fa..f750b9c 100644
--- a/drivers/staging/lustre/lnet/selftest/console.c
+++ b/drivers/staging/lustre/lnet/selftest/console.c
@@ -86,7 +86,7 @@ lstcon_node_find(lnet_process_id_t id, struct lstcon_node 
**ndpp, int create)
if (!create)
return -ENOENT;
 
-   LIBCFS_ALLOC(*ndpp, sizeof(*ndpp) + sizeof(*ndl));
+   LIBCFS_ALLOC(*ndpp, sizeof(**ndpp) + sizeof(*ndl));
if (!*ndpp)
return -ENOMEM;
 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[patch] staging: lustre/ptlrpc: small leak on allocation failure

2016-11-24 Thread Dan Carpenter
We should free "desc" before returning NULL.

Signed-off-by: Dan Carpenter 

diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c 
b/drivers/staging/lustre/lustre/ptlrpc/client.c
index ac959ef..8047413 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/client.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
@@ -128,12 +128,12 @@ struct ptlrpc_bulk_desc *ptlrpc_new_bulk(unsigned int 
nfrags,
GET_KIOV(desc) = kcalloc(nfrags, sizeof(*GET_KIOV(desc)),
 GFP_NOFS);
if (!GET_KIOV(desc))
-   goto out;
+   goto free_desc;
} else {
GET_KVEC(desc) = kcalloc(nfrags, sizeof(*GET_KVEC(desc)),
 GFP_NOFS);
if (!GET_KVEC(desc))
-   goto out;
+   goto free_desc;
}
 
spin_lock_init(&desc->bd_lock);
@@ -154,7 +154,8 @@ struct ptlrpc_bulk_desc *ptlrpc_new_bulk(unsigned int 
nfrags,
LNetInvalidateHandle(&desc->bd_mds[i]);
 
return desc;
-out:
+free_desc:
+   kfree(desc);
return NULL;
 }
 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: ks7010: fixed 'space prohibited after that *' erros.

2016-11-24 Thread Joe Perches
On Thu, 2016-11-24 at 14:59 +0530, Yamanappagouda Patil wrote:
> Fixed checkpatch.pl errors related to "space prohibited after that '*'
> or '&'" in ks_wlan_net.c file.

trivia:

> diff --git a/drivers/staging/ks7010/ks_wlan_net.c 
> b/drivers/staging/ks7010/ks_wlan_net.c
[]
> @@ -389,7 +389,7 @@ static int ks_wlan_set_wap(struct net_device *dev, struct 
> iw_request_info *info,
>   /* for SLEEP MODE */
>   if (priv->reg.operation_mode == MODE_ADHOC ||
>   priv->reg.operation_mode == MODE_INFRASTRUCTURE) {
> - memcpy(priv->reg.bssid, (u8 *) & ap_addr->sa_data, ETH_ALEN);
> + memcpy(priv->reg.bssid, (u8 *) &ap_addr->sa_data, ETH_ALEN);

You could remove the useless cast to (u8 *) too
 
>   if (is_valid_ether_addr((u8 *) priv->reg.bssid))
>   priv->need_commit |= SME_MODE_SET;
> @@ -2681,7 +2681,7 @@ static int ks_wlan_set_phy_information_timer(struct 
> net_device *dev,
>   return -EPERM;
>   /* for SLEEP MODE */
>   if (*uwrq >= 0 && *uwrq <= 0x)  /* 0-65535 */
> - priv->reg.phy_info_timer = (uint16_t) * uwrq;
> + priv->reg.phy_info_timer = (uint16_t) *uwrq;

These could be written without the space after the casts

priv->reg.phy_info_timer = (uint16_t)*uwrq;

etc...

>   else
>   return -EINVAL;
> 

These tests could be reversed to reduce indentation for the
expected cases

if (*uwrq < 0 || *uwrq > 0x)etc
return -EINVAL;
priv->reg.phy_info_timer = (uint16_t)*uwrq;

etc...

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


Aw: Re: [net-next 1/2] net: ethernet: slicoss: add slicoss gigabit ethernet driver

2016-11-24 Thread Lino Sanfilippo
Hi Andrew, Hi Florian

> Gesendet: Dienstag, 15. November 2016 um 23:34 Uhr
> Von: "Lino Sanfilippo" 
> An: "Andrew Lunn" 
> Cc: "Florian Fainelli" , da...@davemloft.net, 
> char...@alacritech.com, lio...@gmail.com, gre...@linuxfoundation.org, 
> de...@driverdev.osuosl.org, linux-ker...@vger.kernel.org, 
> net...@vger.kernel.org
> Betreff: Re: [net-next 1/2] net: ethernet: slicoss: add slicoss gigabit 
> ethernet driver
>
> On 15.11.2016 22:59, Andrew Lunn wrote:
> >> The link state is retrieved by a command to the application processor that 
> >> is running 
> >> on the network card. Also the register to set the phy configuration is 
> >> write-only, so
> >> it is not even possible to do the usual mdio bit-banging in the Phy read() 
> >> and write()
> >> functions (however there seems to be another application processor command 
> >> reserved 
> >> for retrieving the PHY settings, but I have not tried it yet). 
> > 
> >>> + val = MII_BMCR << 16 | SLIC_PCR_AUTONEG |
> >>> +  SLIC_PCR_AUTONEG_RST;
> >>> + slic_write(sdev, SLIC_REG_WPHY, val);
> > 
> > This actually looks a lot like an MDIO write operation. The upper 16
> > bits are the register, and the lower 16 bits are the data. What you
> > don't have is the address. But maybe it is limited to one address.
> > 
> > If the processor command reserved for read works in a similar way, you
> > have enough to do an MDIO bus.
> > 
> 
> Ok, I will give it a try. Reading values via the application processor
> is a bit awkward though, since it requires an address to a dma area as part of
> the command and then the AP informs the driver via irq that the dma memory 
> has 
> been written. So probably the irq handler will have to set some flag and
> the mdio_read() function will have to poll for that flag in place of doing 
> bit-banging a register. 
> 
> > If you can get the read working look at registers 2 and 3. Compare
> > what you get with the values at the end of marvell.c.
> > 
> 
> Will do, thank you!
> 

unfortunately I was not able to figure out how to read the phy. My hope was to 
find
a hidden register that I can use to request the phy status from the cards 
utility processor.
I actually found two more registers that seem to be reserved for the 
communication
with the UP. At least they cause the UPR irq to be fired but there is no data 
written to
the provided dma address. I assume that they are not meant to be used for the 
this purpose.
So I am afraid I am not able to use the phy API in this driver for now. 
However I will send a v2 of the driver shortly that will include the other
changes suggested by Andrew along with some further small improvements.
Thanks for your help so far!

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


Re: [PATCH 2/2] staging: slicoss: replace UPDATE_STATS_GB macro into an inline function

2016-11-24 Thread Sergio Paracuellos
On Wed, Nov 23, 2016 at 11:32 PM, Markus Böhme
 wrote:
> On 11/23/2016 08:00 PM, Markus Böhme wrote:
>> On 11/23/2016 07:10 PM, Sergio Paracuellos wrote:
>>> This patch replaces UPDATE_STATS_GB macro in slic.h header file
>>> into an inline function. This provides type safety and readability.
>>>
>>> Signed-off-by: Sergio Paracuellos 
>>> ---
>>>  drivers/staging/slicoss/slic.h|  6 ++---
>>>  drivers/staging/slicoss/slicoss.c | 56 
>>> ---
>>>  2 files changed, 32 insertions(+), 30 deletions(-)
>>>
>>> diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
>>> index 2c05868..b19ddc9 100644
>>> --- a/drivers/staging/slicoss/slic.h
>>> +++ b/drivers/staging/slicoss/slic.h
>>> @@ -548,9 +548,9 @@ static inline void slic_flush_write(struct adapter 
>>> *adapter)
>>>  ioread32(adapter->regs + SLIC_REG_HOSTID);
>>>  }
>>>
>>> -#define UPDATE_STATS_GB(largestat, newstat, oldstat) \
>>> -{\
>>> -(largestat) += ((newstat) - (oldstat));  \
>>> +static inline u64 update_stats_gb(const u64 newstat, const u64 oldstat)
>>> +{
>>> +return (newstat - oldstat);
>>>  }
>>>
>>
>> I suggest dropping the parentheses here. They are unnecessary and likely
>> to lead to a cleanup patch.
>>
>
> Giving it a second thought, perhaps one should do without this
> macro/function and just inline the calculation. IMO this would improve
> readability even more.

I see. Ok, I'll remove this inline function and macro and send a V2
patchset with just the calculation inlined.

Thanks,

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


[PATCH v2 0/2] staging: slicoss: minor changes to clean some code

2016-11-24 Thread Sergio Paracuellos
This patchset clean some code in slicoss driver:
* Removes not used macro.
* Remove a macro and just inline code.

Changes in v2:
* Remove inline function into inline code.


Sergio Paracuellos (2):
  staging: slicoss: remove not used UPDATE_STATS macro
  staging: slicoss: remove UPDATE_STATS_GB macro and inline code

 drivers/staging/slicoss/slic.h| 13 --
 drivers/staging/slicoss/slicoss.c | 52 +++
 2 files changed, 25 insertions(+), 40 deletions(-)

-- 
1.9.1

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


[PATCH v2 1/2] staging: slicoss: remove not used UPDATE_STATS macro

2016-11-24 Thread Sergio Paracuellos
This patch remove UPDATE_STATS macro from
header slic.h which is not being used.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/slicoss/slic.h | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
index 1f6562c..2c05868 100644
--- a/drivers/staging/slicoss/slic.h
+++ b/drivers/staging/slicoss/slic.h
@@ -548,14 +548,6 @@ static inline void slic_flush_write(struct adapter 
*adapter)
ioread32(adapter->regs + SLIC_REG_HOSTID);
 }
 
-#define UPDATE_STATS(largestat, newstat, oldstat)\
-{\
-   if ((newstat) < (oldstat))   \
-   (largestat) += ((newstat) + (0x - oldstat + 1)); \
-   else \
-   (largestat) += ((newstat) - (oldstat));  \
-}
-
 #define UPDATE_STATS_GB(largestat, newstat, oldstat) \
 {\
(largestat) += ((newstat) - (oldstat));  \
-- 
1.9.1

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


[PATCH v2 2/2] staging: slicoss: remove UPDATE_STATS_GB macro and inline code

2016-11-24 Thread Sergio Paracuellos
This patch removes UPDATE_STATS_GB macro in slic.h header file
and just inline code. This improve readability.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/slicoss/slic.h|  5 
 drivers/staging/slicoss/slicoss.c | 52 +++
 2 files changed, 25 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
index 2c05868..2893bdf 100644
--- a/drivers/staging/slicoss/slic.h
+++ b/drivers/staging/slicoss/slic.h
@@ -548,11 +548,6 @@ static inline void slic_flush_write(struct adapter 
*adapter)
ioread32(adapter->regs + SLIC_REG_HOSTID);
 }
 
-#define UPDATE_STATS_GB(largestat, newstat, oldstat) \
-{\
-   (largestat) += ((newstat) - (oldstat));  \
-}
-
 #if BITS_PER_LONG == 64
 #define   SLIC_GET_ADDR_LOW(_addr)  (u32)((u64)(_addr) & \
0x)
diff --git a/drivers/staging/slicoss/slicoss.c 
b/drivers/staging/slicoss/slicoss.c
index b6ec0a1..ffc7c45 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -1014,45 +1014,43 @@ static void slic_upr_request_complete(struct adapter 
*adapter, u32 isr)
break;
}
 
-   UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, stats->xmit_tcp_segs,
-   old->xmit_tcp_segs);
+   stst->tcp.xmit_tcp_segs =
+   stats->xmit_tcp_segs - old->xmit_tcp_segs;
 
-   UPDATE_STATS_GB(stst->tcp.xmit_tcp_bytes, stats->xmit_tcp_bytes,
-   old->xmit_tcp_bytes);
+   stst->tcp.xmit_tcp_bytes =
+   stats->xmit_tcp_bytes - old->xmit_tcp_bytes;
 
-   UPDATE_STATS_GB(stst->tcp.rcv_tcp_segs, stats->rcv_tcp_segs,
-   old->rcv_tcp_segs);
+   stst->tcp.rcv_tcp_segs =
+   stats->rcv_tcp_segs - old->rcv_tcp_segs;
 
-   UPDATE_STATS_GB(stst->tcp.rcv_tcp_bytes, stats->rcv_tcp_bytes,
-   old->rcv_tcp_bytes);
+   stst->tcp.rcv_tcp_bytes =
+   stats->rcv_tcp_bytes - old->rcv_tcp_bytes;
 
-   UPDATE_STATS_GB(stst->iface.xmt_bytes, stats->xmit_bytes,
-   old->xmit_bytes);
+   stst->iface.xmt_bytes =
+   stats->xmit_bytes - old->xmit_bytes;
 
-   UPDATE_STATS_GB(stst->iface.xmt_ucast, stats->xmit_unicasts,
-   old->xmit_unicasts);
+   stst->iface.xmt_ucast =
+   stats->xmit_unicasts - old->xmit_unicasts;
 
-   UPDATE_STATS_GB(stst->iface.rcv_bytes, stats->rcv_bytes,
-   old->rcv_bytes);
+   stst->iface.rcv_bytes =
+   stats->rcv_bytes - old->rcv_bytes;
 
-   UPDATE_STATS_GB(stst->iface.rcv_ucast, stats->rcv_unicasts,
-   old->rcv_unicasts);
+   stst->iface.rcv_ucast =
+   stats->rcv_unicasts - old->rcv_unicasts;
 
-   UPDATE_STATS_GB(stst->iface.xmt_errors, stats->xmit_collisions,
-   old->xmit_collisions);
+   stst->iface.xmt_errors =
+   stats->xmit_collisions - old->xmit_collisions;
 
-   UPDATE_STATS_GB(stst->iface.xmt_errors,
-   stats->xmit_excess_collisions,
-   old->xmit_excess_collisions);
+   stst->iface.xmt_errors = stats->xmit_excess_collisions -
+   old->xmit_excess_collisions;
 
-   UPDATE_STATS_GB(stst->iface.xmt_errors, stats->xmit_other_error,
-   old->xmit_other_error);
+   stst->iface.xmt_errors =
+   stats->xmit_other_error - old->xmit_other_error;
 
-   UPDATE_STATS_GB(stst->iface.rcv_errors, stats->rcv_other_error,
-   old->rcv_other_error);
+   stst->iface.rcv_errors =
+   stats->rcv_other_error - old->rcv_other_error;
 
-   UPDATE_STATS_GB(stst->iface.rcv_discards, stats->rcv_drops,
-   old->rcv_drops);
+   stst->iface.rcv_discards = stats->rcv_drops - old->rcv_drops;
 
if (stats->rcv_drops > old->rcv_drops)
adapter->rcv_drops += (stats->rcv_drops -
-- 
1.9.1

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


Re: [PATCH v2 2/2] staging: slicoss: remove UPDATE_STATS_GB macro and inline code

2016-11-24 Thread Markus Böhme
On 11/24/2016 08:21 PM, Sergio Paracuellos wrote:
> This patch removes UPDATE_STATS_GB macro in slic.h header file
> and just inline code. This improve readability.
> 
> Signed-off-by: Sergio Paracuellos 
> ---
>  drivers/staging/slicoss/slic.h|  5 
>  drivers/staging/slicoss/slicoss.c | 52 
> +++
>  2 files changed, 25 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
> index 2c05868..2893bdf 100644
> --- a/drivers/staging/slicoss/slic.h
> +++ b/drivers/staging/slicoss/slic.h
> @@ -548,11 +548,6 @@ static inline void slic_flush_write(struct adapter 
> *adapter)
>   ioread32(adapter->regs + SLIC_REG_HOSTID);
>  }
>  
> -#define UPDATE_STATS_GB(largestat, newstat, oldstat) \
> -{\
> - (largestat) += ((newstat) - (oldstat));  \
> -}
> -
>  #if BITS_PER_LONG == 64
>  #define   SLIC_GET_ADDR_LOW(_addr)  (u32)((u64)(_addr) & \
>   0x)
> diff --git a/drivers/staging/slicoss/slicoss.c 
> b/drivers/staging/slicoss/slicoss.c
> index b6ec0a1..ffc7c45 100644
> --- a/drivers/staging/slicoss/slicoss.c
> +++ b/drivers/staging/slicoss/slicoss.c
> @@ -1014,45 +1014,43 @@ static void slic_upr_request_complete(struct adapter 
> *adapter, u32 isr)
>   break;
>   }
>  
> - UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, stats->xmit_tcp_segs,
> - old->xmit_tcp_segs);
> + stst->tcp.xmit_tcp_segs =
> + stats->xmit_tcp_segs - old->xmit_tcp_segs;

Missed this the first time, but the difference should be added to the
value in stst:

stst->tcp.xmit_tcp_segs +=
stats->xmit_tcp_segs - old->xmit_tcp_segs;

The same applies to the changes below.

>  
> - UPDATE_STATS_GB(stst->tcp.xmit_tcp_bytes, stats->xmit_tcp_bytes,
> - old->xmit_tcp_bytes);
> + stst->tcp.xmit_tcp_bytes =
> + stats->xmit_tcp_bytes - old->xmit_tcp_bytes;
>  
> - UPDATE_STATS_GB(stst->tcp.rcv_tcp_segs, stats->rcv_tcp_segs,
> - old->rcv_tcp_segs);
> + stst->tcp.rcv_tcp_segs =
> + stats->rcv_tcp_segs - old->rcv_tcp_segs;
>  
> - UPDATE_STATS_GB(stst->tcp.rcv_tcp_bytes, stats->rcv_tcp_bytes,
> - old->rcv_tcp_bytes);
> + stst->tcp.rcv_tcp_bytes =
> + stats->rcv_tcp_bytes - old->rcv_tcp_bytes;
>  
> - UPDATE_STATS_GB(stst->iface.xmt_bytes, stats->xmit_bytes,
> - old->xmit_bytes);
> + stst->iface.xmt_bytes =
> + stats->xmit_bytes - old->xmit_bytes;
>  
> - UPDATE_STATS_GB(stst->iface.xmt_ucast, stats->xmit_unicasts,
> - old->xmit_unicasts);
> + stst->iface.xmt_ucast =
> + stats->xmit_unicasts - old->xmit_unicasts;
>  
> - UPDATE_STATS_GB(stst->iface.rcv_bytes, stats->rcv_bytes,
> - old->rcv_bytes);
> + stst->iface.rcv_bytes =
> + stats->rcv_bytes - old->rcv_bytes;
>  
> - UPDATE_STATS_GB(stst->iface.rcv_ucast, stats->rcv_unicasts,
> - old->rcv_unicasts);
> + stst->iface.rcv_ucast =
> + stats->rcv_unicasts - old->rcv_unicasts;
>  
> - UPDATE_STATS_GB(stst->iface.xmt_errors, stats->xmit_collisions,
> - old->xmit_collisions);
> + stst->iface.xmt_errors =
> + stats->xmit_collisions - old->xmit_collisions;
>  
> - UPDATE_STATS_GB(stst->iface.xmt_errors,
> - stats->xmit_excess_collisions,
> - old->xmit_excess_collisions);
> + stst->iface.xmt_errors = stats->xmit_excess_collisions -
> + old->xmit_excess_collisions;
>  
> - UPDATE_STATS_GB(stst->iface.xmt_errors, stats->xmit_other_error,
> - old->xmit_other_error);
> + stst->iface.xmt_errors =
> + stats->xmit_other_error - old->xmit_other_error;
>  
> - UPDATE_STATS_GB(stst->iface.rcv_errors, stats->rcv_other_error,
> - old->rcv_other_error);
> + stst->iface.rcv_errors =
> + stats->rcv_other_error - old->rcv_other_error;
>  
> - UPDATE_STATS_GB(stst->iface.rcv_discards, stats->rcv_drops,
> - old->rcv_drops);
> + stst->iface.rcv_discards = stats->rcv_drops - old->rcv_drops;
>  
>   if (stats->rcv_drops > old->rcv_drops)
>   adapter->rcv_drops += (stats

[PATCH v3 1/2] staging: slicoss: remove not used UPDATE_STATS macro

2016-11-24 Thread Sergio Paracuellos
This patch remove UPDATE_STATS macro from
header slic.h which is not being used.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/slicoss/slic.h | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
index 1f6562c..2c05868 100644
--- a/drivers/staging/slicoss/slic.h
+++ b/drivers/staging/slicoss/slic.h
@@ -548,14 +548,6 @@ static inline void slic_flush_write(struct adapter 
*adapter)
ioread32(adapter->regs + SLIC_REG_HOSTID);
 }
 
-#define UPDATE_STATS(largestat, newstat, oldstat)\
-{\
-   if ((newstat) < (oldstat))   \
-   (largestat) += ((newstat) + (0x - oldstat + 1)); \
-   else \
-   (largestat) += ((newstat) - (oldstat));  \
-}
-
 #define UPDATE_STATS_GB(largestat, newstat, oldstat) \
 {\
(largestat) += ((newstat) - (oldstat));  \
-- 
1.9.1

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


[PATCH v3 2/2] staging: slicoss: remove UPDATE_STATS_GB macro and inline code

2016-11-24 Thread Sergio Paracuellos
This patch removes UPDATE_STATS_GB macro in slic.h header file
and just inline code. This improve readability.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/slicoss/slic.h|  5 
 drivers/staging/slicoss/slicoss.c | 52 +++
 2 files changed, 25 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
index 2c05868..2893bdf 100644
--- a/drivers/staging/slicoss/slic.h
+++ b/drivers/staging/slicoss/slic.h
@@ -548,11 +548,6 @@ static inline void slic_flush_write(struct adapter 
*adapter)
ioread32(adapter->regs + SLIC_REG_HOSTID);
 }
 
-#define UPDATE_STATS_GB(largestat, newstat, oldstat) \
-{\
-   (largestat) += ((newstat) - (oldstat));  \
-}
-
 #if BITS_PER_LONG == 64
 #define   SLIC_GET_ADDR_LOW(_addr)  (u32)((u64)(_addr) & \
0x)
diff --git a/drivers/staging/slicoss/slicoss.c 
b/drivers/staging/slicoss/slicoss.c
index b6ec0a1..a63d229 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -1014,45 +1014,43 @@ static void slic_upr_request_complete(struct adapter 
*adapter, u32 isr)
break;
}
 
-   UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, stats->xmit_tcp_segs,
-   old->xmit_tcp_segs);
+   stst->tcp.xmit_tcp_segs +=
+   stats->xmit_tcp_segs - old->xmit_tcp_segs;
 
-   UPDATE_STATS_GB(stst->tcp.xmit_tcp_bytes, stats->xmit_tcp_bytes,
-   old->xmit_tcp_bytes);
+   stst->tcp.xmit_tcp_bytes +=
+   stats->xmit_tcp_bytes - old->xmit_tcp_bytes;
 
-   UPDATE_STATS_GB(stst->tcp.rcv_tcp_segs, stats->rcv_tcp_segs,
-   old->rcv_tcp_segs);
+   stst->tcp.rcv_tcp_segs +=
+   stats->rcv_tcp_segs - old->rcv_tcp_segs;
 
-   UPDATE_STATS_GB(stst->tcp.rcv_tcp_bytes, stats->rcv_tcp_bytes,
-   old->rcv_tcp_bytes);
+   stst->tcp.rcv_tcp_bytes +=
+   stats->rcv_tcp_bytes - old->rcv_tcp_bytes;
 
-   UPDATE_STATS_GB(stst->iface.xmt_bytes, stats->xmit_bytes,
-   old->xmit_bytes);
+   stst->iface.xmt_bytes +=
+   stats->xmit_bytes - old->xmit_bytes;
 
-   UPDATE_STATS_GB(stst->iface.xmt_ucast, stats->xmit_unicasts,
-   old->xmit_unicasts);
+   stst->iface.xmt_ucast +=
+   stats->xmit_unicasts - old->xmit_unicasts;
 
-   UPDATE_STATS_GB(stst->iface.rcv_bytes, stats->rcv_bytes,
-   old->rcv_bytes);
+   stst->iface.rcv_bytes +=
+   stats->rcv_bytes - old->rcv_bytes;
 
-   UPDATE_STATS_GB(stst->iface.rcv_ucast, stats->rcv_unicasts,
-   old->rcv_unicasts);
+   stst->iface.rcv_ucast +=
+   stats->rcv_unicasts - old->rcv_unicasts;
 
-   UPDATE_STATS_GB(stst->iface.xmt_errors, stats->xmit_collisions,
-   old->xmit_collisions);
+   stst->iface.xmt_errors +=
+   stats->xmit_collisions - old->xmit_collisions;
 
-   UPDATE_STATS_GB(stst->iface.xmt_errors,
-   stats->xmit_excess_collisions,
-   old->xmit_excess_collisions);
+   stst->iface.xmt_errors += stats->xmit_excess_collisions -
+   old->xmit_excess_collisions;
 
-   UPDATE_STATS_GB(stst->iface.xmt_errors, stats->xmit_other_error,
-   old->xmit_other_error);
+   stst->iface.xmt_errors +=
+   stats->xmit_other_error - old->xmit_other_error;
 
-   UPDATE_STATS_GB(stst->iface.rcv_errors, stats->rcv_other_error,
-   old->rcv_other_error);
+   stst->iface.rcv_errors +=
+   stats->rcv_other_error - old->rcv_other_error;
 
-   UPDATE_STATS_GB(stst->iface.rcv_discards, stats->rcv_drops,
-   old->rcv_drops);
+   stst->iface.rcv_discards += stats->rcv_drops - old->rcv_drops;
 
if (stats->rcv_drops > old->rcv_drops)
adapter->rcv_drops += (stats->rcv_drops -
-- 
1.9.1

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


[PATCH v3 0/2] staging: slicoss: minor changes to clean some code

2016-11-24 Thread Sergio Paracuellos
This patchset clean some code in slicoss driver:
* Removes not used macro.
* Remove a macro and just inline code.

Changes in v2:
* Remove inline function into inline code.

Changes in v3:
* Replace '=' in favour of '+='.

Sergio Paracuellos (2):
  staging: slicoss: remove not used UPDATE_STATS macro
  staging: slicoss: remove UPDATE_STATS_GB macro and inline code

 drivers/staging/slicoss/slic.h| 13 --
 drivers/staging/slicoss/slicoss.c | 52 +++
 2 files changed, 25 insertions(+), 40 deletions(-)

-- 
1.9.1

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


[PATCH 2/3] staging: comedi: s626: use preferred kernel type u16

2016-11-24 Thread Saber Rezvani
>From 946376d81bd841696316123586028914448523d1 Mon Sep 17 00:00:00 2001
From: Saber 
Date: Thu, 24 Nov 2016 23:25:47 +0330
Subject: [PATCH 2/3] staging: comedi: s626: use preferred kernel type u16

Fix the checkpatch.pl issue:
CHECK: Prefer kernel type 'u16' over 'uint16_t'

Signed-off-by: Saber Rezvani 
---
 drivers/staging/comedi/drivers/s626.c | 96 +--
 1 file changed, 48 insertions(+), 48 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index ffca397..02d4de9 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -81,7 +81,7 @@ struct s626_private {
int ai_convert_count;   /* conversion counter */
unsigned int ai_convert_timer;  /* time between conversion in
 * units of the timer */
-   uint16_t counter_int_enabs; /* counter interrupt enable mask
+   u16 counter_int_enabs;  /* counter interrupt enable mask
 * for MISC2 register */
u8 adc_items;   /* number of items in ADC poll list */
struct s626_buffer_dma rps_buf; /* DMA buffer used to hold ADC (RPS1)
@@ -90,7 +90,7 @@ struct s626_private {
 * and hold DAC data */
uint32_t *dac_wbuf; /* pointer to logical adrs of DMA buffer
 * used to hold DAC data */
-   uint16_t dacpol;/* image of DAC polarity register */
+   u16 dacpol; /* image of DAC polarity register */
u8 trim_setpoint[12];   /* images of TrimDAC setpoints */
uint32_t i2c_adrs;  /* I2C device address for onboard EEPROM
 * (board rev dependent) */
@@ -179,7 +179,7 @@ static void s626_debi_transfer(struct comedi_device *dev)
 /*
  * Read a value from a gate array register.
  */
-static uint16_t s626_debi_read(struct comedi_device *dev, uint16_t addr)
+static u16 s626_debi_read(struct comedi_device *dev, u16 addr)
 {
/* Set up DEBI control register value in shadow RAM */
writel(S626_DEBI_CMD_RDWORD | addr, dev->mmio + S626_P_DEBICMD);
@@ -193,8 +193,8 @@ static uint16_t s626_debi_read(struct comedi_device *dev, 
uint16_t addr)
 /*
  * Write a value to a gate array register.
  */
-static void s626_debi_write(struct comedi_device *dev, uint16_t addr,
-   uint16_t wdata)
+static void s626_debi_write(struct comedi_device *dev, u16 addr,
+   u16 wdata)
 {
/* Set up DEBI control register value in shadow RAM */
writel(S626_DEBI_CMD_WRWORD | addr, dev->mmio + S626_P_DEBICMD);
@@ -516,10 +516,10 @@ static int s626_send_dac(struct comedi_device *dev, 
uint32_t val)
  * Private helper function: Write setpoint to an application DAC channel.
  */
 static int s626_set_dac(struct comedi_device *dev,
-   uint16_t chan, int16_t dacdata)
+   u16 chan, int16_t dacdata)
 {
struct s626_private *devpriv = dev->private;
-   uint16_t signmask;
+   u16 signmask;
uint32_t ws_image;
uint32_t val;
 
@@ -535,7 +535,7 @@ static int s626_set_dac(struct comedi_device *dev,
}
 
/* Limit DAC setpoint value to valid range. */
-   if ((uint16_t)dacdata > 0x1FFF)
+   if ((u16)dacdata > 0x1FFF)
dacdata = 0x1FFF;
 
/*
@@ -661,7 +661,7 @@ static int s626_load_trim_dacs(struct comedi_device *dev)
  * latches B.
  */
 static void s626_set_latch_source(struct comedi_device *dev,
- unsigned int chan, uint16_t value)
+ unsigned int chan, u16 value)
 {
s626_debi_replace(dev, S626_LP_CRB(chan),
  ~(S626_CRBMSK_INTCTRL | S626_CRBMSK_LATCHSRC),
@@ -686,7 +686,7 @@ static void s626_preload(struct comedi_device *dev,
 static void s626_reset_cap_flags(struct comedi_device *dev,
 unsigned int chan)
 {
-   uint16_t set;
+   u16 set;
 
set = S626_SET_CRB_INTRESETCMD(1);
if (chan < 3)
@@ -704,12 +704,12 @@ static void s626_reset_cap_flags(struct comedi_device 
*dev,
  * ClkPol, ClkEnab, IndexSrc, IndexPol, LoadSrc.
  */
 static void s626_set_mode_a(struct comedi_device *dev,
-   unsigned int chan, uint16_t setup,
-   uint16_t disable_int_src)
+   unsigned int chan, u16 setup,
+   u16 disable_int_src)
 {
struct s626_private *devpriv = dev->private;
-   uint16_t cra;
-   uint16_t crb;
+   u16 cra;
+   u16 crb;
unsigned int cntsrc, clkmult, clkpol;
 
/* Initialize CRA and CRB images. */
@@ -782,12 +782,12 @@ static void s626_set_mode_a(struct comedi_device *dev,
 }
 
 static vo

[PATCH 1/3] staging: comedi: s626: use preferred kernel type u8

2016-11-24 Thread Saber Rezvani
>From c3dd43f3d43e7bec8f7f1140519ffc1f3b727b01 Mon Sep 17 00:00:00 2001
From: Saber 
Date: Thu, 24 Nov 2016 23:15:21 +0330
Subject: [PATCH 1/3] staging: comedi: s626: use preferred kernel type u8

Fix the checkpatch.pl issue:
CHECK: Prefer kernel type 'u8' over 'uint8_t'

Signed-off-by: Saber Rezvani 
---
 drivers/staging/comedi/drivers/s626.c | 32 
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index c14a025..ffca397 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -75,7 +75,7 @@ struct s626_buffer_dma {
 };
 
 struct s626_private {
-   uint8_t ai_cmd_running; /* ai_cmd is running */
+   u8 ai_cmd_running;  /* ai_cmd is running */
unsigned int ai_sample_timer;   /* time between samples in
 * units of the timer */
int ai_convert_count;   /* conversion counter */
@@ -83,7 +83,7 @@ struct s626_private {
 * units of the timer */
uint16_t counter_int_enabs; /* counter interrupt enable mask
 * for MISC2 register */
-   uint8_t adc_items;  /* number of items in ADC poll list */
+   u8 adc_items;   /* number of items in ADC poll list */
struct s626_buffer_dma rps_buf; /* DMA buffer used to hold ADC (RPS1)
 * program */
struct s626_buffer_dma ana_buf; /* DMA buffer used to receive ADC data
@@ -91,7 +91,7 @@ struct s626_private {
uint32_t *dac_wbuf; /* pointer to logical adrs of DMA buffer
 * used to hold DAC data */
uint16_t dacpol;/* image of DAC polarity register */
-   uint8_t trim_setpoint[12];  /* images of TrimDAC setpoints */
+   u8 trim_setpoint[12];   /* images of TrimDAC setpoints */
uint32_t i2c_adrs;  /* I2C device address for onboard EEPROM
 * (board rev dependent) */
 };
@@ -267,8 +267,8 @@ static int s626_i2c_handshake(struct comedi_device *dev, 
uint32_t val)
return ctrl & S626_I2C_ERR;
 }
 
-/* Read uint8_t from EEPROM. */
-static uint8_t s626_i2c_read(struct comedi_device *dev, uint8_t addr)
+/* Read u8 from EEPROM. */
+static u8 s626_i2c_read(struct comedi_device *dev, u8 addr)
 {
struct s626_private *devpriv = dev->private;
 
@@ -304,10 +304,10 @@ static uint8_t s626_i2c_read(struct comedi_device *dev, 
uint8_t addr)
 /* ***  DAC FUNCTIONS *** */
 
 /* TrimDac LogicalChan-to-PhysicalChan mapping table. */
-static const uint8_t s626_trimchan[] = { 10, 9, 8, 3, 2, 7, 6, 1, 0, 5, 4 };
+static const u8 s626_trimchan[] = { 10, 9, 8, 3, 2, 7, 6, 1, 0, 5, 4 };
 
 /* TrimDac LogicalChan-to-EepromAdrs mapping table. */
-static const uint8_t s626_trimadrs[] = {
+static const u8 s626_trimadrs[] = {
0x40, 0x41, 0x42, 0x50, 0x51, 0x52, 0x53, 0x60, 0x61, 0x62, 0x63
 };
 
@@ -582,7 +582,7 @@ static int s626_set_dac(struct comedi_device *dev,
 }
 
 static int s626_write_trim_dac(struct comedi_device *dev,
-  uint8_t logical_chan, uint8_t dac_data)
+  u8 logical_chan, u8 dac_data)
 {
struct s626_private *devpriv = dev->private;
uint32_t chan;
@@ -591,7 +591,7 @@ static int s626_write_trim_dac(struct comedi_device *dev,
 * Save the new setpoint in case the application needs to read it back
 * later.
 */
-   devpriv->trim_setpoint[logical_chan] = (uint8_t)dac_data;
+   devpriv->trim_setpoint[logical_chan] = (u8)dac_data;
 
/* Map logical channel number to physical channel number. */
chan = s626_trimchan[logical_chan];
@@ -633,7 +633,7 @@ static int s626_write_trim_dac(struct comedi_device *dev,
 
 static int s626_load_trim_dacs(struct comedi_device *dev)
 {
-   uint8_t i;
+   u8 i;
int ret;
 
/* Copy TrimDac setpoint values from EEPROM to TrimDacs. */
@@ -1035,7 +1035,7 @@ static int s626_dio_set_irq(struct comedi_device *dev, 
unsigned int chan)
return 0;
 }
 
-static int s626_dio_reset_irq(struct comedi_device *dev, unsigned int group,
+static int s626_dio_reset_irq(struct comedi_device *dev, u8 group,
  unsigned int mask)
 {
/* disable edge capture write command */
@@ -1062,7 +1062,7 @@ static int s626_dio_clear_irq(struct comedi_device *dev)
 }
 
 static void s626_handle_dio_interrupt(struct comedi_device *dev,
- uint16_t irqbit, uint8_t group)
+ uint16_t irqbit, u8 group)
 {
struct s626_private *devpriv = dev->private;
struct comedi_subdevice *s = dev->read_subdev;
@@ -,7 +,7 @@ stati

[PATCH 3/3] staging: comedi: s626: use preferred kernel type u32

2016-11-24 Thread Saber Rezvani
>From 5a907ea23f93f4358a91eb75915ef4b6134a9034 Mon Sep 17 00:00:00 2001
From: Saber 
Date: Thu, 24 Nov 2016 23:35:52 +0330
Subject: [PATCH 3/3] staging: comedi: s626: use preferred kernel type u32

Fix the checkpatch.pl issue:
CHECK: Prefer kernel type 'u32' over 'uint32_t'

Signed-off-by: Saber Rezvani 
---
 drivers/staging/comedi/drivers/s626.c | 58 +--
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index 02d4de9..591ff68 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -88,11 +88,11 @@ struct s626_private {
 * program */
struct s626_buffer_dma ana_buf; /* DMA buffer used to receive ADC data
 * and hold DAC data */
-   uint32_t *dac_wbuf; /* pointer to logical adrs of DMA buffer
+   u32 *dac_wbuf;  /* pointer to logical adrs of DMA buffer
 * used to hold DAC data */
u16 dacpol; /* image of DAC polarity register */
u8 trim_setpoint[12];   /* images of TrimDAC setpoints */
-   uint32_t i2c_adrs;  /* I2C device address for onboard EEPROM
+   u32 i2c_adrs;   /* I2C device address for onboard EEPROM
 * (board rev dependent) */
 };
 
@@ -241,7 +241,7 @@ static int s626_i2c_handshake_eoc(struct comedi_device *dev,
return -EBUSY;
 }
 
-static int s626_i2c_handshake(struct comedi_device *dev, uint32_t val)
+static int s626_i2c_handshake(struct comedi_device *dev, u32 val)
 {
unsigned int ctrl;
int ret;
@@ -357,7 +357,7 @@ static int s626_send_dac_eoc(struct comedi_device *dev,
  * channel 2.  Assumes: (1) TSL2 slot records initialized, and (2)
  * dacpol contains valid target image.
  */
-static int s626_send_dac(struct comedi_device *dev, uint32_t val)
+static int s626_send_dac(struct comedi_device *dev, u32 val)
 {
struct s626_private *devpriv = dev->private;
int ret;
@@ -520,8 +520,8 @@ static int s626_set_dac(struct comedi_device *dev,
 {
struct s626_private *devpriv = dev->private;
u16 signmask;
-   uint32_t ws_image;
-   uint32_t val;
+   u32 ws_image;
+   u32 val;
 
/*
 * Adjust DAC data polarity and set up Polarity Control Register image.
@@ -575,9 +575,9 @@ static int s626_set_dac(struct comedi_device *dev,
 * (write to non-existent trimdac). */
val |= 0x4000;  /* Address the two main dual-DAC devices
 * (TSL's chip select enables target device). */
-   val |= ((uint32_t)(chan & 1) << 15);/* Address the DAC channel
+   val |= ((u32)(chan & 1) << 15); /* Address the DAC channel
 * within the device. */
-   val |= (uint32_t)dacdata;   /* Include DAC setpoint data. */
+   val |= (u32)dacdata;/* Include DAC setpoint data. */
return s626_send_dac(dev, val);
 }
 
@@ -585,7 +585,7 @@ static int s626_write_trim_dac(struct comedi_device *dev,
   u8 logical_chan, u8 dac_data)
 {
struct s626_private *devpriv = dev->private;
-   uint32_t chan;
+   u32 chan;
 
/*
 * Save the new setpoint in case the application needs to read it back
@@ -672,7 +672,7 @@ static void s626_set_latch_source(struct comedi_device *dev,
  * Write value into counter preload register.
  */
 static void s626_preload(struct comedi_device *dev,
-unsigned int chan, uint32_t value)
+unsigned int chan, u32 value)
 {
s626_debi_write(dev, S626_LP_CNTR(chan), value);
s626_debi_write(dev, S626_LP_CNTR(chan) + 2, value >> 16);
@@ -1196,7 +1196,7 @@ static bool s626_handle_eos_interrupt(struct 
comedi_device *dev)
 * first uint16_t in the buffer because it contains junk data
 * from the final ADC of the previous poll list scan.
 */
-   uint32_t *readaddr = (uint32_t *)devpriv->ana_buf.logical_base + 1;
+   u32 *readaddr = (u32 *)devpriv->ana_buf.logical_base + 1;
int i;
 
/* get the data and hand it over to comedi */
@@ -1231,7 +1231,7 @@ static irqreturn_t s626_irq_handler(int irq, void *d)
 {
struct comedi_device *dev = d;
unsigned long flags;
-   uint32_t irqtype, irqstatus;
+   u32 irqtype, irqstatus;
 
if (!dev->attached)
return IRQ_NONE;
@@ -1277,20 +1277,20 @@ static void s626_reset_adc(struct comedi_device *dev, 
u8 *ppl)
struct s626_private *devpriv = dev->private;
struct comedi_subdevice *s = dev->read_subdev;
struct comedi_cmd *cmd = &s->async->cmd;
-   uint32_t *rps;
-   uint32_t jmp_adrs;
+ 

Re: [PATCH v2 2/2] staging: slicoss: remove UPDATE_STATS_GB macro and inline code

2016-11-24 Thread Sergio Paracuellos
On Thu, Nov 24, 2016 at 8:41 PM, Markus Böhme  wrote:
> On 11/24/2016 08:21 PM, Sergio Paracuellos wrote:
>> This patch removes UPDATE_STATS_GB macro in slic.h header file
>> and just inline code. This improve readability.
>>
>> Signed-off-by: Sergio Paracuellos 
>> ---
>>  drivers/staging/slicoss/slic.h|  5 
>>  drivers/staging/slicoss/slicoss.c | 52 
>> +++
>>  2 files changed, 25 insertions(+), 32 deletions(-)
>>
>> diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
>> index 2c05868..2893bdf 100644
>> --- a/drivers/staging/slicoss/slic.h
>> +++ b/drivers/staging/slicoss/slic.h
>> @@ -548,11 +548,6 @@ static inline void slic_flush_write(struct adapter 
>> *adapter)
>>   ioread32(adapter->regs + SLIC_REG_HOSTID);
>>  }
>>
>> -#define UPDATE_STATS_GB(largestat, newstat, oldstat) \
>> -{\
>> - (largestat) += ((newstat) - (oldstat));  \
>> -}
>> -
>>  #if BITS_PER_LONG == 64
>>  #define   SLIC_GET_ADDR_LOW(_addr)  (u32)((u64)(_addr) & \
>>   0x)
>> diff --git a/drivers/staging/slicoss/slicoss.c 
>> b/drivers/staging/slicoss/slicoss.c
>> index b6ec0a1..ffc7c45 100644
>> --- a/drivers/staging/slicoss/slicoss.c
>> +++ b/drivers/staging/slicoss/slicoss.c
>> @@ -1014,45 +1014,43 @@ static void slic_upr_request_complete(struct adapter 
>> *adapter, u32 isr)
>>   break;
>>   }
>>
>> - UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, stats->xmit_tcp_segs,
>> - old->xmit_tcp_segs);
>> + stst->tcp.xmit_tcp_segs =
>> + stats->xmit_tcp_segs - old->xmit_tcp_segs;
>
> Missed this the first time, but the difference should be added to the
> value in stst:
>
> stst->tcp.xmit_tcp_segs +=
> stats->xmit_tcp_segs - old->xmit_tcp_segs;
>
> The same applies to the changes below.

True. I have just sent v3 with these fixed.

Thanks for let me know.

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


[PATCH] staging: most: Eliminate symbolic permissions usage

2016-11-24 Thread Jason Litzinger
Fix checkpatch warnings regarding the use of symbolic permissions.

Where the MOST_CHANNEL_ATTR macro is used, convert to octal permissions
over symbolic.

Where _ATTR is used directly, replace with _ATTR_RW/_ATTR_WO and
update the show/store function names appropriately.

Signed-off-by: Jason Litzinger 
---
 drivers/staging/most/mostcore/core.c | 18 --
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/most/mostcore/core.c 
b/drivers/staging/most/mostcore/core.c
index 4c580d1a6a46..3c574a8cb971 100644
--- a/drivers/staging/most/mostcore/core.c
+++ b/drivers/staging/most/mostcore/core.c
@@ -342,7 +342,7 @@ static ssize_t show_channel_starving(struct most_c_obj *c,
 }
 
 #define create_show_channel_attribute(val) \
-   static MOST_CHNL_ATTR(val, S_IRUGO, show_##val, NULL)
+   static MOST_CHNL_ATTR(val, 0444, show_##val, NULL)
 
 create_show_channel_attribute(available_directions);
 create_show_channel_attribute(available_datatypes);
@@ -494,9 +494,7 @@ static ssize_t store_set_packets_per_xact(struct most_c_obj 
*c,
 }
 
 #define create_channel_attribute(value) \
-   static MOST_CHNL_ATTR(value, S_IRUGO | S_IWUSR, \
- show_##value, \
- store_##value)
+   static MOST_CHNL_ATTR(value, 0644, show_##value, store_##value)
 
 create_channel_attribute(set_buffer_size);
 create_channel_attribute(set_number_of_buffers);
@@ -690,7 +688,7 @@ static ssize_t show_interface(struct most_inst_obj 
*instance_obj,
 }
 
 #define create_inst_attribute(value) \
-   static MOST_INST_ATTR(value, S_IRUGO, show_##value, NULL)
+   static MOST_INST_ATTR(value, 0444, show_##value, NULL)
 
 create_inst_attribute(description);
 create_inst_attribute(interface);
@@ -849,7 +847,7 @@ static void most_aim_release(struct kobject *kobj)
kfree(aim_obj);
 }
 
-static ssize_t show_add_link(struct most_aim_obj *aim_obj,
+static ssize_t add_link_show(struct most_aim_obj *aim_obj,
 struct most_aim_attribute *attr,
 char *buf)
 {
@@ -966,7 +964,7 @@ most_c_obj *get_channel_by_name(char *mdev, char *mdev_ch)
  * (1) would create the device node /dev/my_rxchannel
  * (2) would create the device node /dev/mdev1-ep81
  */
-static ssize_t store_add_link(struct most_aim_obj *aim_obj,
+static ssize_t add_link_store(struct most_aim_obj *aim_obj,
  struct most_aim_attribute *attr,
  const char *buf,
  size_t len)
@@ -1016,7 +1014,7 @@ static ssize_t store_add_link(struct most_aim_obj 
*aim_obj,
 }
 
 static struct most_aim_attribute most_aim_attr_add_link =
-   __ATTR(add_link, S_IRUGO | S_IWUSR, show_add_link, store_add_link);
+   __ATTR_RW(add_link);
 
 /**
  * store_remove_link - store function for remove_link attribute
@@ -1028,7 +1026,7 @@ static struct most_aim_attribute most_aim_attr_add_link =
  * Example:
  * echo "mdev0:ep81" >remove_link
  */
-static ssize_t store_remove_link(struct most_aim_obj *aim_obj,
+static ssize_t remove_link_store(struct most_aim_obj *aim_obj,
 struct most_aim_attribute *attr,
 const char *buf,
 size_t len)
@@ -1059,7 +1057,7 @@ static ssize_t store_remove_link(struct most_aim_obj 
*aim_obj,
 }
 
 static struct most_aim_attribute most_aim_attr_remove_link =
-   __ATTR(remove_link, S_IWUSR, NULL, store_remove_link);
+   __ATTR_WO(remove_link)
 
 static struct attribute *most_aim_def_attrs[] = {
&most_aim_attr_add_link.attr,
-- 
2.10.0

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


Gigabit ethernet driver for Alacritechs SLIC devices

2016-11-24 Thread Lino Sanfilippo
Hi,

this is the second version of the slicoss gigabit ethernet driver (which is a
rework of the driver from Alacritech which can currently be found under
drivers/staging/slicoss). The driver is supposed to support Mojave, Oasis and
Kalahari cards, for both copper and fiber.

If this code is accepted the staging version can be removed.

The driver has been tested on a SEN2104ET adapter (4 Port PCIe copper).

v2:
- remove unusual padding in statistic strings (suggested by Andrew Lunn)
- for mdio register and bit names use defines from mii.h instead of own ones
  (suggested by Andrew Lunn)
- remove unused defines
- ensure PCI flush at two more places
- use mmiowb before lock to prevent mmio writes leaking out of lock
- fix some typos in comments
- add copyright and GPL header

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


[PATCH v2 net-next 2/2] MAINTAINERS: add entry for slicoss ethernet driver

2016-11-24 Thread Lino Sanfilippo
Add myself as maintainer for the slicoss ethernet driver.

Signed-off-by: Lino Sanfilippo 
---
 MAINTAINERS | 5 +
 1 file changed, 5 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 6781a3f..bb9af28 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -562,6 +562,11 @@ T: git git://linuxtv.org/anttip/media_tree.git
 S: Maintained
 F: drivers/media/usb/airspy/
 
+ALACRITECH GIGABIT ETHERNET DRIVER
+M: Lino Sanfilippo 
+S: Maintained
+F: drivers/net/ethernet/alacritech/*
+
 ALCATEL SPEEDTOUCH USB DRIVER
 M: Duncan Sands 
 L: linux-...@vger.kernel.org
-- 
1.9.1

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


[PATCH v2 net-next 1/2] net: ethernet: slicoss: add slicoss gigabit ethernet driver

2016-11-24 Thread Lino Sanfilippo
Add driver for Alacritech gigabit ethernet cards with SLIC (session-layer
interface control) technology. The driver provides basic support without
SLIC for the following devices:

- Mojave cards (single port PCI Gigabit) both copper and fiber
- Oasis cards (single and dual port PCI-x Gigabit) copper and fiber
- Kalahari cards (dual and quad port PCI-e Gigabit) copper and fiber

Signed-off-by: Lino Sanfilippo 
---
 drivers/net/ethernet/Kconfig  |1 +
 drivers/net/ethernet/Makefile |1 +
 drivers/net/ethernet/alacritech/Kconfig   |   28 +
 drivers/net/ethernet/alacritech/Makefile  |4 +
 drivers/net/ethernet/alacritech/slic.h|  558 +
 drivers/net/ethernet/alacritech/slicoss.c | 1867 +
 include/linux/pci_ids.h   |   18 +
 7 files changed, 2477 insertions(+)
 create mode 100644 drivers/net/ethernet/alacritech/Kconfig
 create mode 100644 drivers/net/ethernet/alacritech/Makefile
 create mode 100644 drivers/net/ethernet/alacritech/slic.h
 create mode 100644 drivers/net/ethernet/alacritech/slicoss.c

diff --git a/drivers/net/ethernet/Kconfig b/drivers/net/ethernet/Kconfig
index 2ffd634..a4cc87fe 100644
--- a/drivers/net/ethernet/Kconfig
+++ b/drivers/net/ethernet/Kconfig
@@ -21,6 +21,7 @@ source "drivers/net/ethernet/3com/Kconfig"
 source "drivers/net/ethernet/adaptec/Kconfig"
 source "drivers/net/ethernet/aeroflex/Kconfig"
 source "drivers/net/ethernet/agere/Kconfig"
+source "drivers/net/ethernet/alacritech/Kconfig"
 source "drivers/net/ethernet/allwinner/Kconfig"
 source "drivers/net/ethernet/alteon/Kconfig"
 source "drivers/net/ethernet/altera/Kconfig"
diff --git a/drivers/net/ethernet/Makefile b/drivers/net/ethernet/Makefile
index 1d349e9..b448027 100644
--- a/drivers/net/ethernet/Makefile
+++ b/drivers/net/ethernet/Makefile
@@ -7,6 +7,7 @@ obj-$(CONFIG_NET_VENDOR_8390) += 8390/
 obj-$(CONFIG_NET_VENDOR_ADAPTEC) += adaptec/
 obj-$(CONFIG_GRETH) += aeroflex/
 obj-$(CONFIG_NET_VENDOR_AGERE) += agere/
+obj-$(CONFIG_NET_VENDOR_ALACRITECH) += alacritech/
 obj-$(CONFIG_NET_VENDOR_ALLWINNER) += allwinner/
 obj-$(CONFIG_NET_VENDOR_ALTEON) += alteon/
 obj-$(CONFIG_ALTERA_TSE) += altera/
diff --git a/drivers/net/ethernet/alacritech/Kconfig 
b/drivers/net/ethernet/alacritech/Kconfig
new file mode 100644
index 000..41000a3
--- /dev/null
+++ b/drivers/net/ethernet/alacritech/Kconfig
@@ -0,0 +1,28 @@
+config NET_VENDOR_ALACRITECH
+bool "Alacritech devices"
+default y
+---help---
+  If you have a network (Ethernet) card belonging to this class, say Y.
+
+  Note that the answer to this question doesn't directly affect the
+  kernel: saying N will just cause the configurator to skip all
+  the questions about Renesas devices. If you say Y, you will be asked
+  for your specific device in the following questions.
+
+if NET_VENDOR_ALACRITECH
+
+config SLICOSS
+   tristate "Alacritech Slicoss support"
+   depends on PCI
+   select CRC32
+   ---help---
+ This driver supports Gigabit Ethernet adapters based on the
+ Session Layer Interface (SLIC) technology by Alacritech.
+
+ Supported are Mojave (1 port) and Oasis (1, 2 and 4 port) cards,
+ both copper and fiber.
+
+ To compile this driver as a module, choose M here: the module
+ will be called slicoss. This is recommended.
+
+endif # NET_VENDOR_ALACRITECH
diff --git a/drivers/net/ethernet/alacritech/Makefile 
b/drivers/net/ethernet/alacritech/Makefile
new file mode 100644
index 000..8790e9e
--- /dev/null
+++ b/drivers/net/ethernet/alacritech/Makefile
@@ -0,0 +1,4 @@
+#
+# Makefile for the Alacritech Slicoss driver
+#
+obj-$(CONFIG_SLICOSS) += slicoss.o
diff --git a/drivers/net/ethernet/alacritech/slic.h 
b/drivers/net/ethernet/alacritech/slic.h
new file mode 100644
index 000..cea5751
--- /dev/null
+++ b/drivers/net/ethernet/alacritech/slic.h
@@ -0,0 +1,558 @@
+
+#ifndef _SLIC_H
+#define _SLIC_H
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define SLIC_VGBSTAT_XPERR 0x4000
+#define SLIC_VGBSTAT_XERRSHFT  25
+#define SLIC_VGBSTAT_XCSERR0x23
+#define SLIC_VGBSTAT_XUFLOW0x22
+#define SLIC_VGBSTAT_XHLEN 0x20
+#define SLIC_VGBSTAT_NETERR0x0100
+#define SLIC_VGBSTAT_NERRSHFT  16
+#define SLIC_VGBSTAT_NERRMSK   0x1ff
+#define SLIC_VGBSTAT_NCSERR0x103
+#define SLIC_VGBSTAT_NUFLOW0x102
+#define SLIC_VGBSTAT_NHLEN 0x100
+#define SLIC_VGBSTAT_LNKERR0x0080
+#define SLIC_VGBSTAT_LERRMSK   0xff
+#define SLIC_VGBSTAT_LDEARLY   0x86
+#define SLIC_VGBSTAT_LBOFLO0x85
+#define SLIC_VGBSTAT_LCODERR   0x84
+#define SLIC_VGBSTAT_LDBLNBL   0x83
+#define SLIC_VGBSTAT_LCRCERR   0x82
+#define SLIC_VGBSTAT_LOFLO 0x81
+#define SLIC_

[PATCH v2] Staging: iio: adc: fix sysfs files modes in ad7192.c

2016-11-24 Thread Boyan Vladinov
Fixes sysfs entries user/group modes and coding style warnings
found by checkpatch.pl tool. Also use the IIO_DEVICE_ATTR_[RO|RW] and
macros to create device attributes

Signed-off-by: Boyan Vladinov 
---
 drivers/staging/iio/adc/ad7192.c | 45 +++-
 1 file changed, 26 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c
index 1fb68c01abd5..630b04d8128f 100644
--- a/drivers/staging/iio/adc/ad7192.c
+++ b/drivers/staging/iio/adc/ad7192.c
@@ -324,8 +324,8 @@ static int ad7192_setup(struct ad7192_state *st,
 }
 
 static ssize_t
-ad7192_show_scale_available(struct device *dev,
-   struct device_attribute *attr, char *buf)
+in_v_m_v_scale_available_show(struct device *dev, struct device_attribute 
*attr,
+ char *buf)
 {
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct ad7192_state *st = iio_priv(indio_dev);
@@ -340,15 +340,19 @@ ad7192_show_scale_available(struct device *dev,
return len;
 }
 
-static IIO_DEVICE_ATTR_NAMED(in_v_m_v_scale_available,
-in_voltage-voltage_scale_available,
-S_IRUGO, ad7192_show_scale_available, NULL, 0);
+static ssize_t
+in_voltage_scale_available_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   return in_v_m_v_scale_available_show(dev, attr, buf);
+}
+
+static IIO_DEVICE_ATTR_RO(in_v_m_v_scale_available, 0);
 
-static IIO_DEVICE_ATTR(in_voltage_scale_available, S_IRUGO,
-  ad7192_show_scale_available, NULL, 0);
+static IIO_DEVICE_ATTR_RO(in_voltage_scale_available, 0);
 
-static ssize_t ad7192_show_ac_excitation(struct device *dev,
-struct device_attribute *attr,
+static ssize_t ac_excitation_en_show(struct device *dev,
+struct device_attribute *attr,
 char *buf)
 {
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
@@ -357,8 +361,8 @@ static ssize_t ad7192_show_ac_excitation(struct device *dev,
return sprintf(buf, "%d\n", !!(st->mode & AD7192_MODE_ACX));
 }
 
-static ssize_t ad7192_show_bridge_switch(struct device *dev,
-struct device_attribute *attr,
+static ssize_t bridge_switch_en_show(struct device *dev,
+struct device_attribute *attr,
 char *buf)
 {
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
@@ -367,8 +371,8 @@ static ssize_t ad7192_show_bridge_switch(struct device *dev,
return sprintf(buf, "%d\n", !!(st->gpocon & AD7192_GPOCON_BPDSW));
 }
 
-static ssize_t ad7192_set(struct device *dev,
- struct device_attribute *attr,
+static ssize_t bridge_switch_en_store(struct device *dev,
+ struct device_attribute *attr,
  const char *buf,
  size_t len)
 {
@@ -412,13 +416,16 @@ static ssize_t ad7192_set(struct device *dev,
return ret ? ret : len;
 }
 
-static IIO_DEVICE_ATTR(bridge_switch_en, S_IRUGO | S_IWUSR,
-  ad7192_show_bridge_switch, ad7192_set,
-  AD7192_REG_GPOCON);
+static ssize_t ac_excitation_en_store(struct device *dev,
+ struct device_attribute *attr,
+const char *buf, size_t len)
+{
+   return bridge_switch_en_store(dev, attr, buf, len);
+}
+
+static IIO_DEVICE_ATTR_RW(bridge_switch_en, AD7192_REG_GPOCON);
 
-static IIO_DEVICE_ATTR(ac_excitation_en, S_IRUGO | S_IWUSR,
-  ad7192_show_ac_excitation, ad7192_set,
-  AD7192_REG_MODE);
+static IIO_DEVICE_ATTR_RW(ac_excitation_en, AD7192_REG_MODE);
 
 static struct attribute *ad7192_attributes[] = {
&iio_dev_attr_in_v_m_v_scale_available.dev_attr.attr,
-- 
2.7.4

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


[PATCH] Staging: Media: Omap4iss: Do not forget to call

2016-11-24 Thread Shailendra Verma
v4l2_fh_init is already done.So call the v4l2_fh_exit in error condition
before returing from the function.

Signed-off-by: Shailendra Verma 
---
 drivers/staging/media/omap4iss/iss_video.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/media/omap4iss/iss_video.c 
b/drivers/staging/media/omap4iss/iss_video.c
index c16927a..c46d14d 100644
--- a/drivers/staging/media/omap4iss/iss_video.c
+++ b/drivers/staging/media/omap4iss/iss_video.c
@@ -1141,6 +1141,7 @@ static int iss_video_open(struct file *file)
 done:
if (ret < 0) {
v4l2_fh_del(&handle->vfh);
+   v4l2_fh_exit(&handle->vfh);
kfree(handle);
}
 
-- 
1.7.9.5

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