coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
gpio.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <console/console.h>
4 #include <device/device.h>
5 #include <device/gpio.h>
6 
7 const struct gpio_operations *dev_get_gpio_ops(struct device *dev)
8 {
9  if (!dev) {
10  printk(BIOS_ERR, "Could not get gpio operations, device is NULL.");
11  return NULL;
12  } else if (!dev->ops) {
13  printk(BIOS_ERR, "Could not get gpio operations, dev->ops is NULL.");
14  return NULL;
15  } else if (!dev->ops->ops_gpio) {
16  printk(BIOS_ERR, "Could not get gpio operations, ops_gpio is NULL.");
17  return NULL;
18  }
19 
20  return dev->ops->ops_gpio;
21 }
#define printk(level,...)
Definition: stdlib.h:16
const struct gpio_operations * dev_get_gpio_ops(struct device *dev)
Definition: gpio.c:7
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
Definition: loglevel.h:72
#define NULL
Definition: stddef.h:19
const struct gpio_operations * ops_gpio
Definition: device.h:67
Definition: device.h:107
struct device_operations * ops
Definition: device.h:143