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

Commit b15f0fb6 authored by Mathieu Poirier's avatar Mathieu Poirier Committed by Greg Kroah-Hartman
Browse files

coresight: removing bind/unbind options from sysfs

The coresight drivers have absolutely no control over bind and unbind
operations triggered from sysfs. The operations simply can't be
cancelled or denied event when one or several tracing sessions are
under way.  Since the memory associated to individual device is
invariably freed, the end result is a kernel crash when the path from
source to sink is travelled again as demonstrated here[1].

One solution could be to keep track of all the path (i.e tracing
session) that get created and iterate through the elements of those path
looking for the coresight device that is being removed.  This proposition
doesn't scale well since there is no upper bound on the amount of
concurrent trace session that can be created.

With the above in mind, this patch prevent devices from being unbounded
from their driver by using the driver->suppress_bind_attr option.  That way
trace sessions can be managed without fearing to loose devices.

Since device can't be removed anymore the xyz_remove() functions found in
each driver is also removed.

[1]. http://www.spinics.net/lists/arm-kernel/msg474952.html



Reported-by: default avatarRabin Vincent <rabin@rab.in>
Signed-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ad725aee
Loading
Loading
Loading
Loading
+1 −10
Original line number Original line Diff line number Diff line
@@ -489,15 +489,6 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id)
	return ret;
	return ret;
}
}


static int etb_remove(struct amba_device *adev)
{
	struct etb_drvdata *drvdata = amba_get_drvdata(adev);

	misc_deregister(&drvdata->miscdev);
	coresight_unregister(drvdata->csdev);
	return 0;
}

#ifdef CONFIG_PM
#ifdef CONFIG_PM
static int etb_runtime_suspend(struct device *dev)
static int etb_runtime_suspend(struct device *dev)
{
{
@@ -537,10 +528,10 @@ static struct amba_driver etb_driver = {
		.name	= "coresight-etb10",
		.name	= "coresight-etb10",
		.owner	= THIS_MODULE,
		.owner	= THIS_MODULE,
		.pm	= &etb_dev_pm_ops,
		.pm	= &etb_dev_pm_ops,
		.suppress_bind_attrs = true,


	},
	},
	.probe		= etb_probe,
	.probe		= etb_probe,
	.remove		= etb_remove,
	.id_table	= etb_ids,
	.id_table	= etb_ids,
};
};


+1 −12
Original line number Original line Diff line number Diff line
@@ -1877,17 +1877,6 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id)
	return ret;
	return ret;
}
}


static int etm_remove(struct amba_device *adev)
{
	struct etm_drvdata *drvdata = amba_get_drvdata(adev);

	coresight_unregister(drvdata->csdev);
	if (--etm_count == 0)
		unregister_hotcpu_notifier(&etm_cpu_notifier);

	return 0;
}

#ifdef CONFIG_PM
#ifdef CONFIG_PM
static int etm_runtime_suspend(struct device *dev)
static int etm_runtime_suspend(struct device *dev)
{
{
@@ -1948,9 +1937,9 @@ static struct amba_driver etm_driver = {
		.name	= "coresight-etm3x",
		.name	= "coresight-etm3x",
		.owner	= THIS_MODULE,
		.owner	= THIS_MODULE,
		.pm	= &etm_dev_pm_ops,
		.pm	= &etm_dev_pm_ops,
		.suppress_bind_attrs = true,
	},
	},
	.probe		= etm_probe,
	.probe		= etm_probe,
	.remove		= etm_remove,
	.id_table	= etm_ids,
	.id_table	= etm_ids,
};
};


+1 −12
Original line number Original line Diff line number Diff line
@@ -2684,17 +2684,6 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id)
	return ret;
	return ret;
}
}


static int etm4_remove(struct amba_device *adev)
{
	struct etmv4_drvdata *drvdata = amba_get_drvdata(adev);

	coresight_unregister(drvdata->csdev);
	if (--etm4_count == 0)
		unregister_hotcpu_notifier(&etm4_cpu_notifier);

	return 0;
}

static struct amba_id etm4_ids[] = {
static struct amba_id etm4_ids[] = {
	{       /* ETM 4.0 - Qualcomm */
	{       /* ETM 4.0 - Qualcomm */
		.id	= 0x0003b95d,
		.id	= 0x0003b95d,
@@ -2712,9 +2701,9 @@ static struct amba_id etm4_ids[] = {
static struct amba_driver etm4x_driver = {
static struct amba_driver etm4x_driver = {
	.drv = {
	.drv = {
		.name   = "coresight-etm4x",
		.name   = "coresight-etm4x",
		.suppress_bind_attrs = true,
	},
	},
	.probe		= etm4_probe,
	.probe		= etm4_probe,
	.remove		= etm4_remove,
	.id_table	= etm4_ids,
	.id_table	= etm4_ids,
};
};


+1 −9
Original line number Original line Diff line number Diff line
@@ -226,14 +226,6 @@ static int funnel_probe(struct amba_device *adev, const struct amba_id *id)
	return 0;
	return 0;
}
}


static int funnel_remove(struct amba_device *adev)
{
	struct funnel_drvdata *drvdata = amba_get_drvdata(adev);

	coresight_unregister(drvdata->csdev);
	return 0;
}

#ifdef CONFIG_PM
#ifdef CONFIG_PM
static int funnel_runtime_suspend(struct device *dev)
static int funnel_runtime_suspend(struct device *dev)
{
{
@@ -273,9 +265,9 @@ static struct amba_driver funnel_driver = {
		.name	= "coresight-funnel",
		.name	= "coresight-funnel",
		.owner	= THIS_MODULE,
		.owner	= THIS_MODULE,
		.pm	= &funnel_dev_pm_ops,
		.pm	= &funnel_dev_pm_ops,
		.suppress_bind_attrs = true,
	},
	},
	.probe		= funnel_probe,
	.probe		= funnel_probe,
	.remove		= funnel_remove,
	.id_table	= funnel_ids,
	.id_table	= funnel_ids,
};
};


+1 −10
Original line number Original line Diff line number Diff line
@@ -156,15 +156,6 @@ static int replicator_probe(struct amba_device *adev, const struct amba_id *id)
	return 0;
	return 0;
}
}


static int replicator_remove(struct amba_device *adev)
{
	struct replicator_state *drvdata = amba_get_drvdata(adev);

	pm_runtime_disable(&adev->dev);
	coresight_unregister(drvdata->csdev);
	return 0;
}

#ifdef CONFIG_PM
#ifdef CONFIG_PM
static int replicator_runtime_suspend(struct device *dev)
static int replicator_runtime_suspend(struct device *dev)
{
{
@@ -206,9 +197,9 @@ static struct amba_driver replicator_driver = {
	.drv = {
	.drv = {
		.name	= "coresight-replicator-qcom",
		.name	= "coresight-replicator-qcom",
		.pm	= &replicator_dev_pm_ops,
		.pm	= &replicator_dev_pm_ops,
		.suppress_bind_attrs = true,
	},
	},
	.probe		= replicator_probe,
	.probe		= replicator_probe,
	.remove		= replicator_remove,
	.id_table	= replicator_ids,
	.id_table	= replicator_ids,
};
};


Loading