Why the macro? You only used it once. The pr_xxx naming convention belongs to a kernel-wide include file. Is it No, this is pr_err. The driver sets dev->mem_start expecting it to work, Same here. Finn --
From: Finn Thain <fthain@telegraphics.com.au> This is exactly how it can be used, and there is much It was an unspecified printk() so Joe's conversion is equal and that's a good way for him to have made these changes. If we want to mark this as KERN_ERR or whatever, that's entirely a seperate change. I think your objections to Joe's changes are completely uncalled for and his changes were good ones. --
Seems to me that the code went from unspecified to wrong. But I can see
Here's a patch, both uncalled-for and untested.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
--- a/drivers/net/mac8390.c 2010-04-16 13:31:04.000000000 +1000
+++ b/drivers/net/mac8390.c 2010-04-16 13:35:06.000000000 +1000
@@ -554,7 +554,7 @@
case MAC8390_APPLE:
switch (mac8390_testio(dev->mem_start)) {
case ACCESS_UNKNOWN:
- pr_info("Don't know how to access card memory!\n");
+ pr_err("Don't know how to access card memory!\n");
return -ENODEV;
break;
@@ -643,8 +643,8 @@
{
__ei_open(dev);
if (request_irq(dev->irq, __ei_interrupt, 0, "8390 Ethernet", dev)) {
- pr_info("%s: unable to get IRQ %d.\n", dev->name, dev->irq);
- return -EAGAIN;
+ pr_err("%s: unable to get IRQ %d.\n", dev->name, dev->irq);
+ return -EBUSY;
}
return 0;
}
@@ -660,7 +660,7 @@
{
ei_status.txing = 0;
if (ei_debug > 1)
- pr_info("reset not supported\n");
+ pr_debug("reset not supported\n");
return;
}
@@ -668,7 +668,7 @@
{
unsigned char *target = nubus_slot_addr(IRQ2SLOT(dev->irq));
if (ei_debug > 1)
- pr_info("Need to reset the NS8390 t=%lu...", jiffies);
+ pr_debug("Need to reset the NS8390 t=%lu...", jiffies);
ei_status.txing = 0;
target[0xC0000] = 0;
if (ei_debug > 1)
--
You'll need to add #define DEBUG This also now doesn't print. cheers, Joe --
Oops. Thanks for spotting that. I'll resend. --
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
--- a/drivers/net/mac8390.c 2010-04-16 13:31:04.000000000 +1000
+++ b/drivers/net/mac8390.c 2010-04-16 14:02:29.000000000 +1000
@@ -554,7 +554,7 @@
case MAC8390_APPLE:
switch (mac8390_testio(dev->mem_start)) {
case ACCESS_UNKNOWN:
- pr_info("Don't know how to access card memory!\n");
+ pr_err("Don't know how to access card memory!\n");
return -ENODEV;
break;
@@ -643,8 +643,8 @@
{
__ei_open(dev);
if (request_irq(dev->irq, __ei_interrupt, 0, "8390 Ethernet", dev)) {
- pr_info("%s: unable to get IRQ %d.\n", dev->name, dev->irq);
- return -EAGAIN;
+ pr_err("%s: unable to get IRQ %d.\n", dev->name, dev->irq);
+ return -EBUSY;
}
return 0;
}
@@ -660,7 +660,7 @@
{
ei_status.txing = 0;
if (ei_debug > 1)
- pr_info("reset not supported\n");
+ printk(KERN_DEBUG "reset not supported\n");
return;
}
@@ -668,11 +668,11 @@
{
unsigned char *target = nubus_slot_addr(IRQ2SLOT(dev->irq));
if (ei_debug > 1)
- pr_info("Need to reset the NS8390 t=%lu...", jiffies);
+ printk(KERN_DEBUG "Need to reset the NS8390 t=%lu...", jiffies);
ei_status.txing = 0;
target[0xC0000] = 0;
if (ei_debug > 1)
- pr_cont("reset complete\n");
+ printk(KERN_CONT "reset complete\n");
return;
}
--
You should document the reason for the return code change in the changelog. It'd be better to prefix this with the driver name or use something like netdev_dbg with #define DEBUG otherwise it's "huh? what device emits this message?" when reading the logs. Something like: printk(KERN_DEBUG pr_fmt("reset not supported\n")); or #define DEBUG netdev_dbg(dev, "reset not supported\n"); or #define DEBUG unnecessary conversion. --
Nubus slots are geographically addressed and their irqs are equally inflexible. -EAGAIN is misleading because retrying will not help fix I guess some prefer consistency, some prefer symmetry. Finn --
From: Finn Thain <fthain@telegraphics.com.au> This is exactly the kind of background information and verbose explanation that belongs in the commit message. Yet in your recent version of the patch, you're still being extremely terse as per the reasoning for using -EBUSY Just saying it's "misleading" doesn't tell anyone anything if they have to go back in the commit history and try to figure out why this change was made if it's causing problems later. Please make the verbose and complete explanation in your commit message, and resubmit your patch. I just want to point out that with all the trouble you gave about Joe's work, you're having one heck of a time even submitting your changes properly. :-) Thanks. --
You are a thorough reviewer, despite the regrettable implication to the contrary in my first message in this thread. And you are quite right, I did not understand the pr_* macros at the time. I apologise. I am hypersensitive to bit rot. I guess that's what happens when one makes it one's job to fix regressions in Linux. Finn --
From: Finn Thain <fthain@telegraphics.com.au> You're missing the whole point of using pr_info() et al. in that it includes the bits we define for pr_fmt at the top of the file. Also, you write absolutely no commit log message entry for your change explaining why you're doing the things you are doing. And finally you are doing two completely unrelated things at one (changing error return values and changing log message levels). --
Change an error return from EAGAIN to EBUSY since the former is
misleading. Also promote the log message. Likewise some other KERN_INFO
log messages.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
--- a/drivers/net/mac8390.c 2010-04-16 13:31:04.000000000 +1000
+++ b/drivers/net/mac8390.c 2010-04-16 23:50:39.000000000 +1000
@@ -554,7 +554,7 @@
case MAC8390_APPLE:
switch (mac8390_testio(dev->mem_start)) {
case ACCESS_UNKNOWN:
- pr_info("Don't know how to access card memory!\n");
+ pr_err("Don't know how to access card memory!\n");
return -ENODEV;
break;
@@ -643,8 +643,8 @@
{
__ei_open(dev);
if (request_irq(dev->irq, __ei_interrupt, 0, "8390 Ethernet", dev)) {
- pr_info("%s: unable to get IRQ %d.\n", dev->name, dev->irq);
- return -EAGAIN;
+ pr_err("%s: unable to get IRQ %d.\n", dev->name, dev->irq);
+ return -EBUSY;
}
return 0;
}
@@ -660,7 +660,7 @@
{
ei_status.txing = 0;
if (ei_debug > 1)
- pr_info("reset not supported\n");
+ printk(KERN_DEBUG pr_fmt("reset not supported\n"));
return;
}
@@ -668,11 +668,11 @@
{
unsigned char *target = nubus_slot_addr(IRQ2SLOT(dev->irq));
if (ei_debug > 1)
- pr_info("Need to reset the NS8390 t=%lu...", jiffies);
+ printk(KERN_DEBUG pr_fmt("Need to reset the NS8390 t=%lu..."), jiffies);
ei_status.txing = 0;
target[0xC0000] = 0;
if (ei_debug > 1)
- pr_cont("reset complete\n");
+ printk(KERN_CONT "reset complete\n");
return;
}
--
Change an error return code from -EAGAIN to -EBUSY since the former is
misleading.
Nubus slots are geographically addressed and their irqs are equally
inflexible. -EAGAIN is misleading because retrying will not help fix
whatever bug it was that made the irq unavailable.
Also promote the log message. Likewise some other KERN_INFO log messages.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
--- a/drivers/net/mac8390.c 2010-04-16 13:31:04.000000000 +1000
+++ b/drivers/net/mac8390.c 2010-04-16 23:50:39.000000000 +1000
@@ -554,7 +554,7 @@
case MAC8390_APPLE:
switch (mac8390_testio(dev->mem_start)) {
case ACCESS_UNKNOWN:
- pr_info("Don't know how to access card memory!\n");
+ pr_err("Don't know how to access card memory!\n");
return -ENODEV;
break;
@@ -643,8 +643,8 @@
{
__ei_open(dev);
if (request_irq(dev->irq, __ei_interrupt, 0, "8390 Ethernet", dev)) {
- pr_info("%s: unable to get IRQ %d.\n", dev->name, dev->irq);
- return -EAGAIN;
+ pr_err("%s: unable to get IRQ %d.\n", dev->name, dev->irq);
+ return -EBUSY;
}
return 0;
}
@@ -660,7 +660,7 @@
{
ei_status.txing = 0;
if (ei_debug > 1)
- pr_info("reset not supported\n");
+ printk(KERN_DEBUG pr_fmt("reset not supported\n"));
return;
}
@@ -668,7 +668,7 @@
{
unsigned char *target = nubus_slot_addr(IRQ2SLOT(dev->irq));
if (ei_debug > 1)
- pr_info("Need to reset the NS8390 t=%lu...", jiffies);
+ printk(KERN_DEBUG pr_fmt("Need to reset the NS8390 t=%lu..."), jiffies);
ei_status.txing = 0;
target[0xC0000] = 0;
if (ei_debug > 1)
--
From: Finn Thain <fthain@telegraphics.com.au>
request_irq() itself returns an appropriate error code, so the
correct change is to do:
err = request_irq( ... );
if (err) {
...
and return 'err'.
--
OK. I'll send a new patch once 2.6.34 is out and I have time to test this and some other patches. Finn --
Propagate the request_irq() return code. Also promote the log level of the
failure message. Likewise some other KERN_INFO messages.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Index: linux-2.6.34/drivers/net/mac8390.c
===================================================================
--- linux-2.6.34.orig/drivers/net/mac8390.c 2010-05-28 00:27:30.000000000 +1000
+++ linux-2.6.34/drivers/net/mac8390.c 2010-05-28 00:27:32.000000000 +1000
@@ -556,7 +556,7 @@ static int __init mac8390_initdev(struct
case MAC8390_APPLE:
switch (mac8390_testio(dev->mem_start)) {
case ACCESS_UNKNOWN:
- pr_info("Don't know how to access card memory!\n");
+ pr_err("Don't know how to access card memory!\n");
return -ENODEV;
break;
@@ -643,10 +643,13 @@ static int __init mac8390_initdev(struct
static int mac8390_open(struct net_device *dev)
{
+ int err;
+
__ei_open(dev);
- if (request_irq(dev->irq, __ei_interrupt, 0, "8390 Ethernet", dev)) {
- pr_info("%s: unable to get IRQ %d.\n", dev->name, dev->irq);
- return -EAGAIN;
+ err = request_irq(dev->irq, __ei_interrupt, 0, "8390 Ethernet", dev);
+ if (err) {
+ pr_err("%s: unable to get IRQ %d\n", dev->name, dev->irq);
+ return err;
}
return 0;
}
@@ -662,7 +665,7 @@ static void mac8390_no_reset(struct net_
{
ei_status.txing = 0;
if (ei_debug > 1)
- pr_info("reset not supported\n");
+ printk(KERN_DEBUG pr_fmt("reset not supported\n"));
return;
}
@@ -670,7 +673,7 @@ static void interlan_reset(struct net_de
{
unsigned char *target = nubus_slot_addr(IRQ2SLOT(dev->irq));
if (ei_debug > 1)
- pr_info("Need to reset the NS8390 t=%lu...", jiffies);
+ printk(KERN_DEBUG pr_fmt("Need to reset the NS8390 t=%lu..."), jiffies);
ei_status.txing = 0;
target[0xC0000] = 0;
if (ei_debug > 1)
@@ -871,5 +874,3 @@ static void word_memcpy_fromcard(void *t
while (count--)
*to++ = *from++;
}
-
-
--
From: Finn Thain <fthain@telegraphics.com.au> Use pr_debug() or pr_devel(). Anything which explicitly codes out a "printk(KERN_*" is suspect, we have interfaces for this. The whole point of defining pr_fmt at the top of the driver is so that in the driver, we use pr_foo() which includes the pr_fmt string at the beginning. If you bypass it you avoid the intended effect of that pr_fmt define. This is getting tiring Finn. So we're already past 4 iterations of this silly simple patch, and I want to remind you yet again what an incredibly hard time you gave Joe Perches for his changes to this file which in the end were entirely correct and well formed, and he got it right on his first attempt. I advise you to think twice before snapping at another developer's work in the future. --
I agree. My patch addresses all of the criticism of the earlier submissions. To make it plain: there are 25 files or so that use ei_debug. Three of those that now have the KERN_DEBUG printk's suppresed by the DEBUG macro only do so as an apparently unintended side effect of a commit that claims to "implement dynmic debug infrastructure". (Go figure.) http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commitdiff;h=dd0fab5b940... Your suggestion to use pr_debug is invoking compile time infrastructure (the DEBUG macro), so it is not in the spirit of this commit, and it is not relevant to any criticism from you or Joe of the earlier submissions. Please apply the patch. Finn --
`pr_debug()' indeed now may generate code if DEBUG is not defined,
i.e. if CONFIG_DYNAMIC_DEBUG is enabled.
This is intented for debug infrastructure the user may want to enable later.
If you want the old behavior, you can use `pr_devel()' instead, which
only generates code if DEBUG is defined.
This is intended for debug infrastructure for developers only.
However, you used `printk(KERN_DEBUG pr_fmt()...)`, which always generates code.
I'm still not 100% sure that was intentional?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
Geert, in the beginning, I decided that it should be KERN_DEBUG, not KERN_INFO, and made that change in the first patch submission. I used pr_debug(). Then Joe pointed out that this required DEBUG defined, which I'd forgotten (I didn't know about CONFIG_DYNAMIC_DEBUG). So, to retain the old behaviour, while following the example of other usages of ei_debug in lib8390 and drivers, I changed it to printk(KERN_DEBUG ...). Then Joe pointed out that I should take advantage of pr_fmt(), so the third submission made that change. (Then David said I should propagate the return code from request_irq, so I made the present patch submission.) Apparently David now wants me to submit this again -- if (ei_debug) pr_debug(...) David, if that code is acceptable, please let me know. If that code is mandatory, why didn't you say so upon the second patch submission? Alternatively, if the following is preferred (as implied by your last email): if (ei_debug) pr_info(...) Then let me know, and I'll quit bothering you. Or just go ahead and change my patch if you wish to save us both some time. --
From: fthain@telegraphics.com.au The only thing I care about is at the moment that you don't do something that ends up dropping the pr_fmt prefix. The pr_fmt define at the beginning of the driver is for nothing if we end up adding exceptions that end up eliding it for no good reason. And that's what your patch was doing. --
Since you have rejected my most recent patch submission, which uses pr_fmt explicitly, I imagine that what you are trying to say here is that only pr_debug or pr_info are acceptable. Now, so that we don't have to go through pointless resubmission iterations, can you tell me which of the following you prefer: if (ei_debug) pr_debug(...) OR if (ei_debug) pr_info(...) Thanks. Finn --
From: Finn Thain <fthain@telegraphics.com.au> Well for the printk in question, it's telling the user that a certain feature can't be enabled. And if the driver has an explicit way to control this message, using ei_debug, it's kind of redundant to slap another layer on top by using the debug printk facility. Changing this to a debug log level printk is only going to make getting the debug message shown harder for the user. So leaving it at pr_info() is just as correct in my eyes. Finally, your patch has so many problems getting applied because you're doing multiple things in one patch. And in fact I've asked you not to do this on several occiaions. Fix the error return codes in one patch, and nothing more. Then in another you can masterbate with printk log levels. --
Use the request_irq() error code as the return value for mac8390_open().
EAGAIN doesn't make sense for Nubus slot IRQs. Only this driver can claim
this IRQ (until the NIC is removed, which means everything is powered
down).
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Index: linux-2.6.34/drivers/net/mac8390.c
===================================================================
--- linux-2.6.34.orig/drivers/net/mac8390.c 2010-06-01 20:20:29.000000000 +1000
+++ linux-2.6.34/drivers/net/mac8390.c 2010-06-01 20:22:23.000000000 +1000
@@ -643,12 +643,13 @@ static int __init mac8390_initdev(struct
static int mac8390_open(struct net_device *dev)
{
+ int err;
+
__ei_open(dev);
- if (request_irq(dev->irq, __ei_interrupt, 0, "8390 Ethernet", dev)) {
- pr_info("%s: unable to get IRQ %d.\n", dev->name, dev->irq);
- return -EAGAIN;
- }
- return 0;
+ err = request_irq(dev->irq, __ei_interrupt, 0, "8390 Ethernet", dev);
+ if (err)
+ pr_info("%s: unable to get IRQ %d\n", dev->name, dev->irq);
+ return err;
}
static int mac8390_close(struct net_device *dev)
--
From: Finn Thain <fthain@telegraphics.com.au> Applied. --
Log error conditions using KERN_ERR priority.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
---
This patch doesn't address the KERN_INFO messages conditional on ei_debug.
I don't know how those can be improved to the satisfaction of all
interested parties.
These two patches should be applied in sequence.
Index: linux-2.6.34/drivers/net/mac8390.c
===================================================================
--- linux-2.6.34.orig/drivers/net/mac8390.c 2010-06-01 20:22:23.000000000 +1000
+++ linux-2.6.34/drivers/net/mac8390.c 2010-06-01 20:22:25.000000000 +1000
@@ -556,7 +556,7 @@ static int __init mac8390_initdev(struct
case MAC8390_APPLE:
switch (mac8390_testio(dev->mem_start)) {
case ACCESS_UNKNOWN:
- pr_info("Don't know how to access card memory!\n");
+ pr_err("Don't know how to access card memory!\n");
return -ENODEV;
break;
@@ -648,7 +648,7 @@ static int mac8390_open(struct net_devic
__ei_open(dev);
err = request_irq(dev->irq, __ei_interrupt, 0, "8390 Ethernet", dev);
if (err)
- pr_info("%s: unable to get IRQ %d\n", dev->name, dev->irq);
+ pr_err("%s: unable to get IRQ %d\n", dev->name, dev->irq);
return err;
}
--
From: Finn Thain <fthain@telegraphics.com.au> Applied, thank you. --
You're welcome. And I ought to add, thanks, Joe, for your patches. It is much harder than I had realised to do them right (or for that matter, well enough). Finn --
There are many uses of KERN_DEBUG that are reasonable to have always enabled. There is no pr_<level> macro/function that is always enabled. David, would you accept a new pr_<level> in kernel.h for that purpose? If so, do you have an opinion what it should be named? I think pr_dbg is not ideal as dev_dbg is already in use and can get optimized away. Maybe one of: pr_always_dbg pr_dbg_always pr_dbg_noopt pr_tdbg or something better? Anyone else? http://lkml.org/lkml/2009/10/1/399 --
From: Joe Perches <joe@perches.com> Doubtful. pr_debug() makes a ton of sense as currently implemented. It's for messages that we want both compile time and run-time control over. The case we have here in mac8390 seems like it should stay as pr_info(). Because 1) it's already controlled by a run-time knob so controlling it even further is confusing and 2) the message is "informative", it lets the user know a feature cannot be enabled, thus pr_info(). --
If that is true in general, then ei_debug itself becomes questionable. In the case of mac8390 at least, I'm certainly leaning toward changing the pr_info (conditional on ei_debug) to pr_debug (unconditional). Finn --
From: fthain@telegraphics.com.au I won't do that, because your change elides the pr_fmt prefix Joe Perches added to the driver for the purposes of making sure such a prefix would be added to all log messages output by the driver. The whole idea is that everything the driver puts into the kernel log has the driver module name at the beginning. That's what the pr_fmt define at the top of the driver does. It's so you can tell which driver the message came from. You're undoing that, which is a bug. It's a step backwards, it's wrong. And to top it off we've had to explain this stuff to you multiple times. So, as long as the patch is incorrect I absolutely will not apply it. --
It's used embedded in the pr_<level> functions. It's in kernel.h, and yes, it is. I suggest you change the levels to what you desire. You could add yourself to the MAINTAINERS entry for this file. cheers, Joe --
My mistake. Finn --
