@@ -142,8 +142,28 @@ struct bb_info {
};
static struct kmem_cache *bb_info_cachep;
+static int fujitsu_hwb_dev_open(struct inode *inode, struct file *filp)
+{
+ struct hwb_private_data *pdata;
+
+ pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
+ if (!pdata)
+ return -ENOMEM;
+ INIT_LIST_HEAD(&pdata->bb_list);
+ spin_lock_init(&pdata->list_lock);
+
+ /*
+ * misc_open() sets pointer of the miscdevice to filp->private_data.
+ * Just override it since barrier fops does not use it
+ */
+ filp->private_data = pdata;
+
+ return 0;
+}
+
static const struct file_operations fujitsu_hwb_dev_fops = {
.owner = THIS_MODULE,
+ .open = fujitsu_hwb_dev_open,
};
static struct miscdevice bar_miscdev = {
Nothing special. Just preparing private_data for this FD. Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com> --- drivers/soc/fujitsu/fujitsu_hwb.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)