The last ref belongs to the core code. 1 means there are no
more external clients on the object. So it can not race with
decrements. But I guess there is a possibility that it can
race with new increments. If it is the case that new increments
can only come from, say, sysfs access, then if we call the
x_put() == 1 after we are unregistered from sysfs and no new
users are allowed then the counter can only go down and we
have the last reference. No?
Like I said option 4 is delicate it must be done carefully.
Thanks
Boaz
--