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

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
...@@ -2021,7 +2021,8 @@ static ssize_t hot_add_show(struct class *class, ...@@ -2021,7 +2021,8 @@ static ssize_t hot_add_show(struct class *class,
return ret; return ret;
return scnprintf(buf, PAGE_SIZE, "%d\n", 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, static ssize_t hot_remove_store(struct class *class,
struct class_attribute *attr, struct class_attribute *attr,
......
...@@ -2116,6 +2116,7 @@ static struct virtio_device_id id_table[] = { ...@@ -2116,6 +2116,7 @@ static struct virtio_device_id id_table[] = {
{ VIRTIO_ID_CONSOLE, VIRTIO_DEV_ANY_ID }, { VIRTIO_ID_CONSOLE, VIRTIO_DEV_ANY_ID },
{ 0 }, { 0 },
}; };
MODULE_DEVICE_TABLE(virtio, id_table);
static unsigned int features[] = { static unsigned int features[] = {
VIRTIO_CONSOLE_F_SIZE, VIRTIO_CONSOLE_F_SIZE,
...@@ -2128,6 +2129,7 @@ static struct virtio_device_id rproc_serial_id_table[] = { ...@@ -2128,6 +2129,7 @@ static struct virtio_device_id rproc_serial_id_table[] = {
#endif #endif
{ 0 }, { 0 },
}; };
MODULE_DEVICE_TABLE(virtio, rproc_serial_id_table);
static unsigned int rproc_serial_features[] = { static unsigned int rproc_serial_features[] = {
}; };
...@@ -2280,6 +2282,5 @@ static void __exit fini(void) ...@@ -2280,6 +2282,5 @@ static void __exit fini(void)
module_init(init); module_init(init);
module_exit(fini); module_exit(fini);
MODULE_DEVICE_TABLE(virtio, id_table);
MODULE_DESCRIPTION("Virtio console driver"); MODULE_DESCRIPTION("Virtio console driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -747,17 +747,50 @@ static int cti_dying_cpu(unsigned int cpu) ...@@ -747,17 +747,50 @@ static int cti_dying_cpu(unsigned int cpu)
return 0; 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 */ /* release PM registrations */
static void cti_pm_release(struct cti_drvdata *drvdata) static void cti_pm_release(struct cti_drvdata *drvdata)
{ {
if (drvdata->ctidev.cpu >= 0) { if (drvdata->ctidev.cpu == -1)
if (--nr_cti_cpu == 0) { return;
cpu_pm_unregister_notifier(&cti_cpu_pm_nb);
cpuhp_remove_state_nocalls(
CPUHP_AP_ARM_CORESIGHT_CTI_STARTING);
}
cti_cpu_drvdata[drvdata->ctidev.cpu] = NULL; 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) ...@@ -823,19 +856,14 @@ static int cti_probe(struct amba_device *adev, const struct amba_id *id)
/* driver data*/ /* driver data*/
drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
if (!drvdata) { if (!drvdata)
ret = -ENOMEM; return -ENOMEM;
dev_info(dev, "%s, mem err\n", __func__);
goto err_out;
}
/* Validity for the resource is already checked by the AMBA core */ /* Validity for the resource is already checked by the AMBA core */
base = devm_ioremap_resource(dev, res); base = devm_ioremap_resource(dev, res);
if (IS_ERR(base)) { if (IS_ERR(base))
ret = PTR_ERR(base); return PTR_ERR(base);
dev_err(dev, "%s, remap err\n", __func__);
goto err_out;
}
drvdata->base = base; drvdata->base = base;
dev_set_drvdata(dev, drvdata); dev_set_drvdata(dev, drvdata);
...@@ -854,8 +882,7 @@ static int cti_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -854,8 +882,7 @@ static int cti_probe(struct amba_device *adev, const struct amba_id *id)
pdata = coresight_cti_get_platform_data(dev); pdata = coresight_cti_get_platform_data(dev);
if (IS_ERR(pdata)) { if (IS_ERR(pdata)) {
dev_err(dev, "coresight_cti_get_platform_data err\n"); dev_err(dev, "coresight_cti_get_platform_data err\n");
ret = PTR_ERR(pdata); return PTR_ERR(pdata);
goto err_out;
} }
/* default to powered - could change on PM notifications */ /* 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) ...@@ -867,35 +894,20 @@ static int cti_probe(struct amba_device *adev, const struct amba_id *id)
drvdata->ctidev.cpu); drvdata->ctidev.cpu);
else else
cti_desc.name = coresight_alloc_device_name(&cti_sys_devs, dev); cti_desc.name = coresight_alloc_device_name(&cti_sys_devs, dev);
if (!cti_desc.name) { if (!cti_desc.name)
ret = -ENOMEM; return -ENOMEM;
goto err_out;
}
/* setup CPU power management handling for CPU bound CTI devices. */ /* setup CPU power management handling for CPU bound CTI devices. */
if (drvdata->ctidev.cpu >= 0) { ret = cti_pm_setup(drvdata);
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();
if (ret) if (ret)
goto err_out; return ret;
}
}
/* create dynamic attributes for connections */ /* create dynamic attributes for connections */
ret = cti_create_cons_sysfs(dev, drvdata); ret = cti_create_cons_sysfs(dev, drvdata);
if (ret) { if (ret) {
dev_err(dev, "%s: create dynamic sysfs entries failed\n", dev_err(dev, "%s: create dynamic sysfs entries failed\n",
cti_desc.name); cti_desc.name);
goto err_out; goto pm_release;
} }
/* set up coresight component description */ /* set up coresight component description */
...@@ -908,7 +920,7 @@ static int cti_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -908,7 +920,7 @@ static int cti_probe(struct amba_device *adev, const struct amba_id *id)
drvdata->csdev = coresight_register(&cti_desc); drvdata->csdev = coresight_register(&cti_desc);
if (IS_ERR(drvdata->csdev)) { if (IS_ERR(drvdata->csdev)) {
ret = PTR_ERR(drvdata->csdev); ret = PTR_ERR(drvdata->csdev);
goto err_out; goto pm_release;
} }
/* add to list of CTI devices */ /* add to list of CTI devices */
...@@ -927,7 +939,7 @@ static int cti_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -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"); dev_info(&drvdata->csdev->dev, "CTI initialized\n");
return 0; return 0;
err_out: pm_release:
cti_pm_release(drvdata); cti_pm_release(drvdata);
return ret; return ret;
} }
......
...@@ -1388,18 +1388,57 @@ static struct notifier_block etm4_cpu_pm_nb = { ...@@ -1388,18 +1388,57 @@ static struct notifier_block etm4_cpu_pm_nb = {
.notifier_call = etm4_cpu_pm_notify, .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)) int ret;
return cpu_pm_register_notifier(&etm4_cpu_pm_nb);
if (etm4_count++)
return 0; 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;
}
/* 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_cpu_pm_unregister(void) 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); 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) 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) ...@@ -1453,24 +1492,15 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id)
etm4_init_arch_data, drvdata, 1)) etm4_init_arch_data, drvdata, 1))
dev_err(dev, "ETM arch init failed\n"); dev_err(dev, "ETM arch init failed\n");
if (!etm4_count++) { ret = etm4_pm_setup_cpuslocked();
cpuhp_setup_state_nocalls_cpuslocked(CPUHP_AP_ARM_CORESIGHT_STARTING, cpus_read_unlock();
"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_cpu_pm_register(); /* etm4_pm_setup_cpuslocked() does its own cleanup - exit on error */
if (ret) if (ret) {
goto err_arch_supported; etmdrvdata[drvdata->cpu] = NULL;
return ret;
} }
cpus_read_unlock();
if (etm4_arch_supported(drvdata->arch) == false) { if (etm4_arch_supported(drvdata->arch) == false) {
ret = -EINVAL; ret = -EINVAL;
goto err_arch_supported; goto err_arch_supported;
...@@ -1517,13 +1547,7 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -1517,13 +1547,7 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id)
err_arch_supported: err_arch_supported:
etmdrvdata[drvdata->cpu] = NULL; etmdrvdata[drvdata->cpu] = NULL;
if (--etm4_count == 0) { etm4_pm_clear();
etm4_cpu_pm_unregister();
cpuhp_remove_state_nocalls(CPUHP_AP_ARM_CORESIGHT_STARTING);
if (hp_online)
cpuhp_remove_state_nocalls(hp_online);
}
return ret; return ret;
} }
......
...@@ -1021,15 +1021,30 @@ int intel_th_set_output(struct intel_th_device *thdev, ...@@ -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_device *hub = to_intel_th_hub(thdev);
struct intel_th_driver *hubdrv = to_intel_th_driver(hub->dev.driver); 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. */ /* In host mode, this is up to the external debugger, do nothing. */
if (hub->host_mode) if (hub->host_mode)
return 0; 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); EXPORT_SYMBOL_GPL(intel_th_set_output);
......
...@@ -233,11 +233,21 @@ static const struct pci_device_id intel_th_pci_id_table[] = { ...@@ -233,11 +233,21 @@ static const struct pci_device_id intel_th_pci_id_table[] = {
PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa0a6), PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa0a6),
.driver_data = (kernel_ulong_t)&intel_th_2x, .driver_data = (kernel_ulong_t)&intel_th_2x,
}, },
{
/* Tiger Lake PCH-H */
PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x43a6),
.driver_data = (kernel_ulong_t)&intel_th_2x,
},
{ {
/* Jasper Lake PCH */ /* Jasper Lake PCH */
PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4da6), PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4da6),
.driver_data = (kernel_ulong_t)&intel_th_2x, .driver_data = (kernel_ulong_t)&intel_th_2x,
}, },
{
/* Jasper Lake CPU */
PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4e29),
.driver_data = (kernel_ulong_t)&intel_th_2x,
},
{ {
/* Elkhart Lake CPU */ /* Elkhart Lake CPU */
PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4529), PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4529),
...@@ -248,6 +258,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { ...@@ -248,6 +258,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = {
PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4b26), PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4b26),
.driver_data = (kernel_ulong_t)&intel_th_2x, .driver_data = (kernel_ulong_t)&intel_th_2x,
}, },
{
/* Emmitsburg PCH */
PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x1bcc),
.driver_data = (kernel_ulong_t)&intel_th_2x,
},
{ 0 }, { 0 },
}; };
......
...@@ -161,9 +161,7 @@ static int sth_stm_link(struct stm_data *stm_data, unsigned int master, ...@@ -161,9 +161,7 @@ static int sth_stm_link(struct stm_data *stm_data, unsigned int master,
{ {
struct sth_device *sth = container_of(stm_data, struct sth_device, stm); struct sth_device *sth = container_of(stm_data, struct sth_device, stm);
intel_th_set_output(to_intel_th_device(sth->dev), master); return intel_th_set_output(to_intel_th_device(sth->dev), master);
return 0;
} }
static int intel_th_sw_init(struct sth_device *sth) static int intel_th_sw_init(struct sth_device *sth)
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/spinlock.h> #include <linux/mutex.h>
#include <linux/atmel-ssc.h> #include <linux/atmel-ssc.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include "../../sound/soc/atmel/atmel_ssc_dai.h" #include "../../sound/soc/atmel/atmel_ssc_dai.h"
/* Serialize access to ssc_list and user count */ /* Serialize access to ssc_list and user count */
static DEFINE_SPINLOCK(user_lock); static DEFINE_MUTEX(user_lock);
static LIST_HEAD(ssc_list); static LIST_HEAD(ssc_list);
struct ssc_device *ssc_request(unsigned int ssc_num) struct ssc_device *ssc_request(unsigned int ssc_num)
...@@ -28,7 +28,7 @@ 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; int ssc_valid = 0;
struct ssc_device *ssc; struct ssc_device *ssc;
spin_lock(&user_lock); mutex_lock(&user_lock);
list_for_each_entry(ssc, &ssc_list, list) { list_for_each_entry(ssc, &ssc_list, list) {
if (ssc->pdev->dev.of_node) { if (ssc->pdev->dev.of_node) {
if (of_alias_get_id(ssc->pdev->dev.of_node, "ssc") if (of_alias_get_id(ssc->pdev->dev.of_node, "ssc")
...@@ -44,18 +44,18 @@ struct ssc_device *ssc_request(unsigned int ssc_num) ...@@ -44,18 +44,18 @@ struct ssc_device *ssc_request(unsigned int ssc_num)
} }
if (!ssc_valid) { if (!ssc_valid) {
spin_unlock(&user_lock); mutex_unlock(&user_lock);
pr_err("ssc: ssc%d platform device is missing\n", ssc_num); pr_err("ssc: ssc%d platform device is missing\n", ssc_num);
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
} }
if (ssc->user) { if (ssc->user) {
spin_unlock(&user_lock); mutex_unlock(&user_lock);
dev_dbg(&ssc->pdev->dev, "module busy\n"); dev_dbg(&ssc->pdev->dev, "module busy\n");
return ERR_PTR(-EBUSY); return ERR_PTR(-EBUSY);
} }
ssc->user++; ssc->user++;
spin_unlock(&user_lock); mutex_unlock(&user_lock);
clk_prepare(ssc->clk); clk_prepare(ssc->clk);
...@@ -67,14 +67,14 @@ void ssc_free(struct ssc_device *ssc) ...@@ -67,14 +67,14 @@ void ssc_free(struct ssc_device *ssc)
{ {
bool disable_clk = true; bool disable_clk = true;
spin_lock(&user_lock); mutex_lock(&user_lock);
if (ssc->user) if (ssc->user)
ssc->user--; ssc->user--;
else { else {
disable_clk = false; disable_clk = false;
dev_dbg(&ssc->pdev->dev, "device already free\n"); dev_dbg(&ssc->pdev->dev, "device already free\n");
} }
spin_unlock(&user_lock); mutex_unlock(&user_lock);
if (disable_clk) if (disable_clk)
clk_unprepare(ssc->clk); clk_unprepare(ssc->clk);
...@@ -237,9 +237,9 @@ static int ssc_probe(struct platform_device *pdev) ...@@ -237,9 +237,9 @@ static int ssc_probe(struct platform_device *pdev)
return -ENXIO; return -ENXIO;
} }
spin_lock(&user_lock); mutex_lock(&user_lock);
list_add_tail(&ssc->list, &ssc_list); list_add_tail(&ssc->list, &ssc_list);
spin_unlock(&user_lock); mutex_unlock(&user_lock);
platform_set_drvdata(pdev, ssc); platform_set_drvdata(pdev, ssc);
...@@ -258,9 +258,9 @@ static int ssc_remove(struct platform_device *pdev) ...@@ -258,9 +258,9 @@ static int ssc_remove(struct platform_device *pdev)
ssc_sound_dai_remove(ssc); ssc_sound_dai_remove(ssc);
spin_lock(&user_lock); mutex_lock(&user_lock);
list_del(&ssc->list); list_del(&ssc->list);
spin_unlock(&user_lock); mutex_unlock(&user_lock);
return 0; return 0;
} }
......
...@@ -745,9 +745,8 @@ static int mei_cl_device_remove(struct device *dev) ...@@ -745,9 +745,8 @@ static int mei_cl_device_remove(struct device *dev)
mei_cl_bus_module_put(cldev); mei_cl_bus_module_put(cldev);
module_put(THIS_MODULE); module_put(THIS_MODULE);
dev->driver = NULL;
return ret;
return ret;
} }
static ssize_t name_show(struct device *dev, struct device_attribute *a, static ssize_t name_show(struct device *dev, struct device_attribute *a,
......
...@@ -545,13 +545,14 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work) ...@@ -545,13 +545,14 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work)
struct sun4i_usb_phy_data *data = struct sun4i_usb_phy_data *data =
container_of(work, struct sun4i_usb_phy_data, detect.work); container_of(work, struct sun4i_usb_phy_data, detect.work);
struct phy *phy0 = data->phys[0].phy; struct phy *phy0 = data->phys[0].phy;
struct sun4i_usb_phy *phy = phy_get_drvdata(phy0); struct sun4i_usb_phy *phy;
bool force_session_end, id_notify = false, vbus_notify = false; bool force_session_end, id_notify = false, vbus_notify = false;
int id_det, vbus_det; int id_det, vbus_det;
if (phy0 == NULL) if (!phy0)
return; return;
phy = phy_get_drvdata(phy0);
id_det = sun4i_usb_phy0_get_id_det(data); id_det = sun4i_usb_phy0_get_id_det(data);
vbus_det = sun4i_usb_phy0_get_vbus_det(data); vbus_det = sun4i_usb_phy0_get_vbus_det(data);
......
...@@ -134,7 +134,7 @@ static inline void combo_phy_w32_off_mask(void __iomem *base, unsigned int reg, ...@@ -134,7 +134,7 @@ static inline void combo_phy_w32_off_mask(void __iomem *base, unsigned int reg,
reg_val = readl(base + reg); reg_val = readl(base + reg);
reg_val &= ~mask; reg_val &= ~mask;
reg_val |= FIELD_PREP(mask, val); reg_val |= val;
writel(reg_val, base + reg); writel(reg_val, base + reg);
} }
...@@ -169,7 +169,7 @@ static int intel_cbphy_pcie_en_pad_refclk(struct intel_cbphy_iphy *iphy) ...@@ -169,7 +169,7 @@ static int intel_cbphy_pcie_en_pad_refclk(struct intel_cbphy_iphy *iphy)
return 0; return 0;
combo_phy_w32_off_mask(cbphy->app_base, PCIE_PHY_GEN_CTRL, combo_phy_w32_off_mask(cbphy->app_base, PCIE_PHY_GEN_CTRL,
PCIE_PHY_CLK_PAD, 0); PCIE_PHY_CLK_PAD, FIELD_PREP(PCIE_PHY_CLK_PAD, 0));
/* Delay for stable clock PLL */ /* Delay for stable clock PLL */
usleep_range(50, 100); usleep_range(50, 100);
...@@ -192,14 +192,14 @@ static int intel_cbphy_pcie_dis_pad_refclk(struct intel_cbphy_iphy *iphy) ...@@ -192,14 +192,14 @@ static int intel_cbphy_pcie_dis_pad_refclk(struct intel_cbphy_iphy *iphy)
return 0; return 0;
combo_phy_w32_off_mask(cbphy->app_base, PCIE_PHY_GEN_CTRL, combo_phy_w32_off_mask(cbphy->app_base, PCIE_PHY_GEN_CTRL,
PCIE_PHY_CLK_PAD, 1); PCIE_PHY_CLK_PAD, FIELD_PREP(PCIE_PHY_CLK_PAD, 1));
return 0; return 0;
} }
static int intel_cbphy_set_mode(struct intel_combo_phy *cbphy) static int intel_cbphy_set_mode(struct intel_combo_phy *cbphy)
{ {
enum intel_combo_mode cb_mode = PHY_PCIE_MODE; enum intel_combo_mode cb_mode;
enum aggregated_mode aggr = cbphy->aggr_mode; enum aggregated_mode aggr = cbphy->aggr_mode;
struct device *dev = cbphy->dev; struct device *dev = cbphy->dev;
enum intel_phy_mode mode; enum intel_phy_mode mode;
...@@ -224,6 +224,8 @@ static int intel_cbphy_set_mode(struct intel_combo_phy *cbphy) ...@@ -224,6 +224,8 @@ static int intel_cbphy_set_mode(struct intel_combo_phy *cbphy)
cb_mode = SATA0_SATA1_MODE; cb_mode = SATA0_SATA1_MODE;
break; break;
default:
return -EINVAL;
} }
ret = regmap_write(cbphy->hsiocfg, REG_COMBO_MODE(cbphy->bid), cb_mode); ret = regmap_write(cbphy->hsiocfg, REG_COMBO_MODE(cbphy->bid), cb_mode);
...@@ -385,7 +387,7 @@ static int intel_cbphy_calibrate(struct phy *phy) ...@@ -385,7 +387,7 @@ static int intel_cbphy_calibrate(struct phy *phy)
/* trigger auto RX adaptation */ /* trigger auto RX adaptation */
combo_phy_w32_off_mask(cr_base, CR_ADDR(PCS_XF_ATE_OVRD_IN_2, id), combo_phy_w32_off_mask(cr_base, CR_ADDR(PCS_XF_ATE_OVRD_IN_2, id),
ADAPT_REQ_MSK, 3); ADAPT_REQ_MSK, FIELD_PREP(ADAPT_REQ_MSK, 3));
/* Wait RX adaptation to finish */ /* Wait RX adaptation to finish */
ret = readl_poll_timeout(cr_base + CR_ADDR(PCS_XF_RX_ADAPT_ACK, id), ret = readl_poll_timeout(cr_base + CR_ADDR(PCS_XF_RX_ADAPT_ACK, id),
val, val & RX_ADAPT_ACK_BIT, 10, 5000); val, val & RX_ADAPT_ACK_BIT, 10, 5000);
...@@ -396,7 +398,7 @@ static int intel_cbphy_calibrate(struct phy *phy) ...@@ -396,7 +398,7 @@ static int intel_cbphy_calibrate(struct phy *phy)
/* Stop RX adaptation */ /* Stop RX adaptation */
combo_phy_w32_off_mask(cr_base, CR_ADDR(PCS_XF_ATE_OVRD_IN_2, id), combo_phy_w32_off_mask(cr_base, CR_ADDR(PCS_XF_ATE_OVRD_IN_2, id),
ADAPT_REQ_MSK, 0); ADAPT_REQ_MSK, FIELD_PREP(ADAPT_REQ_MSK, 0));
return ret; return ret;
} }
......
...@@ -607,8 +607,8 @@ static int inno_dsidphy_probe(struct platform_device *pdev) ...@@ -607,8 +607,8 @@ static int inno_dsidphy_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, inno); platform_set_drvdata(pdev, inno);
inno->phy_base = devm_platform_ioremap_resource(pdev, 0); inno->phy_base = devm_platform_ioremap_resource(pdev, 0);
if (!inno->phy_base) if (IS_ERR(inno->phy_base))
return -ENOMEM; return PTR_ERR(inno->phy_base);
inno->ref_clk = devm_clk_get(dev, "ref"); inno->ref_clk = devm_clk_get(dev, "ref");
if (IS_ERR(inno->ref_clk)) { if (IS_ERR(inno->ref_clk)) {
......
...@@ -72,7 +72,7 @@ struct serdes_am654_clk_mux { ...@@ -72,7 +72,7 @@ struct serdes_am654_clk_mux {
#define to_serdes_am654_clk_mux(_hw) \ #define to_serdes_am654_clk_mux(_hw) \
container_of(_hw, struct serdes_am654_clk_mux, hw) container_of(_hw, struct serdes_am654_clk_mux, hw)
static struct regmap_config serdes_am654_regmap_config = { static const struct regmap_config serdes_am654_regmap_config = {
.reg_bits = 32, .reg_bits = 32,
.val_bits = 32, .val_bits = 32,
.reg_stride = 4, .reg_stride = 4,
......
...@@ -117,7 +117,7 @@ struct wiz_clk_mux { ...@@ -117,7 +117,7 @@ struct wiz_clk_mux {
struct wiz_clk_divider { struct wiz_clk_divider {
struct clk_hw hw; struct clk_hw hw;
struct regmap_field *field; struct regmap_field *field;
struct clk_div_table *table; const struct clk_div_table *table;
struct clk_init_data clk_data; struct clk_init_data clk_data;
}; };
...@@ -131,7 +131,7 @@ struct wiz_clk_mux_sel { ...@@ -131,7 +131,7 @@ struct wiz_clk_mux_sel {
struct wiz_clk_div_sel { struct wiz_clk_div_sel {
struct regmap_field *field; struct regmap_field *field;
struct clk_div_table *table; const struct clk_div_table *table;
const char *node_name; const char *node_name;
}; };
...@@ -173,7 +173,7 @@ static struct wiz_clk_mux_sel clk_mux_sel_10g[] = { ...@@ -173,7 +173,7 @@ static struct wiz_clk_mux_sel clk_mux_sel_10g[] = {
}, },
}; };
static struct clk_div_table clk_div_table[] = { static const struct clk_div_table clk_div_table[] = {
{ .val = 0, .div = 1, }, { .val = 0, .div = 1, },
{ .val = 1, .div = 2, }, { .val = 1, .div = 2, },
{ .val = 2, .div = 4, }, { .val = 2, .div = 4, },
...@@ -559,7 +559,7 @@ static const struct clk_ops wiz_clk_div_ops = { ...@@ -559,7 +559,7 @@ static const struct clk_ops wiz_clk_div_ops = {
static int wiz_div_clk_register(struct wiz *wiz, struct device_node *node, static int wiz_div_clk_register(struct wiz *wiz, struct device_node *node,
struct regmap_field *field, struct regmap_field *field,
struct clk_div_table *table) const struct clk_div_table *table)
{ {
struct device *dev = wiz->dev; struct device *dev = wiz->dev;
struct wiz_clk_divider *div; struct wiz_clk_divider *div;
...@@ -756,7 +756,7 @@ static const struct reset_control_ops wiz_phy_reset_ops = { ...@@ -756,7 +756,7 @@ static const struct reset_control_ops wiz_phy_reset_ops = {
.deassert = wiz_phy_reset_deassert, .deassert = wiz_phy_reset_deassert,
}; };
static struct regmap_config wiz_regmap_config = { static const struct regmap_config wiz_regmap_config = {
.reg_bits = 32, .reg_bits = 32,
.val_bits = 32, .val_bits = 32,
.reg_stride = 4, .reg_stride = 4,
......
...@@ -930,7 +930,8 @@ static int intel_create_dai(struct sdw_cdns *cdns, ...@@ -930,7 +930,8 @@ static int intel_create_dai(struct sdw_cdns *cdns,
/* TODO: Read supported rates/formats from hardware */ /* TODO: Read supported rates/formats from hardware */
for (i = off; i < (off + num); i++) { for (i = off; i < (off + num); i++) {
dais[i].name = kasprintf(GFP_KERNEL, "SDW%d Pin%d", dais[i].name = devm_kasprintf(cdns->dev, GFP_KERNEL,
"SDW%d Pin%d",
cdns->instance, i); cdns->instance, i);
if (!dais[i].name) if (!dais[i].name)
return -ENOMEM; return -ENOMEM;
......
...@@ -159,9 +159,9 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev) ...@@ -159,9 +159,9 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)
priv->pdev = pdev; priv->pdev = pdev;
if (!uioinfo->irq) { if (!uioinfo->irq) {
ret = platform_get_irq(pdev, 0); ret = platform_get_irq_optional(pdev, 0);
uioinfo->irq = ret; uioinfo->irq = ret;
if (ret == -ENXIO && pdev->dev.of_node) if (ret == -ENXIO)
uioinfo->irq = UIO_IRQ_NONE; uioinfo->irq = UIO_IRQ_NONE;
else if (ret == -EPROBE_DEFER) else if (ret == -EPROBE_DEFER)
return ret; return ret;
......
...@@ -1444,7 +1444,7 @@ static int vbg_ioctl_change_guest_capabilities(struct vbg_dev *gdev, ...@@ -1444,7 +1444,7 @@ static int vbg_ioctl_change_guest_capabilities(struct vbg_dev *gdev,
or_mask = caps->u.in.or_mask; or_mask = caps->u.in.or_mask;
not_mask = caps->u.in.not_mask; not_mask = caps->u.in.not_mask;
if ((or_mask | not_mask) & ~VMMDEV_EVENT_VALID_EVENT_MASK) if ((or_mask | not_mask) & ~VMMDEV_GUEST_CAPABILITIES_MASK)
return -EINVAL; return -EINVAL;
ret = vbg_set_session_capabilities(gdev, session, or_mask, not_mask, ret = vbg_set_session_capabilities(gdev, session, or_mask, not_mask,
...@@ -1520,7 +1520,8 @@ int vbg_core_ioctl(struct vbg_session *session, unsigned int req, void *data) ...@@ -1520,7 +1520,8 @@ int vbg_core_ioctl(struct vbg_session *session, unsigned int req, void *data)
/* For VMMDEV_REQUEST hdr->type != VBG_IOCTL_HDR_TYPE_DEFAULT */ /* For VMMDEV_REQUEST hdr->type != VBG_IOCTL_HDR_TYPE_DEFAULT */
if (req_no_size == VBG_IOCTL_VMMDEV_REQUEST(0) || if (req_no_size == VBG_IOCTL_VMMDEV_REQUEST(0) ||
req == VBG_IOCTL_VMMDEV_REQUEST_BIG) req == VBG_IOCTL_VMMDEV_REQUEST_BIG ||
req == VBG_IOCTL_VMMDEV_REQUEST_BIG_ALT)
return vbg_ioctl_vmmrequest(gdev, session, data); return vbg_ioctl_vmmrequest(gdev, session, data);
if (hdr->type != VBG_IOCTL_HDR_TYPE_DEFAULT) if (hdr->type != VBG_IOCTL_HDR_TYPE_DEFAULT)
...@@ -1558,6 +1559,7 @@ int vbg_core_ioctl(struct vbg_session *session, unsigned int req, void *data) ...@@ -1558,6 +1559,7 @@ int vbg_core_ioctl(struct vbg_session *session, unsigned int req, void *data)
case VBG_IOCTL_HGCM_CALL(0): case VBG_IOCTL_HGCM_CALL(0):
return vbg_ioctl_hgcm_call(gdev, session, f32bit, data); return vbg_ioctl_hgcm_call(gdev, session, f32bit, data);
case VBG_IOCTL_LOG(0): case VBG_IOCTL_LOG(0):
case VBG_IOCTL_LOG_ALT(0):
return vbg_ioctl_log(data); return vbg_ioctl_log(data);
} }
......
...@@ -15,6 +15,21 @@ ...@@ -15,6 +15,21 @@
#include <linux/vboxguest.h> #include <linux/vboxguest.h>
#include "vmmdev.h" #include "vmmdev.h"
/*
* The mainline kernel version (this version) of the vboxguest module
* contained a bug where it defined VBGL_IOCTL_VMMDEV_REQUEST_BIG and
* VBGL_IOCTL_LOG using _IOC(_IOC_READ | _IOC_WRITE, 'V', ...) instead
* of _IO(V, ...) as the out of tree VirtualBox upstream version does.
*
* These _ALT definitions keep compatibility with the wrong defines the
* mainline kernel version used for a while.
* Note the VirtualBox userspace bits have always been built against
* VirtualBox upstream's headers, so this is likely not necessary. But
* we must never break our ABI so we keep these around to be 100% sure.
*/
#define VBG_IOCTL_VMMDEV_REQUEST_BIG_ALT _IOC(_IOC_READ | _IOC_WRITE, 'V', 3, 0)
#define VBG_IOCTL_LOG_ALT(s) _IOC(_IOC_READ | _IOC_WRITE, 'V', 9, s)
struct vbg_session; struct vbg_session;
/** VBox guest memory balloon. */ /** VBox guest memory balloon. */
......
...@@ -131,7 +131,8 @@ static long vbg_misc_device_ioctl(struct file *filp, unsigned int req, ...@@ -131,7 +131,8 @@ static long vbg_misc_device_ioctl(struct file *filp, unsigned int req,
* the need for a bounce-buffer and another copy later on. * the need for a bounce-buffer and another copy later on.
*/ */
is_vmmdev_req = (req & ~IOCSIZE_MASK) == VBG_IOCTL_VMMDEV_REQUEST(0) || is_vmmdev_req = (req & ~IOCSIZE_MASK) == VBG_IOCTL_VMMDEV_REQUEST(0) ||
req == VBG_IOCTL_VMMDEV_REQUEST_BIG; req == VBG_IOCTL_VMMDEV_REQUEST_BIG ||
req == VBG_IOCTL_VMMDEV_REQUEST_BIG_ALT;
if (is_vmmdev_req) if (is_vmmdev_req)
buf = vbg_req_alloc(size, VBG_IOCTL_HDR_TYPE_DEFAULT, buf = vbg_req_alloc(size, VBG_IOCTL_HDR_TYPE_DEFAULT,
......
...@@ -206,6 +206,8 @@ VMMDEV_ASSERT_SIZE(vmmdev_mask, 24 + 8); ...@@ -206,6 +206,8 @@ VMMDEV_ASSERT_SIZE(vmmdev_mask, 24 + 8);
* not. * not.
*/ */
#define VMMDEV_GUEST_SUPPORTS_GRAPHICS BIT(2) #define VMMDEV_GUEST_SUPPORTS_GRAPHICS BIT(2)
/* The mask of valid capabilities, for sanity checking. */
#define VMMDEV_GUEST_CAPABILITIES_MASK 0x00000007U
/** struct vmmdev_hypervisorinfo - Hypervisor info structure. */ /** struct vmmdev_hypervisorinfo - Hypervisor info structure. */
struct vmmdev_hypervisorinfo { struct vmmdev_hypervisorinfo {
......
...@@ -103,7 +103,7 @@ VMMDEV_ASSERT_SIZE(vbg_ioctl_driver_version_info, 24 + 20); ...@@ -103,7 +103,7 @@ VMMDEV_ASSERT_SIZE(vbg_ioctl_driver_version_info, 24 + 20);
/* IOCTL to perform a VMM Device request larger then 1KB. */ /* IOCTL to perform a VMM Device request larger then 1KB. */
#define VBG_IOCTL_VMMDEV_REQUEST_BIG _IOC(_IOC_READ | _IOC_WRITE, 'V', 3, 0) #define VBG_IOCTL_VMMDEV_REQUEST_BIG _IO('V', 3)
/** VBG_IOCTL_HGCM_CONNECT data structure. */ /** VBG_IOCTL_HGCM_CONNECT data structure. */
...@@ -198,7 +198,7 @@ struct vbg_ioctl_log { ...@@ -198,7 +198,7 @@ struct vbg_ioctl_log {
} u; } u;
}; };
#define VBG_IOCTL_LOG(s) _IOC(_IOC_READ | _IOC_WRITE, 'V', 9, s) #define VBG_IOCTL_LOG(s) _IO('V', 9)
/** VBG_IOCTL_WAIT_FOR_EVENTS data structure. */ /** VBG_IOCTL_WAIT_FOR_EVENTS data structure. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment