diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/device.h | 41 | ||||
| -rw-r--r-- | include/linux/i2c-id.h | 12 | ||||
| -rw-r--r-- | include/linux/module.h | 19 | ||||
| -rw-r--r-- | include/linux/sysfs.h | 21 |
4 files changed, 68 insertions, 25 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 2b8b3d636889..3f6e14c099e2 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -54,6 +54,9 @@ struct bus_type { struct kset drivers; struct kset devices; + struct bus_attribute * bus_attrs; + struct device_attribute * dev_attrs; + int (*match)(struct device * dev, struct device_driver * drv); struct device * (*add) (struct device * parent, char * bus_id); int (*hotplug) (struct device *dev, char **envp, @@ -90,11 +93,7 @@ struct bus_attribute { }; #define BUS_ATTR(_name,_mode,_show,_store) \ -struct bus_attribute bus_attr_##_name = { \ - .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE }, \ - .show = _show, \ - .store = _store, \ -}; +struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store) extern int bus_create_file(struct bus_type *, struct bus_attribute *); extern void bus_remove_file(struct bus_type *, struct bus_attribute *); @@ -131,11 +130,7 @@ struct driver_attribute { }; #define DRIVER_ATTR(_name,_mode,_show,_store) \ -struct driver_attribute driver_attr_##_name = { \ - .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE }, \ - .show = _show, \ - .store = _store, \ -}; +struct driver_attribute driver_attr_##_name = __ATTR(_name,_mode,_show,_store) extern int driver_create_file(struct device_driver *, struct driver_attribute *); extern void driver_remove_file(struct device_driver *, struct driver_attribute *); @@ -151,6 +146,9 @@ struct class { struct list_head children; struct list_head interfaces; + struct class_attribute * class_attrs; + struct class_device_attribute * class_dev_attrs; + int (*hotplug)(struct class_device *dev, char **envp, int num_envp, char *buffer, int buffer_size); @@ -172,11 +170,7 @@ struct class_attribute { }; #define CLASS_ATTR(_name,_mode,_show,_store) \ -struct class_attribute class_attr_##_name = { \ - .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE }, \ - .show = _show, \ - .store = _store, \ -}; +struct class_attribute class_attr_##_name = __ATTR(_name,_mode,_show,_store) extern int class_create_file(struct class *, const struct class_attribute *); extern void class_remove_file(struct class *, const struct class_attribute *); @@ -224,11 +218,8 @@ struct class_device_attribute { }; #define CLASS_DEVICE_ATTR(_name,_mode,_show,_store) \ -struct class_device_attribute class_device_attr_##_name = { \ - .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE }, \ - .show = _show, \ - .store = _store, \ -}; +struct class_device_attribute class_device_attr_##_name = \ + __ATTR(_name,_mode,_show,_store) extern int class_device_create_file(struct class_device *, const struct class_device_attribute *); @@ -342,11 +333,7 @@ struct device_attribute { }; #define DEVICE_ATTR(_name,_mode,_show,_store) \ -struct device_attribute dev_attr_##_name = { \ - .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE }, \ - .show = _show, \ - .store = _store, \ -}; +struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store) extern int device_create_file(struct device *device, struct device_attribute * entry); @@ -390,6 +377,10 @@ extern void platform_device_unregister(struct platform_device *); extern struct bus_type platform_bus_type; extern struct device platform_bus; +extern struct resource *platform_get_resource(struct platform_device *, unsigned int, unsigned int); +extern int platform_get_irq(struct platform_device *, unsigned int); +extern int platform_add_devices(struct platform_device **, int); + /* drivers/base/power.c */ extern void device_shutdown(void); diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h index 591e7ad68d30..520fe7220cd3 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h @@ -101,6 +101,14 @@ #define I2C_DRIVERID_UDA1342 53 /* UDA1342 audio codec */ #define I2C_DRIVERID_ADV7170 54 /* video encoder */ #define I2C_DRIVERID_RADEON 55 /* I2C bus on Radeon boards */ +#define I2C_DRIVERID_MAX1617 56 /* temp sensor */ +#define I2C_DRIVERID_SAA7191 57 /* video encoder */ +#define I2C_DRIVERID_INDYCAM 58 /* SGI IndyCam */ +#define I2C_DRIVERID_BT832 59 /* CMOS camera video processor */ +#define I2C_DRIVERID_TDA9887 60 /* TDA988x IF-PLL demodulator */ +#define I2C_DRIVERID_OVCAMCHIP 61 /* OmniVision CMOS image sens. */ +#define I2C_DRIVERID_TDA7313 62 /* TDA7313 audio processor */ +#define I2C_DRIVERID_MAX6900 63 /* MAX6900 real-time clock */ #define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */ @@ -264,6 +272,10 @@ #define I2C_HW_SMBUS_SCX200 0x0b #define I2C_HW_SMBUS_NFORCE2 0x0c #define I2C_HW_SMBUS_W9968CF 0x0d +#define I2C_HW_SMBUS_OV511 0x0e /* OV511(+) USB 1.1 webcam ICs */ +#define I2C_HW_SMBUS_OV518 0x0f /* OV518(+) USB 1.1 webcam ICs */ +#define I2C_HW_SMBUS_OV519 0x10 /* OV519 USB 1.1 webcam IC */ +#define I2C_HW_SMBUS_OVFX2 0x11 /* Cypress/OmniVision FX2 webcam */ /* --- ISA pseudo-adapter */ #define I2C_HW_ISA 0x00 diff --git a/include/linux/module.h b/include/linux/module.h index 2709330e8684..2ad187c3bda1 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -225,6 +225,22 @@ struct module_kobject struct module_attribute attr[0]; }; +/* Similar stuff for section attributes. */ +#define MODULE_SECT_NAME_LEN 32 +struct module_sect_attr +{ + struct attribute attr; + char name[MODULE_SECT_NAME_LEN]; + unsigned long address; +}; + +struct module_sections +{ + struct kobject kobj; + struct module_sect_attr attrs[0]; +}; + + struct module { enum module_state state; @@ -298,6 +314,9 @@ struct module Elf_Sym *symtab; unsigned long num_symtab; char *strtab; + + /* Section attributes */ + struct module_sections *sect_attrs; #endif /* Per-cpu data. */ diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 4cb54379e85a..f94c7ac77c48 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h @@ -24,6 +24,27 @@ struct attribute_group { }; + +/** + * Use these macros to make defining attributes easier. See include/linux/device.h + * for examples.. + */ + +#define __ATTR(_name,_mode,_show,_store) { \ + .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE }, \ + .show = _show, \ + .store = _store, \ +} + +#define __ATTR_RO(_name) { \ + .attr = { .name = __stringify(_name), .mode = 0444, .owner = THIS_MODULE }, \ + .show = _name##_show, \ +} + +#define __ATTR_NULL { .attr = { .name = NULL } } + +#define attr_name(_attr) (_attr).attr.name + struct bin_attribute { struct attribute attr; size_t size; |
