Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 12a3bfef authored by Joe Perches's avatar Joe Perches Committed by David S. Miller
Browse files

generic_hdlc: Update to current logging forms



Use pr_fmt, pr_<level> and netdev_<level> as appropriate.

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2903dd65
Loading
Loading
Loading
Loading
+15 −15
Original line number Original line Diff line number Diff line
@@ -14,6 +14,8 @@
 *    Moxa C101 User's Manual
 *    Moxa C101 User's Manual
 */
 */


#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/module.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/capability.h>
#include <linux/capability.h>
@@ -313,44 +315,44 @@ static int __init c101_run(unsigned long irq, unsigned long winbase)
	int result;
	int result;


	if (irq<3 || irq>15 || irq == 6) /* FIXME */ {
	if (irq<3 || irq>15 || irq == 6) /* FIXME */ {
		printk(KERN_ERR "c101: invalid IRQ value\n");
		pr_err("invalid IRQ value\n");
		return -ENODEV;
		return -ENODEV;
	}
	}


	if (winbase < 0xC0000 || winbase > 0xDFFFF || (winbase & 0x3FFF) !=0) {
	if (winbase < 0xC0000 || winbase > 0xDFFFF || (winbase & 0x3FFF) !=0) {
		printk(KERN_ERR "c101: invalid RAM value\n");
		pr_err("invalid RAM value\n");
		return -ENODEV;
		return -ENODEV;
	}
	}


	card = kzalloc(sizeof(card_t), GFP_KERNEL);
	card = kzalloc(sizeof(card_t), GFP_KERNEL);
	if (card == NULL) {
	if (card == NULL) {
		printk(KERN_ERR "c101: unable to allocate memory\n");
		pr_err("unable to allocate memory\n");
		return -ENOBUFS;
		return -ENOBUFS;
	}
	}


	card->dev = alloc_hdlcdev(card);
	card->dev = alloc_hdlcdev(card);
	if (!card->dev) {
	if (!card->dev) {
		printk(KERN_ERR "c101: unable to allocate memory\n");
		pr_err("unable to allocate memory\n");
		kfree(card);
		kfree(card);
		return -ENOBUFS;
		return -ENOBUFS;
	}
	}


	if (request_irq(irq, sca_intr, 0, devname, card)) {
	if (request_irq(irq, sca_intr, 0, devname, card)) {
		printk(KERN_ERR "c101: could not allocate IRQ\n");
		pr_err("could not allocate IRQ\n");
		c101_destroy_card(card);
		c101_destroy_card(card);
		return -EBUSY;
		return -EBUSY;
	}
	}
	card->irq = irq;
	card->irq = irq;


	if (!request_mem_region(winbase, C101_MAPPED_RAM_SIZE, devname)) {
	if (!request_mem_region(winbase, C101_MAPPED_RAM_SIZE, devname)) {
		printk(KERN_ERR "c101: could not request RAM window\n");
		pr_err("could not request RAM window\n");
		c101_destroy_card(card);
		c101_destroy_card(card);
		return -EBUSY;
		return -EBUSY;
	}
	}
	card->phy_winbase = winbase;
	card->phy_winbase = winbase;
	card->win0base = ioremap(winbase, C101_MAPPED_RAM_SIZE);
	card->win0base = ioremap(winbase, C101_MAPPED_RAM_SIZE);
	if (!card->win0base) {
	if (!card->win0base) {
		printk(KERN_ERR "c101: could not map I/O address\n");
		pr_err("could not map I/O address\n");
		c101_destroy_card(card);
		c101_destroy_card(card);
		return -EFAULT;
		return -EFAULT;
	}
	}
@@ -381,7 +383,7 @@ static int __init c101_run(unsigned long irq, unsigned long winbase)


	result = register_hdlc_device(dev);
	result = register_hdlc_device(dev);
	if (result) {
	if (result) {
		printk(KERN_WARNING "c101: unable to register hdlc device\n");
		pr_warn("unable to register hdlc device\n");
		c101_destroy_card(card);
		c101_destroy_card(card);
		return result;
		return result;
	}
	}
