summaryrefslogtreecommitdiff
path: root/src/device/gpio.c
blob: 96ceddade6b1ad98f8a8126267ff07f0257f3638 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* SPDX-License-Identifier: GPL-2.0-only */

#include <console/console.h>
#include <device/device.h>
#include <device/gpio.h>
#include <stddef.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;
}