Re: [RFC 0/6] Driver core: Encourage use of const attributes



On Fri, Dec 18, 2009 at 10:52:21AM +0200, Phil Carmody wrote:
On 18/12/09 00:16 +0100, ext Greg KH wrote:
On Thu, Dec 17, 2009 at 08:12:10PM +0200, Phil Carmody wrote:
[...]> > So here I offer a small patchset which I hope will permit and
encourage device and other attributes to be made const, and put
in read-only sections.

1-3 address the three attribute types which seemed to be trivially
const-able, and are the important part of the set.

I like these, very nice.

Thanks, I can possibly sniff a little bit deeper, and see if there are
any other obvious throwing-away-of-consts nearby.

Great.

4 adds a new macro to encourage the use of Const ATTRibutes,
and may need a better name. (I wanted to avoid RO, for example.)

Hm, is this really needed? How badly do things break if you change the
current attribute macros to use 'const'? What subsystems are not using
const?

That was the first thing that went through my mind, but I didn't want
to be too brave. He who dares wins though, and I can certainly give
that a try. allmodconfig is my friend.

That would be nice to try, let me know what you find.

5 and 6 are merely two quick examples of how easy it is to adopt
the new const convention. In reality, these structures have been
constant and treated as constant by the driver core all along, it's
just that one word was missing from a few important places.

I would hope to submit a patchset with 1-3 and a possibly modified
4. The migrations themselves will belong in different trees.

I'll be glad to take 1-3 now, and queue it up for .34.

They cleave cleanly at that point, so I'll resend with a [PATCH] prefix.

Got them, I'll go queue them up.

thanks again,

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



Relevant Pages

  • Re: Singly Linked List in C
    ... While a linked list is certainly one way to implement a queue, a circular buffer could be a better approach, if you can accept a fixed upper limit to the number of elements in the queue. ... I would not consider it objectionable, but I would want to make sure that you understand that making 'sp' const has nothing to do with protecting the argument of the function from modification. ... The first const would protect the thing that the pointer points at from change. ...
    (comp.lang.c)
  • Re: Thread safe queue in C
    ... within linux with C and i need a thread safe queue.How can i obtain a ... Anyway, creating a queue with POSIX Threads is rather trivial, I don't see why you can't quickly create one: ... typedef struct queue_s queue; ... queue* const _this, ...
    (comp.programming.threads)
  • Mail in Exchnage 2003 Queue oder Link anzeigen
    ... Ich komme nur einfach nicht an die Mails in der Queue dran. ... Const admin = "administrator" ... Set objWMILocator2 = CreateObject ... For Each m In PendingQueue ...
    (microsoft.public.de.german.scripting.wsh)
  • Re: [RFC 0/6] Driver core: Encourage use of const attributes
    ... current attribute macros to use 'const'? ... What subsystems are not using ... That was the first thing that went through my mind, ...
    (Linux-Kernel)
  • Re: Singly Linked List in C
    ... circular buffer could be a better ... elements in the queue. ... It avoids the space overhead of having each node ... reasons that declaring any other local variable const might make sense. ...
    (comp.lang.c)