From: Greg KH Subject: sysfs: make attribute contain a private pointer. Lets us get rid of the bin_attribute's pointer at the same time. This is being done so that sysfs code can determine what attribute is being accessed to allow smaller amounts of kernel code to be written. Based on a patch from Yani Ioannou Signed-off-by: Greg Kroah-Hartman --- drivers/pci/pci-sysfs.c | 4 ++-- include/linux/sysfs.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) --- gregkh-2.6.orig/include/linux/sysfs.h 2005-05-11 00:04:23.000000000 -0700 +++ gregkh-2.6/include/linux/sysfs.h 2005-05-11 00:04:33.000000000 -0700 @@ -18,6 +18,7 @@ struct attribute { const char * name; struct module * owner; + void * private; mode_t mode; }; @@ -53,7 +54,6 @@ struct bin_attribute { struct attribute attr; size_t size; - void *private; ssize_t (*read)(struct kobject *, char *, loff_t, size_t); ssize_t (*write)(struct kobject *, char *, loff_t, size_t); int (*mmap)(struct kobject *, struct bin_attribute *attr, --- gregkh-2.6.orig/drivers/pci/pci-sysfs.c 2005-05-11 00:04:23.000000000 -0700 +++ gregkh-2.6/drivers/pci/pci-sysfs.c 2005-05-11 00:04:33.000000000 -0700 @@ -299,7 +299,7 @@ { struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj)); - struct resource *res = (struct resource *)attr->private; + struct resource *res = (struct resource *)attr->attr.private; enum pci_mmap_state mmap_type; vma->vm_pgoff += res->start >> PAGE_SHIFT; @@ -337,9 +337,9 @@ res_attr->attr.name = res_attr_name; res_attr->attr.mode = S_IRUSR | S_IWUSR; res_attr->attr.owner = THIS_MODULE; + res_attr->attr.private = &pdev->resource[i]; res_attr->size = pci_resource_len(pdev, i); res_attr->mmap = pci_mmap_resource; - res_attr->private = &pdev->resource[i]; sysfs_create_bin_file(&pdev->dev.kobj, res_attr); } }