Re: [Outreachy kernel] Re: [PATCH] staging: irda: Replace printk() with appropriate net_*macro_ratelimited()

2018-03-06 Thread SIMRAN SINGHAL
On Tue, Mar 6, 2018 at 2:33 AM, Julia Lawall  wrote:
>
>
> On Mon, 5 Mar 2018, Arushi Singhal wrote:
>
>>
>>
>> On Mon, Mar 5, 2018 at 3:33 PM, Dan Carpenter  
>> wrote:
>>   On Mon, Mar 05, 2018 at 04:02:06AM +0530, Arushi Singhal wrote:
>>   > Replace printk having a log level with the appropriate
>>   > net_*macro_ratelimited.
>>   > It's better to use actual device name as a prefix in error messages.
>>   > Indentation is also changed, to fix the  checkpatch issue if line is 
>> not
>>   > exceding 80 characters.
>>   >
>>   > Signed-off-by: Arushi Singhal 
>>   > ---
>>   >  .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c  | 22 
>> +++---
>>   >  1 file changed, 11 insertions(+), 11 deletions(-)
>>   >
>>   > diff --git 
>> a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c 
>> b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
>>   > index e6648f7..200fe5f 100644
>>   > --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
>>   > +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
>>   > @@ -73,7 +73,7 @@ static void *ieee80211_ccmp_init(int key_idx)
>>   >
>>   >   priv->tfm = (void *)crypto_alloc_cipher("aes", 0, 
>> CRYPTO_ALG_ASYNC);
>>   >   if (IS_ERR(priv->tfm)) {
>>   > - printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not 
>> allocate crypto API aes\n");
>>   > + net_dbg_ratelimited("ieee80211_crypt_ccmp: could not 
>> allocate crypto API aes\n");
>>
>>
>>   This should probably just be deleted.
>>
>> Hello Dan
>> Why we should make this change?
>> According to me it's use here to print debug message.
>> Wanted to know more about your thought on this.
>>
>>   >   priv->tfm = NULL;
>>   >   goto fail;
>>   >   }
>>   > @@ -276,22 +276,22 @@ static int ieee80211_ccmp_decrypt(struct 
>> sk_buff *skb, int hdr_len, void *priv)
>>   >   keyidx = pos[3];
>>   >   if (!(keyidx & (1 << 5))) {
>>   >   if (net_ratelimit()) {
>>   > - printk(KERN_DEBUG "CCMP: received packet 
>> without ExtIV flag from %pM\n",
>>   > - hdr->addr2);
>>   > + net_dbg_ratelimited("CCMP: received packet 
>> without ExtIV flag from %pM\n",
>>   > + hdr->addr2);
>>   >   }
>>
>>   The "if (net_ratelimit()) " already means the message is ratelimited so
>>   it's net_dbg() ok?  I think so, but I've never looked at this before.
>>
>>
>> net_dbg() is an implicit declaration of a function. So we can't do this 
>> change.
>
> Perhaps you can add the header file that declares net_dbg.

Hi Julia

There is such header file which declares net_dbg.
We can use dev_dbg() for all struct device object.
We can use netdev_dbg() for all struct netdevice object.
For net subsystem when there is no struct device object we can go with
net_dbg_ratelimited (preferred) or pr_debug.

I have understood this from my readings. If I am wrong somewhere
please correct me.

Thanks
Arushi

>
> julia
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.20.1803052203001.2763%40hadrien.
> For more options, visit https://groups.google.com/d/optout.


Re: [Outreachy kernel] Re: [PATCH] staging: irda: Replace printk() with appropriate net_*macro_ratelimited()

2018-03-06 Thread SIMRAN SINGHAL
On Tue, Mar 6, 2018 at 2:33 AM, Julia Lawall  wrote:
>
>
> On Mon, 5 Mar 2018, Arushi Singhal wrote:
>
>>
>>
>> On Mon, Mar 5, 2018 at 3:33 PM, Dan Carpenter  
>> wrote:
>>   On Mon, Mar 05, 2018 at 04:02:06AM +0530, Arushi Singhal wrote:
>>   > Replace printk having a log level with the appropriate
>>   > net_*macro_ratelimited.
>>   > It's better to use actual device name as a prefix in error messages.
>>   > Indentation is also changed, to fix the  checkpatch issue if line is 
>> not
>>   > exceding 80 characters.
>>   >
>>   > Signed-off-by: Arushi Singhal 
>>   > ---
>>   >  .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c  | 22 
>> +++---
>>   >  1 file changed, 11 insertions(+), 11 deletions(-)
>>   >
>>   > diff --git 
>> a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c 
>> b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
>>   > index e6648f7..200fe5f 100644
>>   > --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
>>   > +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
>>   > @@ -73,7 +73,7 @@ static void *ieee80211_ccmp_init(int key_idx)
>>   >
>>   >   priv->tfm = (void *)crypto_alloc_cipher("aes", 0, 
>> CRYPTO_ALG_ASYNC);
>>   >   if (IS_ERR(priv->tfm)) {
>>   > - printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not 
>> allocate crypto API aes\n");
>>   > + net_dbg_ratelimited("ieee80211_crypt_ccmp: could not 
>> allocate crypto API aes\n");
>>
>>
>>   This should probably just be deleted.
>>
>> Hello Dan
>> Why we should make this change?
>> According to me it's use here to print debug message.
>> Wanted to know more about your thought on this.
>>
>>   >   priv->tfm = NULL;
>>   >   goto fail;
>>   >   }
>>   > @@ -276,22 +276,22 @@ static int ieee80211_ccmp_decrypt(struct 
>> sk_buff *skb, int hdr_len, void *priv)
>>   >   keyidx = pos[3];
>>   >   if (!(keyidx & (1 << 5))) {
>>   >   if (net_ratelimit()) {
>>   > - printk(KERN_DEBUG "CCMP: received packet 
>> without ExtIV flag from %pM\n",
>>   > - hdr->addr2);
>>   > + net_dbg_ratelimited("CCMP: received packet 
>> without ExtIV flag from %pM\n",
>>   > + hdr->addr2);
>>   >   }
>>
>>   The "if (net_ratelimit()) " already means the message is ratelimited so
>>   it's net_dbg() ok?  I think so, but I've never looked at this before.
>>
>>
>> net_dbg() is an implicit declaration of a function. So we can't do this 
>> change.
>
> Perhaps you can add the header file that declares net_dbg.

Hi Julia

There is such header file which declares net_dbg.
We can use dev_dbg() for all struct device object.
We can use netdev_dbg() for all struct netdevice object.
For net subsystem when there is no struct device object we can go with
net_dbg_ratelimited (preferred) or pr_debug.

I have understood this from my readings. If I am wrong somewhere
please correct me.

Thanks
Arushi

>
> julia
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.20.1803052203001.2763%40hadrien.
> For more options, visit https://groups.google.com/d/optout.


[PATCH] staging: rtl8192u: ieee80211: Convert printks to pr_

2017-06-21 Thread simran singhal
Use the current logging style.
Coalesce formats where appropriate.

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 34 ++-
 1 file changed, 14 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
index 7a31510..d1a86bb 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
@@ -236,8 +236,8 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, 
struct sk_buff *skb,
 
#ifdef NOT_YET
if (ieee->iw_mode == IW_MODE_MASTER) {
-   printk(KERN_DEBUG "%s: Master mode not yet supported.\n",
-  ieee->dev->name);
+   pr_debug("%s: Master mode not yet supported.\n",
+ieee->dev->name);
return 0;
 /*
   hostap_update_sta_ps(ieee, (struct hostap_ieee80211_hdr_4addr *)
@@ -265,9 +265,8 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, 
struct sk_buff *skb,
 
if (ieee->iw_mode == IW_MODE_MASTER) {
if (type != WLAN_FC_TYPE_MGMT && type != WLAN_FC_TYPE_CTRL) {
-   printk(KERN_DEBUG "%s: unknown management frame "
-  "(type=0x%02x, stype=0x%02x) dropped\n",
-  skb->dev->name, type, stype);
+   pr_debug("%s: unknown management frame (type=0x%02x, 
stype=0x%02x) dropped\n",
+skb->dev->name, type, stype);
return -1;
}
 
@@ -275,8 +274,8 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, 
struct sk_buff *skb,
return 0;
}
 
-   printk(KERN_DEBUG "%s: hostap_rx_frame_mgmt: management frame "
-  "received in non-Host AP mode\n", skb->dev->name);
+   pr_debug("%s: hostap_rx_frame_mgmt: management frame received in 
non-Host AP mode\n",
+skb->dev->name);
return -1;
#endif
 }
@@ -354,9 +353,8 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, 
struct sk_buff *skb,
if (ieee->tkip_countermeasures &&
strcmp(crypt->ops->name, "TKIP") == 0) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "%s: TKIP countermeasures: dropped "
-  "received packet from %pM\n",
-  ieee->dev->name, hdr->addr2);
+   pr_debug("%s: TKIP countermeasures: dropped received 
packet from %pM\n",
+ieee->dev->name, hdr->addr2);
}
return -1;
}
@@ -403,9 +401,8 @@ ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device 
*ieee, struct sk_buff *s
res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
atomic_dec(>refcnt);
if (res < 0) {
-   printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed"
-  " (SA=%pM keyidx=%d)\n",
-  ieee->dev->name, hdr->addr2, keyidx);
+   pr_debug("%s: MSDU decryption/MIC verification failed (SA=%pM 
keyidx=%d)\n",
+ieee->dev->name, hdr->addr2, keyidx);
return -1;
}
 
@@ -923,8 +920,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct 
sk_buff *skb,
stats = >stats;
 
if (skb->len < 10) {
-   printk(KERN_INFO "%s: SKB length < 10\n",
-  dev->name);
+   pr_info("%s: SKB length < 10\n", dev->name);
goto rx_dropped;
}
 
@@ -1170,9 +1166,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct 
sk_buff *skb,
flen -= hdrlen;
 
if (frag_skb->tail + flen > frag_skb->end) {
-   printk(KERN_WARNING "%s: host decrypted and "
-  "reassembled frame did not fit skb\n",
-  dev->name);
+   pr_warn("%s: host decrypted and reassembled frame did 
not fit skb\n",
+   dev->name);
ieee80211_frag_cache_invalidate(ieee, hdr);
goto rx_dropped;
}
@@ -2049,8 +2044,7 @@ int ieee80211_parse_info_param(struct ieee80211_device 
*ieee,
}
break;
case MFIE_TYPE_QOS_PARAMETER:
-   printk(KERN_ERR
-  "QoS Error need to parse QOS_PARAMETER IE\n");
+   pr_err("QoS Error need to parse QOS_PARAMETER IE\n");
break;
 
case MFIE_TYPE_COUNTRY:
-- 
2.7.4



[PATCH] staging: rtl8192u: ieee80211: Convert printks to pr_

2017-06-21 Thread simran singhal
Use the current logging style.
Coalesce formats where appropriate.

Signed-off-by: simran singhal 
---
 drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 34 ++-
 1 file changed, 14 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
index 7a31510..d1a86bb 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
@@ -236,8 +236,8 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, 
struct sk_buff *skb,
 
#ifdef NOT_YET
if (ieee->iw_mode == IW_MODE_MASTER) {
-   printk(KERN_DEBUG "%s: Master mode not yet supported.\n",
-  ieee->dev->name);
+   pr_debug("%s: Master mode not yet supported.\n",
+ieee->dev->name);
return 0;
 /*
   hostap_update_sta_ps(ieee, (struct hostap_ieee80211_hdr_4addr *)
@@ -265,9 +265,8 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, 
struct sk_buff *skb,
 
if (ieee->iw_mode == IW_MODE_MASTER) {
if (type != WLAN_FC_TYPE_MGMT && type != WLAN_FC_TYPE_CTRL) {
-   printk(KERN_DEBUG "%s: unknown management frame "
-  "(type=0x%02x, stype=0x%02x) dropped\n",
-  skb->dev->name, type, stype);
+   pr_debug("%s: unknown management frame (type=0x%02x, 
stype=0x%02x) dropped\n",
+skb->dev->name, type, stype);
return -1;
}
 
@@ -275,8 +274,8 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, 
struct sk_buff *skb,
return 0;
}
 
-   printk(KERN_DEBUG "%s: hostap_rx_frame_mgmt: management frame "
-  "received in non-Host AP mode\n", skb->dev->name);
+   pr_debug("%s: hostap_rx_frame_mgmt: management frame received in 
non-Host AP mode\n",
+skb->dev->name);
return -1;
#endif
 }
@@ -354,9 +353,8 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, 
struct sk_buff *skb,
if (ieee->tkip_countermeasures &&
strcmp(crypt->ops->name, "TKIP") == 0) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "%s: TKIP countermeasures: dropped "
-  "received packet from %pM\n",
-  ieee->dev->name, hdr->addr2);
+   pr_debug("%s: TKIP countermeasures: dropped received 
packet from %pM\n",
+ieee->dev->name, hdr->addr2);
}
return -1;
}
@@ -403,9 +401,8 @@ ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device 
*ieee, struct sk_buff *s
res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
atomic_dec(>refcnt);
if (res < 0) {
-   printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed"
-  " (SA=%pM keyidx=%d)\n",
-  ieee->dev->name, hdr->addr2, keyidx);
+   pr_debug("%s: MSDU decryption/MIC verification failed (SA=%pM 
keyidx=%d)\n",
+ieee->dev->name, hdr->addr2, keyidx);
return -1;
}
 
@@ -923,8 +920,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct 
sk_buff *skb,
stats = >stats;
 
if (skb->len < 10) {
-   printk(KERN_INFO "%s: SKB length < 10\n",
-  dev->name);
+   pr_info("%s: SKB length < 10\n", dev->name);
goto rx_dropped;
}
 
@@ -1170,9 +1166,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct 
sk_buff *skb,
flen -= hdrlen;
 
if (frag_skb->tail + flen > frag_skb->end) {
-   printk(KERN_WARNING "%s: host decrypted and "
-  "reassembled frame did not fit skb\n",
-  dev->name);
+   pr_warn("%s: host decrypted and reassembled frame did 
not fit skb\n",
+   dev->name);
ieee80211_frag_cache_invalidate(ieee, hdr);
goto rx_dropped;
}
@@ -2049,8 +2044,7 @@ int ieee80211_parse_info_param(struct ieee80211_device 
*ieee,
}
break;
case MFIE_TYPE_QOS_PARAMETER:
-   printk(KERN_ERR
-  "QoS Error need to parse QOS_PARAMETER IE\n");
+   pr_err("QoS Error need to parse QOS_PARAMETER IE\n");
break;
 
case MFIE_TYPE_COUNTRY:
-- 
2.7.4



[PATCH] staging: lustre: lnet: selftest: Change the type of variable to bool

2017-06-20 Thread simran singhal
This patch changes the type of variable done from int to boolean. As it
is been used as a boolean in the function sfw_test_rpc_done(). It also
makes the code more readable and bool data type also requires less
memory in comparison to int data type.

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/staging/lustre/lnet/selftest/framework.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/framework.c 
b/drivers/staging/lustre/lnet/selftest/framework.c
index ef27bff..3789df6 100644
--- a/drivers/staging/lustre/lnet/selftest/framework.c
+++ b/drivers/staging/lustre/lnet/selftest/framework.c
@@ -869,7 +869,7 @@ sfw_test_rpc_done(struct srpc_client_rpc *rpc)
 {
struct sfw_test_unit *tsu = rpc->crpc_priv;
struct sfw_test_instance *tsi = tsu->tsu_instance;
-   int done = 0;
+   bool done = false;
 
tsi->tsi_ops->tso_done_rpc(tsu, rpc);
 
@@ -883,7 +883,7 @@ sfw_test_rpc_done(struct srpc_client_rpc *rpc)
/* batch is stopping or loop is done or get error */
if (tsi->tsi_stopping || !tsu->tsu_loop ||
(rpc->crpc_status && tsi->tsi_stoptsu_onerr))
-   done = 1;
+   done = true;
 
/* dec ref for poster */
srpc_client_rpc_decref(rpc);
-- 
2.7.4



[PATCH] staging: lustre: lnet: selftest: Change the type of variable to bool

2017-06-20 Thread simran singhal
This patch changes the type of variable done from int to boolean. As it
is been used as a boolean in the function sfw_test_rpc_done(). It also
makes the code more readable and bool data type also requires less
memory in comparison to int data type.

Signed-off-by: simran singhal 
---
 drivers/staging/lustre/lnet/selftest/framework.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/framework.c 
b/drivers/staging/lustre/lnet/selftest/framework.c
index ef27bff..3789df6 100644
--- a/drivers/staging/lustre/lnet/selftest/framework.c
+++ b/drivers/staging/lustre/lnet/selftest/framework.c
@@ -869,7 +869,7 @@ sfw_test_rpc_done(struct srpc_client_rpc *rpc)
 {
struct sfw_test_unit *tsu = rpc->crpc_priv;
struct sfw_test_instance *tsi = tsu->tsu_instance;
-   int done = 0;
+   bool done = false;
 
tsi->tsi_ops->tso_done_rpc(tsu, rpc);
 
@@ -883,7 +883,7 @@ sfw_test_rpc_done(struct srpc_client_rpc *rpc)
/* batch is stopping or loop is done or get error */
if (tsi->tsi_stopping || !tsu->tsu_loop ||
(rpc->crpc_status && tsi->tsi_stoptsu_onerr))
-   done = 1;
+   done = true;
 
/* dec ref for poster */
srpc_client_rpc_decref(rpc);
-- 
2.7.4



[PATCH] staging: rtl8723bs: hal: Use (true/false) in assignment to bool

2017-06-19 Thread simran singhal
This patch assigns (true/false) to boolean EDCCA_State instead of (1/0).
And, there is no need of comparing EDCCA_State explicitly with constant
1.

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/staging/rtl8723bs/hal/odm_DIG.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/odm_DIG.c 
b/drivers/staging/rtl8723bs/hal/odm_DIG.c
index 202c52f..0bde944 100644
--- a/drivers/staging/rtl8723bs/hal/odm_DIG.c
+++ b/drivers/staging/rtl8723bs/hal/odm_DIG.c
@@ -278,11 +278,11 @@ void odm_Adaptivity(void *pDM_VOID, u8 IGI)
 
if (!pDM_Odm->ForceEDCCA) {
if (pDM_Odm->RSSI_Min > pDM_Odm->AdapEn_RSSI)
-   EDCCA_State = 1;
+   EDCCA_State = true;
else if (pDM_Odm->RSSI_Min < (pDM_Odm->AdapEn_RSSI - 5))
-   EDCCA_State = 0;
+   EDCCA_State = false;
} else
-   EDCCA_State = 1;
+   EDCCA_State = true;
 
if (
pDM_Odm->bLinked &&
@@ -305,7 +305,7 @@ void odm_Adaptivity(void *pDM_VOID, u8 IGI)
)
);
 
-   if (EDCCA_State == 1) {
+   if (EDCCA_State) {
Diff = IGI_target-(s8)IGI;
TH_L2H_dmc = pDM_Odm->TH_L2H_ini + Diff;
if (TH_L2H_dmc > 10)
-- 
2.7.4



[PATCH] staging: rtl8723bs: hal: Use (true/false) in assignment to bool

2017-06-19 Thread simran singhal
This patch assigns (true/false) to boolean EDCCA_State instead of (1/0).
And, there is no need of comparing EDCCA_State explicitly with constant
1.

Signed-off-by: simran singhal 
---
 drivers/staging/rtl8723bs/hal/odm_DIG.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/odm_DIG.c 
b/drivers/staging/rtl8723bs/hal/odm_DIG.c
index 202c52f..0bde944 100644
--- a/drivers/staging/rtl8723bs/hal/odm_DIG.c
+++ b/drivers/staging/rtl8723bs/hal/odm_DIG.c
@@ -278,11 +278,11 @@ void odm_Adaptivity(void *pDM_VOID, u8 IGI)
 
if (!pDM_Odm->ForceEDCCA) {
if (pDM_Odm->RSSI_Min > pDM_Odm->AdapEn_RSSI)
-   EDCCA_State = 1;
+   EDCCA_State = true;
else if (pDM_Odm->RSSI_Min < (pDM_Odm->AdapEn_RSSI - 5))
-   EDCCA_State = 0;
+   EDCCA_State = false;
} else
-   EDCCA_State = 1;
+   EDCCA_State = true;
 
if (
pDM_Odm->bLinked &&
@@ -305,7 +305,7 @@ void odm_Adaptivity(void *pDM_VOID, u8 IGI)
)
);
 
-   if (EDCCA_State == 1) {
+   if (EDCCA_State) {
Diff = IGI_target-(s8)IGI;
TH_L2H_dmc = pDM_Odm->TH_L2H_ini + Diff;
if (TH_L2H_dmc > 10)
-- 
2.7.4



[PATCH] staging: sm750fb: Remove typedefs from _logical_chip_type_t and _clock_type_t

2017-06-19 Thread Simran Singhal
This patch removes typedefs from enum _logical_chip_type_t and enum
_clock_type_t and rename them to logical_chip_type_t and clock_type_t
respectively.

Fix checkpatch warning:
WARNING: do not add new typedefs

Signed-off-by: Simran Singhal <singhalsimr...@gmail.com>
---
 drivers/staging/sm750fb/ddk750_chip.c |  4 ++--
 drivers/staging/sm750fb/ddk750_chip.h | 14 ++
 drivers/staging/sm750fb/ddk750_mode.c |  2 +-
 drivers/staging/sm750fb/ddk750_mode.h |  2 +-
 drivers/staging/sm750fb/sm750_hw.c|  2 +-
 5 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.c 
b/drivers/staging/sm750fb/ddk750_chip.c
index 944dd25..db4d2fc 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -7,9 +7,9 @@
 
 #define MHz(x) ((x) * 100)
 
-static logical_chip_type_t chip;
+static enum logical_chip_type_t chip;
 
-logical_chip_type_t sm750_get_chip_type(void)
+enum logical_chip_type_t sm750_get_chip_type(void)
 {
return chip;
 }
diff --git a/drivers/staging/sm750fb/ddk750_chip.h 
b/drivers/staging/sm750fb/ddk750_chip.h
index 2c7a9b9..df1f586 100644
--- a/drivers/staging/sm750fb/ddk750_chip.h
+++ b/drivers/staging/sm750fb/ddk750_chip.h
@@ -23,25 +23,23 @@ static inline void poke32(u32 data, u32 addr)
 }
 
 /* This is all the chips recognized by this library */
-typedef enum _logical_chip_type_t {
+enum logical_chip_type_t {
SM_UNKNOWN,
SM718,
SM750,
SM750LE,
-}
-logical_chip_type_t;
+};
 
-typedef enum _clock_type_t {
+enum clock_type_t {
MXCLK_PLL,
PRIMARY_PLL,
SECONDARY_PLL,
VGA0_PLL,
VGA1_PLL,
-}
-clock_type_t;
+};
 
 struct pll_value {
-   clock_type_t clockType;
+   enum clock_type_t clockType;
unsigned long inputFreq; /* Input clock frequency to the PLL */
 
/* Use this when clockType = PANEL_PLL */
@@ -93,7 +91,7 @@ struct initchip_param {
/* More initialization parameter can be added if needed */
 };
 
-logical_chip_type_t sm750_get_chip_type(void);
+enum logical_chip_type_t sm750_get_chip_type(void);
 void sm750_set_chip_type(unsigned short devId, u8 revId);
 unsigned int sm750_calc_pll_value(unsigned int request, struct  pll_value 
*pll);
 unsigned int sm750_format_pll_reg(struct pll_value *pPLL);
diff --git a/drivers/staging/sm750fb/ddk750_mode.c 
b/drivers/staging/sm750fb/ddk750_mode.c
index bb673e1..6242770 100644
--- a/drivers/staging/sm750fb/ddk750_mode.c
+++ b/drivers/staging/sm750fb/ddk750_mode.c
@@ -205,7 +205,7 @@ static int programModeRegisters(struct mode_parameter 
*pModeParam,
return ret;
 }
 
-int ddk750_setModeTiming(struct mode_parameter *parm, clock_type_t clock)
+int ddk750_setModeTiming(struct mode_parameter *parm, enum clock_type_t clock)
 {
struct pll_value pll;
unsigned int uiActualPixelClk;
diff --git a/drivers/staging/sm750fb/ddk750_mode.h 
b/drivers/staging/sm750fb/ddk750_mode.h
index d5eae36..78a3cc7 100644
--- a/drivers/staging/sm750fb/ddk750_mode.h
+++ b/drivers/staging/sm750fb/ddk750_mode.h
@@ -32,5 +32,5 @@ struct mode_parameter {
enum spolarity clock_phase_polarity;
 };
 
-int ddk750_setModeTiming(struct mode_parameter *parm, clock_type_t clock);
+int ddk750_setModeTiming(struct mode_parameter *parm, enum clock_type_t clock);
 #endif
diff --git a/drivers/staging/sm750fb/sm750_hw.c 
b/drivers/staging/sm750fb/sm750_hw.c
index baf1bbd..8836e324 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -253,7 +253,7 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc *crtc,
int ret, fmt;
u32 reg;
struct mode_parameter modparm;
-   clock_type_t clock;
+   enum clock_type_t clock;
struct sm750_dev *sm750_dev;
struct lynxfb_par *par;
 
-- 
2.7.4



[PATCH] staging: sm750fb: Remove typedefs from _logical_chip_type_t and _clock_type_t

2017-06-19 Thread Simran Singhal
This patch removes typedefs from enum _logical_chip_type_t and enum
_clock_type_t and rename them to logical_chip_type_t and clock_type_t
respectively.

Fix checkpatch warning:
WARNING: do not add new typedefs

Signed-off-by: Simran Singhal 
---
 drivers/staging/sm750fb/ddk750_chip.c |  4 ++--
 drivers/staging/sm750fb/ddk750_chip.h | 14 ++
 drivers/staging/sm750fb/ddk750_mode.c |  2 +-
 drivers/staging/sm750fb/ddk750_mode.h |  2 +-
 drivers/staging/sm750fb/sm750_hw.c|  2 +-
 5 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.c 
b/drivers/staging/sm750fb/ddk750_chip.c
index 944dd25..db4d2fc 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -7,9 +7,9 @@
 
 #define MHz(x) ((x) * 100)
 
-static logical_chip_type_t chip;
+static enum logical_chip_type_t chip;
 
-logical_chip_type_t sm750_get_chip_type(void)
+enum logical_chip_type_t sm750_get_chip_type(void)
 {
return chip;
 }
diff --git a/drivers/staging/sm750fb/ddk750_chip.h 
b/drivers/staging/sm750fb/ddk750_chip.h
index 2c7a9b9..df1f586 100644
--- a/drivers/staging/sm750fb/ddk750_chip.h
+++ b/drivers/staging/sm750fb/ddk750_chip.h
@@ -23,25 +23,23 @@ static inline void poke32(u32 data, u32 addr)
 }
 
 /* This is all the chips recognized by this library */
-typedef enum _logical_chip_type_t {
+enum logical_chip_type_t {
SM_UNKNOWN,
SM718,
SM750,
SM750LE,
-}
-logical_chip_type_t;
+};
 
-typedef enum _clock_type_t {
+enum clock_type_t {
MXCLK_PLL,
PRIMARY_PLL,
SECONDARY_PLL,
VGA0_PLL,
VGA1_PLL,
-}
-clock_type_t;
+};
 
 struct pll_value {
-   clock_type_t clockType;
+   enum clock_type_t clockType;
unsigned long inputFreq; /* Input clock frequency to the PLL */
 
/* Use this when clockType = PANEL_PLL */
@@ -93,7 +91,7 @@ struct initchip_param {
/* More initialization parameter can be added if needed */
 };
 
-logical_chip_type_t sm750_get_chip_type(void);
+enum logical_chip_type_t sm750_get_chip_type(void);
 void sm750_set_chip_type(unsigned short devId, u8 revId);
 unsigned int sm750_calc_pll_value(unsigned int request, struct  pll_value 
*pll);
 unsigned int sm750_format_pll_reg(struct pll_value *pPLL);
diff --git a/drivers/staging/sm750fb/ddk750_mode.c 
b/drivers/staging/sm750fb/ddk750_mode.c
index bb673e1..6242770 100644
--- a/drivers/staging/sm750fb/ddk750_mode.c
+++ b/drivers/staging/sm750fb/ddk750_mode.c
@@ -205,7 +205,7 @@ static int programModeRegisters(struct mode_parameter 
*pModeParam,
return ret;
 }
 
-int ddk750_setModeTiming(struct mode_parameter *parm, clock_type_t clock)
+int ddk750_setModeTiming(struct mode_parameter *parm, enum clock_type_t clock)
 {
struct pll_value pll;
unsigned int uiActualPixelClk;
diff --git a/drivers/staging/sm750fb/ddk750_mode.h 
b/drivers/staging/sm750fb/ddk750_mode.h
index d5eae36..78a3cc7 100644
--- a/drivers/staging/sm750fb/ddk750_mode.h
+++ b/drivers/staging/sm750fb/ddk750_mode.h
@@ -32,5 +32,5 @@ struct mode_parameter {
enum spolarity clock_phase_polarity;
 };
 
-int ddk750_setModeTiming(struct mode_parameter *parm, clock_type_t clock);
+int ddk750_setModeTiming(struct mode_parameter *parm, enum clock_type_t clock);
 #endif
diff --git a/drivers/staging/sm750fb/sm750_hw.c 
b/drivers/staging/sm750fb/sm750_hw.c
index baf1bbd..8836e324 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -253,7 +253,7 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc *crtc,
int ret, fmt;
u32 reg;
struct mode_parameter modparm;
-   clock_type_t clock;
+   enum clock_type_t clock;
struct sm750_dev *sm750_dev;
struct lynxfb_par *par;
 
-- 
2.7.4



[PATCH] iio: pressure: zpa2326: Remove unnecessary cast on void pointer

2017-04-01 Thread simran singhal
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|
- (T*)
  e
)

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/iio/pressure/zpa2326.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/pressure/zpa2326.c b/drivers/iio/pressure/zpa2326.c
index c720c3a..e58a0ad 100644
--- a/drivers/iio/pressure/zpa2326.c
+++ b/drivers/iio/pressure/zpa2326.c
@@ -751,7 +751,7 @@ static void zpa2326_suspend(struct iio_dev *indio_dev)
  */
 static irqreturn_t zpa2326_handle_irq(int irq, void *data)
 {
-   struct iio_dev *indio_dev = (struct iio_dev *)data;
+   struct iio_dev *indio_dev = data;
 
if (iio_buffer_enabled(indio_dev)) {
/* Timestamping needed for buffered sampling only. */
@@ -790,7 +790,7 @@ static irqreturn_t zpa2326_handle_irq(int irq, void *data)
  */
 static irqreturn_t zpa2326_handle_threaded_irq(int irq, void *data)
 {
-   struct iio_dev *indio_dev = (struct iio_dev *)data;
+   struct iio_dev *indio_dev = data;
struct zpa2326_private *priv = iio_priv(indio_dev);
unsigned intval;
boolcont;
-- 
2.7.4



[PATCH] iio: pressure: zpa2326: Remove unnecessary cast on void pointer

2017-04-01 Thread simran singhal
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|
- (T*)
  e
)

Signed-off-by: simran singhal 
---
 drivers/iio/pressure/zpa2326.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/pressure/zpa2326.c b/drivers/iio/pressure/zpa2326.c
index c720c3a..e58a0ad 100644
--- a/drivers/iio/pressure/zpa2326.c
+++ b/drivers/iio/pressure/zpa2326.c
@@ -751,7 +751,7 @@ static void zpa2326_suspend(struct iio_dev *indio_dev)
  */
 static irqreturn_t zpa2326_handle_irq(int irq, void *data)
 {
-   struct iio_dev *indio_dev = (struct iio_dev *)data;
+   struct iio_dev *indio_dev = data;
 
if (iio_buffer_enabled(indio_dev)) {
/* Timestamping needed for buffered sampling only. */
@@ -790,7 +790,7 @@ static irqreturn_t zpa2326_handle_irq(int irq, void *data)
  */
 static irqreturn_t zpa2326_handle_threaded_irq(int irq, void *data)
 {
-   struct iio_dev *indio_dev = (struct iio_dev *)data;
+   struct iio_dev *indio_dev = data;
struct zpa2326_private *priv = iio_priv(indio_dev);
unsigned intval;
boolcont;
-- 
2.7.4



[PATCH] iio: imu: st_lsm6dsx: Remove unnecessary cast on void pointer

2017-04-01 Thread simran singhal
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|
- (T*)
  e
)

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c 
b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
index e11653d..f570b48 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
@@ -364,7 +364,7 @@ static int st_lsm6dsx_update_fifo(struct iio_dev *iio_dev, 
bool enable)
 
 static irqreturn_t st_lsm6dsx_handler_irq(int irq, void *private)
 {
-   struct st_lsm6dsx_hw *hw = (struct st_lsm6dsx_hw *)private;
+   struct st_lsm6dsx_hw *hw = private;
struct st_lsm6dsx_sensor *sensor;
int i;
 
@@ -388,7 +388,7 @@ static irqreturn_t st_lsm6dsx_handler_irq(int irq, void 
*private)
 
 static irqreturn_t st_lsm6dsx_handler_thread(int irq, void *private)
 {
-   struct st_lsm6dsx_hw *hw = (struct st_lsm6dsx_hw *)private;
+   struct st_lsm6dsx_hw *hw = private;
int count;
 
mutex_lock(>fifo_lock);
-- 
2.7.4



[PATCH] iio: imu: st_lsm6dsx: Remove unnecessary cast on void pointer

2017-04-01 Thread simran singhal
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|
- (T*)
  e
)

Signed-off-by: simran singhal 
---
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c 
b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
index e11653d..f570b48 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
@@ -364,7 +364,7 @@ static int st_lsm6dsx_update_fifo(struct iio_dev *iio_dev, 
bool enable)
 
 static irqreturn_t st_lsm6dsx_handler_irq(int irq, void *private)
 {
-   struct st_lsm6dsx_hw *hw = (struct st_lsm6dsx_hw *)private;
+   struct st_lsm6dsx_hw *hw = private;
struct st_lsm6dsx_sensor *sensor;
int i;
 
@@ -388,7 +388,7 @@ static irqreturn_t st_lsm6dsx_handler_irq(int irq, void 
*private)
 
 static irqreturn_t st_lsm6dsx_handler_thread(int irq, void *private)
 {
-   struct st_lsm6dsx_hw *hw = (struct st_lsm6dsx_hw *)private;
+   struct st_lsm6dsx_hw *hw = private;
int count;
 
mutex_lock(>fifo_lock);
-- 
2.7.4



[PATCH] iio: humidity: hts221_buffer: Remove unnecessary cast on void pointer

2017-04-01 Thread simran singhal
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|
- (T*)
  e
)

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/iio/humidity/hts221_buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/humidity/hts221_buffer.c 
b/drivers/iio/humidity/hts221_buffer.c
index 72ddcda..7d19a3d 100644
--- a/drivers/iio/humidity/hts221_buffer.c
+++ b/drivers/iio/humidity/hts221_buffer.c
@@ -41,7 +41,7 @@ static const struct iio_trigger_ops hts221_trigger_ops = {
 
 static irqreturn_t hts221_trigger_handler_thread(int irq, void *private)
 {
-   struct hts221_hw *hw = (struct hts221_hw *)private;
+   struct hts221_hw *hw = private;
u8 status;
int err;
 
-- 
2.7.4



[PATCH] iio: humidity: hts221_buffer: Remove unnecessary cast on void pointer

2017-04-01 Thread simran singhal
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|
- (T*)
  e
)

Signed-off-by: simran singhal 
---
 drivers/iio/humidity/hts221_buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/humidity/hts221_buffer.c 
b/drivers/iio/humidity/hts221_buffer.c
index 72ddcda..7d19a3d 100644
--- a/drivers/iio/humidity/hts221_buffer.c
+++ b/drivers/iio/humidity/hts221_buffer.c
@@ -41,7 +41,7 @@ static const struct iio_trigger_ops hts221_trigger_ops = {
 
 static irqreturn_t hts221_trigger_handler_thread(int irq, void *private)
 {
-   struct hts221_hw *hw = (struct hts221_hw *)private;
+   struct hts221_hw *hw = private;
u8 status;
int err;
 
-- 
2.7.4



[PATCH] iio: dac: ad5504: Remove unnecessary cast on void pointer

2017-04-01 Thread simran singhal
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|
- (T*)
  e
)

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/iio/dac/ad5504.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c
index 22a027d..712d86b 100644
--- a/drivers/iio/dac/ad5504.c
+++ b/drivers/iio/dac/ad5504.c
@@ -223,7 +223,7 @@ static irqreturn_t ad5504_event_handler(int irq, void 
*private)
0,
IIO_EV_TYPE_THRESH,
IIO_EV_DIR_RISING),
-  iio_get_time_ns((struct iio_dev *)private));
+  iio_get_time_ns(private));
 
return IRQ_HANDLED;
 }
-- 
2.7.4



[PATCH] iio: dac: ad5504: Remove unnecessary cast on void pointer

2017-04-01 Thread simran singhal
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|
- (T*)
  e
)

Signed-off-by: simran singhal 
---
 drivers/iio/dac/ad5504.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c
index 22a027d..712d86b 100644
--- a/drivers/iio/dac/ad5504.c
+++ b/drivers/iio/dac/ad5504.c
@@ -223,7 +223,7 @@ static irqreturn_t ad5504_event_handler(int irq, void 
*private)
0,
IIO_EV_TYPE_THRESH,
IIO_EV_DIR_RISING),
-  iio_get_time_ns((struct iio_dev *)private));
+  iio_get_time_ns(private));
 
return IRQ_HANDLED;
 }
-- 
2.7.4



[PATCH] iio: common: ms_sensors: Remove unnecessary cast on void pointer

2017-04-01 Thread simran singhal
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|
- (T*)
  e
)

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/iio/common/ms_sensors/ms_sensors_i2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/common/ms_sensors/ms_sensors_i2c.c 
b/drivers/iio/common/ms_sensors/ms_sensors_i2c.c
index ecf7721..125b5ff 100644
--- a/drivers/iio/common/ms_sensors/ms_sensors_i2c.c
+++ b/drivers/iio/common/ms_sensors/ms_sensors_i2c.c
@@ -74,7 +74,7 @@ EXPORT_SYMBOL(ms_sensors_reset);
 int ms_sensors_read_prom_word(void *cli, int cmd, u16 *word)
 {
int ret;
-   struct i2c_client *client = (struct i2c_client *)cli;
+   struct i2c_client *client = cli;
 
ret = i2c_smbus_read_word_swapped(client, cmd);
if (ret < 0) {
@@ -107,7 +107,7 @@ int ms_sensors_convert_and_read(void *cli, u8 conv, u8 rd,
 {
int ret;
__be32 buf = 0;
-   struct i2c_client *client = (struct i2c_client *)cli;
+   struct i2c_client *client = cli;
 
/* Trigger conversion */
ret = i2c_smbus_write_byte(client, conv);
-- 
2.7.4



[PATCH] iio: common: ms_sensors: Remove unnecessary cast on void pointer

2017-04-01 Thread simran singhal
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|
- (T*)
  e
)

Signed-off-by: simran singhal 
---
 drivers/iio/common/ms_sensors/ms_sensors_i2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/common/ms_sensors/ms_sensors_i2c.c 
b/drivers/iio/common/ms_sensors/ms_sensors_i2c.c
index ecf7721..125b5ff 100644
--- a/drivers/iio/common/ms_sensors/ms_sensors_i2c.c
+++ b/drivers/iio/common/ms_sensors/ms_sensors_i2c.c
@@ -74,7 +74,7 @@ EXPORT_SYMBOL(ms_sensors_reset);
 int ms_sensors_read_prom_word(void *cli, int cmd, u16 *word)
 {
int ret;
-   struct i2c_client *client = (struct i2c_client *)cli;
+   struct i2c_client *client = cli;
 
ret = i2c_smbus_read_word_swapped(client, cmd);
if (ret < 0) {
@@ -107,7 +107,7 @@ int ms_sensors_convert_and_read(void *cli, u8 conv, u8 rd,
 {
int ret;
__be32 buf = 0;
-   struct i2c_client *client = (struct i2c_client *)cli;
+   struct i2c_client *client = cli;
 
/* Trigger conversion */
ret = i2c_smbus_write_byte(client, conv);
-- 
2.7.4



[PATCH] iio: adc: Remove unnecessary cast on void pointer

2017-04-01 Thread simran singhal
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|
- (T*)
  e
)

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/iio/adc/exynos_adc.c  | 2 +-
 drivers/iio/adc/imx7d_adc.c   | 2 +-
 drivers/iio/adc/max1027.c | 2 +-
 drivers/iio/adc/rockchip_saradc.c | 2 +-
 drivers/iio/adc/sun4i-gpadc-iio.c | 2 +-
 drivers/iio/adc/vf610_adc.c   | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
index ad1775b..6c5a7be 100644
--- a/drivers/iio/adc/exynos_adc.c
+++ b/drivers/iio/adc/exynos_adc.c
@@ -579,7 +579,7 @@ static int exynos_read_s3c64xx_ts(struct iio_dev 
*indio_dev, int *x, int *y)
 
 static irqreturn_t exynos_adc_isr(int irq, void *dev_id)
 {
-   struct exynos_adc *info = (struct exynos_adc *)dev_id;
+   struct exynos_adc *info = dev_id;
u32 mask = info->data->mask;
 
/* Read value */
diff --git a/drivers/iio/adc/imx7d_adc.c b/drivers/iio/adc/imx7d_adc.c
index e2241ee..254b29a 100644
--- a/drivers/iio/adc/imx7d_adc.c
+++ b/drivers/iio/adc/imx7d_adc.c
@@ -365,7 +365,7 @@ static int imx7d_adc_read_data(struct imx7d_adc *info)
 
 static irqreturn_t imx7d_adc_isr(int irq, void *dev_id)
 {
-   struct imx7d_adc *info = (struct imx7d_adc *)dev_id;
+   struct imx7d_adc *info = dev_id;
int status;
 
status = readl(info->regs + IMX7D_REG_ADC_INT_STATUS);
diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
index 3b7c4f7..ebc7159 100644
--- a/drivers/iio/adc/max1027.c
+++ b/drivers/iio/adc/max1027.c
@@ -364,7 +364,7 @@ static int max1027_set_trigger_state(struct iio_trigger 
*trig, bool state)
 
 static irqreturn_t max1027_trigger_handler(int irq, void *private)
 {
-   struct iio_poll_func *pf = (struct iio_poll_func *)private;
+   struct iio_poll_func *pf = private;
struct iio_dev *indio_dev = pf->indio_dev;
struct max1027_state *st = iio_priv(indio_dev);
 
diff --git a/drivers/iio/adc/rockchip_saradc.c 
b/drivers/iio/adc/rockchip_saradc.c
index 85d7012..ae6d332 100644
--- a/drivers/iio/adc/rockchip_saradc.c
+++ b/drivers/iio/adc/rockchip_saradc.c
@@ -109,7 +109,7 @@ static int rockchip_saradc_read_raw(struct iio_dev 
*indio_dev,
 
 static irqreturn_t rockchip_saradc_isr(int irq, void *dev_id)
 {
-   struct rockchip_saradc *info = (struct rockchip_saradc *)dev_id;
+   struct rockchip_saradc *info = dev_id;
 
/* Read value */
info->last_val = readl_relaxed(info->regs + SARADC_DATA);
diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c 
b/drivers/iio/adc/sun4i-gpadc-iio.c
index a8e134f..e531825 100644
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
@@ -382,7 +382,7 @@ static int sun4i_gpadc_runtime_resume(struct device *dev)
 
 static int sun4i_gpadc_get_temp(void *data, int *temp)
 {
-   struct sun4i_gpadc_iio *info = (struct sun4i_gpadc_iio *)data;
+   struct sun4i_gpadc_iio *info = data;
int val, scale, offset;
 
if (sun4i_gpadc_temp_read(info->indio_dev, ))
diff --git a/drivers/iio/adc/vf610_adc.c b/drivers/iio/adc/vf610_adc.c
index 228a003..01fc76f 100644
--- a/drivers/iio/adc/vf610_adc.c
+++ b/drivers/iio/adc/vf610_adc.c
@@ -584,7 +584,7 @@ static int vf610_adc_read_data(struct vf610_adc *info)
 
 static irqreturn_t vf610_adc_isr(int irq, void *dev_id)
 {
-   struct iio_dev *indio_dev = (struct iio_dev *)dev_id;
+   struct iio_dev *indio_dev = dev_id;
struct vf610_adc *info = iio_priv(indio_dev);
int coco;
 
-- 
2.7.4



[PATCH] iio: adc: Remove unnecessary cast on void pointer

2017-04-01 Thread simran singhal
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|
- (T*)
  e
)

Signed-off-by: simran singhal 
---
 drivers/iio/adc/exynos_adc.c  | 2 +-
 drivers/iio/adc/imx7d_adc.c   | 2 +-
 drivers/iio/adc/max1027.c | 2 +-
 drivers/iio/adc/rockchip_saradc.c | 2 +-
 drivers/iio/adc/sun4i-gpadc-iio.c | 2 +-
 drivers/iio/adc/vf610_adc.c   | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
index ad1775b..6c5a7be 100644
--- a/drivers/iio/adc/exynos_adc.c
+++ b/drivers/iio/adc/exynos_adc.c
@@ -579,7 +579,7 @@ static int exynos_read_s3c64xx_ts(struct iio_dev 
*indio_dev, int *x, int *y)
 
 static irqreturn_t exynos_adc_isr(int irq, void *dev_id)
 {
-   struct exynos_adc *info = (struct exynos_adc *)dev_id;
+   struct exynos_adc *info = dev_id;
u32 mask = info->data->mask;
 
/* Read value */
diff --git a/drivers/iio/adc/imx7d_adc.c b/drivers/iio/adc/imx7d_adc.c
index e2241ee..254b29a 100644
--- a/drivers/iio/adc/imx7d_adc.c
+++ b/drivers/iio/adc/imx7d_adc.c
@@ -365,7 +365,7 @@ static int imx7d_adc_read_data(struct imx7d_adc *info)
 
 static irqreturn_t imx7d_adc_isr(int irq, void *dev_id)
 {
-   struct imx7d_adc *info = (struct imx7d_adc *)dev_id;
+   struct imx7d_adc *info = dev_id;
int status;
 
status = readl(info->regs + IMX7D_REG_ADC_INT_STATUS);
diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
index 3b7c4f7..ebc7159 100644
--- a/drivers/iio/adc/max1027.c
+++ b/drivers/iio/adc/max1027.c
@@ -364,7 +364,7 @@ static int max1027_set_trigger_state(struct iio_trigger 
*trig, bool state)
 
 static irqreturn_t max1027_trigger_handler(int irq, void *private)
 {
-   struct iio_poll_func *pf = (struct iio_poll_func *)private;
+   struct iio_poll_func *pf = private;
struct iio_dev *indio_dev = pf->indio_dev;
struct max1027_state *st = iio_priv(indio_dev);
 
diff --git a/drivers/iio/adc/rockchip_saradc.c 
b/drivers/iio/adc/rockchip_saradc.c
index 85d7012..ae6d332 100644
--- a/drivers/iio/adc/rockchip_saradc.c
+++ b/drivers/iio/adc/rockchip_saradc.c
@@ -109,7 +109,7 @@ static int rockchip_saradc_read_raw(struct iio_dev 
*indio_dev,
 
 static irqreturn_t rockchip_saradc_isr(int irq, void *dev_id)
 {
-   struct rockchip_saradc *info = (struct rockchip_saradc *)dev_id;
+   struct rockchip_saradc *info = dev_id;
 
/* Read value */
info->last_val = readl_relaxed(info->regs + SARADC_DATA);
diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c 
b/drivers/iio/adc/sun4i-gpadc-iio.c
index a8e134f..e531825 100644
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
@@ -382,7 +382,7 @@ static int sun4i_gpadc_runtime_resume(struct device *dev)
 
 static int sun4i_gpadc_get_temp(void *data, int *temp)
 {
-   struct sun4i_gpadc_iio *info = (struct sun4i_gpadc_iio *)data;
+   struct sun4i_gpadc_iio *info = data;
int val, scale, offset;
 
if (sun4i_gpadc_temp_read(info->indio_dev, ))
diff --git a/drivers/iio/adc/vf610_adc.c b/drivers/iio/adc/vf610_adc.c
index 228a003..01fc76f 100644
--- a/drivers/iio/adc/vf610_adc.c
+++ b/drivers/iio/adc/vf610_adc.c
@@ -584,7 +584,7 @@ static int vf610_adc_read_data(struct vf610_adc *info)
 
 static irqreturn_t vf610_adc_isr(int irq, void *dev_id)
 {
-   struct iio_dev *indio_dev = (struct iio_dev *)dev_id;
+   struct iio_dev *indio_dev = dev_id;
struct vf610_adc *info = iio_priv(indio_dev);
int coco;
 
-- 
2.7.4



[PATCH] net: ipv4: netfilter: Remove unused function nf_nat_need_gre()

2017-04-01 Thread simran singhal
The function nf_nat_need_gre() on being called, simply returns
back. The function doesn't have FIXME code around.
Hence, nf_nat_need_gre() and its calls have been removed.

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 net/ipv4/netfilter/nf_nat_pptp.c  | 2 --
 net/ipv4/netfilter/nf_nat_proto_gre.c | 6 --
 2 files changed, 8 deletions(-)

diff --git a/net/ipv4/netfilter/nf_nat_pptp.c b/net/ipv4/netfilter/nf_nat_pptp.c
index b3ca21b..747e737 100644
--- a/net/ipv4/netfilter/nf_nat_pptp.c
+++ b/net/ipv4/netfilter/nf_nat_pptp.c
@@ -282,8 +282,6 @@ pptp_inbound_pkt(struct sk_buff *skb,
 
 static int __init nf_nat_helper_pptp_init(void)
 {
-   nf_nat_need_gre();
-
BUG_ON(nf_nat_pptp_hook_outbound != NULL);
RCU_INIT_POINTER(nf_nat_pptp_hook_outbound, pptp_outbound_pkt);
 
diff --git a/net/ipv4/netfilter/nf_nat_proto_gre.c 
b/net/ipv4/netfilter/nf_nat_proto_gre.c
index edf0500..c020a4d 100644
--- a/net/ipv4/netfilter/nf_nat_proto_gre.c
+++ b/net/ipv4/netfilter/nf_nat_proto_gre.c
@@ -142,9 +142,3 @@ static void __exit nf_nat_proto_gre_fini(void)
 
 module_init(nf_nat_proto_gre_init);
 module_exit(nf_nat_proto_gre_fini);
-
-void nf_nat_need_gre(void)
-{
-   return;
-}
-EXPORT_SYMBOL_GPL(nf_nat_need_gre);
-- 
2.7.4



[PATCH] net: ipv4: netfilter: Remove unused function nf_nat_need_gre()

2017-04-01 Thread simran singhal
The function nf_nat_need_gre() on being called, simply returns
back. The function doesn't have FIXME code around.
Hence, nf_nat_need_gre() and its calls have been removed.

Signed-off-by: simran singhal 
---
 net/ipv4/netfilter/nf_nat_pptp.c  | 2 --
 net/ipv4/netfilter/nf_nat_proto_gre.c | 6 --
 2 files changed, 8 deletions(-)

diff --git a/net/ipv4/netfilter/nf_nat_pptp.c b/net/ipv4/netfilter/nf_nat_pptp.c
index b3ca21b..747e737 100644
--- a/net/ipv4/netfilter/nf_nat_pptp.c
+++ b/net/ipv4/netfilter/nf_nat_pptp.c
@@ -282,8 +282,6 @@ pptp_inbound_pkt(struct sk_buff *skb,
 
 static int __init nf_nat_helper_pptp_init(void)
 {
-   nf_nat_need_gre();
-
BUG_ON(nf_nat_pptp_hook_outbound != NULL);
RCU_INIT_POINTER(nf_nat_pptp_hook_outbound, pptp_outbound_pkt);
 
diff --git a/net/ipv4/netfilter/nf_nat_proto_gre.c 
b/net/ipv4/netfilter/nf_nat_proto_gre.c
index edf0500..c020a4d 100644
--- a/net/ipv4/netfilter/nf_nat_proto_gre.c
+++ b/net/ipv4/netfilter/nf_nat_proto_gre.c
@@ -142,9 +142,3 @@ static void __exit nf_nat_proto_gre_fini(void)
 
 module_init(nf_nat_proto_gre_init);
 module_exit(nf_nat_proto_gre_fini);
-
-void nf_nat_need_gre(void)
-{
-   return;
-}
-EXPORT_SYMBOL_GPL(nf_nat_need_gre);
-- 
2.7.4



[PATCH] iio: proximity: as3935: constify attribute_group structures

2017-04-01 Thread simran singhal
Check for attribute_group structures that are only stored in the
attrs filed of iio_info structure. As the attrs field of iio_info
structures is constant, so these attribute_group structures can also be
declared constant.
Done using coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};

@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.attrs=@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;

File size before:
   textdata bss dec hex filename
   4037 288   0432510e5 drivers/iio/proximity/as3935.o

File size after:
   textdata bss dec hex filename
   4101 256   043571105 drivers/iio/proximity/as3935.o

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/iio/proximity/as3935.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c
index 5656deb..1b8b472 100644
--- a/drivers/iio/proximity/as3935.c
+++ b/drivers/iio/proximity/as3935.c
@@ -155,7 +155,7 @@ static struct attribute *as3935_attributes[] = {
NULL,
 };
 
-static struct attribute_group as3935_attribute_group = {
+static const struct attribute_group as3935_attribute_group = {
.attrs = as3935_attributes,
 };
 
-- 
2.7.4



[PATCH] iio: proximity: as3935: constify attribute_group structures

2017-04-01 Thread simran singhal
Check for attribute_group structures that are only stored in the
attrs filed of iio_info structure. As the attrs field of iio_info
structures is constant, so these attribute_group structures can also be
declared constant.
Done using coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};

@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.attrs=@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;

File size before:
   textdata bss dec hex filename
   4037 288   0432510e5 drivers/iio/proximity/as3935.o

File size after:
   textdata bss dec hex filename
   4101 256   043571105 drivers/iio/proximity/as3935.o

Signed-off-by: simran singhal 
---
 drivers/iio/proximity/as3935.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c
index 5656deb..1b8b472 100644
--- a/drivers/iio/proximity/as3935.c
+++ b/drivers/iio/proximity/as3935.c
@@ -155,7 +155,7 @@ static struct attribute *as3935_attributes[] = {
NULL,
 };
 
-static struct attribute_group as3935_attribute_group = {
+static const struct attribute_group as3935_attribute_group = {
.attrs = as3935_attributes,
 };
 
-- 
2.7.4



[PATCH] iio: light: bh1750: constify attribute_group structures

2017-04-01 Thread simran singhal
Check for attribute_group structures that are only stored in the
attrs filed of iio_info structure. As the attrs field of iio_info
structures is constant, so these attribute_group structures can also be
declared constant.
Done using coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};

@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.attrs=@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;

File size before:
   textdata bss dec hex filename
   2276 352   02628 a44 drivers/iio/light/bh1750.o

File size after:
   textdata bss dec hex filename
   2340 320   02660 a64 drivers/iio/light/bh1750.o

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/iio/light/bh1750.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/light/bh1750.c b/drivers/iio/light/bh1750.c
index b059466..6c61187 100644
--- a/drivers/iio/light/bh1750.c
+++ b/drivers/iio/light/bh1750.c
@@ -212,7 +212,7 @@ static struct attribute *bh1750_attributes[] = {
NULL,
 };
 
-static struct attribute_group bh1750_attribute_group = {
+static const struct attribute_group bh1750_attribute_group = {
.attrs = bh1750_attributes,
 };
 
-- 
2.7.4



[PATCH] iio: light: bh1750: constify attribute_group structures

2017-04-01 Thread simran singhal
Check for attribute_group structures that are only stored in the
attrs filed of iio_info structure. As the attrs field of iio_info
structures is constant, so these attribute_group structures can also be
declared constant.
Done using coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};

@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.attrs=@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;

File size before:
   textdata bss dec hex filename
   2276 352   02628 a44 drivers/iio/light/bh1750.o

File size after:
   textdata bss dec hex filename
   2340 320   02660 a64 drivers/iio/light/bh1750.o

Signed-off-by: simran singhal 
---
 drivers/iio/light/bh1750.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/light/bh1750.c b/drivers/iio/light/bh1750.c
index b059466..6c61187 100644
--- a/drivers/iio/light/bh1750.c
+++ b/drivers/iio/light/bh1750.c
@@ -212,7 +212,7 @@ static struct attribute *bh1750_attributes[] = {
NULL,
 };
 
-static struct attribute_group bh1750_attribute_group = {
+static const struct attribute_group bh1750_attribute_group = {
.attrs = bh1750_attributes,
 };
 
-- 
2.7.4



[PATCH] iio: light: apds9960: constify attribute_group structures

2017-04-01 Thread simran singhal
Check for attribute_group structures that are only stored in the
attrs filed of iio_info structure. As the attrs field of iio_info
structures is constant, so these attribute_group structures can also be
declared constant.
Done using coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};

@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.attrs=@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;

File size before:
   textdata bss dec hex filename
   8503 488   08991231f drivers/iio/light/apds9960.o

File size after:
   textdata bss dec hex filename
   8567 424   08991231f drivers/iio/light/apds9960.o

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/iio/light/apds9960.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/light/apds9960.c b/drivers/iio/light/apds9960.c
index 90bc98d..c7af36d 100644
--- a/drivers/iio/light/apds9960.c
+++ b/drivers/iio/light/apds9960.c
@@ -343,7 +343,7 @@ static struct attribute *apds9960_attributes[] = {
NULL,
 };
 
-static struct attribute_group apds9960_attribute_group = {
+static const struct attribute_group apds9960_attribute_group = {
.attrs = apds9960_attributes,
 };
 
-- 
2.7.4



[PATCH] iio: light: apds9960: constify attribute_group structures

2017-04-01 Thread simran singhal
Check for attribute_group structures that are only stored in the
attrs filed of iio_info structure. As the attrs field of iio_info
structures is constant, so these attribute_group structures can also be
declared constant.
Done using coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};

@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.attrs=@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;

File size before:
   textdata bss dec hex filename
   8503 488   08991231f drivers/iio/light/apds9960.o

File size after:
   textdata bss dec hex filename
   8567 424   08991231f drivers/iio/light/apds9960.o

Signed-off-by: simran singhal 
---
 drivers/iio/light/apds9960.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/light/apds9960.c b/drivers/iio/light/apds9960.c
index 90bc98d..c7af36d 100644
--- a/drivers/iio/light/apds9960.c
+++ b/drivers/iio/light/apds9960.c
@@ -343,7 +343,7 @@ static struct attribute *apds9960_attributes[] = {
NULL,
 };
 
-static struct attribute_group apds9960_attribute_group = {
+static const struct attribute_group apds9960_attribute_group = {
.attrs = apds9960_attributes,
 };
 
-- 
2.7.4



[PATCH] iio: humidity: hdc100x: constify attribute_group structures

2017-04-01 Thread simran singhal
Check for attribute_group structures that are only stored in the
attrs filed of iio_info structure. As the attrs field of iio_info
structures is constant, so these attribute_group structures can also be
declared constant.
Done using coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};

@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.attrs=@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;

File size before:
   textdata bss dec hex filename
   3459 488   03947 f6b drivers/iio/humidity/hdc100x.o

File size after:
   textdata bss dec hex filename
   3507 424   03931 f5b drivers/iio/humidity/hdc100x.o

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/iio/humidity/hdc100x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/humidity/hdc100x.c b/drivers/iio/humidity/hdc100x.c
index 265c34d..aa17115 100644
--- a/drivers/iio/humidity/hdc100x.c
+++ b/drivers/iio/humidity/hdc100x.c
@@ -79,7 +79,7 @@ static struct attribute *hdc100x_attributes[] = {
NULL
 };
 
-static struct attribute_group hdc100x_attribute_group = {
+static const struct attribute_group hdc100x_attribute_group = {
.attrs = hdc100x_attributes,
 };
 
-- 
2.7.4



[PATCH] iio: humidity: hdc100x: constify attribute_group structures

2017-04-01 Thread simran singhal
Check for attribute_group structures that are only stored in the
attrs filed of iio_info structure. As the attrs field of iio_info
structures is constant, so these attribute_group structures can also be
declared constant.
Done using coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};

@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.attrs=@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;

File size before:
   textdata bss dec hex filename
   3459 488   03947 f6b drivers/iio/humidity/hdc100x.o

File size after:
   textdata bss dec hex filename
   3507 424   03931 f5b drivers/iio/humidity/hdc100x.o

Signed-off-by: simran singhal 
---
 drivers/iio/humidity/hdc100x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/humidity/hdc100x.c b/drivers/iio/humidity/hdc100x.c
index 265c34d..aa17115 100644
--- a/drivers/iio/humidity/hdc100x.c
+++ b/drivers/iio/humidity/hdc100x.c
@@ -79,7 +79,7 @@ static struct attribute *hdc100x_attributes[] = {
NULL
 };
 
-static struct attribute_group hdc100x_attribute_group = {
+static const struct attribute_group hdc100x_attribute_group = {
.attrs = hdc100x_attributes,
 };
 
-- 
2.7.4



[PATCH] iio: adc: hx711: constify attribute_group structures

2017-04-01 Thread simran singhal
Check for attribute_group structures that are only stored in the
attrs filed of iio_info structure. As the attrs field of iio_info
structures is constant, so these attribute_group structures can also be
declared constant.
Done using coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};

@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.attrs=@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;

File size before:
   textdata bss dec hex filename
   3042 480   03522 dc2 drivers/iio/adc/hx711.o

File size after:
   textdata bss dec hex filename
   3098 416   03514 dba drivers/iio/adc/hx711.o

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/iio/adc/hx711.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/hx711.c b/drivers/iio/adc/hx711.c
index 139639f..27005d8 100644
--- a/drivers/iio/adc/hx711.c
+++ b/drivers/iio/adc/hx711.c
@@ -369,7 +369,7 @@ static struct attribute *hx711_attributes[] = {
NULL,
 };
 
-static struct attribute_group hx711_attribute_group = {
+static const struct attribute_group hx711_attribute_group = {
.attrs = hx711_attributes,
 };
 
-- 
2.7.4



[PATCH] iio: adc: hx711: constify attribute_group structures

2017-04-01 Thread simran singhal
Check for attribute_group structures that are only stored in the
attrs filed of iio_info structure. As the attrs field of iio_info
structures is constant, so these attribute_group structures can also be
declared constant.
Done using coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};

@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.attrs=@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;

File size before:
   textdata bss dec hex filename
   3042 480   03522 dc2 drivers/iio/adc/hx711.o

File size after:
   textdata bss dec hex filename
   3098 416   03514 dba drivers/iio/adc/hx711.o

Signed-off-by: simran singhal 
---
 drivers/iio/adc/hx711.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/hx711.c b/drivers/iio/adc/hx711.c
index 139639f..27005d8 100644
--- a/drivers/iio/adc/hx711.c
+++ b/drivers/iio/adc/hx711.c
@@ -369,7 +369,7 @@ static struct attribute *hx711_attributes[] = {
NULL,
 };
 
-static struct attribute_group hx711_attribute_group = {
+static const struct attribute_group hx711_attribute_group = {
.attrs = hx711_attributes,
 };
 
-- 
2.7.4



[PATCH] staging: iio: light: constify attribute_group structures

2017-03-31 Thread simran singhal
As the event_attrs field of iio_info structures is constant, so these
attribute_group structures can also be declared constant.

File size before:
   textdata bss dec hex filename
  150641528   0   1659240d0
drivers/staging/iio/light/tsl2x7x_core.o

File size after:
   textdata bss dec hex filename
  151921400   0   1659240d0
drivers/staging/iio/light/tsl2x7x_core.o

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/staging/iio/light/tsl2x7x_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/light/tsl2x7x_core.c 
b/drivers/staging/iio/light/tsl2x7x_core.c
index 0490c1d..9a0046a 100644
--- a/drivers/staging/iio/light/tsl2x7x_core.c
+++ b/drivers/staging/iio/light/tsl2x7x_core.c
@@ -1676,7 +1676,7 @@ static const struct attribute_group 
tsl2X7X_device_attr_group_tbl[] = {
},
 };
 
-static struct attribute_group tsl2X7X_event_attr_group_tbl[] = {
+static const struct attribute_group tsl2X7X_event_attr_group_tbl[] = {
[ALS] = {
.attrs = tsl2X7X_ALS_event_attrs,
.name = "events",
-- 
2.7.4



[PATCH] staging: iio: light: constify attribute_group structures

2017-03-31 Thread simran singhal
As the event_attrs field of iio_info structures is constant, so these
attribute_group structures can also be declared constant.

File size before:
   textdata bss dec hex filename
  150641528   0   1659240d0
drivers/staging/iio/light/tsl2x7x_core.o

File size after:
   textdata bss dec hex filename
  151921400   0   1659240d0
drivers/staging/iio/light/tsl2x7x_core.o

Signed-off-by: simran singhal 
---
 drivers/staging/iio/light/tsl2x7x_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/light/tsl2x7x_core.c 
b/drivers/staging/iio/light/tsl2x7x_core.c
index 0490c1d..9a0046a 100644
--- a/drivers/staging/iio/light/tsl2x7x_core.c
+++ b/drivers/staging/iio/light/tsl2x7x_core.c
@@ -1676,7 +1676,7 @@ static const struct attribute_group 
tsl2X7X_device_attr_group_tbl[] = {
},
 };
 
-static struct attribute_group tsl2X7X_event_attr_group_tbl[] = {
+static const struct attribute_group tsl2X7X_event_attr_group_tbl[] = {
[ALS] = {
.attrs = tsl2X7X_ALS_event_attrs,
.name = "events",
-- 
2.7.4



Re: [PATCH 1/3] iio: health: afe440x: Remove code in comments

2017-03-31 Thread SIMRAN SINGHAL
Please ignore this Patch. This Patch is wrong.

On Sat, Apr 1, 2017 at 12:20 AM, Joe Perches <j...@perches.com> wrote:
> On Sat, 2017-04-01 at 00:13 +0530, SIMRAN SINGHAL wrote:
>> On Sat, Apr 1, 2017 at 12:03 AM, Joe Perches <j...@perches.com> wrote:
>> > On Fri, 2017-03-31 at 22:16 +0530, simran singhal wrote:
>> > > Commenting out code is a bad idea.
>> > > As comments are for explaining what code is about.
>> >
>> > patch doesn't match commit message.
>>
>> In commit message I am clearly saying commenting out the code is a bad Idea.
>> As comments are for explaining what code is about.
>> And that's what I am doing in the patch deleting the commented codes.
>>
>> My subject also says "Remove code in comments"
>>
>> Than what is not matching?
>
> Read your own patch.
>
> You are removing #defines not comments.
>
> If the whole thing is in comments, then
> the #defines immediately above what you
> are removing should also be deleted.
>
>> >
>> > > Signed-off-by: simran singhal <singhalsimr...@gmail.com>
>> > > ---
>> > >  drivers/iio/health/afe440x.h | 58 
>> > > 
>> > >  1 file changed, 58 deletions(-)
>> > >
>> > > diff --git a/drivers/iio/health/afe440x.h b/drivers/iio/health/afe440x.h
>> > > index 1a0f247..71e2f0e 100644
>> > > --- a/drivers/iio/health/afe440x.h
>> > > +++ b/drivers/iio/health/afe440x.h
>> > > @@ -88,56 +88,11 @@
>> > >  #define AFE440X_CONTROL0_WRITE   0x0
>> > >  #define AFE440X_CONTROL0_READ0x1
>> > >
>> > > -#define AFE440X_INTENSITY_CHAN(_index, _mask)\
>> > > - {   \
>> > > - .type = IIO_INTENSITY,  \
>> > > - .channel = _index,  \
>> > > - .address = _index,  \
>> > > - .scan_index = _index,   \
>> > > - .scan_type = {  \
>> > > - .sign = 's',\
>> > > - .realbits = 24, \
>> > > - .storagebits = 32,  \
>> > > - .endianness = IIO_CPU,  \
>> > > - },  \
>> > > - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |  \
>> > > - _mask,  \
>> > > - .indexed = true,\
>> > > - }
>> > > -
>> > > -#define AFE440X_CURRENT_CHAN(_index) \
>> > > - {   \
>> > > - .type = IIO_CURRENT,\
>> > > - .channel = _index,  \
>> > > - .address = _index,  \
>> > > - .scan_index = -1,   \
>> > > - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |  \
>> > > - BIT(IIO_CHAN_INFO_SCALE),   \
>> > > - .indexed = true,\
>> > > - .output = true, \
>> > > - }
>> > > -
>> > >  struct afe440x_val_table {
>> > >   int integer;
>> > >   int fract;
>> > >  };
>> > >
>> > > -#define AFE440X_TABLE_ATTR(_name, _table)\
>> > > -static ssize_t _name ## _show(struct device *dev,\
>> > > -   struct device_attribute *attr, char *buf) \
>> > > -{\
>> > > - ssize_t len = 0;\
>> > > - int i;  \
>> > > - \
>> > > - for (i = 0; i < ARRAY_SIZE(_table); i++)\
>> > > - len += scnprintf(buf + len, P

Re: [PATCH 1/3] iio: health: afe440x: Remove code in comments

2017-03-31 Thread SIMRAN SINGHAL
Please ignore this Patch. This Patch is wrong.

On Sat, Apr 1, 2017 at 12:20 AM, Joe Perches  wrote:
> On Sat, 2017-04-01 at 00:13 +0530, SIMRAN SINGHAL wrote:
>> On Sat, Apr 1, 2017 at 12:03 AM, Joe Perches  wrote:
>> > On Fri, 2017-03-31 at 22:16 +0530, simran singhal wrote:
>> > > Commenting out code is a bad idea.
>> > > As comments are for explaining what code is about.
>> >
>> > patch doesn't match commit message.
>>
>> In commit message I am clearly saying commenting out the code is a bad Idea.
>> As comments are for explaining what code is about.
>> And that's what I am doing in the patch deleting the commented codes.
>>
>> My subject also says "Remove code in comments"
>>
>> Than what is not matching?
>
> Read your own patch.
>
> You are removing #defines not comments.
>
> If the whole thing is in comments, then
> the #defines immediately above what you
> are removing should also be deleted.
>
>> >
>> > > Signed-off-by: simran singhal 
>> > > ---
>> > >  drivers/iio/health/afe440x.h | 58 
>> > > 
>> > >  1 file changed, 58 deletions(-)
>> > >
>> > > diff --git a/drivers/iio/health/afe440x.h b/drivers/iio/health/afe440x.h
>> > > index 1a0f247..71e2f0e 100644
>> > > --- a/drivers/iio/health/afe440x.h
>> > > +++ b/drivers/iio/health/afe440x.h
>> > > @@ -88,56 +88,11 @@
>> > >  #define AFE440X_CONTROL0_WRITE   0x0
>> > >  #define AFE440X_CONTROL0_READ0x1
>> > >
>> > > -#define AFE440X_INTENSITY_CHAN(_index, _mask)\
>> > > - {   \
>> > > - .type = IIO_INTENSITY,  \
>> > > - .channel = _index,  \
>> > > - .address = _index,  \
>> > > - .scan_index = _index,   \
>> > > - .scan_type = {  \
>> > > - .sign = 's',\
>> > > - .realbits = 24, \
>> > > - .storagebits = 32,  \
>> > > - .endianness = IIO_CPU,  \
>> > > - },  \
>> > > - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |  \
>> > > - _mask,  \
>> > > - .indexed = true,\
>> > > - }
>> > > -
>> > > -#define AFE440X_CURRENT_CHAN(_index) \
>> > > - {   \
>> > > - .type = IIO_CURRENT,\
>> > > - .channel = _index,  \
>> > > - .address = _index,  \
>> > > - .scan_index = -1,   \
>> > > - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |  \
>> > > - BIT(IIO_CHAN_INFO_SCALE),   \
>> > > - .indexed = true,\
>> > > - .output = true, \
>> > > - }
>> > > -
>> > >  struct afe440x_val_table {
>> > >   int integer;
>> > >   int fract;
>> > >  };
>> > >
>> > > -#define AFE440X_TABLE_ATTR(_name, _table)\
>> > > -static ssize_t _name ## _show(struct device *dev,\
>> > > -   struct device_attribute *attr, char *buf) \
>> > > -{\
>> > > - ssize_t len = 0;\
>> > > - int i;  \
>> > > - \
>> > > - for (i = 0; i < ARRAY_SIZE(_table); i++)\
>> > > - len += scnprintf(buf + len, PAGE_SIZE - len, "%d.%06u ", \
>> > > 

Re: [PATCH 0/3] iio: health: Clean up

2017-03-31 Thread SIMRAN SINGHAL
Please ignore this Patch. As this patch is completely wrong due to
my lack of understanding.

On Fri, Mar 31, 2017 at 10:16 PM, simran singhal
<singhalsimr...@gmail.com> wrote:
> This patch-series removes commented code in afe440x.h and
> removes unused functions in afe4404.c and afe4403.c.
>
> simran singhal (3):
>   iio: health: afe440x: Remove code in comments
>   iio: health: afe4404: Remove all unused functions
>   iio: health: afe4403: Remove all unused functions
>
>  drivers/iio/health/afe4403.c | 51 --
>  drivers/iio/health/afe4404.c | 51 --
>  drivers/iio/health/afe440x.h | 58 
> 
>  3 files changed, 160 deletions(-)
>
> --
> 2.7.4
>


Re: [PATCH 0/3] iio: health: Clean up

2017-03-31 Thread SIMRAN SINGHAL
Please ignore this Patch. As this patch is completely wrong due to
my lack of understanding.

On Fri, Mar 31, 2017 at 10:16 PM, simran singhal
 wrote:
> This patch-series removes commented code in afe440x.h and
> removes unused functions in afe4404.c and afe4403.c.
>
> simran singhal (3):
>   iio: health: afe440x: Remove code in comments
>   iio: health: afe4404: Remove all unused functions
>   iio: health: afe4403: Remove all unused functions
>
>  drivers/iio/health/afe4403.c | 51 --
>  drivers/iio/health/afe4404.c | 51 --
>  drivers/iio/health/afe440x.h | 58 
> 
>  3 files changed, 160 deletions(-)
>
> --
> 2.7.4
>


Re: [PATCH 1/3] iio: health: afe440x: Remove code in comments

2017-03-31 Thread SIMRAN SINGHAL
On Sat, Apr 1, 2017 at 12:03 AM, Joe Perches <j...@perches.com> wrote:
> On Fri, 2017-03-31 at 22:16 +0530, simran singhal wrote:
>> Commenting out code is a bad idea.
>> As comments are for explaining what code is about.
>
> patch doesn't match commit message.

In commit message I am clearly saying commenting out the code is a bad Idea.
As comments are for explaining what code is about.
And that's what I am doing in the patch deleting the commented codes.

My subject also says "Remove code in comments"

Than what is not matching?

>
>> Signed-off-by: simran singhal <singhalsimr...@gmail.com>
>> ---
>>  drivers/iio/health/afe440x.h | 58 
>> 
>>  1 file changed, 58 deletions(-)
>>
>> diff --git a/drivers/iio/health/afe440x.h b/drivers/iio/health/afe440x.h
>> index 1a0f247..71e2f0e 100644
>> --- a/drivers/iio/health/afe440x.h
>> +++ b/drivers/iio/health/afe440x.h
>> @@ -88,56 +88,11 @@
>>  #define AFE440X_CONTROL0_WRITE   0x0
>>  #define AFE440X_CONTROL0_READ0x1
>>
>> -#define AFE440X_INTENSITY_CHAN(_index, _mask)\
>> - {   \
>> - .type = IIO_INTENSITY,  \
>> - .channel = _index,  \
>> - .address = _index,  \
>> - .scan_index = _index,   \
>> - .scan_type = {  \
>> - .sign = 's',\
>> - .realbits = 24, \
>> - .storagebits = 32,  \
>> - .endianness = IIO_CPU,  \
>> - },  \
>> - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |  \
>> - _mask,  \
>> - .indexed = true,\
>> - }
>> -
>> -#define AFE440X_CURRENT_CHAN(_index) \
>> - {   \
>> - .type = IIO_CURRENT,\
>> - .channel = _index,  \
>> - .address = _index,  \
>> - .scan_index = -1,   \
>> - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |  \
>> - BIT(IIO_CHAN_INFO_SCALE),   \
>> - .indexed = true,\
>> - .output = true, \
>> - }
>> -
>>  struct afe440x_val_table {
>>   int integer;
>>   int fract;
>>  };
>>
>> -#define AFE440X_TABLE_ATTR(_name, _table)\
>> -static ssize_t _name ## _show(struct device *dev,\
>> -   struct device_attribute *attr, char *buf) \
>> -{\
>> - ssize_t len = 0;\
>> - int i;  \
>> - \
>> - for (i = 0; i < ARRAY_SIZE(_table); i++)\
>> - len += scnprintf(buf + len, PAGE_SIZE - len, "%d.%06u ", \
>> -  _table[i].integer, \
>> -  _table[i].fract);  \
>> - \
>> - buf[len - 1] = '\n';\
>> - \
>> - return len; \
>> -}\
>>  static DEVICE_ATTR_RO(_name)
>>
>>  struct afe440x_attr {
>> @@ -147,17 +102,4 @@ struct afe440x_attr {
>>   unsigned int table_size;
>>  };
>>
>> -#define to_afe440x_attr(_dev_attr)   \
>> - container_of(_dev_attr, struct afe440x_attr, dev_attr)
>> -
>> -#define AFE440X_ATTR(_name, _field, _table)  \
>> - struct afe440x_attr afe440x_attr_##_name = {\
>> - .dev_attr = __ATTR(_name, (S_IRUGO | S_IWUSR),  \
>> -afe440x_show_register,   \
>> -afe440x_store_register), \
>> - .field = _field,\
>> - .val_table = _table,\
>> - .table_size = ARRAY_SIZE(_table),   \
>> - }
>> -
>>  #endif /* _AFE440X_H */


Re: [PATCH 1/3] iio: health: afe440x: Remove code in comments

2017-03-31 Thread SIMRAN SINGHAL
On Sat, Apr 1, 2017 at 12:03 AM, Joe Perches  wrote:
> On Fri, 2017-03-31 at 22:16 +0530, simran singhal wrote:
>> Commenting out code is a bad idea.
>> As comments are for explaining what code is about.
>
> patch doesn't match commit message.

In commit message I am clearly saying commenting out the code is a bad Idea.
As comments are for explaining what code is about.
And that's what I am doing in the patch deleting the commented codes.

My subject also says "Remove code in comments"

Than what is not matching?

>
>> Signed-off-by: simran singhal 
>> ---
>>  drivers/iio/health/afe440x.h | 58 
>> 
>>  1 file changed, 58 deletions(-)
>>
>> diff --git a/drivers/iio/health/afe440x.h b/drivers/iio/health/afe440x.h
>> index 1a0f247..71e2f0e 100644
>> --- a/drivers/iio/health/afe440x.h
>> +++ b/drivers/iio/health/afe440x.h
>> @@ -88,56 +88,11 @@
>>  #define AFE440X_CONTROL0_WRITE   0x0
>>  #define AFE440X_CONTROL0_READ0x1
>>
>> -#define AFE440X_INTENSITY_CHAN(_index, _mask)\
>> - {   \
>> - .type = IIO_INTENSITY,  \
>> - .channel = _index,  \
>> - .address = _index,  \
>> - .scan_index = _index,   \
>> - .scan_type = {  \
>> - .sign = 's',\
>> - .realbits = 24, \
>> - .storagebits = 32,  \
>> - .endianness = IIO_CPU,  \
>> - },  \
>> - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |  \
>> - _mask,  \
>> - .indexed = true,\
>> - }
>> -
>> -#define AFE440X_CURRENT_CHAN(_index) \
>> - {   \
>> - .type = IIO_CURRENT,\
>> - .channel = _index,  \
>> - .address = _index,  \
>> - .scan_index = -1,   \
>> - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |  \
>> - BIT(IIO_CHAN_INFO_SCALE),   \
>> - .indexed = true,\
>> - .output = true, \
>> - }
>> -
>>  struct afe440x_val_table {
>>   int integer;
>>   int fract;
>>  };
>>
>> -#define AFE440X_TABLE_ATTR(_name, _table)\
>> -static ssize_t _name ## _show(struct device *dev,\
>> -   struct device_attribute *attr, char *buf) \
>> -{\
>> - ssize_t len = 0;\
>> - int i;  \
>> - \
>> - for (i = 0; i < ARRAY_SIZE(_table); i++)\
>> - len += scnprintf(buf + len, PAGE_SIZE - len, "%d.%06u ", \
>> -  _table[i].integer, \
>> -  _table[i].fract);  \
>> - \
>> - buf[len - 1] = '\n';\
>> - \
>> - return len; \
>> -}\
>>  static DEVICE_ATTR_RO(_name)
>>
>>  struct afe440x_attr {
>> @@ -147,17 +102,4 @@ struct afe440x_attr {
>>   unsigned int table_size;
>>  };
>>
>> -#define to_afe440x_attr(_dev_attr)   \
>> - container_of(_dev_attr, struct afe440x_attr, dev_attr)
>> -
>> -#define AFE440X_ATTR(_name, _field, _table)  \
>> - struct afe440x_attr afe440x_attr_##_name = {\
>> - .dev_attr = __ATTR(_name, (S_IRUGO | S_IWUSR),  \
>> -afe440x_show_register,   \
>> -afe440x_store_register), \
>> - .field = _field,\
>> - .val_table = _table,\
>> - .table_size = ARRAY_SIZE(_table),   \
>> - }
>> -
>>  #endif /* _AFE440X_H */


[PATCH 1/3] iio: health: afe440x: Remove code in comments

2017-03-31 Thread simran singhal
Commenting out code is a bad idea.
As comments are for explaining what code is about.

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/iio/health/afe440x.h | 58 
 1 file changed, 58 deletions(-)

diff --git a/drivers/iio/health/afe440x.h b/drivers/iio/health/afe440x.h
index 1a0f247..71e2f0e 100644
--- a/drivers/iio/health/afe440x.h
+++ b/drivers/iio/health/afe440x.h
@@ -88,56 +88,11 @@
 #define AFE440X_CONTROL0_WRITE 0x0
 #define AFE440X_CONTROL0_READ  0x1
 
-#define AFE440X_INTENSITY_CHAN(_index, _mask)  \
-   {   \
-   .type = IIO_INTENSITY,  \
-   .channel = _index,  \
-   .address = _index,  \
-   .scan_index = _index,   \
-   .scan_type = {  \
-   .sign = 's',\
-   .realbits = 24, \
-   .storagebits = 32,  \
-   .endianness = IIO_CPU,  \
-   },  \
-   .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |  \
-   _mask,  \
-   .indexed = true,\
-   }
-
-#define AFE440X_CURRENT_CHAN(_index)   \
-   {   \
-   .type = IIO_CURRENT,\
-   .channel = _index,  \
-   .address = _index,  \
-   .scan_index = -1,   \
-   .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |  \
-   BIT(IIO_CHAN_INFO_SCALE),   \
-   .indexed = true,\
-   .output = true, \
-   }
-
 struct afe440x_val_table {
int integer;
int fract;
 };
 
-#define AFE440X_TABLE_ATTR(_name, _table)  \
-static ssize_t _name ## _show(struct device *dev,  \
- struct device_attribute *attr, char *buf) \
-{  \
-   ssize_t len = 0;\
-   int i;  \
-   \
-   for (i = 0; i < ARRAY_SIZE(_table); i++)\
-   len += scnprintf(buf + len, PAGE_SIZE - len, "%d.%06u ", \
-_table[i].integer, \
-_table[i].fract);  \
-   \
-   buf[len - 1] = '\n';\
-   \
-   return len; \
-}  \
 static DEVICE_ATTR_RO(_name)
 
 struct afe440x_attr {
@@ -147,17 +102,4 @@ struct afe440x_attr {
unsigned int table_size;
 };
 
-#define to_afe440x_attr(_dev_attr) \
-   container_of(_dev_attr, struct afe440x_attr, dev_attr)
-
-#define AFE440X_ATTR(_name, _field, _table)\
-   struct afe440x_attr afe440x_attr_##_name = {\
-   .dev_attr = __ATTR(_name, (S_IRUGO | S_IWUSR),  \
-  afe440x_show_register,   \
-  afe440x_store_register), \
-   .field = _field,\
-   .val_table = _table,\
-   .table_size = ARRAY_SIZE(_table),   \
-   }
-
 #endif /* _AFE440X_H */
-- 
2.7.4



[PATCH 1/3] iio: health: afe440x: Remove code in comments

2017-03-31 Thread simran singhal
Commenting out code is a bad idea.
As comments are for explaining what code is about.

Signed-off-by: simran singhal 
---
 drivers/iio/health/afe440x.h | 58 
 1 file changed, 58 deletions(-)

diff --git a/drivers/iio/health/afe440x.h b/drivers/iio/health/afe440x.h
index 1a0f247..71e2f0e 100644
--- a/drivers/iio/health/afe440x.h
+++ b/drivers/iio/health/afe440x.h
@@ -88,56 +88,11 @@
 #define AFE440X_CONTROL0_WRITE 0x0
 #define AFE440X_CONTROL0_READ  0x1
 
-#define AFE440X_INTENSITY_CHAN(_index, _mask)  \
-   {   \
-   .type = IIO_INTENSITY,  \
-   .channel = _index,  \
-   .address = _index,  \
-   .scan_index = _index,   \
-   .scan_type = {  \
-   .sign = 's',\
-   .realbits = 24, \
-   .storagebits = 32,  \
-   .endianness = IIO_CPU,  \
-   },  \
-   .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |  \
-   _mask,  \
-   .indexed = true,\
-   }
-
-#define AFE440X_CURRENT_CHAN(_index)   \
-   {   \
-   .type = IIO_CURRENT,\
-   .channel = _index,  \
-   .address = _index,  \
-   .scan_index = -1,   \
-   .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |  \
-   BIT(IIO_CHAN_INFO_SCALE),   \
-   .indexed = true,\
-   .output = true, \
-   }
-
 struct afe440x_val_table {
int integer;
int fract;
 };
 
-#define AFE440X_TABLE_ATTR(_name, _table)  \
-static ssize_t _name ## _show(struct device *dev,  \
- struct device_attribute *attr, char *buf) \
-{  \
-   ssize_t len = 0;\
-   int i;  \
-   \
-   for (i = 0; i < ARRAY_SIZE(_table); i++)\
-   len += scnprintf(buf + len, PAGE_SIZE - len, "%d.%06u ", \
-_table[i].integer, \
-_table[i].fract);  \
-   \
-   buf[len - 1] = '\n';\
-   \
-   return len; \
-}  \
 static DEVICE_ATTR_RO(_name)
 
 struct afe440x_attr {
@@ -147,17 +102,4 @@ struct afe440x_attr {
unsigned int table_size;
 };
 
-#define to_afe440x_attr(_dev_attr) \
-   container_of(_dev_attr, struct afe440x_attr, dev_attr)
-
-#define AFE440X_ATTR(_name, _field, _table)\
-   struct afe440x_attr afe440x_attr_##_name = {\
-   .dev_attr = __ATTR(_name, (S_IRUGO | S_IWUSR),  \
-  afe440x_show_register,   \
-  afe440x_store_register), \
-   .field = _field,\
-   .val_table = _table,\
-   .table_size = ARRAY_SIZE(_table),   \
-   }
-
 #endif /* _AFE440X_H */
-- 
2.7.4



[PATCH 2/3] iio: health: afe4404: Remove all unused functions

2017-03-31 Thread simran singhal
The functions afe440x_show_register and afe440x_store_register are never
used anywhere in the kernel. So, remove their definitions.
Grepped to find occurences.

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/iio/health/afe4404.c | 51 
 1 file changed, 51 deletions(-)

diff --git a/drivers/iio/health/afe4404.c b/drivers/iio/health/afe4404.c
index 964f523..168991a 100644
--- a/drivers/iio/health/afe4404.c
+++ b/drivers/iio/health/afe4404.c
@@ -170,57 +170,6 @@ static const struct afe440x_val_table afe4404_cap_table[] 
= {
 };
 AFE440X_TABLE_ATTR(in_intensity_capacitance_available, afe4404_cap_table);
 
-static ssize_t afe440x_show_register(struct device *dev,
-struct device_attribute *attr,
-char *buf)
-{
-   struct iio_dev *indio_dev = dev_to_iio_dev(dev);
-   struct afe4404_data *afe = iio_priv(indio_dev);
-   struct afe440x_attr *afe440x_attr = to_afe440x_attr(attr);
-   unsigned int reg_val;
-   int vals[2];
-   int ret;
-
-   ret = regmap_field_read(afe->fields[afe440x_attr->field], _val);
-   if (ret)
-   return ret;
-
-   if (reg_val >= afe440x_attr->table_size)
-   return -EINVAL;
-
-   vals[0] = afe440x_attr->val_table[reg_val].integer;
-   vals[1] = afe440x_attr->val_table[reg_val].fract;
-
-   return iio_format_value(buf, IIO_VAL_INT_PLUS_MICRO, 2, vals);
-}
-
-static ssize_t afe440x_store_register(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
-   struct iio_dev *indio_dev = dev_to_iio_dev(dev);
-   struct afe4404_data *afe = iio_priv(indio_dev);
-   struct afe440x_attr *afe440x_attr = to_afe440x_attr(attr);
-   int val, integer, fract, ret;
-
-   ret = iio_str_to_fixpoint(buf, 10, , );
-   if (ret)
-   return ret;
-
-   for (val = 0; val < afe440x_attr->table_size; val++)
-   if (afe440x_attr->val_table[val].integer == integer &&
-   afe440x_attr->val_table[val].fract == fract)
-   break;
-   if (val == afe440x_attr->table_size)
-   return -EINVAL;
-
-   ret = regmap_field_write(afe->fields[afe440x_attr->field], val);
-   if (ret)
-   return ret;
-
-   return count;
-}
-
 static AFE440X_ATTR(in_intensity1_resistance, F_TIA_GAIN_SEP, 
afe4404_res_table);
 static AFE440X_ATTR(in_intensity1_capacitance, F_TIA_CF_SEP, 
afe4404_cap_table);
 
-- 
2.7.4



[PATCH 3/3] iio: health: afe4403: Remove all unused functions

2017-03-31 Thread simran singhal
The functions afe440x_show_register and afe440x_store_register are never
used anywhere in the kernel. So, remove their definitions.
Grepped to find occurences.

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/iio/health/afe4403.c | 51 
 1 file changed, 51 deletions(-)

diff --git a/drivers/iio/health/afe4403.c b/drivers/iio/health/afe4403.c
index 6bb23a4..3059014 100644
--- a/drivers/iio/health/afe4403.c
+++ b/drivers/iio/health/afe4403.c
@@ -136,57 +136,6 @@ static const struct afe440x_val_table afe4403_cap_table[] 
= {
 };
 AFE440X_TABLE_ATTR(in_intensity_capacitance_available, afe4403_cap_table);
 
-static ssize_t afe440x_show_register(struct device *dev,
-struct device_attribute *attr,
-char *buf)
-{
-   struct iio_dev *indio_dev = dev_to_iio_dev(dev);
-   struct afe4403_data *afe = iio_priv(indio_dev);
-   struct afe440x_attr *afe440x_attr = to_afe440x_attr(attr);
-   unsigned int reg_val;
-   int vals[2];
-   int ret;
-
-   ret = regmap_field_read(afe->fields[afe440x_attr->field], _val);
-   if (ret)
-   return ret;
-
-   if (reg_val >= afe440x_attr->table_size)
-   return -EINVAL;
-
-   vals[0] = afe440x_attr->val_table[reg_val].integer;
-   vals[1] = afe440x_attr->val_table[reg_val].fract;
-
-   return iio_format_value(buf, IIO_VAL_INT_PLUS_MICRO, 2, vals);
-}
-
-static ssize_t afe440x_store_register(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
-   struct iio_dev *indio_dev = dev_to_iio_dev(dev);
-   struct afe4403_data *afe = iio_priv(indio_dev);
-   struct afe440x_attr *afe440x_attr = to_afe440x_attr(attr);
-   int val, integer, fract, ret;
-
-   ret = iio_str_to_fixpoint(buf, 10, , );
-   if (ret)
-   return ret;
-
-   for (val = 0; val < afe440x_attr->table_size; val++)
-   if (afe440x_attr->val_table[val].integer == integer &&
-   afe440x_attr->val_table[val].fract == fract)
-   break;
-   if (val == afe440x_attr->table_size)
-   return -EINVAL;
-
-   ret = regmap_field_write(afe->fields[afe440x_attr->field], val);
-   if (ret)
-   return ret;
-
-   return count;
-}
-
 static AFE440X_ATTR(in_intensity1_resistance, F_RF_LED, afe4403_res_table);
 static AFE440X_ATTR(in_intensity1_capacitance, F_CF_LED, afe4403_cap_table);
 
-- 
2.7.4



[PATCH 2/3] iio: health: afe4404: Remove all unused functions

2017-03-31 Thread simran singhal
The functions afe440x_show_register and afe440x_store_register are never
used anywhere in the kernel. So, remove their definitions.
Grepped to find occurences.

Signed-off-by: simran singhal 
---
 drivers/iio/health/afe4404.c | 51 
 1 file changed, 51 deletions(-)

diff --git a/drivers/iio/health/afe4404.c b/drivers/iio/health/afe4404.c
index 964f523..168991a 100644
--- a/drivers/iio/health/afe4404.c
+++ b/drivers/iio/health/afe4404.c
@@ -170,57 +170,6 @@ static const struct afe440x_val_table afe4404_cap_table[] 
= {
 };
 AFE440X_TABLE_ATTR(in_intensity_capacitance_available, afe4404_cap_table);
 
-static ssize_t afe440x_show_register(struct device *dev,
-struct device_attribute *attr,
-char *buf)
-{
-   struct iio_dev *indio_dev = dev_to_iio_dev(dev);
-   struct afe4404_data *afe = iio_priv(indio_dev);
-   struct afe440x_attr *afe440x_attr = to_afe440x_attr(attr);
-   unsigned int reg_val;
-   int vals[2];
-   int ret;
-
-   ret = regmap_field_read(afe->fields[afe440x_attr->field], _val);
-   if (ret)
-   return ret;
-
-   if (reg_val >= afe440x_attr->table_size)
-   return -EINVAL;
-
-   vals[0] = afe440x_attr->val_table[reg_val].integer;
-   vals[1] = afe440x_attr->val_table[reg_val].fract;
-
-   return iio_format_value(buf, IIO_VAL_INT_PLUS_MICRO, 2, vals);
-}
-
-static ssize_t afe440x_store_register(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
-   struct iio_dev *indio_dev = dev_to_iio_dev(dev);
-   struct afe4404_data *afe = iio_priv(indio_dev);
-   struct afe440x_attr *afe440x_attr = to_afe440x_attr(attr);
-   int val, integer, fract, ret;
-
-   ret = iio_str_to_fixpoint(buf, 10, , );
-   if (ret)
-   return ret;
-
-   for (val = 0; val < afe440x_attr->table_size; val++)
-   if (afe440x_attr->val_table[val].integer == integer &&
-   afe440x_attr->val_table[val].fract == fract)
-   break;
-   if (val == afe440x_attr->table_size)
-   return -EINVAL;
-
-   ret = regmap_field_write(afe->fields[afe440x_attr->field], val);
-   if (ret)
-   return ret;
-
-   return count;
-}
-
 static AFE440X_ATTR(in_intensity1_resistance, F_TIA_GAIN_SEP, 
afe4404_res_table);
 static AFE440X_ATTR(in_intensity1_capacitance, F_TIA_CF_SEP, 
afe4404_cap_table);
 
-- 
2.7.4



[PATCH 3/3] iio: health: afe4403: Remove all unused functions

2017-03-31 Thread simran singhal
The functions afe440x_show_register and afe440x_store_register are never
used anywhere in the kernel. So, remove their definitions.
Grepped to find occurences.

Signed-off-by: simran singhal 
---
 drivers/iio/health/afe4403.c | 51 
 1 file changed, 51 deletions(-)

diff --git a/drivers/iio/health/afe4403.c b/drivers/iio/health/afe4403.c
index 6bb23a4..3059014 100644
--- a/drivers/iio/health/afe4403.c
+++ b/drivers/iio/health/afe4403.c
@@ -136,57 +136,6 @@ static const struct afe440x_val_table afe4403_cap_table[] 
= {
 };
 AFE440X_TABLE_ATTR(in_intensity_capacitance_available, afe4403_cap_table);
 
-static ssize_t afe440x_show_register(struct device *dev,
-struct device_attribute *attr,
-char *buf)
-{
-   struct iio_dev *indio_dev = dev_to_iio_dev(dev);
-   struct afe4403_data *afe = iio_priv(indio_dev);
-   struct afe440x_attr *afe440x_attr = to_afe440x_attr(attr);
-   unsigned int reg_val;
-   int vals[2];
-   int ret;
-
-   ret = regmap_field_read(afe->fields[afe440x_attr->field], _val);
-   if (ret)
-   return ret;
-
-   if (reg_val >= afe440x_attr->table_size)
-   return -EINVAL;
-
-   vals[0] = afe440x_attr->val_table[reg_val].integer;
-   vals[1] = afe440x_attr->val_table[reg_val].fract;
-
-   return iio_format_value(buf, IIO_VAL_INT_PLUS_MICRO, 2, vals);
-}
-
-static ssize_t afe440x_store_register(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
-   struct iio_dev *indio_dev = dev_to_iio_dev(dev);
-   struct afe4403_data *afe = iio_priv(indio_dev);
-   struct afe440x_attr *afe440x_attr = to_afe440x_attr(attr);
-   int val, integer, fract, ret;
-
-   ret = iio_str_to_fixpoint(buf, 10, , );
-   if (ret)
-   return ret;
-
-   for (val = 0; val < afe440x_attr->table_size; val++)
-   if (afe440x_attr->val_table[val].integer == integer &&
-   afe440x_attr->val_table[val].fract == fract)
-   break;
-   if (val == afe440x_attr->table_size)
-   return -EINVAL;
-
-   ret = regmap_field_write(afe->fields[afe440x_attr->field], val);
-   if (ret)
-   return ret;
-
-   return count;
-}
-
 static AFE440X_ATTR(in_intensity1_resistance, F_RF_LED, afe4403_res_table);
 static AFE440X_ATTR(in_intensity1_capacitance, F_CF_LED, afe4403_cap_table);
 
-- 
2.7.4



[PATCH 0/3] iio: health: Clean up

2017-03-31 Thread simran singhal
This patch-series removes commented code in afe440x.h and 
removes unused functions in afe4404.c and afe4403.c.

simran singhal (3):
  iio: health: afe440x: Remove code in comments
  iio: health: afe4404: Remove all unused functions
  iio: health: afe4403: Remove all unused functions

 drivers/iio/health/afe4403.c | 51 --
 drivers/iio/health/afe4404.c | 51 --
 drivers/iio/health/afe440x.h | 58 
 3 files changed, 160 deletions(-)

-- 
2.7.4



[PATCH 0/3] iio: health: Clean up

2017-03-31 Thread simran singhal
This patch-series removes commented code in afe440x.h and 
removes unused functions in afe4404.c and afe4403.c.

simran singhal (3):
  iio: health: afe440x: Remove code in comments
  iio: health: afe4404: Remove all unused functions
  iio: health: afe4403: Remove all unused functions

 drivers/iio/health/afe4403.c | 51 --
 drivers/iio/health/afe4404.c | 51 --
 drivers/iio/health/afe440x.h | 58 
 3 files changed, 160 deletions(-)

-- 
2.7.4



[PATCH 0/3] staging: iio: Remove useless type conversion

2017-03-31 Thread simran singhal
This patch-series removes some type conversions like casting a pointer to a 
pointer of same type,
casting to the original type using addressof(&) operator etc.

simran singhal (3):
  staging: iio: accel: Remove useless type conversion
  staging: iio: frequency: Remove useless type conversion
  staging: iio: light: Remove useless type conversion

 drivers/staging/iio/accel/adis16201.c| 2 +-
 drivers/staging/iio/accel/adis16203.c| 2 +-
 drivers/staging/iio/accel/adis16209.c| 2 +-
 drivers/staging/iio/accel/adis16240.c| 6 +++---
 drivers/staging/iio/frequency/ad9832.c   | 2 +-
 drivers/staging/iio/light/tsl2x7x_core.c | 2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)

-- 
2.7.4



[PATCH 0/3] staging: iio: Remove useless type conversion

2017-03-31 Thread simran singhal
This patch-series removes some type conversions like casting a pointer to a 
pointer of same type,
casting to the original type using addressof(&) operator etc.

simran singhal (3):
  staging: iio: accel: Remove useless type conversion
  staging: iio: frequency: Remove useless type conversion
  staging: iio: light: Remove useless type conversion

 drivers/staging/iio/accel/adis16201.c| 2 +-
 drivers/staging/iio/accel/adis16203.c| 2 +-
 drivers/staging/iio/accel/adis16209.c| 2 +-
 drivers/staging/iio/accel/adis16240.c| 6 +++---
 drivers/staging/iio/frequency/ad9832.c   | 2 +-
 drivers/staging/iio/light/tsl2x7x_core.c | 2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)

-- 
2.7.4



[PATCH 2/3] staging: iio: frequency: Remove useless type conversion

2017-03-31 Thread simran singhal
Some type conversions like casting a pointer to a pointer of same type,
casting to the original type using addressof(&) operator etc. are not
needed. Therefore, remove them. Done using coccinelle:

@@
type t;
t *p;
t a;
@@
(
- (t)(a)
+ a
|
- (t *)(p)
+ p
|
- (t *)()
+ 
)

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/staging/iio/frequency/ad9832.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/frequency/ad9832.c 
b/drivers/staging/iio/frequency/ad9832.c
index 425b8ab..01bdf8e 100644
--- a/drivers/staging/iio/frequency/ad9832.c
+++ b/drivers/staging/iio/frequency/ad9832.c
@@ -119,7 +119,7 @@ struct ad9832_state {
 static unsigned long ad9832_calc_freqreg(unsigned long mclk, unsigned long 
fout)
 {
unsigned long long freqreg = (u64)fout *
-(u64)((u64)1L << AD9832_FREQ_BITS);
+(u64)1L << AD9832_FREQ_BITS;
do_div(freqreg, mclk);
return freqreg;
 }
-- 
2.7.4



[PATCH 2/3] staging: iio: frequency: Remove useless type conversion

2017-03-31 Thread simran singhal
Some type conversions like casting a pointer to a pointer of same type,
casting to the original type using addressof(&) operator etc. are not
needed. Therefore, remove them. Done using coccinelle:

@@
type t;
t *p;
t a;
@@
(
- (t)(a)
+ a
|
- (t *)(p)
+ p
|
- (t *)()
+ 
)

Signed-off-by: simran singhal 
---
 drivers/staging/iio/frequency/ad9832.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/frequency/ad9832.c 
b/drivers/staging/iio/frequency/ad9832.c
index 425b8ab..01bdf8e 100644
--- a/drivers/staging/iio/frequency/ad9832.c
+++ b/drivers/staging/iio/frequency/ad9832.c
@@ -119,7 +119,7 @@ struct ad9832_state {
 static unsigned long ad9832_calc_freqreg(unsigned long mclk, unsigned long 
fout)
 {
unsigned long long freqreg = (u64)fout *
-(u64)((u64)1L << AD9832_FREQ_BITS);
+(u64)1L << AD9832_FREQ_BITS;
do_div(freqreg, mclk);
return freqreg;
 }
-- 
2.7.4



[PATCH 3/3] staging: iio: light: Remove useless type conversion

2017-03-31 Thread simran singhal
Some type conversions like casting a pointer to a pointer of same type,
casting to the original type using addressof(&) operator etc. are not
needed. Therefore, remove them. Done using coccinelle:

@@
type t;
t *p;
t a;
@@
(
- (t)(a)
+ a
|
- (t *)(p)
+ p
|
- (t *)()
+ 
)

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/staging/iio/light/tsl2x7x_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/light/tsl2x7x_core.c 
b/drivers/staging/iio/light/tsl2x7x_core.c
index ea15bc1..0490c1d 100644
--- a/drivers/staging/iio/light/tsl2x7x_core.c
+++ b/drivers/staging/iio/light/tsl2x7x_core.c
@@ -624,7 +624,7 @@ static int tsl2x7x_als_calibrate(struct iio_dev *indio_dev)
dev_info(>client->dev,
 "%s als_calibrate completed\n", chip->client->name);
 
-   return (int)gain_trim_val;
+   return gain_trim_val;
 }
 
 static int tsl2x7x_chip_on(struct iio_dev *indio_dev)
-- 
2.7.4



[PATCH 3/3] staging: iio: light: Remove useless type conversion

2017-03-31 Thread simran singhal
Some type conversions like casting a pointer to a pointer of same type,
casting to the original type using addressof(&) operator etc. are not
needed. Therefore, remove them. Done using coccinelle:

@@
type t;
t *p;
t a;
@@
(
- (t)(a)
+ a
|
- (t *)(p)
+ p
|
- (t *)()
+ 
)

Signed-off-by: simran singhal 
---
 drivers/staging/iio/light/tsl2x7x_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/light/tsl2x7x_core.c 
b/drivers/staging/iio/light/tsl2x7x_core.c
index ea15bc1..0490c1d 100644
--- a/drivers/staging/iio/light/tsl2x7x_core.c
+++ b/drivers/staging/iio/light/tsl2x7x_core.c
@@ -624,7 +624,7 @@ static int tsl2x7x_als_calibrate(struct iio_dev *indio_dev)
dev_info(>client->dev,
 "%s als_calibrate completed\n", chip->client->name);
 
-   return (int)gain_trim_val;
+   return gain_trim_val;
 }
 
 static int tsl2x7x_chip_on(struct iio_dev *indio_dev)
-- 
2.7.4



[PATCH 1/3] staging: iio: accel: Remove useless type conversion

2017-03-31 Thread simran singhal
Some type conversions like casting a pointer to a pointer of same type,
casting to the original type using addressof(&) operator etc. are not
needed. Therefore, remove them. Done using coccinelle:

@@
type t;
t *p;
t a;
@@
(
- (t)(a)
+ a
|
- (t *)(p)
+ p
|
- (t *)()
+ 
)

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/staging/iio/accel/adis16201.c | 2 +-
 drivers/staging/iio/accel/adis16203.c | 2 +-
 drivers/staging/iio/accel/adis16209.c | 2 +-
 drivers/staging/iio/accel/adis16240.c | 6 +++---
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16201.c 
b/drivers/staging/iio/accel/adis16201.c
index fbc2406..b7381d3 100644
--- a/drivers/staging/iio/accel/adis16201.c
+++ b/drivers/staging/iio/accel/adis16201.c
@@ -228,7 +228,7 @@ static int adis16201_read_raw(struct iio_dev *indio_dev,
if (ret)
return ret;
val16 &= (1 << bits) - 1;
-   val16 = (s16)(val16 << (16 - bits)) >> (16 - bits);
+   val16 = val16 << (16 - bits) >> (16 - bits);
*val = val16;
return IIO_VAL_INT;
}
diff --git a/drivers/staging/iio/accel/adis16203.c 
b/drivers/staging/iio/accel/adis16203.c
index b59755a..25e5e52 100644
--- a/drivers/staging/iio/accel/adis16203.c
+++ b/drivers/staging/iio/accel/adis16203.c
@@ -211,7 +211,7 @@ static int adis16203_read_raw(struct iio_dev *indio_dev,
return ret;
}
val16 &= (1 << bits) - 1;
-   val16 = (s16)(val16 << (16 - bits)) >> (16 - bits);
+   val16 = val16 << (16 - bits) >> (16 - bits);
*val = val16;
mutex_unlock(_dev->mlock);
return IIO_VAL_INT;
diff --git a/drivers/staging/iio/accel/adis16209.c 
b/drivers/staging/iio/accel/adis16209.c
index 52fa2e0..7aac310 100644
--- a/drivers/staging/iio/accel/adis16209.c
+++ b/drivers/staging/iio/accel/adis16209.c
@@ -259,7 +259,7 @@ static int adis16209_read_raw(struct iio_dev *indio_dev,
return ret;
}
val16 &= (1 << bits) - 1;
-   val16 = (s16)(val16 << (16 - bits)) >> (16 - bits);
+   val16 = val16 << (16 - bits) >> (16 - bits);
*val = val16;
return IIO_VAL_INT;
}
diff --git a/drivers/staging/iio/accel/adis16240.c 
b/drivers/staging/iio/accel/adis16240.c
index 6e3c95c..2c55b65 100644
--- a/drivers/staging/iio/accel/adis16240.c
+++ b/drivers/staging/iio/accel/adis16240.c
@@ -220,7 +220,7 @@ static ssize_t adis16240_spi_read_signed(struct device *dev,
if (val & ADIS16240_ERROR_ACTIVE)
adis_check_status(st);
 
-   val = (s16)(val << shift) >> shift;
+   val = val << shift >> shift;
return sprintf(buf, "%d\n", val);
 }
 
@@ -294,7 +294,7 @@ static int adis16240_read_raw(struct iio_dev *indio_dev,
return ret;
}
val16 &= (1 << bits) - 1;
-   val16 = (s16)(val16 << (16 - bits)) >> (16 - bits);
+   val16 = val16 << (16 - bits) >> (16 - bits);
*val = val16;
return IIO_VAL_INT;
case IIO_CHAN_INFO_PEAK:
@@ -305,7 +305,7 @@ static int adis16240_read_raw(struct iio_dev *indio_dev,
return ret;
}
val16 &= (1 << bits) - 1;
-   val16 = (s16)(val16 << (16 - bits)) >> (16 - bits);
+   val16 = val16 << (16 - bits) >> (16 - bits);
*val = val16;
return IIO_VAL_INT;
}
-- 
2.7.4



[PATCH 1/3] staging: iio: accel: Remove useless type conversion

2017-03-31 Thread simran singhal
Some type conversions like casting a pointer to a pointer of same type,
casting to the original type using addressof(&) operator etc. are not
needed. Therefore, remove them. Done using coccinelle:

@@
type t;
t *p;
t a;
@@
(
- (t)(a)
+ a
|
- (t *)(p)
+ p
|
- (t *)()
+ 
)

Signed-off-by: simran singhal 
---
 drivers/staging/iio/accel/adis16201.c | 2 +-
 drivers/staging/iio/accel/adis16203.c | 2 +-
 drivers/staging/iio/accel/adis16209.c | 2 +-
 drivers/staging/iio/accel/adis16240.c | 6 +++---
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16201.c 
b/drivers/staging/iio/accel/adis16201.c
index fbc2406..b7381d3 100644
--- a/drivers/staging/iio/accel/adis16201.c
+++ b/drivers/staging/iio/accel/adis16201.c
@@ -228,7 +228,7 @@ static int adis16201_read_raw(struct iio_dev *indio_dev,
if (ret)
return ret;
val16 &= (1 << bits) - 1;
-   val16 = (s16)(val16 << (16 - bits)) >> (16 - bits);
+   val16 = val16 << (16 - bits) >> (16 - bits);
*val = val16;
return IIO_VAL_INT;
}
diff --git a/drivers/staging/iio/accel/adis16203.c 
b/drivers/staging/iio/accel/adis16203.c
index b59755a..25e5e52 100644
--- a/drivers/staging/iio/accel/adis16203.c
+++ b/drivers/staging/iio/accel/adis16203.c
@@ -211,7 +211,7 @@ static int adis16203_read_raw(struct iio_dev *indio_dev,
return ret;
}
val16 &= (1 << bits) - 1;
-   val16 = (s16)(val16 << (16 - bits)) >> (16 - bits);
+   val16 = val16 << (16 - bits) >> (16 - bits);
*val = val16;
mutex_unlock(_dev->mlock);
return IIO_VAL_INT;
diff --git a/drivers/staging/iio/accel/adis16209.c 
b/drivers/staging/iio/accel/adis16209.c
index 52fa2e0..7aac310 100644
--- a/drivers/staging/iio/accel/adis16209.c
+++ b/drivers/staging/iio/accel/adis16209.c
@@ -259,7 +259,7 @@ static int adis16209_read_raw(struct iio_dev *indio_dev,
return ret;
}
val16 &= (1 << bits) - 1;
-   val16 = (s16)(val16 << (16 - bits)) >> (16 - bits);
+   val16 = val16 << (16 - bits) >> (16 - bits);
*val = val16;
return IIO_VAL_INT;
}
diff --git a/drivers/staging/iio/accel/adis16240.c 
b/drivers/staging/iio/accel/adis16240.c
index 6e3c95c..2c55b65 100644
--- a/drivers/staging/iio/accel/adis16240.c
+++ b/drivers/staging/iio/accel/adis16240.c
@@ -220,7 +220,7 @@ static ssize_t adis16240_spi_read_signed(struct device *dev,
if (val & ADIS16240_ERROR_ACTIVE)
adis_check_status(st);
 
-   val = (s16)(val << shift) >> shift;
+   val = val << shift >> shift;
return sprintf(buf, "%d\n", val);
 }
 
@@ -294,7 +294,7 @@ static int adis16240_read_raw(struct iio_dev *indio_dev,
return ret;
}
val16 &= (1 << bits) - 1;
-   val16 = (s16)(val16 << (16 - bits)) >> (16 - bits);
+   val16 = val16 << (16 - bits) >> (16 - bits);
*val = val16;
return IIO_VAL_INT;
case IIO_CHAN_INFO_PEAK:
@@ -305,7 +305,7 @@ static int adis16240_read_raw(struct iio_dev *indio_dev,
return ret;
}
val16 &= (1 << bits) - 1;
-   val16 = (s16)(val16 << (16 - bits)) >> (16 - bits);
+   val16 = val16 << (16 - bits) >> (16 - bits);
*val = val16;
return IIO_VAL_INT;
}
-- 
2.7.4



[PATCH v2] iio: gyro: adis16060: Change the name of function.

2017-03-31 Thread simran singhal
Change the name of function from adis16060_spi_write_than_read()
to adis16060_spi_write_then_read(). change "than" to "then" as
its time depended.

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---

 v2:
   -Change the subject.
   -Add signed-off-by.

 drivers/staging/iio/gyro/adis16060_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/gyro/adis16060_core.c 
b/drivers/staging/iio/gyro/adis16060_core.c
index 8115962..9675245 100644
--- a/drivers/staging/iio/gyro/adis16060_core.c
+++ b/drivers/staging/iio/gyro/adis16060_core.c
@@ -40,7 +40,7 @@ struct adis16060_state {
 
 static struct iio_dev *adis16060_iio_dev;
 
-static int adis16060_spi_write_than_read(struct iio_dev *indio_dev,
+static int adis16060_spi_write_then_read(struct iio_dev *indio_dev,
 u8 conf, u16 *val)
 {
int ret;
@@ -81,7 +81,7 @@ static int adis16060_read_raw(struct iio_dev *indio_dev,
 
switch (mask) {
case IIO_CHAN_INFO_RAW:
-   ret = adis16060_spi_write_than_read(indio_dev,
+   ret = adis16060_spi_write_then_read(indio_dev,
chan->address, );
if (ret < 0)
return ret;
-- 
2.7.4



[PATCH v2] iio: gyro: adis16060: Change the name of function.

2017-03-31 Thread simran singhal
Change the name of function from adis16060_spi_write_than_read()
to adis16060_spi_write_then_read(). change "than" to "then" as
its time depended.

Signed-off-by: simran singhal 
---

 v2:
   -Change the subject.
   -Add signed-off-by.

 drivers/staging/iio/gyro/adis16060_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/gyro/adis16060_core.c 
b/drivers/staging/iio/gyro/adis16060_core.c
index 8115962..9675245 100644
--- a/drivers/staging/iio/gyro/adis16060_core.c
+++ b/drivers/staging/iio/gyro/adis16060_core.c
@@ -40,7 +40,7 @@ struct adis16060_state {
 
 static struct iio_dev *adis16060_iio_dev;
 
-static int adis16060_spi_write_than_read(struct iio_dev *indio_dev,
+static int adis16060_spi_write_then_read(struct iio_dev *indio_dev,
 u8 conf, u16 *val)
 {
int ret;
@@ -81,7 +81,7 @@ static int adis16060_read_raw(struct iio_dev *indio_dev,
 
switch (mask) {
case IIO_CHAN_INFO_RAW:
-   ret = adis16060_spi_write_than_read(indio_dev,
+   ret = adis16060_spi_write_then_read(indio_dev,
chan->address, );
if (ret < 0)
return ret;
-- 
2.7.4



Re: [Outreachy kernel] [PATCH v4] staging: iio: ade7753: Replace mlock with driver private lock

2017-03-30 Thread SIMRAN SINGHAL
On Fri, Mar 31, 2017 at 1:18 AM, Jonathan Cameron
<ji...@jic23.retrosnub.co.uk> wrote:
>
>
> On 30 March 2017 19:44:26 BST, SIMRAN SINGHAL <singhalsimr...@gmail.com> 
> wrote:
>>On Fri, Mar 31, 2017 at 12:02 AM, Jonathan Cameron <ji...@kernel.org>
>>wrote:
>>> On 28/03/17 19:37, Alison Schofield wrote:
>>>> On Tue, Mar 28, 2017 at 10:55:17PM +0530, SIMRAN SINGHAL wrote:
>>>>> On Fri, Mar 24, 2017 at 12:51 AM, Alison Schofield
>><amsfiel...@gmail.com> wrote:
>>>>>> On Fri, Mar 24, 2017 at 12:05:20AM +0530, simran singhal wrote:
>>>>>>> The IIO subsystem is redefining iio_dev->mlock to be used by
>>>>>>> the IIO core only for protecting device operating mode changes.
>>>>>>> ie. Changes between INDIO_DIRECT_MODE, INDIO_BUFFER_* modes.
>>>>>>>
>>>>>>> In this driver, mlock was being used to protect hardware state
>>>>>>> changes.  Replace it with a lock in the devices global data.
>>>>>>
>>>>>> Hi Simran,
>>>>>>
>>>>>> Please post all revision histories below the --- not just the most
>>>>>> recent.
>>>>>>
>>>>> Sorry, will not repeat this.
>>>>>
>>>>>> Does this lock enforce the needed "atomicity" in the
>>write_frequency
>>>>>> function? I read Jonathans comment on a previous revision about
>>>>>> "ensuring the spi bus frequency and sampling frequency of the
>>device
>>>>>> are changed in an atomic fashion"
>>>>>>
>>>>>
>>>>> By introducing another lock I am protecting read_modify_write and
>>>>> in this way also protecting the designated register that we are
>>about
>>>>> to write.
>>>>
>>>> I see it protecting this path from being re-entered.  My uncertainty
>>>> is about other paths to read/write.
>>>>
>>>>>
>>>>>> Is it possible for another spi bus transaction (read or write) to
>>>>>> occur between the read and write in write_frequency?
>>>>>>
>>>>>
>>>>> Gargi has also come up with a solution.
>>>>>
>>https://groups.google.com/forum/#!topic/outreachy-kernel/kzE9CrI5Bd8
>>>>>
>>>>> Should I do like her as her's also seem correct or go ahead with
>>this.
>>>>
>>>> My suggestion would be to wait for feedback on Gargi's patch.
>>>> (See the Outreachy log about creating similar solutions.)
>>>>
>>>> We will not be able to close on this set of patches during the
>>>> Outreachy application window.  You can continue to push for closure
>>>> beyond the March 30th date as your time allows :)
>>>>
>>> It is a close choice between the two approaches. In some ways
>>> yours is easier to follow, but Gargi's is more elegant.
>>>
>>> Lets go with that one for consistency across similar drivers,
>>> but if you had been the original author and done it this way
>>> I certainly wouldn't bother asking you to change it!
>>
>>Yes, jonathan I am the original author.
>
> Sorry, I meant of the driver rather than this improvement.
>
By reading your pervious comment, I got what you mean!!
For consistency, I will do it in the same way Gargi did.

> Jonathan
>>
>>>
>>> So in conclusion both patches are good.
>>>
>>> Jonathan
>>>
>>>> Thanks,
>>>> alisons
>>>>
>>>>>
>>>>>> alisons
>>>>>>>
>>>>>>> Signed-off-by: simran singhal <singhalsimr...@gmail.com>
>>>>>>> ---
>>>>>>>
>>>>>>>  v4:
>>>>>>>-Add mutex_init
>>>>>>>
>>>>>>>  drivers/staging/iio/meter/ade7753.c | 7 +--
>>>>>>>  1 file changed, 5 insertions(+), 2 deletions(-)
>>>>>>>
>>>>>>> diff --git a/drivers/staging/iio/meter/ade7753.c
>>b/drivers/staging/iio/meter/ade7753.c
>>>>>>> index b71fbd3..30aebaf 100644
>>>>>>> --- a/drivers/staging/iio/meter/ade7753.c
>>>>>>> +++ b/drivers/staging/iio/meter/ade7753.c
>>>>>>> @@ -80,11 +80,13 @@
>>>>>>>   * @us: actual spi_device
>>&

Re: [Outreachy kernel] [PATCH v4] staging: iio: ade7753: Replace mlock with driver private lock

2017-03-30 Thread SIMRAN SINGHAL
On Fri, Mar 31, 2017 at 1:18 AM, Jonathan Cameron
 wrote:
>
>
> On 30 March 2017 19:44:26 BST, SIMRAN SINGHAL  
> wrote:
>>On Fri, Mar 31, 2017 at 12:02 AM, Jonathan Cameron 
>>wrote:
>>> On 28/03/17 19:37, Alison Schofield wrote:
>>>> On Tue, Mar 28, 2017 at 10:55:17PM +0530, SIMRAN SINGHAL wrote:
>>>>> On Fri, Mar 24, 2017 at 12:51 AM, Alison Schofield
>> wrote:
>>>>>> On Fri, Mar 24, 2017 at 12:05:20AM +0530, simran singhal wrote:
>>>>>>> The IIO subsystem is redefining iio_dev->mlock to be used by
>>>>>>> the IIO core only for protecting device operating mode changes.
>>>>>>> ie. Changes between INDIO_DIRECT_MODE, INDIO_BUFFER_* modes.
>>>>>>>
>>>>>>> In this driver, mlock was being used to protect hardware state
>>>>>>> changes.  Replace it with a lock in the devices global data.
>>>>>>
>>>>>> Hi Simran,
>>>>>>
>>>>>> Please post all revision histories below the --- not just the most
>>>>>> recent.
>>>>>>
>>>>> Sorry, will not repeat this.
>>>>>
>>>>>> Does this lock enforce the needed "atomicity" in the
>>write_frequency
>>>>>> function? I read Jonathans comment on a previous revision about
>>>>>> "ensuring the spi bus frequency and sampling frequency of the
>>device
>>>>>> are changed in an atomic fashion"
>>>>>>
>>>>>
>>>>> By introducing another lock I am protecting read_modify_write and
>>>>> in this way also protecting the designated register that we are
>>about
>>>>> to write.
>>>>
>>>> I see it protecting this path from being re-entered.  My uncertainty
>>>> is about other paths to read/write.
>>>>
>>>>>
>>>>>> Is it possible for another spi bus transaction (read or write) to
>>>>>> occur between the read and write in write_frequency?
>>>>>>
>>>>>
>>>>> Gargi has also come up with a solution.
>>>>>
>>https://groups.google.com/forum/#!topic/outreachy-kernel/kzE9CrI5Bd8
>>>>>
>>>>> Should I do like her as her's also seem correct or go ahead with
>>this.
>>>>
>>>> My suggestion would be to wait for feedback on Gargi's patch.
>>>> (See the Outreachy log about creating similar solutions.)
>>>>
>>>> We will not be able to close on this set of patches during the
>>>> Outreachy application window.  You can continue to push for closure
>>>> beyond the March 30th date as your time allows :)
>>>>
>>> It is a close choice between the two approaches. In some ways
>>> yours is easier to follow, but Gargi's is more elegant.
>>>
>>> Lets go with that one for consistency across similar drivers,
>>> but if you had been the original author and done it this way
>>> I certainly wouldn't bother asking you to change it!
>>
>>Yes, jonathan I am the original author.
>
> Sorry, I meant of the driver rather than this improvement.
>
By reading your pervious comment, I got what you mean!!
For consistency, I will do it in the same way Gargi did.

> Jonathan
>>
>>>
>>> So in conclusion both patches are good.
>>>
>>> Jonathan
>>>
>>>> Thanks,
>>>> alisons
>>>>
>>>>>
>>>>>> alisons
>>>>>>>
>>>>>>> Signed-off-by: simran singhal 
>>>>>>> ---
>>>>>>>
>>>>>>>  v4:
>>>>>>>-Add mutex_init
>>>>>>>
>>>>>>>  drivers/staging/iio/meter/ade7753.c | 7 +--
>>>>>>>  1 file changed, 5 insertions(+), 2 deletions(-)
>>>>>>>
>>>>>>> diff --git a/drivers/staging/iio/meter/ade7753.c
>>b/drivers/staging/iio/meter/ade7753.c
>>>>>>> index b71fbd3..30aebaf 100644
>>>>>>> --- a/drivers/staging/iio/meter/ade7753.c
>>>>>>> +++ b/drivers/staging/iio/meter/ade7753.c
>>>>>>> @@ -80,11 +80,13 @@
>>>>>>>   * @us: actual spi_device
>>>>>>>   * @tx: transmit buffer
>>>>>>>   * @rx: receive buffer
>>>>>>&g

[PATCH] iio: gyro: adis16060: Change the function's name

2017-03-30 Thread simran singhal
Change the name of function from adis16060_spi_write_than_read()
to adis16060_spi_write_then_read(). change "than" to "then" as
its time depended.
---
 drivers/staging/iio/gyro/adis16060_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/gyro/adis16060_core.c 
b/drivers/staging/iio/gyro/adis16060_core.c
index 8115962..9675245 100644
--- a/drivers/staging/iio/gyro/adis16060_core.c
+++ b/drivers/staging/iio/gyro/adis16060_core.c
@@ -40,7 +40,7 @@ struct adis16060_state {
 
 static struct iio_dev *adis16060_iio_dev;
 
-static int adis16060_spi_write_than_read(struct iio_dev *indio_dev,
+static int adis16060_spi_write_then_read(struct iio_dev *indio_dev,
 u8 conf, u16 *val)
 {
int ret;
@@ -81,7 +81,7 @@ static int adis16060_read_raw(struct iio_dev *indio_dev,
 
switch (mask) {
case IIO_CHAN_INFO_RAW:
-   ret = adis16060_spi_write_than_read(indio_dev,
+   ret = adis16060_spi_write_then_read(indio_dev,
chan->address, );
if (ret < 0)
return ret;
-- 
2.7.4



[PATCH] iio: gyro: adis16060: Change the function's name

2017-03-30 Thread simran singhal
Change the name of function from adis16060_spi_write_than_read()
to adis16060_spi_write_then_read(). change "than" to "then" as
its time depended.
---
 drivers/staging/iio/gyro/adis16060_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/gyro/adis16060_core.c 
b/drivers/staging/iio/gyro/adis16060_core.c
index 8115962..9675245 100644
--- a/drivers/staging/iio/gyro/adis16060_core.c
+++ b/drivers/staging/iio/gyro/adis16060_core.c
@@ -40,7 +40,7 @@ struct adis16060_state {
 
 static struct iio_dev *adis16060_iio_dev;
 
-static int adis16060_spi_write_than_read(struct iio_dev *indio_dev,
+static int adis16060_spi_write_then_read(struct iio_dev *indio_dev,
 u8 conf, u16 *val)
 {
int ret;
@@ -81,7 +81,7 @@ static int adis16060_read_raw(struct iio_dev *indio_dev,
 
switch (mask) {
case IIO_CHAN_INFO_RAW:
-   ret = adis16060_spi_write_than_read(indio_dev,
+   ret = adis16060_spi_write_then_read(indio_dev,
chan->address, );
if (ret < 0)
return ret;
-- 
2.7.4



Re: [Outreachy kernel] [PATCH v4] staging: iio: ade7753: Replace mlock with driver private lock

2017-03-30 Thread SIMRAN SINGHAL
On Fri, Mar 31, 2017 at 12:02 AM, Jonathan Cameron <ji...@kernel.org> wrote:
> On 28/03/17 19:37, Alison Schofield wrote:
>> On Tue, Mar 28, 2017 at 10:55:17PM +0530, SIMRAN SINGHAL wrote:
>>> On Fri, Mar 24, 2017 at 12:51 AM, Alison Schofield <amsfiel...@gmail.com> 
>>> wrote:
>>>> On Fri, Mar 24, 2017 at 12:05:20AM +0530, simran singhal wrote:
>>>>> The IIO subsystem is redefining iio_dev->mlock to be used by
>>>>> the IIO core only for protecting device operating mode changes.
>>>>> ie. Changes between INDIO_DIRECT_MODE, INDIO_BUFFER_* modes.
>>>>>
>>>>> In this driver, mlock was being used to protect hardware state
>>>>> changes.  Replace it with a lock in the devices global data.
>>>>
>>>> Hi Simran,
>>>>
>>>> Please post all revision histories below the --- not just the most
>>>> recent.
>>>>
>>> Sorry, will not repeat this.
>>>
>>>> Does this lock enforce the needed "atomicity" in the write_frequency
>>>> function? I read Jonathans comment on a previous revision about
>>>> "ensuring the spi bus frequency and sampling frequency of the device
>>>> are changed in an atomic fashion"
>>>>
>>>
>>> By introducing another lock I am protecting read_modify_write and
>>> in this way also protecting the designated register that we are about
>>> to write.
>>
>> I see it protecting this path from being re-entered.  My uncertainty
>> is about other paths to read/write.
>>
>>>
>>>> Is it possible for another spi bus transaction (read or write) to
>>>> occur between the read and write in write_frequency?
>>>>
>>>
>>> Gargi has also come up with a solution.
>>> https://groups.google.com/forum/#!topic/outreachy-kernel/kzE9CrI5Bd8
>>>
>>> Should I do like her as her's also seem correct or go ahead with this.
>>
>> My suggestion would be to wait for feedback on Gargi's patch.
>> (See the Outreachy log about creating similar solutions.)
>>
>> We will not be able to close on this set of patches during the
>> Outreachy application window.  You can continue to push for closure
>> beyond the March 30th date as your time allows :)
>>
> It is a close choice between the two approaches. In some ways
> yours is easier to follow, but Gargi's is more elegant.
>
> Lets go with that one for consistency across similar drivers,
> but if you had been the original author and done it this way
> I certainly wouldn't bother asking you to change it!

Yes, jonathan I am the original author.

>
> So in conclusion both patches are good.
>
> Jonathan
>
>> Thanks,
>> alisons
>>
>>>
>>>> alisons
>>>>>
>>>>> Signed-off-by: simran singhal <singhalsimr...@gmail.com>
>>>>> ---
>>>>>
>>>>>  v4:
>>>>>-Add mutex_init
>>>>>
>>>>>  drivers/staging/iio/meter/ade7753.c | 7 +--
>>>>>  1 file changed, 5 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/drivers/staging/iio/meter/ade7753.c 
>>>>> b/drivers/staging/iio/meter/ade7753.c
>>>>> index b71fbd3..30aebaf 100644
>>>>> --- a/drivers/staging/iio/meter/ade7753.c
>>>>> +++ b/drivers/staging/iio/meter/ade7753.c
>>>>> @@ -80,11 +80,13 @@
>>>>>   * @us: actual spi_device
>>>>>   * @tx: transmit buffer
>>>>>   * @rx: receive buffer
>>>>> + * @lock:   protect sensor state
>>>>>   * @buf_lock:   mutex to protect tx and rx
>>>>>   **/
>>>>>  struct ade7753_state {
>>>>>   struct spi_device   *us;
>>>>>   struct mutexbuf_lock;
>>>>> + struct mutexlock;  /* protect sensor state */
>>>>>   u8  tx[ADE7753_MAX_TX] cacheline_aligned;
>>>>>   u8  rx[ADE7753_MAX_RX];
>>>>>  };
>>>>> @@ -484,7 +486,7 @@ static ssize_t ade7753_write_frequency(struct device 
>>>>> *dev,
>>>>>   if (!val)
>>>>>   return -EINVAL;
>>>>>
>>>>> - mutex_lock(_dev->mlock);
>>>>> + mutex_lock(>lock);
>>>>>
>>>>>   t = 27900 / val;
>>>>>   if (t > 0)
>>>>> @@ -505,7 +507,7 @@ static ssize_t ade7753_write_frequency(struct device 
>>>>> *dev,
>>>>>   ret = ade7753_spi_write_reg_16(dev, ADE7753_MODE, reg);
>>>>>
>>>>>  out:
>>>>> - mutex_unlock(_dev->mlock);
>>>>> + mutex_unlock(>lock);
>>>>>
>>>>>   return ret ? ret : len;
>>>>>  }
>>>>> @@ -581,6 +583,7 @@ static int ade7753_probe(struct spi_device *spi)
>>>>>   st = iio_priv(indio_dev);
>>>>>   st->us = spi;
>>>>>   mutex_init(>buf_lock);
>>>>> + mutex_init(>lock);
>>>>>
>>>>>   indio_dev->name = spi->dev.driver->name;
>>>>>   indio_dev->dev.parent = >dev;
>>>>> --
>>>>> 2.7.4
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google Groups 
>>>>> "outreachy-kernel" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>>>> email to outreachy-kernel+unsubscr...@googlegroups.com.
>>>>> To post to this group, send email to outreachy-ker...@googlegroups.com.
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/outreachy-kernel/20170323183520.GA9871%40singhal-Inspiron-5558.
>>>>> For more options, visit https://groups.google.com/d/optout.
>


Re: [Outreachy kernel] [PATCH v4] staging: iio: ade7753: Replace mlock with driver private lock

2017-03-30 Thread SIMRAN SINGHAL
On Fri, Mar 31, 2017 at 12:02 AM, Jonathan Cameron  wrote:
> On 28/03/17 19:37, Alison Schofield wrote:
>> On Tue, Mar 28, 2017 at 10:55:17PM +0530, SIMRAN SINGHAL wrote:
>>> On Fri, Mar 24, 2017 at 12:51 AM, Alison Schofield  
>>> wrote:
>>>> On Fri, Mar 24, 2017 at 12:05:20AM +0530, simran singhal wrote:
>>>>> The IIO subsystem is redefining iio_dev->mlock to be used by
>>>>> the IIO core only for protecting device operating mode changes.
>>>>> ie. Changes between INDIO_DIRECT_MODE, INDIO_BUFFER_* modes.
>>>>>
>>>>> In this driver, mlock was being used to protect hardware state
>>>>> changes.  Replace it with a lock in the devices global data.
>>>>
>>>> Hi Simran,
>>>>
>>>> Please post all revision histories below the --- not just the most
>>>> recent.
>>>>
>>> Sorry, will not repeat this.
>>>
>>>> Does this lock enforce the needed "atomicity" in the write_frequency
>>>> function? I read Jonathans comment on a previous revision about
>>>> "ensuring the spi bus frequency and sampling frequency of the device
>>>> are changed in an atomic fashion"
>>>>
>>>
>>> By introducing another lock I am protecting read_modify_write and
>>> in this way also protecting the designated register that we are about
>>> to write.
>>
>> I see it protecting this path from being re-entered.  My uncertainty
>> is about other paths to read/write.
>>
>>>
>>>> Is it possible for another spi bus transaction (read or write) to
>>>> occur between the read and write in write_frequency?
>>>>
>>>
>>> Gargi has also come up with a solution.
>>> https://groups.google.com/forum/#!topic/outreachy-kernel/kzE9CrI5Bd8
>>>
>>> Should I do like her as her's also seem correct or go ahead with this.
>>
>> My suggestion would be to wait for feedback on Gargi's patch.
>> (See the Outreachy log about creating similar solutions.)
>>
>> We will not be able to close on this set of patches during the
>> Outreachy application window.  You can continue to push for closure
>> beyond the March 30th date as your time allows :)
>>
> It is a close choice between the two approaches. In some ways
> yours is easier to follow, but Gargi's is more elegant.
>
> Lets go with that one for consistency across similar drivers,
> but if you had been the original author and done it this way
> I certainly wouldn't bother asking you to change it!

Yes, jonathan I am the original author.

>
> So in conclusion both patches are good.
>
> Jonathan
>
>> Thanks,
>> alisons
>>
>>>
>>>> alisons
>>>>>
>>>>> Signed-off-by: simran singhal 
>>>>> ---
>>>>>
>>>>>  v4:
>>>>>-Add mutex_init
>>>>>
>>>>>  drivers/staging/iio/meter/ade7753.c | 7 +--
>>>>>  1 file changed, 5 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/drivers/staging/iio/meter/ade7753.c 
>>>>> b/drivers/staging/iio/meter/ade7753.c
>>>>> index b71fbd3..30aebaf 100644
>>>>> --- a/drivers/staging/iio/meter/ade7753.c
>>>>> +++ b/drivers/staging/iio/meter/ade7753.c
>>>>> @@ -80,11 +80,13 @@
>>>>>   * @us: actual spi_device
>>>>>   * @tx: transmit buffer
>>>>>   * @rx: receive buffer
>>>>> + * @lock:   protect sensor state
>>>>>   * @buf_lock:   mutex to protect tx and rx
>>>>>   **/
>>>>>  struct ade7753_state {
>>>>>   struct spi_device   *us;
>>>>>   struct mutexbuf_lock;
>>>>> + struct mutexlock;  /* protect sensor state */
>>>>>   u8  tx[ADE7753_MAX_TX] cacheline_aligned;
>>>>>   u8  rx[ADE7753_MAX_RX];
>>>>>  };
>>>>> @@ -484,7 +486,7 @@ static ssize_t ade7753_write_frequency(struct device 
>>>>> *dev,
>>>>>   if (!val)
>>>>>   return -EINVAL;
>>>>>
>>>>> - mutex_lock(_dev->mlock);
>>>>> + mutex_lock(>lock);
>>>>>
>>>>>   t = 27900 / val;
>>>>>   if (t > 0)
>>>>> @@ -505,7 +507,7 @@ static ssize_t ade7753_write_frequency(struct device 
>>>>> *dev,
>>>>>   ret = ade7753_spi_write_reg_16(dev, ADE7753_MODE, reg);
>>>>>
>>>>>  out:
>>>>> - mutex_unlock(_dev->mlock);
>>>>> + mutex_unlock(>lock);
>>>>>
>>>>>   return ret ? ret : len;
>>>>>  }
>>>>> @@ -581,6 +583,7 @@ static int ade7753_probe(struct spi_device *spi)
>>>>>   st = iio_priv(indio_dev);
>>>>>   st->us = spi;
>>>>>   mutex_init(>buf_lock);
>>>>> + mutex_init(>lock);
>>>>>
>>>>>   indio_dev->name = spi->dev.driver->name;
>>>>>   indio_dev->dev.parent = >dev;
>>>>> --
>>>>> 2.7.4
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google Groups 
>>>>> "outreachy-kernel" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>>>> email to outreachy-kernel+unsubscr...@googlegroups.com.
>>>>> To post to this group, send email to outreachy-ker...@googlegroups.com.
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/outreachy-kernel/20170323183520.GA9871%40singhal-Inspiron-5558.
>>>>> For more options, visit https://groups.google.com/d/optout.
>


[PATCH v2] iio: light: lm3533-als: constify attribute_group structures

2017-03-30 Thread simran singhal
Check for attribute_group structures that are only stored in the
event_attrs filed of iio_info structure. As the event_attrs field of
iio_info structures is constant, so these attribute_group structures can
also be declared constant. Done using coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};

@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.event_attrs=@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;

As the attrs field of iio_info structures is also constant, so these
attribute_group structures can also be declared constant. Done manually.

File size before:
   textdata bss dec hex filename
   57982376   081741fee drivers/iio/light/lm3533-als.o

File size after:
   textdata bss dec hex filename
   59262248   081741fee drivers/iio/light/lm3533-als.o

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 v2:
   -make one more attribute_group const.
   -change the values of file size after.
   -change commit message.

 drivers/iio/light/lm3533-als.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/light/lm3533-als.c b/drivers/iio/light/lm3533-als.c
index f409c20..0443fd2 100644
--- a/drivers/iio/light/lm3533-als.c
+++ b/drivers/iio/light/lm3533-als.c
@@ -690,7 +690,7 @@ static struct attribute *lm3533_als_event_attributes[] = {
NULL
 };
 
-static struct attribute_group lm3533_als_event_attribute_group = {
+static const struct attribute_group lm3533_als_event_attribute_group = {
.attrs = lm3533_als_event_attributes
 };
 
@@ -714,7 +714,7 @@ static struct attribute *lm3533_als_attributes[] = {
NULL
 };
 
-static struct attribute_group lm3533_als_attribute_group = {
+static const struct attribute_group lm3533_als_attribute_group = {
.attrs = lm3533_als_attributes
 };
 
-- 
2.7.4



[PATCH v2] iio: light: lm3533-als: constify attribute_group structures

2017-03-30 Thread simran singhal
Check for attribute_group structures that are only stored in the
event_attrs filed of iio_info structure. As the event_attrs field of
iio_info structures is constant, so these attribute_group structures can
also be declared constant. Done using coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};

@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.event_attrs=@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;

As the attrs field of iio_info structures is also constant, so these
attribute_group structures can also be declared constant. Done manually.

File size before:
   textdata bss dec hex filename
   57982376   081741fee drivers/iio/light/lm3533-als.o

File size after:
   textdata bss dec hex filename
   59262248   081741fee drivers/iio/light/lm3533-als.o

Signed-off-by: simran singhal 
---
 v2:
   -make one more attribute_group const.
   -change the values of file size after.
   -change commit message.

 drivers/iio/light/lm3533-als.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/light/lm3533-als.c b/drivers/iio/light/lm3533-als.c
index f409c20..0443fd2 100644
--- a/drivers/iio/light/lm3533-als.c
+++ b/drivers/iio/light/lm3533-als.c
@@ -690,7 +690,7 @@ static struct attribute *lm3533_als_event_attributes[] = {
NULL
 };
 
-static struct attribute_group lm3533_als_event_attribute_group = {
+static const struct attribute_group lm3533_als_event_attribute_group = {
.attrs = lm3533_als_event_attributes
 };
 
@@ -714,7 +714,7 @@ static struct attribute *lm3533_als_attributes[] = {
NULL
 };
 
-static struct attribute_group lm3533_als_attribute_group = {
+static const struct attribute_group lm3533_als_attribute_group = {
.attrs = lm3533_als_attributes
 };
 
-- 
2.7.4



Re: [PATCH] iio: adc: ad799x: constify attribute_group structures

2017-03-29 Thread SIMRAN SINGHAL
On Thu, Mar 30, 2017 at 3:06 AM, Jonathan Cameron <ji...@kernel.org> wrote:
> On 29/03/17 22:28, SIMRAN SINGHAL wrote:
>> On Thu, Mar 30, 2017 at 2:43 AM, Jonathan Cameron <ji...@kernel.org> wrote:
>>> On 28/03/17 21:07, simran singhal wrote:
>>>> Check for attribute_group structures that are only stored in the
>>>> event_attrs filed of iio_info structure. As the event_attrs field of
>>>> iio_info structures is constant, so these attribute_group structures can
>>>> also be declared constant.
>>>> Done using coccinelle:
>>>>
>>>> @r1 disable optional_qualifier @
>>>> identifier i;
>>>> position p;
>>>> @@
>>>> static struct attribute_group i@p = {...};
>>>>
>>>> @ok1@
>>>> identifier r1.i;
>>>> position p;
>>>> struct iio_info x;
>>>> @@
>>>> x.event_attrs=@p;
>>>>
>>>> @bad@
>>>> position p!={r1.p,ok1.p};
>>>> identifier r1.i;
>>>> @@
>>>> i@p
>>>>
>>>> @depends on !bad disable optional_qualifier@
>>>> identifier r1.i;
>>>> @@
>>>> static
>>>> +const
>>>> struct attribute_group i={...};
>>>>
>>>> @depends on !bad disable optional_qualifier@
>>>> identifier r1.i;
>>>> @@
>>>> +const
>>>> struct attribute_group i;
>>>>
>>>> File size before:
>>>>textdata bss dec hex filename
>>>>   26051 464   0   265156793 drivers/iio/adc/ad799x.o
>>>>
>>>> File size after:
>>>>text  data bss dec hex filename
>>>>   26115   400   0   265156793 drivers/iio/adc/ad799x.o
>>>>
>>>> Signed-off-by: simran singhal <singhalsimr...@gmail.com>
>>> Applied to the togreg branch of iio.git and pushed out as testing
>>> for the autobuilders to play with it.
>>>
>>
>> But my tree is up-to-date and I also test it before sending.
> this is standard practice.  I build as well before pushing out, but
> I only do one or two configurations of one or two architectures.
> The autobuilders are a set of large servers that Intel run as a service
> to the kernel community.
>
> Typically they'll run a few hundred builds for dozens of processor 
> architectures
> + a much more extensive set of static tests than most kernel developers
> are set up to run.  Here things will almost certainly be fine, but
> I've been wrong before!
>
> The only thing is I tend to push out in the evening then go to bed before
> the results come in, then might not get to it for a day or so to push out
> as togreg.  This tree I am happy to rebase - that is I can drop or fixup
> patches with issues.  The togreg branch is the one that people often
> base new work on, so if I change the tree under them all sorts of nasty
> merge issues can occur.
>
> This is why most trees that ultimately go upstream are non rebasing -
> but a lot of people now have a testing branch which is deliberately
> unofficial - people shouldn't use it to base their trees on as it
> is temporary for build test purposes.
>
> Greg has one as well (I assume this is what it is for), he just tends
> to be quicker about dealing with whatever comes up than I am so
> doesn't explicitly mention it when he takes patches.
>
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/log/?h=staging-testing
>
> So it's nothing to worry about. I just put that note in so people
> don't wonder why their patch isn't immediately present in the public
> togreg branch of iio.git.
>

Thanks for the explaination.

Simran

> Jonathan
>>
>>> Thanks,
>>>
>>> Jonathan
>>>> ---
>>>>  drivers/iio/adc/ad799x.c | 2 +-
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c
>>>> index 9704090..22426ae 100644
>>>> --- a/drivers/iio/adc/ad799x.c
>>>> +++ b/drivers/iio/adc/ad799x.c
>>>> @@ -520,7 +520,7 @@ static struct attribute *ad799x_event_attributes[] = {
>>>>   NULL,
>>>>  };
>>>>
>>>> -static struct attribute_group ad799x_event_attrs_group = {
>>>> +static const struct attribute_group ad799x_event_attrs_group = {
>>>>   .attrs = ad799x_event_attributes,
>>>>  };
>>>>
>>>>
>>>
>


Re: [PATCH] iio: adc: ad799x: constify attribute_group structures

2017-03-29 Thread SIMRAN SINGHAL
On Thu, Mar 30, 2017 at 3:06 AM, Jonathan Cameron  wrote:
> On 29/03/17 22:28, SIMRAN SINGHAL wrote:
>> On Thu, Mar 30, 2017 at 2:43 AM, Jonathan Cameron  wrote:
>>> On 28/03/17 21:07, simran singhal wrote:
>>>> Check for attribute_group structures that are only stored in the
>>>> event_attrs filed of iio_info structure. As the event_attrs field of
>>>> iio_info structures is constant, so these attribute_group structures can
>>>> also be declared constant.
>>>> Done using coccinelle:
>>>>
>>>> @r1 disable optional_qualifier @
>>>> identifier i;
>>>> position p;
>>>> @@
>>>> static struct attribute_group i@p = {...};
>>>>
>>>> @ok1@
>>>> identifier r1.i;
>>>> position p;
>>>> struct iio_info x;
>>>> @@
>>>> x.event_attrs=@p;
>>>>
>>>> @bad@
>>>> position p!={r1.p,ok1.p};
>>>> identifier r1.i;
>>>> @@
>>>> i@p
>>>>
>>>> @depends on !bad disable optional_qualifier@
>>>> identifier r1.i;
>>>> @@
>>>> static
>>>> +const
>>>> struct attribute_group i={...};
>>>>
>>>> @depends on !bad disable optional_qualifier@
>>>> identifier r1.i;
>>>> @@
>>>> +const
>>>> struct attribute_group i;
>>>>
>>>> File size before:
>>>>textdata bss dec hex filename
>>>>   26051 464   0   265156793 drivers/iio/adc/ad799x.o
>>>>
>>>> File size after:
>>>>text  data bss dec hex filename
>>>>   26115   400   0   265156793 drivers/iio/adc/ad799x.o
>>>>
>>>> Signed-off-by: simran singhal 
>>> Applied to the togreg branch of iio.git and pushed out as testing
>>> for the autobuilders to play with it.
>>>
>>
>> But my tree is up-to-date and I also test it before sending.
> this is standard practice.  I build as well before pushing out, but
> I only do one or two configurations of one or two architectures.
> The autobuilders are a set of large servers that Intel run as a service
> to the kernel community.
>
> Typically they'll run a few hundred builds for dozens of processor 
> architectures
> + a much more extensive set of static tests than most kernel developers
> are set up to run.  Here things will almost certainly be fine, but
> I've been wrong before!
>
> The only thing is I tend to push out in the evening then go to bed before
> the results come in, then might not get to it for a day or so to push out
> as togreg.  This tree I am happy to rebase - that is I can drop or fixup
> patches with issues.  The togreg branch is the one that people often
> base new work on, so if I change the tree under them all sorts of nasty
> merge issues can occur.
>
> This is why most trees that ultimately go upstream are non rebasing -
> but a lot of people now have a testing branch which is deliberately
> unofficial - people shouldn't use it to base their trees on as it
> is temporary for build test purposes.
>
> Greg has one as well (I assume this is what it is for), he just tends
> to be quicker about dealing with whatever comes up than I am so
> doesn't explicitly mention it when he takes patches.
>
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/log/?h=staging-testing
>
> So it's nothing to worry about. I just put that note in so people
> don't wonder why their patch isn't immediately present in the public
> togreg branch of iio.git.
>

Thanks for the explaination.

Simran

> Jonathan
>>
>>> Thanks,
>>>
>>> Jonathan
>>>> ---
>>>>  drivers/iio/adc/ad799x.c | 2 +-
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c
>>>> index 9704090..22426ae 100644
>>>> --- a/drivers/iio/adc/ad799x.c
>>>> +++ b/drivers/iio/adc/ad799x.c
>>>> @@ -520,7 +520,7 @@ static struct attribute *ad799x_event_attributes[] = {
>>>>   NULL,
>>>>  };
>>>>
>>>> -static struct attribute_group ad799x_event_attrs_group = {
>>>> +static const struct attribute_group ad799x_event_attrs_group = {
>>>>   .attrs = ad799x_event_attributes,
>>>>  };
>>>>
>>>>
>>>
>


Re: [PATCH] iio: adc: ad799x: constify attribute_group structures

2017-03-29 Thread SIMRAN SINGHAL
On Thu, Mar 30, 2017 at 2:43 AM, Jonathan Cameron <ji...@kernel.org> wrote:
> On 28/03/17 21:07, simran singhal wrote:
>> Check for attribute_group structures that are only stored in the
>> event_attrs filed of iio_info structure. As the event_attrs field of
>> iio_info structures is constant, so these attribute_group structures can
>> also be declared constant.
>> Done using coccinelle:
>>
>> @r1 disable optional_qualifier @
>> identifier i;
>> position p;
>> @@
>> static struct attribute_group i@p = {...};
>>
>> @ok1@
>> identifier r1.i;
>> position p;
>> struct iio_info x;
>> @@
>> x.event_attrs=@p;
>>
>> @bad@
>> position p!={r1.p,ok1.p};
>> identifier r1.i;
>> @@
>> i@p
>>
>> @depends on !bad disable optional_qualifier@
>> identifier r1.i;
>> @@
>> static
>> +const
>> struct attribute_group i={...};
>>
>> @depends on !bad disable optional_qualifier@
>> identifier r1.i;
>> @@
>> +const
>> struct attribute_group i;
>>
>> File size before:
>>textdata bss dec hex filename
>>   26051 464   0   265156793 drivers/iio/adc/ad799x.o
>>
>> File size after:
>>text  data bss dec hex filename
>>   26115   400   0   265156793 drivers/iio/adc/ad799x.o
>>
>> Signed-off-by: simran singhal <singhalsimr...@gmail.com>
> Applied to the togreg branch of iio.git and pushed out as testing
> for the autobuilders to play with it.
>

But my tree is up-to-date and I also test it before sending.

> Thanks,
>
> Jonathan
>> ---
>>  drivers/iio/adc/ad799x.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c
>> index 9704090..22426ae 100644
>> --- a/drivers/iio/adc/ad799x.c
>> +++ b/drivers/iio/adc/ad799x.c
>> @@ -520,7 +520,7 @@ static struct attribute *ad799x_event_attributes[] = {
>>   NULL,
>>  };
>>
>> -static struct attribute_group ad799x_event_attrs_group = {
>> +static const struct attribute_group ad799x_event_attrs_group = {
>>   .attrs = ad799x_event_attributes,
>>  };
>>
>>
>


Re: [PATCH] iio: adc: ad799x: constify attribute_group structures

2017-03-29 Thread SIMRAN SINGHAL
On Thu, Mar 30, 2017 at 2:43 AM, Jonathan Cameron  wrote:
> On 28/03/17 21:07, simran singhal wrote:
>> Check for attribute_group structures that are only stored in the
>> event_attrs filed of iio_info structure. As the event_attrs field of
>> iio_info structures is constant, so these attribute_group structures can
>> also be declared constant.
>> Done using coccinelle:
>>
>> @r1 disable optional_qualifier @
>> identifier i;
>> position p;
>> @@
>> static struct attribute_group i@p = {...};
>>
>> @ok1@
>> identifier r1.i;
>> position p;
>> struct iio_info x;
>> @@
>> x.event_attrs=@p;
>>
>> @bad@
>> position p!={r1.p,ok1.p};
>> identifier r1.i;
>> @@
>> i@p
>>
>> @depends on !bad disable optional_qualifier@
>> identifier r1.i;
>> @@
>> static
>> +const
>> struct attribute_group i={...};
>>
>> @depends on !bad disable optional_qualifier@
>> identifier r1.i;
>> @@
>> +const
>> struct attribute_group i;
>>
>> File size before:
>>textdata bss dec hex filename
>>   26051 464   0   265156793 drivers/iio/adc/ad799x.o
>>
>> File size after:
>>text  data bss dec hex filename
>>   26115   400   0   265156793 drivers/iio/adc/ad799x.o
>>
>> Signed-off-by: simran singhal 
> Applied to the togreg branch of iio.git and pushed out as testing
> for the autobuilders to play with it.
>

But my tree is up-to-date and I also test it before sending.

> Thanks,
>
> Jonathan
>> ---
>>  drivers/iio/adc/ad799x.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c
>> index 9704090..22426ae 100644
>> --- a/drivers/iio/adc/ad799x.c
>> +++ b/drivers/iio/adc/ad799x.c
>> @@ -520,7 +520,7 @@ static struct attribute *ad799x_event_attributes[] = {
>>   NULL,
>>  };
>>
>> -static struct attribute_group ad799x_event_attrs_group = {
>> +static const struct attribute_group ad799x_event_attrs_group = {
>>   .attrs = ad799x_event_attributes,
>>  };
>>
>>
>


Re: [PATCH] iio: adc: max1363: constify attribute_group structures

2017-03-29 Thread SIMRAN SINGHAL
On Thu, Mar 30, 2017 at 2:41 AM, Jonathan Cameron <ji...@kernel.org> wrote:
> On 28/03/17 21:15, simran singhal wrote:
>> Check for attribute_group structures that are only stored in the
>> event_attrs filed of iio_info structure. As the event_attrs field of
>> iio_info structures is constant, so these attribute_group structures can
>> also be declared constant. Done using coccinelle:
>>
>> @r1 disable optional_qualifier @
>> identifier i;
>> position p;
>> @@
>> static struct attribute_group i@p = {...};
>>
>> @ok1@
>> identifier r1.i;
>> position p;
>> struct iio_info x;
>> @@
>> x.event_attrs=@p;
>>
>> @bad@
>> position p!={r1.p,ok1.p};
>> identifier r1.i;
>> @@
>> i@p
>>
>> @depends on !bad disable optional_qualifier@
>> identifier r1.i;
>> @@
>> static
>> +const
>> struct attribute_group i={...};
>>
>> @depends on !bad disable optional_qualifier@
>> identifier r1.i;
>> @@
>> +const
>> struct attribute_group i;
>>
>> File size before:
>>textdata bss dec hex filename
>>   36951 448   0   373999217 drivers/iio/adc/max1363.o
>>
>> File size after:
>>text  data bss dec hex filename
>>   37015   384   0   373999217 drivers/iio/adc/max1363.o
>>
>> Signed-off-by: simran singhal <singhalsimr...@gmail.com>
> Applied to the togreg branch of iio.git and pushed out as testing for
> the autobuilders to play with it.
>

But my tree is up-to-date and I also test it before sending.

> Thanks,
>
> Jonathan
>> ---
>>  drivers/iio/adc/max1363.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/adc/max1363.c b/drivers/iio/adc/max1363.c
>> index c6c12fe..80eada4 100644
>> --- a/drivers/iio/adc/max1363.c
>> +++ b/drivers/iio/adc/max1363.c
>> @@ -1007,7 +1007,7 @@ static struct attribute *max1363_event_attributes[] = {
>>   NULL,
>>  };
>>
>> -static struct attribute_group max1363_event_attribute_group = {
>> +static const struct attribute_group max1363_event_attribute_group = {
>>   .attrs = max1363_event_attributes,
>>  };
>>
>>
>


Re: [PATCH] iio: dac: ad5504: constify attribute_group structures

2017-03-29 Thread SIMRAN SINGHAL
On Thu, Mar 30, 2017 at 2:39 AM, Jonathan Cameron <ji...@kernel.org> wrote:
> On 28/03/17 21:21, simran singhal wrote:
>> Check for attribute_group structures that are only stored in the
>> event_attrs filed of iio_info structure. As the event_attrs field of
>> iio_info structures is constant, so these attribute_group structures can
>> also be declared constant. Done using coccinelle:
>>
>> @r1 disable optional_qualifier @
>> identifier i;
>> position p;
>> @@
>> static struct attribute_group i@p = {...};
>>
>> @ok1@
>> identifier r1.i;
>> position p;
>> struct iio_info x;
>> @@
>> x.event_attrs=@p;
>>
>> @bad@
>> position p!={r1.p,ok1.p};
>> identifier r1.i;
>> @@
>> i@p
>>
>> @depends on !bad disable optional_qualifier@
>> identifier r1.i;
>> @@
>> static
>> +const
>> struct attribute_group i={...};
>>
>> @depends on !bad disable optional_qualifier@
>> identifier r1.i;
>> @@
>> +const
>> struct attribute_group i;
>>
>> File size before:
>>textdata bss dec hex filename
>>3046 360   03406 d4e drivers/iio/dac/ad5504.o
>>
>> File size after:
>>text  data bss dec hex filename
>>3110   296   03406 d4e drivers/iio/dac/ad5504.o
>>
>> Signed-off-by: simran singhal <singhalsimr...@gmail.com>
> Applied to the togreg branch of iio.git and pushed out as testing
> for the autobuilders to play with it.
>
But my tree is up-to-date and I also test it before sending.

> Thanks,
>
> Jonathan
>> ---
>>  drivers/iio/dac/ad5504.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c
>> index 788b3d6..22a027d 100644
>> --- a/drivers/iio/dac/ad5504.c
>> +++ b/drivers/iio/dac/ad5504.c
>> @@ -212,7 +212,7 @@ static struct attribute *ad5504_ev_attributes[] = {
>>   NULL,
>>  };
>>
>> -static struct attribute_group ad5504_ev_attribute_group = {
>> +static const struct attribute_group ad5504_ev_attribute_group = {
>>   .attrs = ad5504_ev_attributes,
>>  };
>>
>>
>


Re: [PATCH] iio: adc: max1363: constify attribute_group structures

2017-03-29 Thread SIMRAN SINGHAL
On Thu, Mar 30, 2017 at 2:41 AM, Jonathan Cameron  wrote:
> On 28/03/17 21:15, simran singhal wrote:
>> Check for attribute_group structures that are only stored in the
>> event_attrs filed of iio_info structure. As the event_attrs field of
>> iio_info structures is constant, so these attribute_group structures can
>> also be declared constant. Done using coccinelle:
>>
>> @r1 disable optional_qualifier @
>> identifier i;
>> position p;
>> @@
>> static struct attribute_group i@p = {...};
>>
>> @ok1@
>> identifier r1.i;
>> position p;
>> struct iio_info x;
>> @@
>> x.event_attrs=@p;
>>
>> @bad@
>> position p!={r1.p,ok1.p};
>> identifier r1.i;
>> @@
>> i@p
>>
>> @depends on !bad disable optional_qualifier@
>> identifier r1.i;
>> @@
>> static
>> +const
>> struct attribute_group i={...};
>>
>> @depends on !bad disable optional_qualifier@
>> identifier r1.i;
>> @@
>> +const
>> struct attribute_group i;
>>
>> File size before:
>>textdata bss dec hex filename
>>   36951 448   0   373999217 drivers/iio/adc/max1363.o
>>
>> File size after:
>>text  data bss dec hex filename
>>   37015   384   0   373999217 drivers/iio/adc/max1363.o
>>
>> Signed-off-by: simran singhal 
> Applied to the togreg branch of iio.git and pushed out as testing for
> the autobuilders to play with it.
>

But my tree is up-to-date and I also test it before sending.

> Thanks,
>
> Jonathan
>> ---
>>  drivers/iio/adc/max1363.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/adc/max1363.c b/drivers/iio/adc/max1363.c
>> index c6c12fe..80eada4 100644
>> --- a/drivers/iio/adc/max1363.c
>> +++ b/drivers/iio/adc/max1363.c
>> @@ -1007,7 +1007,7 @@ static struct attribute *max1363_event_attributes[] = {
>>   NULL,
>>  };
>>
>> -static struct attribute_group max1363_event_attribute_group = {
>> +static const struct attribute_group max1363_event_attribute_group = {
>>   .attrs = max1363_event_attributes,
>>  };
>>
>>
>


Re: [PATCH] iio: dac: ad5504: constify attribute_group structures

2017-03-29 Thread SIMRAN SINGHAL
On Thu, Mar 30, 2017 at 2:39 AM, Jonathan Cameron  wrote:
> On 28/03/17 21:21, simran singhal wrote:
>> Check for attribute_group structures that are only stored in the
>> event_attrs filed of iio_info structure. As the event_attrs field of
>> iio_info structures is constant, so these attribute_group structures can
>> also be declared constant. Done using coccinelle:
>>
>> @r1 disable optional_qualifier @
>> identifier i;
>> position p;
>> @@
>> static struct attribute_group i@p = {...};
>>
>> @ok1@
>> identifier r1.i;
>> position p;
>> struct iio_info x;
>> @@
>> x.event_attrs=@p;
>>
>> @bad@
>> position p!={r1.p,ok1.p};
>> identifier r1.i;
>> @@
>> i@p
>>
>> @depends on !bad disable optional_qualifier@
>> identifier r1.i;
>> @@
>> static
>> +const
>> struct attribute_group i={...};
>>
>> @depends on !bad disable optional_qualifier@
>> identifier r1.i;
>> @@
>> +const
>> struct attribute_group i;
>>
>> File size before:
>>textdata bss dec hex filename
>>3046 360   03406 d4e drivers/iio/dac/ad5504.o
>>
>> File size after:
>>text  data bss dec hex filename
>>3110   296   03406 d4e drivers/iio/dac/ad5504.o
>>
>> Signed-off-by: simran singhal 
> Applied to the togreg branch of iio.git and pushed out as testing
> for the autobuilders to play with it.
>
But my tree is up-to-date and I also test it before sending.

> Thanks,
>
> Jonathan
>> ---
>>  drivers/iio/dac/ad5504.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c
>> index 788b3d6..22a027d 100644
>> --- a/drivers/iio/dac/ad5504.c
>> +++ b/drivers/iio/dac/ad5504.c
>> @@ -212,7 +212,7 @@ static struct attribute *ad5504_ev_attributes[] = {
>>   NULL,
>>  };
>>
>> -static struct attribute_group ad5504_ev_attribute_group = {
>> +static const struct attribute_group ad5504_ev_attribute_group = {
>>   .attrs = ad5504_ev_attributes,
>>  };
>>
>>
>


Re: [Outreachy kernel] [PATCH 1/4] iio: common: st_sensors: Replace ternary operator with min macro

2017-03-29 Thread SIMRAN SINGHAL
On Wed, Mar 29, 2017 at 9:46 PM, Daniel Baluta <daniel.bal...@gmail.com> wrote:
> On Wed, Mar 29, 2017 at 3:33 PM, simran singhal
> <singhalsimr...@gmail.com> wrote:
>> Use macro min() to get the minimum of two values for brevity and
>> readability.
>>
>> Signed-off-by: simran singhal <singhalsimr...@gmail.com>
>> ---
>>  drivers/iio/common/st_sensors/st_sensors_i2c.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/common/st_sensors/st_sensors_i2c.c 
>> b/drivers/iio/common/st_sensors/st_sensors_i2c.c
>> index c83df4d..7a68fdd 100644
>> --- a/drivers/iio/common/st_sensors/st_sensors_i2c.c
>> +++ b/drivers/iio/common/st_sensors/st_sensors_i2c.c
>> @@ -39,7 +39,7 @@ static int st_sensors_i2c_read_byte(struct 
>> st_sensor_transfer_buffer *tb,
>> *res_byte = err & 0xff;
>>
>>  st_accel_i2c_read_byte_error:
>> -   return err < 0 ? err : 0;
>> +   return min(err, 0);
>>  }
>
> Appreciate the brevity but this certainly doesn't make code
> easier to read.
>
> In linux kernel err < 0 signifies an error and be replacing
> comparison < 0 with min() we some hide the meaning of this.
>
Yes, you are right keeping the previous one will be more
meaningful.

Thanks.

> thanks,
> Daniel.


Re: [Outreachy kernel] [PATCH 1/4] iio: common: st_sensors: Replace ternary operator with min macro

2017-03-29 Thread SIMRAN SINGHAL
On Wed, Mar 29, 2017 at 9:46 PM, Daniel Baluta  wrote:
> On Wed, Mar 29, 2017 at 3:33 PM, simran singhal
>  wrote:
>> Use macro min() to get the minimum of two values for brevity and
>> readability.
>>
>> Signed-off-by: simran singhal 
>> ---
>>  drivers/iio/common/st_sensors/st_sensors_i2c.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/common/st_sensors/st_sensors_i2c.c 
>> b/drivers/iio/common/st_sensors/st_sensors_i2c.c
>> index c83df4d..7a68fdd 100644
>> --- a/drivers/iio/common/st_sensors/st_sensors_i2c.c
>> +++ b/drivers/iio/common/st_sensors/st_sensors_i2c.c
>> @@ -39,7 +39,7 @@ static int st_sensors_i2c_read_byte(struct 
>> st_sensor_transfer_buffer *tb,
>> *res_byte = err & 0xff;
>>
>>  st_accel_i2c_read_byte_error:
>> -   return err < 0 ? err : 0;
>> +   return min(err, 0);
>>  }
>
> Appreciate the brevity but this certainly doesn't make code
> easier to read.
>
> In linux kernel err < 0 signifies an error and be replacing
> comparison < 0 with min() we some hide the meaning of this.
>
Yes, you are right keeping the previous one will be more
meaningful.

Thanks.

> thanks,
> Daniel.


Re: [Outreachy kernel] [PATCH 4/4] iio: light: si1145: Replace ternary operator with min macro

2017-03-29 Thread SIMRAN SINGHAL
On Wed, Mar 29, 2017 at 8:22 PM, SIMRAN SINGHAL
<singhalsimr...@gmail.com> wrote:
> On Wed, Mar 29, 2017 at 6:23 PM, Lars-Peter Clausen <l...@metafoo.de> wrote:
>> On 03/29/2017 02:40 PM, Julia Lawall wrote:
>>>
>>>
>>> On Wed, 29 Mar 2017, simran singhal wrote:
>>>
>>>> Use macro min() to get the minimum of two values for brevity and
>>>> readability.
>>>>
>>>> Signed-off-by: simran singhal <singhalsimr...@gmail.com>
>>>> ---
>>>>  drivers/iio/light/si1145.c | 2 +-
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/iio/light/si1145.c b/drivers/iio/light/si1145.c
>>>> index 096034c..e7ad6fb 100644
>>>> --- a/drivers/iio/light/si1145.c
>>>> +++ b/drivers/iio/light/si1145.c
>>>> @@ -557,7 +557,7 @@ static int si1145_set_chlist(struct iio_dev 
>>>> *indio_dev, unsigned long scan_mask)
>>>>  data->scan_mask = scan_mask;
>>>>  ret = si1145_param_set(data, SI1145_PARAM_CHLIST, reg);
>>>>
>>>> -return ret < 0 ? ret : 0;
>>>> +return min(ret, 0);
>>>
>>> A similar change involving max was already rejected.  ret < 0 is a
>>> standard way of detecting an error, so perhaps leaving that explicitly
>>> present will be preferred.
>>
>> I think a more sensible thing to do here is to check whether ret/err can
>> actually take any positive values and if not, replace the whole thing with
>> just 'return ret;' or 'return some_fn()'. I'd expect that his can be done in
>> most of the cases.
>>

Lars, I will check it and resend it.


Re: [Outreachy kernel] [PATCH 4/4] iio: light: si1145: Replace ternary operator with min macro

2017-03-29 Thread SIMRAN SINGHAL
On Wed, Mar 29, 2017 at 8:22 PM, SIMRAN SINGHAL
 wrote:
> On Wed, Mar 29, 2017 at 6:23 PM, Lars-Peter Clausen  wrote:
>> On 03/29/2017 02:40 PM, Julia Lawall wrote:
>>>
>>>
>>> On Wed, 29 Mar 2017, simran singhal wrote:
>>>
>>>> Use macro min() to get the minimum of two values for brevity and
>>>> readability.
>>>>
>>>> Signed-off-by: simran singhal 
>>>> ---
>>>>  drivers/iio/light/si1145.c | 2 +-
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/iio/light/si1145.c b/drivers/iio/light/si1145.c
>>>> index 096034c..e7ad6fb 100644
>>>> --- a/drivers/iio/light/si1145.c
>>>> +++ b/drivers/iio/light/si1145.c
>>>> @@ -557,7 +557,7 @@ static int si1145_set_chlist(struct iio_dev 
>>>> *indio_dev, unsigned long scan_mask)
>>>>  data->scan_mask = scan_mask;
>>>>  ret = si1145_param_set(data, SI1145_PARAM_CHLIST, reg);
>>>>
>>>> -return ret < 0 ? ret : 0;
>>>> +return min(ret, 0);
>>>
>>> A similar change involving max was already rejected.  ret < 0 is a
>>> standard way of detecting an error, so perhaps leaving that explicitly
>>> present will be preferred.
>>
>> I think a more sensible thing to do here is to check whether ret/err can
>> actually take any positive values and if not, replace the whole thing with
>> just 'return ret;' or 'return some_fn()'. I'd expect that his can be done in
>> most of the cases.
>>

Lars, I will check it and resend it.


Re: [Outreachy kernel] [PATCH 4/4] iio: light: si1145: Replace ternary operator with min macro

2017-03-29 Thread SIMRAN SINGHAL
On Wed, Mar 29, 2017 at 6:23 PM, Lars-Peter Clausen <l...@metafoo.de> wrote:
> On 03/29/2017 02:40 PM, Julia Lawall wrote:
>>
>>
>> On Wed, 29 Mar 2017, simran singhal wrote:
>>
>>> Use macro min() to get the minimum of two values for brevity and
>>> readability.
>>>
>>> Signed-off-by: simran singhal <singhalsimr...@gmail.com>
>>> ---
>>>  drivers/iio/light/si1145.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/iio/light/si1145.c b/drivers/iio/light/si1145.c
>>> index 096034c..e7ad6fb 100644
>>> --- a/drivers/iio/light/si1145.c
>>> +++ b/drivers/iio/light/si1145.c
>>> @@ -557,7 +557,7 @@ static int si1145_set_chlist(struct iio_dev *indio_dev, 
>>> unsigned long scan_mask)
>>>  data->scan_mask = scan_mask;
>>>  ret = si1145_param_set(data, SI1145_PARAM_CHLIST, reg);
>>>
>>> -return ret < 0 ? ret : 0;
>>> +return min(ret, 0);
>>
>> A similar change involving max was already rejected.  ret < 0 is a
>> standard way of detecting an error, so perhaps leaving that explicitly
>> present will be preferred.
>
> I think a more sensible thing to do here is to check whether ret/err can
> actually take any positive values and if not, replace the whole thing with
> just 'return ret;' or 'return some_fn()'. I'd expect that his can be done in
> most of the cases.
>


Re: [Outreachy kernel] [PATCH 4/4] iio: light: si1145: Replace ternary operator with min macro

2017-03-29 Thread SIMRAN SINGHAL
On Wed, Mar 29, 2017 at 6:23 PM, Lars-Peter Clausen  wrote:
> On 03/29/2017 02:40 PM, Julia Lawall wrote:
>>
>>
>> On Wed, 29 Mar 2017, simran singhal wrote:
>>
>>> Use macro min() to get the minimum of two values for brevity and
>>> readability.
>>>
>>> Signed-off-by: simran singhal 
>>> ---
>>>  drivers/iio/light/si1145.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/iio/light/si1145.c b/drivers/iio/light/si1145.c
>>> index 096034c..e7ad6fb 100644
>>> --- a/drivers/iio/light/si1145.c
>>> +++ b/drivers/iio/light/si1145.c
>>> @@ -557,7 +557,7 @@ static int si1145_set_chlist(struct iio_dev *indio_dev, 
>>> unsigned long scan_mask)
>>>  data->scan_mask = scan_mask;
>>>  ret = si1145_param_set(data, SI1145_PARAM_CHLIST, reg);
>>>
>>> -return ret < 0 ? ret : 0;
>>> +return min(ret, 0);
>>
>> A similar change involving max was already rejected.  ret < 0 is a
>> standard way of detecting an error, so perhaps leaving that explicitly
>> present will be preferred.
>
> I think a more sensible thing to do here is to check whether ret/err can
> actually take any positive values and if not, replace the whole thing with
> just 'return ret;' or 'return some_fn()'. I'd expect that his can be done in
> most of the cases.
>


[PATCH] iio: accel: bma180: Set up buffer timestamps for non-zero values

2017-03-29 Thread simran singhal
Use the iio_pollfunc_store_time parameter during triggered buffer set-up
to get valid timestamps.

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/iio/accel/bma180.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c
index efc6773..4ae5c80 100644
--- a/drivers/iio/accel/bma180.c
+++ b/drivers/iio/accel/bma180.c
@@ -762,7 +762,7 @@ static int bma180_probe(struct i2c_client *client,
goto err_trigger_free;
}
 
-   ret = iio_triggered_buffer_setup(indio_dev, NULL,
+   ret = iio_triggered_buffer_setup(indio_dev, iio_pollfunc_store_time,
bma180_trigger_handler, NULL);
if (ret < 0) {
dev_err(>dev, "unable to setup iio triggered buffer\n");
-- 
2.7.4



[PATCH] iio: accel: bma180: Set up buffer timestamps for non-zero values

2017-03-29 Thread simran singhal
Use the iio_pollfunc_store_time parameter during triggered buffer set-up
to get valid timestamps.

Signed-off-by: simran singhal 
---
 drivers/iio/accel/bma180.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c
index efc6773..4ae5c80 100644
--- a/drivers/iio/accel/bma180.c
+++ b/drivers/iio/accel/bma180.c
@@ -762,7 +762,7 @@ static int bma180_probe(struct i2c_client *client,
goto err_trigger_free;
}
 
-   ret = iio_triggered_buffer_setup(indio_dev, NULL,
+   ret = iio_triggered_buffer_setup(indio_dev, iio_pollfunc_store_time,
bma180_trigger_handler, NULL);
if (ret < 0) {
dev_err(>dev, "unable to setup iio triggered buffer\n");
-- 
2.7.4



[PATCH 3/4] iio: imu: st_lsm6dsx: Replace ternary operator with min macro

2017-03-29 Thread simran singhal
Use macro min() to get the minimum of two values for brevity and
readability.

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c 
b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
index e959825..e11653d 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
@@ -203,7 +203,7 @@ int st_lsm6dsx_update_watermark(struct st_lsm6dsx_sensor 
*sensor, u16 watermark)
 out:
mutex_unlock(>lock);
 
-   return err < 0 ? err : 0;
+   return min(err, 0);
 }
 
 /**
-- 
2.7.4



[PATCH 4/4] iio: light: si1145: Replace ternary operator with min macro

2017-03-29 Thread simran singhal
Use macro min() to get the minimum of two values for brevity and
readability.

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/iio/light/si1145.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/light/si1145.c b/drivers/iio/light/si1145.c
index 096034c..e7ad6fb 100644
--- a/drivers/iio/light/si1145.c
+++ b/drivers/iio/light/si1145.c
@@ -557,7 +557,7 @@ static int si1145_set_chlist(struct iio_dev *indio_dev, 
unsigned long scan_mask)
data->scan_mask = scan_mask;
ret = si1145_param_set(data, SI1145_PARAM_CHLIST, reg);
 
-   return ret < 0 ? ret : 0;
+   return min(ret, 0);
 }
 
 static int si1145_measure(struct iio_dev *indio_dev,
-- 
2.7.4



[PATCH 3/4] iio: imu: st_lsm6dsx: Replace ternary operator with min macro

2017-03-29 Thread simran singhal
Use macro min() to get the minimum of two values for brevity and
readability.

Signed-off-by: simran singhal 
---
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c 
b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
index e959825..e11653d 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
@@ -203,7 +203,7 @@ int st_lsm6dsx_update_watermark(struct st_lsm6dsx_sensor 
*sensor, u16 watermark)
 out:
mutex_unlock(>lock);
 
-   return err < 0 ? err : 0;
+   return min(err, 0);
 }
 
 /**
-- 
2.7.4



[PATCH 4/4] iio: light: si1145: Replace ternary operator with min macro

2017-03-29 Thread simran singhal
Use macro min() to get the minimum of two values for brevity and
readability.

Signed-off-by: simran singhal 
---
 drivers/iio/light/si1145.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/light/si1145.c b/drivers/iio/light/si1145.c
index 096034c..e7ad6fb 100644
--- a/drivers/iio/light/si1145.c
+++ b/drivers/iio/light/si1145.c
@@ -557,7 +557,7 @@ static int si1145_set_chlist(struct iio_dev *indio_dev, 
unsigned long scan_mask)
data->scan_mask = scan_mask;
ret = si1145_param_set(data, SI1145_PARAM_CHLIST, reg);
 
-   return ret < 0 ? ret : 0;
+   return min(ret, 0);
 }
 
 static int si1145_measure(struct iio_dev *indio_dev,
-- 
2.7.4



[PATCH 2/4] iio: imu: st_lsm6dsx: Replace ternary operator with min macro

2017-03-29 Thread simran singhal
Use macro min() to get the minimum of two values for brevity and
readability.

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/iio/humidity/hts221_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/humidity/hts221_core.c 
b/drivers/iio/humidity/hts221_core.c
index 3f3ef4a1..f98240a 100644
--- a/drivers/iio/humidity/hts221_core.c
+++ b/drivers/iio/humidity/hts221_core.c
@@ -206,7 +206,7 @@ int hts221_config_drdy(struct hts221_hw *hw, bool enable)
err = hts221_write_with_mask(hw, HTS221_REG_CNTRL3_ADDR,
 HTS221_DRDY_MASK, val);
 
-   return err < 0 ? err : 0;
+   return min(err, 0);
 }
 
 static int hts221_update_odr(struct hts221_hw *hw, u8 odr)
-- 
2.7.4



[PATCH 0/4] drivers: iio: Replace ternary operator with min macro

2017-03-29 Thread simran singhal
Use macro min() to get the minimum of two values for brevity and readability. 

simran singhal (4):
  iio: common: st_sensors: Replace ternary operator with min macro
  iio: imu: st_lsm6dsx: Replace ternary operator with min macro
  iio: imu: st_lsm6dsx: Replace ternary operator with min macro
  iio: light: si1145: Replace ternary operator with min macro

 drivers/iio/common/st_sensors/st_sensors_i2c.c | 2 +-
 drivers/iio/humidity/hts221_core.c | 2 +-
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 2 +-
 drivers/iio/light/si1145.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.7.4



[PATCH 1/4] iio: common: st_sensors: Replace ternary operator with min macro

2017-03-29 Thread simran singhal
Use macro min() to get the minimum of two values for brevity and
readability.

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 drivers/iio/common/st_sensors/st_sensors_i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/common/st_sensors/st_sensors_i2c.c 
b/drivers/iio/common/st_sensors/st_sensors_i2c.c
index c83df4d..7a68fdd 100644
--- a/drivers/iio/common/st_sensors/st_sensors_i2c.c
+++ b/drivers/iio/common/st_sensors/st_sensors_i2c.c
@@ -39,7 +39,7 @@ static int st_sensors_i2c_read_byte(struct 
st_sensor_transfer_buffer *tb,
*res_byte = err & 0xff;
 
 st_accel_i2c_read_byte_error:
-   return err < 0 ? err : 0;
+   return min(err, 0);
 }
 
 static int st_sensors_i2c_read_multiple_byte(
-- 
2.7.4



[PATCH 2/4] iio: imu: st_lsm6dsx: Replace ternary operator with min macro

2017-03-29 Thread simran singhal
Use macro min() to get the minimum of two values for brevity and
readability.

Signed-off-by: simran singhal 
---
 drivers/iio/humidity/hts221_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/humidity/hts221_core.c 
b/drivers/iio/humidity/hts221_core.c
index 3f3ef4a1..f98240a 100644
--- a/drivers/iio/humidity/hts221_core.c
+++ b/drivers/iio/humidity/hts221_core.c
@@ -206,7 +206,7 @@ int hts221_config_drdy(struct hts221_hw *hw, bool enable)
err = hts221_write_with_mask(hw, HTS221_REG_CNTRL3_ADDR,
 HTS221_DRDY_MASK, val);
 
-   return err < 0 ? err : 0;
+   return min(err, 0);
 }
 
 static int hts221_update_odr(struct hts221_hw *hw, u8 odr)
-- 
2.7.4



[PATCH 0/4] drivers: iio: Replace ternary operator with min macro

2017-03-29 Thread simran singhal
Use macro min() to get the minimum of two values for brevity and readability. 

simran singhal (4):
  iio: common: st_sensors: Replace ternary operator with min macro
  iio: imu: st_lsm6dsx: Replace ternary operator with min macro
  iio: imu: st_lsm6dsx: Replace ternary operator with min macro
  iio: light: si1145: Replace ternary operator with min macro

 drivers/iio/common/st_sensors/st_sensors_i2c.c | 2 +-
 drivers/iio/humidity/hts221_core.c | 2 +-
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 2 +-
 drivers/iio/light/si1145.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.7.4



[PATCH 1/4] iio: common: st_sensors: Replace ternary operator with min macro

2017-03-29 Thread simran singhal
Use macro min() to get the minimum of two values for brevity and
readability.

Signed-off-by: simran singhal 
---
 drivers/iio/common/st_sensors/st_sensors_i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/common/st_sensors/st_sensors_i2c.c 
b/drivers/iio/common/st_sensors/st_sensors_i2c.c
index c83df4d..7a68fdd 100644
--- a/drivers/iio/common/st_sensors/st_sensors_i2c.c
+++ b/drivers/iio/common/st_sensors/st_sensors_i2c.c
@@ -39,7 +39,7 @@ static int st_sensors_i2c_read_byte(struct 
st_sensor_transfer_buffer *tb,
*res_byte = err & 0xff;
 
 st_accel_i2c_read_byte_error:
-   return err < 0 ? err : 0;
+   return min(err, 0);
 }
 
 static int st_sensors_i2c_read_multiple_byte(
-- 
2.7.4



Re: [PATCH v2] netfilter: Clean up tests if NULL returned on failure

2017-03-29 Thread SIMRAN SINGHAL
On Wed, Mar 29, 2017 at 2:19 PM, SIMRAN SINGHAL
<singhalsimr...@gmail.com> wrote:
> On Wed, Mar 29, 2017 at 12:25 PM, Jan Engelhardt <jeng...@inai.de> wrote:
>>
>> On Tuesday 2017-03-28 18:23, SIMRAN SINGHAL wrote:
>>>On Tue, Mar 28, 2017 at 7:24 PM, Jan Engelhardt <jeng...@inai.de> wrote:
>>>> On Tuesday 2017-03-28 15:13, simran singhal wrote:
>>>>
>>>>>Some functions like kmalloc/kzalloc return NULL on failure. When NULL
>>>>>represents failure, !x is commonly used.
>>>>>
>>>>>@@ -910,7 +910,7 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct 
>>>>>ip_vs_dest_user_kern *udest,
>>>>>   }
>>>>>
>>>>>   dest = kzalloc(sizeof(struct ip_vs_dest), GFP_KERNEL);
>>>>>-  if (dest == NULL)
>>>>>+  if (!dest)
>>>>>   return -ENOMEM;
>>>>
>>>> This kind of transformation however is not cleanup anymore, it's really
>>>> bikeshedding and should be avoided. There are pro and cons for both
>>>> variants, and there is not really an overwhelming number of arguments
>>>> for either variant to justify the change.
>>>
>>>Sorry, but I didn't get what you are trying to convey. And particularly pros 
>>>and
>>>cons of both variants.
>>
>> The ==NULL/!=NULL part sort of ensures that the left side is a pointer, which
>> is lost when just using the variable and have it implicitly convert to bool.
>
> Thanks for the explaination
>
> But, according to me we should prefer != NULL over ==NULL according to
> coding style.

Sorry their is typing mistake in above.

But, according to me we should prefer !var over ( var ==NULL ) according to the
coding style


Re: [PATCH v2] netfilter: Clean up tests if NULL returned on failure

2017-03-29 Thread SIMRAN SINGHAL
On Wed, Mar 29, 2017 at 2:19 PM, SIMRAN SINGHAL
 wrote:
> On Wed, Mar 29, 2017 at 12:25 PM, Jan Engelhardt  wrote:
>>
>> On Tuesday 2017-03-28 18:23, SIMRAN SINGHAL wrote:
>>>On Tue, Mar 28, 2017 at 7:24 PM, Jan Engelhardt  wrote:
>>>> On Tuesday 2017-03-28 15:13, simran singhal wrote:
>>>>
>>>>>Some functions like kmalloc/kzalloc return NULL on failure. When NULL
>>>>>represents failure, !x is commonly used.
>>>>>
>>>>>@@ -910,7 +910,7 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct 
>>>>>ip_vs_dest_user_kern *udest,
>>>>>   }
>>>>>
>>>>>   dest = kzalloc(sizeof(struct ip_vs_dest), GFP_KERNEL);
>>>>>-  if (dest == NULL)
>>>>>+  if (!dest)
>>>>>   return -ENOMEM;
>>>>
>>>> This kind of transformation however is not cleanup anymore, it's really
>>>> bikeshedding and should be avoided. There are pro and cons for both
>>>> variants, and there is not really an overwhelming number of arguments
>>>> for either variant to justify the change.
>>>
>>>Sorry, but I didn't get what you are trying to convey. And particularly pros 
>>>and
>>>cons of both variants.
>>
>> The ==NULL/!=NULL part sort of ensures that the left side is a pointer, which
>> is lost when just using the variable and have it implicitly convert to bool.
>
> Thanks for the explaination
>
> But, according to me we should prefer != NULL over ==NULL according to
> coding style.

Sorry their is typing mistake in above.

But, according to me we should prefer !var over ( var ==NULL ) according to the
coding style


Re: [PATCH v2] netfilter: Clean up tests if NULL returned on failure

2017-03-29 Thread SIMRAN SINGHAL
On Wed, Mar 29, 2017 at 12:25 PM, Jan Engelhardt <jeng...@inai.de> wrote:
>
> On Tuesday 2017-03-28 18:23, SIMRAN SINGHAL wrote:
>>On Tue, Mar 28, 2017 at 7:24 PM, Jan Engelhardt <jeng...@inai.de> wrote:
>>> On Tuesday 2017-03-28 15:13, simran singhal wrote:
>>>
>>>>Some functions like kmalloc/kzalloc return NULL on failure. When NULL
>>>>represents failure, !x is commonly used.
>>>>
>>>>@@ -910,7 +910,7 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct 
>>>>ip_vs_dest_user_kern *udest,
>>>>   }
>>>>
>>>>   dest = kzalloc(sizeof(struct ip_vs_dest), GFP_KERNEL);
>>>>-  if (dest == NULL)
>>>>+  if (!dest)
>>>>   return -ENOMEM;
>>>
>>> This kind of transformation however is not cleanup anymore, it's really
>>> bikeshedding and should be avoided. There are pro and cons for both
>>> variants, and there is not really an overwhelming number of arguments
>>> for either variant to justify the change.
>>
>>Sorry, but I didn't get what you are trying to convey. And particularly pros 
>>and
>>cons of both variants.
>
> The ==NULL/!=NULL part sort of ensures that the left side is a pointer, which
> is lost when just using the variable and have it implicitly convert to bool.

Thanks for the explaination

But, according to me we should prefer != NULL over ==NULL according to
coding style.


Re: [PATCH v2] netfilter: Clean up tests if NULL returned on failure

2017-03-29 Thread SIMRAN SINGHAL
On Wed, Mar 29, 2017 at 12:25 PM, Jan Engelhardt  wrote:
>
> On Tuesday 2017-03-28 18:23, SIMRAN SINGHAL wrote:
>>On Tue, Mar 28, 2017 at 7:24 PM, Jan Engelhardt  wrote:
>>> On Tuesday 2017-03-28 15:13, simran singhal wrote:
>>>
>>>>Some functions like kmalloc/kzalloc return NULL on failure. When NULL
>>>>represents failure, !x is commonly used.
>>>>
>>>>@@ -910,7 +910,7 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct 
>>>>ip_vs_dest_user_kern *udest,
>>>>   }
>>>>
>>>>   dest = kzalloc(sizeof(struct ip_vs_dest), GFP_KERNEL);
>>>>-  if (dest == NULL)
>>>>+  if (!dest)
>>>>   return -ENOMEM;
>>>
>>> This kind of transformation however is not cleanup anymore, it's really
>>> bikeshedding and should be avoided. There are pro and cons for both
>>> variants, and there is not really an overwhelming number of arguments
>>> for either variant to justify the change.
>>
>>Sorry, but I didn't get what you are trying to convey. And particularly pros 
>>and
>>cons of both variants.
>
> The ==NULL/!=NULL part sort of ensures that the left side is a pointer, which
> is lost when just using the variable and have it implicitly convert to bool.

Thanks for the explaination

But, according to me we should prefer != NULL over ==NULL according to
coding style.


[PATCH] net: netfilter: Use list_{next/prev}_entry instead of list_entry

2017-03-28 Thread simran singhal
This patch replace list_entry with list_prev_entry as it makes the
code more clear to read.

Signed-off-by: simran singhal <singhalsimr...@gmail.com>
---
 net/netfilter/nf_tables_api.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index b7645d7..a341eaf 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -1895,7 +1895,7 @@ static int nf_tables_fill_rule_info(struct sk_buff *skb, 
struct net *net,
goto nla_put_failure;
 
if ((event != NFT_MSG_DELRULE) && (rule->list.prev != >rules)) {
-   prule = list_entry(rule->list.prev, struct nft_rule, list);
+   prule = list_prev_entry(rule, list);
if (nla_put_be64(skb, NFTA_RULE_POSITION,
 cpu_to_be64(prule->handle),
 NFTA_RULE_PAD))
-- 
2.7.4



[PATCH] net: netfilter: Use list_{next/prev}_entry instead of list_entry

2017-03-28 Thread simran singhal
This patch replace list_entry with list_prev_entry as it makes the
code more clear to read.

Signed-off-by: simran singhal 
---
 net/netfilter/nf_tables_api.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index b7645d7..a341eaf 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -1895,7 +1895,7 @@ static int nf_tables_fill_rule_info(struct sk_buff *skb, 
struct net *net,
goto nla_put_failure;
 
if ((event != NFT_MSG_DELRULE) && (rule->list.prev != >rules)) {
-   prule = list_entry(rule->list.prev, struct nft_rule, list);
+   prule = list_prev_entry(rule, list);
if (nla_put_be64(skb, NFTA_RULE_POSITION,
 cpu_to_be64(prule->handle),
 NFTA_RULE_PAD))
-- 
2.7.4



  1   2   3   4   5   6   7   8   >