提交 2b937303 编写于 作者: G Greg Kroah-Hartman

PCI: remove foolish code from pci-driver.c

The PCI bus should not be trying to declare its own attribute type.
Especially as this code could never ever be called because the driver
core overwrites the driver kobject type to be its own internal type.
Delete all of this code as it was never being used and is not correct.

Also update my copyright on the file while I'm touching things there.
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 03d43b19
/*
* drivers/pci/pci-driver.c
*
* (C) Copyright 2002-2004, 2007 Greg Kroah-Hartman <greg@kroah.com>
* (C) Copyright 2007 Novell Inc.
*
* Released under the GPL v2 only.
*
*/
#include <linux/pci.h>
......@@ -356,50 +361,6 @@ static void pci_device_shutdown(struct device *dev)
drv->shutdown(pci_dev);
}
#define kobj_to_pci_driver(obj) container_of(obj, struct device_driver, kobj)
#define attr_to_driver_attribute(obj) container_of(obj, struct driver_attribute, attr)
static ssize_t
pci_driver_attr_show(struct kobject * kobj, struct attribute *attr, char *buf)
{
struct device_driver *driver = kobj_to_pci_driver(kobj);
struct driver_attribute *dattr = attr_to_driver_attribute(attr);
ssize_t ret;
if (!get_driver(driver))
return -ENODEV;
ret = dattr->show ? dattr->show(driver, buf) : -EIO;
put_driver(driver);
return ret;
}
static ssize_t
pci_driver_attr_store(struct kobject * kobj, struct attribute *attr,
const char *buf, size_t count)
{
struct device_driver *driver = kobj_to_pci_driver(kobj);
struct driver_attribute *dattr = attr_to_driver_attribute(attr);
ssize_t ret;
if (!get_driver(driver))
return -ENODEV;
ret = dattr->store ? dattr->store(driver, buf, count) : -EIO;
put_driver(driver);
return ret;
}
static struct sysfs_ops pci_driver_sysfs_ops = {
.show = pci_driver_attr_show,
.store = pci_driver_attr_store,
};
static struct kobj_type pci_driver_kobj_type = {
.sysfs_ops = &pci_driver_sysfs_ops,
};
/**
* __pci_register_driver - register a new pci driver
* @drv: the driver structure to register
......@@ -421,7 +382,6 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner,
drv->driver.bus = &pci_bus_type;
drv->driver.owner = owner;
drv->driver.mod_name = mod_name;
drv->driver.kobj.ktype = &pci_driver_kobj_type;
spin_lock_init(&drv->dynids.lock);
INIT_LIST_HEAD(&drv->dynids.list);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册