Re: [PATCH 01/10] staging: ks7010: use linux circular buffer header macros to handle tx and rx queues

2018-04-23 Thread Sergio Paracuellos
On Mon, Apr 23, 2018 at 3:19 PM, Greg KH  wrote:
> On Mon, Apr 23, 2018 at 03:02:20PM +0200, Sergio Paracuellos wrote:
>> On Mon, Apr 23, 2018 at 2:30 PM, Greg KH  wrote:
>> > On Mon, Apr 16, 2018 at 12:29:23PM +0200, Sergio Paracuellos wrote:
>> >> This commit replace current custom implementation of some circular
>> >> buffer head and tail logic in favour of the use of macros defined
>> >> in linux circ_buf.h header. Queue related inline function names
>> >> have been review also.
>> >>
>> >> Signed-off-by: Sergio Paracuellos 
>> >> ---
>> >>  drivers/staging/ks7010/ks7010_sdio.c | 49 
>> >> ++--
>> >>  1 file changed, 30 insertions(+), 19 deletions(-)
>> >
>> > Not all patches in this series would apply.  Can you please rebase and
>> > resend the remaining ones?
>>
>> I will. I think previous one to this series is not being applied at
>> all. Is it posible? The one with cover-letter subject "cleanups
>> continue" which contains 14 patches. It has a mail thread with Dan
>> about circular buffer stuff to fix and no resend the series because is
>> the wrong one is the last patch.
>
> I have no idea, sorry, all of these patches are long-gone from my patch
> queue.  If I haven't applied something, rebase and resend.  I'm dealing
> with over a thousand staging driver patches right now, I can't stop and
> "think" about what I already reviewed :)

ack! II'll resend those too with the remaining ones which problems to
apply in all the series.

>
> thanks,
>
> greg k-h

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


Re: [PATCH 01/10] staging: ks7010: use linux circular buffer header macros to handle tx and rx queues

2018-04-23 Thread Greg KH
On Mon, Apr 23, 2018 at 03:02:20PM +0200, Sergio Paracuellos wrote:
> On Mon, Apr 23, 2018 at 2:30 PM, Greg KH  wrote:
> > On Mon, Apr 16, 2018 at 12:29:23PM +0200, Sergio Paracuellos wrote:
> >> This commit replace current custom implementation of some circular
> >> buffer head and tail logic in favour of the use of macros defined
> >> in linux circ_buf.h header. Queue related inline function names
> >> have been review also.
> >>
> >> Signed-off-by: Sergio Paracuellos 
> >> ---
> >>  drivers/staging/ks7010/ks7010_sdio.c | 49 
> >> ++--
> >>  1 file changed, 30 insertions(+), 19 deletions(-)
> >
> > Not all patches in this series would apply.  Can you please rebase and
> > resend the remaining ones?
> 
> I will. I think previous one to this series is not being applied at
> all. Is it posible? The one with cover-letter subject "cleanups
> continue" which contains 14 patches. It has a mail thread with Dan
> about circular buffer stuff to fix and no resend the series because is
> the wrong one is the last patch.

I have no idea, sorry, all of these patches are long-gone from my patch
queue.  If I haven't applied something, rebase and resend.  I'm dealing
with over a thousand staging driver patches right now, I can't stop and
"think" about what I already reviewed :)

thanks,

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


Re: [PATCH 01/10] staging: ks7010: use linux circular buffer header macros to handle tx and rx queues

2018-04-23 Thread Sergio Paracuellos
On Mon, Apr 23, 2018 at 2:30 PM, Greg KH  wrote:
> On Mon, Apr 16, 2018 at 12:29:23PM +0200, Sergio Paracuellos wrote:
>> This commit replace current custom implementation of some circular
>> buffer head and tail logic in favour of the use of macros defined
>> in linux circ_buf.h header. Queue related inline function names
>> have been review also.
>>
>> Signed-off-by: Sergio Paracuellos 
>> ---
>>  drivers/staging/ks7010/ks7010_sdio.c | 49 
>> ++--
>>  1 file changed, 30 insertions(+), 19 deletions(-)
>
> Not all patches in this series would apply.  Can you please rebase and
> resend the remaining ones?

I will. I think previous one to this series is not being applied at
all. Is it posible? The one with
cover-letter subject "cleanups continue" which contains 14 patches. It
has a mail thread with
Dan about circular buffer stuff to fix and no resend the series
because is the wrong one is the
last patch.

>
> thanks,
>
> greg k-h

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


Re: [PATCH 01/10] staging: ks7010: use linux circular buffer header macros to handle tx and rx queues

2018-04-23 Thread Greg KH
On Mon, Apr 16, 2018 at 12:29:23PM +0200, Sergio Paracuellos wrote:
> This commit replace current custom implementation of some circular
> buffer head and tail logic in favour of the use of macros defined
> in linux circ_buf.h header. Queue related inline function names
> have been review also.
> 
> Signed-off-by: Sergio Paracuellos 
> ---
>  drivers/staging/ks7010/ks7010_sdio.c | 49 
> ++--
>  1 file changed, 30 insertions(+), 19 deletions(-)

Not all patches in this series would apply.  Can you please rebase and
resend the remaining ones?

thanks,

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


[PATCH 01/10] staging: ks7010: use linux circular buffer header macros to handle tx and rx queues

