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

Commit 27b018b3 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "char: msm_smd_pkt: flush pending work on release"

parents e54c9fc0 1a77e412
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -1035,11 +1035,7 @@ int smd_pkt_open(struct inode *inode, struct file *file)

	mutex_lock(&smd_pkt_devp->ch_lock);
	if (smd_pkt_devp->ch == 0) {
		wakeup_source_init(&smd_pkt_devp->pa_ws,
							smd_pkt_devp->dev_name);
		INIT_WORK(&smd_pkt_devp->packet_arrival_work,
				packet_arrival_worker);
		init_completion(&smd_pkt_devp->ch_allocated);
		INIT_COMPLETION(smd_pkt_devp->ch_allocated);

		r = smd_pkt_add_driver(smd_pkt_devp);
		if (r) {
@@ -1144,9 +1140,6 @@ release_pd:
	if (r < 0)
		smd_pkt_remove_driver(smd_pkt_devp);
out:
	if (!smd_pkt_devp->ch)
		wakeup_source_trash(&smd_pkt_devp->pa_ws);

	mutex_unlock(&smd_pkt_devp->ch_lock);


@@ -1183,12 +1176,15 @@ int smd_pkt_release(struct inode *inode, struct file *file)
		smd_pkt_devp->has_reset = 0;
		smd_pkt_devp->do_reset_notification = 0;
		smd_pkt_devp->ws_locked = 0;
		wakeup_source_trash(&smd_pkt_devp->pa_ws);
	}
	mutex_unlock(&smd_pkt_devp->tx_lock);
	mutex_unlock(&smd_pkt_devp->rx_lock);
	mutex_unlock(&smd_pkt_devp->ch_lock);

	if (flush_work(&smd_pkt_devp->packet_arrival_work))
		D_STATUS("%s: Flushed work for smd_pkt_dev id:%d\n", __func__,
				smd_pkt_devp->i);

	D_STATUS("Finished %s on smd_pkt_dev id:%d\n",
		 __func__, smd_pkt_devp->i);

@@ -1223,6 +1219,9 @@ static int smd_pkt_init_add_device(struct smd_pkt_dev *smd_pkt_devp, int i)
	mutex_init(&smd_pkt_devp->ch_lock);
	mutex_init(&smd_pkt_devp->rx_lock);
	mutex_init(&smd_pkt_devp->tx_lock);
	wakeup_source_init(&smd_pkt_devp->pa_ws, smd_pkt_devp->dev_name);
	INIT_WORK(&smd_pkt_devp->packet_arrival_work, packet_arrival_worker);
	init_completion(&smd_pkt_devp->ch_allocated);

	cdev_init(&smd_pkt_devp->cdev, &smd_pkt_fops);
	smd_pkt_devp->cdev.owner = THIS_MODULE;
@@ -1246,6 +1245,7 @@ static int smd_pkt_init_add_device(struct smd_pkt_dev *smd_pkt_devp, int i)
			__func__, i);
		r = -ENOMEM;
		cdev_del(&smd_pkt_devp->cdev);
		wakeup_source_trash(&smd_pkt_devp->pa_ws);
		return r;
	}
	if (device_create_file(smd_pkt_devp->devicep,