From: Greg KH <greg@kroah.com>
To: dtor_core@ameritech.net
Cc: James Bottomley <James.Bottomley@steeleye.com>,
Matthew Wilcox <matthew@wil.cx>,
James.Smart@emulex.com, Andrew Morton <akpm@osdl.org>,
SCSI Mailing List <linux-scsi@vger.kernel.org>,
Linux Kernel <linux-kernel@vger.kernel.org>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
Russell King <rmk@arm.linux.org.uk>,
Dmitry Torokhov <dtor@mail.ru>
Subject: Re: [PATCH] add transport class symlink to device object
Date: Wed, 31 Aug 2005 14:43:07 -0700 [thread overview]
Message-ID: <20050831214307.GE20443@kroah.com> (raw)
In-Reply-To: <d120d500050818125031d1bc98@mail.gmail.com>
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?
thanks,
greg k-h
next prev parent reply other threads:[~2005-08-31 21:43 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-13 15:34 [PATCH] add transport class symlink to device object James.Smart
2005-08-13 21:39 ` Greg KH
2005-08-13 23:36 ` James Bottomley
2005-08-14 0:42 ` James Bottomley
2005-08-14 1:37 ` James Bottomley
2005-08-14 15:02 ` Matthew Wilcox
2005-08-14 22:25 ` Russell King
2005-08-15 0:43 ` Matthew Wilcox
2005-08-15 8:32 ` Russell King
2005-08-18 5:21 ` Greg KH
2005-08-18 6:30 ` Russell King
2005-08-18 6:41 ` Greg KH
2005-08-18 6:50 ` Russell King
2005-08-18 7:04 ` Greg KH
2005-08-18 11:43 ` Matthew Wilcox
2005-08-15 22:41 ` James Bottomley
2005-08-18 5:23 ` Greg KH
2005-08-18 6:37 ` Greg KH
2005-08-18 19:50 ` Dmitry Torokhov
2005-08-31 21:43 ` Greg KH [this message]
2005-09-01 5:57 ` Dmitry Torokhov
-- strict thread matches above, loose matches on Subject: below --
2005-08-14 12:42 James.Smart
2005-08-14 14:17 ` James Bottomley
2005-08-16 0:52 James.Smart
2005-08-16 1:08 ` James Bottomley
2005-08-16 13:41 ` Luben Tuikov
2005-08-16 13:37 ` Luben Tuikov
2005-08-16 20:53 ` Russell King
2005-08-16 15:50 James.Smart
2005-08-18 11:31 James.Smart
2005-08-18 11:32 James.Smart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050831214307.GE20443@kroah.com \
--to=greg@kroah.com \
--cc=James.Bottomley@steeleye.com \
--cc=James.Smart@emulex.com \
--cc=akpm@osdl.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=dtor@mail.ru \
--cc=dtor_core@ameritech.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=matthew@wil.cx \
--cc=rmk@arm.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).