Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2013 Google, Inc |
| 4 | * |
| 5 | * (C) Copyright 2012 |
| 6 | * Pavel Herrmann <morpheus.ibis@gmail.com> |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 7 | */ |
| 8 | |
Kever Yang | 5f09a2d | 2019-10-22 15:39:47 +0800 | [diff] [blame] | 9 | #define LOG_CATEGORY LOGC_DM |
| 10 | |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 11 | #include <common.h> |
Simon Glass | ee145d6 | 2017-05-18 20:09:09 -0600 | [diff] [blame] | 12 | #include <dm.h> |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 13 | #include <errno.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 14 | #include <log.h> |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 15 | #include <malloc.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 16 | #include <asm/global_data.h> |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 17 | #include <dm/device.h> |
| 18 | #include <dm/device-internal.h> |
| 19 | #include <dm/lists.h> |
| 20 | #include <dm/uclass.h> |
| 21 | #include <dm/uclass-internal.h> |
| 22 | #include <dm/util.h> |
| 23 | |
| 24 | DECLARE_GLOBAL_DATA_PTR; |
| 25 | |
| 26 | struct uclass *uclass_find(enum uclass_id key) |
| 27 | { |
| 28 | struct uclass *uc; |
| 29 | |
Simon Glass | de70867 | 2014-07-23 06:55:15 -0600 | [diff] [blame] | 30 | if (!gd->dm_root) |
| 31 | return NULL; |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 32 | /* |
| 33 | * TODO(sjg@chromium.org): Optimise this, perhaps moving the found |
| 34 | * node to the start of the list, or creating a linear array mapping |
| 35 | * id to node. |
| 36 | */ |
Simon Glass | 784cd9e | 2020-12-19 10:40:17 -0700 | [diff] [blame] | 37 | list_for_each_entry(uc, gd->uclass_root, sibling_node) { |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 38 | if (uc->uc_drv->id == key) |
| 39 | return uc; |
| 40 | } |
| 41 | |
| 42 | return NULL; |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * uclass_add() - Create new uclass in list |
| 47 | * @id: Id number to create |
| 48 | * @ucp: Returns pointer to uclass, or NULL on error |
| 49 | * @return 0 on success, -ve on error |
| 50 | * |
| 51 | * The new uclass is added to the list. There must be only one uclass for |
| 52 | * each id. |
| 53 | */ |
| 54 | static int uclass_add(enum uclass_id id, struct uclass **ucp) |
| 55 | { |
| 56 | struct uclass_driver *uc_drv; |
| 57 | struct uclass *uc; |
| 58 | int ret; |
| 59 | |
| 60 | *ucp = NULL; |
| 61 | uc_drv = lists_uclass_lookup(id); |
| 62 | if (!uc_drv) { |
Masahiro Yamada | 1d06ced | 2015-07-07 18:51:32 +0900 | [diff] [blame] | 63 | debug("Cannot find uclass for id %d: please add the UCLASS_DRIVER() declaration for this UCLASS_... id\n", |
| 64 | id); |
Simon Glass | 43313de | 2015-08-30 16:55:16 -0600 | [diff] [blame] | 65 | /* |
| 66 | * Use a strange error to make this case easier to find. When |
| 67 | * a uclass is not available it can prevent driver model from |
| 68 | * starting up and this failure is otherwise hard to debug. |
| 69 | */ |
| 70 | return -EPFNOSUPPORT; |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 71 | } |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 72 | uc = calloc(1, sizeof(*uc)); |
| 73 | if (!uc) |
| 74 | return -ENOMEM; |
Simon Glass | 8a2b47f | 2020-12-03 16:55:17 -0700 | [diff] [blame] | 75 | if (uc_drv->priv_auto) { |
Simon Glass | 2543b16 | 2020-12-22 19:30:29 -0700 | [diff] [blame] | 76 | void *ptr; |
| 77 | |
| 78 | ptr = calloc(1, uc_drv->priv_auto); |
| 79 | if (!ptr) { |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 80 | ret = -ENOMEM; |
| 81 | goto fail_mem; |
| 82 | } |
Simon Glass | 2543b16 | 2020-12-22 19:30:29 -0700 | [diff] [blame] | 83 | uclass_set_priv(uc, ptr); |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 84 | } |
| 85 | uc->uc_drv = uc_drv; |
| 86 | INIT_LIST_HEAD(&uc->sibling_node); |
| 87 | INIT_LIST_HEAD(&uc->dev_head); |
Simon Glass | 784cd9e | 2020-12-19 10:40:17 -0700 | [diff] [blame] | 88 | list_add(&uc->sibling_node, DM_UCLASS_ROOT_NON_CONST); |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 89 | |
| 90 | if (uc_drv->init) { |
| 91 | ret = uc_drv->init(uc); |
| 92 | if (ret) |
| 93 | goto fail; |
| 94 | } |
| 95 | |
| 96 | *ucp = uc; |
| 97 | |
| 98 | return 0; |
| 99 | fail: |
Simon Glass | 8a2b47f | 2020-12-03 16:55:17 -0700 | [diff] [blame] | 100 | if (uc_drv->priv_auto) { |
Simon Glass | 2543b16 | 2020-12-22 19:30:29 -0700 | [diff] [blame] | 101 | free(uclass_get_priv(uc)); |
| 102 | uclass_set_priv(uc, NULL); |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 103 | } |
| 104 | list_del(&uc->sibling_node); |
| 105 | fail_mem: |
| 106 | free(uc); |
| 107 | |
| 108 | return ret; |
| 109 | } |
| 110 | |
| 111 | int uclass_destroy(struct uclass *uc) |
| 112 | { |
| 113 | struct uclass_driver *uc_drv; |
Simon Glass | f33663d | 2015-04-19 07:20:58 -0600 | [diff] [blame] | 114 | struct udevice *dev; |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 115 | int ret; |
| 116 | |
Simon Glass | f33663d | 2015-04-19 07:20:58 -0600 | [diff] [blame] | 117 | /* |
| 118 | * We cannot use list_for_each_entry_safe() here. If a device in this |
| 119 | * uclass has a child device also in this uclass, it will be also be |
| 120 | * unbound (by the recursion in the call to device_unbind() below). |
| 121 | * We can loop until the list is empty. |
| 122 | */ |
| 123 | while (!list_empty(&uc->dev_head)) { |
| 124 | dev = list_first_entry(&uc->dev_head, struct udevice, |
| 125 | uclass_node); |
Simon Glass | 42697f5 | 2020-03-28 14:03:48 -0600 | [diff] [blame] | 126 | ret = device_remove(dev, DM_REMOVE_NORMAL | DM_REMOVE_NO_PD); |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 127 | if (ret) |
Simon Glass | 5f3c9e0 | 2020-03-28 14:03:47 -0600 | [diff] [blame] | 128 | return log_msg_ret("remove", ret); |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 129 | ret = device_unbind(dev); |
| 130 | if (ret) |
Simon Glass | 5f3c9e0 | 2020-03-28 14:03:47 -0600 | [diff] [blame] | 131 | return log_msg_ret("unbind", ret); |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 132 | } |
| 133 | |
| 134 | uc_drv = uc->uc_drv; |
| 135 | if (uc_drv->destroy) |
| 136 | uc_drv->destroy(uc); |
| 137 | list_del(&uc->sibling_node); |
Simon Glass | 8a2b47f | 2020-12-03 16:55:17 -0700 | [diff] [blame] | 138 | if (uc_drv->priv_auto) |
Simon Glass | 2543b16 | 2020-12-22 19:30:29 -0700 | [diff] [blame] | 139 | free(uclass_get_priv(uc)); |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 140 | free(uc); |
| 141 | |
| 142 | return 0; |
| 143 | } |
| 144 | |
| 145 | int uclass_get(enum uclass_id id, struct uclass **ucp) |
| 146 | { |
| 147 | struct uclass *uc; |
| 148 | |
| 149 | *ucp = NULL; |
| 150 | uc = uclass_find(id); |
Simon Glass | 05693e9 | 2021-03-15 17:25:18 +1300 | [diff] [blame] | 151 | if (!uc) { |
| 152 | if (CONFIG_IS_ENABLED(OF_PLATDATA_INST)) |
| 153 | return -ENOENT; |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 154 | return uclass_add(id, ucp); |
Simon Glass | 05693e9 | 2021-03-15 17:25:18 +1300 | [diff] [blame] | 155 | } |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 156 | *ucp = uc; |
| 157 | |
| 158 | return 0; |
| 159 | } |
| 160 | |
Simon Glass | d19d073 | 2016-10-05 20:42:13 -0600 | [diff] [blame] | 161 | const char *uclass_get_name(enum uclass_id id) |
| 162 | { |
| 163 | struct uclass *uc; |
| 164 | |
| 165 | if (uclass_get(id, &uc)) |
| 166 | return NULL; |
| 167 | return uc->uc_drv->name; |
| 168 | } |
| 169 | |
Simon Glass | 96404c2 | 2020-12-22 19:30:26 -0700 | [diff] [blame] | 170 | void *uclass_get_priv(const struct uclass *uc) |
| 171 | { |
Simon Glass | 541f62c | 2020-12-22 19:30:30 -0700 | [diff] [blame] | 172 | return uc->priv_; |
Simon Glass | 96404c2 | 2020-12-22 19:30:26 -0700 | [diff] [blame] | 173 | } |
| 174 | |
| 175 | void uclass_set_priv(struct uclass *uc, void *priv) |
| 176 | { |
Simon Glass | 541f62c | 2020-12-22 19:30:30 -0700 | [diff] [blame] | 177 | uc->priv_ = priv; |
Simon Glass | 96404c2 | 2020-12-22 19:30:26 -0700 | [diff] [blame] | 178 | } |
| 179 | |
Simon Glass | 70e35b4 | 2017-12-28 13:14:15 -0700 | [diff] [blame] | 180 | enum uclass_id uclass_get_by_name(const char *name) |
| 181 | { |
| 182 | int i; |
| 183 | |
| 184 | for (i = 0; i < UCLASS_COUNT; i++) { |
| 185 | struct uclass_driver *uc_drv = lists_uclass_lookup(i); |
| 186 | |
| 187 | if (uc_drv && !strcmp(uc_drv->name, name)) |
| 188 | return i; |
| 189 | } |
| 190 | |
| 191 | return UCLASS_INVALID; |
| 192 | } |
| 193 | |
Jean-Jacques Hiblot | c4f0248 | 2018-08-09 16:17:42 +0200 | [diff] [blame] | 194 | int dev_get_uclass_index(struct udevice *dev, struct uclass **ucp) |
| 195 | { |
| 196 | struct udevice *iter; |
| 197 | struct uclass *uc = dev->uclass; |
| 198 | int i = 0; |
| 199 | |
| 200 | if (list_empty(&uc->dev_head)) |
| 201 | return -ENODEV; |
| 202 | |
Liviu Dudau | 6f38622 | 2018-09-28 14:12:55 +0100 | [diff] [blame] | 203 | uclass_foreach_dev(iter, uc) { |
Jean-Jacques Hiblot | c4f0248 | 2018-08-09 16:17:42 +0200 | [diff] [blame] | 204 | if (iter == dev) { |
| 205 | if (ucp) |
| 206 | *ucp = uc; |
| 207 | return i; |
| 208 | } |
| 209 | i++; |
| 210 | } |
| 211 | |
| 212 | return -ENODEV; |
| 213 | } |
| 214 | |
Heiko Schocher | b74fcb4 | 2014-05-22 12:43:05 +0200 | [diff] [blame] | 215 | int uclass_find_device(enum uclass_id id, int index, struct udevice **devp) |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 216 | { |
| 217 | struct uclass *uc; |
Heiko Schocher | b74fcb4 | 2014-05-22 12:43:05 +0200 | [diff] [blame] | 218 | struct udevice *dev; |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 219 | int ret; |
| 220 | |
| 221 | *devp = NULL; |
| 222 | ret = uclass_get(id, &uc); |
| 223 | if (ret) |
| 224 | return ret; |
Simon Glass | 46766df | 2015-07-31 09:31:19 -0600 | [diff] [blame] | 225 | if (list_empty(&uc->dev_head)) |
| 226 | return -ENODEV; |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 227 | |
Liviu Dudau | 6f38622 | 2018-09-28 14:12:55 +0100 | [diff] [blame] | 228 | uclass_foreach_dev(dev, uc) { |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 229 | if (!index--) { |
| 230 | *devp = dev; |
| 231 | return 0; |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | return -ENODEV; |
| 236 | } |
| 237 | |
Przemyslaw Marczak | f9d156e | 2015-04-15 13:07:17 +0200 | [diff] [blame] | 238 | int uclass_find_first_device(enum uclass_id id, struct udevice **devp) |
| 239 | { |
| 240 | struct uclass *uc; |
| 241 | int ret; |
| 242 | |
| 243 | *devp = NULL; |
| 244 | ret = uclass_get(id, &uc); |
| 245 | if (ret) |
| 246 | return ret; |
| 247 | if (list_empty(&uc->dev_head)) |
Simon Glass | 0bb4427 | 2019-09-25 08:55:55 -0600 | [diff] [blame] | 248 | return 0; |
Przemyslaw Marczak | f9d156e | 2015-04-15 13:07:17 +0200 | [diff] [blame] | 249 | |
| 250 | *devp = list_first_entry(&uc->dev_head, struct udevice, uclass_node); |
| 251 | |
| 252 | return 0; |
| 253 | } |
| 254 | |
| 255 | int uclass_find_next_device(struct udevice **devp) |
| 256 | { |
| 257 | struct udevice *dev = *devp; |
| 258 | |
| 259 | *devp = NULL; |
| 260 | if (list_is_last(&dev->uclass_node, &dev->uclass->dev_head)) |
| 261 | return 0; |
| 262 | |
| 263 | *devp = list_entry(dev->uclass_node.next, struct udevice, uclass_node); |
| 264 | |
| 265 | return 0; |
| 266 | } |
| 267 | |
Przemyslaw Marczak | 2ffdf14 | 2015-04-15 13:07:22 +0200 | [diff] [blame] | 268 | int uclass_find_device_by_name(enum uclass_id id, const char *name, |
| 269 | struct udevice **devp) |
| 270 | { |
| 271 | struct uclass *uc; |
| 272 | struct udevice *dev; |
| 273 | int ret; |
| 274 | |
| 275 | *devp = NULL; |
| 276 | if (!name) |
| 277 | return -EINVAL; |
| 278 | ret = uclass_get(id, &uc); |
| 279 | if (ret) |
| 280 | return ret; |
| 281 | |
Liviu Dudau | 6f38622 | 2018-09-28 14:12:55 +0100 | [diff] [blame] | 282 | uclass_foreach_dev(dev, uc) { |
Peng Fan | 26d68b2 | 2019-05-22 07:08:14 +0000 | [diff] [blame] | 283 | if (!strcmp(dev->name, name)) { |
Przemyslaw Marczak | 2ffdf14 | 2015-04-15 13:07:22 +0200 | [diff] [blame] | 284 | *devp = dev; |
| 285 | return 0; |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | return -ENODEV; |
| 290 | } |
| 291 | |
Simon Glass | b941f56 | 2020-12-16 21:20:30 -0700 | [diff] [blame] | 292 | int uclass_find_next_free_seq(struct uclass *uc) |
Jean-Jacques Hiblot | a5da300 | 2018-12-07 14:50:39 +0100 | [diff] [blame] | 293 | { |
Jean-Jacques Hiblot | a5da300 | 2018-12-07 14:50:39 +0100 | [diff] [blame] | 294 | struct udevice *dev; |
Jean-Jacques Hiblot | a5da300 | 2018-12-07 14:50:39 +0100 | [diff] [blame] | 295 | int max = -1; |
| 296 | |
Simon Glass | b941f56 | 2020-12-16 21:20:30 -0700 | [diff] [blame] | 297 | /* If using aliases, start with the highest alias value */ |
| 298 | if (CONFIG_IS_ENABLED(DM_SEQ_ALIAS) && |
| 299 | (uc->uc_drv->flags & DM_UC_FLAG_SEQ_ALIAS)) |
| 300 | max = dev_read_alias_highest_id(uc->uc_drv->name); |
| 301 | |
| 302 | /* Avoid conflict with existing devices */ |
Jean-Jacques Hiblot | a5da300 | 2018-12-07 14:50:39 +0100 | [diff] [blame] | 303 | list_for_each_entry(dev, &uc->dev_head, uclass_node) { |
Simon Glass | 5e34992 | 2020-12-19 10:40:09 -0700 | [diff] [blame] | 304 | if (dev->seq_ > max) |
| 305 | max = dev->seq_; |
Jean-Jacques Hiblot | a5da300 | 2018-12-07 14:50:39 +0100 | [diff] [blame] | 306 | } |
Simon Glass | b941f56 | 2020-12-16 21:20:30 -0700 | [diff] [blame] | 307 | /* |
| 308 | * At this point, max will be -1 if there are no existing aliases or |
| 309 | * devices |
| 310 | */ |
Jean-Jacques Hiblot | a5da300 | 2018-12-07 14:50:39 +0100 | [diff] [blame] | 311 | |
| 312 | return max + 1; |
| 313 | } |
Jean-Jacques Hiblot | a5da300 | 2018-12-07 14:50:39 +0100 | [diff] [blame] | 314 | |
Simon Glass | 07e1338 | 2020-12-16 21:20:29 -0700 | [diff] [blame] | 315 | int uclass_find_device_by_seq(enum uclass_id id, int seq, struct udevice **devp) |
Simon Glass | db6f020 | 2014-07-23 06:55:12 -0600 | [diff] [blame] | 316 | { |
| 317 | struct uclass *uc; |
| 318 | struct udevice *dev; |
| 319 | int ret; |
| 320 | |
| 321 | *devp = NULL; |
Simon Glass | 07e1338 | 2020-12-16 21:20:29 -0700 | [diff] [blame] | 322 | log_debug("%d\n", seq); |
| 323 | if (seq == -1) |
Simon Glass | db6f020 | 2014-07-23 06:55:12 -0600 | [diff] [blame] | 324 | return -ENODEV; |
| 325 | ret = uclass_get(id, &uc); |
| 326 | if (ret) |
| 327 | return ret; |
| 328 | |
Liviu Dudau | 6f38622 | 2018-09-28 14:12:55 +0100 | [diff] [blame] | 329 | uclass_foreach_dev(dev, uc) { |
Simon Glass | 5e34992 | 2020-12-19 10:40:09 -0700 | [diff] [blame] | 330 | log_debug(" - %d '%s'\n", dev->seq_, dev->name); |
| 331 | if (dev->seq_ == seq) { |
Simon Glass | db6f020 | 2014-07-23 06:55:12 -0600 | [diff] [blame] | 332 | *devp = dev; |
Kever Yang | 5f09a2d | 2019-10-22 15:39:47 +0800 | [diff] [blame] | 333 | log_debug(" - found\n"); |
Simon Glass | db6f020 | 2014-07-23 06:55:12 -0600 | [diff] [blame] | 334 | return 0; |
| 335 | } |
| 336 | } |
Kever Yang | 5f09a2d | 2019-10-22 15:39:47 +0800 | [diff] [blame] | 337 | log_debug(" - not found\n"); |
Simon Glass | db6f020 | 2014-07-23 06:55:12 -0600 | [diff] [blame] | 338 | |
| 339 | return -ENODEV; |
| 340 | } |
| 341 | |
Simon Glass | 96f0444 | 2016-01-21 19:43:57 -0700 | [diff] [blame] | 342 | int uclass_find_device_by_of_offset(enum uclass_id id, int node, |
| 343 | struct udevice **devp) |
Simon Glass | c1464ab | 2014-07-23 06:55:14 -0600 | [diff] [blame] | 344 | { |
| 345 | struct uclass *uc; |
| 346 | struct udevice *dev; |
| 347 | int ret; |
| 348 | |
| 349 | *devp = NULL; |
| 350 | if (node < 0) |
| 351 | return -ENODEV; |
| 352 | ret = uclass_get(id, &uc); |
| 353 | if (ret) |
| 354 | return ret; |
| 355 | |
Liviu Dudau | 6f38622 | 2018-09-28 14:12:55 +0100 | [diff] [blame] | 356 | uclass_foreach_dev(dev, uc) { |
Simon Glass | dd79d6e | 2017-01-17 16:52:55 -0700 | [diff] [blame] | 357 | if (dev_of_offset(dev) == node) { |
Simon Glass | c1464ab | 2014-07-23 06:55:14 -0600 | [diff] [blame] | 358 | *devp = dev; |
| 359 | return 0; |
| 360 | } |
| 361 | } |
| 362 | |
| 363 | return -ENODEV; |
| 364 | } |
| 365 | |
Simon Glass | ee145d6 | 2017-05-18 20:09:09 -0600 | [diff] [blame] | 366 | int uclass_find_device_by_ofnode(enum uclass_id id, ofnode node, |
| 367 | struct udevice **devp) |
| 368 | { |
| 369 | struct uclass *uc; |
| 370 | struct udevice *dev; |
| 371 | int ret; |
| 372 | |
Simon Glass | 5ab533c | 2018-06-11 13:07:19 -0600 | [diff] [blame] | 373 | log(LOGC_DM, LOGL_DEBUG, "Looking for %s\n", ofnode_get_name(node)); |
Simon Glass | ee145d6 | 2017-05-18 20:09:09 -0600 | [diff] [blame] | 374 | *devp = NULL; |
| 375 | if (!ofnode_valid(node)) |
| 376 | return -ENODEV; |
| 377 | ret = uclass_get(id, &uc); |
| 378 | if (ret) |
| 379 | return ret; |
| 380 | |
Liviu Dudau | 6f38622 | 2018-09-28 14:12:55 +0100 | [diff] [blame] | 381 | uclass_foreach_dev(dev, uc) { |
Simon Glass | 5ab533c | 2018-06-11 13:07:19 -0600 | [diff] [blame] | 382 | log(LOGC_DM, LOGL_DEBUG_CONTENT, " - checking %s\n", |
| 383 | dev->name); |
Simon Glass | ee145d6 | 2017-05-18 20:09:09 -0600 | [diff] [blame] | 384 | if (ofnode_equal(dev_ofnode(dev), node)) { |
| 385 | *devp = dev; |
Simon Glass | 5ab533c | 2018-06-11 13:07:19 -0600 | [diff] [blame] | 386 | goto done; |
Simon Glass | ee145d6 | 2017-05-18 20:09:09 -0600 | [diff] [blame] | 387 | } |
| 388 | } |
Simon Glass | 5ab533c | 2018-06-11 13:07:19 -0600 | [diff] [blame] | 389 | ret = -ENODEV; |
Simon Glass | ee145d6 | 2017-05-18 20:09:09 -0600 | [diff] [blame] | 390 | |
Simon Glass | 5ab533c | 2018-06-11 13:07:19 -0600 | [diff] [blame] | 391 | done: |
| 392 | log(LOGC_DM, LOGL_DEBUG, " - result for %s: %s (ret=%d)\n", |
| 393 | ofnode_get_name(node), *devp ? (*devp)->name : "(none)", ret); |
| 394 | return ret; |
Simon Glass | ee145d6 | 2017-05-18 20:09:09 -0600 | [diff] [blame] | 395 | } |
| 396 | |
Simon Glass | 107da8f | 2021-03-15 17:25:26 +1300 | [diff] [blame] | 397 | #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) |
Simon Glass | dc3efdc | 2018-11-18 08:14:30 -0700 | [diff] [blame] | 398 | int uclass_find_device_by_phandle(enum uclass_id id, struct udevice *parent, |
| 399 | const char *name, struct udevice **devp) |
Simon Glass | 75f00df | 2015-07-02 18:15:38 -0600 | [diff] [blame] | 400 | { |
| 401 | struct udevice *dev; |
| 402 | struct uclass *uc; |
| 403 | int find_phandle; |
| 404 | int ret; |
| 405 | |
| 406 | *devp = NULL; |
Simon Glass | bfb6e3d | 2017-05-18 20:09:12 -0600 | [diff] [blame] | 407 | find_phandle = dev_read_u32_default(parent, name, -1); |
Simon Glass | 75f00df | 2015-07-02 18:15:38 -0600 | [diff] [blame] | 408 | if (find_phandle <= 0) |
| 409 | return -ENOENT; |
| 410 | ret = uclass_get(id, &uc); |
| 411 | if (ret) |
| 412 | return ret; |
| 413 | |
Liviu Dudau | 6f38622 | 2018-09-28 14:12:55 +0100 | [diff] [blame] | 414 | uclass_foreach_dev(dev, uc) { |
Simon Glass | dd79d6e | 2017-01-17 16:52:55 -0700 | [diff] [blame] | 415 | uint phandle; |
| 416 | |
Simon Glass | bfb6e3d | 2017-05-18 20:09:12 -0600 | [diff] [blame] | 417 | phandle = dev_read_phandle(dev); |
Simon Glass | 75f00df | 2015-07-02 18:15:38 -0600 | [diff] [blame] | 418 | |
| 419 | if (phandle == find_phandle) { |
| 420 | *devp = dev; |
| 421 | return 0; |
| 422 | } |
| 423 | } |
| 424 | |
| 425 | return -ENODEV; |
| 426 | } |
Simon Glass | 359c487 | 2015-12-19 19:38:55 -0700 | [diff] [blame] | 427 | #endif |
Simon Glass | 75f00df | 2015-07-02 18:15:38 -0600 | [diff] [blame] | 428 | |
Simon Glass | 32d8ab6 | 2016-07-17 15:23:15 -0600 | [diff] [blame] | 429 | int uclass_get_device_by_driver(enum uclass_id id, |
| 430 | const struct driver *find_drv, |
| 431 | struct udevice **devp) |
| 432 | { |
| 433 | struct udevice *dev; |
| 434 | struct uclass *uc; |
| 435 | int ret; |
| 436 | |
| 437 | ret = uclass_get(id, &uc); |
| 438 | if (ret) |
| 439 | return ret; |
| 440 | |
Liviu Dudau | 6f38622 | 2018-09-28 14:12:55 +0100 | [diff] [blame] | 441 | uclass_foreach_dev(dev, uc) { |
Simon Glass | 32d8ab6 | 2016-07-17 15:23:15 -0600 | [diff] [blame] | 442 | if (dev->driver == find_drv) |
| 443 | return uclass_get_device_tail(dev, 0, devp); |
| 444 | } |
| 445 | |
| 446 | return -ENODEV; |
| 447 | } |
| 448 | |
Simon Glass | 98c9fb0 | 2017-04-23 20:10:43 -0600 | [diff] [blame] | 449 | int uclass_get_device_tail(struct udevice *dev, int ret, struct udevice **devp) |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 450 | { |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 451 | if (ret) |
| 452 | return ret; |
| 453 | |
Simon Glass | 46cc8ba9 | 2015-04-24 22:33:07 -0600 | [diff] [blame] | 454 | assert(dev); |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 455 | ret = device_probe(dev); |
| 456 | if (ret) |
| 457 | return ret; |
| 458 | |
| 459 | *devp = dev; |
| 460 | |
| 461 | return 0; |
| 462 | } |
| 463 | |
Simon Glass | 4b67cef | 2014-07-23 06:55:08 -0600 | [diff] [blame] | 464 | int uclass_get_device(enum uclass_id id, int index, struct udevice **devp) |
| 465 | { |
| 466 | struct udevice *dev; |
| 467 | int ret; |
| 468 | |
| 469 | *devp = NULL; |
| 470 | ret = uclass_find_device(id, index, &dev); |
| 471 | return uclass_get_device_tail(dev, ret, devp); |
| 472 | } |
| 473 | |
Przemyslaw Marczak | a12a1f5 | 2015-04-15 13:07:23 +0200 | [diff] [blame] | 474 | int uclass_get_device_by_name(enum uclass_id id, const char *name, |
| 475 | struct udevice **devp) |
| 476 | { |
| 477 | struct udevice *dev; |
| 478 | int ret; |
| 479 | |
| 480 | *devp = NULL; |
| 481 | ret = uclass_find_device_by_name(id, name, &dev); |
| 482 | return uclass_get_device_tail(dev, ret, devp); |
| 483 | } |
| 484 | |
Simon Glass | db6f020 | 2014-07-23 06:55:12 -0600 | [diff] [blame] | 485 | int uclass_get_device_by_seq(enum uclass_id id, int seq, struct udevice **devp) |
| 486 | { |
| 487 | struct udevice *dev; |
| 488 | int ret; |
| 489 | |
| 490 | *devp = NULL; |
Simon Glass | 07e1338 | 2020-12-16 21:20:29 -0700 | [diff] [blame] | 491 | ret = uclass_find_device_by_seq(id, seq, &dev); |
| 492 | |
Simon Glass | db6f020 | 2014-07-23 06:55:12 -0600 | [diff] [blame] | 493 | return uclass_get_device_tail(dev, ret, devp); |
| 494 | } |
| 495 | |
Simon Glass | c1464ab | 2014-07-23 06:55:14 -0600 | [diff] [blame] | 496 | int uclass_get_device_by_of_offset(enum uclass_id id, int node, |
| 497 | struct udevice **devp) |
| 498 | { |
| 499 | struct udevice *dev; |
| 500 | int ret; |
| 501 | |
| 502 | *devp = NULL; |
| 503 | ret = uclass_find_device_by_of_offset(id, node, &dev); |
| 504 | return uclass_get_device_tail(dev, ret, devp); |
| 505 | } |
| 506 | |
Simon Glass | ee145d6 | 2017-05-18 20:09:09 -0600 | [diff] [blame] | 507 | int uclass_get_device_by_ofnode(enum uclass_id id, ofnode node, |
| 508 | struct udevice **devp) |
| 509 | { |
| 510 | struct udevice *dev; |
| 511 | int ret; |
| 512 | |
Simon Glass | 5ab533c | 2018-06-11 13:07:19 -0600 | [diff] [blame] | 513 | log(LOGC_DM, LOGL_DEBUG, "Looking for %s\n", ofnode_get_name(node)); |
Simon Glass | ee145d6 | 2017-05-18 20:09:09 -0600 | [diff] [blame] | 514 | *devp = NULL; |
| 515 | ret = uclass_find_device_by_ofnode(id, node, &dev); |
Simon Glass | 5ab533c | 2018-06-11 13:07:19 -0600 | [diff] [blame] | 516 | log(LOGC_DM, LOGL_DEBUG, " - result for %s: %s (ret=%d)\n", |
| 517 | ofnode_get_name(node), dev ? dev->name : "(none)", ret); |
Simon Glass | ee145d6 | 2017-05-18 20:09:09 -0600 | [diff] [blame] | 518 | |
| 519 | return uclass_get_device_tail(dev, ret, devp); |
| 520 | } |
| 521 | |
Simon Glass | 359c487 | 2015-12-19 19:38:55 -0700 | [diff] [blame] | 522 | #if CONFIG_IS_ENABLED(OF_CONTROL) |
Kever Yang | 66a0b5a | 2018-02-09 10:56:23 +0800 | [diff] [blame] | 523 | int uclass_get_device_by_phandle_id(enum uclass_id id, uint phandle_id, |
| 524 | struct udevice **devp) |
| 525 | { |
| 526 | struct udevice *dev; |
| 527 | struct uclass *uc; |
| 528 | int ret; |
| 529 | |
| 530 | *devp = NULL; |
| 531 | ret = uclass_get(id, &uc); |
| 532 | if (ret) |
| 533 | return ret; |
| 534 | |
Liviu Dudau | 6f38622 | 2018-09-28 14:12:55 +0100 | [diff] [blame] | 535 | uclass_foreach_dev(dev, uc) { |
Kever Yang | 66a0b5a | 2018-02-09 10:56:23 +0800 | [diff] [blame] | 536 | uint phandle; |
| 537 | |
| 538 | phandle = dev_read_phandle(dev); |
| 539 | |
| 540 | if (phandle == phandle_id) { |
| 541 | *devp = dev; |
| 542 | return uclass_get_device_tail(dev, ret, devp); |
| 543 | } |
| 544 | } |
| 545 | |
| 546 | return -ENODEV; |
| 547 | } |
| 548 | |
Simon Glass | 75f00df | 2015-07-02 18:15:38 -0600 | [diff] [blame] | 549 | int uclass_get_device_by_phandle(enum uclass_id id, struct udevice *parent, |
| 550 | const char *name, struct udevice **devp) |
| 551 | { |
| 552 | struct udevice *dev; |
| 553 | int ret; |
| 554 | |
| 555 | *devp = NULL; |
| 556 | ret = uclass_find_device_by_phandle(id, parent, name, &dev); |
| 557 | return uclass_get_device_tail(dev, ret, devp); |
| 558 | } |
Simon Glass | 359c487 | 2015-12-19 19:38:55 -0700 | [diff] [blame] | 559 | #endif |
Simon Glass | 75f00df | 2015-07-02 18:15:38 -0600 | [diff] [blame] | 560 | |
Heiko Schocher | b74fcb4 | 2014-05-22 12:43:05 +0200 | [diff] [blame] | 561 | int uclass_first_device(enum uclass_id id, struct udevice **devp) |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 562 | { |
Heiko Schocher | b74fcb4 | 2014-05-22 12:43:05 +0200 | [diff] [blame] | 563 | struct udevice *dev; |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 564 | int ret; |
| 565 | |
| 566 | *devp = NULL; |
Przemyslaw Marczak | f9d156e | 2015-04-15 13:07:17 +0200 | [diff] [blame] | 567 | ret = uclass_find_first_device(id, &dev); |
Simon Glass | 46cc8ba9 | 2015-04-24 22:33:07 -0600 | [diff] [blame] | 568 | if (!dev) |
| 569 | return 0; |
Przemyslaw Marczak | f9d156e | 2015-04-15 13:07:17 +0200 | [diff] [blame] | 570 | return uclass_get_device_tail(dev, ret, devp); |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 571 | } |
| 572 | |
Simon Glass | 832c3f0 | 2016-02-11 13:23:25 -0700 | [diff] [blame] | 573 | int uclass_first_device_err(enum uclass_id id, struct udevice **devp) |
| 574 | { |
| 575 | int ret; |
| 576 | |
| 577 | ret = uclass_first_device(id, devp); |
| 578 | if (ret) |
| 579 | return ret; |
| 580 | else if (!*devp) |
| 581 | return -ENODEV; |
| 582 | |
| 583 | return 0; |
| 584 | } |
| 585 | |
Heiko Schocher | b74fcb4 | 2014-05-22 12:43:05 +0200 | [diff] [blame] | 586 | int uclass_next_device(struct udevice **devp) |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 587 | { |
Heiko Schocher | b74fcb4 | 2014-05-22 12:43:05 +0200 | [diff] [blame] | 588 | struct udevice *dev = *devp; |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 589 | int ret; |
| 590 | |
| 591 | *devp = NULL; |
Przemyslaw Marczak | f9d156e | 2015-04-15 13:07:17 +0200 | [diff] [blame] | 592 | ret = uclass_find_next_device(&dev); |
Simon Glass | 46cc8ba9 | 2015-04-24 22:33:07 -0600 | [diff] [blame] | 593 | if (!dev) |
| 594 | return 0; |
Przemyslaw Marczak | f9d156e | 2015-04-15 13:07:17 +0200 | [diff] [blame] | 595 | return uclass_get_device_tail(dev, ret, devp); |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 596 | } |
| 597 | |
Patrice Chotard | 4dff178 | 2018-10-24 14:10:15 +0200 | [diff] [blame] | 598 | int uclass_next_device_err(struct udevice **devp) |
| 599 | { |
| 600 | int ret; |
| 601 | |
| 602 | ret = uclass_next_device(devp); |
| 603 | if (ret) |
| 604 | return ret; |
| 605 | else if (!*devp) |
| 606 | return -ENODEV; |
| 607 | |
| 608 | return 0; |
| 609 | } |
| 610 | |
Simon Glass | 3ff83bc | 2017-04-23 20:10:45 -0600 | [diff] [blame] | 611 | int uclass_first_device_check(enum uclass_id id, struct udevice **devp) |
| 612 | { |
| 613 | int ret; |
| 614 | |
| 615 | *devp = NULL; |
| 616 | ret = uclass_find_first_device(id, devp); |
| 617 | if (ret) |
| 618 | return ret; |
| 619 | if (!*devp) |
| 620 | return 0; |
| 621 | |
| 622 | return device_probe(*devp); |
| 623 | } |
| 624 | |
| 625 | int uclass_next_device_check(struct udevice **devp) |
| 626 | { |
| 627 | int ret; |
| 628 | |
| 629 | ret = uclass_find_next_device(devp); |
| 630 | if (ret) |
| 631 | return ret; |
| 632 | if (!*devp) |
| 633 | return 0; |
| 634 | |
| 635 | return device_probe(*devp); |
| 636 | } |
| 637 | |
Simon Glass | 35cb2a4 | 2020-02-06 09:54:50 -0700 | [diff] [blame] | 638 | int uclass_first_device_drvdata(enum uclass_id id, ulong driver_data, |
| 639 | struct udevice **devp) |
| 640 | { |
| 641 | struct udevice *dev; |
| 642 | struct uclass *uc; |
| 643 | |
| 644 | uclass_id_foreach_dev(id, dev, uc) { |
| 645 | if (dev_get_driver_data(dev) == driver_data) { |
| 646 | *devp = dev; |
| 647 | |
| 648 | return device_probe(dev); |
| 649 | } |
| 650 | } |
| 651 | |
| 652 | return -ENODEV; |
| 653 | } |
| 654 | |
Heiko Schocher | b74fcb4 | 2014-05-22 12:43:05 +0200 | [diff] [blame] | 655 | int uclass_bind_device(struct udevice *dev) |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 656 | { |
| 657 | struct uclass *uc; |
| 658 | int ret; |
| 659 | |
| 660 | uc = dev->uclass; |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 661 | list_add_tail(&dev->uclass_node, &uc->dev_head); |
| 662 | |
Simon Glass | f4c9b3e | 2015-01-25 08:27:08 -0700 | [diff] [blame] | 663 | if (dev->parent) { |
| 664 | struct uclass_driver *uc_drv = dev->parent->uclass->uc_drv; |
| 665 | |
| 666 | if (uc_drv->child_post_bind) { |
| 667 | ret = uc_drv->child_post_bind(dev); |
| 668 | if (ret) |
| 669 | goto err; |
| 670 | } |
| 671 | } |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 672 | |
| 673 | return 0; |
Simon Glass | f4c9b3e | 2015-01-25 08:27:08 -0700 | [diff] [blame] | 674 | err: |
| 675 | /* There is no need to undo the parent's post_bind call */ |
| 676 | list_del(&dev->uclass_node); |
| 677 | |
| 678 | return ret; |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 679 | } |
| 680 | |
Masahiro Yamada | 04aa00d | 2015-08-12 07:31:52 +0900 | [diff] [blame] | 681 | #if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE) |
Heiko Schocher | b74fcb4 | 2014-05-22 12:43:05 +0200 | [diff] [blame] | 682 | int uclass_unbind_device(struct udevice *dev) |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 683 | { |
| 684 | struct uclass *uc; |
| 685 | int ret; |
| 686 | |
| 687 | uc = dev->uclass; |
| 688 | if (uc->uc_drv->pre_unbind) { |
| 689 | ret = uc->uc_drv->pre_unbind(dev); |
| 690 | if (ret) |
| 691 | return ret; |
| 692 | } |
| 693 | |
| 694 | list_del(&dev->uclass_node); |
| 695 | return 0; |
| 696 | } |
Simon Glass | 8914c8a | 2015-02-27 22:06:31 -0700 | [diff] [blame] | 697 | #endif |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 698 | |
Simon Glass | 9c1f382 | 2015-03-05 12:25:22 -0700 | [diff] [blame] | 699 | int uclass_pre_probe_device(struct udevice *dev) |
Simon Glass | 5104b98 | 2015-01-25 08:27:10 -0700 | [diff] [blame] | 700 | { |
| 701 | struct uclass_driver *uc_drv; |
Simon Glass | 9c1f382 | 2015-03-05 12:25:22 -0700 | [diff] [blame] | 702 | int ret; |
| 703 | |
| 704 | uc_drv = dev->uclass->uc_drv; |
| 705 | if (uc_drv->pre_probe) { |
| 706 | ret = uc_drv->pre_probe(dev); |
| 707 | if (ret) |
| 708 | return ret; |
| 709 | } |
Simon Glass | 5104b98 | 2015-01-25 08:27:10 -0700 | [diff] [blame] | 710 | |
| 711 | if (!dev->parent) |
| 712 | return 0; |
| 713 | uc_drv = dev->parent->uclass->uc_drv; |
Simon Glass | 256d402 | 2019-09-25 08:55:47 -0600 | [diff] [blame] | 714 | if (uc_drv->child_pre_probe) { |
| 715 | ret = uc_drv->child_pre_probe(dev); |
| 716 | if (ret) |
| 717 | return ret; |
| 718 | } |
Simon Glass | 5104b98 | 2015-01-25 08:27:10 -0700 | [diff] [blame] | 719 | |
| 720 | return 0; |
| 721 | } |
| 722 | |
Heiko Schocher | b74fcb4 | 2014-05-22 12:43:05 +0200 | [diff] [blame] | 723 | int uclass_post_probe_device(struct udevice *dev) |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 724 | { |
Bin Meng | 30569cf | 2018-10-15 02:20:57 -0700 | [diff] [blame] | 725 | struct uclass_driver *uc_drv; |
| 726 | int ret; |
| 727 | |
| 728 | if (dev->parent) { |
| 729 | uc_drv = dev->parent->uclass->uc_drv; |
| 730 | if (uc_drv->child_post_probe) { |
| 731 | ret = uc_drv->child_post_probe(dev); |
| 732 | if (ret) |
| 733 | return ret; |
| 734 | } |
| 735 | } |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 736 | |
Bin Meng | 30569cf | 2018-10-15 02:20:57 -0700 | [diff] [blame] | 737 | uc_drv = dev->uclass->uc_drv; |
Simon Glass | 256d402 | 2019-09-25 08:55:47 -0600 | [diff] [blame] | 738 | if (uc_drv->post_probe) { |
| 739 | ret = uc_drv->post_probe(dev); |
| 740 | if (ret) |
| 741 | return ret; |
| 742 | } |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 743 | |
| 744 | return 0; |
| 745 | } |
| 746 | |
Masahiro Yamada | 04aa00d | 2015-08-12 07:31:52 +0900 | [diff] [blame] | 747 | #if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE) |
Heiko Schocher | b74fcb4 | 2014-05-22 12:43:05 +0200 | [diff] [blame] | 748 | int uclass_pre_remove_device(struct udevice *dev) |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 749 | { |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 750 | struct uclass *uc; |
| 751 | int ret; |
| 752 | |
| 753 | uc = dev->uclass; |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 754 | if (uc->uc_drv->pre_remove) { |
| 755 | ret = uc->uc_drv->pre_remove(dev); |
| 756 | if (ret) |
| 757 | return ret; |
| 758 | } |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 759 | |
| 760 | return 0; |
| 761 | } |
Simon Glass | 8914c8a | 2015-02-27 22:06:31 -0700 | [diff] [blame] | 762 | #endif |
Jean-Jacques Hiblot | db97c7f | 2019-07-05 09:33:57 +0200 | [diff] [blame] | 763 | |
Vabhav Sharma | bcab47a | 2020-12-09 10:42:03 +0530 | [diff] [blame] | 764 | int uclass_probe_all(enum uclass_id id) |
| 765 | { |
| 766 | struct udevice *dev; |
| 767 | int ret; |
| 768 | |
| 769 | ret = uclass_first_device(id, &dev); |
| 770 | if (ret || !dev) |
| 771 | return ret; |
| 772 | |
| 773 | /* Scanning uclass to probe all devices */ |
| 774 | while (dev) { |
| 775 | ret = uclass_next_device(&dev); |
| 776 | if (ret) |
| 777 | return ret; |
| 778 | } |
| 779 | |
| 780 | return 0; |
| 781 | } |
| 782 | |
Jean-Jacques Hiblot | db97c7f | 2019-07-05 09:33:57 +0200 | [diff] [blame] | 783 | UCLASS_DRIVER(nop) = { |
| 784 | .id = UCLASS_NOP, |
| 785 | .name = "nop", |
| 786 | }; |