From: Alex Chiang <achiang@hp.com>
To: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Cc: Greg KH <gregkh@suse.de>, Gary Hade <garyhade@us.ibm.com>,
Kristen Carlson Accardi <kristen.c.accardi@intel.com>,
Matthew Wilcox <matthew@wil.cx>,
warthog19@eaglescrag.net, rick.jones2@hp.com,
linux-kernel@vger.kernel.org, linux-pci@atrey.karlin.mff.cuni.cz,
linux-acpi@vger.kernel.org
Subject: Re: [PATCH 11/16] PCI slot: Remove useless release handler (Not for mainline!)
Date: Mon, 24 Mar 2008 21:08:44 -0600 [thread overview]
Message-ID: <20080325030844.GD11575@ldl.fc.hp.com> (raw)
In-Reply-To: <47E336FA.2060104@jp.fujitsu.com>
* Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>:
> The release() handler of struct pci_slot never be called because
> pci_hp_deregister() calls pci_slot_destroy() after setting
> slot->release with NULL. So we don't need release() handler of struct
> pci_slot. In addition, we don't need pci_slot_add_hotplug().
Thanks, this was a good change. I've tested and merged it.
I did make two small changes though:
>
> Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
>
> ---
> drivers/pci/hotplug/pci_hotplug_core.c | 15 -----------
> drivers/pci/slot.c | 44 ---------------------------------
> include/linux/pci.h | 3 --
> 3 files changed, 1 insertion(+), 61 deletions(-)
>
> Index: linux-2.6.25-rc6/drivers/pci/slot.c
> ===================================================================
> --- linux-2.6.25-rc6.orig/drivers/pci/slot.c
> +++ linux-2.6.25-rc6/drivers/pci/slot.c
> @@ -67,9 +67,6 @@ static void pci_slot_release(struct kobj
>
> list_del(&slot->list);
>
> - if (slot->release)
> - slot->release(slot);
> -
> remove_sysfs_files(slot);
> kfree(slot);
> }
> @@ -79,47 +76,6 @@ static struct kobj_type pci_slot_ktype =
> .release = &pci_slot_release,
> };
>
> -int pci_slot_add_hotplug(struct pci_bus *parent, int slot_nr,
> - void (*release)(struct pci_slot *))
> -{
> - struct pci_slot *slot;
> - int retval, found;
> -
> - retval = found = 0;
> -
> - down_write(&pci_bus_sem);
> -
> - /* This slot should have already been created, so look for it. If
> - * we can't find it, return -EEXIST.
> - */
> - list_for_each_entry(slot, &parent->slots, list) {
> - if (slot->number == slot_nr) {
> - found = 1;
> - break;
> - }
> - }
> -
> - if (!found) {
> - pr_debug("%s: slot not found\n", __func__);
> - retval = -EEXIST;
> - goto out;
> - }
> -
> - if (slot->release) {
> - pr_debug("%s: already claimed\n", __func__);
> - retval = -EBUSY;
> - goto out;
> - }
> -
> - pr_debug("%s: adding release function to %x:%d\n",
> - __func__, parent->number, slot_nr);
> - slot->release = release;
> - out:
> - up_write(&pci_bus_sem);
> - return retval;
> -}
> -EXPORT_SYMBOL_GPL(pci_slot_add_hotplug);
> -
> struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
> const char *name)
> {
> Index: linux-2.6.25-rc6/include/linux/pci.h
> ===================================================================
> --- linux-2.6.25-rc6.orig/include/linux/pci.h
> +++ linux-2.6.25-rc6/include/linux/pci.h
> @@ -135,7 +135,6 @@ struct pci_slot {
> struct hotplug_slot *hotplug; /* Hotplug info (migrate over time) */
> unsigned char number; /* PCI_SLOT(pci_dev->devfn) */
> struct kobject kobj;
> - void (*release)(struct pci_slot *);
> };
>
> /*
> @@ -494,8 +493,6 @@ struct pci_bus *pci_add_new_bus(struct p
> int busnr);
> struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
> const char *name);
> -int pci_slot_add_hotplug(struct pci_bus *parent, int slot_nr,
> - void (*release)(struct pci_slot *));
> int pci_destroy_slot(struct pci_slot *slot);
> int pci_scan_slot(struct pci_bus *bus, int devfn);
> struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn);
> Index: linux-2.6.25-rc6/drivers/pci/hotplug/pci_hotplug_core.c
> ===================================================================
> --- linux-2.6.25-rc6.orig/drivers/pci/hotplug/pci_hotplug_core.c
> +++ linux-2.6.25-rc6/drivers/pci/hotplug/pci_hotplug_core.c
> @@ -537,12 +537,6 @@ static struct hotplug_slot *get_slot_fro
> return NULL;
> }
>
> -static void hotplug_release(struct pci_slot *slot)
> -{
> - struct hotplug_slot *hotplug = slot->hotplug;
> - hotplug->release(hotplug);
> -}
> -
> /**
> * pci_hp_register - register a hotplug_slot with the PCI hotplug subsystem
> * @slot: pointer to the &struct hotplug_slot to register
> @@ -576,12 +570,6 @@ int pci_hp_register(struct hotplug_slot
> if (IS_ERR(pci_slot))
> return PTR_ERR(pci_slot);
This prevents multiple hotplug drivers from claiming the same
slot.
+ if (pci_slot->hotplug) {
+ dbg("%s: already claimed\n", __func__);
+ pci_destroy_slot(pci_slot);
+ return -EBUSY;
>
> - result = pci_slot_add_hotplug(bus, slot_nr, hotplug_release);
> - if (result) {
> - pci_destroy_slot(pci_slot);
> - return result;
> - }
> -
> slot->pci_slot = pci_slot;
> pci_slot->hotplug = slot;
>
> @@ -631,8 +619,7 @@ int pci_hp_deregister(struct hotplug_slo
> fs_remove_slot(slot);
> dbg("Removed slot %s from the list\n", hotplug->name);
>
> - hotplug_release(slot);
> - slot->release = NULL;
> + hotplug->release(hotplug);
+ slot->hotplug = NULL;
The above is needed if pci_slot is loaded, and you wish to
repeatedly load/unload acpiphp/pciehp/other hp drivers.
Thanks,
/ac
> pci_destroy_slot(slot);
>
> return 0;
>
>
next prev parent reply other threads:[~2008-03-25 3:08 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-18 21:05 [PATCH 0/3, v10] PCI, ACPI: Physical PCI slot objects Alex Chiang
2008-03-18 21:08 ` [PATCH 1/3] Construct one fakephp slot per pci slot Alex Chiang
2008-03-18 21:09 ` [PATCH 2/3] Introduce pci_slot Alex Chiang
2008-03-18 21:09 ` [PATCH 3/3] ACPI PCI slot detection driver Alex Chiang
2008-03-19 0:55 ` [PATCH 0/3, v10] PCI, ACPI: Physical PCI slot objects Matthew Wilcox
2008-03-19 1:52 ` Alex Chiang
2008-03-19 2:34 ` Kenji Kaneshige
2008-03-19 2:24 ` Kenji Kaneshige
2008-03-21 4:07 ` Kenji Kaneshige
2008-03-21 4:09 ` [PATCH 1/16][BUG] Export kobject_rename for pci_hotplug_core (Not for mainline!) Kenji Kaneshige
2008-03-21 15:56 ` Alex Chiang
2008-03-21 16:15 ` Greg KH
2008-03-21 16:45 ` Alex Chiang
2008-03-21 4:10 ` [PATCH 2/16] ACPI pci_slot: Fix dmi table for Fujitsu PRIMEQUEST " Kenji Kaneshige
2008-03-21 16:04 ` Alex Chiang
2008-03-21 4:11 ` [PATCH 3/16][BUG] ACPI pci_slot: Fix _STA evaluation " Kenji Kaneshige
2008-03-21 16:17 ` Alex Chiang
2008-03-21 4:12 ` [PATCH 4/16][BUG] PCI slot: Add missing semaphore for slot release " Kenji Kaneshige
2008-03-21 16:57 ` Alex Chiang
2008-03-21 4:13 ` [PATCH 5/16] PCI slot: Use list_head for pci slot list " Kenji Kaneshige
2008-03-21 18:40 ` Alex Chiang
2008-03-21 4:14 ` [PATCH 6/16][BUG] ACPI pci_slot: Fix slot removal path " Kenji Kaneshige
2008-03-21 19:42 ` Alex Chiang
2008-03-21 4:14 ` [PATCH 7/16][BUG] PCI slot: Remove compiler warnings " Kenji Kaneshige
2008-03-21 20:01 ` Alex Chiang
2008-03-21 4:15 ` [PATCH 8/16][BUG] PCI slot: Fix invalid memory access " Kenji Kaneshige
2008-03-21 20:01 ` Alex Chiang
2008-03-21 4:16 ` [PATCH 9/16] PCI slot: Remove unused slot member from pci_dev " Kenji Kaneshige
2008-03-21 19:30 ` Matthew Wilcox
2008-03-24 20:29 ` Alex Chiang
2008-03-21 4:17 ` [PATCH 10/16] PCI slot: Replace dbg with pr_debug " Kenji Kaneshige
2008-03-21 19:30 ` Matthew Wilcox
2008-03-21 20:02 ` Alex Chiang
2008-03-21 4:18 ` [PATCH 11/16] PCI slot: Remove useless release handler " Kenji Kaneshige
2008-03-25 3:08 ` Alex Chiang [this message]
2008-03-21 4:19 ` [PATCH 12/16] PCI slot: Use .default_attrs for address file " Kenji Kaneshige
2008-03-21 19:32 ` Matthew Wilcox
2008-03-25 3:31 ` Alex Chiang
2008-03-21 4:23 ` [PATCH 13/16] PCI slot: Fix return value of pci_create_slot() " Kenji Kaneshige
2008-03-25 3:31 ` Alex Chiang
2008-03-21 4:26 ` [PATCH 14/16] PCI slot: Change return value of pci_destroy_slot() " Kenji Kaneshige
2008-03-21 19:32 ` Matthew Wilcox
2008-03-25 3:31 ` Alex Chiang
2008-03-21 4:26 ` [PATCH 15/16] PCI slot: Trivial cleanups for slot.c " Kenji Kaneshige
2008-03-21 19:33 ` Matthew Wilcox
2008-03-25 3:31 ` Alex Chiang
2008-03-21 4:27 ` [PATCH 16/16][BUG] PCI hotplug core: add missing lock for hotplug slot list " Kenji Kaneshige
2008-03-25 3:31 ` Alex Chiang
2008-03-21 15:53 ` [PATCH 0/3, v10] PCI, ACPI: Physical PCI slot objects Alex Chiang
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=20080325030844.GD11575@ldl.fc.hp.com \
--to=achiang@hp.com \
--cc=garyhade@us.ibm.com \
--cc=gregkh@suse.de \
--cc=kaneshige.kenji@jp.fujitsu.com \
--cc=kristen.c.accardi@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@atrey.karlin.mff.cuni.cz \
--cc=matthew@wil.cx \
--cc=rick.jones2@hp.com \
--cc=warthog19@eaglescrag.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox