Commit 3e543a4d authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'char-misc-5.8-rc6' of...

Merge tag 'char-misc-5.8-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc into master

Pull char/misc fixes from Greg KH:
 "Here are number of small char/misc driver fixes for 5.8-rc6

  Not that many complex fixes here, just a number of small fixes for
  reported issues, and some new device ids. Nothing fancy.

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'char-misc-5.8-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (21 commits)
  virtio: virtio_console: add missing MODULE_DEVICE_TABLE() for rproc serial
  intel_th: Fix a NULL dereference when hub driver is not loaded
  intel_th: pci: Add Emmitsburg PCH support
  intel_th: pci: Add Tiger Lake PCH-H support
  intel_th: pci: Add Jasper Lake CPU support
  virt: vbox: Fix guest capabilities mask check
  virt: vbox: Fix VBGL_IOCTL_VMMDEV_REQUEST_BIG and _LOG req numbers to match upstream
  uio_pdrv_genirq: fix use without device tree and no interrupt
  uio_pdrv_genirq: Remove warning when irq is not specified
  coresight: etmv4: Fix CPU power management setup in probe() function
  coresight: cti: Fix error handling in probe
  Revert "zram: convert remaining CLASS_ATTR() to CLASS_ATTR_RO()"
  mei: bus: don't clean driver pointer
  misc: atmel-ssc: lock with mutex instead of spinlock
  phy: sun4i-usb: fix dereference of pointer phy0 before it is null checked
  phy: rockchip: Fix return value of inno_dsidphy_probe()
  phy: ti: j721e-wiz: Constify structs
  phy: ti: am654-serdes: Constify regmap_config
  phy: intel: fix enum type mismatch warning
  phy: intel: Fix compilation error on FIELD_PREP usage
  ...
parents 50ad1c21 897c44f0
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,
+2 −1
Original line number Diff line number Diff line
@@ -2116,6 +2116,7 @@ static struct virtio_device_id id_table[] = {
	{ VIRTIO_ID_CONSOLE, VIRTIO_DEV_ANY_ID },
	{ 0 },
};
MODULE_DEVICE_TABLE(virtio, id_table);

static unsigned int features[] = {
	VIRTIO_CONSOLE_F_SIZE,
@@ -2128,6 +2129,7 @@ static struct virtio_device_id rproc_serial_id_table[] = {
#endif
	{ 0 },
};
MODULE_DEVICE_TABLE(virtio, rproc_serial_id_table);

static unsigned int rproc_serial_features[] = {
};
@@ -2280,6 +2282,5 @@ static void __exit fini(void)
module_init(init);
module_exit(fini);

MODULE_DEVICE_TABLE(virtio, id_table);
MODULE_DESCRIPTION("Virtio console driver");
MODULE_LICENSE("GPL");
+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;
}

+18 −3
Original line number Diff line number Diff line
@@ -1021,15 +1021,30 @@ int intel_th_set_output(struct intel_th_device *thdev,
{
	struct intel_th_device *hub = to_intel_th_hub(thdev);
	struct intel_th_driver *hubdrv = to_intel_th_driver(hub->dev.driver);
	int ret;

	/* In host mode, this is up to the external debugger, do nothing. */
	if (hub->host_mode)
		return 0;

	if (!hubdrv->set_output)
		return -ENOTSUPP;
	/*
	 * hub is instantiated together with the source device that
	 * calls here, so guaranteed to be present.
	 */
	hubdrv = to_intel_th_driver(hub->dev.driver);
	if (!hubdrv || !try_module_get(hubdrv->driver.owner))
		return -EINVAL;

	return hubdrv->set_output(hub, master);
	if (!hubdrv->set_output) {
		ret = -ENOTSUPP;
		goto out;
	}

	ret = hubdrv->set_output(hub, master);

out:
	module_put(hubdrv->driver.owner);
	return ret;
}
EXPORT_SYMBOL_GPL(intel_th_set_output);

Loading