From patchwork Fri Mar 1 17:02:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 777145 Received: from mail-il1-f177.google.com (mail-il1-f177.google.com [209.85.166.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB701538B for ; Fri, 1 Mar 2024 17:02:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709312572; cv=none; b=RqqI94dX4DsQjBL1w4cRI21936jOVYHnWcgbzz8/474mV/D/R4GYChIbazY2jNPWN1TkHKJo02g2Ow0LwJY2z+m2dz0SPQ7bAZkHT5B8Zkd9fnDdmnAD3djBZI9EHkpufCu+UbDoxaZ3x1N1E648JCSpXhExofYNHnZchhMjpIY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709312572; c=relaxed/simple; bh=g9icqaFUX1RcE7FU17Pn10ZHapUyO6Ps4WVZPo13UvE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=X38g6iYCWnLJMiXfViniiuuHyAvuhfOaPcs4Kqd5lCj/LRN43j85E8ieWjNf9+06enhlYLz36rmZqyWgAtsD7u7tohG+27mBMlXptSkJSenwJ5fCS40RKMT5/yOXStyS2ZPlghljukj3R1llvztMpl+LG+htsAxwirNe93/IpaA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ds4Sjysy; arc=none smtp.client-ip=209.85.166.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ds4Sjysy" Received: by mail-il1-f177.google.com with SMTP id e9e14a558f8ab-3651c1e1022so11107165ab.0 for ; Fri, 01 Mar 2024 09:02:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709312569; x=1709917369; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Rr0sPFq1qDPx+8llR1pfou4QHoPDxxC6Fwf1wZxXaxw=; b=ds4Sjysym7OC0p47Vnhn3PAtHEIIICdWFXC07/RL2ecqVTkXrdJjudgLp8nP5eDzcE wEnR7gbSzlXYWI+osll3ujOE5hB4JZOCrpZXn9yIr53Yl0ivszOiJETzjqoG4MLrjC5X yMpZXkKJz/mT3w8drW8A8cwMuyd4NrWNkkgmM71NSSYfUjWAbFZjre7lANaw2iwTn+gf ALlYD5e+DFgDPO2xoh/4pknU7XDEy65vTBNCzgQfsDiMO1oy8rWk4+vE82C2npmNzGV4 +2SXUOC94lWO+aeR3PWzmNSIWegG6Yzu4Im9Uby05Y+fweIAWILWl3+T9RZmIQUF3ABx WD6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709312569; x=1709917369; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Rr0sPFq1qDPx+8llR1pfou4QHoPDxxC6Fwf1wZxXaxw=; b=KMG5aB0LhBoT9eLAHfunTx4z8yCDNtr9r6XkdUhD0Ld30LVGZey1+Nleg6Q8ikae1q aWW4oSI/hmEo85Q8wgT/TUAJrYfV6bXel5j2IR32REPF/QlzlnC7nBeD5UVxADI38R+l 05Hz0FclUmFmJoAVwfBRZNYp6ZCYGCIllhJCcyrQV9+NEKZ6z/vjmYfPdstb7FdsJnxc iOVR8lZyOTZ1iI5do9rHkJCO4Rvpv6HlAUgmBytPVl1Bx4+egQng2HgpI9vqQBsVP+mJ 4/amykWghN8cUQdY8w/Ij8klv8R2Ybeef3RyKC4JF95WuhSU5pE7umucM5dZAVtTmqKz f5lA== X-Forwarded-Encrypted: i=1; AJvYcCV1zCP8KSrG3zP4ySIUGWFXtuERAAXfKtaVPysBZhNBOP9kaDOgH2sKzVcyxW//qTwdI5otxI6Rl21UrufkflFD4MS4FnS2X8ydyEkzJQ== X-Gm-Message-State: AOJu0Yzz6yNzQgasqnp8mU9tbwfGL7V+K5KHrcplRtW+H6cQPjcUK36t y+jTq6oSktthD/NpJDztfBthQH43HS9KxcjTaod8HNhp1MuHhICLgSWNB1eFAEg= X-Google-Smtp-Source: AGHT+IEc8WDbH71aOYiXRryhVbw4XxkINw9m3SLDaj3comAhKmzbtzJgyh1FFXIpoFXfgyaJePYm6g== X-Received: by 2002:a05:6e02:1d18:b0:365:696:2817 with SMTP id i24-20020a056e021d1800b0036506962817mr2440997ila.3.1709312569049; Fri, 01 Mar 2024 09:02:49 -0800 (PST) Received: from localhost.localdomain (c-73-228-159-35.hsd1.mn.comcast.net. [73.228.159.35]) by smtp.gmail.com with ESMTPSA id o2-20020a92dac2000000b0036581060910sm991430ilq.6.2024.03.01.09.02.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 09:02:48 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: horms@kernel.org, mka@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 2/7] net: ipa: introduce ipa_interrupt_init() Date: Fri, 1 Mar 2024 11:02:37 -0600 Message-Id: <20240301170242.243703-3-elder@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240301170242.243703-1-elder@linaro.org> References: <20240301170242.243703-1-elder@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Create a new function ipa_interrupt_init() that is called at probe time to allocate and initialize the IPA interrupt data structure. Create ipa_interrupt_exit() as its inverse. This follows the normal IPA driver pattern of *_init() functions doing things that can be done before access to hardware is required. Signed-off-by: Alex Elder --- v2: Updated based on changes to patch 1 drivers/net/ipa/ipa_interrupt.c | 45 +++++++++++++++++++++++---------- drivers/net/ipa/ipa_interrupt.h | 14 ++++++++++ drivers/net/ipa/ipa_main.c | 28 ++++++++++++++++---- 3 files changed, 68 insertions(+), 19 deletions(-) diff --git a/drivers/net/ipa/ipa_interrupt.c b/drivers/net/ipa/ipa_interrupt.c index e23c9a5942eda..7399724160a89 100644 --- a/drivers/net/ipa/ipa_interrupt.c +++ b/drivers/net/ipa/ipa_interrupt.c @@ -19,6 +19,7 @@ * time only these three are supported. */ +#include #include #include #include @@ -238,26 +239,15 @@ void ipa_interrupt_simulate_suspend(struct ipa_interrupt *interrupt) /* Configure the IPA interrupt framework */ int ipa_interrupt_config(struct ipa *ipa) { + struct ipa_interrupt *interrupt = ipa->interrupt; struct device *dev = &ipa->pdev->dev; - struct ipa_interrupt *interrupt; + unsigned int irq = interrupt->irq; const struct reg *reg; - unsigned int irq; int ret; - ret = platform_get_irq_byname(ipa->pdev, "ipa"); - if (ret <= 0) { - dev_err(dev, "DT error %d getting \"ipa\" IRQ property\n", ret); - return ret ? : -EINVAL; - } - irq = ret; - - interrupt = kzalloc(sizeof(*interrupt), GFP_KERNEL); - if (!interrupt) - return -ENOMEM; interrupt->ipa = ipa; - interrupt->irq = irq; - /* Start with all IPA interrupts disabled */ + /* Disable all IPA interrupt types */ reg = ipa_reg(ipa, IPA_IRQ_EN); iowrite32(0, ipa->reg_virt + reg_offset(reg)); @@ -297,5 +287,32 @@ void ipa_interrupt_deconfig(struct ipa *ipa) dev_pm_clear_wake_irq(dev); free_irq(interrupt->irq, interrupt); +} + +/* Initialize the IPA interrupt structure */ +struct ipa_interrupt *ipa_interrupt_init(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct ipa_interrupt *interrupt; + int irq; + + irq = platform_get_irq_byname(pdev, "ipa"); + if (irq <= 0) { + dev_err(dev, "DT error %d getting \"ipa\" IRQ property\n", irq); + + return ERR_PTR(irq ? : -EINVAL); + } + + interrupt = kzalloc(sizeof(*interrupt), GFP_KERNEL); + if (!interrupt) + return ERR_PTR(-ENOMEM); + interrupt->irq = irq; + + return interrupt; +} + +/* Inverse of ipa_interrupt_init() */ +void ipa_interrupt_exit(struct ipa_interrupt *interrupt) +{ kfree(interrupt); } diff --git a/drivers/net/ipa/ipa_interrupt.h b/drivers/net/ipa/ipa_interrupt.h index 1947654e3e360..f3f4f4330a597 100644 --- a/drivers/net/ipa/ipa_interrupt.h +++ b/drivers/net/ipa/ipa_interrupt.h @@ -89,4 +89,18 @@ int ipa_interrupt_config(struct ipa *ipa); */ void ipa_interrupt_deconfig(struct ipa *ipa); +/** + * ipa_interrupt_init() - Initialize the IPA interrupt structure + * @pdev: IPA platform device pointer + * + * Return: Pointer to an IPA interrupt structure, or a pointer-coded error + */ +struct ipa_interrupt *ipa_interrupt_init(struct platform_device *pdev); + +/** + * ipa_interrupt_exit() - Inverse of ipa_interrupt_init() + * @interrupt: IPA interrupt structure + */ +void ipa_interrupt_exit(struct ipa_interrupt *interrupt); + #endif /* _IPA_INTERRUPT_H_ */ diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 0c6e6719d99e3..6cf5c1280aa4e 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -803,6 +803,7 @@ static enum ipa_firmware_loader ipa_firmware_loader(struct device *dev) static int ipa_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; + struct ipa_interrupt *interrupt; enum ipa_firmware_loader loader; const struct ipa_data *data; struct ipa_power *power; @@ -834,12 +835,21 @@ static int ipa_probe(struct platform_device *pdev) if (loader == IPA_LOADER_DEFER) return -EPROBE_DEFER; - /* The clock and interconnects might not be ready when we're - * probed, so might return -EPROBE_DEFER. + /* The IPA interrupt might not be ready when we're probed, so this + * might return -EPROBE_DEFER. + */ + interrupt = ipa_interrupt_init(pdev); + if (IS_ERR(interrupt)) + return PTR_ERR(interrupt); + + /* The clock and interconnects might not be ready when we're probed, + * so this might return -EPROBE_DEFER. */ power = ipa_power_init(dev, data->power_data); - if (IS_ERR(power)) - return PTR_ERR(power); + if (IS_ERR(power)) { + ret = PTR_ERR(power); + goto err_interrupt_exit; + } /* No more EPROBE_DEFER. Allocate and initialize the IPA structure */ ipa = kzalloc(sizeof(*ipa), GFP_KERNEL); @@ -850,6 +860,7 @@ static int ipa_probe(struct platform_device *pdev) ipa->pdev = pdev; dev_set_drvdata(dev, ipa); + ipa->interrupt = interrupt; ipa->power = power; ipa->version = data->version; ipa->modem_route_count = data->modem_route_count; @@ -934,6 +945,8 @@ static int ipa_probe(struct platform_device *pdev) kfree(ipa); err_power_exit: ipa_power_exit(power); +err_interrupt_exit: + ipa_interrupt_exit(interrupt); return ret; } @@ -941,10 +954,14 @@ static int ipa_probe(struct platform_device *pdev) static void ipa_remove(struct platform_device *pdev) { struct ipa *ipa = dev_get_drvdata(&pdev->dev); - struct ipa_power *power = ipa->power; struct device *dev = &pdev->dev; + struct ipa_interrupt *interrupt; + struct ipa_power *power; int ret; + power = ipa->power; + interrupt = ipa->interrupt; + /* Prevent the modem from triggering a call to ipa_setup(). This * also ensures a modem-initiated setup that's underway completes. */ @@ -986,6 +1003,7 @@ static void ipa_remove(struct platform_device *pdev) ipa_reg_exit(ipa); kfree(ipa); ipa_power_exit(power); + ipa_interrupt_exit(interrupt); dev_info(dev, "IPA driver removed"); } From patchwork Fri Mar 1 17:02:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 777144 Received: from mail-io1-f53.google.com (mail-io1-f53.google.com [209.85.166.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42B86F513 for ; Fri, 1 Mar 2024 17:02:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709312575; cv=none; b=rCLFKdMq9rmU6CUP0FsMMhGQ5ZummOuTDW1/hEwbqxFgxDVQS7KEmwjWYtj9IkFoLbkm0QRiZ0GdBchEakb5lpqga0ixA7B1kG1gbpgra+Y+Kge9YCZgCD2CcYXAfJOslTgC5FPjrx1NDSfR6xmoL4c+ybz69bm7bTCyB4OocVk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709312575; c=relaxed/simple; bh=C4WEfnReplN0gQTzXkMZmEt442ImK4xT7st2F/By4dE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BkH4gU86vtjNvSknHq6zAUs/Id/VCHKufJp10H0tBgiMZ4OSVTSVjoTehLWyq/XvuVD0lDHONS6smTsgMz08wbRTccxHCqF90ClhSdABsc2KP19QMNCvOagV+Lc81z0LF29sE4PgxkmObXEQhS6T7rYxPpQ2vSia9pIf3CQYus8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=NU43KbUI; arc=none smtp.client-ip=209.85.166.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="NU43KbUI" Received: by mail-io1-f53.google.com with SMTP id ca18e2360f4ac-7c81e087882so31180139f.0 for ; Fri, 01 Mar 2024 09:02:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709312571; x=1709917371; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=c1od9Mf5e1UrqV2FcK9CW+GpeCIGbA7ZM3UP+zHhMOk=; b=NU43KbUI3qj5J1dqdZ+CXUQJpf5ZEmFXgF9iI2pkqDNFLzJKgQXfCNje/IqqjUKvHa HXDeMo0/7B9dSNEM1dZO//om7aqdw0DqEDHAc+fJcIUKhuC2Nn8w2n+rZvZk9l82IJa/ we90sqP0QsaqqdL50LftNLWe8hRwspNsNOXiu0s/T84WXxsS4ZKpkxLwaxw0gUxhwfwZ m9zZGjI4dAKvXlwNeWgs7xn2e4UxR1eUfyWThPFO4u4XAw7J0q/q06AKqi9WSVv1PXje /1YpLZLCZ7omRltFggNhW/986ed2f5uRkTvRj/CrhyElQEgLjh9MlRq2BtX2Iz+jH4M9 UZ8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709312571; x=1709917371; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c1od9Mf5e1UrqV2FcK9CW+GpeCIGbA7ZM3UP+zHhMOk=; b=E7kFRmwQY/Srhx1aI54/1fgKNM6qXIgdKAeonBkIS8+Xs7SGMoD/RH4sLZrwhvkwnU wLWB90XJR5ipO1khCkMFa/SVC7Z7bLM6tBGX3Y2pJatlq9mbDrkS5cFgIQO1lqVeWcnh 8jcr5nzlFxEGOx/OP17IpdCg5PcjdAXZvBZxy18nYbYQ0WfUhqLySV0EsO0Laypv0ehu Ck8FsWQu1y6Xr3RW4WoYKpqO4CrsYNNcPcP8ZkInm7JSeqvTvP+yBWxE6/LvXbRQW1RA X4YbxYXuKyuYVB3WRvTE28oDMSVMbUvDrOA5MhK+oYd8frSr/92eNC77bsfZYTrux0Um JiFg== X-Forwarded-Encrypted: i=1; AJvYcCWIVb8jNeuzlkdKPRjm5UDUKbsnTTgaqXRlIwv2R23aMvpksZsAdu0QBYfKLI3RkMKIR+ALvpXBsoYrwLPjgvGpsj5aM/FJU2hdpG8ZNA== X-Gm-Message-State: AOJu0YxM41RbcQGIOYJQereNWloaw5GQbbV9Qibaeaq4fhercBF2bdw8 z5vSxicYk/eoeV7PmtU/7lZZWgDi8oqWRfCNxuFAXG5gECog+4EM7b5/tXpW6F4= X-Google-Smtp-Source: AGHT+IFKq3ninjSPbxfeCsVJ+HOfQBqUgzK6ZYXi5n/KtwuSbZFpzhfNQAP2pp2m3ZB3TD1gzESWIQ== X-Received: by 2002:a05:6e02:1d13:b0:365:2445:ffd6 with SMTP id i19-20020a056e021d1300b003652445ffd6mr1369615ila.13.1709312571464; Fri, 01 Mar 2024 09:02:51 -0800 (PST) Received: from localhost.localdomain (c-73-228-159-35.hsd1.mn.comcast.net. [73.228.159.35]) by smtp.gmail.com with ESMTPSA id o2-20020a92dac2000000b0036581060910sm991430ilq.6.2024.03.01.09.02.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 09:02:51 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: horms@kernel.org, mka@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 4/7] net: ipa: pass a platform device to ipa_mem_init() Date: Fri, 1 Mar 2024 11:02:39 -0600 Message-Id: <20240301170242.243703-5-elder@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240301170242.243703-1-elder@linaro.org> References: <20240301170242.243703-1-elder@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Rather than using the platform device pointer field in the IPA pointer, pass a platform device pointer to ipa_mem_init(). Use that pointer throughout that function. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_main.c | 2 +- drivers/net/ipa/ipa_mem.c | 13 +++++++------ drivers/net/ipa/ipa_mem.h | 5 ++++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 5c9c1b0ef8de5..17ee075370ce6 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -870,7 +870,7 @@ static int ipa_probe(struct platform_device *pdev) if (ret) goto err_kfree_ipa; - ret = ipa_mem_init(ipa, data->mem_data); + ret = ipa_mem_init(ipa, pdev, data->mem_data); if (ret) goto err_reg_exit; diff --git a/drivers/net/ipa/ipa_mem.c b/drivers/net/ipa/ipa_mem.c index 694960537ecda..d7df7d340221d 100644 --- a/drivers/net/ipa/ipa_mem.c +++ b/drivers/net/ipa/ipa_mem.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -75,9 +76,9 @@ ipa_mem_zero_region_add(struct gsi_trans *trans, enum ipa_mem_id mem_id) int ipa_mem_setup(struct ipa *ipa) { dma_addr_t addr = ipa->zero_addr; - const struct reg *reg; const struct ipa_mem *mem; struct gsi_trans *trans; + const struct reg *reg; u32 offset; u16 size; u32 val; @@ -615,9 +616,10 @@ static void ipa_smem_exit(struct ipa *ipa) } /* Perform memory region-related initialization */ -int ipa_mem_init(struct ipa *ipa, const struct ipa_mem_data *mem_data) +int ipa_mem_init(struct ipa *ipa, struct platform_device *pdev, + const struct ipa_mem_data *mem_data) { - struct device *dev = &ipa->pdev->dev; + struct device *dev = &pdev->dev; struct resource *res; int ret; @@ -634,14 +636,13 @@ int ipa_mem_init(struct ipa *ipa, const struct ipa_mem_data *mem_data) if (!ipa_table_mem_valid(ipa, true)) return -EINVAL; - ret = dma_set_mask_and_coherent(&ipa->pdev->dev, DMA_BIT_MASK(64)); + ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)); if (ret) { dev_err(dev, "error %d setting DMA mask\n", ret); return ret; } - res = platform_get_resource_byname(ipa->pdev, IORESOURCE_MEM, - "ipa-shared"); + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ipa-shared"); if (!res) { dev_err(dev, "DT error getting \"ipa-shared\" memory property\n"); diff --git a/drivers/net/ipa/ipa_mem.h b/drivers/net/ipa/ipa_mem.h index 868e9c20e8c41..28aad00a151da 100644 --- a/drivers/net/ipa/ipa_mem.h +++ b/drivers/net/ipa/ipa_mem.h @@ -6,6 +6,8 @@ #ifndef _IPA_MEM_H_ #define _IPA_MEM_H_ +struct platform_device; + struct ipa; struct ipa_mem_data; @@ -100,7 +102,8 @@ int ipa_mem_setup(struct ipa *ipa); /* No ipa_mem_teardown() needed */ int ipa_mem_zero_modem(struct ipa *ipa); -int ipa_mem_init(struct ipa *ipa, const struct ipa_mem_data *mem_data); +int ipa_mem_init(struct ipa *ipa, struct platform_device *pdev, + const struct ipa_mem_data *mem_data); void ipa_mem_exit(struct ipa *ipa); #endif /* _IPA_MEM_H_ */ From patchwork Fri Mar 1 17:02:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 777143 Received: from mail-il1-f169.google.com (mail-il1-f169.google.com [209.85.166.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 840CA22097 for ; Fri, 1 Mar 2024 17:02:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709312576; cv=none; b=gq3t4hqQs9KKE2+rHs4f1ECO+kmhaX327q4N6HZhTAmH2Pg0G/dZ19C/FH+9uIWfsw/BEiAmtiu7pQ191tCSxnsBMjAxJOpodT+0wPV7xSX33odGhj6F+swJ8+9eMOY/hrW8N8wlNK9K394N2UHZ0p72pco2Zk4ufIeDVQN7uL0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709312576; c=relaxed/simple; bh=pEDv/5wU7sbtDhxVNH7M10AUlaZ8vBb6MddBYxdRtUM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FBJjo2ZcNSB9lRNQihleB4XDKuf4P4IR62dShmd6IpbtTyOA6Gj4kufo6CaN9/PmoN726sT3iIQ6npPsriVD4pc/To7lfIzXZq/AIOXKdtHZ8vvmxkXZj6NTy+yYT5AXQTFi4mknk0iPdEDQiKeFzvPbbt04xJfnLuleubNXW4c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=fPVwitAF; arc=none smtp.client-ip=209.85.166.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="fPVwitAF" Received: by mail-il1-f169.google.com with SMTP id e9e14a558f8ab-365be6563cbso6859395ab.0 for ; Fri, 01 Mar 2024 09:02:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709312573; x=1709917373; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CjF4i+Vy6ouwx0EOaBtId9vglat4HShUeD3p4ZJNnXY=; b=fPVwitAFZTKFiW3JexhnQtFkAos9fx6cbwlBv8UGW2ytxPMJ8zbJQAJefJB51rWL4l QnkVS4r03F5BcbJFn+Jox00lQodhEho6t/kTuWMTJ7kITKRSP/z3i17vMz9yBoH1mW+k CNn1n1eMRwvdE4BkAH+bbEV9yDy4ah4U2IK7MIJZPS5NT/rNnv7A1JCRGqtVE5KlW2oA I4Bak86W/jskwMNoGcLN8oEAA3351YxjVbhpLKB/HQAv9MUUjPw2qBk0G4/fWvD/aw38 +5CgW7iUMAGSWF9Ifm+/3Q2ib226udF2s6kYH9SK3W5vdmhI++cQgaUKmTmGlpAygx3T /w2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709312573; x=1709917373; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CjF4i+Vy6ouwx0EOaBtId9vglat4HShUeD3p4ZJNnXY=; b=u9X2qjoEbu/fzRHg25metSMXSPcyn/vxY+IGKGtFM1HOMtDWWkJYnGmc+oImH8IgUp 5jhGoUYV+yluMi8yYCiHDAyG0329MRYRJKtNVUs+QuEkdoijX6jdufMmA5sr1eEdpyI7 9WPGQovP4YY3iVxsyRyoHM6A/IhXhm+qkUiXR+k9DGNysx89wzjo4GRmk9E9x1Sys1mI P8zo/tv6+cheOcoq/dWwcTLd1B3p1M6GCzQb3ammxZ00asY5G7NaoH8ohULeoEeCsI1O FjdnOiEjkgEI8mDwK8ydu7JxX9PVB/9qKyVBIleJpQrMD1m47nEyBooUemnWvt1EWVuS uxoA== X-Forwarded-Encrypted: i=1; AJvYcCUMfaei74WYK19JQzjLq7fx13QqpUJAFmnJuxhUlWUQIKGd5wVA4IBE3b1kk1Rhfrrw15I4zdNsJcsUbiWvdWIgKZHfbmv+XMSMRKFWpg== X-Gm-Message-State: AOJu0YyoZhRNHWzQ8H/Ohwv8MM4wARA9vW+qHOjvCpWpr7PuUwGHkdB9 RuaChZIcKwvhclqogcZdVVyLgMOzQCTxHUx2pEPCVslciclH1Z5WE8P3npP4zcw= X-Google-Smtp-Source: AGHT+IHrd68QcExTAOu/aeqCceJo5ZmXmc2iXGYS8ZJMGZzOquE/cm5CHi53LjP1/ur42QPIteCtjQ== X-Received: by 2002:a92:cd83:0:b0:365:c089:1d3a with SMTP id r3-20020a92cd83000000b00365c0891d3amr2709855ilb.15.1709312573653; Fri, 01 Mar 2024 09:02:53 -0800 (PST) Received: from localhost.localdomain (c-73-228-159-35.hsd1.mn.comcast.net. [73.228.159.35]) by smtp.gmail.com with ESMTPSA id o2-20020a92dac2000000b0036581060910sm991430ilq.6.2024.03.01.09.02.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 09:02:53 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: horms@kernel.org, mka@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 6/7] net: ipa: pass a platform device to ipa_smp2p_init() Date: Fri, 1 Mar 2024 11:02:41 -0600 Message-Id: <20240301170242.243703-7-elder@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240301170242.243703-1-elder@linaro.org> References: <20240301170242.243703-1-elder@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Rather than using the platform device pointer field in the IPA pointer, pass a platform device pointer to ipa_smp2p_init(). Use that pointer throughout that function. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_main.c | 2 +- drivers/net/ipa/ipa_smp2p.c | 10 +++++----- drivers/net/ipa/ipa_smp2p.h | 7 +++++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 17ee075370ce6..3125aec88e6e1 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -888,7 +888,7 @@ static int ipa_probe(struct platform_device *pdev) if (ret) goto err_endpoint_exit; - ret = ipa_smp2p_init(ipa, loader == IPA_LOADER_MODEM); + ret = ipa_smp2p_init(ipa, pdev, loader == IPA_LOADER_MODEM); if (ret) goto err_table_exit; diff --git a/drivers/net/ipa/ipa_smp2p.c b/drivers/net/ipa/ipa_smp2p.c index 8c4497dfe5afd..831268551d9a7 100644 --- a/drivers/net/ipa/ipa_smp2p.c +++ b/drivers/net/ipa/ipa_smp2p.c @@ -220,10 +220,11 @@ static void ipa_smp2p_power_release(struct ipa *ipa) } /* Initialize the IPA SMP2P subsystem */ -int ipa_smp2p_init(struct ipa *ipa, bool modem_init) +int +ipa_smp2p_init(struct ipa *ipa, struct platform_device *pdev, bool modem_init) { struct qcom_smem_state *enabled_state; - struct device *dev = &ipa->pdev->dev; + struct device *dev = &pdev->dev; struct qcom_smem_state *valid_state; struct ipa_smp2p *smp2p; u32 enabled_bit; @@ -262,7 +263,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, smp2p->ipa->pdev, "ipa-clock-query", + ret = ipa_smp2p_irq_init(smp2p, pdev, "ipa-clock-query", ipa_smp2p_modem_clk_query_isr); if (ret < 0) goto err_null_smp2p; @@ -274,8 +275,7 @@ 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, smp2p->ipa->pdev, - "ipa-setup-ready", + ret = ipa_smp2p_irq_init(smp2p, pdev, "ipa-setup-ready", ipa_smp2p_modem_setup_ready_isr); if (ret < 0) goto err_notifier_unregister; diff --git a/drivers/net/ipa/ipa_smp2p.h b/drivers/net/ipa/ipa_smp2p.h index 9b969b03d1a4b..2a3d8eefb13bb 100644 --- a/drivers/net/ipa/ipa_smp2p.h +++ b/drivers/net/ipa/ipa_smp2p.h @@ -8,17 +8,20 @@ #include +struct platform_device; + struct ipa; /** * ipa_smp2p_init() - Initialize the IPA SMP2P subsystem * @ipa: IPA pointer + * @pdev: Platform device pointer * @modem_init: Whether the modem is responsible for GSI initialization * * Return: 0 if successful, or a negative error code - * */ -int ipa_smp2p_init(struct ipa *ipa, bool modem_init); +int ipa_smp2p_init(struct ipa *ipa, struct platform_device *pdev, + bool modem_init); /** * ipa_smp2p_exit() - Inverse of ipa_smp2p_init()