Commit 163ef0b5 authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

tulip: Convert printks to netdev_<level>

Use the current more descriptive logging styles.

Add pr_fmt and remove PFX where appropriate.
Use netif_<level>, netdev_<level>
Indent a few blocks in xircom_cb where appropriate.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 54668b84
This diff is collapsed.
......@@ -406,7 +406,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
SET_NETDEV_DEV(dev, &pdev->dev);
if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
pr_warning("32-bit PCI DMA not available\n");
pr_warn("32-bit PCI DMA not available\n");
err = -ENODEV;
goto err_out_free;
}
......
......@@ -222,8 +222,8 @@ void __devinit tulip_parse_eeprom(struct net_device *dev)
/* there is no phy information, don't even try to build mtable */
if (count == 0) {
if (tulip_debug > 0)
pr_warning("%s: no phy info, aborting mtable build\n",
dev->name);
pr_warn("%s: no phy info, aborting mtable build\n",
dev->name);
return;
}
......
......@@ -12,6 +12,7 @@
Please submit bugs to http://bugzilla.kernel.org/ .
*/
#define pr_fmt(fmt) "tulip: " fmt
#define DRV_NAME "tulip"
#ifdef CONFIG_TULIP_NAPI
......@@ -119,8 +120,6 @@ module_param(csr0, int, 0);
module_param_array(options, int, NULL, 0);
module_param_array(full_duplex, int, NULL, 0);
#define PFX DRV_NAME ": "
#ifdef TULIP_DEBUG
int tulip_debug = TULIP_DEBUG;
#else
......@@ -1340,13 +1339,13 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
*/
if (pdev->subsystem_vendor == PCI_VENDOR_ID_LMC) {
pr_err(PFX "skipping LMC card\n");
pr_err("skipping LMC card\n");
return -ENODEV;
} else if (pdev->subsystem_vendor == PCI_VENDOR_ID_SBE &&
(pdev->subsystem_device == PCI_SUBDEVICE_ID_SBE_T3E3 ||
pdev->subsystem_device == PCI_SUBDEVICE_ID_SBE_2T3E3_P0 ||
pdev->subsystem_device == PCI_SUBDEVICE_ID_SBE_2T3E3_P1)) {
pr_err(PFX "skipping SBE T3E3 port\n");
pr_err("skipping SBE T3E3 port\n");
return -ENODEV;
}
......@@ -1362,13 +1361,13 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
if (pdev->vendor == 0x1282 && pdev->device == 0x9100 &&
pdev->revision < 0x30) {
pr_info(PFX "skipping early DM9100 with Crc bug (use dmfe)\n");
pr_info("skipping early DM9100 with Crc bug (use dmfe)\n");
return -ENODEV;
}
dp = pci_device_to_OF_node(pdev);
if (!(dp && of_get_property(dp, "local-mac-address", NULL))) {
pr_info(PFX "skipping DM910x expansion card (use dmfe)\n");
pr_info("skipping DM910x expansion card (use dmfe)\n");
return -ENODEV;
}
}
......@@ -1415,16 +1414,14 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
i = pci_enable_device(pdev);
if (i) {
pr_err(PFX "Cannot enable tulip board #%d, aborting\n",
board_idx);
pr_err("Cannot enable tulip board #%d, aborting\n", board_idx);
return i;
}
/* The chip will fail to enter a low-power state later unless
* first explicitly commanded into D0 */
if (pci_set_power_state(pdev, PCI_D0)) {
printk (KERN_NOTICE PFX
"Failed to set power state to D0\n");
pr_notice("Failed to set power state to D0\n");
}
irq = pdev->irq;
......@@ -1432,13 +1429,13 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
/* alloc_etherdev ensures aligned and zeroed private structures */
dev = alloc_etherdev (sizeof (*tp));
if (!dev) {
pr_err(PFX "ether device alloc failed, aborting\n");
pr_err("ether device alloc failed, aborting\n");
return -ENOMEM;
}
SET_NETDEV_DEV(dev, &pdev->dev);
if (pci_resource_len (pdev, 0) < tulip_tbl[chip_idx].io_size) {
pr_err(PFX "%s: I/O region (0x%llx@0x%llx) too small, aborting\n",
pr_err("%s: I/O region (0x%llx@0x%llx) too small, aborting\n",
pci_name(pdev),
(unsigned long long)pci_resource_len (pdev, 0),
(unsigned long long)pci_resource_start (pdev, 0));
......@@ -1905,12 +1902,12 @@ static int tulip_resume(struct pci_dev *pdev)
return 0;
if ((retval = pci_enable_device(pdev))) {
pr_err(PFX "pci_enable_device failed in resume\n");
pr_err("pci_enable_device failed in resume\n");
return retval;
}
if ((retval = request_irq(dev->irq, tulip_interrupt, IRQF_SHARED, dev->name, dev))) {
pr_err(PFX "request_irq failed in resume\n");
pr_err("request_irq failed in resume\n");
return retval;
}
......
......@@ -292,7 +292,7 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
SET_NETDEV_DEV(dev, &pdev->dev);
if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
pr_warning("32-bit PCI DMA not available\n");
pr_warn("32-bit PCI DMA not available\n");
err = -ENODEV;
goto err_out_free;
}
......@@ -390,9 +390,9 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
if (err)
goto err_out_res;
dev_info(&dev->dev, "ULi M%04lx at pci%s, %pM, irq %d\n",
ent->driver_data >> 16, pci_name(pdev),
dev->dev_addr, dev->irq);
netdev_info(dev, "ULi M%04lx at pci%s, %pM, irq %d\n",
ent->driver_data >> 16, pci_name(pdev),
dev->dev_addr, dev->irq);
pci_set_master(pdev);
......@@ -524,7 +524,7 @@ static void uli526x_init(struct net_device *dev)
}
}
if(phy_tmp == 32)
pr_warning("Can not find the phy address!!!");
pr_warn("Can not find the phy address!!!\n");
/* Parser SROM and media mode */
db->media_mode = uli526x_media_mode;
......@@ -590,7 +590,7 @@ static netdev_tx_t uli526x_start_xmit(struct sk_buff *skb,
/* Too large packet check */
if (skb->len > MAX_PACKET_SIZE) {
pr_err("big packet = %d\n", (u16)skb->len);
netdev_err(dev, "big packet = %d\n", (u16)skb->len);
dev_kfree_skb(skb);
return NETDEV_TX_OK;
}
......@@ -600,7 +600,7 @@ static netdev_tx_t uli526x_start_xmit(struct sk_buff *skb,
/* No Tx resource check, it never happen nromally */
if (db->tx_packet_cnt >= TX_FREE_DESC_CNT) {
spin_unlock_irqrestore(&db->lock, flags);
pr_err("No Tx resource %ld\n", db->tx_packet_cnt);
netdev_err(dev, "No Tx resource %ld\n", db->tx_packet_cnt);
return NETDEV_TX_BUSY;
}
......@@ -1024,7 +1024,6 @@ static void uli526x_timer(unsigned long data)
struct net_device *dev = (struct net_device *) data;
struct uli526x_board_info *db = netdev_priv(dev);
unsigned long flags;
u8 TmpSpeed=10;
//ULI526X_DBUG(0, "uli526x_timer()", 0);
spin_lock_irqsave(&db->lock, flags);
......@@ -1070,7 +1069,7 @@ static void uli526x_timer(unsigned long data)
/* Link Failed */
ULI526X_DBUG(0, "Link Failed", tmp_cr12);
netif_carrier_off(dev);
pr_info("%s NIC Link is Down\n",dev->name);
netdev_info(dev, "NIC Link is Down\n");
db->link_failed = 1;
/* For Force 10/100M Half/Full mode: Enable Auto-Nego mode */
......@@ -1096,18 +1095,13 @@ static void uli526x_timer(unsigned long data)
if(db->link_failed==0)
{
if(db->op_mode==ULI526X_100MHF || db->op_mode==ULI526X_100MFD)
{
TmpSpeed = 100;
}
if(db->op_mode==ULI526X_10MFD || db->op_mode==ULI526X_100MFD)
{
pr_info("%s NIC Link is Up %d Mbps Full duplex\n",dev->name,TmpSpeed);
}
else
{
pr_info("%s NIC Link is Up %d Mbps Half duplex\n",dev->name,TmpSpeed);
}
netdev_info(dev, "NIC Link is Up %d Mbps %s duplex\n",
(db->op_mode == ULI526X_100MHF ||
db->op_mode == ULI526X_100MFD)
? 100 : 10,
(db->op_mode == ULI526X_10MFD ||
db->op_mode == ULI526X_100MFD)
? "Full" : "Half");
netif_carrier_on(dev);
}
/* SHOW_MEDIA_TYPE(db->op_mode); */
......@@ -1116,7 +1110,7 @@ static void uli526x_timer(unsigned long data)
{
if(db->init==1)
{
pr_info("%s NIC Link is Down\n",dev->name);
netdev_info(dev, "NIC Link is Down\n");
netif_carrier_off(dev);
}
}
......@@ -1242,7 +1236,7 @@ static int uli526x_resume(struct pci_dev *pdev)
err = pci_set_power_state(pdev, PCI_D0);
if (err) {
dev_warn(&dev->dev, "Could not put device into D0\n");
netdev_warn(dev, "Could not put device into D0\n");
return err;
}
......@@ -1443,7 +1437,7 @@ static void send_filter_frame(struct net_device *dev, int mc_cnt)
update_cr6(db->cr6_data, dev->base_addr);
dev->trans_start = jiffies;
} else
pr_err("No Tx resource - Send_filter_frame!\n");
netdev_err(dev, "No Tx resource - Send_filter_frame!\n");
}
......
......@@ -44,6 +44,8 @@
* Wake-On-LAN
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#define DRV_NAME "winbond-840"
#define DRV_VERSION "1.01-e"
#define DRV_RELDATE "Sep-11-2006"
......@@ -375,8 +377,8 @@ static int __devinit w840_probe1 (struct pci_dev *pdev,
irq = pdev->irq;
if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
pr_warning("Winbond-840: Device %s disabled due to DMA limitations\n",
pci_name(pdev));
pr_warn("Device %s disabled due to DMA limitations\n",
pci_name(pdev));
return -EIO;
}
dev = alloc_etherdev(sizeof(*np));
......
......@@ -262,8 +262,8 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
goto reg_fail;
}
dev_info(&dev->dev, "Xircom cardbus revision %i at irq %i\n",
pdev->revision, pdev->irq);
netdev_info(dev, "Xircom cardbus revision %i at irq %i\n",
pdev->revision, pdev->irq);
/* start the transmitter to get a heartbeat */
/* TODO: send 2 dummy packets here */
transceiver_voodoo(private);
......@@ -335,7 +335,7 @@ static irqreturn_t xircom_interrupt(int irq, void *dev_instance)
int newlink;
printk(KERN_DEBUG "xircom_cb: Link status has changed\n");
newlink = link_status(card);
dev_info(&dev->dev, "Link is %i mbit\n", newlink);
netdev_info(dev, "Link is %d mbit\n", newlink);
if (newlink)
netif_carrier_on(dev);
else
......@@ -426,8 +426,8 @@ static int xircom_open(struct net_device *dev)
struct xircom_private *xp = netdev_priv(dev);
int retval;
pr_info("xircom cardbus adaptor found, registering as %s, using irq %i\n",
dev->name, dev->irq);
netdev_info(dev, "xircom cardbus adaptor found, using irq %i\n",
dev->irq);
retval = request_irq(dev->irq, xircom_interrupt, IRQF_SHARED, dev->name, dev);
if (retval)
return retval;
......@@ -703,7 +703,7 @@ static void activate_receiver(struct xircom_private *card)
udelay(50);
counter--;
if (counter <= 0)
pr_err("Receiver failed to deactivate\n");
netdev_err(card->dev, "Receiver failed to deactivate\n");
}
/* enable the receiver */
......@@ -720,7 +720,8 @@ static void activate_receiver(struct xircom_private *card)
udelay(50);
counter--;
if (counter <= 0)
pr_err("Receiver failed to re-activate\n");
netdev_err(card->dev,
"Receiver failed to re-activate\n");
}
}
......@@ -748,7 +749,7 @@ static void deactivate_receiver(struct xircom_private *card)
udelay(50);
counter--;
if (counter <= 0)
pr_err("Receiver failed to deactivate\n");
netdev_err(card->dev, "Receiver failed to deactivate\n");
}
}
......@@ -786,7 +787,8 @@ static void activate_transmitter(struct xircom_private *card)
udelay(50);
counter--;
if (counter <= 0)
pr_err("Transmitter failed to deactivate\n");
netdev_err(card->dev,
"Transmitter failed to deactivate\n");
}
/* enable the transmitter */
......@@ -803,7 +805,8 @@ static void activate_transmitter(struct xircom_private *card)
udelay(50);
counter--;
if (counter <= 0)
pr_err("Transmitter failed to re-activate\n");
netdev_err(card->dev,
"Transmitter failed to re-activate\n");
}
}
......@@ -831,7 +834,8 @@ static void deactivate_transmitter(struct xircom_private *card)
udelay(50);
counter--;
if (counter <= 0)
pr_err("Transmitter failed to deactivate\n");
netdev_err(card->dev,
"Transmitter failed to deactivate\n");
}
}
......@@ -1060,75 +1064,81 @@ static void xircom_up(struct xircom_private *card)
}
/* Bufferoffset is in BYTES */
static void investigate_read_descriptor(struct net_device *dev,struct xircom_private *card, int descnr, unsigned int bufferoffset)
static void
investigate_read_descriptor(struct net_device *dev, struct xircom_private *card,
int descnr, unsigned int bufferoffset)
{
int status;
int status;
status = le32_to_cpu(card->rx_buffer[4*descnr]);
status = le32_to_cpu(card->rx_buffer[4*descnr]);
if ((status > 0)) { /* packet received */
if (status > 0) { /* packet received */
/* TODO: discard error packets */
/* TODO: discard error packets */
short pkt_len = ((status >> 16) & 0x7ff) - 4; /* minus 4, we don't want the CRC */
struct sk_buff *skb;
short pkt_len = ((status >> 16) & 0x7ff) - 4;
/* minus 4, we don't want the CRC */
struct sk_buff *skb;
if (pkt_len > 1518) {
pr_err("Packet length %i is bogus\n", pkt_len);
pkt_len = 1518;
}
if (pkt_len > 1518) {
netdev_err(dev, "Packet length %i is bogus\n", pkt_len);
pkt_len = 1518;
}
skb = dev_alloc_skb(pkt_len + 2);
if (skb == NULL) {
dev->stats.rx_dropped++;
goto out;
}
skb_reserve(skb, 2);
skb_copy_to_linear_data(skb, (unsigned char*)&card->rx_buffer[bufferoffset / 4], pkt_len);
skb_put(skb, pkt_len);
skb->protocol = eth_type_trans(skb, dev);
netif_rx(skb);
dev->stats.rx_packets++;
dev->stats.rx_bytes += pkt_len;
out:
/* give the buffer back to the card */
card->rx_buffer[4*descnr] = cpu_to_le32(0x80000000);
trigger_receive(card);
skb = dev_alloc_skb(pkt_len + 2);
if (skb == NULL) {
dev->stats.rx_dropped++;
goto out;
}
skb_reserve(skb, 2);
skb_copy_to_linear_data(skb,
&card->rx_buffer[bufferoffset / 4],
pkt_len);
skb_put(skb, pkt_len);
skb->protocol = eth_type_trans(skb, dev);
netif_rx(skb);
dev->stats.rx_packets++;
dev->stats.rx_bytes += pkt_len;
out:
/* give the buffer back to the card */
card->rx_buffer[4*descnr] = cpu_to_le32(0x80000000);
trigger_receive(card);
}
}
/* Bufferoffset is in BYTES */
static void investigate_write_descriptor(struct net_device *dev, struct xircom_private *card, int descnr, unsigned int bufferoffset)
static void
investigate_write_descriptor(struct net_device *dev,
struct xircom_private *card,
int descnr, unsigned int bufferoffset)
{
int status;
int status;
status = le32_to_cpu(card->tx_buffer[4*descnr]);
status = le32_to_cpu(card->tx_buffer[4*descnr]);
#if 0
if (status & 0x8000) { /* Major error */
pr_err("Major transmit error status %x\n", status);
card->tx_buffer[4*descnr] = 0;
netif_wake_queue (dev);
}
if (status & 0x8000) { /* Major error */
pr_err("Major transmit error status %x\n", status);
card->tx_buffer[4*descnr] = 0;
netif_wake_queue (dev);
}
#endif
if (status > 0) { /* bit 31 is 0 when done */
if (card->tx_skb[descnr]!=NULL) {
dev->stats.tx_bytes += card->tx_skb[descnr]->len;
dev_kfree_skb_irq(card->tx_skb[descnr]);
}
card->tx_skb[descnr] = NULL;
/* Bit 8 in the status field is 1 if there was a collision */
if (status&(1<<8))
dev->stats.collisions++;
card->tx_buffer[4*descnr] = 0; /* descriptor is free again */
netif_wake_queue (dev);
dev->stats.tx_packets++;
if (status > 0) { /* bit 31 is 0 when done */
if (card->tx_skb[descnr]!=NULL) {
dev->stats.tx_bytes += card->tx_skb[descnr]->len;
dev_kfree_skb_irq(card->tx_skb[descnr]);
}
card->tx_skb[descnr] = NULL;
/* Bit 8 in the status field is 1 if there was a collision */
if (status & (1 << 8))
dev->stats.collisions++;
card->tx_buffer[4*descnr] = 0; /* descriptor is free again */
netif_wake_queue (dev);
dev->stats.tx_packets++;
}
}
static int __init xircom_init(void)
{
return pci_register_driver(&xircom_ops);
......
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