Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6732d21e authored by Yuanfang Zhang's avatar Yuanfang Zhang
Browse files

soc: qcom: Fix mhi_qdss mode permission issue



QDSS mhi_qdss mode node permission sometimes cannot be updated
by ueventd, this is because mode node is not created after ueventd
received qdss KOBJ_ADD event. This change solves this issue.

Change-Id: Ibdb1051db7f442fb27f6501ec81742127e0bf930
Signed-off-by: default avatarYuanfang Zhang <zhangyuanfang@codeaurora.org>
parent c7849b7a
Loading
Loading
Loading
Loading
+18 −15
Original line number Diff line number Diff line
@@ -307,6 +307,21 @@ static ssize_t mode_store(struct device *dev,
static DEVICE_ATTR_RW(mode);
static DEVICE_ATTR_RO(curr_chan);

static struct attribute *qdss_bridge_attrs[] = {
	&dev_attr_mode.attr,
	&dev_attr_curr_chan.attr,
	NULL,
};

static const struct attribute_group qdss_bridge_group = {
	.attrs = qdss_bridge_attrs,
};

static const struct attribute_group *qdss_bridge_groups[] = {
	&qdss_bridge_group,
	NULL,
};

static void mhi_read_work_fn(struct work_struct *work)
{
	int err = 0;
@@ -838,7 +853,6 @@ static void qdss_mhi_remove(struct mhi_device *mhi_dev)
	} else
		spin_unlock_bh(&drvdata->lock);

	device_remove_file(drvdata->dev, &dev_attr_mode);
	device_destroy(mhi_class, drvdata->cdev.dev);
	cdev_del(&drvdata->cdev);
	unregister_chrdev_region(drvdata->cdev.dev, 1);
@@ -937,27 +951,14 @@ static int qdss_mhi_probe(struct mhi_device *mhi_dev,
	mhi_device_set_devdata(mhi_dev, drvdata);
	dev_set_drvdata(drvdata->dev, drvdata);

	ret = device_create_file(drvdata->dev, &dev_attr_mode);
	if (ret) {
		pr_err("mode sysfs node create failed error:%d\n", ret);
		goto exit_destroy_device;
	}
	ret = device_create_file(drvdata->dev, &dev_attr_curr_chan);
	if (ret) {
		pr_err("curr_chan sysfs node create failed error:%d\n", ret);
		goto exit_destroy_device;
	}

	ret = qdss_mhi_init(drvdata);
	if (ret) {
		pr_err("Device probe failed err:%d\n", ret);
		goto remove_sysfs_exit;
		goto exit_destroy_device;
	}
	queue_work(drvdata->mhi_wq, &drvdata->open_work);
	return 0;

remove_sysfs_exit:
	device_remove_file(drvdata->dev, &dev_attr_mode);
exit_destroy_device:
	device_destroy(mhi_class, drvdata->cdev.dev);
exit_cdev_add:
@@ -994,6 +995,8 @@ static int __init qdss_bridge_init(void)
	if (IS_ERR(mhi_class))
		return -ENODEV;

	mhi_class->dev_groups = qdss_bridge_groups;

	ret = mhi_driver_register(&qdss_mhi_driver);
	if (ret)
		class_destroy(mhi_class);