| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 Corey Tabaka | 2 * Copyright (c) 2012 Corey Tabaka |
| 3 * | 3 * |
| 4 * Permission is hereby granted, free of charge, to any person obtaining | 4 * Permission is hereby granted, free of charge, to any person obtaining |
| 5 * a copy of this software and associated documentation files | 5 * a copy of this software and associated documentation files |
| 6 * (the "Software"), to deal in the Software without restriction, | 6 * (the "Software"), to deal in the Software without restriction, |
| 7 * including without limitation the rights to use, copy, modify, merge, | 7 * including without limitation the rights to use, copy, modify, merge, |
| 8 * publish, distribute, sublicense, and/or sell copies of the Software, | 8 * publish, distribute, sublicense, and/or sell copies of the Software, |
| 9 * and to permit persons to whom the Software is furnished to do so, | 9 * and to permit persons to whom the Software is furnished to do so, |
| 10 * subject to the following conditions: | 10 * subject to the following conditions: |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 status_t (*suspend)(struct device *dev); | 61 status_t (*suspend)(struct device *dev); |
| 62 status_t (*resume)(struct device *dev); | 62 status_t (*resume)(struct device *dev); |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 /* describes a driver, one per driver type */ | 65 /* describes a driver, one per driver type */ |
| 66 struct driver { | 66 struct driver { |
| 67 const char *type; | 67 const char *type; |
| 68 const struct driver_ops *ops; | 68 const struct driver_ops *ops; |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 /* macro-expanding concat */ |
| 72 #define concat(a, b) __ex_concat(a, b) |
| 73 #define __ex_concat(a, b) a ## b |
| 74 |
| 71 #define DRIVER_EXPORT(type_, ops_) \ | 75 #define DRIVER_EXPORT(type_, ops_) \ |
| 72 const struct driver concat(__driver_, type_) \ | 76 const struct driver concat(__driver_, type_) \ |
| 73 __ALIGNED(sizeof(void *)) __SECTION(".drivers") = { \ | 77 __ALIGNED(sizeof(void *)) __SECTION(".drivers") = { \ |
| 74 .type = #type_, \ | 78 .type = #type_, \ |
| 75 .ops = ops_, \ | 79 .ops = ops_, \ |
| 76 } | 80 } |
| 77 | 81 |
| 78 #define DEVICE_INSTANCE(type_, name_, config_) \ | 82 #define DEVICE_INSTANCE(type_, name_, config_) \ |
| 79 extern struct driver concat(__driver_, type_); \ | 83 extern struct driver concat(__driver_, type_); \ |
| 80 struct device concat(__device_, concat(type_, concat(_, name_))) \ | 84 struct device concat(__device_, concat(type_, concat(_, name_))) \ |
| (...skipping 23 matching lines...) Expand all Loading... |
| 104 status_t device_fini_all(void); | 108 status_t device_fini_all(void); |
| 105 | 109 |
| 106 status_t device_init(struct device *dev); | 110 status_t device_init(struct device *dev); |
| 107 status_t device_fini(struct device *dev); | 111 status_t device_fini(struct device *dev); |
| 108 | 112 |
| 109 status_t device_suspend(struct device *dev); | 113 status_t device_suspend(struct device *dev); |
| 110 status_t device_resume(struct device *dev); | 114 status_t device_resume(struct device *dev); |
| 111 | 115 |
| 112 #endif | 116 #endif |
| 113 | 117 |
| OLD | NEW |