* [PATCH v2] i2c: amd-mp2: clean up amd_mp2_find_device()
@ 2025-12-10 4:02 Johan Hovold
2025-12-11 11:43 ` Shyam Sundar S K
2026-01-16 12:54 ` Andi Shyti
0 siblings, 2 replies; 3+ messages in thread
From: Johan Hovold @ 2025-12-10 4:02 UTC (permalink / raw)
To: Elie Morisse, Shyam Sundar S K, Andi Shyti
Cc: linux-i2c, linux-kernel, Johan Hovold
Rename the driver data pointer for consistency with the rest of the
driver and drop a redundant cast.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
Changes in v2
- rebase [1] on current mainline where the reference leak has already
been fixed and update the commit message to reflect that this is now
only a cleanup
[1] https://lore.kernel.org/lkml/20251121113714.4080-1-johan@kernel.org/
drivers/i2c/busses/i2c-amd-mp2-pci.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/busses/i2c-amd-mp2-pci.c b/drivers/i2c/busses/i2c-amd-mp2-pci.c
index 60edbabc2986..5b41d18b62d3 100644
--- a/drivers/i2c/busses/i2c-amd-mp2-pci.c
+++ b/drivers/i2c/busses/i2c-amd-mp2-pci.c
@@ -456,18 +456,20 @@ module_pci_driver(amd_mp2_pci_driver);
struct amd_mp2_dev *amd_mp2_find_device(void)
{
+ struct amd_mp2_dev *privdata;
struct device *dev;
struct pci_dev *pci_dev;
- struct amd_mp2_dev *mp2_dev;
dev = driver_find_next_device(&amd_mp2_pci_driver.driver, NULL);
if (!dev)
return NULL;
pci_dev = to_pci_dev(dev);
- mp2_dev = (struct amd_mp2_dev *)pci_get_drvdata(pci_dev);
+ privdata = pci_get_drvdata(pci_dev);
+
put_device(dev);
- return mp2_dev;
+
+ return privdata;
}
EXPORT_SYMBOL_GPL(amd_mp2_find_device);
--
2.52.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] i2c: amd-mp2: clean up amd_mp2_find_device()
2025-12-10 4:02 [PATCH v2] i2c: amd-mp2: clean up amd_mp2_find_device() Johan Hovold
@ 2025-12-11 11:43 ` Shyam Sundar S K
2026-01-16 12:54 ` Andi Shyti
1 sibling, 0 replies; 3+ messages in thread
From: Shyam Sundar S K @ 2025-12-11 11:43 UTC (permalink / raw)
To: Johan Hovold, Elie Morisse, Andi Shyti; +Cc: linux-i2c, linux-kernel
On 12/10/2025 09:32, Johan Hovold wrote:
> Rename the driver data pointer for consistency with the rest of the
> driver and drop a redundant cast.
>
> Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Thanks,
Shyam
> ---
>
> Changes in v2
> - rebase [1] on current mainline where the reference leak has already
> been fixed and update the commit message to reflect that this is now
> only a cleanup
>
> [1] https://lore.kernel.org/lkml/20251121113714.4080-1-johan@kernel.org/
>
>
> drivers/i2c/busses/i2c-amd-mp2-pci.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-amd-mp2-pci.c b/drivers/i2c/busses/i2c-amd-mp2-pci.c
> index 60edbabc2986..5b41d18b62d3 100644
> --- a/drivers/i2c/busses/i2c-amd-mp2-pci.c
> +++ b/drivers/i2c/busses/i2c-amd-mp2-pci.c
> @@ -456,18 +456,20 @@ module_pci_driver(amd_mp2_pci_driver);
>
> struct amd_mp2_dev *amd_mp2_find_device(void)
> {
> + struct amd_mp2_dev *privdata;
> struct device *dev;
> struct pci_dev *pci_dev;
> - struct amd_mp2_dev *mp2_dev;
>
> dev = driver_find_next_device(&amd_mp2_pci_driver.driver, NULL);
> if (!dev)
> return NULL;
>
> pci_dev = to_pci_dev(dev);
> - mp2_dev = (struct amd_mp2_dev *)pci_get_drvdata(pci_dev);
> + privdata = pci_get_drvdata(pci_dev);
> +
> put_device(dev);
> - return mp2_dev;
> +
> + return privdata;
> }
> EXPORT_SYMBOL_GPL(amd_mp2_find_device);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] i2c: amd-mp2: clean up amd_mp2_find_device()
2025-12-10 4:02 [PATCH v2] i2c: amd-mp2: clean up amd_mp2_find_device() Johan Hovold
2025-12-11 11:43 ` Shyam Sundar S K
@ 2026-01-16 12:54 ` Andi Shyti
1 sibling, 0 replies; 3+ messages in thread
From: Andi Shyti @ 2026-01-16 12:54 UTC (permalink / raw)
To: Johan Hovold; +Cc: Elie Morisse, Shyam Sundar S K, linux-i2c, linux-kernel
Hi Johan,
On Wed, Dec 10, 2025 at 01:02:58PM +0900, Johan Hovold wrote:
> Rename the driver data pointer for consistency with the rest of the
> driver and drop a redundant cast.
>
> Signed-off-by: Johan Hovold <johan@kernel.org>
merged to i2c/i2c-host.
Thanks,
Andi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-01-16 12:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-10 4:02 [PATCH v2] i2c: amd-mp2: clean up amd_mp2_find_device() Johan Hovold
2025-12-11 11:43 ` Shyam Sundar S K
2026-01-16 12:54 ` Andi Shyti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox