All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org, pcihpd-discuss@lists.sourceforge.net
Subject: Re: [PATCH] More PCI fixes for 2.5.73
Date: Wed, 25 Jun 2003 17:48:15 -0700	[thread overview]
Message-ID: <10565884952122@kroah.com> (raw)
In-Reply-To: <1056588494675@kroah.com>

ChangeSet 1.1429.2.6, 2003/06/25 17:13:44-07:00, greg@kroah.com

[PATCH] PCI Hotplug: fix core problem with kobject lifespans.

Added needed release function, now all pci hotplug drivers need to implement
it...


 drivers/pci/hotplug/pci_hotplug.h      |    4 ++++
 drivers/pci/hotplug/pci_hotplug_core.c |   22 +++++++++++++---------
 2 files changed, 17 insertions(+), 9 deletions(-)


diff -Nru a/drivers/pci/hotplug/pci_hotplug.h b/drivers/pci/hotplug/pci_hotplug.h
--- a/drivers/pci/hotplug/pci_hotplug.h	Wed Jun 25 17:37:57 2003
+++ b/drivers/pci/hotplug/pci_hotplug.h	Wed Jun 25 17:37:57 2003
@@ -51,6 +51,8 @@
 	ssize_t (*show)(struct hotplug_slot *, char *);
 	ssize_t (*store)(struct hotplug_slot *, const char *, size_t);
 };
+#define to_hotplug_attr(n) container_of(n, struct hotplug_slot_attribute, attr);
+
 /**
  * struct hotplug_slot_ops -the callbacks that the hotplug pci core can use
  * @owner: The module owner of this structure
@@ -130,12 +132,14 @@
 	char				*name;
 	struct hotplug_slot_ops		*ops;
 	struct hotplug_slot_info	*info;
+	void (*release) (struct hotplug_slot *slot);
 	void				*private;
 
 	/* Variables below this are for use only by the hotplug pci core. */
 	struct list_head		slot_list;
 	struct kobject			kobj;
 };
+#define to_hotplug_slot(n) container_of(n, struct hotplug_slot, kobj)
 
 extern int pci_hp_register		(struct hotplug_slot *slot);
 extern int pci_hp_deregister		(struct hotplug_slot *slot);
diff -Nru a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c
--- a/drivers/pci/hotplug/pci_hotplug_core.c	Wed Jun 25 17:37:57 2003
+++ b/drivers/pci/hotplug/pci_hotplug_core.c	Wed Jun 25 17:37:57 2003
@@ -74,20 +74,16 @@
 static ssize_t hotplug_slot_attr_show(struct kobject *kobj,
 		struct attribute *attr, char *buf)
 {
-	struct hotplug_slot *slot=container_of(kobj,
-			struct hotplug_slot,kobj);
-	struct hotplug_slot_attribute *attribute =
-		container_of(attr, struct hotplug_slot_attribute, attr);
+	struct hotplug_slot *slot = to_hotplug_slot(kobj);
+	struct hotplug_slot_attribute *attribute = to_hotplug_attr(attr);
 	return attribute->show ? attribute->show(slot, buf) : 0;
 }
 
 static ssize_t hotplug_slot_attr_store(struct kobject *kobj,
 		struct attribute *attr, const char *buf, size_t len)
 {
-	struct hotplug_slot *slot=container_of(kobj,
-			struct hotplug_slot,kobj);
-	struct hotplug_slot_attribute *attribute =
-		container_of(attr, struct hotplug_slot_attribute, attr);
+	struct hotplug_slot *slot = to_hotplug_slot(kobj);
+	struct hotplug_slot_attribute *attribute = to_hotplug_attr(attr);
 	return attribute->store ? attribute->store(slot, buf, len) : 0;
 }
 
@@ -96,8 +92,16 @@
 	.store = hotplug_slot_attr_store,
 };
 
+static void hotplug_slot_release(struct kobject *kobj)
+{
+	struct hotplug_slot *slot = to_hotplug_slot(kobj);
+	if (slot->release)
+		slot->release(slot);
+}
+
 static struct kobj_type hotplug_slot_ktype = {
-	.sysfs_ops = &hotplug_slot_sysfs_ops
+	.sysfs_ops = &hotplug_slot_sysfs_ops,
+	.release = &hotplug_slot_release,
 };
 
 static decl_subsys(hotplug_slots, &hotplug_slot_ktype, NULL);


  reply	other threads:[~2003-06-26  0:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-26  0:45 [BK PATCH] More PCI fixes for 2.5.73 Greg KH
2003-06-26  0:48 ` [PATCH] " Greg KH
2003-06-26  0:48   ` Greg KH
2003-06-26  0:48     ` Greg KH
2003-06-26  0:48       ` Greg KH
2003-06-26  0:48         ` Greg KH
2003-06-26  0:48           ` Greg KH [this message]
2003-06-26  0:48             ` Greg KH
2003-06-26  0:48               ` Greg KH

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=10565884952122@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pcihpd-discuss@lists.sourceforge.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.