summaryrefslogtreecommitdiff
path: root/src/device/gpio.c
blob: 5e714970243977519e4b0504416e183ac6cfed59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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;
}