* [PATCH 3/3] gigaset: prune use of tty_buffer_request_room
2010-03-14 22:58 [PATCH 0/3] gigaset fixes for 2.6.34-rc1 Tilman Schmidt
@ 2010-03-14 22:58 ` Tilman Schmidt
2010-03-14 22:58 ` [PATCH 2/3] gigaset: correct clearing of at_state strings on RING Tilman Schmidt
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Tilman Schmidt @ 2010-03-14 22:58 UTC (permalink / raw)
To: Karsten Keil, David Miller
Cc: Hansjoerg Lipp, Alan Cox, isdn4linux, i4ldeveloper, netdev,
linux-kernel, stable
Calling tty_buffer_request_room() before tty_insert_flip_string()
is unnecessary, costs CPU and for big buffers can mess up the
multi-page allocation avoidance.
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
CC: Alan Cox <alan@lxorguk.ukuu.org.uk>, stable@kernel.org
---
Note to -stable: applies correctly to 2.6.33 with fuzz 2.
drivers/isdn/gigaset/interface.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c
index a1bcbc2..f0dc6c9 100644
--- a/drivers/isdn/gigaset/interface.c
+++ b/drivers/isdn/gigaset/interface.c
@@ -628,7 +628,6 @@ void gigaset_if_receive(struct cardstate *cs,
if (tty == NULL)
gig_dbg(DEBUG_IF, "receive on closed device");
else {
- tty_buffer_request_room(tty, len);
tty_insert_flip_string(tty, buffer, len);
tty_flip_buffer_push(tty);
}
--
1.6.5.3.298.g39add
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/3] gigaset: correct clearing of at_state strings on RING
2010-03-14 22:58 [PATCH 0/3] gigaset fixes for 2.6.34-rc1 Tilman Schmidt
2010-03-14 22:58 ` [PATCH 3/3] gigaset: prune use of tty_buffer_request_room Tilman Schmidt
@ 2010-03-14 22:58 ` Tilman Schmidt
2010-03-14 22:58 ` [PATCH 1/3] gigaset: avoid registering CAPI driver more than once Tilman Schmidt
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Tilman Schmidt @ 2010-03-14 22:58 UTC (permalink / raw)
To: Karsten Keil, David Miller
Cc: Hansjoerg Lipp, isdn4linux, i4ldeveloper, netdev, linux-kernel,
stable
In RING handling, clear the table of received parameter strings in
a loop like everywhere else, instead of by enumeration which had
already gotten out of sync.
Impact: minor bugfix
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
CC: stable@kernel.org
---
Note to -stable: applies correctly to 2.6.33.
drivers/isdn/gigaset/ev-layer.c | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c
index c8f89b7..206c380 100644
--- a/drivers/isdn/gigaset/ev-layer.c
+++ b/drivers/isdn/gigaset/ev-layer.c
@@ -1258,14 +1258,10 @@ static void do_action(int action, struct cardstate *cs,
* note that bcs may be NULL if no B channel is free
*/
at_state2->ConState = 700;
- kfree(at_state2->str_var[STR_NMBR]);
- at_state2->str_var[STR_NMBR] = NULL;
- kfree(at_state2->str_var[STR_ZCPN]);
- at_state2->str_var[STR_ZCPN] = NULL;
- kfree(at_state2->str_var[STR_ZBC]);
- at_state2->str_var[STR_ZBC] = NULL;
- kfree(at_state2->str_var[STR_ZHLC]);
- at_state2->str_var[STR_ZHLC] = NULL;
+ for (i = 0; i < STR_NUM; ++i) {
+ kfree(at_state2->str_var[i]);
+ at_state2->str_var[i] = NULL;
+ }
at_state2->int_var[VAR_ZCTP] = -1;
spin_lock_irqsave(&cs->lock, flags);
--
1.6.5.3.298.g39add
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 1/3] gigaset: avoid registering CAPI driver more than once
2010-03-14 22:58 [PATCH 0/3] gigaset fixes for 2.6.34-rc1 Tilman Schmidt
2010-03-14 22:58 ` [PATCH 3/3] gigaset: prune use of tty_buffer_request_room Tilman Schmidt
2010-03-14 22:58 ` [PATCH 2/3] gigaset: correct clearing of at_state strings on RING Tilman Schmidt
@ 2010-03-14 22:58 ` Tilman Schmidt
2010-03-15 15:00 ` [PATCH 0/3] gigaset fixes for 2.6.34-rc1 Karsten Keil
2010-03-15 23:06 ` David Miller
4 siblings, 0 replies; 6+ messages in thread
From: Tilman Schmidt @ 2010-03-14 22:58 UTC (permalink / raw)
To: Karsten Keil, David Miller
Cc: Hansjoerg Lipp, isdn4linux, i4ldeveloper, netdev, linux-kernel,
stable
Registering/unregistering the Gigaset CAPI driver when a device is
connected/disconnected causes an Oops when disconnecting two Gigaset
devices in a row, because the same capi_driver structure gets
unregistered twice. Fix by making driver registration/unregistration
a separate operation (empty in the ISDN4Linux case) called when the
main module is loaded/unloaded.
Impact: bugfix
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
CC: stable@kernel.org
---
Note to -stable: applies correctly to 2.6.33 with fuzz 2 in capi.c.
drivers/isdn/gigaset/capi.c | 44 ++++++++++++++++++++++-----------------
drivers/isdn/gigaset/common.c | 6 +++-
drivers/isdn/gigaset/gigaset.h | 6 +++-
drivers/isdn/gigaset/i4l.c | 28 ++++++++++++++++++-------
4 files changed, 53 insertions(+), 31 deletions(-)
diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c
index 6643d65..4a31962 100644
--- a/drivers/isdn/gigaset/capi.c
+++ b/drivers/isdn/gigaset/capi.c
@@ -2191,36 +2191,24 @@ static const struct file_operations gigaset_proc_fops = {
.release = single_release,
};
-static struct capi_driver capi_driver_gigaset = {
- .name = "gigaset",
- .revision = "1.0",
-};
-
/**
- * gigaset_isdn_register() - register to LL
+ * gigaset_isdn_regdev() - register device to LL
* @cs: device descriptor structure.
* @isdnid: device name.
*
- * Called by main module to register the device with the LL.
- *
* Return value: 1 for success, 0 for failure
*/
-int gigaset_isdn_register(struct cardstate *cs, const char *isdnid)
+int gigaset_isdn_regdev(struct cardstate *cs, const char *isdnid)
{
struct gigaset_capi_ctr *iif;
int rc;
- pr_info("Kernel CAPI interface\n");
-
iif = kmalloc(sizeof(*iif), GFP_KERNEL);
if (!iif) {
pr_err("%s: out of memory\n", __func__);
return 0;
}
- /* register driver with CAPI (ToDo: what for?) */
- register_capi_driver(&capi_driver_gigaset);
-
/* prepare controller structure */
iif->ctr.owner = THIS_MODULE;
iif->ctr.driverdata = cs;
@@ -2241,7 +2229,6 @@ int gigaset_isdn_register(struct cardstate *cs, const char *isdnid)
rc = attach_capi_ctr(&iif->ctr);
if (rc) {
pr_err("attach_capi_ctr failed (%d)\n", rc);
- unregister_capi_driver(&capi_driver_gigaset);
kfree(iif);
return 0;
}
@@ -2252,17 +2239,36 @@ int gigaset_isdn_register(struct cardstate *cs, const char *isdnid)
}
/**
- * gigaset_isdn_unregister() - unregister from LL
+ * gigaset_isdn_unregdev() - unregister device from LL
* @cs: device descriptor structure.
- *
- * Called by main module to unregister the device from the LL.
*/
-void gigaset_isdn_unregister(struct cardstate *cs)
+void gigaset_isdn_unregdev(struct cardstate *cs)
{
struct gigaset_capi_ctr *iif = cs->iif;
detach_capi_ctr(&iif->ctr);
kfree(iif);
cs->iif = NULL;
+}
+
+static struct capi_driver capi_driver_gigaset = {
+ .name = "gigaset",
+ .revision = "1.0",
+};
+
+/**
+ * gigaset_isdn_regdrv() - register driver to LL
+ */
+void gigaset_isdn_regdrv(void)
+{
+ pr_info("Kernel CAPI interface\n");
+ register_capi_driver(&capi_driver_gigaset);
+}
+
+/**
+ * gigaset_isdn_unregdrv() - unregister driver from LL
+ */
+void gigaset_isdn_unregdrv(void)
+{
unregister_capi_driver(&capi_driver_gigaset);
}
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c
index 85de339..bdc01cb 100644
--- a/drivers/isdn/gigaset/common.c
+++ b/drivers/isdn/gigaset/common.c
@@ -507,7 +507,7 @@ void gigaset_freecs(struct cardstate *cs)
case 2: /* error in initcshw */
/* Deregister from LL */
make_invalid(cs, VALID_ID);
- gigaset_isdn_unregister(cs);
+ gigaset_isdn_unregdev(cs);
/* fall through */
case 1: /* error when registering to LL */
@@ -769,7 +769,7 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
cs->cmdbytes = 0;
gig_dbg(DEBUG_INIT, "setting up iif");
- if (!gigaset_isdn_register(cs, modulename)) {
+ if (!gigaset_isdn_regdev(cs, modulename)) {
pr_err("error registering ISDN device\n");
goto error;
}
@@ -1205,11 +1205,13 @@ static int __init gigaset_init_module(void)
gigaset_debuglevel = DEBUG_DEFAULT;
pr_info(DRIVER_DESC DRIVER_DESC_DEBUG "\n");
+ gigaset_isdn_regdrv();
return 0;
}
static void __exit gigaset_exit_module(void)
{
+ gigaset_isdn_unregdrv();
}
module_init(gigaset_init_module);
diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h
index 1875ab8..cdd144e 100644
--- a/drivers/isdn/gigaset/gigaset.h
+++ b/drivers/isdn/gigaset/gigaset.h
@@ -675,8 +675,10 @@ int gigaset_isowbuf_getbytes(struct isowbuf_t *iwb, int size);
*/
/* Called from common.c for setting up/shutting down with the ISDN subsystem */
-int gigaset_isdn_register(struct cardstate *cs, const char *isdnid);
-void gigaset_isdn_unregister(struct cardstate *cs);
+void gigaset_isdn_regdrv(void);
+void gigaset_isdn_unregdrv(void);
+int gigaset_isdn_regdev(struct cardstate *cs, const char *isdnid);
+void gigaset_isdn_unregdev(struct cardstate *cs);
/* Called from hardware module to indicate completion of an skb */
void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb);
diff --git a/drivers/isdn/gigaset/i4l.c b/drivers/isdn/gigaset/i4l.c
index f0acb9d..c22e5ac 100644
--- a/drivers/isdn/gigaset/i4l.c
+++ b/drivers/isdn/gigaset/i4l.c
@@ -592,15 +592,13 @@ void gigaset_isdn_stop(struct cardstate *cs)
}
/**
- * gigaset_isdn_register() - register to LL
+ * gigaset_isdn_regdev() - register to LL
* @cs: device descriptor structure.
* @isdnid: device name.
*
- * Called by main module to register the device with the LL.
- *
* Return value: 1 for success, 0 for failure
*/
-int gigaset_isdn_register(struct cardstate *cs, const char *isdnid)
+int gigaset_isdn_regdev(struct cardstate *cs, const char *isdnid)
{
isdn_if *iif;
@@ -650,15 +648,29 @@ int gigaset_isdn_register(struct cardstate *cs, const char *isdnid)
}
/**
- * gigaset_isdn_unregister() - unregister from LL
+ * gigaset_isdn_unregdev() - unregister device from LL
* @cs: device descriptor structure.
- *
- * Called by main module to unregister the device from the LL.
*/
-void gigaset_isdn_unregister(struct cardstate *cs)
+void gigaset_isdn_unregdev(struct cardstate *cs)
{
gig_dbg(DEBUG_CMD, "sending UNLOAD");
gigaset_i4l_cmd(cs, ISDN_STAT_UNLOAD);
kfree(cs->iif);
cs->iif = NULL;
}
+
+/**
+ * gigaset_isdn_regdrv() - register driver to LL
+ */
+void gigaset_isdn_regdrv(void)
+{
+ /* nothing to do */
+}
+
+/**
+ * gigaset_isdn_unregdrv() - unregister driver from LL
+ */
+void gigaset_isdn_unregdrv(void)
+{
+ /* nothing to do */
+}
--
1.6.5.3.298.g39add
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 0/3] gigaset fixes for 2.6.34-rc1
2010-03-14 22:58 [PATCH 0/3] gigaset fixes for 2.6.34-rc1 Tilman Schmidt
` (2 preceding siblings ...)
2010-03-14 22:58 ` [PATCH 1/3] gigaset: avoid registering CAPI driver more than once Tilman Schmidt
@ 2010-03-15 15:00 ` Karsten Keil
2010-03-15 23:06 ` David Miller
4 siblings, 0 replies; 6+ messages in thread
From: Karsten Keil @ 2010-03-15 15:00 UTC (permalink / raw)
To: Tilman Schmidt
Cc: David Miller, Hansjoerg Lipp, Alan Cox, isdn4linux, i4ldeveloper,
netdev, linux-kernel
On Sonntag, 14. März 2010 23:58:05 Tilman Schmidt wrote:
> Karsten, David,
>
> following are three bugfix patches to the Gigaset driver which should
> still go into 2.6.34 if possible, and also into the 2.6.33 stable branch.
Ack for all
>
> Thanks,
> Tilman
>
> Tilman Schmidt (3):
> gigaset: avoid registering CAPI driver more than once
> gigaset: correct clearing of at_state strings on RING
> gigaset: prune use of tty_buffer_request_room
>
> drivers/isdn/gigaset/capi.c | 44
> +++++++++++++++++++++---------------- drivers/isdn/gigaset/common.c |
> 6 +++-
> drivers/isdn/gigaset/ev-layer.c | 12 +++-------
> drivers/isdn/gigaset/gigaset.h | 6 +++-
> drivers/isdn/gigaset/i4l.c | 28 +++++++++++++++++-------
> drivers/isdn/gigaset/interface.c | 1 -
> 6 files changed, 57 insertions(+), 40 deletions(-)
>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 0/3] gigaset fixes for 2.6.34-rc1
2010-03-14 22:58 [PATCH 0/3] gigaset fixes for 2.6.34-rc1 Tilman Schmidt
` (3 preceding siblings ...)
2010-03-15 15:00 ` [PATCH 0/3] gigaset fixes for 2.6.34-rc1 Karsten Keil
@ 2010-03-15 23:06 ` David Miller
4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2010-03-15 23:06 UTC (permalink / raw)
To: tilman; +Cc: isdn, hjlipp, alan, isdn4linux, i4ldeveloper, netdev,
linux-kernel
From: Tilman Schmidt <tilman@imap.cc>
Date: Sun, 14 Mar 2010 23:58:05 +0100 (CET)
> following are three bugfix patches to the Gigaset driver which should
> still go into 2.6.34 if possible, and also into the 2.6.33 stable branch.
All applied, thanks Tilman.
^ permalink raw reply [flat|nested] 6+ messages in thread