lkml.org 
[lkml]   [2006]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectadvice on using dev_info(), dev_err() and friends (was: [PATCH 2/9] isdn4linux: Siemens Gigaset drivers - common module)
Hello Greg,

thank you for your comments. Just a few follow-up questions.

On 15.02.2006 04:27, Greg KH wrote:
> On Sat, Feb 11, 2006 at 03:52:27PM +0100, Hansjoerg Lipp wrote:
>
>>--- linux-2.6.16-rc2/drivers/isdn/gigaset/gigaset.h 1970-01-01 01:00:00.000000000 +0100
>>+++ linux-2.6.16-rc2-gig/drivers/isdn/gigaset/gigaset.h 2006-02-11 15:20:26.000000000 +0100
[...]
>>+#undef info
>>+#define info(format, arg...) printk(KERN_INFO "%s: " format "\n", THIS_MODULE ? THIS_MODULE->name : "gigaset_hw" , ## arg)
>
> Care to use the dev_info(), dev_err() and other dev_* friends instead of
> rolling your own? It gives you a much easier and standardised way of
> identifying the driver and individual device that the message is
> happening for.

This turns out to be surprisingly tricky, as these macros take a device
pointer argument which mustn't be NULL either.

Could you please advise how to use these when I do not have a device
pointer available (ie. before the probe method has been called) or when
there is a risk of it being no longer valid (ie. the USB device has been
unplugged)? I can detect both cases by checking for dev==NULL, but then
what do I do if it is? Is there a dummy device structure somewhere which
I could then use instead? Somehow, replacing all our occurrences of
info("m%sg", args);
with
if (cs->dev)
dev_info(cs->dev, "m%sg\n", args);
else
printk(KERN_INFO "gigaset: m%sg\n", args);
doesn't really appeal to me. :-)

Thanks
Tilman
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-02-21 18:05    [W:0.445 / U:0.076 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site