1 /*
2  * Copyright (c) 2013 Corey Tabaka
3  *
4  * Use of this source code is governed by a MIT-style
5  * license that can be found in the LICENSE file or at
6  * https://opensource.org/licenses/MIT
7  */
8 
9 #include <lk/err.h>
10 #include <dev/class/spi.h>
11 
class_spi_transaction(struct device * dev,struct spi_transaction * txn,size_t count)12 ssize_t class_spi_transaction(struct device *dev, struct spi_transaction *txn, size_t count) {
13     struct spi_ops *ops = device_get_driver_ops(dev, struct spi_ops, std);
14     if (!ops)
15         return ERR_NOT_CONFIGURED;
16 
17     if (ops->transaction)
18         return ops->transaction(dev, txn, count);
19     else
20         return ERR_NOT_SUPPORTED;
21 }
22 
23