Re: [PATCH] scsi_host sysfs updates scsi-misc-2.5 [0/2]

Mike Anderson
2003-05-12T18:26:38Z

James Bottomley [James.Bottomley@steeleye.com] wrote:
> On Mon, 2003-05-12 at 12:50, James Bottomley wrote:
> > Surprisingly, it still fails. I've debugged the refcounting and I see
> > it fall to zero in scsi_host_put but the dev release method doesn't
> > trigger for no reason I can see.
> >
> > It's probably a kobject initialisation problem somewhere.
>
> OK, found it. the ->release is triggered by the kobj_kset, which isn't
> set until device_add time, not device init time.
>
> Therefore, we shouldn't really put and get objects until they've been
> added (or the kobj_set_kset_s needs to be moved to device_initialize()).
>

I would like to have feedback from Mochel on the device_initialize
call.

The documentation I have read indicates the device_initialize call was to
allow the struct device to be usable for reference counting. I think we
should determine if that is the intent and can we call kobj_set_kset_s
in device_initialize.

Another option may be to set the ktype value on our struct device
kobject until device_add overrides this with the call to kobj_set_kset_s.