linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / pci / pci-sysfs.c
index a9c7d41..965a593 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 
+#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/pci.h>
 #include <linux/stat.h>
@@ -42,29 +43,6 @@ pci_config_attr(subsystem_vendor, "0x%04x\n");
 pci_config_attr(subsystem_device, "0x%04x\n");
 pci_config_attr(class, "0x%06x\n");
 pci_config_attr(irq, "%u\n");
-pci_config_attr(is_enabled, "%u\n");
-
-static ssize_t broken_parity_status_show(struct device *dev,
-                                        struct device_attribute *attr,
-                                        char *buf)
-{
-       struct pci_dev *pdev = to_pci_dev(dev);
-       return sprintf (buf, "%u\n", pdev->broken_parity_status);
-}
-
-static ssize_t broken_parity_status_store(struct device *dev,
-                                         struct device_attribute *attr,
-                                         const char *buf, size_t count)
-{
-       struct pci_dev *pdev = to_pci_dev(dev);
-       ssize_t consumed = -EINVAL;
-
-       if ((count > 0) && (*buf == '0' || *buf == '1')) {
-               pdev->broken_parity_status = *buf == '1' ? 1 : 0;
-               consumed = count;
-       }
-       return consumed;
-}
 
 static ssize_t local_cpus_show(struct device *dev,
                        struct device_attribute *attr, char *buf)
@@ -86,7 +64,7 @@ resource_show(struct device * dev, struct device_attribute *attr, char * buf)
        char * str = buf;
        int i;
        int max = 7;
-       resource_size_t start, end;
+       u64 start, end;
 
        if (pci_dev->subordinate)
                max = DEVICE_COUNT_RESOURCE;
@@ -112,25 +90,6 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
                       (u8)(pci_dev->class >> 16), (u8)(pci_dev->class >> 8),
                       (u8)(pci_dev->class));
 }
-static ssize_t
-is_enabled_store(struct device *dev, struct device_attribute *attr,
-               const char *buf, size_t count)
-{
-       struct pci_dev *pdev = to_pci_dev(dev);
-
-       /* this can crash the machine when done on the "wrong" device */
-       if (!capable(CAP_SYS_ADMIN))
-               return count;
-
-       if (*buf == '0')
-               pci_disable_device(pdev);
-
-       if (*buf == '1')
-               pci_enable_device(pdev);
-
-       return count;
-}
-
 
 struct device_attribute pci_dev_attrs[] = {
        __ATTR_RO(resource),
@@ -142,9 +101,6 @@ struct device_attribute pci_dev_attrs[] = {
        __ATTR_RO(irq),
        __ATTR_RO(local_cpus),
        __ATTR_RO(modalias),
-       __ATTR(enable, 0600, is_enabled_show, is_enabled_store),
-       __ATTR(broken_parity_status,(S_IRUGO|S_IWUSR),
-               broken_parity_status_show,broken_parity_status_store),
        __ATTR_NULL,
 };
 
@@ -364,7 +320,7 @@ pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
                                                       struct device, kobj));
        struct resource *res = (struct resource *)attr->private;
        enum pci_mmap_state mmap_type;
-       resource_size_t start, end;
+       u64 start, end;
        int i;
 
        for (i = 0; i < PCI_ROM_RESOURCE; i++)
@@ -545,8 +501,9 @@ int pci_create_sysfs_dev_files (struct pci_dev *pdev)
        if (pci_resource_len(pdev, PCI_ROM_RESOURCE)) {
                struct bin_attribute *rom_attr;
                
-               rom_attr = kzalloc(sizeof(*rom_attr), GFP_ATOMIC);
+               rom_attr = kmalloc(sizeof(*rom_attr), GFP_ATOMIC);
                if (rom_attr) {
+                       memset(rom_attr, 0x00, sizeof(*rom_attr));
                        pdev->rom_attr = rom_attr;
                        rom_attr->size = pci_resource_len(pdev, PCI_ROM_RESOURCE);
                        rom_attr->attr.name = "rom";
@@ -571,9 +528,6 @@ int pci_create_sysfs_dev_files (struct pci_dev *pdev)
  */
 void pci_remove_sysfs_dev_files(struct pci_dev *pdev)
 {
-       if (!sysfs_initialized)
-               return;
-
        if (pdev->cfg_size < 4096)
                sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr);
        else