#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/uaccess.h>
#define GNSS_FLAG_HAS_WRITE_RAW BIT(0)
static DEFINE_IDA(gnss_minors);
#define GNSS_READ_FIFO_SIZE 4096
#define GNSS_WRITE_BUF_SIZE 1024
#define to_gnss_device(d) container_of((d), struct gnss_device, dev)
static int gnss_open(struct inode *inode, struct file *file)
struct gnss_device *gdev;
gdev = container_of(inode->i_cdev, struct gnss_device, cdev);
stream_open(inode, file);
file->private_data = gdev;
down_write(&gdev->rwsem);
if (gdev->disconnected) {
if (gdev->count++ == 0) {
ret = gdev->ops->open(gdev);