lkml.org 
[lkml]   [2005]   [Sep]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] add transport class symlink to device object
Date
On Wednesday 31 August 2005 16:43, Greg KH wrote:
> On Thu, Aug 18, 2005 at 02:50:19PM -0500, Dmitry Torokhov wrote:
> > On 8/18/05, Greg KH <greg@kroah.com> wrote:
> > > @@ -500,9 +519,13 @@ int class_device_add(struct class_device
> > > }
> > >
> > > class_device_add_attrs(class_dev);
> > > - if (class_dev->dev)
> > > + if (class_dev->dev) {
> > > + class_name = make_class_name(class_dev);
> > > sysfs_create_link(&class_dev->kobj,
> > > &class_dev->dev->kobj, "device");
> > > + sysfs_create_link(&class_dev->dev->kobj, &class_dev->kobj,
> > > + class_name);
> > > + }
> > >
> >
> > I wonder if we need to grab a reference to class_dev->dev here:
> >
> > dev = device_get(class_dev->dev);
> > if (dev) {
> > ....
> > }
> >
> > Otherwise, if device gets unregistered/deleted before class device is
> > deleted we'll get into trouble when removing the link since
> > class_dev->dev will be garbage.
> >
> > .. But grabbing that reference will cause pains in SCSI system which,
> > when I looked, removed class devices from device's release function.
>
> No the sysfs_create_link() call increments the kobject reference on the
> target of the symlink. See sysfs_add_link() for details. So this
> should be just fine, right?
>

Yes, you are right. Sorry for the moise.

--
Dmitry
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-09-01 07:59    [W:0.268 / U:0.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site