| // SPDX-License-Identifier: GPL-2.0+ |
| * Copyright (C) 2020 Philippe Reynes <philippe.reynes@softathome.com> |
| #define LOG_CATEGORY UCLASS_BUTTON |
| #include <dm/uclass-internal.h> |
| int button_get_by_label(const char *label, struct udevice **devp) |
| uclass_id_foreach_dev(UCLASS_BUTTON, dev, uc) { |
| struct button_uc_plat *uc_plat = dev_get_uclass_plat(dev); |
| /* Ignore the top-level button node */ |
| if (uc_plat->label && !strcmp(label, uc_plat->label)) |
| return uclass_get_device_tail(dev, 0, devp); |
| enum button_state_t button_get_state(struct udevice *dev) |
| struct button_ops *ops = button_get_ops(dev); |
| return ops->get_state(dev); |
| UCLASS_DRIVER(button) = { |
| .per_device_plat_auto = sizeof(struct button_uc_plat), |