lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 05 Mar 2008 10:12:22 +0900
From:	MUNEDA Takahiro <muneda.takahiro@...fujitsu.com>
To:	Alex Chiang <achiang@...com>
Cc:	Greg KH <gregkh@...e.de>, Matthew Wilcox <matthew@....cx>,
	Gary Hade <garyhade@...ibm.com>,
	kaneshige.kenji@...fujitsu.com, warthog19@...lescrag.net,
	kristen.c.accardi@...el.com, rick.jones2@...com,
	linux-kernel@...r.kernel.org, linux-pci@...ey.karlin.mff.cuni.cz,
	linux-acpi@...r.kernel.org
Subject: Re: [PATCH 2/3] Introduce pci_slot

At Tue, 4 Mar 2008 17:48:40 -0700,
Alex Chiang <achiang@...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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