2009-04-05 16:40:36

by Tilman Schmidt

[permalink] [raw]
Subject: [PATCH 0/3] gigaset: late patches for 2.6.30

Dave,

following are three last-minute patches to the Gigaset driver
for kernel release 2.6.30. As they are rather low-impact bug and
documentation fixes I hope they can still be included.

Thanks,
Tilman


2009-04-05 16:40:12

by Tilman Schmidt

[permalink] [raw]
Subject: [PATCH 1/3] bas_gigaset: use tasklet_hi_schedule for timing critical tasklets

The tasklets for isochronous data transfer need to run within 8 msec
to avoid over/underruns, so schedule them with high priority to fix
reported issues with occasional over/underruns.

Signed-off-by: Tilman Schmidt <[email protected]>
---
drivers/isdn/gigaset/bas-gigaset.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c
index 831ddce..781c404 100644
--- a/drivers/isdn/gigaset/bas-gigaset.c
+++ b/drivers/isdn/gigaset/bas-gigaset.c
@@ -821,7 +821,7 @@ static void read_iso_callback(struct urb *urb)
/* pass URB to tasklet */
ubc->isoindone = urb;
ubc->isoinstatus = status;
- tasklet_schedule(&ubc->rcvd_tasklet);
+ tasklet_hi_schedule(&ubc->rcvd_tasklet);
} else {
/* tasklet still busy, drop data and resubmit URB */
ubc->loststatus = status;
@@ -888,7 +888,7 @@ static void write_iso_callback(struct urb *urb)
ubc->isooutovfl = ubc->isooutdone;
ubc->isooutdone = ucx;
spin_unlock_irqrestore(&ubc->isooutlock, flags);
- tasklet_schedule(&ubc->sent_tasklet);
+ tasklet_hi_schedule(&ubc->sent_tasklet);
}

