Skip to content

Commit da95cf6

Browse files
committed
Merge tag 'coresight-fixes-v6.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/coresight/linux into char-misc-next
Suzuki writes: "coresight: Fixes for v6.1 Fixes for coresight drivers for v6.1 - Fix possible deadlock CTI mutexes (LOCKDEP) - Fix hang in CTI with runtime power management" * tag 'coresight-fixes-v6.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/coresight/linux: coresight: cti: Fix hang in cti_disable_hw() coresight: Fix possible deadlock with lock dependency
2 parents 9abf231 + 665c157 commit da95cf6

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

drivers/hwtracing/coresight/coresight-core.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,14 +1687,15 @@ struct coresight_device *coresight_register(struct coresight_desc *desc)
16871687
ret = coresight_fixup_device_conns(csdev);
16881688
if (!ret)
16891689
ret = coresight_fixup_orphan_conns(csdev);
1690-
if (!ret && cti_assoc_ops && cti_assoc_ops->add)
1691-
cti_assoc_ops->add(csdev);
16921690

16931691
out_unlock:
16941692
mutex_unlock(&coresight_mutex);
16951693
/* Success */
1696-
if (!ret)
1694+
if (!ret) {
1695+
if (cti_assoc_ops && cti_assoc_ops->add)
1696+
cti_assoc_ops->add(csdev);
16971697
return csdev;
1698+
}
16981699

16991700
/* Unregister the device if needed */
17001701
if (registered) {

drivers/hwtracing/coresight/coresight-cti-core.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ static int cti_enable_hw(struct cti_drvdata *drvdata)
9494
unsigned long flags;
9595
int rc = 0;
9696

97-
pm_runtime_get_sync(dev->parent);
9897
spin_lock_irqsave(&drvdata->spinlock, flags);
9998

10099
/* no need to do anything if enabled or unpowered*/
@@ -119,7 +118,6 @@ static int cti_enable_hw(struct cti_drvdata *drvdata)
119118
/* cannot enable due to error */
120119
cti_err_not_enabled:
121120
spin_unlock_irqrestore(&drvdata->spinlock, flags);
122-
pm_runtime_put(dev->parent);
123121
return rc;
124122
}
125123

@@ -175,7 +173,6 @@ static int cti_disable_hw(struct cti_drvdata *drvdata)
175173
coresight_disclaim_device_unlocked(csdev);
176174
CS_LOCK(drvdata->base);
177175
spin_unlock(&drvdata->spinlock);
178-
pm_runtime_put(dev->parent);
179176
return 0;
180177

181178
/* not disabled this call */
@@ -541,7 +538,7 @@ cti_match_fixup_csdev(struct cti_device *ctidev, const char *node_name,
541538
/*
542539
* Search the cti list to add an associated CTI into the supplied CS device
543540
* This will set the association if CTI declared before the CS device.
544-
* (called from coresight_register() with coresight_mutex locked).
541+
* (called from coresight_register() without coresight_mutex locked).
545542
*/
546543
static void cti_add_assoc_to_csdev(struct coresight_device *csdev)
547544
{
@@ -569,7 +566,8 @@ static void cti_add_assoc_to_csdev(struct coresight_device *csdev)
569566
* if we found a matching csdev then update the ECT
570567
* association pointer for the device with this CTI.
571568
*/
572-
csdev->ect_dev = ect_item->csdev;
569+
coresight_set_assoc_ectdev_mutex(csdev->ect_dev,
570+
ect_item->csdev);
573571
break;
574572
}
575573
}

0 commit comments

Comments
 (0)