Satyam Sharma wrote:
> Please, this is _basic_ refcounting semantics. For those who disagree,
> kindly read Yoshifuji's above paragraph again.
I did but I don't really see anything so basic about refcounting
semantics there.
[...]
> Ok, what's the compelling reason to change sysfs_put() then?
> I don't see any, either.
Because mixed situation is undisputably worse than one way or the other
&& making sysfs_put() to conform to its surroundings is the shortest
path to achieve uniformity. Gees, what's so important about allowing or
not allowing NULL?
>> but we're leaning toward accepting NULL argument in this
>> type of functions. Think about kfree(NULL) and its usefulness.
>
> Don't {mis}quote the kfree() mistake here, please.
Like it or not, kfree(NULL) is used the same way.
>> More
>> importantly, the ecosystem around sysfs - that is, kobject, driver model
>> - generally accepts NULL argument for their get/put functions
>
> This can only mean two things:
>
> (1) Either, they simply do not _need_ the refcounting in the first place
> (which means -- better do away with get() and put() for them altogether)
I don't really see how you can jump there from allowing NULL argument.
Your conclusion is really far from the origin.
[...]
NULL put is usually used to simplify error handling / cleanup codes.
>> I can't believe it should be so difficult to understand this. How can any
>> caller (that first did a xxx_get() on that shared object) land up with that
>> object getting NULL _from under it_ unless some logic is wrong
>> somewhere? And instead of flagging this broken logic, the proposed
>> change here would hide it.
I agree with you about get(). Allowing NULL argument doesn't really
help anything. It only increases the chance of getting things wrong.
I'm all for not allowing NULL argument to get(). For put(), as I wrote
before, I think allowing NULL has some advantages and I don't care
either way as long as it's not confusing. The 'not confusing' part is
way more important to me than advantages of either way.