LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: MUNEDA Takahiro <muneda.takahiro@jp.fujitsu.com>
To: Alex Chiang <achiang@hp.com>
Cc: Greg KH <gregkh@suse.de>, Matthew Wilcox <matthew@wil.cx>,
	Gary Hade <garyhade@us.ibm.com>,
	kaneshige.kenji@jp.fujitsu.com, warthog19@eaglescrag.net,
	kristen.c.accardi@intel.com, rick.jones2@hp.com,
	linux-kernel@vger.kernel.org, linux-pci@atrey.karlin.mff.cuni.cz,
	linux-acpi@vger.kernel.org
Subject: Re: [PATCH 2/3] Introduce pci_slot
Date: Wed, 05 Mar 2008 10:12:22 +0900	[thread overview]
Message-ID: <87y78y0ya1.wl%muneda.takahiro@jp.fujitsu.com> (raw)
In-Reply-To: <20080305004840.GL3694@ldl.fc.hp.com>

At Tue, 4 Mar 2008 17:48:40 -0700,
Alex Chiang <achiang@hp.com> wrote:
> 
> +struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
> +				 const char *name)
> +{
> +	struct pci_slot *slot;
> +	int err;
> +
> +	down_write(&pci_bus_sem);
> +
> +	/* If we've already created this slot, bump refcount and return. */
> +	for (slot = parent->slot; slot; slot = slot->next) {
> +		if (slot->number == slot_nr) {
> +			kobject_get(&slot->kobj);
> +			dbg("%s: bumped refcount to %d on %x:%d\n",
> +				__FUNCTION__, slot->kobj.kref.refcount,
> +				parent->number, slot_nr);
> +			goto out;
> +		}
> +	}
> +
> +	slot = kzalloc(sizeof(*slot), GFP_KERNEL);
> +	if (!slot) {
> +		slot = ERR_PTR(-ENOMEM);
> +		goto out;
> +	}
> +
> +	slot->bus = parent;
> +	slot->number = slot_nr;
> +
> +	slot->kobj.kset = pci_slots_kset;
> +	err = kobject_init_and_add(&slot->kobj, &pci_slot_ktype, NULL,
> +				   "%s", name);
> +	if (err) {
> +		printk(KERN_ERR "Unable to register kobject %s", name);

Add '\n', please.

> +		err = -EINVAL;
> +		goto err;
> +	}
> +
> +	err = create_sysfs_files(slot);
> +	if (err)
> +		goto unregister;
> +
> +	slot->next = parent->slot;
> +	parent->slot = slot;
> +
> +	dbg("%s: created pci_slot on %x:%d\n",
> +		__FUNCTION__, parent->number, slot_nr);
> +
> + out:
> +	up_write(&pci_bus_sem);
> +	return slot;
> +
> + unregister:
> +	kobject_put(&slot->kobj);
> + err:
> +	kfree(slot);
> +	slot = ERR_PTR(err);
> +	goto out;
> +}
> +EXPORT_SYMBOL_GPL(pci_create_slot);
> +
> +int pci_destroy_slot(struct pci_slot *slot)
> +{
> +	kobject_put(&slot->kobj);
> +
> +	dbg("%s: decreased refcount to %d on %x:%d\n", __FUNCTION__,
> +		slot->kobj.kref.refcount, slot->bus->number, slot->number);
> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(pci_destroy_slot);
> +
> +static int pci_slot_init(void)
> +{
> +	int result = 0;
> +	struct kset *pci_bus_kset;
> +
> +	pci_bus_kset = bus_get_kset(&pci_bus_type);
> +
> +	pci_slots_kset = kset_create_and_add("slots", NULL,
> +						&pci_bus_kset->kobj);
> +	if (!pci_slots_kset) {
> +		result = -ENOMEM;
> +		printk(KERN_ERR "PCI: Slot initialisation failure (%d)",
> +			result);

Ditto.

And 'initialisation' -> 'initialization' ?

> +	}
> +	return result;
> +}
> +
> +subsys_initcall(pci_slot_init);

Thanks,
MUNE

  reply	other threads:[~2008-03-05  1:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-05  0:42 [PATCH 0/3, v8] PCI, ACPI: Physical PCI slot objects Alex Chiang
2008-03-05  0:48 ` [PATCH 1/3] Construct one fakephp slot per pci slot Alex Chiang
2008-03-05  0:48 ` [PATCH 2/3] Introduce pci_slot Alex Chiang
2008-03-05  1:12   ` MUNEDA Takahiro [this message]
2008-03-05  0:49 ` [PATCH 3/3] ACPI PCI slot detection driver Alex Chiang
2008-03-05  4:47 ` [PATCH 0/3, v8] PCI, ACPI: Physical PCI slot objects Greg KH
2008-03-06 17:49 ` Gary Hade
2008-03-18 21:05 [PATCH 0/3, v10] " Alex Chiang
2008-03-18 21:09 ` [PATCH 2/3] Introduce pci_slot Alex Chiang
2008-06-09 22:22 [PATCH 0/3, v15] PCI, ACPI: Physical PCI slot objects Alex Chiang
2008-06-09 22:25 ` [PATCH 2/3] Introduce pci_slot Alex Chiang
2008-06-10 21:25 [PATCH 0/3, v16] PCI, ACPI: Physical PCI slot objects Alex Chiang
2008-06-10 21:28 ` [PATCH 2/3] Introduce pci_slot 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=87y78y0ya1.wl%muneda.takahiro@jp.fujitsu.com \
    --to=muneda.takahiro@jp.fujitsu.com \
    --cc=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 \
    --subject='Re: [PATCH 2/3] Introduce pci_slot' \
    /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

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).