netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] ISDN patches for net-next
@ 2014-12-10 12:41 Tilman Schmidt
  2014-12-10 12:41 ` [PATCH 1/5] isdn/gigaset: drop duplicate declaration Tilman Schmidt
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Tilman Schmidt @ 2014-12-10 12:41 UTC (permalink / raw)
  To: netdev; +Cc: David Miller, Hansjoerg Lipp, Karsten Keil, isdn4linux

Here's a series of patches for the Gigaset ISDN driver and one for
the ISDN CAPI subsystem.  Please merge as appropriate.

Thanks,
Tilman

Tilman Schmidt (5):
  isdn/gigaset: drop duplicate declaration
  isdn/gigaset: clarify gigaset_modem_fill control structure
  isdn/gigaset: elliminate unnecessary argument from send_cb()
  isdn/gigaset: enable Kernel CAPI support by default
  isdn/capi: correct argument types of command_2_index

 drivers/isdn/capi/capiutil.c       |  2 +-
 drivers/isdn/gigaset/Kconfig       |  2 +-
 drivers/isdn/gigaset/gigaset.h     |  3 --
 drivers/isdn/gigaset/usb-gigaset.c | 77 ++++++++++++++++++--------------------
 4 files changed, 38 insertions(+), 46 deletions(-)

-- 
1.9.2.459.g68773ac

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 5/5] isdn/capi: correct argument types of command_2_index
  2014-12-10 12:41 [PATCH 0/5] ISDN patches for net-next Tilman Schmidt
  2014-12-10 12:41 ` [PATCH 1/5] isdn/gigaset: drop duplicate declaration Tilman Schmidt
@ 2014-12-10 12:41 ` Tilman Schmidt
  2014-12-10 12:41 ` [PATCH 4/5] isdn/gigaset: enable Kernel CAPI support by default Tilman Schmidt
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Tilman Schmidt @ 2014-12-10 12:41 UTC (permalink / raw)
  To: netdev; +Cc: David Miller, Hansjoerg Lipp, Karsten Keil, isdn4linux

Utility function command_2_index is always called with arguments of
type u8. Adapt its declaration accordingly.

Signed-off-by: Tilman Schmidt <tilman@imap.cc>
---
 drivers/isdn/capi/capiutil.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/isdn/capi/capiutil.c b/drivers/isdn/capi/capiutil.c
index 36c1b37..9846d82 100644
--- a/drivers/isdn/capi/capiutil.c
+++ b/drivers/isdn/capi/capiutil.c
@@ -201,7 +201,7 @@ static unsigned char *cpars[] =
 #define structTRcpyovl(x, y, l) memmove(y, x, l)
 
 /*-------------------------------------------------------*/
-static unsigned command_2_index(unsigned c, unsigned sc)
+static unsigned command_2_index(u8 c, u8 sc)
 {
 	if (c & 0x80)
 		c = 0x9 + (c & 0x0f);
-- 
1.9.2.459.g68773ac

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 1/5] isdn/gigaset: drop duplicate declaration
  2014-12-10 12:41 [PATCH 0/5] ISDN patches for net-next Tilman Schmidt
@ 2014-12-10 12:41 ` Tilman Schmidt
  2014-12-10 12:41 ` [PATCH 5/5] isdn/capi: correct argument types of command_2_index Tilman Schmidt
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Tilman Schmidt @ 2014-12-10 12:41 UTC (permalink / raw)
  To: netdev; +Cc: David Miller, Hansjoerg Lipp, Karsten Keil, isdn4linux

Function gigaset_skb_sent was declared twice, identically, in gigaset.h.

Signed-off-by: Tilman Schmidt <tilman@imap.cc>
---
 drivers/isdn/gigaset/gigaset.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h
index eb63a0f..166537e 100644
--- a/drivers/isdn/gigaset/gigaset.h
+++ b/drivers/isdn/gigaset/gigaset.h
@@ -751,9 +751,6 @@ void gigaset_stop(struct cardstate *cs);
 /* Tell common.c that the driver is being unloaded. */
 int gigaset_shutdown(struct cardstate *cs);
 
-/* Tell common.c that an skb has been sent. */
-void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb);
-
 /* Append event to the queue.
  * Returns NULL on failure or a pointer to the event on success.
  * ptr must be kmalloc()ed (and not be freed by the caller).
-- 
1.9.2.459.g68773ac

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/5] isdn/gigaset: clarify gigaset_modem_fill control structure
  2014-12-10 12:41 [PATCH 0/5] ISDN patches for net-next Tilman Schmidt
                   ` (3 preceding siblings ...)
  2014-12-10 12:41 ` [PATCH 3/5] isdn/gigaset: elliminate unnecessary argument from send_cb() Tilman Schmidt
@ 2014-12-10 12:41 ` Tilman Schmidt
  2014-12-10 20:06 ` [PATCH 0/5] ISDN patches for net-next David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: Tilman Schmidt @ 2014-12-10 12:41 UTC (permalink / raw)
  To: netdev; +Cc: David Miller, Hansjoerg Lipp, Karsten Keil, isdn4linux

Replace the flag-controlled retry loop by explicit goto statements
in the error branches to make the control structure easier to
understand.

Signed-off-by: Tilman Schmidt <tilman@imap.cc>
---
 drivers/isdn/gigaset/usb-gigaset.c | 52 ++++++++++++++++++--------------------
 1 file changed, 24 insertions(+), 28 deletions(-)

diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c
index a8e652d..c31d746 100644
--- a/drivers/isdn/gigaset/usb-gigaset.c
+++ b/drivers/isdn/gigaset/usb-gigaset.c
@@ -304,7 +304,6 @@ static void gigaset_modem_fill(unsigned long data)
 	struct cardstate *cs = (struct cardstate *) data;
 	struct bc_state *bcs = &cs->bcs[0]; /* only one channel */
 	struct cmdbuf_t *cb;
-	int again;
 
 	gig_dbg(DEBUG_OUTPUT, "modem_fill");
 
@@ -313,36 +312,33 @@ static void gigaset_modem_fill(unsigned long data)
 		return;
 	}
 
-	do {
-		again = 0;
-		if (!bcs->tx_skb) { /* no skb is being sent */
-			cb = cs->cmdbuf;
-			if (cb) { /* commands to send? */
-				gig_dbg(DEBUG_OUTPUT, "modem_fill: cb");
-				if (send_cb(cs, cb) < 0) {
-					gig_dbg(DEBUG_OUTPUT,
-						"modem_fill: send_cb failed");
-					again = 1; /* no callback will be
-						      called! */
-				}
-			} else { /* skbs to send? */
-				bcs->tx_skb = skb_dequeue(&bcs->squeue);
-				if (bcs->tx_skb)
-					gig_dbg(DEBUG_INTR,
-						"Dequeued skb (Adr: %lx)!",
-						(unsigned long) bcs->tx_skb);
-			}
-		}
-
-		if (bcs->tx_skb) {
-			gig_dbg(DEBUG_OUTPUT, "modem_fill: tx_skb");
-			if (write_modem(cs) < 0) {
+again:
+	if (!bcs->tx_skb) {	/* no skb is being sent */
+		cb = cs->cmdbuf;
+		if (cb) {	/* commands to send? */
+			gig_dbg(DEBUG_OUTPUT, "modem_fill: cb");
+			if (send_cb(cs, cb) < 0) {
 				gig_dbg(DEBUG_OUTPUT,
-					"modem_fill: write_modem failed");
-				again = 1; /* no callback will be called! */
+					"modem_fill: send_cb failed");
+				goto again; /* no callback will be called! */
 			}
+			return;
 		}
-	} while (again);
+
+		/* skbs to send? */
+		bcs->tx_skb = skb_dequeue(&bcs->squeue);
+		if (!bcs->tx_skb)
+			return;
+
+		gig_dbg(DEBUG_INTR, "Dequeued skb (Adr: %lx)!",
+			(unsigned long) bcs->tx_skb);
+	}
+
+	gig_dbg(DEBUG_OUTPUT, "modem_fill: tx_skb");
+	if (write_modem(cs) < 0) {
+		gig_dbg(DEBUG_OUTPUT, "modem_fill: write_modem failed");
+		goto again;	/* no callback will be called! */
+	}
 }
 
 /*
-- 
1.9.2.459.g68773ac

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/5] isdn/gigaset: enable Kernel CAPI support by default
  2014-12-10 12:41 [PATCH 0/5] ISDN patches for net-next Tilman Schmidt
  2014-12-10 12:41 ` [PATCH 1/5] isdn/gigaset: drop duplicate declaration Tilman Schmidt
  2014-12-10 12:41 ` [PATCH 5/5] isdn/capi: correct argument types of command_2_index Tilman Schmidt
@ 2014-12-10 12:41 ` Tilman Schmidt
  2014-12-10 12:41 ` [PATCH 3/5] isdn/gigaset: elliminate unnecessary argument from send_cb() Tilman Schmidt
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Tilman Schmidt @ 2014-12-10 12:41 UTC (permalink / raw)
  To: netdev; +Cc: David Miller, Hansjoerg Lipp, Karsten Keil, isdn4linux

Kernel CAPI has been the recommended ISDN subsystem for the Gigaset
driver since kernel release 2.6.34.2. It provides full backwards
compatibility to the old I4L subsystem thanks to the capidrv module.
I4L has been marked as deprecated for more than seven years.

Signed-off-by: Tilman Schmidt <tilman@imap.cc>
---
 drivers/isdn/gigaset/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/isdn/gigaset/Kconfig b/drivers/isdn/gigaset/Kconfig
index dde5e09..83f62b8 100644
--- a/drivers/isdn/gigaset/Kconfig
+++ b/drivers/isdn/gigaset/Kconfig
@@ -20,7 +20,7 @@ if ISDN_DRV_GIGASET
 config GIGASET_CAPI
 	bool "Gigaset CAPI support"
 	depends on ISDN_CAPI='y'||(ISDN_CAPI='m'&&ISDN_DRV_GIGASET='m')
-	default ISDN_I4L='n'
+	default 'y'
 	help
 	  Build the Gigaset driver as a CAPI 2.0 driver interfacing with
 	  the Kernel CAPI subsystem. To use it with the old ISDN4Linux
-- 
1.9.2.459.g68773ac

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/5] isdn/gigaset: elliminate unnecessary argument from send_cb()
  2014-12-10 12:41 [PATCH 0/5] ISDN patches for net-next Tilman Schmidt
                   ` (2 preceding siblings ...)
  2014-12-10 12:41 ` [PATCH 4/5] isdn/gigaset: enable Kernel CAPI support by default Tilman Schmidt
@ 2014-12-10 12:41 ` Tilman Schmidt
  2014-12-10 12:41 ` [PATCH 2/5] isdn/gigaset: clarify gigaset_modem_fill control structure Tilman Schmidt
  2014-12-10 20:06 ` [PATCH 0/5] ISDN patches for net-next David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: Tilman Schmidt @ 2014-12-10 12:41 UTC (permalink / raw)
  To: netdev; +Cc: David Miller, Hansjoerg Lipp, Karsten Keil, isdn4linux

No need to pass a member of the cardstate structure as a separate
argument if the entire structure is already passed.

Signed-off-by: Tilman Schmidt <tilman@imap.cc>
---
 drivers/isdn/gigaset/usb-gigaset.c | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c
index c31d746..5f306e2 100644
--- a/drivers/isdn/gigaset/usb-gigaset.c
+++ b/drivers/isdn/gigaset/usb-gigaset.c
@@ -293,7 +293,7 @@ static int gigaset_close_bchannel(struct bc_state *bcs)
 }
 
 static int write_modem(struct cardstate *cs);
-static int send_cb(struct cardstate *cs, struct cmdbuf_t *cb);
+static int send_cb(struct cardstate *cs);
 
 
 /* Write tasklet handler: Continue sending current skb, or send command, or
@@ -303,7 +303,6 @@ static void gigaset_modem_fill(unsigned long data)
 {
 	struct cardstate *cs = (struct cardstate *) data;
 	struct bc_state *bcs = &cs->bcs[0]; /* only one channel */
-	struct cmdbuf_t *cb;
 
 	gig_dbg(DEBUG_OUTPUT, "modem_fill");
 
@@ -314,10 +313,9 @@ static void gigaset_modem_fill(unsigned long data)
 
 again:
 	if (!bcs->tx_skb) {	/* no skb is being sent */
-		cb = cs->cmdbuf;
-		if (cb) {	/* commands to send? */
+		if (cs->cmdbuf) {	/* commands to send? */
 			gig_dbg(DEBUG_OUTPUT, "modem_fill: cb");
-			if (send_cb(cs, cb) < 0) {
+			if (send_cb(cs) < 0) {
 				gig_dbg(DEBUG_OUTPUT,
 					"modem_fill: send_cb failed");
 				goto again; /* no callback will be called! */
@@ -425,9 +423,9 @@ static void gigaset_write_bulk_callback(struct urb *urb)
 	spin_unlock_irqrestore(&cs->lock, flags);
 }
 
-static int send_cb(struct cardstate *cs, struct cmdbuf_t *cb)
+static int send_cb(struct cardstate *cs)
 {
-	struct cmdbuf_t *tcb;
+	struct cmdbuf_t *cb = cs->cmdbuf;
 	unsigned long flags;
 	int count;
 	int status = -ENOENT;
@@ -435,26 +433,27 @@ static int send_cb(struct cardstate *cs, struct cmdbuf_t *cb)
 
 	do {
 		if (!cb->len) {
-			tcb = cb;
-
 			spin_lock_irqsave(&cs->cmdlock, flags);
 			cs->cmdbytes -= cs->curlen;
 			gig_dbg(DEBUG_OUTPUT, "send_cb: sent %u bytes, %u left",
 				cs->curlen, cs->cmdbytes);
-			cs->cmdbuf = cb = cb->next;
-			if (cb) {
-				cb->prev = NULL;
-				cs->curlen = cb->len;
+			cs->cmdbuf = cb->next;
+			if (cs->cmdbuf) {
+				cs->cmdbuf->prev = NULL;
+				cs->curlen = cs->cmdbuf->len;
 			} else {
 				cs->lastcmdbuf = NULL;
 				cs->curlen = 0;
 			}
 			spin_unlock_irqrestore(&cs->cmdlock, flags);
 
-			if (tcb->wake_tasklet)
-				tasklet_schedule(tcb->wake_tasklet);
-			kfree(tcb);
+			if (cb->wake_tasklet)
+				tasklet_schedule(cb->wake_tasklet);
+			kfree(cb);
+
+			cb = cs->cmdbuf;
 		}
+
 		if (cb) {
 			count = min(cb->len, ucs->bulk_out_size);
 			gig_dbg(DEBUG_OUTPUT, "send_cb: send %d bytes", count);
-- 
1.9.2.459.g68773ac

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/5] ISDN patches for net-next
  2014-12-10 12:41 [PATCH 0/5] ISDN patches for net-next Tilman Schmidt
                   ` (4 preceding siblings ...)
  2014-12-10 12:41 ` [PATCH 2/5] isdn/gigaset: clarify gigaset_modem_fill control structure Tilman Schmidt
@ 2014-12-10 20:06 ` David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2014-12-10 20:06 UTC (permalink / raw)
  To: tilman; +Cc: netdev, hjlipp, isdn, isdn4linux

From: Tilman Schmidt <tilman@imap.cc>
Date: Wed, 10 Dec 2014 13:41:55 +0100 (CET)

> Here's a series of patches for the Gigaset ISDN driver and one for
> the ISDN CAPI subsystem.  Please merge as appropriate.

Series applied, thank you.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-12-10 20:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-10 12:41 [PATCH 0/5] ISDN patches for net-next Tilman Schmidt
2014-12-10 12:41 ` [PATCH 1/5] isdn/gigaset: drop duplicate declaration Tilman Schmidt
2014-12-10 12:41 ` [PATCH 5/5] isdn/capi: correct argument types of command_2_index Tilman Schmidt
2014-12-10 12:41 ` [PATCH 4/5] isdn/gigaset: enable Kernel CAPI support by default Tilman Schmidt
2014-12-10 12:41 ` [PATCH 3/5] isdn/gigaset: elliminate unnecessary argument from send_cb() Tilman Schmidt
2014-12-10 12:41 ` [PATCH 2/5] isdn/gigaset: clarify gigaset_modem_fill control structure Tilman Schmidt
2014-12-10 20:06 ` [PATCH 0/5] ISDN patches for net-next David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).