public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Christie <michaelc@cs.wisc.edu>
To: James.Bottomley@steeleye.com
Cc: linux-scsi <linux-scsi@vger.kernel.org>
Subject: [PATCH] add missing class_device_del to transport classes
Date: Wed, 26 Jan 2005 15:59:26 -0800	[thread overview]
Message-ID: <41F82EDE.3040905@cs.wisc.edu> (raw)

[-- Attachment #1: Type: text/plain, Size: 1117 bytes --]

James,

It appears there is a missing class_device_del.
The comments for transport_remove_device indicate
that transport_remove_classdev should call it
(which the attached patch does), but the comment in
attribute_container_remove_device:

  If you want a
  * two phase release: remove from visibility and then delete the
  * device, then you should use this routine with a fn that calls
  * class_device_del() and then use
  * attribute_container_device_trigger() to do the final put on the
  * classdev.

Indicate that maybe transport_destroy_classdev and
transport_remove_device are incorrect. However,
attribute_container_remove_device will do a
list_del(&ic->node); so that later calls to
attribute_container_device_trigger would not be able
to do the final put on that classdev. I assumed the
comments in attribute_container_remove_device
are incorrect, so the attached patch made against
scsi-rc-fixes-2.6 adds a call to class_device_del
to transport_remove_classdev.

I did not fix the comments in attribute_container_remove_device
becuase I was not 100% certain what is the correct behavior or
usage.

Mike


[-- Attachment #2: add-classdev-del.patch --]
[-- Type: text/x-patch, Size: 613 bytes --]

--- scsi-rc-fixes-2.6.orig/drivers/base/transport_class.c	2005-01-25 13:30:27.000000000 -0800
+++ scsi-rc-fixes-2.6.newtest/drivers/base/transport_class.c	2005-01-26 15:22:52.000000000 -0800
@@ -216,10 +216,16 @@ static int transport_remove_classdev(str
 				     struct class_device *classdev)
 {
 	struct transport_class *tclass = class_to_transport_class(cont->class);
+	struct class_device_attribute **attrs = cont->attrs;
+	int i;
 
 	if (tclass->remove)
 		tclass->remove(dev);
 
+	for (i = 0; attrs[i]; i++)
+		class_device_remove_file(classdev, attrs[i]);
+	class_device_del(classdev);
+
 	return 0;
 }
 

             reply	other threads:[~2005-01-26 23:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-26 23:59 Mike Christie [this message]
2005-01-27 21:33 ` [PATCH] add missing class_device_del to transport classes James Bottomley
2005-01-30  1:47 ` James Bottomley

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=41F82EDE.3040905@cs.wisc.edu \
    --to=michaelc@cs.wisc.edu \
    --cc=James.Bottomley@steeleye.com \
    --cc=linux-scsi@vger.kernel.org \
    /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