1 /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* 3 * Greybus bundles 4 * 5 * Copyright 2014 Google Inc. 6 * Copyright 2014 Linaro Ltd. 7 */ 8 9 #ifndef __BUNDLE_H 10 #define __BUNDLE_H 11 12 #include <linux/types.h> 13 #include <linux/list.h> 14 #include <linux/pm_runtime.h> 15 #include <linux/device.h> 16 17 #define BUNDLE_ID_NONE U8_MAX 18 19 /* Greybus "public" definitions" */ 20 struct gb_bundle { 21 struct device dev; 22 struct gb_interface *intf; 23 24 u8 id; 25 u8 class; 26 u8 class_major; 27 u8 class_minor; 28 29 size_t num_cports; 30 struct greybus_descriptor_cport *cport 31 32 struct list_head connections; 33 u8 *state; 34 35 struct list_head links; /* int 36 }; 37 #define to_gb_bundle(d) container_of(d, struct 38 39 /* Greybus "private" definitions" */ 40 struct gb_bundle *gb_bundle_create(struct gb_i 41 u8 class); 42 int gb_bundle_add(struct gb_bundle *bundle); 43 void gb_bundle_destroy(struct gb_bundle *bundl 44 45 /* Bundle Runtime PM wrappers */ 46 #ifdef CONFIG_PM 47 static inline int gb_pm_runtime_get_sync(struc 48 { 49 int retval; 50 51 retval = pm_runtime_get_sync(&bundle-> 52 if (retval < 0) { 53 dev_err(&bundle->dev, 54 "pm_runtime_get_sync f 55 pm_runtime_put_noidle(&bundle- 56 return retval; 57 } 58 59 return 0; 60 } 61 62 static inline int gb_pm_runtime_put_autosuspen 63 { 64 int retval; 65 66 pm_runtime_mark_last_busy(&bundle->dev 67 retval = pm_runtime_put_autosuspend(&b 68 69 return retval; 70 } 71 72 static inline void gb_pm_runtime_get_noresume( 73 { 74 pm_runtime_get_noresume(&bundle->dev); 75 } 76 77 static inline void gb_pm_runtime_put_noidle(st 78 { 79 pm_runtime_put_noidle(&bundle->dev); 80 } 81 82 #else 83 static inline int gb_pm_runtime_get_sync(struc 84 { return 0; } 85 static inline int gb_pm_runtime_put_autosuspen 86 { return 0; } 87 88 static inline void gb_pm_runtime_get_noresume( 89 static inline void gb_pm_runtime_put_noidle(st 90 #endif 91 92 #endif /* __BUNDLE_H */ 93
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.