Commit 5002779d authored by Tilman Schmidt's avatar Tilman Schmidt Committed by Linus Torvalds

gigaset: use dev_ macros for messages

The info() / warn() / err() macros from usb.h for generating kernel
messages are considered inferior to dev_info() / dev_warn() / dev_err()
from device.h.  Replace them where possible.  Also correct the severity
level and improve the text of one message.
Signed-off-by: default avatarTilman Schmidt <tilman@imap.cc>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 9b3e43a7
...@@ -575,7 +575,8 @@ int gigaset_m10x_send_skb(struct bc_state *bcs, struct sk_buff *skb) ...@@ -575,7 +575,8 @@ int gigaset_m10x_send_skb(struct bc_state *bcs, struct sk_buff *skb)
else else
skb = iraw_encode(skb, HW_HDR_LEN, 0); skb = iraw_encode(skb, HW_HDR_LEN, 0);
if (!skb) { if (!skb) {
err("unable to allocate memory for encoding!\n"); dev_err(bcs->cs->dev,
"unable to allocate memory for encoding!\n");
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -287,7 +287,7 @@ struct event_t *gigaset_add_event(struct cardstate *cs, ...@@ -287,7 +287,7 @@ struct event_t *gigaset_add_event(struct cardstate *cs,
tail = cs->ev_tail; tail = cs->ev_tail;
next = (tail + 1) % MAX_EVENTS; next = (tail + 1) % MAX_EVENTS;
if (unlikely(next == cs->ev_head)) if (unlikely(next == cs->ev_head))
err("event queue full"); dev_err(cs->dev, "event queue full\n");
else { else {
event = cs->events + tail; event = cs->events + tail;
event->type = type; event->type = type;
......
...@@ -106,7 +106,6 @@ enum debuglevel { ...@@ -106,7 +106,6 @@ enum debuglevel {
#undef err #undef err
#undef info #undef info
#undef warn #undef warn
#undef notice
#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \ #define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \
format "\n" , ## arg) format "\n" , ## arg)
...@@ -114,8 +113,6 @@ enum debuglevel { ...@@ -114,8 +113,6 @@ enum debuglevel {
format "\n" , ## arg) format "\n" , ## arg)
#define warn(format, arg...) printk(KERN_WARNING KBUILD_MODNAME ": " \ #define warn(format, arg...) printk(KERN_WARNING KBUILD_MODNAME ": " \
format "\n" , ## arg) format "\n" , ## arg)
#define notice(format, arg...) printk(KERN_NOTICE KBUILD_MODNAME ": " \
format "\n" , ## arg)
#ifdef CONFIG_GIGASET_DEBUG #ifdef CONFIG_GIGASET_DEBUG
......
...@@ -46,7 +46,8 @@ static int writebuf_from_LL(int driverID, int channel, int ack, ...@@ -46,7 +46,8 @@ static int writebuf_from_LL(int driverID, int channel, int ack,
return -ENODEV; return -ENODEV;
} }
if (channel < 0 || channel >= cs->channels) { if (channel < 0 || channel >= cs->channels) {
err("%s: invalid channel ID (%d)", __func__, channel); dev_err(cs->dev, "%s: invalid channel ID (%d)\n",
__func__, channel);
return -ENODEV; return -ENODEV;
} }
bcs = &cs->bcs[channel]; bcs = &cs->bcs[channel];
...@@ -58,11 +59,13 @@ static int writebuf_from_LL(int driverID, int channel, int ack, ...@@ -58,11 +59,13 @@ static int writebuf_from_LL(int driverID, int channel, int ack,
if (!len) { if (!len) {
if (ack) if (ack)
notice("%s: not ACKing empty packet", __func__); dev_notice(cs->dev, "%s: not ACKing empty packet\n",
__func__);
return 0; return 0;
} }
if (len > MAX_BUF_SIZE) { if (len > MAX_BUF_SIZE) {
err("%s: packet too large (%d bytes)", __func__, len); dev_err(cs->dev, "%s: packet too large (%d bytes)\n",
__func__, len);
return -EINVAL; return -EINVAL;
} }
...@@ -116,8 +119,7 @@ static int command_from_LL(isdn_ctrl *cntrl) ...@@ -116,8 +119,7 @@ static int command_from_LL(isdn_ctrl *cntrl)
gigaset_debugdrivers(); gigaset_debugdrivers();
if (!cs) { if (!cs) {
warn("LL tried to access unknown device with nr. %d", err("%s: invalid driver ID (%d)", __func__, cntrl->driver);
cntrl->driver);
return -ENODEV; return -ENODEV;
} }
...@@ -126,7 +128,7 @@ static int command_from_LL(isdn_ctrl *cntrl) ...@@ -126,7 +128,7 @@ static int command_from_LL(isdn_ctrl *cntrl)
gig_dbg(DEBUG_ANY, "ISDN_CMD_IOCTL (driver: %d, arg: %ld)", gig_dbg(DEBUG_ANY, "ISDN_CMD_IOCTL (driver: %d, arg: %ld)",
cntrl->driver, cntrl->arg); cntrl->driver, cntrl->arg);
warn("ISDN_CMD_IOCTL is not supported."); dev_warn(cs->dev, "ISDN_CMD_IOCTL not supported\n");
return -EINVAL; return -EINVAL;
case ISDN_CMD_DIAL: case ISDN_CMD_DIAL:
...@@ -138,22 +140,23 @@ static int command_from_LL(isdn_ctrl *cntrl) ...@@ -138,22 +140,23 @@ static int command_from_LL(isdn_ctrl *cntrl)
cntrl->parm.setup.si1, cntrl->parm.setup.si2); cntrl->parm.setup.si1, cntrl->parm.setup.si2);
if (cntrl->arg >= cs->channels) { if (cntrl->arg >= cs->channels) {
err("ISDN_CMD_DIAL: invalid channel (%d)", dev_err(cs->dev,
(int) cntrl->arg); "ISDN_CMD_DIAL: invalid channel (%d)\n",
(int) cntrl->arg);
return -EINVAL; return -EINVAL;
} }
bcs = cs->bcs + cntrl->arg; bcs = cs->bcs + cntrl->arg;
if (!gigaset_get_channel(bcs)) { if (!gigaset_get_channel(bcs)) {
err("ISDN_CMD_DIAL: channel not free"); dev_err(cs->dev, "ISDN_CMD_DIAL: channel not free\n");
return -EBUSY; return -EBUSY;
} }
sp = kmalloc(sizeof *sp, GFP_ATOMIC); sp = kmalloc(sizeof *sp, GFP_ATOMIC);
if (!sp) { if (!sp) {
gigaset_free_channel(bcs); gigaset_free_channel(bcs);
err("ISDN_CMD_DIAL: out of memory"); dev_err(cs->dev, "ISDN_CMD_DIAL: out of memory\n");
return -ENOMEM; return -ENOMEM;
} }
*sp = cntrl->parm.setup; *sp = cntrl->parm.setup;
...@@ -173,8 +176,9 @@ static int command_from_LL(isdn_ctrl *cntrl) ...@@ -173,8 +176,9 @@ static int command_from_LL(isdn_ctrl *cntrl)
gig_dbg(DEBUG_ANY, "ISDN_CMD_ACCEPTD"); gig_dbg(DEBUG_ANY, "ISDN_CMD_ACCEPTD");
if (cntrl->arg >= cs->channels) { if (cntrl->arg >= cs->channels) {
err("ISDN_CMD_ACCEPTD: invalid channel (%d)", dev_err(cs->dev,
(int) cntrl->arg); "ISDN_CMD_ACCEPTD: invalid channel (%d)\n",
(int) cntrl->arg);
return -EINVAL; return -EINVAL;
} }
...@@ -196,8 +200,9 @@ static int command_from_LL(isdn_ctrl *cntrl) ...@@ -196,8 +200,9 @@ static int command_from_LL(isdn_ctrl *cntrl)
(int) cntrl->arg); (int) cntrl->arg);
if (cntrl->arg >= cs->channels) { if (cntrl->arg >= cs->channels) {
err("ISDN_CMD_HANGUP: invalid channel (%u)", dev_err(cs->dev,
(unsigned) cntrl->arg); "ISDN_CMD_HANGUP: invalid channel (%d)\n",
(int) cntrl->arg);
return -EINVAL; return -EINVAL;
} }
...@@ -224,8 +229,9 @@ static int command_from_LL(isdn_ctrl *cntrl) ...@@ -224,8 +229,9 @@ static int command_from_LL(isdn_ctrl *cntrl)
cntrl->arg & 0xff, (cntrl->arg >> 8)); cntrl->arg & 0xff, (cntrl->arg >> 8));
if ((cntrl->arg & 0xff) >= cs->channels) { if ((cntrl->arg & 0xff) >= cs->channels) {
err("ISDN_CMD_SETL2: invalid channel (%u)", dev_err(cs->dev,
(unsigned) cntrl->arg & 0xff); "ISDN_CMD_SETL2: invalid channel (%d)\n",
(int) cntrl->arg & 0xff);
return -EINVAL; return -EINVAL;
} }
...@@ -244,14 +250,16 @@ static int command_from_LL(isdn_ctrl *cntrl) ...@@ -244,14 +250,16 @@ static int command_from_LL(isdn_ctrl *cntrl)
cntrl->arg & 0xff, (cntrl->arg >> 8)); cntrl->arg & 0xff, (cntrl->arg >> 8));
if ((cntrl->arg & 0xff) >= cs->channels) { if ((cntrl->arg & 0xff) >= cs->channels) {
err("ISDN_CMD_SETL3: invalid channel (%u)", dev_err(cs->dev,
(unsigned) cntrl->arg & 0xff); "ISDN_CMD_SETL3: invalid channel (%d)\n",
(int) cntrl->arg & 0xff);
return -EINVAL; return -EINVAL;
} }
if (cntrl->arg >> 8 != ISDN_PROTO_L3_TRANS) { if (cntrl->arg >> 8 != ISDN_PROTO_L3_TRANS) {
err("ISDN_CMD_SETL3: invalid protocol %lu", dev_err(cs->dev,
cntrl->arg >> 8); "ISDN_CMD_SETL3: invalid protocol %lu\n",
cntrl->arg >> 8);
return -EINVAL; return -EINVAL;
} }
...@@ -262,8 +270,9 @@ static int command_from_LL(isdn_ctrl *cntrl) ...@@ -262,8 +270,9 @@ static int command_from_LL(isdn_ctrl *cntrl)
case ISDN_CMD_ALERT: case ISDN_CMD_ALERT:
gig_dbg(DEBUG_ANY, "ISDN_CMD_ALERT"); //FIXME gig_dbg(DEBUG_ANY, "ISDN_CMD_ALERT"); //FIXME
if (cntrl->arg >= cs->channels) { if (cntrl->arg >= cs->channels) {
err("ISDN_CMD_ALERT: invalid channel (%d)", dev_err(cs->dev,
(int) cntrl->arg); "ISDN_CMD_ALERT: invalid channel (%d)\n",
(int) cntrl->arg);
return -EINVAL; return -EINVAL;
} }
//bcs = cs->bcs + cntrl->arg; //bcs = cs->bcs + cntrl->arg;
...@@ -295,7 +304,8 @@ static int command_from_LL(isdn_ctrl *cntrl) ...@@ -295,7 +304,8 @@ static int command_from_LL(isdn_ctrl *cntrl)
gig_dbg(DEBUG_ANY, "ISDN_CMD_GETSIL"); gig_dbg(DEBUG_ANY, "ISDN_CMD_GETSIL");
break; break;
default: default:
err("unknown command %d from LL", cntrl->command); dev_err(cs->dev, "unknown command %d from LL\n",
cntrl->command);
return -EINVAL; return -EINVAL;
} }
......
...@@ -197,7 +197,7 @@ static void if_close(struct tty_struct *tty, struct file *filp) ...@@ -197,7 +197,7 @@ static void if_close(struct tty_struct *tty, struct file *filp)
mutex_lock(&cs->mutex); mutex_lock(&cs->mutex);
if (!cs->open_count) if (!cs->open_count)
warn("%s: device not opened", __func__); dev_warn(cs->dev, "%s: device not opened\n", __func__);
else { else {
if (!--cs->open_count) { if (!--cs->open_count) {
spin_lock_irqsave(&cs->lock, flags); spin_lock_irqsave(&cs->lock, flags);
...@@ -232,7 +232,7 @@ static int if_ioctl(struct tty_struct *tty, struct file *file, ...@@ -232,7 +232,7 @@ static int if_ioctl(struct tty_struct *tty, struct file *file,
return -ERESTARTSYS; // FIXME -EINTR? return -ERESTARTSYS; // FIXME -EINTR?
if (!cs->open_count) if (!cs->open_count)
warn("%s: device not opened", __func__); dev_warn(cs->dev, "%s: device not opened\n", __func__);
else { else {
retval = 0; retval = 0;
switch (cmd) { switch (cmd) {
...@@ -364,9 +364,9 @@ static int if_write(struct tty_struct *tty, const unsigned char *buf, int count) ...@@ -364,9 +364,9 @@ static int if_write(struct tty_struct *tty, const unsigned char *buf, int count)
return -ERESTARTSYS; // FIXME -EINTR? return -ERESTARTSYS; // FIXME -EINTR?
if (!cs->open_count) if (!cs->open_count)
warn("%s: device not opened", __func__); dev_warn(cs->dev, "%s: device not opened\n", __func__);
else if (cs->mstate != MS_LOCKED) { else if (cs->mstate != MS_LOCKED) {
warn("can't write to unlocked device"); dev_warn(cs->dev, "can't write to unlocked device\n");
retval = -EBUSY; retval = -EBUSY;
} else if (!cs->connected) { } else if (!cs->connected) {
gig_dbg(DEBUG_ANY, "can't write to unplugged device"); gig_dbg(DEBUG_ANY, "can't write to unplugged device");
...@@ -398,9 +398,9 @@ static int if_write_room(struct tty_struct *tty) ...@@ -398,9 +398,9 @@ static int if_write_room(struct tty_struct *tty)
return -ERESTARTSYS; // FIXME -EINTR? return -ERESTARTSYS; // FIXME -EINTR?
if (!cs->open_count) if (!cs->open_count)
warn("%s: device not opened", __func__); dev_warn(cs->dev, "%s: device not opened\n", __func__);
else if (cs->mstate != MS_LOCKED) { else if (cs->mstate != MS_LOCKED) {
warn("can't write to unlocked device"); dev_warn(cs->dev, "can't write to unlocked device\n");
retval = -EBUSY; retval = -EBUSY;
} else if (!cs->connected) { } else if (!cs->connected) {
gig_dbg(DEBUG_ANY, "can't write to unplugged device"); gig_dbg(DEBUG_ANY, "can't write to unplugged device");
...@@ -430,9 +430,9 @@ static int if_chars_in_buffer(struct tty_struct *tty) ...@@ -430,9 +430,9 @@ static int if_chars_in_buffer(struct tty_struct *tty)
return -ERESTARTSYS; // FIXME -EINTR? return -ERESTARTSYS; // FIXME -EINTR?
if (!cs->open_count) if (!cs->open_count)
warn("%s: device not opened", __func__); dev_warn(cs->dev, "%s: device not opened\n", __func__);
else if (cs->mstate != MS_LOCKED) { else if (cs->mstate != MS_LOCKED) {
warn("can't write to unlocked device"); dev_warn(cs->dev, "can't write to unlocked device\n");
retval = -EBUSY; retval = -EBUSY;
} else if (!cs->connected) { } else if (!cs->connected) {
gig_dbg(DEBUG_ANY, "can't write to unplugged device"); gig_dbg(DEBUG_ANY, "can't write to unplugged device");
...@@ -460,7 +460,7 @@ static void if_throttle(struct tty_struct *tty) ...@@ -460,7 +460,7 @@ static void if_throttle(struct tty_struct *tty)
mutex_lock(&cs->mutex); mutex_lock(&cs->mutex);
if (!cs->open_count) if (!cs->open_count)
warn("%s: device not opened", __func__); dev_warn(cs->dev, "%s: device not opened\n", __func__);
else { else {
//FIXME //FIXME
} }
...@@ -483,7 +483,7 @@ static void if_unthrottle(struct tty_struct *tty) ...@@ -483,7 +483,7 @@ static void if_unthrottle(struct tty_struct *tty)
mutex_lock(&cs->mutex); mutex_lock(&cs->mutex);
if (!cs->open_count) if (!cs->open_count)
warn("%s: device not opened", __func__); dev_warn(cs->dev, "%s: device not opened\n", __func__);
else { else {
//FIXME //FIXME
} }
...@@ -510,7 +510,7 @@ static void if_set_termios(struct tty_struct *tty, struct ktermios *old) ...@@ -510,7 +510,7 @@ static void if_set_termios(struct tty_struct *tty, struct ktermios *old)
mutex_lock(&cs->mutex); mutex_lock(&cs->mutex);
if (!cs->open_count) { if (!cs->open_count) {
warn("%s: device not opened", __func__); dev_warn(cs->dev, "%s: device not opened\n", __func__);
goto out; goto out;
} }
...@@ -623,7 +623,8 @@ void gigaset_if_init(struct cardstate *cs) ...@@ -623,7 +623,8 @@ void gigaset_if_init(struct cardstate *cs)
if (!IS_ERR(cs->tty_dev)) if (!IS_ERR(cs->tty_dev))
dev_set_drvdata(cs->tty_dev, cs); dev_set_drvdata(cs->tty_dev, cs);
else { else {
warn("could not register device to the tty subsystem"); dev_warn(cs->dev,
"could not register device to the tty subsystem\n");
cs->tty_dev = NULL; cs->tty_dev = NULL;
} }
mutex_unlock(&cs->mutex); mutex_unlock(&cs->mutex);
......
...@@ -498,8 +498,9 @@ static int send_cb(struct cardstate *cs, struct cmdbuf_t *cb) ...@@ -498,8 +498,9 @@ static int send_cb(struct cardstate *cs, struct cmdbuf_t *cb)
if (status) { if (status) {
ucs->busy = 0; ucs->busy = 0;
err("could not submit urb (error %d)\n", dev_err(cs->dev,
-status); "could not submit urb (error %d)\n",
-status);
cb->len = 0; /* skip urb => remove cb+wakeup cb->len = 0; /* skip urb => remove cb+wakeup
in next loop cycle */ in next loop cycle */
} }
...@@ -670,7 +671,7 @@ static int write_modem(struct cardstate *cs) ...@@ -670,7 +671,7 @@ static int write_modem(struct cardstate *cs)
spin_unlock_irqrestore(&cs->lock, flags); spin_unlock_irqrestore(&cs->lock, flags);
if (ret) { if (ret) {
err("could not submit urb (error %d)\n", -ret); dev_err(cs->dev, "could not submit urb (error %d)\n", -ret);
ucs->busy = 0; ucs->busy = 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment