From: Erick Karanja <karanja99erick@gmail.com>
To: alexander.deucher@amd.com, christian.koenig@amd.com,
airlied@gmail.com, simona@ffwll.ch
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org,
Erick Karanja <karanja99erick@gmail.com>
Subject: [PATCH] drm/radeon : Use devm_i2c_add_adapter instead of i2c_add_adapter
Date: Thu, 11 Dec 2025 11:59:23 +0300 [thread overview]
Message-ID: <20251211085923.737742-1-karanja99erick@gmail.com> (raw)
Replace i2c_add_adapter() with devm_i2c_add_adapter() and remove all
associated cleanup, as devm_i2c_add_adapter() handles adapter teardown
automatically.
Signed-off-by: Erick Karanja <karanja99erick@gmail.com>
---
drivers/gpu/drm/radeon/radeon_i2c.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c
index 1f16619ed06e..f3ba4187092c 100644
--- a/drivers/gpu/drm/radeon/radeon_i2c.c
+++ b/drivers/gpu/drm/radeon/radeon_i2c.c
@@ -931,7 +931,7 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev,
snprintf(i2c->adapter.name, sizeof(i2c->adapter.name),
"Radeon i2c hw bus %s", name);
i2c->adapter.algo = &radeon_i2c_algo;
- ret = i2c_add_adapter(&i2c->adapter);
+ ret = devm_i2c_add_adapter(dev->dev, &i2c->adapter);
if (ret)
goto out_free;
} else if (rec->hw_capable &&
@@ -972,15 +972,6 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev,
}
-void radeon_i2c_destroy(struct radeon_i2c_chan *i2c)
-{
- if (!i2c)
- return;
- WARN_ON(i2c->has_aux);
- i2c_del_adapter(&i2c->adapter);
- kfree(i2c);
-}
-
/* Add the default buses */
void radeon_i2c_init(struct radeon_device *rdev)
{
@@ -999,10 +990,8 @@ void radeon_i2c_fini(struct radeon_device *rdev)
int i;
for (i = 0; i < RADEON_MAX_I2C_BUS; i++) {
- if (rdev->i2c_bus[i]) {
- radeon_i2c_destroy(rdev->i2c_bus[i]);
+ if (rdev->i2c_bus[i])
rdev->i2c_bus[i] = NULL;
- }
}
}
--
2.43.0
next reply other threads:[~2025-12-11 9:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-11 8:59 Erick Karanja [this message]
2025-12-16 15:38 ` [PATCH] drm/radeon : Use devm_i2c_add_adapter instead of i2c_add_adapter Alex Deucher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251211085923.737742-1-karanja99erick@gmail.com \
--to=karanja99erick@gmail.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=simona@ffwll.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox