2024-03-01 17:11:50

by Alex Elder

[permalink] [raw]
Subject: [PATCH net-next v2 0/7] net: ipa: simplify device pointer access

This version of this patch series fixes the bugs in the first patch
(which were fixed in the second), where ipa_interrupt_config() had
two remaining spots that returned a pointer rather than an integer.

Outside of initialization, all uses of the platform device pointer
stored in the IPA structure determine the address of device
structure embedded within the platform device structure.

By changing some of the initialization functions to take a platform
device as argument we can simplify getting at the device structure
address by storing it (instead of the platform device pointer) in
the IPA structure.

The first two patches split the interrupt initialization code into
two parts--one done earlier than before. The next four patches
update some initialization functions to take a platform device
pointer as argument. And the last patch replaces the platform
device pointer with a device pointer, and converts all remaining
references to the &ipa->pdev->dev to use ipa->dev.

-Alex

Alex Elder (7):
net: ipa: change ipa_interrupt_config() prototype
net: ipa: introduce ipa_interrupt_init()
net: ipa: pass a platform device to ipa_reg_init()
net: ipa: pass a platform device to ipa_mem_init()
net: ipa: pass a platform device to ipa_smp2p_irq_init()
net: ipa: pass a platform device to ipa_smp2p_init()
net: ipa: don't save the platform device

drivers/net/ipa/ipa.h | 5 +--
drivers/net/ipa/ipa_cmd.c | 6 +--
drivers/net/ipa/ipa_endpoint.c | 29 +++++++-------
drivers/net/ipa/ipa_interrupt.c | 69 +++++++++++++++++++++------------
drivers/net/ipa/ipa_interrupt.h | 22 +++++++++--
drivers/net/ipa/ipa_main.c | 60 +++++++++++++++++-----------
drivers/net/ipa/ipa_mem.c | 37 +++++++++---------
drivers/net/ipa/ipa_mem.h | 5 ++-
drivers/net/ipa/ipa_modem.c | 14 +++----
drivers/net/ipa/ipa_power.c | 4 +-
drivers/net/ipa/ipa_qmi.c | 10 ++---
drivers/net/ipa/ipa_reg.c | 8 ++--
drivers/net/ipa/ipa_reg.h | 4 +-
drivers/net/ipa/ipa_smp2p.c | 33 ++++++++--------
drivers/net/ipa/ipa_smp2p.h | 7 +++-
drivers/net/ipa/ipa_table.c | 18 ++++-----
drivers/net/ipa/ipa_uc.c | 9 ++---
17 files changed, 197 insertions(+), 143 deletions(-)

--
2.40.1



2024-03-01 17:12:54

by Alex Elder

[permalink] [raw]
Subject: [PATCH net-next v2 5/7] net: ipa: pass a platform device to ipa_smp2p_irq_init()

Rather than using the platform device pointer field in the IPA
pointer, pass a platform device pointer to ipa_smp2p_irq_init().
Use that pointer throughout that function (without assuming it's
the same as the IPA platform device pointer).

Signed-off-by: Alex Elder <[email protected]>
---
drivers/net/ipa/ipa_smp2p.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ipa/ipa_smp2p.c b/drivers/net/ipa/ipa_smp2p.c
index 5620dc271fac3..8c4497dfe5afd 100644
--- a/drivers/net/ipa/ipa_smp2p.c
+++ b/drivers/net/ipa/ipa_smp2p.c
@@ -5,7 +5,7 @@
*/

#include <linux/types.h>
-#include <linux/device.h>
+#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/notifier.h>
#include <linux/panic_notifier.h>
@@ -179,14 +179,15 @@ static irqreturn_t ipa_smp2p_modem_setup_ready_isr(int irq, void *dev_id)
}

/* Initialize SMP2P interrupts */
-static int ipa_smp2p_irq_init(struct ipa_smp2p *smp2p, const char *name,
- irq_handler_t handler)
+static int ipa_smp2p_irq_init(struct ipa_smp2p *smp2p,
+ struct platform_device *pdev,
+ const char *name, irq_handler_t handler)
{
- struct device *dev = &smp2p->ipa->pdev->dev;
+ struct device *dev = &pdev->dev;
unsigned int irq;
int ret;

- ret = platform_get_irq_byname(smp2p->ipa->pdev, name);
+ ret = platform_get_irq_byname(pdev, name);
if (ret <= 0)
return ret ? : -EINVAL;
irq = ret;
@@ -261,7 +262,7 @@ int ipa_smp2p_init(struct ipa *ipa, bool modem_init)
/* We have enough information saved to handle notifications */
ipa->smp2p = smp2p;

- ret = ipa_smp2p_irq_init(smp2p, "ipa-clock-query",
+ ret = ipa_smp2p_irq_init(smp2p, smp2p->ipa->pdev, "ipa-clock-query",
ipa_smp2p_modem_clk_query_isr);
if (ret < 0)
goto err_null_smp2p;
@@ -273,7 +274,8 @@ int ipa_smp2p_init(struct ipa *ipa, bool modem_init)

if (modem_init) {
/* Result will be non-zero (negative for error) */
- ret = ipa_smp2p_irq_init(smp2p, "ipa-setup-ready",
+ ret = ipa_smp2p_irq_init(smp2p, smp2p->ipa->pdev,
+ "ipa-setup-ready",
ipa_smp2p_modem_setup_ready_isr);
if (ret < 0)
goto err_notifier_unregister;
--
2.40.1


2024-03-04 11:51:09

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH net-next v2 0/7] net: ipa: simplify device pointer access

Hello:

This series was applied to netdev/net-next.git (main)
by David S. Miller <[email protected]>:

On Fri, 1 Mar 2024 11:02:35 -0600 you wrote:
> This version of this patch series fixes the bugs in the first patch
> (which were fixed in the second), where ipa_interrupt_config() had
> two remaining spots that returned a pointer rather than an integer.
>
> Outside of initialization, all uses of the platform device pointer
> stored in the IPA structure determine the address of device
> structure embedded within the platform device structure.
>
> [...]

Here is the summary with links:
- [net-next,v2,1/7] net: ipa: change ipa_interrupt_config() prototype
https://git.kernel.org/netdev/net-next/c/e87e4371edfc
- [net-next,v2,2/7] net: ipa: introduce ipa_interrupt_init()
https://git.kernel.org/netdev/net-next/c/ad1be80d7582
- [net-next,v2,3/7] net: ipa: pass a platform device to ipa_reg_init()
https://git.kernel.org/netdev/net-next/c/a47956e72a3e
- [net-next,v2,4/7] net: ipa: pass a platform device to ipa_mem_init()
https://git.kernel.org/netdev/net-next/c/95c54a963b24
- [net-next,v2,5/7] net: ipa: pass a platform device to ipa_smp2p_irq_init()
https://git.kernel.org/netdev/net-next/c/59622a8fb453
- [net-next,v2,6/7] net: ipa: pass a platform device to ipa_smp2p_init()
https://git.kernel.org/netdev/net-next/c/81d65f3413da
- [net-next,v2,7/7] net: ipa: don't save the platform device
https://git.kernel.org/netdev/net-next/c/5245f4fd28d1

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html