Commit e3f259d3 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'i2c-for-6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull i2c fixes from Wolfram Sang:
 "A revert to fix a regression introduced this merge window and a fix
  for proper error handling in the remove path of the iMX driver"

* tag 'i2c-for-6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  i2c: imx: Make sure to unregister adapter on remove()
  Revert "i2c: scmi: Replace open coded device_get_match_data()"
parents 367bcbc5 d98bdd3a
...@@ -1572,9 +1572,7 @@ static int i2c_imx_remove(struct platform_device *pdev) ...@@ -1572,9 +1572,7 @@ static int i2c_imx_remove(struct platform_device *pdev)
struct imx_i2c_struct *i2c_imx = platform_get_drvdata(pdev); struct imx_i2c_struct *i2c_imx = platform_get_drvdata(pdev);
int irq, ret; int irq, ret;
ret = pm_runtime_resume_and_get(&pdev->dev); ret = pm_runtime_get_sync(&pdev->dev);
if (ret < 0)
return ret;
hrtimer_cancel(&i2c_imx->slave_timer); hrtimer_cancel(&i2c_imx->slave_timer);
...@@ -1585,17 +1583,21 @@ static int i2c_imx_remove(struct platform_device *pdev) ...@@ -1585,17 +1583,21 @@ static int i2c_imx_remove(struct platform_device *pdev)
if (i2c_imx->dma) if (i2c_imx->dma)
i2c_imx_dma_free(i2c_imx); i2c_imx_dma_free(i2c_imx);
if (ret == 0) {
/* setup chip registers to defaults */ /* setup chip registers to defaults */
imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IADR); imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IADR);
imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IFDR); imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IFDR);
imx_i2c_write_reg(0, i2c_imx, IMX_I2C_I2CR); imx_i2c_write_reg(0, i2c_imx, IMX_I2C_I2CR);
imx_i2c_write_reg(0, i2c_imx, IMX_I2C_I2SR); imx_i2c_write_reg(0, i2c_imx, IMX_I2C_I2SR);
clk_disable(i2c_imx->clk);
}
clk_notifier_unregister(i2c_imx->clk, &i2c_imx->clk_change_nb); clk_notifier_unregister(i2c_imx->clk, &i2c_imx->clk_change_nb);
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq >= 0) if (irq >= 0)
free_irq(irq, i2c_imx); free_irq(irq, i2c_imx);
clk_disable_unprepare(i2c_imx->clk);
clk_unprepare(i2c_imx->clk);
pm_runtime_put_noidle(&pdev->dev); pm_runtime_put_noidle(&pdev->dev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
......
...@@ -30,7 +30,7 @@ struct acpi_smbus_cmi { ...@@ -30,7 +30,7 @@ struct acpi_smbus_cmi {
u8 cap_info:1; u8 cap_info:1;
u8 cap_read:1; u8 cap_read:1;
u8 cap_write:1; u8 cap_write:1;
const struct smbus_methods_t *methods; struct smbus_methods_t *methods;
}; };
static const struct smbus_methods_t smbus_methods = { static const struct smbus_methods_t smbus_methods = {
...@@ -361,6 +361,7 @@ static acpi_status acpi_smbus_cmi_query_methods(acpi_handle handle, u32 level, ...@@ -361,6 +361,7 @@ static acpi_status acpi_smbus_cmi_query_methods(acpi_handle handle, u32 level,
static int acpi_smbus_cmi_add(struct acpi_device *device) static int acpi_smbus_cmi_add(struct acpi_device *device)
{ {
struct acpi_smbus_cmi *smbus_cmi; struct acpi_smbus_cmi *smbus_cmi;
const struct acpi_device_id *id;
int ret; int ret;
smbus_cmi = kzalloc(sizeof(struct acpi_smbus_cmi), GFP_KERNEL); smbus_cmi = kzalloc(sizeof(struct acpi_smbus_cmi), GFP_KERNEL);
...@@ -368,7 +369,6 @@ static int acpi_smbus_cmi_add(struct acpi_device *device) ...@@ -368,7 +369,6 @@ static int acpi_smbus_cmi_add(struct acpi_device *device)
return -ENOMEM; return -ENOMEM;
smbus_cmi->handle = device->handle; smbus_cmi->handle = device->handle;
smbus_cmi->methods = device_get_match_data(&device->dev);
strcpy(acpi_device_name(device), ACPI_SMBUS_HC_DEVICE_NAME); strcpy(acpi_device_name(device), ACPI_SMBUS_HC_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_SMBUS_HC_CLASS); strcpy(acpi_device_class(device), ACPI_SMBUS_HC_CLASS);
device->driver_data = smbus_cmi; device->driver_data = smbus_cmi;
...@@ -376,6 +376,11 @@ static int acpi_smbus_cmi_add(struct acpi_device *device) ...@@ -376,6 +376,11 @@ static int acpi_smbus_cmi_add(struct acpi_device *device)
smbus_cmi->cap_read = 0; smbus_cmi->cap_read = 0;
smbus_cmi->cap_write = 0; smbus_cmi->cap_write = 0;
for (id = acpi_smbus_cmi_ids; id->id[0]; id++)
if (!strcmp(id->id, acpi_device_hid(device)))
smbus_cmi->methods =
(struct smbus_methods_t *) id->driver_data;
acpi_walk_namespace(ACPI_TYPE_METHOD, smbus_cmi->handle, 1, acpi_walk_namespace(ACPI_TYPE_METHOD, smbus_cmi->handle, 1,
acpi_smbus_cmi_query_methods, NULL, smbus_cmi, NULL); acpi_smbus_cmi_query_methods, NULL, smbus_cmi, NULL);
......
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