[lkml]   [2011]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PWM v8 1/3] PWM: Implement a generic PWM framework

    On Sat, Mar 12, 2011 at 10:24 PM, Bill Gatliff <> wrote:
    > +static ssize_t pwm_duty_ns_show(struct device *dev,
    > +                               struct device_attribute *attr,
    > +                               char *buf)
    > +{
    > +       struct pwm_device *p = to_pwm_device(dev);
    > +       return sprintf(buf, "%lu\n", pwm_get_duty_ns(p));
    > +}

    What would happen if device_unregister() was called on the above
    device while duty_ns_show() was running?

    My hope is that the device_unregister() would decrement the usage
    count on the device, but the count would still be nonzero due to the
    running attribute method; thus, the device would not be deleted. When
    the method exited, the usage count would become zero and THEN the
    device would disappear. Is that how things work? (I have looked at
    the code for device_unregister() and friends, but haven't yet been
    able to answer this question for myself; said code seems nontrivial).

    Bill Gatliff
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2011-03-14 15:31    [W:0.019 / U:1.164 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site