/* Adds the driver structure to the list of registered drivers. Returns a negative value on error, otherwise 0. If no error occurred, the driver remains registered even if no device was claimed during registration.  */
int __pci_register_driver(struct pci_driver *drv, struct module *owner, const char *mod_name)
/* Adds the driver structure to the list of registered drivers. Returns a negative value on error, otherwise 0. If no error occurred, the driver remains registered even if no device was claimed during registration.  */
int __pci_register_driver(struct pci_driver *drv, struct module *owner, const char *mod_name)
{
	int error;
	drv->driver.name = drv->name;
	drv->driver.bus = &pci_bus_type;
	drv->driver.owner = owner;
	drv->driver.mod_name = mod_name;
	spin_lock_init(&drv->dynids.lock);
	INIT_LIST_HEAD(&drv->dynids.list);
	error = driver_register(&drv->driver);
	if (error)
		goto out;
	error = pci_create_newid_file(drv);
	if (error)
		goto out_newid;
	error = pci_create_removeid_file(drv);
	if (error)
		goto out_removeid;
out:
	return error;
out_removeid:
	pci_remove_newid_file(drv);
out_newid:
	driver_unregister(&drv->driver);
	goto out;
}