Commit 3475b91f authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'tag-chrome-platform-for-v6.7' of...

Merge tag 'tag-chrome-platform-for-v6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux

Pull chrome platform updates from Tzung-Bi Shih:
 "Improvements:

   - Annotate flexible array members with __counted_by

   - Convert platform drivers' .remove callbacks to return void

  Fixes:

   - Avoid MKBP event timeouts by disabling/enabling IRQ later/earlier

  Misc:

   - Minor cleanups and fixes"

* tag 'tag-chrome-platform-for-v6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux: (21 commits)
  platform/chrome: cros_ec_lpc: Separate host command and irq disable
  platform/chrome: kunit: make EC protocol tests independent
  platform/chrome: kunit: initialize lock for fake ec_dev
  platform/chrome: cros_ec: fix compilation warning
  platform/chrome: cros_ec_proto: Mark outdata as const
  platform/chrome: cros_typec_vdm: Mark port_amode_ops const
  platform/chrome: cros_ec_typec: Use dev_err_probe() more
  platform/chrome: cros_ec_typec: Use semi-colons instead of commas
  platform/chrome/wilco_ec: telemetry: Convert to platform remove callback returning void
  platform/chrome/wilco_ec: debugfs: Convert to platform remove callback returning void
  platform/chrome/wilco_ec: core: Convert to platform remove callback returning void
  platform/chrome: cros_usbpd_notify: Convert to platform remove callback returning void
  platform/chrome: cros_usbpd_logger: Convert to platform remove callback returning void
  platform/chrome: cros_typec_switch: Convert to platform remove callback returning void
  platform/chrome: cros_ec_vbc: Convert to platform remove callback returning void
  platform/chrome: cros_ec_sysfs: Convert to platform remove callback returning void
  platform/chrome: cros_ec_lpc: Convert to platform remove callback returning void
  platform/chrome: cros_ec_lightbar: Convert to platform remove callback returning void
  platform/chrome: cros_ec_debugfs: Convert to platform remove callback returning void
  platform/chrome: cros_ec_chardev: Convert to platform remove callback returning void
  ...
