From 2ce5e0bca93f06683b40fbae3b5b4031dd02b2cc Mon Sep 17 00:00:00 2001 From: Patrick Mochel Date: Thu, 21 Nov 2002 05:01:54 -0600 Subject: Allow subsystem to have attributes, too. This is really handy for subsystems that have any attributes they want to export, esp. if they have just a few, since they don't have to define all of the infrastructure for creating and tearing down the attributes for the high level type that they are. - define struct subsys_attribute for declaring attributes of subsystems themselves. - define subsys_create_file() and subsys_remove_file(). - define subsys_sysfs_ops for forwarding sysfs reads and writes to the subsystem attribute callbacks. - Set the sysfs_ops to be the subsystem ones if the kobject doesn't belong to a subsystem itself (meaning that it is a subsystem). --- include/linux/kobject.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 7b3157a78f7e..6b528c5a61cb 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h @@ -60,4 +60,13 @@ static inline void subsys_put(struct subsystem * s) kobject_put(&s->kobj); } +struct subsys_attribute { + struct attribute attr; + ssize_t (*show)(struct subsystem *, char *, size_t, loff_t); + ssize_t (*store)(struct subsystem *, const char *, size_t, loff_t); +}; + +extern int subsys_create_file(struct subsystem * , struct subsys_attribute *); +extern void subsys_remove_file(struct subsystem * , struct subsys_attribute *); + #endif /* _KOBJECT_H_ */ -- cgit v1.2.3 From 8ab1bc19e974fdebe76c065fe444979c84ba2f74 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Fri, 22 Nov 2002 04:39:35 -0600 Subject: move dma_mask into struct device Attached is a patch which moves dma_mask into struct device and cleans up the scsi mid-layer to use it (instead of using struct pci_dev). The advantage to doing this is probably most apparent on non-pci bus architectures where currently you have to construct a fake pci_dev just so you can get the bounce buffers to work correctly. The patch tries to perturb the minimum amount of code, so dma_mask in struct device is simply a pointer to the one in pci_dev. However, it will make it easy for me now to add generic device to MCA without having to go the fake pci route. --- drivers/pci/probe.c | 1 + include/linux/device.h | 1 + 2 files changed, 2 insertions(+) (limited to 'include') diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 5dfb1af81376..cfe5444f9fac 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -448,6 +448,7 @@ struct pci_dev * __devinit pci_scan_device(struct pci_dev *temp) /* now put in global tree */ strcpy(dev->dev.bus_id,dev->slot_name); + dev->dev.dma_mask = &dev->dma_mask; device_register(&dev->dev); return dev; diff --git a/include/linux/device.h b/include/linux/device.h index 6ce7d11cc8f9..44262d7f34c3 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -303,6 +303,7 @@ struct device { being off. */ unsigned char *saved_state; /* saved device state */ + u64 *dma_mask; /* dma mask (if dma'able device) */ void (*release)(struct device * dev); }; -- cgit v1.2.3