Commit 2d41d2ab authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Merge branch 'char-misc-linus' into 'char-misc-next'



We need the virtbox changes in here as well to build on top of.

Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parents 415abcdf 59d1d2e8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2021,7 +2021,8 @@ static ssize_t hot_add_show(struct class *class,
		return ret;
	return scnprintf(buf, PAGE_SIZE, "%d\n", ret);
}
static CLASS_ATTR_RO(hot_add);
static struct class_attribute class_attr_hot_add =
	__ATTR(hot_add, 0400, hot_add_show, NULL);

static ssize_t hot_remove_store(struct class *class,
			struct class_attribute *attr,
+54 −42
Original line number Diff line number Diff line
@@ -747,17 +747,50 @@ static int cti_dying_cpu(unsigned int cpu)
	return 0;
}

static int cti_pm_setup(struct cti_drvdata *drvdata)
{
	int ret;

	if (drvdata->ctidev.cpu == -1)
		return 0;

	if (nr_cti_cpu)
		goto done;

	cpus_read_lock();
	ret = cpuhp_setup_state_nocalls_cpuslocked(
			CPUHP_AP_ARM_CORESIGHT_CTI_STARTING,
			"arm/coresight_cti:starting",
			cti_starting_cpu, cti_dying_cpu);
	if (ret) {
		cpus_read_unlock();
		return ret;
	}

	ret = cpu_pm_register_notifier(&cti_cpu_pm_nb);
	cpus_read_unlock();
	if (ret) {
		cpuhp_remove_state_nocalls(CPUHP_AP_ARM_CORESIGHT_CTI_STARTING);
		return ret;
	}

done:
	nr_cti_cpu++;
	cti_cpu_drvdata[drvdata->ctidev.cpu] = drvdata;

	return 0;
}

/* release PM registrations */
static void cti_pm_release(struct cti_drvdata *drvdata)
{
	if (drvdata->ctidev.cpu >= 0) {
		if (--nr_cti_cpu == 0) {
			cpu_pm_unregister_notifier(&cti_cpu_pm_nb);
	if (drvdata->ctidev.cpu == -1)
		return;

			cpuhp_remove_state_nocalls(
				CPUHP_AP_ARM_CORESIGHT_CTI_STARTING);
		}
	cti_cpu_drvdata[drvdata->ctidev.cpu] = NULL;
	if (--nr_cti_cpu == 0) {
		cpu_pm_unregister_notifier(&cti_cpu_pm_nb);
		cpuhp_remove_state_nocalls(CPUHP_AP_ARM_CORESIGHT_CTI_STARTING);
	}
}

@@ -823,19 +856,14 @@ static int cti_probe(struct amba_device *adev, const struct amba_id *id)

	/* driver data*/
	drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
	if (!drvdata) {
		ret = -ENOMEM;
		dev_info(dev, "%s, mem err\n", __func__);
		goto err_out;
	}
	if (!drvdata)
		return -ENOMEM;

	/* Validity for the resource is already checked by the AMBA core */
	base = devm_ioremap_resource(dev, res);
	if (IS_ERR(base)) {
		ret = PTR_ERR(base);
		dev_err(dev, "%s, remap err\n", __func__);
		goto err_out;
	}
	if (IS_ERR(base))
		return PTR_ERR(base);

	drvdata->base = base;

	dev_set_drvdata(dev, drvdata);
@@ -854,8 +882,7 @@ static int cti_probe(struct amba_device *adev, const struct amba_id *id)
	pdata = coresight_cti_get_platform_data(dev);
	if (IS_ERR(pdata)) {
		dev_err(dev, "coresight_cti_get_platform_data err\n");
		ret =  PTR_ERR(pdata);
		goto err_out;
		return  PTR_ERR(pdata);
	}

	/* default to powered - could change on PM notifications */
@@ -867,35 +894,20 @@ static int cti_probe(struct amba_device *adev, const struct amba_id *id)
					       drvdata->ctidev.cpu);
	else
		cti_desc.name = coresight_alloc_device_name(&cti_sys_devs, dev);
	if (!cti_desc.name) {
		ret = -ENOMEM;
		goto err_out;
	}
	if (!cti_desc.name)
		return -ENOMEM;

	/* setup CPU power management handling for CPU bound CTI devices. */
	if (drvdata->ctidev.cpu >= 0) {
		cti_cpu_drvdata[drvdata->ctidev.cpu] = drvdata;
		if (!nr_cti_cpu++) {
			cpus_read_lock();
			ret = cpuhp_setup_state_nocalls_cpuslocked(
				CPUHP_AP_ARM_CORESIGHT_CTI_STARTING,
				"arm/coresight_cti:starting",
				cti_starting_cpu, cti_dying_cpu);

			if (!ret)
				ret = cpu_pm_register_notifier(&cti_cpu_pm_nb);
			cpus_read_unlock();
	ret = cti_pm_setup(drvdata);
	if (ret)
				goto err_out;
		}
	}
		return ret;

	/* create dynamic attributes for connections */
	ret = cti_create_cons_sysfs(dev, drvdata);
	if (ret) {
		dev_err(dev, "%s: create dynamic sysfs entries failed\n",
			cti_desc.name);
		goto err_out;
		goto pm_release;
	}

	/* set up coresight component description */