@@ -389,10 +391,8 @@ static int __init c101_run(unsigned long irq, unsigned long winbase)
	sca_init_port(card); /* Set up C101 memory */
	sca_init_port(card); /* Set up C101 memory */
	set_carrier(card);
	set_carrier(card);


	printk(KERN_INFO "%s: Moxa C101 on IRQ%u,"
	netdev_info(dev, "Moxa C101 on IRQ%u, using %u TX + %u RX packets rings\n",
	       " using %u TX + %u RX packets rings\n",
		    card->irq, card->tx_ring_buffers, card->rx_ring_buffers);
	       dev->name, card->irq,
	       card->tx_ring_buffers, card->rx_ring_buffers);


	*new_card = card;
	*new_card = card;
	new_card = &card->next_card;
	new_card = &card->next_card;
@@ -405,12 +405,12 @@ static int __init c101_init(void)
{
{
	if (hw == NULL) {
	if (hw == NULL) {
#ifdef MODULE
#ifdef MODULE
		printk(KERN_INFO "c101: no card initialized\n");
		pr_info("no card initialized\n");
#endif
#endif
		return -EINVAL;	/* no parameters specified, abort */
		return -EINVAL;	/* no parameters specified, abort */
	}
	}


	printk(KERN_INFO "%s\n", version);
	pr_info("%s\n", version);


	do {
	do {
		unsigned long irq, ram;
		unsigned long irq, ram;
@@ -428,7 +428,7 @@ static int __init c101_init(void)
			return first_card ? 0 : -EINVAL;
			return first_card ? 0 : -EINVAL;
	}while(*hw++ == ':');
	}while(*hw++ == ':');


	printk(KERN_ERR "c101: invalid hardware parameters\n");
	pr_err("invalid hardware parameters\n");
	return first_card ? 0 : -EINVAL;
	return first_card ? 0 : -EINVAL;
}
}


