diff options
Diffstat (limited to 'src/device/gpio.c')
-rw-r--r-- | src/device/gpio.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/device/gpio.c b/src/device/gpio.c new file mode 100644 index 0000000000..5e71497024 --- /dev/null +++ b/src/device/gpio.c @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <console/console.h> +#include <device/device.h> +#include <device/gpio.h> + +const struct gpio_operations *dev_get_gpio_ops(struct device *dev) +{ + if (!dev) { + printk(BIOS_ERR, "Could not get gpio operations, device is NULL."); + return NULL; + } else if (!dev->ops) { + printk(BIOS_ERR, "Could not get gpio operations, dev->ops is NULL."); + return NULL; + } else if (!dev->ops->ops_gpio) { + printk(BIOS_ERR, "Could not get gpio operations, ops_gpio is NULL."); + return NULL; + } + + return dev->ops->ops_gpio; +} |