lkml.org 
[lkml]   [2008]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectAccessor macros vs reference counting
On Sat, Feb 23, 2008 at 04:14:08PM +0800, WANG Cong wrote:
> Use get_personality() macro instead of explicit reference
> for parisc code.
> - if (personality(current->personality) == PER_LINUX32
> + if (personality(get_personality()) == PER_LINUX32

Hm. We have an interesting clash of conventions here.

On the one hand, we have the java-style accessor convention.
get_personality()/set_personality().

On the other hand, we have reference counting. get_cpu()/put_cpu().

When I first saw this patch, I assumed the latter (and went looking for
the missing put_), but _personality is of the former style. I have one
suggestion (that nobody is going to like), which is that we suffix
reference-counting functions with _ref, ie:

get_cpu_ref()
put_cpu_ref()
pci_get_device_ref()
pci_put_device_ref()
pci_dev_get_ref()
pci_dev_put_ref()

(PCI is actually a good example here; it has "get" referring both to
refcounting and to accessors)

--
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."


\
 
 \ /
  Last update: 2008-02-23 10:09    [W:0.058 / U:0.492 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site