drm/xe/i2c: Re-apply use device_create_managed_software_node()

Original commit 0f485f8865 ("drm/xe/i2c: use device_create_managed_software_node()")
got silently removed by commit cc46796964 ("Merge drm/drm-next into drm-xe-next").

Re-apply it.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Link: https://patch.msgid.link/20260922-xe-i2c-reapply-swnode-unreg-v1-1-1bdda5d44701@oss.qualcomm.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
[Rodrigo: Modified commit message to reflect the right history]
This commit is contained in:
Bartosz Golaszewski 2026-09-22 16:25:55 +02:00 committed by Rodrigo Vivi
parent 43a1c34d9f
commit ee489527db
No known key found for this signature in database
GPG Key ID: FA625F640EEB13CA
2 changed files with 8 additions and 15 deletions

View File

@ -111,14 +111,9 @@ static int xe_i2c_register_adapter(struct xe_i2c *i2c)
{
struct pci_dev *pci = to_pci_dev(i2c->drm_dev);
struct platform_device *pdev;
struct fwnode_handle *fwnode;
int ret;
u32 id;
fwnode = fwnode_create_software_node(xe_i2c_adapter_properties, NULL);
if (IS_ERR(fwnode))
return PTR_ERR(fwnode);
id = (pci_domain_nr(pci->bus) << 16) | pci_dev_id(pci);
/*
@ -128,14 +123,16 @@ static int xe_i2c_register_adapter(struct xe_i2c *i2c)
* platform_device_register_full() is done.
*/
pdev = platform_device_alloc(adapter_name, id);
if (!pdev) {
ret = -ENOMEM;
goto err_fwnode_remove;
}
if (!pdev)
return -ENOMEM;
ret = device_create_managed_software_node(&pdev->dev,
xe_i2c_adapter_properties,
NULL);
if (ret)
goto err_pdev_put;
pdev->dev.parent = i2c->drm_dev;
pdev->dev.fwnode = fwnode;
i2c->adapter_node = fwnode;
i2c->pdev = pdev;
ret = platform_device_add(pdev);
@ -146,8 +143,6 @@ static int xe_i2c_register_adapter(struct xe_i2c *i2c)
err_pdev_put:
platform_device_put(pdev);
err_fwnode_remove:
fwnode_remove_software_node(fwnode);
return ret;
}
@ -155,7 +150,6 @@ static int xe_i2c_register_adapter(struct xe_i2c *i2c)
static void xe_i2c_unregister_adapter(struct xe_i2c *i2c)
{
platform_device_unregister(i2c->pdev);
fwnode_remove_software_node(i2c->adapter_node);
}
/**

View File

@ -33,7 +33,6 @@ struct xe_i2c_endpoint {
};
struct xe_i2c {
struct fwnode_handle *adapter_node;
struct platform_device *pdev;
struct i2c_adapter *adapter;
struct i2c_client *client[XE_I2C_MAX_CLIENTS];