@@ -908,7 +920,7 @@ static int cti_probe(struct amba_device *adev, const struct amba_id *id)
	drvdata->csdev = coresight_register(&cti_desc);
	if (IS_ERR(drvdata->csdev)) {
		ret = PTR_ERR(drvdata->csdev);
		goto err_out;
		goto pm_release;
	}

	/* add to list of CTI devices */
@@ -927,7 +939,7 @@ static int cti_probe(struct amba_device *adev, const struct amba_id *id)
	dev_info(&drvdata->csdev->dev, "CTI initialized\n");
	return 0;

err_out:
pm_release:
	cti_pm_release(drvdata);
	return ret;
}
+53 −29
Original line number Diff line number Diff line
@@ -1388,18 +1388,57 @@ static struct notifier_block etm4_cpu_pm_nb = {
	.notifier_call = etm4_cpu_pm_notify,
};

static int etm4_cpu_pm_register(void)
/* Setup PM. Called with cpus locked. Deals with error conditions and counts */
static int etm4_pm_setup_cpuslocked(void)
{
	if (IS_ENABLED(CONFIG_CPU_PM))
		return cpu_pm_register_notifier(&etm4_cpu_pm_nb);
	int ret;

	if (etm4_count++)
		return 0;

	ret = cpu_pm_register_notifier(&etm4_cpu_pm_nb);
	if (ret)
		goto reduce_count;

	ret = cpuhp_setup_state_nocalls_cpuslocked(CPUHP_AP_ARM_CORESIGHT_STARTING,
						   "arm/coresight4:starting",
						   etm4_starting_cpu, etm4_dying_cpu);

	if (ret)
		goto unregister_notifier;

	ret = cpuhp_setup_state_nocalls_cpuslocked(CPUHP_AP_ONLINE_DYN,
						   "arm/coresight4:online",
						   etm4_online_cpu, NULL);

	/* HP dyn state ID returned in ret on success */
	if (ret > 0) {
		hp_online = ret;
		return 0;
	}

static void etm4_cpu_pm_unregister(void)
	/* failed dyn state - remove others */
	cpuhp_remove_state_nocalls_cpuslocked(CPUHP_AP_ARM_CORESIGHT_STARTING);

unregister_notifier:
	cpu_pm_unregister_notifier(&etm4_cpu_pm_nb);

reduce_count:
	--etm4_count;
	return ret;
}

static void etm4_pm_clear(void)
{
	if (IS_ENABLED(CONFIG_CPU_PM))
	if (--etm4_count != 0)
		return;

	cpu_pm_unregister_notifier(&etm4_cpu_pm_nb);
	cpuhp_remove_state_nocalls(CPUHP_AP_ARM_CORESIGHT_STARTING);
	if (hp_online) {
		cpuhp_remove_state_nocalls(hp_online);
		hp_online = 0;
	}
}

static int etm4_probe(struct amba_device *adev, const struct amba_id *id)
@@ -1453,24 +1492,15 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id)
				etm4_init_arch_data,  drvdata, 1))
		dev_err(dev, "ETM arch init failed\n");

	if (!etm4_count++) {
		cpuhp_setup_state_nocalls_cpuslocked(CPUHP_AP_ARM_CORESIGHT_STARTING,
						     "arm/coresight4:starting",
						     etm4_starting_cpu, etm4_dying_cpu);
		ret = cpuhp_setup_state_nocalls_cpuslocked(CPUHP_AP_ONLINE_DYN,
							   "arm/coresight4:online",
							   etm4_online_cpu, NULL);
		if (ret < 0)
			goto err_arch_supported;
		hp_online = ret;
	ret = etm4_pm_setup_cpuslocked();
	cpus_read_unlock();

		ret = etm4_cpu_pm_register();
		if (ret)
			goto err_arch_supported;
	/* etm4_pm_setup_cpuslocked() does its own cleanup - exit on error */
	if (ret) {
		etmdrvdata[drvdata->cpu] = NULL;
		return ret;
	}

	cpus_read_unlock();

	if (etm4_arch_supported(drvdata->arch) == false) {
		ret = -EINVAL;
		goto err_arch_supported;
@@ -1517,13 +1547,7 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id)

err_arch_supported:
	etmdrvdata[drvdata->cpu] = NULL;
	if (--etm4_count == 0) {
		etm4_cpu_pm_unregister();

		cpuhp_remove_state_nocalls(CPUHP_AP_ARM_CORESIGHT_STARTING);
		if (hp_online)
			cpuhp_remove_state_nocalls(hp_online);
	}
	etm4_pm_clear();
	return ret;
}

+12 −12
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/spinlock.h>
#include <linux/mutex.h>
#include <linux/atmel-ssc.h>
#include <linux/slab.h>
#include <linux/module.h>
@@ -20,7 +20,7 @@
#include "../../sound/soc/atmel/atmel_ssc_dai.h"

/* Serialize access to ssc_list and user count */
static DEFINE_SPINLOCK(user_lock);
static DEFINE_MUTEX(user_lock);
static LIST_HEAD(ssc_list);

struct ssc_device *ssc_request(unsigned int ssc_num)
@@ -28,7 +28,7 @@ struct ssc_device *ssc_request(unsigned int ssc_num)
	int ssc_valid = 0;
	struct ssc_device *ssc;

	spin_lock(&user_lock);
	mutex_lock(&user_lock);
	list_for_each_entry(ssc, &ssc_list, list) {
		if (ssc->pdev->dev.of_node) {
			if (of_alias_get_id(ssc->pdev->dev.of_node, "ssc")
@@ -44,18 +44,18 @@ struct ssc_device *ssc_request(unsigned int ssc_num)
	}

	if (!ssc_valid) {
		spin_unlock(&user_lock);
		mutex_unlock(&user_lock);
		pr_err("ssc: ssc%d platform device is missing\n", ssc_num);
		return ERR_PTR(-ENODEV);
	}

	if (ssc->user) {
		spin_unlock(&user_lock);
		mutex_unlock(&user_lock);
		dev_dbg(&ssc->pdev->dev, "module busy\n");
		return ERR_PTR(-EBUSY);
	}
	ssc->user++;
	spin_unlock(&user_lock);
	mutex_unlock(&user_lock);

	clk_prepare(ssc->clk);

@@ -67,14 +67,14 @@ void ssc_free(struct ssc_device *ssc)
{
	bool disable_clk = true;

	spin_lock(&user_lock);
	mutex_lock(&user_lock);
	if (ssc->user)
		ssc->user--;
	else {
		disable_clk = false;
		dev_dbg(&ssc->pdev->dev, "device already free\n");
	}
	spin_unlock(&user_lock);
	mutex_unlock(&user_lock);

	if (disable_clk)
		clk_unprepare(ssc->clk);
@@ -237,9 +237,9 @@ static int ssc_probe(struct platform_device *pdev)
		return -ENXIO;
	}

	spin_lock(&user_lock);
	mutex_lock(&user_lock);
	list_add_tail(&ssc->list, &ssc_list);
	spin_unlock(&user_lock);
	mutex_unlock(&user_lock);

	platform_set_drvdata(pdev, ssc);

@@ -258,9 +258,9 @@ static int ssc_remove(struct platform_device *pdev)

	ssc_sound_dai_remove(ssc);

	spin_lock(&user_lock);
	mutex_lock(&user_lock);
	list_del(&ssc->list);
	spin_unlock(&user_lock);
	mutex_unlock(&user_lock);

	return 0;
}
+1 −2
Original line number Diff line number Diff line
@@ -745,9 +745,8 @@ static int mei_cl_device_remove(struct device *dev)

	mei_cl_bus_module_put(cldev);
	module_put(THIS_MODULE);
	dev->driver = NULL;
	return ret;

	return ret;
}

static ssize_t name_show(struct device *dev, struct device_attribute *a,
Loading