Commit 0a5804b53a3c71dc0c9c43e5c747015b6e50e9e1

Authored by Masahiro Yamada
Committed by Tom Rini
1 parent e00e8b3989

dm: drop CONFIG_DM_DEVICE_REMOVE from uncmd list

We do not want to compile the DM remove code for SPL.  Currently,
we undef it in include/config_uncmd_spl.h (for C files) and in
scripts/Makefile.uncmd_spl (for Makefiles).  This is really ugly.

This commit demonstrates how we can deprecate those two files.

Use $(SPL_) for the entry in the Makfile and CONFIG_IS_ENABLED()
in C files.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

Showing 7 changed files with 13 additions and 16 deletions Side-by-side Diff

drivers/core/Makefile
... ... @@ -9,7 +9,7 @@
9 9 ifndef CONFIG_SPL_BUILD
10 10 obj-$(CONFIG_OF_CONTROL) += simple-bus.o
11 11 endif
12   -obj-$(CONFIG_DM_DEVICE_REMOVE) += device-remove.o
  12 +obj-$(CONFIG_$(SPL_)DM_DEVICE_REMOVE) += device-remove.o
13 13 obj-$(CONFIG_DM) += dump.o
14 14 obj-$(CONFIG_REGMAP) += regmap.o
15 15 obj-$(CONFIG_SYSCON) += syscon-uclass.o
drivers/core/device.c
... ... @@ -140,7 +140,7 @@
140 140 return 0;
141 141  
142 142 fail_child_post_bind:
143   - if (IS_ENABLED(CONFIG_DM_DEVICE_REMOVE)) {
  143 + if (CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)) {
144 144 if (drv->unbind && drv->unbind(dev)) {
145 145 dm_warn("unbind() method failed on dev '%s' on error path\n",
146 146 dev->name);
147 147  
... ... @@ -148,14 +148,14 @@
148 148 }
149 149  
150 150 fail_bind:
151   - if (IS_ENABLED(CONFIG_DM_DEVICE_REMOVE)) {
  151 + if (CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)) {
152 152 if (uclass_unbind_device(dev)) {
153 153 dm_warn("Failed to unbind dev '%s' on error path\n",
154 154 dev->name);
155 155 }
156 156 }
157 157 fail_uclass_bind:
158   - if (IS_ENABLED(CONFIG_DM_DEVICE_REMOVE)) {
  158 + if (CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)) {
159 159 list_del(&dev->sibling_node);
160 160 if (dev->flags & DM_FLAG_ALLOC_PARENT_PDATA) {
161 161 free(dev->parent_platdata);
drivers/core/uclass.c
... ... @@ -435,7 +435,7 @@
435 435 return ret;
436 436 }
437 437  
438   -#ifdef CONFIG_DM_DEVICE_REMOVE
  438 +#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)
439 439 int uclass_unbind_device(struct udevice *dev)
440 440 {
441 441 struct uclass *uc;
... ... @@ -515,7 +515,7 @@
515 515 return 0;
516 516 }
517 517  
518   -#ifdef CONFIG_DM_DEVICE_REMOVE
  518 +#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)
519 519 int uclass_pre_remove_device(struct udevice *dev)
520 520 {
521 521 struct uclass_driver *uc_drv;
include/config_uncmd_spl.h
... ... @@ -32,7 +32,6 @@
32 32 #endif
33 33  
34 34 #undef CONFIG_DM_WARN
35   -#undef CONFIG_DM_DEVICE_REMOVE
36 35 #undef CONFIG_DM_SEQ_ALIAS
37 36 #undef CONFIG_DM_STDIO
38 37  
include/dm/device-internal.h
... ... @@ -87,7 +87,7 @@
87 87 * @dev: Pointer to device to remove
88 88 * @return 0 if OK, -ve on error (an error here is normally a very bad thing)
89 89 */
90   -#ifdef CONFIG_DM_DEVICE_REMOVE
  90 +#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)
91 91 int device_remove(struct udevice *dev);
92 92 #else
93 93 static inline int device_remove(struct udevice *dev) { return 0; }
... ... @@ -101,7 +101,7 @@
101 101 * @dev: Pointer to device to unbind
102 102 * @return 0 if OK, -ve on error
103 103 */
104   -#ifdef CONFIG_DM_DEVICE_REMOVE
  104 +#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)
105 105 int device_unbind(struct udevice *dev);
106 106 #else
107 107 static inline int device_unbind(struct udevice *dev) { return 0; }
... ... @@ -112,7 +112,7 @@
112 112 * @dev: The device whose children are to be removed
113 113 * @return 0 on success, -ve on error
114 114 */
115   -#ifdef CONFIG_DM_DEVICE_REMOVE
  115 +#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)
116 116 int device_remove_children(struct udevice *dev);
117 117 #else
118 118 static inline int device_remove_children(struct udevice *dev) { return 0; }
119 119  
... ... @@ -127,13 +127,13 @@
127 127 * @dev: The device that is to be stripped of its children
128 128 * @return 0 on success, -ve on error
129 129 */
130   -#ifdef CONFIG_DM_DEVICE_REMOVE
  130 +#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)
131 131 int device_unbind_children(struct udevice *dev);
132 132 #else
133 133 static inline int device_unbind_children(struct udevice *dev) { return 0; }
134 134 #endif
135 135  
136   -#ifdef CONFIG_DM_DEVICE_REMOVE
  136 +#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)
137 137 void device_free(struct udevice *dev);
138 138 #else
139 139 static inline void device_free(struct udevice *dev) {}
include/dm/uclass-internal.h
... ... @@ -116,7 +116,7 @@
116 116 * @dev: Pointer to the device
117 117 * #return 0 on success, -ve on error
118 118 */
119   -#ifdef CONFIG_DM_DEVICE_REMOVE
  119 +#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)
120 120 int uclass_unbind_device(struct udevice *dev);
121 121 #else
122 122 static inline int uclass_unbind_device(struct udevice *dev) { return 0; }
... ... @@ -153,7 +153,7 @@
153 153 * @dev: Pointer to the device
154 154 * #return 0 on success, -ve on error
155 155 */
156   -#ifdef CONFIG_DM_DEVICE_REMOVE
  156 +#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)
157 157 int uclass_pre_remove_device(struct udevice *dev);
158 158 #else
159 159 static inline int uclass_pre_remove_device(struct udevice *dev) { return 0; }
scripts/Makefile.uncmd_spl
... ... @@ -15,7 +15,5 @@
15 15 CONFIG_DM_SPI_FLASH=
16 16 endif
17 17  
18   -CONFIG_DM_DEVICE_REMOVE=
19   -
20 18 endif