/* @dev: pointer to target char dev to be initialized @fops: file operation struct hook to this char device  */
int u_cdev_init(u_cdev_t *dev, void *fops)
/* @dev: pointer to target char dev to be initialized @fops: file operation struct hook to this char device  */
int u_cdev_init(u_cdev_t *dev, void *fops)
{
		cdev_err("invalid dev:%p or fops:%p\r\n", dev, fops);
		return -EINVAL;
	}
	if (dev->ops) {
		if (dev->ops != fops) {
			cdev_err("dev->ops:%p != fops:%p, ignore\r\n", dev->ops, fops);
			return -EINVAL;
		} else {
			cdev_warn("dev->ops is already assigned, ignore\r\n", dev->ops);
			return 0;
		}
	}
	dev->ops = fops;
	dev->thread_ctx = NULL;
	dlist_init(&dev->node);
	cdev_dbg("dev:%p init done, id:%d, fops:%p\r\n", dev, dev->dev_id, fops);
	return 0;
}