parents f9a7eda4 47ea0ddb
...@@ -299,12 +299,12 @@ config CROS_TYPEC_SWITCH ...@@ -299,12 +299,12 @@ config CROS_TYPEC_SWITCH
source "drivers/platform/chrome/wilco_ec/Kconfig" source "drivers/platform/chrome/wilco_ec/Kconfig"
# Kunit test cases # Kunit test cases
config CROS_KUNIT config CROS_KUNIT_EC_PROTO_TEST
tristate "Kunit tests for ChromeOS" if !KUNIT_ALL_TESTS tristate "Kunit tests for ChromeOS EC protocol" if !KUNIT_ALL_TESTS
depends on KUNIT && CROS_EC depends on KUNIT && CROS_EC
default KUNIT_ALL_TESTS default KUNIT_ALL_TESTS
select CROS_EC_PROTO select CROS_EC_PROTO
help help
ChromeOS Kunit tests. Kunit tests for ChromeOS EC protocol.
endif # CHROMEOS_PLATFORMS endif # CHROMEOS_PLATFORMS
...@@ -36,6 +36,5 @@ obj-$(CONFIG_CROS_USBPD_NOTIFY) += cros_usbpd_notify.o ...@@ -36,6 +36,5 @@ obj-$(CONFIG_CROS_USBPD_NOTIFY) += cros_usbpd_notify.o
obj-$(CONFIG_WILCO_EC) += wilco_ec/ obj-$(CONFIG_WILCO_EC) += wilco_ec/
# Kunit test cases # Kunit test cases
obj-$(CONFIG_CROS_KUNIT) += cros_kunit.o obj-$(CONFIG_CROS_KUNIT_EC_PROTO_TEST) += cros_kunit_proto_test.o
cros_kunit-objs := cros_kunit_util.o cros_kunit_proto_test-objs := cros_ec_proto_test_util.o cros_ec_proto_test.o
cros_kunit-objs += cros_ec_proto_test.o
...@@ -321,17 +321,8 @@ void cros_ec_unregister(struct cros_ec_device *ec_dev) ...@@ -321,17 +321,8 @@ void cros_ec_unregister(struct cros_ec_device *ec_dev)
EXPORT_SYMBOL(cros_ec_unregister); EXPORT_SYMBOL(cros_ec_unregister);
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
/** static void cros_ec_send_suspend_event(struct cros_ec_device *ec_dev)
* cros_ec_suspend() - Handle a suspend operation for the ChromeOS EC device.
* @ec_dev: Device to suspend.
*
* This can be called by drivers to handle a suspend event.
*
* Return: 0 on success or negative error code.
*/
int cros_ec_suspend(struct cros_ec_device *ec_dev)
{ {
struct device *dev = ec_dev->dev;
int ret; int ret;
u8 sleep_event; u8 sleep_event;
...@@ -343,7 +334,26 @@ int cros_ec_suspend(struct cros_ec_device *ec_dev) ...@@ -343,7 +334,26 @@ int cros_ec_suspend(struct cros_ec_device *ec_dev)
if (ret < 0) if (ret < 0)
dev_dbg(ec_dev->dev, "Error %d sending suspend event to ec\n", dev_dbg(ec_dev->dev, "Error %d sending suspend event to ec\n",
ret); ret);
}
/**
* cros_ec_suspend_prepare() - Handle a suspend prepare operation for the ChromeOS EC device.
* @ec_dev: Device to suspend.
*
* This can be called by drivers to handle a suspend prepare stage of suspend.
*
* Return: 0 always.
*/
int cros_ec_suspend_prepare(struct cros_ec_device *ec_dev)
{
cros_ec_send_suspend_event(ec_dev);
return 0;
}
EXPORT_SYMBOL(cros_ec_suspend_prepare);
static void cros_ec_disable_irq(struct cros_ec_device *ec_dev)
{
struct device *dev = ec_dev->dev;
if (device_may_wakeup(dev)) if (device_may_wakeup(dev))
ec_dev->wake_enabled = !enable_irq_wake(ec_dev->irq); ec_dev->wake_enabled = !enable_irq_wake(ec_dev->irq);
else else
...@@ -351,7 +361,35 @@ int cros_ec_suspend(struct cros_ec_device *ec_dev) ...@@ -351,7 +361,35 @@ int cros_ec_suspend(struct cros_ec_device *ec_dev)
disable_irq(ec_dev->irq); disable_irq(ec_dev->irq);
ec_dev->suspended = true; ec_dev->suspended = true;
}
/**
* cros_ec_suspend_late() - Handle a suspend late operation for the ChromeOS EC device.
* @ec_dev: Device to suspend.
*
* This can be called by drivers to handle a suspend late stage of suspend.
*
* Return: 0 always.
*/
int cros_ec_suspend_late(struct cros_ec_device *ec_dev)
{
cros_ec_disable_irq(ec_dev);
return 0;
}
EXPORT_SYMBOL(cros_ec_suspend_late);
/**
* cros_ec_suspend() - Handle a suspend operation for the ChromeOS EC device.
* @ec_dev: Device to suspend.
*
* This can be called by drivers to handle a suspend event.
*
* Return: 0 always.
*/
int cros_ec_suspend(struct cros_ec_device *ec_dev)
{
cros_ec_send_suspend_event(ec_dev);
cros_ec_disable_irq(ec_dev);
return 0; return 0;
} }
EXPORT_SYMBOL(cros_ec_suspend); EXPORT_SYMBOL(cros_ec_suspend);
...@@ -370,22 +408,11 @@ static void cros_ec_report_events_during_suspend(struct cros_ec_device *ec_dev) ...@@ -370,22 +408,11 @@ static void cros_ec_report_events_during_suspend(struct cros_ec_device *ec_dev)
} }
} }
/** static void cros_ec_send_resume_event(struct cros_ec_device *ec_dev)
* cros_ec_resume() - Handle a resume operation for the ChromeOS EC device.
* @ec_dev: Device to resume.
*
* This can be called by drivers to handle a resume event.
*
* Return: 0 on success or negative error code.
*/
int cros_ec_resume(struct cros_ec_device *ec_dev)
{ {
int ret; int ret;
u8 sleep_event; u8 sleep_event;
ec_dev->suspended = false;
enable_irq(ec_dev->irq);
sleep_event = (!IS_ENABLED(CONFIG_ACPI) || pm_suspend_via_firmware()) ? sleep_event = (!IS_ENABLED(CONFIG_ACPI) || pm_suspend_via_firmware()) ?
HOST_SLEEP_EVENT_S3_RESUME : HOST_SLEEP_EVENT_S3_RESUME :
HOST_SLEEP_EVENT_S0IX_RESUME; HOST_SLEEP_EVENT_S0IX_RESUME;
...@@ -394,6 +421,24 @@ int cros_ec_resume(struct cros_ec_device *ec_dev) ...@@ -394,6 +421,24 @@ int cros_ec_resume(struct cros_ec_device *ec_dev)
if (ret < 0) if (ret < 0)
dev_dbg(ec_dev->dev, "Error %d sending resume event to ec\n", dev_dbg(ec_dev->dev, "Error %d sending resume event to ec\n",
ret); ret);
}
/**
* cros_ec_resume_complete() - Handle a resume complete operation for the ChromeOS EC device.
* @ec_dev: Device to resume.
*
* This can be called by drivers to handle a resume complete stage of resume.
*/
void cros_ec_resume_complete(struct cros_ec_device *ec_dev)
{
cros_ec_send_resume_event(ec_dev);
}
EXPORT_SYMBOL(cros_ec_resume_complete);
static void cros_ec_enable_irq(struct cros_ec_device *ec_dev)
{
ec_dev->suspended = false;
enable_irq(ec_dev->irq);
if (ec_dev->wake_enabled) if (ec_dev->wake_enabled)
disable_irq_wake(ec_dev->irq); disable_irq_wake(ec_dev->irq);
...@@ -403,8 +448,35 @@ int cros_ec_resume(struct cros_ec_device *ec_dev) ...@@ -403,8 +448,35 @@ int cros_ec_resume(struct cros_ec_device *ec_dev)
* suspend. This way the clients know what to do with them. * suspend. This way the clients know what to do with them.
*/ */
cros_ec_report_events_during_suspend(ec_dev); cros_ec_report_events_during_suspend(ec_dev);
}
/**
* cros_ec_resume_early() - Handle a resume early operation for the ChromeOS EC device.
* @ec_dev: Device to resume.
*
* This can be called by drivers to handle a resume early stage of resume.
*
* Return: 0 always.
*/
int cros_ec_resume_early(struct cros_ec_device *ec_dev)
{
cros_ec_enable_irq(ec_dev);
return 0;
}
EXPORT_SYMBOL(cros_ec_resume_early);
/**
* cros_ec_resume() - Handle a resume operation for the ChromeOS EC device.
* @ec_dev: Device to resume.
*
* This can be called by drivers to handle a resume event.
*
* Return: 0 always.
*/
int cros_ec_resume(struct cros_ec_device *ec_dev)
{
cros_ec_enable_irq(ec_dev);
cros_ec_send_resume_event(ec_dev);
return 0; return 0;
} }
EXPORT_SYMBOL(cros_ec_resume); EXPORT_SYMBOL(cros_ec_resume);
......
...@@ -10,11 +10,17 @@ ...@@ -10,11 +10,17 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
struct cros_ec_device;
int cros_ec_register(struct cros_ec_device *ec_dev); int cros_ec_register(struct cros_ec_device *ec_dev);
void cros_ec_unregister(struct cros_ec_device *ec_dev); void cros_ec_unregister(struct cros_ec_device *ec_dev);
int cros_ec_suspend(struct cros_ec_device *ec_dev); int cros_ec_suspend(struct cros_ec_device *ec_dev);
int cros_ec_suspend_late(struct cros_ec_device *ec_dev);
int cros_ec_suspend_prepare(struct cros_ec_device *ec_dev);
int cros_ec_resume(struct cros_ec_device *ec_dev); int cros_ec_resume(struct cros_ec_device *ec_dev);
int cros_ec_resume_early(struct cros_ec_device *ec_dev);
void cros_ec_resume_complete(struct cros_ec_device *ec_dev);
irqreturn_t cros_ec_irq_thread(int irq, void *data); irqreturn_t cros_ec_irq_thread(int irq, void *data);
......
...@@ -396,13 +396,11 @@ static int cros_ec_chardev_probe(struct platform_device *pdev) ...@@ -396,13 +396,11 @@ static int cros_ec_chardev_probe(struct platform_device *pdev)
return misc_register(&data->misc); return misc_register(&data->misc);
} }
static int cros_ec_chardev_remove(struct platform_device *pdev) static void cros_ec_chardev_remove(struct platform_device *pdev)
{ {
struct chardev_data *data = dev_get_drvdata(&pdev->dev); struct chardev_data *data = dev_get_drvdata(&pdev->dev);
misc_deregister(&data->misc); misc_deregister(&data->misc);
return 0;
} }
static struct platform_driver cros_ec_chardev_driver = { static struct platform_driver cros_ec_chardev_driver = {
...@@ -410,7 +408,7 @@ static struct platform_driver cros_ec_chardev_driver = { ...@@ -410,7 +408,7 @@ static struct platform_driver cros_ec_chardev_driver = {
.name = DRV_NAME, .name = DRV_NAME,
}, },
.probe = cros_ec_chardev_probe, .probe = cros_ec_chardev_probe,
.remove = cros_ec_chardev_remove, .remove_new = cros_ec_chardev_remove,
}; };
module_platform_driver(cros_ec_chardev_driver); module_platform_driver(cros_ec_chardev_driver);
......
...@@ -533,14 +533,12 @@ static int cros_ec_debugfs_probe(struct platform_device *pd) ...@@ -533,14 +533,12 @@ static int cros_ec_debugfs_probe(struct platform_device *pd)
return ret; return ret;
} }
static int cros_ec_debugfs_remove(struct platform_device *pd) static void cros_ec_debugfs_remove(struct platform_device *pd)
{ {
struct cros_ec_dev *ec = dev_get_drvdata(pd->dev.parent); struct cros_ec_dev *ec = dev_get_drvdata(pd->dev.parent);
debugfs_remove_recursive(ec->debug_info->dir); debugfs_remove_recursive(ec->debug_info->dir);
cros_ec_cleanup_console_log(ec->debug_info); cros_ec_cleanup_console_log(ec->debug_info);
return 0;
} }
static int __maybe_unused cros_ec_debugfs_suspend(struct device *dev) static int __maybe_unused cros_ec_debugfs_suspend(struct device *dev)
...@@ -573,7 +571,7 @@ static struct platform_driver cros_ec_debugfs_driver = { ...@@ -573,7 +571,7 @@ static struct platform_driver cros_ec_debugfs_driver = {
.probe_type = PROBE_PREFER_ASYNCHRONOUS, .probe_type = PROBE_PREFER_ASYNCHRONOUS,
}, },
.probe = cros_ec_debugfs_probe, .probe = cros_ec_debugfs_probe,
.remove = cros_ec_debugfs_remove, .remove_new = cros_ec_debugfs_remove,
}; };
module_platform_driver(cros_ec_debugfs_driver); module_platform_driver(cros_ec_debugfs_driver);
......
...@@ -560,7 +560,7 @@ static int cros_ec_lightbar_probe(struct platform_device *pd) ...@@ -560,7 +560,7 @@ static int cros_ec_lightbar_probe(struct platform_device *pd)
return ret; return ret;
} }
static int cros_ec_lightbar_remove(struct platform_device *pd) static void cros_ec_lightbar_remove(struct platform_device *pd)
{ {
struct cros_ec_dev *ec_dev = dev_get_drvdata(pd->dev.parent); struct cros_ec_dev *ec_dev = dev_get_drvdata(pd->dev.parent);
...@@ -569,8 +569,6 @@ static int cros_ec_lightbar_remove(struct platform_device *pd) ...@@ -569,8 +569,6 @@ static int cros_ec_lightbar_remove(struct platform_device *pd)
/* Let the EC take over the lightbar again. */ /* Let the EC take over the lightbar again. */
lb_manual_suspend_ctrl(ec_dev, 0); lb_manual_suspend_ctrl(ec_dev, 0);
return 0;
} }
static int __maybe_unused cros_ec_lightbar_resume(struct device *dev) static int __maybe_unused cros_ec_lightbar_resume(struct device *dev)
...@@ -603,7 +601,7 @@ static struct platform_driver cros_ec_lightbar_driver = { ...@@ -603,7 +601,7 @@ static struct platform_driver cros_ec_lightbar_driver = {
.probe_type = PROBE_PREFER_ASYNCHRONOUS, .probe_type = PROBE_PREFER_ASYNCHRONOUS,
}, },
.probe = cros_ec_lightbar_probe, .probe = cros_ec_lightbar_probe,
.remove = cros_ec_lightbar_remove, .remove_new = cros_ec_lightbar_remove,
}; };
module_platform_driver(cros_ec_lightbar_driver); module_platform_driver(cros_ec_lightbar_driver);
......
...@@ -460,7 +460,7 @@ static int cros_ec_lpc_probe(struct platform_device *pdev) ...@@ -460,7 +460,7 @@ static int cros_ec_lpc_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int cros_ec_lpc_remove(struct platform_device *pdev) static void cros_ec_lpc_remove(struct platform_device *pdev)
{ {
struct cros_ec_device *ec_dev = platform_get_drvdata(pdev); struct cros_ec_device *ec_dev = platform_get_drvdata(pdev);
struct acpi_device *adev; struct acpi_device *adev;
...@@ -471,8 +471,6 @@ static int cros_ec_lpc_remove(struct platform_device *pdev) ...@@ -471,8 +471,6 @@ static int cros_ec_lpc_remove(struct platform_device *pdev)
cros_ec_lpc_acpi_notify); cros_ec_lpc_acpi_notify);
cros_ec_unregister(ec_dev); cros_ec_unregister(ec_dev);
return 0;
} }
static const struct acpi_device_id cros_ec_lpc_acpi_device_ids[] = { static const struct acpi_device_id cros_ec_lpc_acpi_device_ids[] = {
...@@ -549,22 +547,36 @@ MODULE_DEVICE_TABLE(dmi, cros_ec_lpc_dmi_table); ...@@ -549,22 +547,36 @@ MODULE_DEVICE_TABLE(dmi, cros_ec_lpc_dmi_table);
static int cros_ec_lpc_prepare(struct device *dev) static int cros_ec_lpc_prepare(struct device *dev)
{ {
struct cros_ec_device *ec_dev = dev_get_drvdata(dev); struct cros_ec_device *ec_dev = dev_get_drvdata(dev);
return cros_ec_suspend_prepare(ec_dev);
return cros_ec_suspend(ec_dev);
} }
static void cros_ec_lpc_complete(struct device *dev) static void cros_ec_lpc_complete(struct device *dev)
{ {
struct cros_ec_device *ec_dev = dev_get_drvdata(dev); struct cros_ec_device *ec_dev = dev_get_drvdata(dev);
cros_ec_resume(ec_dev); cros_ec_resume_complete(ec_dev);
}
static int cros_ec_lpc_suspend_late(struct device *dev)
{
struct cros_ec_device *ec_dev = dev_get_drvdata(dev);
return cros_ec_suspend_late(ec_dev);
}
static int cros_ec_lpc_resume_early(struct device *dev)
{
struct cros_ec_device *ec_dev = dev_get_drvdata(dev);
return cros_ec_resume_early(ec_dev);
} }
#endif #endif
static const struct dev_pm_ops cros_ec_lpc_pm_ops = { static const struct dev_pm_ops cros_ec_lpc_pm_ops = {
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
.prepare = cros_ec_lpc_prepare, .prepare = cros_ec_lpc_prepare,
.complete = cros_ec_lpc_complete .complete = cros_ec_lpc_complete,
#endif #endif
SET_LATE_SYSTEM_SLEEP_PM_OPS(cros_ec_lpc_suspend_late, cros_ec_lpc_resume_early)
}; };
static struct platform_driver cros_ec_lpc_driver = { static struct platform_driver cros_ec_lpc_driver = {
...@@ -580,7 +592,7 @@ static struct platform_driver cros_ec_lpc_driver = { ...@@ -580,7 +592,7 @@ static struct platform_driver cros_ec_lpc_driver = {
.probe_type = PROBE_FORCE_SYNCHRONOUS, .probe_type = PROBE_FORCE_SYNCHRONOUS,
}, },
.probe = cros_ec_lpc_probe, .probe = cros_ec_lpc_probe,
.remove = cros_ec_lpc_remove, .remove_new = cros_ec_lpc_remove,
}; };
static struct platform_device cros_ec_lpc_device = { static struct platform_device cros_ec_lpc_device = {
......
...@@ -1004,7 +1004,7 @@ EXPORT_SYMBOL_GPL(cros_ec_get_sensor_count); ...@@ -1004,7 +1004,7 @@ EXPORT_SYMBOL_GPL(cros_ec_get_sensor_count);
int cros_ec_cmd(struct cros_ec_device *ec_dev, int cros_ec_cmd(struct cros_ec_device *ec_dev,
unsigned int version, unsigned int version,
int command, int command,
void *outdata, const void *outdata,
size_t outsize, size_t outsize,
void *indata, void *indata,
size_t insize) size_t insize)
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <linux/platform_data/cros_ec_proto.h> #include <linux/platform_data/cros_ec_proto.h>
#include "cros_ec.h" #include "cros_ec.h"
#include "cros_kunit_util.h" #include "cros_ec_proto_test_util.h"
#define BUFSIZE 512 #define BUFSIZE 512
...@@ -2668,6 +2668,7 @@ static int cros_ec_proto_test_init(struct kunit *test) ...@@ -2668,6 +2668,7 @@ static int cros_ec_proto_test_init(struct kunit *test)
ec_dev->dev->release = cros_ec_proto_test_release; ec_dev->dev->release = cros_ec_proto_test_release;
ec_dev->cmd_xfer = cros_kunit_ec_xfer_mock; ec_dev->cmd_xfer = cros_kunit_ec_xfer_mock;
ec_dev->pkt_xfer = cros_kunit_ec_xfer_mock; ec_dev->pkt_xfer = cros_kunit_ec_xfer_mock;
mutex_init(&ec_dev->lock);
priv->msg = (struct cros_ec_command *)priv->_msg; priv->msg = (struct cros_ec_command *)priv->_msg;
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <linux/platform_data/cros_ec_proto.h> #include <linux/platform_data/cros_ec_proto.h>
#include "cros_ec.h" #include "cros_ec.h"
#include "cros_kunit_util.h" #include "cros_ec_proto_test_util.h"
int cros_kunit_ec_xfer_mock_default_result; int cros_kunit_ec_xfer_mock_default_result;
int cros_kunit_ec_xfer_mock_default_ret; int cros_kunit_ec_xfer_mock_default_ret;
...@@ -126,5 +126,3 @@ void cros_kunit_mock_reset(void) ...@@ -126,5 +126,3 @@ void cros_kunit_mock_reset(void)
cros_kunit_readmem_mock_data = NULL; cros_kunit_readmem_mock_data = NULL;
cros_kunit_readmem_mock_ret = 0; cros_kunit_readmem_mock_ret = 0;
} }
MODULE_LICENSE("GPL");
...@@ -340,13 +340,11 @@ static int cros_ec_sysfs_probe(struct platform_device *pd) ...@@ -340,13 +340,11 @@ static int cros_ec_sysfs_probe(struct platform_device *pd)
return ret; return ret;
} }
static int cros_ec_sysfs_remove(struct platform_device *pd) static void cros_ec_sysfs_remove(struct platform_device *pd)
{ {
struct cros_ec_dev *ec_dev = dev_get_drvdata(pd->dev.parent); struct cros_ec_dev *ec_dev = dev_get_drvdata(pd->dev.parent);
sysfs_remove_group(&ec_dev->class_dev.kobj, &cros_ec_attr_group); sysfs_remove_group(&ec_dev->class_dev.kobj, &cros_ec_attr_group);
return 0;
} }
static struct platform_driver cros_ec_sysfs_driver = { static struct platform_driver cros_ec_sysfs_driver = {
...@@ -354,7 +352,7 @@ static struct platform_driver cros_ec_sysfs_driver = { ...@@ -354,7 +352,7 @@ static struct platform_driver cros_ec_sysfs_driver = {
.name = DRV_NAME, .name = DRV_NAME,
}, },
.probe = cros_ec_sysfs_probe, .probe = cros_ec_sysfs_probe,
.remove = cros_ec_sysfs_remove, .remove_new = cros_ec_sysfs_remove,
}; };
module_platform_driver(cros_ec_sysfs_driver); module_platform_driver(cros_ec_sysfs_driver);
......
...@@ -80,28 +80,28 @@ static int cros_typec_get_switch_handles(struct cros_typec_port *port, ...@@ -80,28 +80,28 @@ static int cros_typec_get_switch_handles(struct cros_typec_port *port,
port->mux = fwnode_typec_mux_get(fwnode); port->mux = fwnode_typec_mux_get(fwnode);
if (IS_ERR(port->mux)) { if (IS_ERR(port->mux)) {
ret = PTR_ERR(port->mux); ret = PTR_ERR(port->mux);
dev_dbg(dev, "Mux handle not found: %d.\n", ret); dev_err_probe(dev, ret, "Mux handle not found\n");
goto mux_err; goto mux_err;
} }
port->retimer = fwnode_typec_retimer_get(fwnode); port->retimer = fwnode_typec_retimer_get(fwnode);
if (IS_ERR(port->retimer)) { if (IS_ERR(port->retimer)) {
ret = PTR_ERR(port->retimer); ret = PTR_ERR(port->retimer);
dev_dbg(dev, "Retimer handle not found: %d.\n", ret); dev_err_probe(dev, ret, "Retimer handle not found\n");
goto retimer_sw_err; goto retimer_sw_err;
} }
port->ori_sw = fwnode_typec_switch_get(fwnode); port->ori_sw = fwnode_typec_switch_get(fwnode);
if (IS_ERR(port->ori_sw)) { if (IS_ERR(port->ori_sw)) {
ret = PTR_ERR(port->ori_sw); ret = PTR_ERR(port->ori_sw);
dev_dbg(dev, "Orientation switch handle not found: %d\n", ret); dev_err_probe(dev, ret, "Orientation switch handle not found\n");
goto ori_sw_err; goto ori_sw_err;
} }
port->role_sw = fwnode_usb_role_switch_get(fwnode); port->role_sw = fwnode_usb_role_switch_get(fwnode);
if (IS_ERR(port->role_sw)) { if (IS_ERR(port->role_sw)) {
ret = PTR_ERR(port->role_sw); ret = PTR_ERR(port->role_sw);
dev_dbg(dev, "USB role switch handle not found: %d\n", ret); dev_err_probe(dev, ret, "USB role switch handle not found\n");
goto role_sw_err; goto role_sw_err;
} }
...@@ -271,9 +271,9 @@ static int cros_typec_register_port_altmodes(struct cros_typec_data *typec, ...@@ -271,9 +271,9 @@ static int cros_typec_register_port_altmodes(struct cros_typec_data *typec,
struct typec_altmode *amode; struct typec_altmode *amode;
/* All PD capable CrOS devices are assumed to support DP altmode. */ /* All PD capable CrOS devices are assumed to support DP altmode. */
desc.svid = USB_TYPEC_DP_SID, desc.svid = USB_TYPEC_DP_SID;
desc.mode = USB_TYPEC_DP_MODE, desc.mode = USB_TYPEC_DP_MODE;
desc.vdo = DP_PORT_VDO, desc.vdo = DP_PORT_VDO;
amode = typec_port_register_altmode(port->port, &desc); amode = typec_port_register_altmode(port->port, &desc);
if (IS_ERR(amode)) if (IS_ERR(amode))
return PTR_ERR(amode); return PTR_ERR(amode);
...@@ -287,8 +287,8 @@ static int cros_typec_register_port_altmodes(struct cros_typec_data *typec, ...@@ -287,8 +287,8 @@ static int cros_typec_register_port_altmodes(struct cros_typec_data *typec,
* here for now. * here for now.
*/ */
memset(&desc, 0, sizeof(desc)); memset(&desc, 0, sizeof(desc));
desc.svid = USB_TYPEC_TBT_SID, desc.svid = USB_TYPEC_TBT_SID;
desc.mode = TYPEC_ANY_MODE, desc.mode = TYPEC_ANY_MODE;
amode = typec_port_register_altmode(port->port, &desc); amode = typec_port_register_altmode(port->port, &desc);
if (IS_ERR(amode)) if (IS_ERR(amode))
return PTR_ERR(amode); return PTR_ERR(amode);
......
...@@ -121,14 +121,12 @@ static int cros_ec_vbc_probe(struct platform_device *pd) ...@@ -121,14 +121,12 @@ static int cros_ec_vbc_probe(struct platform_device *pd)
return ret; return ret;
} }
static int cros_ec_vbc_remove(struct platform_device *pd) static void cros_ec_vbc_remove(struct platform_device *pd)
{ {
struct cros_ec_dev *ec_dev = dev_get_drvdata(pd->dev.parent); struct cros_ec_dev *ec_dev = dev_get_drvdata(pd->dev.parent);
sysfs_remove_group(&ec_dev->class_dev.kobj, sysfs_remove_group(&ec_dev->class_dev.kobj,
&cros_ec_vbc_attr_group); &cros_ec_vbc_attr_group);
return 0;
} }
static struct platform_driver cros_ec_vbc_driver = { static struct platform_driver cros_ec_vbc_driver = {
...@@ -136,7 +134,7 @@ static struct platform_driver cros_ec_vbc_driver = { ...@@ -136,7 +134,7 @@ static struct platform_driver cros_ec_vbc_driver = {
.name = DRV_NAME, .name = DRV_NAME,
}, },
.probe = cros_ec_vbc_probe, .probe = cros_ec_vbc_probe,
.remove = cros_ec_vbc_remove, .remove_new = cros_ec_vbc_remove,
}; };
module_platform_driver(cros_ec_vbc_driver); module_platform_driver(cros_ec_vbc_driver);
......
...@@ -297,12 +297,11 @@ static int cros_typec_switch_probe(struct platform_device *pdev) ...@@ -297,12 +297,11 @@ static int cros_typec_switch_probe(struct platform_device *pdev)
return cros_typec_register_switches(sdata); return cros_typec_register_switches(sdata);
} }
static int cros_typec_switch_remove(struct platform_device *pdev) static void cros_typec_switch_remove(struct platform_device *pdev)
{ {
struct cros_typec_switch_data *sdata = platform_get_drvdata(pdev); struct cros_typec_switch_data *sdata = platform_get_drvdata(pdev);
cros_typec_unregister_switches(sdata); cros_typec_unregister_switches(sdata);
return 0;
} }
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
...@@ -319,7 +318,7 @@ static struct platform_driver cros_typec_switch_driver = { ...@@ -319,7 +318,7 @@ static struct platform_driver cros_typec_switch_driver = {
.acpi_match_table = ACPI_PTR(cros_typec_switch_acpi_id), .acpi_match_table = ACPI_PTR(cros_typec_switch_acpi_id),
}, },
.probe = cros_typec_switch_probe, .probe = cros_typec_switch_probe,
.remove = cros_typec_switch_remove, .remove_new = cros_typec_switch_remove,
}; };
module_platform_driver(cros_typec_switch_driver); module_platform_driver(cros_typec_switch_driver);
......
...@@ -142,7 +142,7 @@ static int cros_typec_port_amode_vdm(struct typec_altmode *amode, const u32 hdr, ...@@ -142,7 +142,7 @@ static int cros_typec_port_amode_vdm(struct typec_altmode *amode, const u32 hdr,
sizeof(req), NULL, 0); sizeof(req), NULL, 0);
} }
struct typec_altmode_ops port_amode_ops = { const struct typec_altmode_ops port_amode_ops = {
.enter = cros_typec_port_amode_enter, .enter = cros_typec_port_amode_enter,
.vdm = cros_typec_port_amode_vdm, .vdm = cros_typec_port_amode_vdm,
}; };
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include <linux/usb/typec_altmode.h> #include <linux/usb/typec_altmode.h>
extern struct typec_altmode_ops port_amode_ops; extern const struct typec_altmode_ops port_amode_ops;
void cros_typec_handle_vdm_attention(struct cros_typec_data *typec, int port_num); void cros_typec_handle_vdm_attention(struct cros_typec_data *typec, int port_num);
void cros_typec_handle_vdm_response(struct cros_typec_data *typec, int port_num); void cros_typec_handle_vdm_response(struct cros_typec_data *typec, int port_num);
......
...@@ -219,14 +219,12 @@ static int cros_usbpd_logger_probe(struct platform_device *pd) ...@@ -219,14 +219,12 @@ static int cros_usbpd_logger_probe(struct platform_device *pd)
return 0; return 0;
} }
static int cros_usbpd_logger_remove(struct platform_device *pd) static void cros_usbpd_logger_remove(struct platform_device *pd)
{ {
struct logger_data *logger = platform_get_drvdata(pd); struct logger_data *logger = platform_get_drvdata(pd);
cancel_delayed_work_sync(&logger->log_work); cancel_delayed_work_sync(&logger->log_work);
destroy_workqueue(logger->log_workqueue); destroy_workqueue(logger->log_workqueue);
return 0;
} }
static int __maybe_unused cros_usbpd_logger_resume(struct device *dev) static int __maybe_unused cros_usbpd_logger_resume(struct device *dev)
...@@ -257,7 +255,7 @@ static struct platform_driver cros_usbpd_logger_driver = { ...@@ -257,7 +255,7 @@ static struct platform_driver cros_usbpd_logger_driver = {
.pm = &cros_usbpd_logger_pm_ops, .pm = &cros_usbpd_logger_pm_ops,
}, },
.probe = cros_usbpd_logger_probe, .probe = cros_usbpd_logger_probe,
.remove = cros_usbpd_logger_remove, .remove_new = cros_usbpd_logger_remove,
}; };
module_platform_driver(cros_usbpd_logger_driver); module_platform_driver(cros_usbpd_logger_driver);
......
...@@ -134,15 +134,13 @@ static int cros_usbpd_notify_probe_acpi(struct platform_device *pdev) ...@@ -134,15 +134,13 @@ static int cros_usbpd_notify_probe_acpi(struct platform_device *pdev)
return 0; return 0;
} }
static int cros_usbpd_notify_remove_acpi(struct platform_device *pdev) static void cros_usbpd_notify_remove_acpi(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct acpi_device *adev = ACPI_COMPANION(dev); struct acpi_device *adev = ACPI_COMPANION(dev);
acpi_remove_notify_handler(adev->handle, ACPI_ALL_NOTIFY, acpi_remove_notify_handler(adev->handle, ACPI_ALL_NOTIFY,
cros_usbpd_notify_acpi); cros_usbpd_notify_acpi);
return 0;
} }
static const struct acpi_device_id cros_usbpd_notify_acpi_device_ids[] = { static const struct acpi_device_id cros_usbpd_notify_acpi_device_ids[] = {
...@@ -157,7 +155,7 @@ static struct platform_driver cros_usbpd_notify_acpi_driver = { ...@@ -157,7 +155,7 @@ static struct platform_driver cros_usbpd_notify_acpi_driver = {
.acpi_match_table = cros_usbpd_notify_acpi_device_ids, .acpi_match_table = cros_usbpd_notify_acpi_device_ids,
}, },
.probe = cros_usbpd_notify_probe_acpi, .probe = cros_usbpd_notify_probe_acpi,
.remove = cros_usbpd_notify_remove_acpi, .remove_new = cros_usbpd_notify_remove_acpi,
}; };
#endif /* CONFIG_ACPI */ #endif /* CONFIG_ACPI */
...@@ -209,7 +207,7 @@ static int cros_usbpd_notify_probe_plat(struct platform_device *pdev) ...@@ -209,7 +207,7 @@ static int cros_usbpd_notify_probe_plat(struct platform_device *pdev)
return 0; return 0;
} }
static int cros_usbpd_notify_remove_plat(struct platform_device *pdev) static void cros_usbpd_notify_remove_plat(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct cros_ec_dev *ecdev = dev_get_drvdata(dev->parent); struct cros_ec_dev *ecdev = dev_get_drvdata(dev->parent);
...@@ -218,8 +216,6 @@ static int cros_usbpd_notify_remove_plat(struct platform_device *pdev) ...@@ -218,8 +216,6 @@ static int cros_usbpd_notify_remove_plat(struct platform_device *pdev)
blocking_notifier_chain_unregister(&ecdev->ec_dev->event_notifier, blocking_notifier_chain_unregister(&ecdev->ec_dev->event_notifier,
&pdnotify->nb); &pdnotify->nb);
return 0;
} }
static struct platform_driver cros_usbpd_notify_plat_driver = { static struct platform_driver cros_usbpd_notify_plat_driver = {
...@@ -227,7 +223,7 @@ static struct platform_driver cros_usbpd_notify_plat_driver = { ...@@ -227,7 +223,7 @@ static struct platform_driver cros_usbpd_notify_plat_driver = {
.name = DRV_NAME, .name = DRV_NAME,
}, },
.probe = cros_usbpd_notify_probe_plat, .probe = cros_usbpd_notify_probe_plat,
.remove = cros_usbpd_notify_remove_plat, .remove_new = cros_usbpd_notify_remove_plat,
}; };
static int __init cros_usbpd_notify_init(void) static int __init cros_usbpd_notify_init(void)
......
...@@ -132,7 +132,7 @@ static int wilco_ec_probe(struct platform_device *pdev) ...@@ -132,7 +132,7 @@ static int wilco_ec_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int wilco_ec_remove(struct platform_device *pdev) static void wilco_ec_remove(struct platform_device *pdev)
{ {
struct wilco_ec_device *ec = platform_get_drvdata(pdev); struct wilco_ec_device *ec = platform_get_drvdata(pdev);
...@@ -142,7 +142,6 @@ static int wilco_ec_remove(struct platform_device *pdev) ...@@ -142,7 +142,6 @@ static int wilco_ec_remove(struct platform_device *pdev)
platform_device_unregister(ec->rtc_pdev); platform_device_unregister(ec->rtc_pdev);
if (ec->debugfs_pdev) if (ec->debugfs_pdev)
platform_device_unregister(ec->debugfs_pdev); platform_device_unregister(ec->debugfs_pdev);
return 0;
} }
static const struct acpi_device_id wilco_ec_acpi_device_ids[] = { static const struct acpi_device_id wilco_ec_acpi_device_ids[] = {
...@@ -157,7 +156,7 @@ static struct platform_driver wilco_ec_driver = { ...@@ -157,7 +156,7 @@ static struct platform_driver wilco_ec_driver = {
.acpi_match_table = wilco_ec_acpi_device_ids, .acpi_match_table = wilco_ec_acpi_device_ids,
}, },
.probe = wilco_ec_probe, .probe = wilco_ec_probe,
.remove = wilco_ec_remove, .remove_new = wilco_ec_remove,
}; };
module_platform_driver(wilco_ec_driver); module_platform_driver(wilco_ec_driver);
......
...@@ -260,11 +260,9 @@ static int wilco_ec_debugfs_probe(struct platform_device *pdev) ...@@ -260,11 +260,9 @@ static int wilco_ec_debugfs_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int wilco_ec_debugfs_remove(struct platform_device *pdev) static void wilco_ec_debugfs_remove(struct platform_device *pdev)
{ {
debugfs_remove_recursive(debug_info->dir); debugfs_remove_recursive(debug_info->dir);
return 0;
} }
static struct platform_driver wilco_ec_debugfs_driver = { static struct platform_driver wilco_ec_debugfs_driver = {
...@@ -272,7 +270,7 @@ static struct platform_driver wilco_ec_debugfs_driver = { ...@@ -272,7 +270,7 @@ static struct platform_driver wilco_ec_debugfs_driver = {
.name = DRV_NAME, .name = DRV_NAME,
}, },
.probe = wilco_ec_debugfs_probe, .probe = wilco_ec_debugfs_probe,
.remove = wilco_ec_debugfs_remove, .remove_new = wilco_ec_debugfs_remove,
}; };
module_platform_driver(wilco_ec_debugfs_driver); module_platform_driver(wilco_ec_debugfs_driver);
......
...@@ -95,7 +95,7 @@ struct ec_event_queue { ...@@ -95,7 +95,7 @@ struct ec_event_queue {
int capacity; int capacity;
int head; int head;
int tail; int tail;
struct ec_event *entries[]; struct ec_event *entries[] __counted_by(capacity);
}; };
/* Maximum number of events to store in ec_event_queue */ /* Maximum number of events to store in ec_event_queue */
......
...@@ -400,20 +400,18 @@ static int telem_device_probe(struct platform_device *pdev) ...@@ -400,20 +400,18 @@ static int telem_device_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int telem_device_remove(struct platform_device *pdev) static void telem_device_remove(struct platform_device *pdev)
{ {
struct telem_device_data *dev_data = platform_get_drvdata(pdev); struct telem_device_data *dev_data = platform_get_drvdata(pdev);
cdev_device_del(&dev_data->cdev, &dev_data->dev); cdev_device_del(&dev_data->cdev, &dev_data->dev);
ida_simple_remove(&telem_ida, MINOR(dev_data->dev.devt)); ida_simple_remove(&telem_ida, MINOR(dev_data->dev.devt));
put_device(&dev_data->dev); put_device(&dev_data->dev);
return 0;
} }
static struct platform_driver telem_driver = { static struct platform_driver telem_driver = {
.probe = telem_device_probe, .probe = telem_device_probe,
.remove = telem_device_remove, .remove_new = telem_device_remove,
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
}, },
......
...@@ -258,7 +258,7 @@ bool cros_ec_check_features(struct cros_ec_dev *ec, int feature); ...@@ -258,7 +258,7 @@ bool cros_ec_check_features(struct cros_ec_dev *ec, int feature);
int cros_ec_get_sensor_count(struct cros_ec_dev *ec); int cros_ec_get_sensor_count(struct cros_ec_dev *ec);
int cros_ec_cmd(struct cros_ec_device *ec_dev, unsigned int version, int command, void *outdata, int cros_ec_cmd(struct cros_ec_device *ec_dev, unsigned int version, int command, const void *outdata,
size_t outsize, void *indata, size_t insize); size_t outsize, void *indata, size_t insize);
/** /**
......
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