#include <linux/fpga/fpga-bridge.h>
#include <linux/fpga/fpga-mgr.h>
#include <linux/fpga/fpga-region.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/spinlock.h>
static DEFINE_IDA(fpga_region_ida);
static struct class *fpga_region_class;
struct fpga_region *fpga_region_class_find(
struct device *start, const void *data,
int (*match)(struct device *, const void *))
dev = class_find_device(fpga_region_class, start, data, match);
return to_fpga_region(dev);
EXPORT_SYMBOL_GPL(fpga_region_class_find);
static struct fpga_region *fpga_region_get(struct fpga_region *region)
struct device *dev = ®ion->dev;
if (!mutex_trylock(®ion->mutex)) {
dev_dbg(dev, "%s: FPGA Region already in use\n", __func__);
if (!try_module_get(dev->parent->driver->owner)) {
mutex_unlock(®ion->mutex);