Skip to content

Commit

Permalink
gigaset: use pr_err() and pr_info()
Browse files Browse the repository at this point in the history
Switch from private printk wrapper macros to using pr_err() and
pr_info() from linux/kernel.h, at the same time unifying a few
error messages.

Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Tilman Schmidt authored and David S. Miller committed Dec 26, 2008
1 parent 4d8cd00 commit c8770dc
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 58 deletions.
12 changes: 7 additions & 5 deletions drivers/isdn/gigaset/bas-gigaset.c
Original file line number Diff line number Diff line change
Expand Up @@ -2067,7 +2067,7 @@ static int gigaset_initbcshw(struct bc_state *bcs)

bcs->hw.bas = ubc = kmalloc(sizeof(struct bas_bc_state), GFP_KERNEL);
if (!ubc) {
err("could not allocate bas_bc_state");
pr_err("out of memory\n");
return 0;
}

Expand All @@ -2081,7 +2081,7 @@ static int gigaset_initbcshw(struct bc_state *bcs)
ubc->isooutdone = ubc->isooutfree = ubc->isooutovfl = NULL;
ubc->numsub = 0;
if (!(ubc->isooutbuf = kmalloc(sizeof(struct isowbuf_t), GFP_KERNEL))) {
err("could not allocate isochronous output buffer");
pr_err("out of memory\n");
kfree(ubc);
bcs->hw.bas = NULL;
return 0;
Expand Down Expand Up @@ -2136,8 +2136,10 @@ static int gigaset_initcshw(struct cardstate *cs)
struct bas_cardstate *ucs;

cs->hw.bas = ucs = kmalloc(sizeof *ucs, GFP_KERNEL);
if (!ucs)
if (!ucs) {
pr_err("out of memory\n");
return 0;
}

ucs->urb_cmd_in = NULL;
ucs->urb_cmd_out = NULL;
Expand Down Expand Up @@ -2503,11 +2505,11 @@ static int __init bas_gigaset_init(void)
/* register this driver with the USB subsystem */
result = usb_register(&gigaset_usb_driver);
if (result < 0) {
err("usb_register failed (error %d)", -result);
pr_err("error %d registering USB driver\n", -result);
goto error;
}

printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n");
pr_info(DRIVER_DESC "\n");
return 0;

error:
Expand Down
20 changes: 9 additions & 11 deletions drivers/isdn/gigaset/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
} else if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL)
skb_reserve(bcs->skb, HW_HDR_LEN);
else {
err("could not allocate skb");
pr_err("out of memory\n");
bcs->inputstate |= INS_skip_frame;
}

Expand Down Expand Up @@ -634,20 +634,20 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,

gig_dbg(DEBUG_INIT, "allocating cs");
if (!(cs = alloc_cs(drv))) {
err("maximum number of devices exceeded");
pr_err("maximum number of devices exceeded\n");
return NULL;
}

gig_dbg(DEBUG_INIT, "allocating bcs[0..%d]", channels - 1);
cs->bcs = kmalloc(channels * sizeof(struct bc_state), GFP_KERNEL);
if (!cs->bcs) {
err("out of memory");
pr_err("out of memory\n");
goto error;
}
gig_dbg(DEBUG_INIT, "allocating inbuf");
cs->inbuf = kmalloc(sizeof(struct inbuf_t), GFP_KERNEL);
if (!cs->inbuf) {
err("out of memory");
pr_err("out of memory\n");
goto error;
}

Expand Down Expand Up @@ -690,7 +690,7 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
for (i = 0; i < channels; ++i) {
gig_dbg(DEBUG_INIT, "setting up bcs[%d].read", i);
if (!gigaset_initbcs(cs->bcs + i, cs, i)) {
err("could not allocate channel %d data", i);
pr_err("could not allocate channel %d data\n", i);
goto error;
}
}
Expand Down Expand Up @@ -720,17 +720,15 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,

gig_dbg(DEBUG_INIT, "setting up iif");
if (!gigaset_register_to_LL(cs, modulename)) {
err("register_isdn failed");
pr_err("error registering ISDN device\n");
goto error;
}

make_valid(cs, VALID_ID);
++cs->cs_init;
gig_dbg(DEBUG_INIT, "setting up hw");
if (!cs->ops->initcshw(cs)) {
err("could not allocate device specific data");
if (!cs->ops->initcshw(cs))
goto error;
}

++cs->cs_init;

Expand Down Expand Up @@ -836,7 +834,7 @@ static void cleanup_cs(struct cardstate *cs)
for (i = 0; i < cs->channels; ++i) {
gigaset_freebcs(cs->bcs + i);
if (!gigaset_initbcs(cs->bcs + i, cs, i))
break; //FIXME error handling
pr_err("could not allocate channel %d data\n", i);
}

if (cs->waiting) {
Expand Down Expand Up @@ -1120,7 +1118,7 @@ static int __init gigaset_init_module(void)
if (gigaset_debuglevel == 1)
gigaset_debuglevel = DEBUG_DEFAULT;

printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n");
pr_info(DRIVER_DESC "\n");
return 0;
}

Expand Down
14 changes: 3 additions & 11 deletions drivers/isdn/gigaset/gigaset.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
#ifndef GIGASET_H
#define GIGASET_H

/* define global prefix for pr_ macros in linux/kernel.h */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/kernel.h>
#include <linux/compiler.h>
#include <linux/types.h>
Expand Down Expand Up @@ -97,17 +100,6 @@ enum debuglevel {
activated */
};

/* Kernel message macros for situations where dev_printk and friends cannot be
* used for lack of reliable access to a device structure.
* linux/usb.h already contains these but in an obsolete form which clutters
* the log needlessly, and according to the USB maintainer those should be
* removed rather than fixed anyway.
*/
#undef err

#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \
format "\n" , ## arg)

#ifdef CONFIG_GIGASET_DEBUG

#define gig_dbg(level, format, arg...) \
Expand Down
4 changes: 2 additions & 2 deletions drivers/isdn/gigaset/i4l.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static int writebuf_from_LL(int driverID, int channel, int ack,
unsigned skblen;

if (!(cs = gigaset_get_cs_by_id(driverID))) {
err("%s: invalid driver ID (%d)", __func__, driverID);
pr_err("%s: invalid driver ID (%d)\n", __func__, driverID);
return -ENODEV;
}
if (channel < 0 || channel >= cs->channels) {
Expand Down Expand Up @@ -119,7 +119,7 @@ static int command_from_LL(isdn_ctrl *cntrl)
gigaset_debugdrivers();

if (!cs) {
err("%s: invalid driver ID (%d)", __func__, cntrl->driver);
pr_err("%s: invalid driver ID (%d)\n", __func__, cntrl->driver);
return -ENODEV;
}

Expand Down
26 changes: 13 additions & 13 deletions drivers/isdn/gigaset/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ static int if_config(struct cardstate *cs, int *arg)
return -EBUSY;

if (!cs->connected) {
err("not connected!");
pr_err("%s: not connected\n", __func__);
return -ENODEV;
}

Expand Down Expand Up @@ -188,7 +188,7 @@ static void if_close(struct tty_struct *tty, struct file *filp)

cs = (struct cardstate *) tty->driver_data;
if (!cs) {
err("cs==NULL in %s", __func__);
pr_err("%s: no cardstate\n", __func__);
return;
}

Expand Down Expand Up @@ -222,7 +222,7 @@ static int if_ioctl(struct tty_struct *tty, struct file *file,

cs = (struct cardstate *) tty->driver_data;
if (!cs) {
err("cs==NULL in %s", __func__);
pr_err("%s: no cardstate\n", __func__);
return -ENODEV;
}

Expand Down Expand Up @@ -297,7 +297,7 @@ static int if_tiocmget(struct tty_struct *tty, struct file *file)

cs = (struct cardstate *) tty->driver_data;
if (!cs) {
err("cs==NULL in %s", __func__);
pr_err("%s: no cardstate\n", __func__);
return -ENODEV;
}

Expand All @@ -323,7 +323,7 @@ static int if_tiocmset(struct tty_struct *tty, struct file *file,

cs = (struct cardstate *) tty->driver_data;
if (!cs) {
err("cs==NULL in %s", __func__);
pr_err("%s: no cardstate\n", __func__);
return -ENODEV;
}

Expand Down Expand Up @@ -354,7 +354,7 @@ static int if_write(struct tty_struct *tty, const unsigned char *buf, int count)

cs = (struct cardstate *) tty->driver_data;
if (!cs) {
err("cs==NULL in %s", __func__);
pr_err("%s: no cardstate\n", __func__);
return -ENODEV;
}

Expand Down Expand Up @@ -388,7 +388,7 @@ static int if_write_room(struct tty_struct *tty)

cs = (struct cardstate *) tty->driver_data;
if (!cs) {
err("cs==NULL in %s", __func__);
pr_err("%s: no cardstate\n", __func__);
return -ENODEV;
}

Expand Down Expand Up @@ -420,7 +420,7 @@ static int if_chars_in_buffer(struct tty_struct *tty)

cs = (struct cardstate *) tty->driver_data;
if (!cs) {
err("cs==NULL in %s", __func__);
pr_err("%s: no cardstate\n", __func__);
return -ENODEV;
}

Expand Down Expand Up @@ -451,7 +451,7 @@ static void if_throttle(struct tty_struct *tty)

cs = (struct cardstate *) tty->driver_data;
if (!cs) {
err("cs==NULL in %s", __func__);
pr_err("%s: no cardstate\n", __func__);
return;
}

Expand All @@ -474,7 +474,7 @@ static void if_unthrottle(struct tty_struct *tty)

cs = (struct cardstate *) tty->driver_data;
if (!cs) {
err("cs==NULL in %s", __func__);
pr_err("%s: no cardstate\n", __func__);
return;
}

Expand All @@ -501,7 +501,7 @@ static void if_set_termios(struct tty_struct *tty, struct ktermios *old)

cs = (struct cardstate *) tty->driver_data;
if (!cs) {
err("cs==NULL in %s", __func__);
pr_err("%s: no cardstate\n", __func__);
return;
}

Expand Down Expand Up @@ -701,15 +701,15 @@ void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname,

ret = tty_register_driver(tty);
if (ret < 0) {
err("failed to register tty driver (error %d)", ret);
pr_err("error %d registering tty driver\n", ret);
goto error;
}
gig_dbg(DEBUG_IF, "tty driver initialized");
drv->have_tty = 1;
return;

enomem:
err("could not allocate tty structures");
pr_err("out of memory\n");
error:
if (drv->tty)
put_tty_driver(drv->tty);
Expand Down
4 changes: 2 additions & 2 deletions drivers/isdn/gigaset/isocdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,13 @@ int gigaset_isowbuf_getbytes(struct isowbuf_t *iwb, int size)
__func__, read, write, limit);
#ifdef CONFIG_GIGASET_DEBUG
if (unlikely(size < 0 || size > BAS_OUTBUFPAD)) {
err("invalid size %d", size);
pr_err("invalid size %d\n", size);
return -EINVAL;
}
src = iwb->read;
if (unlikely(limit > BAS_OUTBUFSIZE + BAS_OUTBUFPAD ||
(read < src && limit >= src))) {
err("isoc write buffer frame reservation violated");
pr_err("isoc write buffer frame reservation violated\n");
return -EFAULT;
}
#endif
Expand Down
16 changes: 8 additions & 8 deletions drivers/isdn/gigaset/ser-gigaset.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,15 +407,15 @@ static int gigaset_initcshw(struct cardstate *cs)
int rc;

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

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) {
err("error %d registering platform device", rc);
pr_err("error %d registering platform device\n", rc);
kfree(cs->hw.ser);
cs->hw.ser = NULL;
return 0;
Expand Down Expand Up @@ -513,10 +513,10 @@ gigaset_tty_open(struct tty_struct *tty)

gig_dbg(DEBUG_INIT, "Starting HLL for Gigaset M101");

printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n");
pr_info(DRIVER_DESC "\n");

if (!driver) {
err("%s: no driver structure", __func__);
pr_err("%s: no driver structure\n", __func__);
return -ENODEV;
}

Expand Down Expand Up @@ -572,7 +572,7 @@ gigaset_tty_close(struct tty_struct *tty)
tty->disc_data = NULL;

if (!cs->hw.ser)
err("%s: no hw cardstate", __func__);
pr_err("%s: no hw cardstate\n", __func__);
else {
/* wait for running methods to finish */
if (!atomic_dec_and_test(&cs->hw.ser->refcnt))
Expand Down Expand Up @@ -772,7 +772,7 @@ static int __init ser_gigaset_init(void)

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

Expand All @@ -783,7 +783,7 @@ static int __init ser_gigaset_init(void)
goto error;

if ((rc = tty_register_ldisc(N_GIGASET_M101, &gigaset_ldisc)) != 0) {
err("error %d registering line discipline", rc);
pr_err("error %d registering line discipline\n", rc);
goto error;
}

Expand All @@ -810,7 +810,7 @@ static void __exit ser_gigaset_exit(void)
}

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

platform_driver_unregister(&device_driver);
}
Expand Down
Loading

0 comments on commit c8770dc

Please sign in to comment.