diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2013-03-17 22:40:50 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2013-03-17 22:40:50 -0400 |
commit | 688d794c4c3f8b08c814381ee2edd3ede5856056 (patch) | |
tree | ef680add71e2a9588d07d8b594edbc1b5cd127d7 /include/linux/device.h | |
parent | 16142655269aaf580488e074eabfdcf0fb4e3687 (diff) | |
parent | a937536b868b8369b98967929045f1df54234323 (diff) |
Merge tag 'v3.9-rc3' into next
Merge with mainline to bring in module_platform_driver_probe() and
devm_ioremap_resource().
Diffstat (limited to 'include/linux/device.h')
-rw-r--r-- | include/linux/device.h | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 854b247bf5f9..4fd899bd2c0d 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/compiler.h> | 21 | #include <linux/compiler.h> |
22 | #include <linux/types.h> | 22 | #include <linux/types.h> |
23 | #include <linux/mutex.h> | 23 | #include <linux/mutex.h> |
24 | #include <linux/pinctrl/devinfo.h> | ||
24 | #include <linux/pm.h> | 25 | #include <linux/pm.h> |
25 | #include <linux/atomic.h> | 26 | #include <linux/atomic.h> |
26 | #include <linux/ratelimit.h> | 27 | #include <linux/ratelimit.h> |
@@ -190,6 +191,7 @@ extern struct klist *bus_get_device_klist(struct bus_type *bus); | |||
190 | * @mod_name: Used for built-in modules. | 191 | * @mod_name: Used for built-in modules. |
191 | * @suppress_bind_attrs: Disables bind/unbind via sysfs. | 192 | * @suppress_bind_attrs: Disables bind/unbind via sysfs. |
192 | * @of_match_table: The open firmware table. | 193 | * @of_match_table: The open firmware table. |
194 | * @acpi_match_table: The ACPI match table. | ||
193 | * @probe: Called to query the existence of a specific device, | 195 | * @probe: Called to query the existence of a specific device, |
194 | * whether this driver can work with it, and bind the driver | 196 | * whether this driver can work with it, and bind the driver |
195 | * to a specific device. | 197 | * to a specific device. |
@@ -223,6 +225,7 @@ struct device_driver { | |||
223 | bool suppress_bind_attrs; /* disables bind/unbind via sysfs */ | 225 | bool suppress_bind_attrs; /* disables bind/unbind via sysfs */ |
224 | 226 | ||
225 | const struct of_device_id *of_match_table; | 227 | const struct of_device_id *of_match_table; |
228 | const struct acpi_device_id *acpi_match_table; | ||
226 | 229 | ||
227 | int (*probe) (struct device *dev); | 230 | int (*probe) (struct device *dev); |
228 | int (*remove) (struct device *dev); | 231 | int (*remove) (struct device *dev); |
@@ -393,8 +396,8 @@ extern int class_for_each_device(struct class *class, struct device *start, | |||
393 | void *data, | 396 | void *data, |
394 | int (*fn)(struct device *dev, void *data)); | 397 | int (*fn)(struct device *dev, void *data)); |
395 | extern struct device *class_find_device(struct class *class, | 398 | extern struct device *class_find_device(struct class *class, |
396 | struct device *start, void *data, | 399 | struct device *start, const void *data, |
397 | int (*match)(struct device *, void *)); | 400 | int (*match)(struct device *, const void *)); |
398 | 401 | ||
399 | struct class_attribute { | 402 | struct class_attribute { |
400 | struct attribute attr; | 403 | struct attribute attr; |
@@ -496,6 +499,10 @@ ssize_t device_show_int(struct device *dev, struct device_attribute *attr, | |||
496 | char *buf); | 499 | char *buf); |
497 | ssize_t device_store_int(struct device *dev, struct device_attribute *attr, | 500 | ssize_t device_store_int(struct device *dev, struct device_attribute *attr, |
498 | const char *buf, size_t count); | 501 | const char *buf, size_t count); |
502 | ssize_t device_show_bool(struct device *dev, struct device_attribute *attr, | ||
503 | char *buf); | ||
504 | ssize_t device_store_bool(struct device *dev, struct device_attribute *attr, | ||
505 | const char *buf, size_t count); | ||
499 | 506 | ||
500 | #define DEVICE_ATTR(_name, _mode, _show, _store) \ | 507 | #define DEVICE_ATTR(_name, _mode, _show, _store) \ |
501 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) | 508 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) |
@@ -505,6 +512,9 @@ ssize_t device_store_int(struct device *dev, struct device_attribute *attr, | |||
505 | #define DEVICE_INT_ATTR(_name, _mode, _var) \ | 512 | #define DEVICE_INT_ATTR(_name, _mode, _var) \ |
506 | struct dev_ext_attribute dev_attr_##_name = \ | 513 | struct dev_ext_attribute dev_attr_##_name = \ |
507 | { __ATTR(_name, _mode, device_show_int, device_store_int), &(_var) } | 514 | { __ATTR(_name, _mode, device_show_int, device_store_int), &(_var) } |
515 | #define DEVICE_BOOL_ATTR(_name, _mode, _var) \ | ||
516 | struct dev_ext_attribute dev_attr_##_name = \ | ||
517 | { __ATTR(_name, _mode, device_show_bool, device_store_bool), &(_var) } | ||
508 | #define DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \ | 518 | #define DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \ |
509 | struct device_attribute dev_attr_##_name = \ | 519 | struct device_attribute dev_attr_##_name = \ |
510 | __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) | 520 | __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) |
@@ -564,6 +574,7 @@ extern int devres_release_group(struct device *dev, void *id); | |||
564 | extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp); | 574 | extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp); |
565 | extern void devm_kfree(struct device *dev, void *p); | 575 | extern void devm_kfree(struct device *dev, void *p); |
566 | 576 | ||
577 | void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res); | ||
567 | void __iomem *devm_request_and_ioremap(struct device *dev, | 578 | void __iomem *devm_request_and_ioremap(struct device *dev, |
568 | struct resource *res); | 579 | struct resource *res); |
569 | 580 | ||
@@ -580,6 +591,12 @@ struct device_dma_parameters { | |||
580 | unsigned long segment_boundary_mask; | 591 | unsigned long segment_boundary_mask; |
581 | }; | 592 | }; |
582 | 593 | ||
594 | struct acpi_dev_node { | ||
595 | #ifdef CONFIG_ACPI | ||
596 | void *handle; | ||
597 | #endif | ||
598 | }; | ||
599 | |||
583 | /** | 600 | /** |
584 | * struct device - The basic device structure | 601 | * struct device - The basic device structure |
585 | * @parent: The device's "parent" device, the device to which it is attached. | 602 | * @parent: The device's "parent" device, the device to which it is attached. |
@@ -609,6 +626,8 @@ struct device_dma_parameters { | |||
609 | * @pm_domain: Provide callbacks that are executed during system suspend, | 626 | * @pm_domain: Provide callbacks that are executed during system suspend, |
610 | * hibernation, system resume and during runtime PM transitions | 627 | * hibernation, system resume and during runtime PM transitions |
611 | * along with subsystem-level and driver-level callbacks. | 628 | * along with subsystem-level and driver-level callbacks. |
629 | * @pins: For device pin management. | ||
630 | * See Documentation/pinctrl.txt for details. | ||
612 | * @numa_node: NUMA node this device is close to. | 631 | * @numa_node: NUMA node this device is close to. |
613 | * @dma_mask: Dma mask (if dma'ble device). | 632 | * @dma_mask: Dma mask (if dma'ble device). |
614 | * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all | 633 | * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all |
@@ -620,6 +639,7 @@ struct device_dma_parameters { | |||
620 | * @dma_mem: Internal for coherent mem override. | 639 | * @dma_mem: Internal for coherent mem override. |
621 | * @archdata: For arch-specific additions. | 640 | * @archdata: For arch-specific additions. |
622 | * @of_node: Associated device tree node. | 641 | * @of_node: Associated device tree node. |
642 | * @acpi_node: Associated ACPI device node. | ||
623 | * @devt: For creating the sysfs "dev". | 643 | * @devt: For creating the sysfs "dev". |
624 | * @id: device instance | 644 | * @id: device instance |
625 | * @devres_lock: Spinlock to protect the resource of the device. | 645 | * @devres_lock: Spinlock to protect the resource of the device. |
@@ -660,6 +680,10 @@ struct device { | |||
660 | struct dev_pm_info power; | 680 | struct dev_pm_info power; |
661 | struct dev_pm_domain *pm_domain; | 681 | struct dev_pm_domain *pm_domain; |
662 | 682 | ||
683 | #ifdef CONFIG_PINCTRL | ||
684 | struct dev_pin_info *pins; | ||
685 | #endif | ||
686 | |||
663 | #ifdef CONFIG_NUMA | 687 | #ifdef CONFIG_NUMA |
664 | int numa_node; /* NUMA node this device is close to */ | 688 | int numa_node; /* NUMA node this device is close to */ |
665 | #endif | 689 | #endif |
@@ -684,6 +708,7 @@ struct device { | |||
684 | struct dev_archdata archdata; | 708 | struct dev_archdata archdata; |
685 | 709 | ||
686 | struct device_node *of_node; /* associated device tree node */ | 710 | struct device_node *of_node; /* associated device tree node */ |
711 | struct acpi_dev_node acpi_node; /* associated ACPI device node */ | ||
687 | 712 | ||
688 | dev_t devt; /* dev_t, creates the sysfs "dev" */ | 713 | dev_t devt; /* dev_t, creates the sysfs "dev" */ |
689 | u32 id; /* device instance */ | 714 | u32 id; /* device instance */ |
@@ -704,6 +729,14 @@ static inline struct device *kobj_to_dev(struct kobject *kobj) | |||
704 | return container_of(kobj, struct device, kobj); | 729 | return container_of(kobj, struct device, kobj); |
705 | } | 730 | } |
706 | 731 | ||
732 | #ifdef CONFIG_ACPI | ||
733 | #define ACPI_HANDLE(dev) ((dev)->acpi_node.handle) | ||
734 | #define ACPI_HANDLE_SET(dev, _handle_) (dev)->acpi_node.handle = (_handle_) | ||
735 | #else | ||
736 | #define ACPI_HANDLE(dev) (NULL) | ||
737 | #define ACPI_HANDLE_SET(dev, _handle_) do { } while (0) | ||
738 | #endif | ||
739 | |||
707 | /* Get the wakeup routines, which depend on struct device */ | 740 | /* Get the wakeup routines, which depend on struct device */ |
708 | #include <linux/pm_wakeup.h> | 741 | #include <linux/pm_wakeup.h> |
709 | 742 | ||