/* starturbs
--
1.6.2.1.214.ge986c

2009-04-05 16:41:10

by Tilman Schmidt

[permalink] [raw]
Subject: [PATCH 3/3] gigaset: documentation update

Update, correct and clarify instructions for loading the driver
and for setting the UNDOCREQ kernel configuration option.

Impact: documentation

Signed-off-by: Tilman Schmidt <[email protected]>
---
Documentation/isdn/README.gigaset | 52 ++++++++++++++++++++++--------------
1 files changed, 32 insertions(+), 20 deletions(-)

diff --git a/Documentation/isdn/README.gigaset b/Documentation/isdn/README.gigaset
index 55b2852..02c0e93 100644
--- a/Documentation/isdn/README.gigaset
+++ b/Documentation/isdn/README.gigaset
@@ -61,24 +61,28 @@ GigaSet 307x Device Driver
---------------------
2.1. Modules
-------
- To get the device working, you have to load the proper kernel module. You
- can do this using
- modprobe modulename
- where modulename is ser_gigaset (M101), usb_gigaset (M105), or
- bas_gigaset (direct USB connection to the base).
+ For the devices to work, the proper kernel modules have to be loaded.
+ This normally happens automatically when the system detects the USB
+ device (base, M105) or when the line discipline is attached (M101). It
+ can also be triggered manually using the modprobe(8) command, for example
+ for troubleshooting or to pass module parameters.

The module ser_gigaset provides a serial line discipline N_GIGASET_M101
- which drives the device through the regular serial line driver. To use it,
- run the Gigaset M101 daemon "gigasetm101d" (also available from
- http://sourceforge.net/projects/gigaset307x/) with the device file of the
- RS232 port to the M101 as an argument, for example:
- gigasetm101d /dev/ttyS1
- This will open the device file, set its line discipline to N_GIGASET_M101,
- and then sleep in the background, keeping the device open so that the
- line discipline remains active. To deactivate it, kill the daemon, for
- example with
- killall gigasetm101d
- before disconnecting the device.
+ which drives the device through the regular serial line driver. It must
+ be attached to the serial line to which the M101 is connected with the
+ ldattach(8) command (requires util-linux-ng release 2.14 or later), for
+ example:
+ ldattach GIGASET_M101 /dev/ttyS1
+ This will open the device file, attach the line discipline to it, and
+ then sleep in the background, keeping the device open so that the line
+ discipline remains active. To deactivate it, kill the daemon, for example
+ with
+ killall ldattach
+ before disconnecting the device. To have this happen automatically at
+ system startup/shutdown on an LSB compatible system, create and activate
+ an appropriate LSB startup script /etc/init.d/gigaset. (The init name
+ 'gigaset' is officially assigned to this project by LANANA.)
+ Alternatively, just add the 'ldattach' command line to /etc/rc.local.

2.2. Device nodes for user space programs
------------------------------------
@@ -194,10 +198,11 @@ GigaSet 307x Device Driver
operation (for wireless access to the base), but are needed for access
to the M105's own configuration mode (registration to the base, baudrate
and line format settings, device status queries) via the gigacontr
- utility. Their use is disabled in the driver by default for safety
- reasons but can be enabled by setting the kernel configuration option
- "Support for undocumented USB requests" (GIGASET_UNDOCREQ) to "Y" and
- recompiling.
+ utility. Their use is controlled by the kernel configuration option
+ "Support for undocumented USB requests" (CONFIG_GIGASET_UNDOCREQ). If you
+ encounter error code -ENOTTY when trying to use some features of the
+ M105, try setting that option to "y" via 'make {x,menu}config' and
+ recompiling the driver.


3. Troubleshooting
@@ -228,6 +233,13 @@ GigaSet 307x Device Driver
Solution:
Select Unimodem mode for all DECT data adapters. (see section 2.4.)

+ Problem:
+ You want to configure your USB DECT data adapter (M105) but gigacontr
+ reports an error: "/dev/ttyGU0: Inappropriate ioctl for device".
+ Solution:
+ Recompile the usb_gigaset driver with the kernel configuration option
+ CONFIG_GIGASET_UNDOCREQ set to 'y'. (see section 2.6.)
+
3.2. Telling the driver to provide more information
----------------------------------------------
Building the driver with the "Gigaset debugging" kernel configuration
--
1.6.2.1.214.ge986c

2009-04-05 16:40:50

by Tilman Schmidt

[permalink] [raw]
Subject: [PATCH 2/3] gigaset: in file ops, check for device disconnect before anything else

When the device is disconnected, the dev structure goes away, so
trying to report another error via dev_printk is bound to oops.
To avoid that, first check whether the device is still connected
and return quietly if it isn't.

Impact: error handling

Signed-off-by: Tilman Schmidt <[email protected]>
Reported-by: Paul Bolle <[email protected]>
Tested-by: Paul Bolle <[email protected]>
---
drivers/isdn/gigaset/interface.c | 58 +++++++++++++++++++------------------
1 files changed, 30 insertions(+), 28 deletions(-)

diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c
index 311e7ca..820a309 100644
--- a/drivers/isdn/gigaset/interface.c
+++ b/drivers/isdn/gigaset/interface.c
@@ -193,7 +193,9 @@ static void if_close(struct tty_struct *tty, struct file *filp)

mutex_lock(&cs->mutex);

- if (!cs->open_count)
+ if (!cs->connected)
+ gig_dbg(DEBUG_IF, "not connected"); /* nothing to do */
+ else if (!cs->open_count)
dev_warn(cs->dev, "%s: device not opened\n", __func__);
else {
if (!--cs->open_count) {
@@ -228,7 +230,10 @@ static int if_ioctl(struct tty_struct *tty, struct file *file,
if (mutex_lock_interruptible(&cs->mutex))
return -ERESTARTSYS; // FIXME -EINTR?

- if (!cs->open_count)
+ if (!cs->connected) {
+ gig_dbg(DEBUG_IF, "not connected");
+ retval = -ENODEV;
+ } else if (!cs->open_count)
dev_warn(cs->dev, "%s: device not opened\n", __func__);
else {
retval = 0;
@@ -248,13 +253,6 @@ static int if_ioctl(struct tty_struct *tty, struct file *file,
retval = put_user(int_arg, (int __user *) arg);
break;
case GIGASET_BRKCHARS:
- //FIXME test if MS_LOCKED
- if (!cs->connected) {
- gig_dbg(DEBUG_ANY,
- "can't communicate with unplugged device");
- retval = -ENODEV;
- break;
- }
retval = copy_from_user(&buf,
(const unsigned char __user *) arg, 6)
? -EFAULT : 0;
@@ -331,7 +329,7 @@ static int if_tiocmset(struct tty_struct *tty, struct file *file,
return -ERESTARTSYS; // FIXME -EINTR?

if (!cs->connected) {
- gig_dbg(DEBUG_ANY, "can't communicate with unplugged device");
+ gig_dbg(DEBUG_IF, "not connected");
retval = -ENODEV;
} else {
mc = (cs->control_state | set) & ~clear & (TIOCM_RTS|TIOCM_DTR);
@@ -360,14 +358,14 @@ static int if_write(struct tty_struct *tty, const unsigned char *buf, int count)
if (mutex_lock_interruptible(&cs->mutex))
return -ERESTARTSYS; // FIXME -EINTR?

- if (!cs->open_count)
+ if (!cs->connected) {
+ gig_dbg(DEBUG_IF, "not connected");
+ retval = -ENODEV;
+ } else if (!cs->open_count)
dev_warn(cs->dev, "%s: device not opened\n", __func__);
else if (cs->mstate != MS_LOCKED) {
dev_warn(cs->dev, "can't write to unlocked device\n");
retval = -EBUSY;
- } else if (!cs->connected) {
- gig_dbg(DEBUG_ANY, "can't write to unplugged device");
- retval = -EBUSY; //FIXME
} else {
retval = cs->ops->write_cmd(cs, buf, count,
&cs->if_wake_tasklet);
@@ -394,14 +392,14 @@ static int if_write_room(struct tty_struct *tty)
if (mutex_lock_interruptible(&cs->mutex))
return -ERESTARTSYS; // FIXME -EINTR?

- if (!cs->open_count)
+ if (!cs->connected) {
+ gig_dbg(DEBUG_IF, "not connected");
+ retval = -ENODEV;
+ } else if (!cs->open_count)
dev_warn(cs->dev, "%s: device not opened\n", __func__);
else if (cs->mstate != MS_LOCKED) {
dev_warn(cs->dev, "can't write to unlocked device\n");
retval = -EBUSY;
- } else if (!cs->connected) {
- gig_dbg(DEBUG_ANY, "can't write to unplugged device");
- retval = -EBUSY; //FIXME
} else
retval = cs->ops->write_room(cs);

@@ -426,14 +424,14 @@ static int if_chars_in_buffer(struct tty_struct *tty)
if (mutex_lock_interruptible(&cs->mutex))
return -ERESTARTSYS; // FIXME -EINTR?

- if (!cs->open_count)
+ if (!cs->connected) {
+ gig_dbg(DEBUG_IF, "not connected");
+ retval = -ENODEV;
+ } else if (!cs->open_count)
dev_warn(cs->dev, "%s: device not opened\n", __func__);
else if (cs->mstate != MS_LOCKED) {
dev_warn(cs->dev, "can't write to unlocked device\n");
retval = -EBUSY;
- } else if (!cs->connected) {
- gig_dbg(DEBUG_ANY, "can't write to unplugged device");
- retval = -EBUSY; //FIXME
} else
retval = cs->ops->chars_in_buffer(cs);

@@ -456,7 +454,9 @@ static void if_throttle(struct tty_struct *tty)

mutex_lock(&cs->mutex);

- if (!cs->open_count)
+ if (!cs->connected)
+ gig_dbg(DEBUG_IF, "not connected"); /* nothing to do */
+ else if (!cs->open_count)
dev_warn(cs->dev, "%s: device not opened\n", __func__);
else {
//FIXME
@@ -479,7 +479,9 @@ static void if_unthrottle(struct tty_struct *tty)

mutex_lock(&cs->mutex);

- if (!cs->open_count)
+ if (!cs->connected)
+ gig_dbg(DEBUG_IF, "not connected"); /* nothing to do */
+ else if (!cs->open_count)
dev_warn(cs->dev, "%s: device not opened\n", __func__);
else {
//FIXME
@@ -506,13 +508,13 @@ static void if_set_termios(struct tty_struct *tty, struct ktermios *old)

mutex_lock(&cs->mutex);

- if (!cs->open_count) {
- dev_warn(cs->dev, "%s: device not opened\n", __func__);
+ if (!cs->connected) {
+ gig_dbg(DEBUG_IF, "not connected");
goto out;
}

- if (!cs->connected) {
- gig_dbg(DEBUG_ANY, "can't communicate with unplugged device");
+ if (!cs->open_count) {
+ dev_warn(cs->dev, "%s: device not opened\n", __func__);
goto out;
}

--
1.6.2.1.214.ge986c

2009-04-07 00:43:58

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 1/3] bas_gigaset: use tasklet_hi_schedule for timing critical tasklets

From: Tilman Schmidt <[email protected]>
Date: Sun, 5 Apr 2009 18:39:33 +0200 (CEST)

> The tasklets for isochronous data transfer need to run within 8 msec
> to avoid over/underruns, so schedule them with high priority to fix
> reported issues with occasional over/underruns.
>
> Signed-off-by: Tilman Schmidt <[email protected]>

Applied.

2009-04-07 00:44:22

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 2/3] gigaset: in file ops, check for device disconnect before anything else

From: Tilman Schmidt <[email protected]>
Date: Sun, 5 Apr 2009 18:39:33 +0200 (CEST)

> When the device is disconnected, the dev structure goes away, so
> trying to report another error via dev_printk is bound to oops.
> To avoid that, first check whether the device is still connected
> and return quietly if it isn't.
>
> Impact: error handling
>
> Signed-off-by: Tilman Schmidt <[email protected]>
> Reported-by: Paul Bolle <[email protected]>
> Tested-by: Paul Bolle <[email protected]>

Applied.

2009-04-07 00:44:38

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 3/3] gigaset: documentation update

From: Tilman Schmidt <[email protected]>
Date: Sun, 5 Apr 2009 18:39:33 +0200 (CEST)

> Update, correct and clarify instructions for loading the driver
> and for setting the UNDOCREQ kernel configuration option.
>
> Impact: documentation
>
> Signed-off-by: Tilman Schmidt <[email protected]>

Applied.