All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Miguel Aguilar <miguel.aguilar@ridgerun.com>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>,
	davinci-linux-open-source@linux.davincidsp.com,
	clark.becker@ridgerun.com, linux-input@vger.kernel.org,
	santiago.nunez@ridgerun.com, todd.fischer@ridgerun.com
Subject: Re: [PATCH v2 1/2] Input: Add DaVinci DM365 Keypad support
Date: Thu, 17 Sep 2009 12:48:17 -0700	[thread overview]
Message-ID: <200909171248.18016.david-b@pacbell.net> (raw)
In-Reply-To: <4AB28D94.2090401@ridgerun.com>

On Thursday 17 September 2009, Miguel Aguilar wrote:
> I have another question: When should I use dev_err and dev_dbg in a probe 
> function, for reporting the errors (-ENOMEM, -ENODEV, -ENOMEM, etc)?

My two cents:  dev_dbg() for configuration errors, which
vanish once the board config is properly set up and are
only needed in early debug stages.  For anything else
(rare!) it's OK to use dev_err().

Some folk like to clutter kernel images with gobs of strings
for messages that never appear.  I'm not one of them; and I
think drivers should be written to minimize space used on
production systems.  Save that RAM for Real Work (tm)!

It's a good habit to scan the driver object before you call
work on it "done".  For platform drivers, probe/remove code
should normally sit in init/exit sections.  Symbols should
as a rule not be exported from drivers.  Having more than
a handful of strings should raise red flags ... who is ever
going to read them?  (And why, and what should they do with
them once they've seen those messages?)  Real hardware faults
generally deserve log messages.  Little else does.

Even look at the object code generated ... you may well observe
stupidly large amounts of code generated for some things, which
can easily be trimmed.  (Remember that the cost of a few extra
fetches into I-cache often dwarf call/return costs for a few
helper subroutines, even on critical paths!)

Sometimes a few minutes spent with such basic checks can show
problems that bloat the runtime footprint by 20% or more.
(Less after you get good habits though!)

- Dave

      reply	other threads:[~2009-09-17 19:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-14 18:12 [PATCH v2 1/2] Input: Add DaVinci DM365 Keypad support miguel.aguilar
2009-09-14 18:45 ` David Brownell
2009-09-17 17:49   ` Miguel Aguilar
2009-09-17 18:01     ` Sergei Shtylyov
2009-09-17 19:27       ` Miguel Aguilar
2009-09-17 19:48         ` David Brownell [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200909171248.18016.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=clark.becker@ridgerun.com \
    --cc=davinci-linux-open-source@linux.davincidsp.com \
    --cc=linux-input@vger.kernel.org \
    --cc=miguel.aguilar@ridgerun.com \
    --cc=santiago.nunez@ridgerun.com \
    --cc=sshtylyov@ru.mvista.com \
    --cc=todd.fischer@ridgerun.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.