Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 170891
b: refs/heads/master
c: ae67d7d
h: refs/heads/master
i:
  170889: 225fa3d
  170887: 71d2dd0
v: v3
  • Loading branch information
Tilman Schmidt authored and David S. Miller committed Oct 29, 2009
1 parent 5ce4c79 commit d62bdf8
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d9ba9c9125d89e246dc0a0702446528acceb6ddb
refs/heads/master: ae67d7d81436c7e85104d586562b1a220d3cd94b
56 changes: 37 additions & 19 deletions trunk/drivers/isdn/gigaset/ser-gigaset.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,15 @@ static void gigaset_modem_fill(unsigned long data)
{
struct cardstate *cs = (struct cardstate *) data;
struct bc_state *bcs;
struct sk_buff *nextskb;
int sent = 0;

if (!cs || !(bcs = cs->bcs)) {
if (!cs) {
gig_dbg(DEBUG_OUTPUT, "%s: no cardstate", __func__);
return;
}
bcs = cs->bcs;
if (!bcs) {
gig_dbg(DEBUG_OUTPUT, "%s: no cardstate", __func__);
return;
}
Expand All @@ -179,9 +185,11 @@ static void gigaset_modem_fill(unsigned long data)
return;

/* no command to send; get skb */
if (!(bcs->tx_skb = skb_dequeue(&bcs->squeue)))
nextskb = skb_dequeue(&bcs->squeue);
if (!nextskb)
/* no skb either, nothing to do */
return;
bcs->tx_skb = nextskb;

gig_dbg(DEBUG_INTR, "Dequeued skb (Adr: %lx)",
(unsigned long) bcs->tx_skb);
Expand Down Expand Up @@ -236,19 +244,20 @@ static void flush_send_queue(struct cardstate *cs)
* number of bytes queued, or error code < 0
*/
static int gigaset_write_cmd(struct cardstate *cs, const unsigned char *buf,
int len, struct tasklet_struct *wake_tasklet)
int len, struct tasklet_struct *wake_tasklet)
{
struct cmdbuf_t *cb;
unsigned long flags;

gigaset_dbg_buffer(cs->mstate != MS_LOCKED ?
DEBUG_TRANSCMD : DEBUG_LOCKCMD,
"CMD Transmit", len, buf);
DEBUG_TRANSCMD : DEBUG_LOCKCMD,
"CMD Transmit", len, buf);

if (len <= 0)
return 0;

if (!(cb = kmalloc(sizeof(struct cmdbuf_t) + len, GFP_ATOMIC))) {
cb = kmalloc(sizeof(struct cmdbuf_t) + len, GFP_ATOMIC);
if (!cb) {
dev_err(cs->dev, "%s: out of memory!\n", __func__);
return -ENOMEM;
}
Expand Down Expand Up @@ -392,7 +401,6 @@ static void gigaset_device_release(struct device *dev)
struct platform_device *pdev = to_platform_device(dev);

/* adapted from platform_device_release() in drivers/base/platform.c */
//FIXME is this actually necessary?
kfree(dev->platform_data);
kfree(pdev->resource);
}
Expand All @@ -404,16 +412,20 @@ static void gigaset_device_release(struct device *dev)
static int gigaset_initcshw(struct cardstate *cs)
{
int rc;
struct ser_cardstate *scs;

if (!(cs->hw.ser = kzalloc(sizeof(struct ser_cardstate), GFP_KERNEL))) {
scs = kzalloc(sizeof(struct ser_cardstate), GFP_KERNEL);
if (!scs) {
pr_err("out of memory\n");
return 0;
}
cs->hw.ser = scs;

cs->hw.ser->dev.name = GIGASET_MODULENAME;
cs->hw.ser->dev.id = cs->minor_index;
cs->hw.ser->dev.dev.release = gigaset_device_release;
if ((rc = platform_device_register(&cs->hw.ser->dev)) != 0) {
rc = platform_device_register(&cs->hw.ser->dev);
if (rc != 0) {
pr_err("error %d registering platform device\n", rc);
kfree(cs->hw.ser);
cs->hw.ser = NULL;
Expand All @@ -422,7 +434,7 @@ static int gigaset_initcshw(struct cardstate *cs)
dev_set_drvdata(&cs->hw.ser->dev.dev, cs);

tasklet_init(&cs->write_tasklet,
&gigaset_modem_fill, (unsigned long) cs);
&gigaset_modem_fill, (unsigned long) cs);
return 1;
}

Expand All @@ -434,7 +446,8 @@ static int gigaset_initcshw(struct cardstate *cs)
* Called by "gigaset_start" and "gigaset_enterconfigmode" in common.c
* and by "if_lock" and "if_termios" in interface.c
*/
static int gigaset_set_modem_ctrl(struct cardstate *cs, unsigned old_state, unsigned new_state)
static int gigaset_set_modem_ctrl(struct cardstate *cs, unsigned old_state,
unsigned new_state)
{
struct tty_struct *tty = cs->hw.ser->tty;
unsigned int set, clear;
Expand Down Expand Up @@ -520,8 +533,8 @@ gigaset_tty_open(struct tty_struct *tty)
}

/* allocate memory for our device state and intialize it */
if (!(cs = gigaset_initcs(driver, 1, 1, 0, cidmode,
GIGASET_MODULENAME)))
cs = gigaset_initcs(driver, 1, 1, 0, cidmode, GIGASET_MODULENAME);
if (!cs)
goto error;

cs->dev = &cs->hw.ser->dev.dev;
Expand Down Expand Up @@ -690,7 +703,8 @@ gigaset_tty_receive(struct tty_struct *tty, const unsigned char *buf,

if (!cs)
return;
if (!(inbuf = cs->inbuf)) {
inbuf = cs->inbuf;
if (!inbuf) {
dev_err(cs->dev, "%s: no inbuf\n", __func__);
cs_put(cs);
return;
Expand Down Expand Up @@ -770,18 +784,21 @@ static int __init ser_gigaset_init(void)
int rc;

gig_dbg(DEBUG_INIT, "%s", __func__);
if ((rc = platform_driver_register(&device_driver)) != 0) {
rc = platform_driver_register(&device_driver);
if (rc != 0) {
pr_err("error %d registering platform driver\n", rc);
return rc;
}

/* allocate memory for our driver state and intialize it */
if (!(driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS,
driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS,
GIGASET_MODULENAME, GIGASET_DEVNAME,
&ops, THIS_MODULE)))
&ops, THIS_MODULE);
if (!driver)
goto error;

if ((rc = tty_register_ldisc(N_GIGASET_M101, &gigaset_ldisc)) != 0) {
rc = tty_register_ldisc(N_GIGASET_M101, &gigaset_ldisc);
if (rc != 0) {
pr_err("error %d registering line discipline\n", rc);
goto error;
}
Expand All @@ -808,7 +825,8 @@ static void __exit ser_gigaset_exit(void)
driver = NULL;
}

if ((rc = tty_unregister_ldisc(N_GIGASET_M101)) != 0)
rc = tty_unregister_ldisc(N_GIGASET_M101);
if (rc != 0)
pr_err("error %d unregistering line discipline\n", rc);

platform_driver_unregister(&device_driver);
Expand Down

0 comments on commit d62bdf8

Please sign in to comment.