public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
To: Alex Chiang <achiang@hp.com>,
	Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>,
	jbarnes@virtuousgeek.org,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Matthew Wilcox <matthew@wil.cx>,
	Andrew Morton <akpm@linux-foundation.org>,
	kristen.c.accardi@intel.com, greg@kroah.com, lenb@kernel.org,
	pbadari@us.ibm.com, linux-pci@vger.kernel.org,
	pcihpd-discuss@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/4, v14] PCI, ACPI: Physical PCI slot objects
Date: Thu, 05 Jun 2008 12:20:54 +0900	[thread overview]
Message-ID: <48475B96.1030102@jp.fujitsu.com> (raw)
In-Reply-To: <20080605030728.GA11528@ldl.fc.hp.com>

Alex-san,

Thank you for updated patch. I'll try it.
Unfortunately, I'm a little busy on the other jobs, so the test
report might be delayed until the beginning of next week.

Thanks,
Kenji Kaneshige


Alex Chiang wrote:
> Hi Kenji-san,
> 
> * Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>:
>> I tried to test your patch using latest linux-next, but I could
>> not apply your patch with the following messages:
> 
> Sorry, that latest patch series was against Linus' tree, not
> linux-next.
> 
>> I think maybe your patch is conflicting with the following patch.
>>
>> commit 372fa8fa0a77c47c7bcfae0ccd14e0c5f97d17fe
>> Author: Kay Sievers <kay.sievers@vrfy.org>
>> Date:   Fri May 2 06:02:41 2008 +0200
>>
>>    driver-core: prepare for removal of 20 char limit from struct device
>>
>>    The access of struct device->bus_id is replaced by dev_name(), to
>>    be able to use the non-limited kobject name after the conversion
>>    of the device register callers.
> 
> Yes, thanks for pointing this out. I've fixed patch 1/4.
> 
> I verified that patches 2, 3 and 4 apply cleanly against
> linux-next, so this should be the only fix you'll need.
> 
> Sorry for the confusion.
> 
> /ac
> 
> commit c0175afea14cdaff3c33d894eb474eed1dcfa65d
> Author: Alex Chiang <achiang@hp.com>
> Date:   Wed Jun 4 21:04:46 2008 -0600
> 
>     Construct one fakephp slot per PCI slot
>     
>     Register one slot per slot, rather than one slot per function.  Change the
>     name of the slot to fake%d instead of the pci address.
>     
>     Signed-off-by: Alex Chiang <achiang@hp.com>
>     Signed-off-by: Matthew Wilcox <matthew@wil.cx>
>     Cc: Greg KH <greg@kroah.com>
>     Cc: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
>     Cc: Len Brown <lenb@kernel.org>
>     Cc: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
>     Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> 
> diff --git a/drivers/pci/hotplug/fakephp.c b/drivers/pci/hotplug/fakephp.c
> index d3393f4..e066959 100644
> --- a/drivers/pci/hotplug/fakephp.c
> +++ b/drivers/pci/hotplug/fakephp.c
> @@ -66,6 +66,7 @@ struct dummy_slot {
>  	struct pci_dev *dev;
>  	struct work_struct remove_work;
>  	unsigned long removed;
> +	char name[8];
>  };
>  
>  static int debug;
> @@ -101,6 +102,7 @@ static int add_slot(struct pci_dev *dev)
>  	struct dummy_slot *dslot;
>  	struct hotplug_slot *slot;
>  	int retval = -ENOMEM;
> +	static int count = 1;
>  
>  	slot = kzalloc(sizeof(struct hotplug_slot), GFP_KERNEL);
>  	if (!slot)
> @@ -114,15 +116,13 @@ static int add_slot(struct pci_dev *dev)
>  	slot->info->max_bus_speed = PCI_SPEED_UNKNOWN;
>  	slot->info->cur_bus_speed = PCI_SPEED_UNKNOWN;
>  
> -	slot->name = kstrdup(dev_name(&dev->dev), GFP_KERNEL);
> -	if (!slot->name)
> -		goto error_info;
> -	dbg("slot->name = %s\n", slot->name);
> -
>  	dslot = kzalloc(sizeof(struct dummy_slot), GFP_KERNEL);
>  	if (!dslot)
> -		goto error_name;
> +		goto error_info;
>  
> +	slot->name = dslot->name;
> +	snprintf(slot->name, sizeof(dslot->name), "fake%d", count++);
> +	dbg("slot->name = %s\n", slot->name);
>  	slot->ops = &dummy_hotplug_slot_ops;
>  	slot->release = &dummy_release;
>  	slot->private = dslot;
> @@ -140,8 +140,6 @@ static int add_slot(struct pci_dev *dev)
>  
>  error_dslot:
>  	kfree(dslot);
> -error_name:
> -	kfree(slot->name);
>  error_info:
>  	kfree(slot->info);
>  error_slot:
> @@ -153,17 +151,17 @@ error:
>  static int __init pci_scan_buses(void)
>  {
>  	struct pci_dev *dev = NULL;
> -	int retval = 0;
> +	int lastslot = 0;
>  
>  	while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
> -		retval = add_slot(dev);
> -		if (retval) {
> -			pci_dev_put(dev);
> -			break;
> -		}
> +		if (PCI_FUNC(dev->devfn) > 0 &&
> +				lastslot == PCI_SLOT(dev->devfn))
> +			continue;
> +		lastslot = PCI_SLOT(dev->devfn);
> +		add_slot(dev);
>  	}
>  
> -	return retval;
> +	return 0;
>  }
>  
>  static void remove_slot(struct dummy_slot *dslot)
> @@ -301,23 +299,9 @@ static int enable_slot(struct hotplug_slot *hotplug_slot)
>  	return 0;
>  }
>  
> -/* find the hotplug_slot for the pci_dev */
> -static struct hotplug_slot *get_slot_from_dev(struct pci_dev *dev)
> -{
> -	struct dummy_slot *dslot;
> -
> -	list_for_each_entry(dslot, &slot_list, node) {
> -		if (dslot->dev == dev)
> -			return dslot->slot;
> -	}
> -	return NULL;
> -}
> -
> -
>  static int disable_slot(struct hotplug_slot *slot)
>  {
>  	struct dummy_slot *dslot;
> -	struct hotplug_slot *hslot;
>  	struct pci_dev *dev;
>  	int func;
>  
> @@ -327,41 +311,27 @@ static int disable_slot(struct hotplug_slot *slot)
>  
>  	dbg("%s - physical_slot = %s\n", __func__, slot->name);
>  
> -	/* don't disable bridged devices just yet, we can't handle them easily... */
> -	if (dslot->dev->subordinate) {
> -		err("Can't remove PCI devices with other PCI devices behind it yet.\n");
> -		return -ENODEV;
> -	}
> -	if (test_and_set_bit(0, &dslot->removed)) {
> -		dbg("Slot already scheduled for removal\n");
> -		return -ENODEV;
> -	}
> -	/* search for subfunctions and disable them first */
> -	if (!(dslot->dev->devfn & 7)) {
> -		for (func = 1; func < 8; func++) {
> -			dev = pci_get_slot(dslot->dev->bus,
> -					dslot->dev->devfn + func);
> -			if (dev) {
> -				hslot = get_slot_from_dev(dev);
> -				if (hslot)
> -					disable_slot(hslot);
> -				else {
> -					err("Hotplug slot not found for subfunction of PCI device\n");
> -					return -ENODEV;
> -				}
> -				pci_dev_put(dev);
> -			} else
> -				dbg("No device in slot found\n");
> +	for (func = 7; func >= 0; func--) {
> +		dev = pci_get_slot(dslot->dev->bus, dslot->dev->devfn + func);
> +		if (!dev)
> +			continue;
> +
> +		if (test_and_set_bit(0, &dslot->removed)) {
> +			dbg("Slot already scheduled for removal\n");
> +			return -ENODEV;
>  		}
> -	}
>  
> -	/* remove the device from the pci core */
> -	pci_remove_bus_device(dslot->dev);
> +		/* queue work item to blow away this sysfs entry and other
> +		 * parts.
> +		 */
> +		INIT_WORK(&dslot->remove_work, remove_slot_worker);
> +		queue_work(dummyphp_wq, &dslot->remove_work);
>  
> -	/* queue work item to blow away this sysfs entry and other parts. */
> -	INIT_WORK(&dslot->remove_work, remove_slot_worker);
> -	queue_work(dummyphp_wq, &dslot->remove_work);
> +		/* blow away this sysfs entry and other parts. */
> +		remove_slot(dslot);
>  
> +		pci_dev_put(dev);
> +	}
>  	return 0;
>  }
>  
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 



  reply	other threads:[~2008-06-05  3:25 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-04 20:08 [PATCH 0/4, v14] PCI, ACPI: Physical PCI slot objects Alex Chiang
2008-06-04 20:14 ` [PATCH] fakephp: Construct one fakephp slot per PCI slot Alex Chiang
2008-06-04 20:16 ` [PATCH] kobject: Export kobject_rename for pci_hotplug_core Alex Chiang
2008-06-04 23:55   ` Greg KH
2008-06-05  5:48   ` Andrew Morton
2008-06-05  6:05     ` Kenji Kaneshige
2008-06-05  6:33       ` Andrew Morton
2008-06-05 15:11         ` Alex Chiang
2008-06-06  4:07           ` Benjamin Herrenschmidt
2008-06-06  4:51             ` Alex Chiang
2008-06-06 23:20               ` Benjamin Herrenschmidt
2008-06-04 20:16 ` [PATCH] PCI: Introduce pci_slot Alex Chiang
2008-06-04 20:18 ` [PATCH] ACPI: PCI slot detection driver Alex Chiang
2008-06-10 18:24   ` Len Brown
2008-06-10 21:17     ` Alex Chiang
2008-06-05  2:32 ` [PATCH 0/4, v14] PCI, ACPI: Physical PCI slot objects Kenji Kaneshige
2008-06-05  3:07   ` Alex Chiang
2008-06-05  3:20     ` Kenji Kaneshige [this message]
2008-06-09  8:08 ` Kenji Kaneshige
2008-06-09 22:11   ` Alex Chiang
2008-06-10  3:04     ` Kenji Kaneshige
2008-06-10  3:12       ` Kenji Kaneshige
2008-06-10 19:24         ` Jesse Barnes
2008-06-10 21:19           ` Alex Chiang
2008-06-10 17:34       ` Alex Chiang
2008-06-11  1:48         ` Kenji Kaneshige
2008-06-11  2:53           ` Alex Chiang
2008-06-11  6:29             ` Kenji Kaneshige

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=48475B96.1030102@jp.fujitsu.com \
    --to=kaneshige.kenji@jp.fujitsu.com \
    --cc=achiang@hp.com \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=greg@kroah.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=kristen.c.accardi@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=pbadari@us.ibm.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox