On Mon, Mar 3, 2008 at 12:16 PM, Stefan Richter wrote:> Kristian Høgsberg wrote:> > I would want to use a kref and a completion for tracking this though> > instead of the atomic. Just use kref_get() instead of incrementing> > the atomic and use kref_put() instead of decrementing it. The release> > function for kref_put() should complete the completion struct and> > instead of the busy loop in fw_core_remove_card() we just wait for the> > completion.>> Sounds like the way to go. Since I already passed that patch upwards, I> will do an incremental rework. (But perhaps not before spending some> time on ticket number 9617 at bugzilla.kernel.org's...)>>> > And I'm not sure I agree that it's a device_count, it> > really just is a ref-count. The core should also hold a reference to> > the card and release it in fw_core_remove_card(), just before waiting> > on the completion.>> Right; we just shouldn't mix fw-ohci's refcounting (which isn't really> needed since the lifetime rules for the card are as simple as they can> get for fw-ohci) and fw-core's refcounting. Yup, we should keep the fw-ohci side of things simple. And they stillare: it calls add_card() to add a new card at which point the corestarts using the card. On removal, it calls remove_card() and whenthat returns the core no knows or cares about the card and fw-ohci.cis free to tear it down however it wants. When I mention that thecore should hold a ref-count, it's really just that somebody needs toown the initial ref-count and make sure it's dropped on the removepath. Kristianÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ¥Šwÿº{.nÇ+‰·¥Š{±þG«�éÿŠ{ayºʇڙë,j­¢f£¢·hš�ï�êÿ‘êçz_è®(­éšŽŠÝ¢j"�ú¶m§ÿÿ¾«þG«�éÿ¢¸?™¨è­Ú&£ø§~�á¶iO•æ¬z·švØ^¶m§ÿÿà ÿ¶ìÿ¢¸?–I¥