Skip to content

Commit

Permalink
PCI: remove foolish code from pci-driver.c
Browse files Browse the repository at this point in the history
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: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Greg Kroah-Hartman committed Jan 25, 2008
1 parent 03d43b1 commit 2b93730
Showing 1 changed file with 5 additions and 45 deletions.
50 changes: 5 additions & 45 deletions drivers/pci/pci-driver.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/*
* 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>
Expand Down Expand Up @@ -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
Expand All @@ -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);
Expand Down

0 comments on commit 2b93730

Please sign in to comment.