Commit a99db196 authored by Richard Röjfors's avatar Richard Röjfors Committed by David S. Miller

ks8842: Replace usage of dev_dbg with netdev_dbg

This patch replaces all usage of dev_dbg with netdev_dbg.

A side effect is that the pointer to the platform device in the adapter
struct can be removed.
Signed-off-by: default avatarRichard Röjfors <richard.rojfors@pelagicore.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c31fd6c2
...@@ -119,7 +119,6 @@ struct ks8842_adapter { ...@@ -119,7 +119,6 @@ struct ks8842_adapter {
int irq; int irq;
struct tasklet_struct tasklet; struct tasklet_struct tasklet;
spinlock_t lock; /* spinlock to be interrupt safe */ spinlock_t lock; /* spinlock to be interrupt safe */
struct platform_device *pdev;
}; };
static inline void ks8842_select_bank(struct ks8842_adapter *adapter, u16 bank) static inline void ks8842_select_bank(struct ks8842_adapter *adapter, u16 bank)
...@@ -331,8 +330,7 @@ static int ks8842_tx_frame(struct sk_buff *skb, struct net_device *netdev) ...@@ -331,8 +330,7 @@ static int ks8842_tx_frame(struct sk_buff *skb, struct net_device *netdev)
u32 *ptr = (u32 *)skb->data; u32 *ptr = (u32 *)skb->data;
u32 ctrl; u32 ctrl;
dev_dbg(&adapter->pdev->dev, netdev_dbg(netdev, "%s: len %u head %p data %p tail %p end %p\n",
"%s: len %u head %p data %p tail %p end %p\n",
__func__, skb->len, skb->head, skb->data, __func__, skb->len, skb->head, skb->data,
skb_tail_pointer(skb), skb_end_pointer(skb)); skb_tail_pointer(skb), skb_end_pointer(skb));
...@@ -369,15 +367,13 @@ static void ks8842_rx_frame(struct net_device *netdev, ...@@ -369,15 +367,13 @@ static void ks8842_rx_frame(struct net_device *netdev,
status &= 0xffff; status &= 0xffff;
dev_dbg(&adapter->pdev->dev, "%s - rx_data: status: %x\n", netdev_dbg(netdev, "%s - rx_data: status: %x\n", __func__, status);
__func__, status);
/* check the status */ /* check the status */
if ((status & RXSR_VALID) && !(status & RXSR_ERROR)) { if ((status & RXSR_VALID) && !(status & RXSR_ERROR)) {
struct sk_buff *skb = netdev_alloc_skb_ip_align(netdev, len); struct sk_buff *skb = netdev_alloc_skb_ip_align(netdev, len);
dev_dbg(&adapter->pdev->dev, "%s, got package, len: %d\n", netdev_dbg(netdev, "%s, got package, len: %d\n", __func__, len);
__func__, len);
if (skb) { if (skb) {
u32 *data; u32 *data;
...@@ -400,7 +396,7 @@ static void ks8842_rx_frame(struct net_device *netdev, ...@@ -400,7 +396,7 @@ static void ks8842_rx_frame(struct net_device *netdev,
} else } else
netdev->stats.rx_dropped++; netdev->stats.rx_dropped++;
} else { } else {
dev_dbg(&adapter->pdev->dev, "RX error, status: %x\n", status); netdev_dbg(netdev, "RX error, status: %x\n", status);
netdev->stats.rx_errors++; netdev->stats.rx_errors++;
if (status & RXSR_TOO_LONG) if (status & RXSR_TOO_LONG)
netdev->stats.rx_length_errors++; netdev->stats.rx_length_errors++;
...@@ -423,8 +419,7 @@ static void ks8842_rx_frame(struct net_device *netdev, ...@@ -423,8 +419,7 @@ static void ks8842_rx_frame(struct net_device *netdev,
void ks8842_handle_rx(struct net_device *netdev, struct ks8842_adapter *adapter) void ks8842_handle_rx(struct net_device *netdev, struct ks8842_adapter *adapter)
{ {
u16 rx_data = ks8842_read16(adapter, 16, REG_RXMIR) & 0x1fff; u16 rx_data = ks8842_read16(adapter, 16, REG_RXMIR) & 0x1fff;
dev_dbg(&adapter->pdev->dev, "%s Entry - rx_data: %d\n", netdev_dbg(netdev, "%s Entry - rx_data: %d\n", __func__, rx_data);
__func__, rx_data);
while (rx_data) { while (rx_data) {
ks8842_rx_frame(netdev, adapter); ks8842_rx_frame(netdev, adapter);
rx_data = ks8842_read16(adapter, 16, REG_RXMIR) & 0x1fff; rx_data = ks8842_read16(adapter, 16, REG_RXMIR) & 0x1fff;
...@@ -434,7 +429,7 @@ void ks8842_handle_rx(struct net_device *netdev, struct ks8842_adapter *adapter) ...@@ -434,7 +429,7 @@ void ks8842_handle_rx(struct net_device *netdev, struct ks8842_adapter *adapter)
void ks8842_handle_tx(struct net_device *netdev, struct ks8842_adapter *adapter) void ks8842_handle_tx(struct net_device *netdev, struct ks8842_adapter *adapter)
{ {
u16 sr = ks8842_read16(adapter, 16, REG_TXSR); u16 sr = ks8842_read16(adapter, 16, REG_TXSR);
dev_dbg(&adapter->pdev->dev, "%s - entry, sr: %x\n", __func__, sr); netdev_dbg(netdev, "%s - entry, sr: %x\n", __func__, sr);
netdev->stats.tx_packets++; netdev->stats.tx_packets++;
if (netif_queue_stopped(netdev)) if (netif_queue_stopped(netdev))
netif_wake_queue(netdev); netif_wake_queue(netdev);
...@@ -443,7 +438,7 @@ void ks8842_handle_tx(struct net_device *netdev, struct ks8842_adapter *adapter) ...@@ -443,7 +438,7 @@ void ks8842_handle_tx(struct net_device *netdev, struct ks8842_adapter *adapter)
void ks8842_handle_rx_overrun(struct net_device *netdev, void ks8842_handle_rx_overrun(struct net_device *netdev,
struct ks8842_adapter *adapter) struct ks8842_adapter *adapter)
{ {
dev_dbg(&adapter->pdev->dev, "%s: entry\n", __func__); netdev_dbg(netdev, "%s: entry\n", __func__);
netdev->stats.rx_errors++; netdev->stats.rx_errors++;
netdev->stats.rx_fifo_errors++; netdev->stats.rx_fifo_errors++;
} }
...@@ -462,7 +457,7 @@ void ks8842_tasklet(unsigned long arg) ...@@ -462,7 +457,7 @@ void ks8842_tasklet(unsigned long arg)
spin_unlock_irqrestore(&adapter->lock, flags); spin_unlock_irqrestore(&adapter->lock, flags);
isr = ks8842_read16(adapter, 18, REG_ISR); isr = ks8842_read16(adapter, 18, REG_ISR);
dev_dbg(&adapter->pdev->dev, "%s - ISR: 0x%x\n", __func__, isr); netdev_dbg(netdev, "%s - ISR: 0x%x\n", __func__, isr);
/* Ack */ /* Ack */
ks8842_write16(adapter, 18, isr, REG_ISR); ks8842_write16(adapter, 18, isr, REG_ISR);
...@@ -501,13 +496,14 @@ void ks8842_tasklet(unsigned long arg) ...@@ -501,13 +496,14 @@ void ks8842_tasklet(unsigned long arg)
static irqreturn_t ks8842_irq(int irq, void *devid) static irqreturn_t ks8842_irq(int irq, void *devid)
{ {
struct ks8842_adapter *adapter = devid; struct net_device *netdev = devid;
struct ks8842_adapter *adapter = netdev_priv(netdev);
u16 isr; u16 isr;
u16 entry_bank = ioread16(adapter->hw_addr + REG_SELECT_BANK); u16 entry_bank = ioread16(adapter->hw_addr + REG_SELECT_BANK);
irqreturn_t ret = IRQ_NONE; irqreturn_t ret = IRQ_NONE;
isr = ks8842_read16(adapter, 18, REG_ISR); isr = ks8842_read16(adapter, 18, REG_ISR);
dev_dbg(&adapter->pdev->dev, "%s - ISR: 0x%x\n", __func__, isr); netdev_dbg(netdev, "%s - ISR: 0x%x\n", __func__, isr);
if (isr) { if (isr) {
/* disable IRQ */ /* disable IRQ */
...@@ -532,7 +528,7 @@ static int ks8842_open(struct net_device *netdev) ...@@ -532,7 +528,7 @@ static int ks8842_open(struct net_device *netdev)
struct ks8842_adapter *adapter = netdev_priv(netdev); struct ks8842_adapter *adapter = netdev_priv(netdev);
int err; int err;
dev_dbg(&adapter->pdev->dev, "%s - entry\n", __func__); netdev_dbg(netdev, "%s - entry\n", __func__);
/* reset the HW */ /* reset the HW */
ks8842_reset_hw(adapter); ks8842_reset_hw(adapter);
...@@ -542,7 +538,7 @@ static int ks8842_open(struct net_device *netdev) ...@@ -542,7 +538,7 @@ static int ks8842_open(struct net_device *netdev)
ks8842_update_link_status(netdev, adapter); ks8842_update_link_status(netdev, adapter);
err = request_irq(adapter->irq, ks8842_irq, IRQF_SHARED, DRV_NAME, err = request_irq(adapter->irq, ks8842_irq, IRQF_SHARED, DRV_NAME,
adapter); netdev);
if (err) { if (err) {
pr_err("Failed to request IRQ: %d: %d\n", adapter->irq, err); pr_err("Failed to request IRQ: %d: %d\n", adapter->irq, err);
return err; return err;
...@@ -555,10 +551,10 @@ static int ks8842_close(struct net_device *netdev) ...@@ -555,10 +551,10 @@ static int ks8842_close(struct net_device *netdev)
{ {
struct ks8842_adapter *adapter = netdev_priv(netdev); struct ks8842_adapter *adapter = netdev_priv(netdev);
dev_dbg(&adapter->pdev->dev, "%s - entry\n", __func__); netdev_dbg(netdev, "%s - entry\n", __func__);
/* free the irq */ /* free the irq */
free_irq(adapter->irq, adapter); free_irq(adapter->irq, netdev);
/* disable the switch */ /* disable the switch */
ks8842_write16(adapter, 32, 0x0, REG_SW_ID_AND_ENABLE); ks8842_write16(adapter, 32, 0x0, REG_SW_ID_AND_ENABLE);
...@@ -572,7 +568,7 @@ static netdev_tx_t ks8842_xmit_frame(struct sk_buff *skb, ...@@ -572,7 +568,7 @@ static netdev_tx_t ks8842_xmit_frame(struct sk_buff *skb,
int ret; int ret;
struct ks8842_adapter *adapter = netdev_priv(netdev); struct ks8842_adapter *adapter = netdev_priv(netdev);
dev_dbg(&adapter->pdev->dev, "%s: entry\n", __func__); netdev_dbg(netdev, "%s: entry\n", __func__);
ret = ks8842_tx_frame(skb, netdev); ret = ks8842_tx_frame(skb, netdev);
...@@ -588,7 +584,7 @@ static int ks8842_set_mac(struct net_device *netdev, void *p) ...@@ -588,7 +584,7 @@ static int ks8842_set_mac(struct net_device *netdev, void *p)
struct sockaddr *addr = p; struct sockaddr *addr = p;
char *mac = (u8 *)addr->sa_data; char *mac = (u8 *)addr->sa_data;
dev_dbg(&adapter->pdev->dev, "%s: entry\n", __func__); netdev_dbg(netdev, "%s: entry\n", __func__);
if (!is_valid_ether_addr(addr->sa_data)) if (!is_valid_ether_addr(addr->sa_data))
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
...@@ -604,7 +600,7 @@ static void ks8842_tx_timeout(struct net_device *netdev) ...@@ -604,7 +600,7 @@ static void ks8842_tx_timeout(struct net_device *netdev)
struct ks8842_adapter *adapter = netdev_priv(netdev); struct ks8842_adapter *adapter = netdev_priv(netdev);
unsigned long flags; unsigned long flags;
dev_dbg(&adapter->pdev->dev, "%s: entry\n", __func__); netdev_dbg(netdev, "%s: entry\n", __func__);
spin_lock_irqsave(&adapter->lock, flags); spin_lock_irqsave(&adapter->lock, flags);
/* disable interrupts */ /* disable interrupts */
...@@ -663,8 +659,6 @@ static int __devinit ks8842_probe(struct platform_device *pdev) ...@@ -663,8 +659,6 @@ static int __devinit ks8842_probe(struct platform_device *pdev)
goto err_get_irq; goto err_get_irq;
} }
adapter->pdev = pdev;
tasklet_init(&adapter->tasklet, ks8842_tasklet, (unsigned long)netdev); tasklet_init(&adapter->tasklet, ks8842_tasklet, (unsigned long)netdev);
spin_lock_init(&adapter->lock); spin_lock_init(&adapter->lock);
......
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