* policy on externs
@ 2018-06-02 16:23 Justin Skists
2018-06-02 17:33 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Justin Skists @ 2018-06-02 16:23 UTC (permalink / raw)
To: kernelnewbies
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! :)
Thanks,
Justin
^ permalink raw reply [flat|nested] 3+ messages in thread
* policy on externs
2018-06-02 16:23 policy on externs Justin Skists
@ 2018-06-02 17:33 ` Greg KH
2018-06-02 17:43 ` Justin Skists
0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2018-06-02 17:33 UTC (permalink / raw)
To: kernelnewbies
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* policy on externs
2018-06-02 17:33 ` Greg KH
@ 2018-06-02 17:43 ` Justin Skists
0 siblings, 0 replies; 3+ messages in thread
From: Justin Skists @ 2018-06-02 17:43 UTC (permalink / raw)
To: kernelnewbies
On Sat, Jun 02, 2018 at 07:33:46PM +0200, Greg KH wrote:
> 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.
OK, Greg. I'll have another look at it, then.
> What driver are you looking at?
I have been looking at the speakup subsystem.
Thanks,
Justin.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-06-02 17:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-02 16:23 policy on externs Justin Skists
2018-06-02 17:33 ` Greg KH
2018-06-02 17:43 ` Justin Skists
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).