/* SPDX-License-Identifier: GPL-2.0-only */

#ifndef _FAUX_DEVICE_H_
#define _FAUX_DEVICE_H_

#include <linux/container_of.h>
#include <linux/device.h>


struct faux_device {
	struct device dev;
};
#define to_faux_device(x) container_of_const((x), struct faux_device, dev)


struct faux_device_ops {
	int (*probe)(struct faux_device *faux_dev);
	void (*remove)(struct faux_device *faux_dev);
};

struct faux_device *faux_device_create(const char *name,
				       struct device *parent,
				       const struct faux_device_ops *faux_ops);
struct faux_device *faux_device_create_with_groups(const char *name,
						   struct device *parent,
						   const struct faux_device_ops *faux_ops,
						   const struct attribute_group **groups);
void faux_device_destroy(struct faux_device *faux_dev);

static inline void *faux_device_get_drvdata(const struct faux_device *faux_dev)
{
	return dev_get_drvdata(&faux_dev->dev);
}

static inline void faux_device_set_drvdata(struct faux_device *faux_dev, void *data)
{
	dev_set_drvdata(&faux_dev->dev, data);
}

#endif 