2018-04-16 Thread Sergio Paracuellos
This commit replace current custom implementation of some circular
buffer head and tail logic in favour of the use of macros defined
in linux circ_buf.h header. Queue related inline function names
have been review also.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/ks7010/ks7010_sdio.c | 49 ++--
 1 file changed, 30 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index 9c591e0..fedcbb3 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -10,6 +10,7 @@
  *   published by the Free Software Foundation.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -111,11 +112,10 @@ static inline void inc_txqtail(struct ks_wlan_private 
*priv)
priv->tx_dev.qtail = (priv->tx_dev.qtail + 1) % TX_DEVICE_BUFF_SIZE;
 }
 
-static inline unsigned int cnt_txqbody(struct ks_wlan_private *priv)
+static inline bool txq_has_space(struct ks_wlan_private *priv)
 {
-   unsigned int tx_cnt = priv->tx_dev.qtail - priv->tx_dev.qhead;
-
-   return (tx_cnt + TX_DEVICE_BUFF_SIZE) % TX_DEVICE_BUFF_SIZE;
+   return (CIRC_SPACE(priv->tx_dev.qhead, priv->tx_dev.qtail,
+  TX_DEVICE_BUFF_SIZE) > 0);
 }
 
 static inline void inc_rxqhead(struct ks_wlan_private *priv)
@@ -128,11 +128,22 @@ static inline void inc_rxqtail(struct ks_wlan_private 
*priv)
priv->rx_dev.qtail = (priv->rx_dev.qtail + 1) % RX_DEVICE_BUFF_SIZE;
 }
 
-static inline unsigned int cnt_rxqbody(struct ks_wlan_private *priv)
+static inline bool rxq_has_space(struct ks_wlan_private *priv)
+{
+   return (CIRC_SPACE(priv->rx_dev.qhead, priv->rx_dev.qtail,
+  RX_DEVICE_BUFF_SIZE) > 0);
+}
+
+static inline unsigned int txq_count(struct ks_wlan_private *priv)
 {
-   unsigned int rx_cnt = priv->rx_dev.qtail - priv->rx_dev.qhead;
+   return CIRC_CNT_TO_END(priv->tx_dev.qhead, priv->tx_dev.qtail,
+  TX_DEVICE_BUFF_SIZE);
+}
 
-   return (rx_cnt + RX_DEVICE_BUFF_SIZE) % RX_DEVICE_BUFF_SIZE;
+static inline unsigned int rxq_count(struct ks_wlan_private *priv)
+{
+   return CIRC_CNT_TO_END(priv->rx_dev.qhead, priv->rx_dev.qtail,
+  RX_DEVICE_BUFF_SIZE);
 }
 
 /* Read single byte from device address into byte (CMD52) */
@@ -258,11 +269,11 @@ static void _ks_wlan_hw_power_save(struct ks_wlan_private 
*priv)
   atomic_read(&priv->psstatus.status),
   atomic_read(&priv->psstatus.confirm_wait),
   atomic_read(&priv->psstatus.snooze_guard),
-  cnt_txqbody(priv));
+  txq_count(priv));
 
if (atomic_read(&priv->psstatus.confirm_wait) ||
atomic_read(&priv->psstatus.snooze_guard) ||
-   cnt_txqbody(priv)) {
+   txq_has_space(priv)) {
queue_delayed_work(priv->wq, &priv->rw_dwork, 0);
return;
}
@@ -308,7 +319,7 @@ static int enqueue_txdev(struct ks_wlan_private *priv, 
unsigned char *p,
goto err_complete;
}
 
-   if ((TX_DEVICE_BUFF_SIZE - 1) <= cnt_txqbody(priv)) {
+   if ((TX_DEVICE_BUFF_SIZE - 1) <= txq_count(priv)) {
netdev_err(priv->net_dev, "tx buffer overflow\n");
ret = -EOVERFLOW;
goto err_complete;
@@ -366,7 +377,7 @@ static void tx_device_task(struct ks_wlan_private *priv)
struct tx_device_buffer *sp;
int ret;
 
-   if (cnt_txqbody(priv) <= 0 ||
+   if (!txq_has_space(priv) ||
atomic_read(&priv->psstatus.status) == PS_SNOOZE)
return;
 
@@ -385,7 +396,7 @@ static void tx_device_task(struct ks_wlan_private *priv)
(*sp->complete_handler)(priv, sp->skb);
inc_txqhead(priv);
 
-   if (cnt_txqbody(priv) > 0)
+   if (txq_has_space(priv))
queue_delayed_work(priv->wq, &priv->rw_dwork, 0);
 }
 
@@ -413,7 +424,7 @@ int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, 
unsigned long size,
result = enqueue_txdev(priv, p, size, complete_handler, skb);
spin_unlock(&priv->tx_dev.tx_dev_lock);
 
-   if (cnt_txqbody(priv) > 0)
+   if (txq_has_space(priv))
queue_delayed_work(priv->wq, &priv->rw_dwork, 0);
 
return result;
@@ -424,12 +435,12 @@ static void rx_event_task(unsigned long dev)
struct ks_wlan_private *priv = (struct ks_wlan_private *)dev;
struct rx_device_buffer *rp;
 
-   if (cnt_rxqbody(priv) > 0 && priv->dev_state >= DEVICE_STATE_BOOT) {
+   if (rxq_has_space(priv) && priv->dev_state >= DEVICE_STATE_BOOT) {
rp = &priv->rx_dev.rx_dev_buff[priv->rx_dev.qhead];
hostif_receive(priv, rp->data, rp->size);
inc_rxqhead(priv);
 
-   if (cnt_rxqbody(priv) > 0)
+   if (rxq_has_space(priv))
tasklet_schedule(&pr