mtd: nand: brcmnand: Check flash #WP pin status before nand erase/program
[linux/fpc-iii.git] / drivers / staging / greybus / bundle.h
blob0c3491def96c29f22390319eb5703986c7047c2c
1 /*
2 * Greybus bundles
4 * Copyright 2014 Google Inc.
5 * Copyright 2014 Linaro Ltd.
7 * Released under the GPLv2 only.
8 */
10 #ifndef __BUNDLE_H
11 #define __BUNDLE_H
13 #include <linux/list.h>
15 #define BUNDLE_ID_NONE U8_MAX
17 /* Greybus "public" definitions" */
18 struct gb_bundle {
19 struct device dev;
20 struct gb_interface *intf;
22 u8 id;
23 u8 class;
24 u8 class_major;
25 u8 class_minor;
27 size_t num_cports;
28 struct greybus_descriptor_cport *cport_desc;
30 struct list_head connections;
31 u8 *state;
33 struct list_head links; /* interface->bundles */
35 #define to_gb_bundle(d) container_of(d, struct gb_bundle, dev)
37 /* Greybus "private" definitions" */
38 struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 bundle_id,
39 u8 class);
40 int gb_bundle_add(struct gb_bundle *bundle);
41 void gb_bundle_destroy(struct gb_bundle *bundle);
43 /* Bundle Runtime PM wrappers */
44 #ifdef CONFIG_PM
45 static inline int gb_pm_runtime_get_sync(struct gb_bundle *bundle)
47 int retval;
49 retval = pm_runtime_get_sync(&bundle->dev);
50 if (retval < 0) {
51 dev_err(&bundle->dev,
52 "pm_runtime_get_sync failed: %d\n", retval);
53 pm_runtime_put_noidle(&bundle->dev);
54 return retval;
57 return 0;
60 static inline int gb_pm_runtime_put_autosuspend(struct gb_bundle *bundle)
62 int retval;
64 pm_runtime_mark_last_busy(&bundle->dev);
65 retval = pm_runtime_put_autosuspend(&bundle->dev);
67 return retval;
70 static inline void gb_pm_runtime_get_noresume(struct gb_bundle *bundle)
72 pm_runtime_get_noresume(&bundle->dev);
75 static inline void gb_pm_runtime_put_noidle(struct gb_bundle *bundle)
77 pm_runtime_put_noidle(&bundle->dev);
80 #else
81 static inline int gb_pm_runtime_get_sync(struct gb_bundle *bundle)
82 { return 0; }
83 static inline int gb_pm_runtime_put_autosuspend(struct gb_bundle *bundle)
84 { return 0; }
86 static inline void gb_pm_runtime_get_noresume(struct gb_bundle *bundle) {}
87 static inline void gb_pm_runtime_put_noidle(struct gb_bundle *bundle) {}
88 #endif
90 #endif /* __BUNDLE_H */