* [PATCH 00/10] can: at91: bugfixes and improvements
@ 2010-10-21 11:01 Marc Kleine-Budde
[not found] ` <1287658882-26914-1-git-send-email-mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
` (7 more replies)
0 siblings, 8 replies; 12+ messages in thread
From: Marc Kleine-Budde @ 2010-10-21 11:01 UTC (permalink / raw)
To: socketcan-core-0fE9KPoRgkgATYTw5x5z8w; +Cc: netdev-u79uwXL29TY76Z2rM5mHXA
Hello,
this series of patches fixes three bugs (CAN_CTRLMODE_3_SAMPLES,
extended frames, use-after-free), a compiler warning (uninit'ed variable) and
a section mismatch. Further it add the implementation of the
do_get_berr_counter callback, the bittiming setting is now done in chip_start.
As requested by Russell King the driver uses __raw_readl instead of readl.
The last two patches do some cleanups, they convert dev_<level> printing
to netdev_<level> and add the KBUILD_MODNAME to the bit timing constant
to identify the driver.
Please review and consider to apply,
Marc
---
The following changes since commit 27b75c95f10d249574d9c4cb9dab878107faede8:
Eric Dumazet (1):
net: avoid RCU for NOCACHE dst
are available in the git repository at:
git://git.pengutronix.de/git/mkl/linux-2.6.git can/at91_can-for-net-next
Marc Kleine-Budde (10):
can: at91_can: use correct bit to enable CAN_CTRLMODE_3_SAMPLES
can: at91_can: fix reception of extended frames
can: at91_can: fix use after free of priv
can: at91_can: fix compiler warning in at91_irq_err_state
can: at91_can: fix section mismatch warning
can: at91_can: implement and use at91_get_berr_counter
can: at91_can: set bittiming in chip_start
can: at91_can: convert readl, writel their __raw pendants
can: at91_can: convert dev_<level> printing to netdev_<level>
can: at91_can: add KBUILD_MODNAME to bittiming constant
drivers/net/can/at91_can.c | 95 ++++++++++++++++++++++++++------------------
1 files changed, 56 insertions(+), 39 deletions(-)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 01/10] can: at91_can: use correct bit to enable CAN_CTRLMODE_3_SAMPLES
[not found] ` <1287658882-26914-1-git-send-email-mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2010-10-21 11:01 ` Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 02/10] can: at91_can: fix reception of extended frames Marc Kleine-Budde
` (2 subsequent siblings)
3 siblings, 0 replies; 12+ messages in thread
From: Marc Kleine-Budde @ 2010-10-21 11:01 UTC (permalink / raw)
To: socketcan-core-0fE9KPoRgkgATYTw5x5z8w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Marc Kleine-Budde
Signed-off-by: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
drivers/net/can/at91_can.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index 2d8bd86..b2a4599 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -2,7 +2,7 @@
* at91_can.c - CAN network driver for AT91 SoC CAN controller
*
* (C) 2007 by Hans J. Koch <hjk-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
- * (C) 2008, 2009 by Marc Kleine-Budde <kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
+ * (C) 2008, 2009, 2010 by Marc Kleine-Budde <kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
*
* This software may be distributed under the terms of the GNU General
* Public License ("GPL") version 2 as distributed in the 'COPYING'
@@ -257,8 +257,8 @@ static int at91_set_bittiming(struct net_device *dev)
const struct can_bittiming *bt = &priv->can.bittiming;
u32 reg_br;
- reg_br = ((priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES) << 24) |
- ((bt->brp - 1) << 16) | ((bt->sjw - 1) << 12) |
+ reg_br = ((priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES) ? 1 << 24 : 0) |
+ ((bt->brp - 1) << 16) | ((bt->sjw - 1) << 12) |
((bt->prop_seg - 1) << 8) | ((bt->phase_seg1 - 1) << 4) |
((bt->phase_seg2 - 1) << 0);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 02/10] can: at91_can: fix reception of extended frames
[not found] ` <1287658882-26914-1-git-send-email-mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2010-10-21 11:01 ` [PATCH 01/10] can: at91_can: use correct bit to enable CAN_CTRLMODE_3_SAMPLES Marc Kleine-Budde
@ 2010-10-21 11:01 ` Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 03/10] can: at91_can: fix use after free of priv Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 04/10] can: at91_can: fix compiler warning in at91_irq_err_state Marc Kleine-Budde
3 siblings, 0 replies; 12+ messages in thread
From: Marc Kleine-Budde @ 2010-10-21 11:01 UTC (permalink / raw)
To: socketcan-core-0fE9KPoRgkgATYTw5x5z8w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Marc Kleine-Budde
The AT91_MID_MIDE bit must be set in order to receive extended frames.
The reception of an extended frame sets this bit, while reception of
standard frames resets it. This results in some lost extended frames in
an extended ID only environment. But leads to unpredictable lost
extended ID frames in a mixed environment.
The problem is fixed by setting the AT91_MID_MIDE after reception of a
CAN frame.
Signed-off-by: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
drivers/net/can/at91_can.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index b2a4599..3b66c67 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -243,6 +243,12 @@ static void at91_setup_mailboxes(struct net_device *dev)
set_mb_mode(priv, i, AT91_MB_MODE_RX);
set_mb_mode(priv, AT91_MB_RX_LAST, AT91_MB_MODE_RX_OVRWR);
+ /* reset acceptance mask and id register */
+ for (i = AT91_MB_RX_FIRST; i <= AT91_MB_RX_LAST; i++) {
+ at91_write(priv, AT91_MAM(i), 0x0 );
+ at91_write(priv, AT91_MID(i), AT91_MID_MIDE);
+ }
+
/* The last 4 mailboxes are used for transmitting. */
for (i = AT91_MB_TX_FIRST; i <= AT91_MB_TX_LAST; i++)
set_mb_mode_prio(priv, i, AT91_MB_MODE_TX, 0);
@@ -480,6 +486,9 @@ static void at91_read_mb(struct net_device *dev, unsigned int mb,
*(u32 *)(cf->data + 0) = at91_read(priv, AT91_MDL(mb));
*(u32 *)(cf->data + 4) = at91_read(priv, AT91_MDH(mb));
+ /* allow RX of extended frames */
+ at91_write(priv, AT91_MID(mb), AT91_MID_MIDE);
+
if (unlikely(mb == AT91_MB_RX_LAST && reg_msr & AT91_MSR_MMI))
at91_rx_overflow_err(dev);
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 03/10] can: at91_can: fix use after free of priv
[not found] ` <1287658882-26914-1-git-send-email-mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2010-10-21 11:01 ` [PATCH 01/10] can: at91_can: use correct bit to enable CAN_CTRLMODE_3_SAMPLES Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 02/10] can: at91_can: fix reception of extended frames Marc Kleine-Budde
@ 2010-10-21 11:01 ` Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 04/10] can: at91_can: fix compiler warning in at91_irq_err_state Marc Kleine-Budde
3 siblings, 0 replies; 12+ messages in thread
From: Marc Kleine-Budde @ 2010-10-21 11:01 UTC (permalink / raw)
To: socketcan-core-0fE9KPoRgkgATYTw5x5z8w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Marc Kleine-Budde
The priv is part of the memory allocated by alloc_candev().
This patch moved the free it after last usage of priv.
While there convert all free_netdev() to free_candev() (which is currently
just a wrapper around free_netdev()) to be symetrically with the allocation
via alloc_candev().
Signed-off-by: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
drivers/net/can/at91_can.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index 3b66c67..2c17e74 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -1101,7 +1101,7 @@ static int __init at91_can_probe(struct platform_device *pdev)
return 0;
exit_free:
- free_netdev(dev);
+ free_candev(dev);
exit_iounmap:
iounmap(addr);
exit_release:
@@ -1122,8 +1122,6 @@ static int __devexit at91_can_remove(struct platform_device *pdev)
platform_set_drvdata(pdev, NULL);
- free_netdev(dev);
-
iounmap(priv->reg_base);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -1131,6 +1129,8 @@ static int __devexit at91_can_remove(struct platform_device *pdev)
clk_put(priv->clk);
+ free_candev(dev);
+
return 0;
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 04/10] can: at91_can: fix compiler warning in at91_irq_err_state
[not found] ` <1287658882-26914-1-git-send-email-mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
` (2 preceding siblings ...)
2010-10-21 11:01 ` [PATCH 03/10] can: at91_can: fix use after free of priv Marc Kleine-Budde
@ 2010-10-21 11:01 ` Marc Kleine-Budde
3 siblings, 0 replies; 12+ messages in thread
From: Marc Kleine-Budde @ 2010-10-21 11:01 UTC (permalink / raw)
To: socketcan-core-0fE9KPoRgkgATYTw5x5z8w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Marc Kleine-Budde
This patch fixes the following compiler warning:
drivers/net/can/at91_can.c: In function 'at91_irq_err_state':
drivers/net/can/at91_can.c:779: warning: 'reg_ier' may be used uninitialized in this function
drivers/net/can/at91_can.c:779: warning: 'reg_idr' may be used uninitialized in this function
Signed-off-by: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
drivers/net/can/at91_can.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index 2c17e74..1954ab0 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -764,7 +764,7 @@ static void at91_irq_err_state(struct net_device *dev,
struct can_frame *cf, enum can_state new_state)
{
struct at91_priv *priv = netdev_priv(dev);
- u32 reg_idr, reg_ier, reg_ecr;
+ u32 reg_idr = 0, reg_ier = 0, reg_ecr;
u8 tec, rec;
reg_ecr = at91_read(priv, AT91_ECR);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 05/10] can: at91_can: fix section mismatch warning
2010-10-21 11:01 [PATCH 00/10] can: at91: bugfixes and improvements Marc Kleine-Budde
[not found] ` <1287658882-26914-1-git-send-email-mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2010-10-21 11:01 ` Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 06/10] can: at91_can: implement and use at91_get_berr_counter Marc Kleine-Budde
` (5 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Marc Kleine-Budde @ 2010-10-21 11:01 UTC (permalink / raw)
To: socketcan-core; +Cc: netdev, Marc Kleine-Budde
...by adding the correct annotation "__devinit" to the driver's probe
function.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/net/can/at91_can.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index 1954ab0..6187813 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -1027,7 +1027,7 @@ static const struct net_device_ops at91_netdev_ops = {
.ndo_start_xmit = at91_start_xmit,
};
-static int __init at91_can_probe(struct platform_device *pdev)
+static int __devinit at91_can_probe(struct platform_device *pdev)
{
struct net_device *dev;
struct at91_priv *priv;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 06/10] can: at91_can: implement and use at91_get_berr_counter
2010-10-21 11:01 [PATCH 00/10] can: at91: bugfixes and improvements Marc Kleine-Budde
[not found] ` <1287658882-26914-1-git-send-email-mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2010-10-21 11:01 ` [PATCH 05/10] can: at91_can: fix section mismatch warning Marc Kleine-Budde
@ 2010-10-21 11:01 ` Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 07/10] can: at91_can: set bittiming in chip_start Marc Kleine-Budde
` (4 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Marc Kleine-Budde @ 2010-10-21 11:01 UTC (permalink / raw)
To: socketcan-core; +Cc: netdev, Marc Kleine-Budde
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/at91_can.c | 25 ++++++++++++++++++-------
1 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index 6187813..4fa0aa0 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -275,6 +275,18 @@ static int at91_set_bittiming(struct net_device *dev)
return 0;
}
+static int at91_get_berr_counter(const struct net_device *dev,
+ struct can_berr_counter *bec)
+{
+ const struct at91_priv *priv = netdev_priv(dev);
+ u32 reg_ecr = at91_read(priv, AT91_ECR);
+
+ bec->rxerr = reg_ecr & 0xff;
+ bec->txerr = reg_ecr >> 16;
+
+ return 0;
+}
+
static void at91_chip_start(struct net_device *dev)
{
struct at91_priv *priv = netdev_priv(dev);
@@ -764,12 +776,10 @@ static void at91_irq_err_state(struct net_device *dev,
struct can_frame *cf, enum can_state new_state)
{
struct at91_priv *priv = netdev_priv(dev);
- u32 reg_idr = 0, reg_ier = 0, reg_ecr;
- u8 tec, rec;
+ u32 reg_idr = 0, reg_ier = 0;
+ struct can_berr_counter bec;
- reg_ecr = at91_read(priv, AT91_ECR);
- rec = reg_ecr & 0xff;
- tec = reg_ecr >> 16;
+ at91_get_berr_counter(dev, &bec);
switch (priv->can.state) {
case CAN_STATE_ERROR_ACTIVE:
@@ -784,7 +794,7 @@ static void at91_irq_err_state(struct net_device *dev,
priv->can.can_stats.error_warning++;
cf->can_id |= CAN_ERR_CRTL;
- cf->data[1] = (tec > rec) ?
+ cf->data[1] = (bec.txerr > bec.rxerr) ?
CAN_ERR_CRTL_TX_WARNING :
CAN_ERR_CRTL_RX_WARNING;
}
@@ -800,7 +810,7 @@ static void at91_irq_err_state(struct net_device *dev,
priv->can.can_stats.error_passive++;
cf->can_id |= CAN_ERR_CRTL;
- cf->data[1] = (tec > rec) ?
+ cf->data[1] = (bec.txerr > bec.rxerr) ?
CAN_ERR_CRTL_TX_PASSIVE :
CAN_ERR_CRTL_RX_PASSIVE;
}
@@ -1078,6 +1088,7 @@ static int __devinit at91_can_probe(struct platform_device *pdev)
priv->can.bittiming_const = &at91_bittiming_const;
priv->can.do_set_bittiming = at91_set_bittiming;
priv->can.do_set_mode = at91_set_mode;
+ priv->can.do_get_berr_counter = at91_get_berr_counter;
priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES;
priv->reg_base = addr;
priv->dev = dev;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 07/10] can: at91_can: set bittiming in chip_start
2010-10-21 11:01 [PATCH 00/10] can: at91: bugfixes and improvements Marc Kleine-Budde
` (2 preceding siblings ...)
2010-10-21 11:01 ` [PATCH 06/10] can: at91_can: implement and use at91_get_berr_counter Marc Kleine-Budde
@ 2010-10-21 11:01 ` Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 08/10] can: at91_can: convert readl, writel their __raw pendants Marc Kleine-Budde
` (3 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Marc Kleine-Budde @ 2010-10-21 11:01 UTC (permalink / raw)
To: socketcan-core; +Cc: netdev, Marc Kleine-Budde
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/at91_can.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index 4fa0aa0..ace9c08 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -299,6 +299,7 @@ static void at91_chip_start(struct net_device *dev)
reg_mr = at91_read(priv, AT91_MR);
at91_write(priv, AT91_MR, reg_mr & ~AT91_MR_CANEN);
+ at91_set_bittiming(dev);
at91_setup_mailboxes(dev);
at91_transceiver_switch(priv, 1);
@@ -1086,7 +1087,6 @@ static int __devinit at91_can_probe(struct platform_device *pdev)
priv = netdev_priv(dev);
priv->can.clock.freq = clk_get_rate(clk);
priv->can.bittiming_const = &at91_bittiming_const;
- priv->can.do_set_bittiming = at91_set_bittiming;
priv->can.do_set_mode = at91_set_mode;
priv->can.do_get_berr_counter = at91_get_berr_counter;
priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 08/10] can: at91_can: convert readl, writel their __raw pendants
2010-10-21 11:01 [PATCH 00/10] can: at91: bugfixes and improvements Marc Kleine-Budde
` (3 preceding siblings ...)
2010-10-21 11:01 ` [PATCH 07/10] can: at91_can: set bittiming in chip_start Marc Kleine-Budde
@ 2010-10-21 11:01 ` Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 09/10] can: at91_can: convert dev_<level> printing to netdev_<level> Marc Kleine-Budde
` (2 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Marc Kleine-Budde @ 2010-10-21 11:01 UTC (permalink / raw)
To: socketcan-core; +Cc: netdev, Marc Kleine-Budde, Russell King
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Russell King <rmk@arm.linux.org.uk>
---
drivers/net/can/at91_can.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index ace9c08..12bd615 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -199,13 +199,13 @@ static inline int get_tx_echo_mb(const struct at91_priv *priv)
static inline u32 at91_read(const struct at91_priv *priv, enum at91_reg reg)
{
- return readl(priv->reg_base + reg);
+ return __raw_readl(priv->reg_base + reg);
}
static inline void at91_write(const struct at91_priv *priv, enum at91_reg reg,
u32 value)
{
- writel(value, priv->reg_base + reg);
+ __raw_writel(value, priv->reg_base + reg);
}
static inline void set_mb_mode_prio(const struct at91_priv *priv,
--
1.7.0.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 09/10] can: at91_can: convert dev_<level> printing to netdev_<level>
2010-10-21 11:01 [PATCH 00/10] can: at91: bugfixes and improvements Marc Kleine-Budde
` (4 preceding siblings ...)
2010-10-21 11:01 ` [PATCH 08/10] can: at91_can: convert readl, writel their __raw pendants Marc Kleine-Budde
@ 2010-10-21 11:01 ` Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 10/10] can: at91_can: add KBUILD_MODNAME to bittiming constant Marc Kleine-Budde
2010-10-24 21:48 ` [PATCH 00/10] can: at91: bugfixes and improvements David Miller
7 siblings, 0 replies; 12+ messages in thread
From: Marc Kleine-Budde @ 2010-10-21 11:01 UTC (permalink / raw)
To: socketcan-core; +Cc: netdev, Marc Kleine-Budde
While there, remove "printk()" on driver loading.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/at91_can.c | 35 ++++++++++++++++-------------------
1 files changed, 16 insertions(+), 19 deletions(-)
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index 12bd615..7149a86 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -268,7 +268,7 @@ static int at91_set_bittiming(struct net_device *dev)
((bt->prop_seg - 1) << 8) | ((bt->phase_seg1 - 1) << 4) |
((bt->phase_seg2 - 1) << 0);
- dev_info(dev->dev.parent, "writing AT91_BR: 0x%08x\n", reg_br);
+ netdev_info(dev, "writing AT91_BR: 0x%08x\n", reg_br);
at91_write(priv, AT91_BR, reg_br);
@@ -369,8 +369,7 @@ static netdev_tx_t at91_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (unlikely(!(at91_read(priv, AT91_MSR(mb)) & AT91_MSR_MRDY))) {
netif_stop_queue(dev);
- dev_err(dev->dev.parent,
- "BUG! TX buffer full when queue awake!\n");
+ netdev_err(dev, "BUG! TX buffer full when queue awake!\n");
return NETDEV_TX_BUSY;
}
@@ -454,7 +453,7 @@ static void at91_rx_overflow_err(struct net_device *dev)
struct sk_buff *skb;
struct can_frame *cf;
- dev_dbg(dev->dev.parent, "RX buffer overflow\n");
+ netdev_dbg(dev, "RX buffer overflow\n");
stats->rx_over_errors++;
stats->rx_errors++;
@@ -587,8 +586,8 @@ static int at91_poll_rx(struct net_device *dev, int quota)
if (priv->rx_next > AT91_MB_RX_LOW_LAST &&
reg_sr & AT91_MB_RX_LOW_MASK)
- dev_info(dev->dev.parent,
- "order of incoming frames cannot be guaranteed\n");
+ netdev_info(dev,
+ "order of incoming frames cannot be guaranteed\n");
again:
for (mb = find_next_bit(addr, AT91_MB_RX_NUM, priv->rx_next);
@@ -626,7 +625,7 @@ static void at91_poll_err_frame(struct net_device *dev,
/* CRC error */
if (reg_sr & AT91_IRQ_CERR) {
- dev_dbg(dev->dev.parent, "CERR irq\n");
+ netdev_dbg(dev, "CERR irq\n");
dev->stats.rx_errors++;
priv->can.can_stats.bus_error++;
cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
@@ -634,7 +633,7 @@ static void at91_poll_err_frame(struct net_device *dev,
/* Stuffing Error */
if (reg_sr & AT91_IRQ_SERR) {
- dev_dbg(dev->dev.parent, "SERR irq\n");
+ netdev_dbg(dev, "SERR irq\n");
dev->stats.rx_errors++;
priv->can.can_stats.bus_error++;
cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
@@ -643,14 +642,14 @@ static void at91_poll_err_frame(struct net_device *dev,
/* Acknowledgement Error */
if (reg_sr & AT91_IRQ_AERR) {
- dev_dbg(dev->dev.parent, "AERR irq\n");
+ netdev_dbg(dev, "AERR irq\n");
dev->stats.tx_errors++;
cf->can_id |= CAN_ERR_ACK;
}
/* Form error */
if (reg_sr & AT91_IRQ_FERR) {
- dev_dbg(dev->dev.parent, "FERR irq\n");
+ netdev_dbg(dev, "FERR irq\n");
dev->stats.rx_errors++;
priv->can.can_stats.bus_error++;
cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
@@ -659,7 +658,7 @@ static void at91_poll_err_frame(struct net_device *dev,
/* Bit Error */
if (reg_sr & AT91_IRQ_BERR) {
- dev_dbg(dev->dev.parent, "BERR irq\n");
+ netdev_dbg(dev, "BERR irq\n");
dev->stats.tx_errors++;
priv->can.can_stats.bus_error++;
cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
@@ -791,7 +790,7 @@ static void at91_irq_err_state(struct net_device *dev,
*/
if (new_state >= CAN_STATE_ERROR_WARNING &&
new_state <= CAN_STATE_BUS_OFF) {
- dev_dbg(dev->dev.parent, "Error Warning IRQ\n");
+ netdev_dbg(dev, "Error Warning IRQ\n");
priv->can.can_stats.error_warning++;
cf->can_id |= CAN_ERR_CRTL;
@@ -807,7 +806,7 @@ static void at91_irq_err_state(struct net_device *dev,
*/
if (new_state >= CAN_STATE_ERROR_PASSIVE &&
new_state <= CAN_STATE_BUS_OFF) {
- dev_dbg(dev->dev.parent, "Error Passive IRQ\n");
+ netdev_dbg(dev, "Error Passive IRQ\n");
priv->can.can_stats.error_passive++;
cf->can_id |= CAN_ERR_CRTL;
@@ -824,7 +823,7 @@ static void at91_irq_err_state(struct net_device *dev,
if (new_state <= CAN_STATE_ERROR_PASSIVE) {
cf->can_id |= CAN_ERR_RESTARTED;
- dev_dbg(dev->dev.parent, "restarted\n");
+ netdev_dbg(dev, "restarted\n");
priv->can.can_stats.restarts++;
netif_carrier_on(dev);
@@ -845,7 +844,7 @@ static void at91_irq_err_state(struct net_device *dev,
* circumstances. so just enable AT91_IRQ_ERRP, thus
* the "fallthrough"
*/
- dev_dbg(dev->dev.parent, "Error Active\n");
+ netdev_dbg(dev, "Error Active\n");
cf->can_id |= CAN_ERR_PROT;
cf->data[2] = CAN_ERR_PROT_ACTIVE;
case CAN_STATE_ERROR_WARNING: /* fallthrough */
@@ -863,7 +862,7 @@ static void at91_irq_err_state(struct net_device *dev,
cf->can_id |= CAN_ERR_BUSOFF;
- dev_dbg(dev->dev.parent, "bus-off\n");
+ netdev_dbg(dev, "bus-off\n");
netif_carrier_off(dev);
priv->can.can_stats.bus_off++;
@@ -901,7 +900,7 @@ static void at91_irq_err(struct net_device *dev)
else if (likely(reg_sr & AT91_IRQ_ERRA))
new_state = CAN_STATE_ERROR_ACTIVE;
else {
- dev_err(dev->dev.parent, "BUG! hardware in undefined state\n");
+ netdev_err(dev, "BUG! hardware in undefined state\n");
return;
}
@@ -1156,14 +1155,12 @@ static struct platform_driver at91_can_driver = {
static int __init at91_can_module_init(void)
{
- printk(KERN_INFO "%s netdevice driver\n", DRV_NAME);
return platform_driver_register(&at91_can_driver);
}
static void __exit at91_can_module_exit(void)
{
platform_driver_unregister(&at91_can_driver);
- printk(KERN_INFO "%s: driver removed\n", DRV_NAME);
}
module_init(at91_can_module_init);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 10/10] can: at91_can: add KBUILD_MODNAME to bittiming constant
2010-10-21 11:01 [PATCH 00/10] can: at91: bugfixes and improvements Marc Kleine-Budde
` (5 preceding siblings ...)
2010-10-21 11:01 ` [PATCH 09/10] can: at91_can: convert dev_<level> printing to netdev_<level> Marc Kleine-Budde
@ 2010-10-21 11:01 ` Marc Kleine-Budde
2010-10-24 21:48 ` [PATCH 00/10] can: at91: bugfixes and improvements David Miller
7 siblings, 0 replies; 12+ messages in thread
From: Marc Kleine-Budde @ 2010-10-21 11:01 UTC (permalink / raw)
To: socketcan-core; +Cc: netdev, Marc Kleine-Budde
While there replace all usage of self defined DRV_NAME by KBUILD_MODNAME.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/at91_can.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index 7149a86..cee98fa 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -40,7 +40,6 @@
#include <mach/board.h>
-#define DRV_NAME "at91_can"
#define AT91_NAPI_WEIGHT 12
/*
@@ -172,6 +171,7 @@ struct at91_priv {
};
static struct can_bittiming_const at91_bittiming_const = {
+ .name = KBUILD_MODNAME,
.tseg1_min = 4,
.tseg1_max = 16,
.tseg2_min = 2,
@@ -1148,7 +1148,7 @@ static struct platform_driver at91_can_driver = {
.probe = at91_can_probe,
.remove = __devexit_p(at91_can_remove),
.driver = {
- .name = DRV_NAME,
+ .name = KBUILD_MODNAME,
.owner = THIS_MODULE,
},
};
@@ -1168,4 +1168,4 @@ module_exit(at91_can_module_exit);
MODULE_AUTHOR("Marc Kleine-Budde <mkl@pengutronix.de>");
MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION(DRV_NAME " CAN netdevice driver");
+MODULE_DESCRIPTION(KBUILD_MODNAME " CAN netdevice driver");
--
1.7.0.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 00/10] can: at91: bugfixes and improvements
2010-10-21 11:01 [PATCH 00/10] can: at91: bugfixes and improvements Marc Kleine-Budde
` (6 preceding siblings ...)
2010-10-21 11:01 ` [PATCH 10/10] can: at91_can: add KBUILD_MODNAME to bittiming constant Marc Kleine-Budde
@ 2010-10-24 21:48 ` David Miller
7 siblings, 0 replies; 12+ messages in thread
From: David Miller @ 2010-10-24 21:48 UTC (permalink / raw)
To: mkl; +Cc: socketcan-core, netdev
From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Thu, 21 Oct 2010 13:01:12 +0200
> this series of patches fixes three bugs (CAN_CTRLMODE_3_SAMPLES,
> extended frames, use-after-free), a compiler warning (uninit'ed variable) and
> a section mismatch. Further it add the implementation of the
> do_get_berr_counter callback, the bittiming setting is now done in chip_start.
> As requested by Russell King the driver uses __raw_readl instead of readl.
>
> The last two patches do some cleanups, they convert dev_<level> printing
> to netdev_<level> and add the KBUILD_MODNAME to the bit timing constant
> to identify the driver.
All applied, thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2010-10-24 21:48 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-21 11:01 [PATCH 00/10] can: at91: bugfixes and improvements Marc Kleine-Budde
[not found] ` <1287658882-26914-1-git-send-email-mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2010-10-21 11:01 ` [PATCH 01/10] can: at91_can: use correct bit to enable CAN_CTRLMODE_3_SAMPLES Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 02/10] can: at91_can: fix reception of extended frames Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 03/10] can: at91_can: fix use after free of priv Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 04/10] can: at91_can: fix compiler warning in at91_irq_err_state Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 05/10] can: at91_can: fix section mismatch warning Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 06/10] can: at91_can: implement and use at91_get_berr_counter Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 07/10] can: at91_can: set bittiming in chip_start Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 08/10] can: at91_can: convert readl, writel their __raw pendants Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 09/10] can: at91_can: convert dev_<level> printing to netdev_<level> Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 10/10] can: at91_can: add KBUILD_MODNAME to bittiming constant Marc Kleine-Budde
2010-10-24 21:48 ` [PATCH 00/10] can: at91: bugfixes and improvements David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).