kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: greg@kroah.com (Greg KH)
To: kernelnewbies@lists.kernelnewbies.org
Subject: policy on externs
Date: Sat, 2 Jun 2018 19:33:46 +0200	[thread overview]
Message-ID: <20180602173346.GA21838@kroah.com> (raw)
In-Reply-To: <20180602162320.GA11676@tanglefoot>

On Sat, Jun 02, 2018 at 05:23:20PM +0100, Justin Skists wrote:
> Hi,
> 
> What is the kernel policy on using "extern" to share variables between
> source files in a module?
> 
> I've been looking at one subsystem in staging [that shares variables quite a
> bit] to becoming familar with it, and seeing if I can help do some work on it
> in my free time.
> 
> Personally I prefer to see them eradicated (they polute the namespace), and
> store such variables in a context structure that is passed around. But I don't
> see any reference about it in the coding style, and I am not one to
> code-churn just because it's not my personal style! :)

context structures are almost always best, as they can be tied to the
hardware device, not the module itself.  So yes, if they can be
eradicated, please do so.

What driver are you looking at?

thanks,

greg k-h

  reply	other threads:[~2018-06-02 17:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-02 16:23 policy on externs Justin Skists
2018-06-02 17:33 ` Greg KH [this message]
2018-06-02 17:43   ` Justin Skists

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=20180602173346.GA21838@kroah.com \
    --to=greg@kroah.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /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 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).