+4 −4
Original line number Original line Diff line number Diff line
@@ -582,8 +582,8 @@ static void sca_dump_rings(struct net_device *dev)
	       sca_in(DSR_RX(phy_node(port)), card), port->rxin,
	       sca_in(DSR_RX(phy_node(port)), card), port->rxin,
	       sca_in(DSR_RX(phy_node(port)), card) & DSR_DE ? "" : "in");
	       sca_in(DSR_RX(phy_node(port)), card) & DSR_DE ? "" : "in");
	for (cnt = 0; cnt < port_to_card(port)->rx_ring_buffers; cnt++)
	for (cnt = 0; cnt < port_to_card(port)->rx_ring_buffers; cnt++)
		printk(" %02X", readb(&(desc_address(port, cnt, 0)->stat)));
		pr_cont(" %02X", readb(&(desc_address(port, cnt, 0)->stat)));
	printk(KERN_CONT "\n");
	pr_cont("\n");


	printk(KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u "
	printk(KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u "
	       "last=%u %sactive",
	       "last=%u %sactive",
@@ -593,8 +593,8 @@ static void sca_dump_rings(struct net_device *dev)
	       sca_in(DSR_TX(phy_node(port)), card) & DSR_DE ? "" : "in");
	       sca_in(DSR_TX(phy_node(port)), card) & DSR_DE ? "" : "in");


	for (cnt = 0; cnt < port_to_card(port)->tx_ring_buffers; cnt++)
	for (cnt = 0; cnt < port_to_card(port)->tx_ring_buffers; cnt++)
		printk(" %02X", readb(&(desc_address(port, cnt, 1)->stat)));
		pr_cont(" %02X", readb(&(desc_address(port, cnt, 1)->stat)));
	printk("\n");
	pr_cont("\n");


	printk(KERN_DEBUG "MSCI: MD: %02x %02x %02x, ST: %02x %02x %02x %02x,"
	printk(KERN_DEBUG "MSCI: MD: %02x %02x %02x, ST: %02x %02x %02x %02x,"
	       " FST: %02x CST: %02x %02x\n",
	       " FST: %02x CST: %02x %02x\n",
+4 −4
Original line number Original line Diff line number Diff line
@@ -530,8 +530,8 @@ static void sca_dump_rings(struct net_device *dev)
	       sca_in(DSR_RX(port->chan), card), port->rxin,
	       sca_in(DSR_RX(port->chan), card), port->rxin,
	       sca_in(DSR_RX(port->chan), card) & DSR_DE ? "" : "in");
	       sca_in(DSR_RX(port->chan), card) & DSR_DE ? "" : "in");
	for (cnt = 0; cnt < port->card->rx_ring_buffers; cnt++)
	for (cnt = 0; cnt < port->card->rx_ring_buffers; cnt++)
		printk(" %02X", readb(&(desc_address(port, cnt, 0)->stat)));
		pr_cont(" %02X", readb(&(desc_address(port, cnt, 0)->stat)));
	printk(KERN_CONT "\n");
	pr_cont("\n");


	printk(KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u "
	printk(KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u "
	       "last=%u %sactive",
	       "last=%u %sactive",
@@ -541,8 +541,8 @@ static void sca_dump_rings(struct net_device *dev)
	       sca_in(DSR_TX(port->chan), card) & DSR_DE ? "" : "in");
	       sca_in(DSR_TX(port->chan), card) & DSR_DE ? "" : "in");


	for (cnt = 0; cnt < port->card->tx_ring_buffers; cnt++)
	for (cnt = 0; cnt < port->card->tx_ring_buffers; cnt++)
		printk(" %02X", readb(&(desc_address(port, cnt, 1)->stat)));
		pr_cont(" %02X", readb(&(desc_address(port, cnt, 1)->stat)));
	printk("\n");
	pr_cont("\n");


	printk(KERN_DEBUG "MSCI: MD: %02x %02x %02x,"
	printk(KERN_DEBUG "MSCI: MD: %02x %02x %02x,"
	       " ST: %02x %02x %02x %02x %02x, FST: %02x CST: %02x %02x\n",
	       " ST: %02x %02x %02x %02x %02x, FST: %02x CST: %02x %02x\n",
+9 −7
Original line number Original line Diff line number Diff line
@@ -22,6 +22,8 @@
 * - proto->start() and stop() are called with spin_lock_irq held.
 * - proto->start() and stop() are called with spin_lock_irq held.
 */
 */


#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/errno.h>
#include <linux/errno.h>
#include <linux/hdlc.h>
#include <linux/hdlc.h>
#include <linux/if_arp.h>
#include <linux/if_arp.h>
@@ -130,10 +132,10 @@ static int hdlc_device_event(struct notifier_block *this, unsigned long event,
		goto carrier_exit;
		goto carrier_exit;


	if (hdlc->carrier) {
	if (hdlc->carrier) {
		printk(KERN_INFO "%s: Carrier detected\n", dev->name);
		netdev_info(dev, "Carrier detected\n");
		hdlc_proto_start(dev);
		hdlc_proto_start(dev);
	} else {
	} else {
		printk(KERN_INFO "%s: Carrier lost\n", dev->name);
		netdev_info(dev, "Carrier lost\n");
		hdlc_proto_stop(dev);
		hdlc_proto_stop(dev);
	}
	}


@@ -165,10 +167,10 @@ int hdlc_open(struct net_device *dev)
	spin_lock_irq(&hdlc->state_lock);
	spin_lock_irq(&hdlc->state_lock);


	if (hdlc->carrier) {
	if (hdlc->carrier) {
		printk(KERN_INFO "%s: Carrier detected\n", dev->name);
		netdev_info(dev, "Carrier detected\n");
		hdlc_proto_start(dev);
		hdlc_proto_start(dev);
	} else
	} else
		printk(KERN_INFO "%s: No carrier\n", dev->name);
		netdev_info(dev, "No carrier\n");


	hdlc->open = 1;
	hdlc->open = 1;


@@ -281,8 +283,8 @@ int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
	if (size)
	if (size)
		if ((dev_to_hdlc(dev)->state = kmalloc(size,
		if ((dev_to_hdlc(dev)->state = kmalloc(size,
						       GFP_KERNEL)) == NULL) {
						       GFP_KERNEL)) == NULL) {
			printk(KERN_WARNING "Memory squeeze on"
			netdev_warn(dev,
			       " hdlc_proto_attach()\n");
				    "Memory squeeze on hdlc_proto_attach()\n");
			module_put(proto->module);
			module_put(proto->module);
			return -ENOBUFS;
			return -ENOBUFS;
		}
		}
@@ -363,7 +365,7 @@ static int __init hdlc_module_init(void)
{
{
	int result;
	int result;


	printk(KERN_INFO "%s\n", version);
	pr_info("%s\n", version);
	if ((result = register_netdevice_notifier(&hdlc_notifier)) != 0)
	if ((result = register_netdevice_notifier(&hdlc_notifier)) != 0)
		return result;
		return result;
	dev_add_pack(&hdlc_packet_type);
	dev_add_pack(&hdlc_packet_type);
+8 −13
Original line number Original line Diff line number Diff line
@@ -103,9 +103,7 @@ static void cisco_keepalive_send(struct net_device *dev, u32 type,
	skb = dev_alloc_skb(sizeof(struct hdlc_header) +
	skb = dev_alloc_skb(sizeof(struct hdlc_header) +
			    sizeof(struct cisco_packet));
			    sizeof(struct cisco_packet));
	if (!skb) {
	if (!skb) {
		printk(KERN_WARNING
		netdev_warn(dev, "Memory squeeze on cisco_keepalive_send()\n");
		       "%s: Memory squeeze on cisco_keepalive_send()\n",
		       dev->name);
		return;
		return;
	}
	}
	skb_reserve(skb, 4);
	skb_reserve(skb, 4);
@@ -181,8 +179,8 @@ static int cisco_rx(struct sk_buff *skb)
		     CISCO_PACKET_LEN) &&
		     CISCO_PACKET_LEN) &&
		    (skb->len != sizeof(struct hdlc_header) +
		    (skb->len != sizeof(struct hdlc_header) +
		     CISCO_BIG_PACKET_LEN)) {
		     CISCO_BIG_PACKET_LEN)) {
			printk(KERN_INFO "%s: Invalid length of Cisco control"
			netdev_info(dev, "Invalid length of Cisco control packet (%d bytes)\n",
			       " packet (%d bytes)\n", dev->name, skb->len);
				    skb->len);
			goto rx_error;
			goto rx_error;
		}
		}


@@ -217,8 +215,7 @@ static int cisco_rx(struct sk_buff *skb)
			return NET_RX_SUCCESS;
			return NET_RX_SUCCESS;


		case CISCO_ADDR_REPLY:
		case CISCO_ADDR_REPLY:
			printk(KERN_INFO "%s: Unexpected Cisco IP address "
			netdev_info(dev, "Unexpected Cisco IP address reply\n");
			       "reply\n", dev->name);
			goto rx_error;
			goto rx_error;


		case CISCO_KEEPALIVE_REQ:
		case CISCO_KEEPALIVE_REQ:
@@ -235,9 +232,8 @@ static int cisco_rx(struct sk_buff *skb)
					min = sec / 60; sec -= min * 60;
					min = sec / 60; sec -= min * 60;
					hrs = min / 60; min -= hrs * 60;
					hrs = min / 60; min -= hrs * 60;
					days = hrs / 24; hrs -= days * 24;
					days = hrs / 24; hrs -= days * 24;
					printk(KERN_INFO "%s: Link up (peer "
					netdev_info(dev, "Link up (peer uptime %ud%uh%um%us)\n",
					       "uptime %ud%uh%um%us)\n",
						    days, hrs, min, sec);
					       dev->name, days, hrs, min, sec);
					netif_dormant_off(dev);
					netif_dormant_off(dev);
					st->up = 1;
					st->up = 1;
				}
				}
@@ -249,8 +245,7 @@ static int cisco_rx(struct sk_buff *skb)
		} /* switch (keepalive type) */
		} /* switch (keepalive type) */
	} /* switch (protocol) */
	} /* switch (protocol) */


	printk(KERN_INFO "%s: Unsupported protocol %x\n", dev->name,
	netdev_info(dev, "Unsupported protocol %x\n", ntohs(data->protocol));
	       ntohs(data->protocol));
	dev_kfree_skb_any(skb);
	dev_kfree_skb_any(skb);
	return NET_RX_DROP;
	return NET_RX_DROP;


@@ -272,7 +267,7 @@ static void cisco_timer(unsigned long arg)
	if (st->up &&
	if (st->up &&
	    time_after(jiffies, st->last_poll + st->settings.timeout * HZ)) {
	    time_after(jiffies, st->last_poll + st->settings.timeout * HZ)) {
		st->up = 0;
		st->up = 0;
		printk(KERN_INFO "%s: Link down\n", dev->name);
		netdev_info(dev, "Link down\n");
		netif_dormant_on(dev);
		netif_dormant_on(dev);
	}
	}


Loading