From patchwork Fri Mar 1 17:02:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 13578786 Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) (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 AE9C14404 for ; Fri, 1 Mar 2024 17:02:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709312570; cv=none; b=HHJmpVx9lomQMNJ2Zs0giw9HKYOayTwiO0BI2c1B3iYlJ3ML68UHpixBAquP0u8NLqaJfFQpMjb/avwNRZDfcqVxMJQmWDAArW+KnMF7sEv/7/4wuQTmxp5GjuGsWobWuto2qHYRwSNohfcGtUQZRjKda7kgE/iKdh4fBmOh2oY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709312570; c=relaxed/simple; bh=iBfmq8FiW83RHkKaeBd7C85lcsS1UP1JRKzZ4ojGyyk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Rvtw9J7gAmn3VY+tgbcl+CNNiq9hstJfWNN/T/SyFqN70YmXnZXhORM6pMPKlNap8+TE4R6RATX67JqgrHpb7xWsI7oHdMnEVH+MEqlU+e8nb/f0ZRWTvFBrhC2jmNhyjo7g+EnSocEWxaJ4kbmmA6apMw6R+mC4IyshS1PG574= 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=f7w0WpsL; arc=none smtp.client-ip=209.85.166.45 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="f7w0WpsL" Received: by mail-io1-f45.google.com with SMTP id ca18e2360f4ac-7bed9fb159fso121765939f.1 for ; Fri, 01 Mar 2024 09:02:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709312568; x=1709917368; 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=iaMlwQQ3/GUmxQKOFUy5DpH0QO/BlGNt49LLq8M56yQ=; b=f7w0WpsLiACwdyMQpSnRkhRes4nHQH53/bAp/im8zZTnZbqseMxpaCs0iBigjjkJeY 4gIcJdQ6CpE2Mq30zzi7PMdVnOTElirueux5qVQaSos2JEEwt97gNMVQPTaeiezoKbuE koeT1mp84WNKLJZjvUzamnPiTq7coIkCEpg+viHJoWU8w0f7QQiObjpExLJduzP5TVJk oNLbg5dXoLB7p/dnkC+bjnsiX8Fk7KEnWo3cQXXYAvmnlRFaET2ypw0t39JYKv2w7eZG CH9NsyrV/xPacwSbvxEC90vlj/nwhRQB49nL5AFg2SqijWgHJpDwMCCsKOSjHTK3QqqC y4dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709312568; x=1709917368; 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=iaMlwQQ3/GUmxQKOFUy5DpH0QO/BlGNt49LLq8M56yQ=; b=D6GZisrXnHhTda0wzpqvA7BFd/prv0NFjJhmK1Tvkq6LgXjSiGiDjTZa9BWYPXF3OG wcnqrQCyLhRc5et6Gmk1vcRppW1KKbSygJVEkTt/KVGc7qMW+uecj8GTBihYn4WKdmVv LCC4g7drQnyxWV9Kcd4jjquLOA0axwWctC1RiPtkfxyPvSvOWMKEaOzh94nwYtzt3qNt PbD98hLUkwTpMIREUXXfFJTBKS4KICLyImgkhjDDov1kfVHGATh1xXu/LIlMw30mGV4S aBvuVPTq/UNrZRJoNn166vDCvSDjcvTKgsEfSB6Bx03mgXI2SeQQBj995vmqH0HW4Dp9 5Yfg== X-Forwarded-Encrypted: i=1; AJvYcCWpls+8sICnYiQ5n7iUJIPpau4t57h7Kq6YOVnqbFkMNC9chVX1tQEyTGoQOKbnHChh3N1+5QARzwUws4pSPoMpNZ8kw2bHcDg4apRtfQ== X-Gm-Message-State: AOJu0YyvyE66mL65g9X1ykmim5kSn3yqc8WuCVMa4EkTcPyHjpMl9c5J zfXts0vqd8pZjpj2BzP7dXztez31V/YyjG/EA0etwawBBPr6x33q4pfhZD75S5Q= X-Google-Smtp-Source: AGHT+IHSx/ZMCskHwH0MKILf0qUluUBJVrdyd/ZzLLEnZgQemtbczKtFo9BeZ2YDZECdrl/gYlM6CQ== X-Received: by 2002:a05:6e02:12e1:b0:365:25c0:c82d with SMTP id l1-20020a056e0212e100b0036525c0c82dmr2548448iln.28.1709312567811; Fri, 01 Mar 2024 09:02:47 -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.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 09:02:47 -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 1/7] net: ipa: change ipa_interrupt_config() prototype Date: Fri, 1 Mar 2024 11:02:36 -0600 Message-Id: <20240301170242.243703-2-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 Change the return type of ipa_interrupt_config() to be an error code rather than an IPA interrupt structure pointer, and assign the the pointer within that function. Change ipa_interrupt_deconfig() to take the IPA pointer as argument and have it invalidate the ipa->interrupt pointer. Signed-off-by: Alex Elder --- v2: Make sure all returns from ipa_interrupt_config() are ints. drivers/net/ipa/ipa_interrupt.c | 25 +++++++++++++++---------- drivers/net/ipa/ipa_interrupt.h | 10 +++++----- drivers/net/ipa/ipa_main.c | 13 ++++--------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/drivers/net/ipa/ipa_interrupt.c b/drivers/net/ipa/ipa_interrupt.c index 4d80bf77a5323..e23c9a5942eda 100644 --- a/drivers/net/ipa/ipa_interrupt.c +++ b/drivers/net/ipa/ipa_interrupt.c @@ -236,7 +236,7 @@ void ipa_interrupt_simulate_suspend(struct ipa_interrupt *interrupt) } /* Configure the IPA interrupt framework */ -struct ipa_interrupt *ipa_interrupt_config(struct ipa *ipa) +int ipa_interrupt_config(struct ipa *ipa) { struct device *dev = &ipa->pdev->dev; struct ipa_interrupt *interrupt; @@ -246,15 +246,14 @@ struct ipa_interrupt *ipa_interrupt_config(struct ipa *ipa) ret = platform_get_irq_byname(ipa->pdev, "ipa"); if (ret <= 0) { - dev_err(dev, "DT error %d getting \"ipa\" IRQ property\n", - ret); - return ERR_PTR(ret ? : -EINVAL); + 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 ERR_PTR(-ENOMEM); + return -ENOMEM; interrupt->ipa = ipa; interrupt->irq = irq; @@ -271,24 +270,30 @@ struct ipa_interrupt *ipa_interrupt_config(struct ipa *ipa) ret = dev_pm_set_wake_irq(dev, irq); if (ret) { - dev_err(dev, "error %d registering \"ipa\" IRQ as wakeirq\n", ret); + dev_err(dev, "error %d registering \"ipa\" IRQ as wakeirq\n", + ret); goto err_free_irq; } - return interrupt; + ipa->interrupt = interrupt; + + return 0; err_free_irq: free_irq(interrupt->irq, interrupt); err_kfree: kfree(interrupt); - return ERR_PTR(ret); + return ret; } /* Inverse of ipa_interrupt_config() */ -void ipa_interrupt_deconfig(struct ipa_interrupt *interrupt) +void ipa_interrupt_deconfig(struct ipa *ipa) { - struct device *dev = &interrupt->ipa->pdev->dev; + struct ipa_interrupt *interrupt = ipa->interrupt; + struct device *dev = &ipa->pdev->dev; + + ipa->interrupt = NULL; dev_pm_clear_wake_irq(dev); free_irq(interrupt->irq, interrupt); diff --git a/drivers/net/ipa/ipa_interrupt.h b/drivers/net/ipa/ipa_interrupt.h index 53e1b71685c75..1947654e3e360 100644 --- a/drivers/net/ipa/ipa_interrupt.h +++ b/drivers/net/ipa/ipa_interrupt.h @@ -76,17 +76,17 @@ void ipa_interrupt_irq_enable(struct ipa *ipa); void ipa_interrupt_irq_disable(struct ipa *ipa); /** - * ipa_interrupt_config() - Configure the IPA interrupt framework + * ipa_interrupt_config() - Configure IPA interrupts * @ipa: IPA pointer * - * Return: Pointer to IPA SMP2P info, or a pointer-coded error + * Return: 0 if successful, or a negative error code */ -struct ipa_interrupt *ipa_interrupt_config(struct ipa *ipa); +int ipa_interrupt_config(struct ipa *ipa); /** * ipa_interrupt_deconfig() - Inverse of ipa_interrupt_config() - * @interrupt: IPA interrupt structure + * @ipa: IPA pointer */ -void ipa_interrupt_deconfig(struct ipa_interrupt *interrupt); +void ipa_interrupt_deconfig(struct ipa *ipa); #endif /* _IPA_INTERRUPT_H_ */ diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 00475fd7a2054..0c6e6719d99e3 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -542,12 +542,9 @@ static int ipa_config(struct ipa *ipa, const struct ipa_data *data) if (ret) goto err_hardware_deconfig; - ipa->interrupt = ipa_interrupt_config(ipa); - if (IS_ERR(ipa->interrupt)) { - ret = PTR_ERR(ipa->interrupt); - ipa->interrupt = NULL; + ret = ipa_interrupt_config(ipa); + if (ret) goto err_mem_deconfig; - } ipa_uc_config(ipa); @@ -572,8 +569,7 @@ static int ipa_config(struct ipa *ipa, const struct ipa_data *data) ipa_endpoint_deconfig(ipa); err_uc_deconfig: ipa_uc_deconfig(ipa); - ipa_interrupt_deconfig(ipa->interrupt); - ipa->interrupt = NULL; + ipa_interrupt_deconfig(ipa); err_mem_deconfig: ipa_mem_deconfig(ipa); err_hardware_deconfig: @@ -591,8 +587,7 @@ static void ipa_deconfig(struct ipa *ipa) ipa_modem_deconfig(ipa); ipa_endpoint_deconfig(ipa); ipa_uc_deconfig(ipa); - ipa_interrupt_deconfig(ipa->interrupt); - ipa->interrupt = NULL; + ipa_interrupt_deconfig(ipa); ipa_mem_deconfig(ipa); ipa_hardware_deconfig(ipa); } 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: 13578787 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:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 13578788 Received: from mail-il1-f172.google.com (mail-il1-f172.google.com [209.85.166.172]) (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 4EF66882E for ; Fri, 1 Mar 2024 17:02:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709312572; cv=none; b=O2GxazxyOaVKVKe87jQbGocIG/4WwuHbU45ca9w6mbxGh/+8e9tObxtcWgueedk8qVAoQCPrC83Nxdro7nNp5zGbg6xAyqcex3Vt4EURo6ZqYz7Jwi7ZOUGdKOn7HK4+AIkCjH9MUOTXCIv615CUQx9X3QWvInvu98mnW8bXFCI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709312572; c=relaxed/simple; bh=XwGOf1MLWzPXiuaGkXStpdLvB4FPo5vk4nLwFw1ga6k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PInpO1sBD2pNJkUkc6tEaNHIY5YjpIpKy2SwimRaTQiXhZU7dIqGKT0Hcv/yhj3oWu8kAm6Jf3klnkfPklIlD76xZqx7WoGjo6bObhJJC2JtXQNmB3RnbUWmbE+294RFfLWfN0uxbZljcQTa/Eam+Pz3pwtaaK+RBh3bjp6ZzBY= 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=WThNEJ/L; arc=none smtp.client-ip=209.85.166.172 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="WThNEJ/L" Received: by mail-il1-f172.google.com with SMTP id e9e14a558f8ab-365253c52aaso7594555ab.2 for ; Fri, 01 Mar 2024 09:02:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709312570; x=1709917370; 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=TGWJjaxvrYhNIssQekJJrsQHyV2VIpv1G8S6HOh3hAI=; b=WThNEJ/L2qGEsrsSRQ5Ki6mTeXizAM7+MZh1SXDqsmKktz8dkDGUXXBgw1ydz5Eprh JXzQSoOMm/8NEZqvlEr0rWF6uMQNAK+XXIMTxDGrbuCWt7YP2YBbXLtUufi4BuVrbNgm 1qkcD27ENItsobns+2pybMXBxyDqYKJ/KKkmuqy/V65e/B1QllGk3lQQHly1QDc6Pn28 v7hWZgauQSLXFDMolNLfIifY8V9fLN+EazdVewMMRn31khryiXKdiITFZEedkpspzLhO DbI8Xo9SlGoEmB/51gkmZlzC4kodcGaVa8BK03ghQl8kJRWqTvA6WLbp3/60OfVF2nHH iB9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709312570; x=1709917370; 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=TGWJjaxvrYhNIssQekJJrsQHyV2VIpv1G8S6HOh3hAI=; b=gMEXnMMTGnQeg1j8/KWclCRIQ9eFZLWhOSuFcyjYLc3wP90BkNCMG9O1rukwtvjTFD cnNtC7BJYVZt+76TsTGwdrSnMyai1d3OFB1FuEgCh/scuj7JDAlyAyFQX/JVGdDsDgJa AGKXRHgEDdYAmmu4DOQ6+9haEpxn5RhE9mHY6ZCU9g1XSN5kByRgm2lOPtIxpPVprE5I Y8aAlo+ChQNE1Y4qHI2oNQ6PprNCpYormXP0njOBAGLjfA8kDORgAsK56B/TO5Q+Ml5v BOpoDveBBKCt05diLCU/DQZhY6QcIgDBX8ABShL5cRo8KSeQHStLu/lzSSC5NO6UqUZZ wiHA== X-Forwarded-Encrypted: i=1; AJvYcCVu7W7NqSJjqFl4wpR8i4ngOyuJfTdAB86sqgXT0VxGJYc35ehOzfzewCmxYnBbAQOTlwbm3MqsVluzL3AiF2lEmUYxrOwA0gHI3dxHGg== X-Gm-Message-State: AOJu0YzJtw0LDIdMk6lusCA1VRofsX+AHlzzfujCgQqsqjkyva4O2N10 SjbDvEhCKYF2lMHtJJo0EztjeDcF44UmT3/EjLagShtXjYP+Ge40Rbn+KFy2BBk= X-Google-Smtp-Source: AGHT+IFuF5YM0vSwjoMxJ/sucKgi07FMEwtC0vCsj/aKhS2iBQBSGrnHVpzotqrIOWbx7KwjP8VSpA== X-Received: by 2002:a05:6e02:152b:b0:365:4004:83bc with SMTP id i11-20020a056e02152b00b00365400483bcmr2366487ilu.14.1709312570335; Fri, 01 Mar 2024 09:02:50 -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.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 09:02:49 -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 3/7] net: ipa: pass a platform device to ipa_reg_init() Date: Fri, 1 Mar 2024 11:02:38 -0600 Message-Id: <20240301170242.243703-4-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_reg_init(). Use that pointer throughout that function. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_main.c | 2 +- drivers/net/ipa/ipa_reg.c | 8 ++++---- drivers/net/ipa/ipa_reg.h | 4 +++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 6cf5c1280aa4e..5c9c1b0ef8de5 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -866,7 +866,7 @@ static int ipa_probe(struct platform_device *pdev) ipa->modem_route_count = data->modem_route_count; init_completion(&ipa->completion); - ret = ipa_reg_init(ipa); + ret = ipa_reg_init(ipa, pdev); if (ret) goto err_kfree_ipa; diff --git a/drivers/net/ipa/ipa_reg.c b/drivers/net/ipa/ipa_reg.c index 6a3203ae6f1ef..98625956e0bb4 100644 --- a/drivers/net/ipa/ipa_reg.c +++ b/drivers/net/ipa/ipa_reg.c @@ -4,6 +4,7 @@ * Copyright (C) 2019-2023 Linaro Ltd. */ +#include #include #include "ipa.h" @@ -132,9 +133,9 @@ static const struct regs *ipa_regs(enum ipa_version version) } } -int ipa_reg_init(struct ipa *ipa) +int ipa_reg_init(struct ipa *ipa, struct platform_device *pdev) { - struct device *dev = &ipa->pdev->dev; + struct device *dev = &pdev->dev; const struct regs *regs; struct resource *res; @@ -146,8 +147,7 @@ int ipa_reg_init(struct ipa *ipa) return -EINVAL; /* Setup IPA register memory */ - res = platform_get_resource_byname(ipa->pdev, IORESOURCE_MEM, - "ipa-reg"); + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ipa-reg"); if (!res) { dev_err(dev, "DT error getting \"ipa-reg\" memory property\n"); return -ENODEV; diff --git a/drivers/net/ipa/ipa_reg.h b/drivers/net/ipa/ipa_reg.h index 2998f115f12c7..62c62495b7968 100644 --- a/drivers/net/ipa/ipa_reg.h +++ b/drivers/net/ipa/ipa_reg.h @@ -12,6 +12,8 @@ #include "ipa_version.h" #include "reg.h" +struct platform_device; + struct ipa; /** @@ -643,7 +645,7 @@ extern const struct regs ipa_regs_v5_5; const struct reg *ipa_reg(struct ipa *ipa, enum ipa_reg_id reg_id); -int ipa_reg_init(struct ipa *ipa); +int ipa_reg_init(struct ipa *ipa, struct platform_device *pdev); void ipa_reg_exit(struct ipa *ipa); #endif /* _IPA_REG_H_ */ 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: 13578789 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:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 13578790 Received: from mail-io1-f54.google.com (mail-io1-f54.google.com [209.85.166.54]) (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 240B1208C4 for ; Fri, 1 Mar 2024 17:02:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709312575; cv=none; b=e8uNAgFQSLrWtAhprXuHFyYleiIyybHD4QA1fHJMMaQk3agOW7+SbuKt8G5lmjdStbU7chpdNHcW8EWjm5eNgwGc5uwaDrmW4zekOrODeue6ZRMjB3QP/M4ryy5qUARk4Vn176xqy/3zleNEoraTJTj2FfW2mrVzGNtH6tBOnqA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709312575; c=relaxed/simple; bh=Am0NKmlCwgLy7Njo99K+o5i4CrEnaQkPIJSAd0GcvZg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Oe9qFwFXEZGO6XeTQ49hp5MLcgT0q/lKizdFfJUdQftvK5l0Q2wHJB7KGsJ43/YFu3MT3rgdAR/z1IYyc+kGlI2SkFGvdl1JTSZCuqUiEPTDURa2tMdSLZIoPg0f8yBciH1ZyKAWsB0nPXhMI9+WZsPoQup1KvtR0dCLWkx2mW0= 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=UoiXNq1Y; arc=none smtp.client-ip=209.85.166.54 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="UoiXNq1Y" Received: by mail-io1-f54.google.com with SMTP id ca18e2360f4ac-7c794deb6cdso102742839f.0 for ; Fri, 01 Mar 2024 09:02:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709312572; x=1709917372; 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=5D+lwpw4B4CqzaxbOzMn85Ig/zR5F9N9xKtP1WaY0I4=; b=UoiXNq1YIse/AYhZrBjeNzM++GGQGFq9Ey6Ss73tCz4yKRng/w92bL2oPBe0j0KBSb sFADnKJ51BglRq4K0hCoRsx9qRaOqhb6bnSGHD3604Muzw/NvCk95+VSbhOjtRnDfXit oDMp3CHa+n4nqSKUmEIACbxyiR7HcYYG/NSbvt4gmdfNm2hColtUbZsGVdyEzkpjlnfK PH/vBB5ZBdKP+x+varCLCAzZror7efDGkRcNmoBZUweLURWvDUVw6ykNWGY5JIPJNfPF nbUffIGAJFNqijTjujOUCefemb5CkWdMt1MFd5XcQWTElWR17FpRLQ+YnQTwQHyLpvb1 mf+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709312572; x=1709917372; 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=5D+lwpw4B4CqzaxbOzMn85Ig/zR5F9N9xKtP1WaY0I4=; b=F2F+aqFBc3qxYug2FDZ6eoeVCjRioyFIbR3Ma/koMZMnnKQ5jgrSRtILYQcoI7vIy6 uwHjTvY4TMp+HcOvzhqSwRb32lld8a55gQW+GM0C1mDh0w+YV3zr//c9Pck/WKEnXW+q He4Zpx1ftimeVGREYJn4YN/GTlZC8lKunxCx9AUmKbqlfQHt/LrG0RKsFOUVyY3nYy1K nWjPfBZiPVNBFuqvBJkl8AELLAcds3Cfjek6qgvR+l+GlpLJ5i+X/GlykXjmefJbKdFw g5FEgYRzY80rMOoHRxCv2xZECAe9aEn9s2ZaNqMNVbDRBmodZoYPjyhTrcVL0l9VduW9 Nrlw== X-Forwarded-Encrypted: i=1; AJvYcCVYv4WT3Fu/PCcRF4Mt7zf6Nr9i0iuqGjkvCwgXXX8rr7erePFr4pCk9XA7EdP5c4C0d/tjxB34tE2CVfATOUk8e1zu2hxWgnxuVnzqSA== X-Gm-Message-State: AOJu0YxIe+aKA6qZlCLObbPd7MeWv/IhVHq1+/Y5cLyAaMgToKDtg/o3 yO9YPVMxTAwJQ319PZwMBtSYG6J/CPjAX+nSflTYeJxym0sWVDJyLN31odzOBLk= X-Google-Smtp-Source: AGHT+IEao1txlb3PWR+Vls4dRzrvRoKUVfV7DGZtMHkfNbUdkpxeGg58q0ddiR3eTAA5Nv2Op55FMw== X-Received: by 2002:a05:6e02:12c3:b0:365:b574:960b with SMTP id i3-20020a056e0212c300b00365b574960bmr2458398ilm.18.1709312572586; Fri, 01 Mar 2024 09:02:52 -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.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 09:02:52 -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 5/7] net: ipa: pass a platform device to ipa_smp2p_irq_init() Date: Fri, 1 Mar 2024 11:02:40 -0600 Message-Id: <20240301170242.243703-6-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_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 --- 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 -#include +#include #include #include #include @@ -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; 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: 13578791 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() From patchwork Fri Mar 1 17:02:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 13578792 Received: from mail-il1-f182.google.com (mail-il1-f182.google.com [209.85.166.182]) (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 E71313FE0 for ; Fri, 1 Mar 2024 17:02:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709312579; cv=none; b=H1u3jUvibu098mu3LefUxF+1IQr9sk5ZdDX5HcLHHc5HyxWt8DZv92+7fEScBun2x+O8FWOWlY+AfeFt2Ug2Sx0o2hRqFipZQimrTg1EwU8UT+sdeM1lb6Bk88CTgKOYNM/EXK70P35KUrPNve4DezDJ0t95d1Xx7MoSIbYs2FI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709312579; c=relaxed/simple; bh=/qdWvtusvoG5pkLxxqc07SePTR8XmELOkvNg8Hp39Mg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tY1TO0Bvvf4eZEMDlcDYLLmIdfNVKT3AwgdqfqKGrpvdndU+ScfYPeL28e63WJ+vYp00p1U42AW+TZt2iKOtSkZ/7F0YPl7mGhmJ29yJNSdEBXHc/VgwjcoAN+ubNNGIJiRePRp7/fzUUTf8wE9N+RTGt3OB7U4KSFQpP0zgtVM= 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=gh7jdSsG; arc=none smtp.client-ip=209.85.166.182 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="gh7jdSsG" Received: by mail-il1-f182.google.com with SMTP id e9e14a558f8ab-3654ac0ead2so5961705ab.3 for ; Fri, 01 Mar 2024 09:02:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709312575; x=1709917375; 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=HSgSXfgxd1HBfN5s8xR+nxlbFslYXN/BhixB/5WxxqU=; b=gh7jdSsGYjXOuYFKoANHE0wsZskNVVbYqiFqpBMJy6rVbYkqlqeZ+EpIpkPn84s7jh BSP9rzgS5N4qFbllbYATDV1O95+RL7D68FUyQPzIZXbeWzgX7FyUTH92I0DvS+nybIfZ ObZCh7+Lg6lVlK17DcyNxnaFMObL4YlWP++xUcRxOomdsXGxDDj7djldHhO8FGtrxgov bQtqaAJd1kOtGutYuScCeIwWLKq7ShGx0Ws5f/iBLEW02wHZczQ6dYI/YmjNs8PiW2q3 7mrNZBdSwbGXHN4lNZMAUv2vvrvwnFWkEagseMHhRLD+UPuUY/7y+S6SjMKEQtljklXP fw1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709312575; x=1709917375; 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=HSgSXfgxd1HBfN5s8xR+nxlbFslYXN/BhixB/5WxxqU=; b=OI3wUNKwdzPxewjFlT2YtThn6HAkyL6lid67I7FZ64QxHW0K9rtUcSL0aMRO1v6U8G l5QSfHI/tN7mWqgipN2jxR6Yy7lWGMxFrT9bZWoAP0Xdbzy0B2UAIdxKXwu172Rnk2Iz IM8WYkoCf99oHPidfN2KN8f7M5HxB486VR+RgMOcz83UxbX8eJURBdNYqXNMSpeIHCG5 KZ2YhpwLz7hHl/yWLedq5r6So5VTougg0R2AiCwDb9YtTAxJKJ3JlWuTrH6Jh5VsBH2k Vv1SePlh+71oD881zBOg2eo6TOgKhG2nso81hMcgpcpbO/QsszszwLJWrrVCaRNTpuui /bdg== X-Forwarded-Encrypted: i=1; AJvYcCU2LJI35A92nzCSZ/y4Bu20QQD7Od8JwPvbkSNoQzLXzDWl/iZckImK4HxaXdS6n+sppZWPGpSKKCY3Wsm5593KnE52YYtEjqKR7EJM8A== X-Gm-Message-State: AOJu0YxnCUbGTReZ6W2bb/E9HONbJlgWvUZG5+eKkxRNBUDu6CrE0wUm kfhVkrT7f6tEYSfVtDAOLDggY77y2ENjpz9mbuo2Wj6FTexQJ6/M2B2RwmW2DVY= X-Google-Smtp-Source: AGHT+IHmakldIhnZdACh8Xb4eLoG//3+9m5Nq3xOh/kIo6weL9MH/PftUqX27mbS1GoJ+9Sp5GSylQ== X-Received: by 2002:a05:6e02:1c22:b0:365:44:1ed6 with SMTP id m2-20020a056e021c2200b0036500441ed6mr2643355ilh.5.1709312574873; Fri, 01 Mar 2024 09:02:54 -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.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 09:02:54 -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 7/7] net: ipa: don't save the platform device Date: Fri, 1 Mar 2024 11:02:42 -0600 Message-Id: <20240301170242.243703-8-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 The IPA platform device is now only used as the structure containing the IPA device structure. Replace the platform device pointer with a pointer to the device structure. Signed-off-by: Alex Elder --- 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 | 7 +++---- drivers/net/ipa/ipa_main.c | 13 ++++++++----- drivers/net/ipa/ipa_mem.c | 24 +++++++++++------------- 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_smp2p.c | 13 ++++++------- drivers/net/ipa/ipa_table.c | 18 ++++++++---------- drivers/net/ipa/ipa_uc.c | 9 ++++----- 12 files changed, 73 insertions(+), 79 deletions(-) diff --git a/drivers/net/ipa/ipa.h b/drivers/net/ipa/ipa.h index f3355e040a9e1..334cd62cf2866 100644 --- a/drivers/net/ipa/ipa.h +++ b/drivers/net/ipa/ipa.h @@ -21,7 +21,6 @@ struct clk; struct icc_path; struct net_device; -struct platform_device; struct ipa_power; struct ipa_smp2p; @@ -31,7 +30,7 @@ struct ipa_interrupt; * struct ipa - IPA information * @gsi: Embedded GSI structure * @version: IPA hardware version - * @pdev: Platform device + * @dev: IPA device pointer * @completion: Used to signal pipeline clear transfer complete * @nb: Notifier block used for remoteproc SSR * @notifier: Remoteproc SSR notifier @@ -79,7 +78,7 @@ struct ipa_interrupt; struct ipa { struct gsi gsi; enum ipa_version version; - struct platform_device *pdev; + struct device *dev; struct completion completion; struct notifier_block nb; void *notifier; diff --git a/drivers/net/ipa/ipa_cmd.c b/drivers/net/ipa/ipa_cmd.c index f1419fbd776c3..39219963dbb3f 100644 --- a/drivers/net/ipa/ipa_cmd.c +++ b/drivers/net/ipa/ipa_cmd.c @@ -174,7 +174,7 @@ bool ipa_cmd_table_init_valid(struct ipa *ipa, const struct ipa_mem *mem, u32 offset_max = field_max(IP_FLTRT_FLAGS_NHASH_ADDR_FMASK); u32 size_max = field_max(IP_FLTRT_FLAGS_NHASH_SIZE_FMASK); const char *table = route ? "route" : "filter"; - struct device *dev = &ipa->pdev->dev; + struct device *dev = ipa->dev; u32 size; size = route ? ipa->route_count : ipa->filter_count + 1; @@ -204,7 +204,7 @@ bool ipa_cmd_table_init_valid(struct ipa *ipa, const struct ipa_mem *mem, /* Validate the memory region that holds headers */ static bool ipa_cmd_header_init_local_valid(struct ipa *ipa) { - struct device *dev = &ipa->pdev->dev; + struct device *dev = ipa->dev; const struct ipa_mem *mem; u32 offset_max; u32 size_max; @@ -256,7 +256,7 @@ static bool ipa_cmd_register_write_offset_valid(struct ipa *ipa, const char *name, u32 offset) { struct ipa_cmd_register_write *payload; - struct device *dev = &ipa->pdev->dev; + struct device *dev = ipa->dev; u32 offset_max; u32 bit_count; diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index afa1d56d9095c..dd490941615e2 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -233,8 +233,8 @@ static bool ipa_endpoint_data_valid_one(struct ipa *ipa, u32 count, const struct ipa_gsi_endpoint_data *data) { const struct ipa_gsi_endpoint_data *other_data; - struct device *dev = &ipa->pdev->dev; enum ipa_endpoint_name other_name; + struct device *dev = ipa->dev; if (ipa_gsi_endpoint_data_empty(data)) return true; @@ -388,7 +388,7 @@ static u32 ipa_endpoint_max(struct ipa *ipa, u32 count, const struct ipa_gsi_endpoint_data *data) { const struct ipa_gsi_endpoint_data *dp = data; - struct device *dev = &ipa->pdev->dev; + struct device *dev = ipa->dev; enum ipa_endpoint_name name; u32 max; @@ -606,7 +606,7 @@ int ipa_endpoint_modem_exception_reset_all(struct ipa *ipa) count = ipa->modem_tx_count + ipa_cmd_pipeline_clear_count(); trans = ipa_cmd_trans_alloc(ipa, count); if (!trans) { - dev_err(&ipa->pdev->dev, + dev_err(ipa->dev, "no transaction to reset modem exception endpoints\n"); return -EBUSY; } @@ -1498,8 +1498,7 @@ ipa_endpoint_status_tag_valid(struct ipa_endpoint *endpoint, const void *data) if (endpoint_id == command_endpoint->endpoint_id) { complete(&ipa->completion); } else { - dev_err(&ipa->pdev->dev, - "unexpected tagged packet from endpoint %u\n", + dev_err(ipa->dev, "unexpected tagged packet from endpoint %u\n", endpoint_id); } @@ -1536,6 +1535,7 @@ static void ipa_endpoint_status_parse(struct ipa_endpoint *endpoint, void *data = page_address(page) + NET_SKB_PAD; u32 unused = buffer_size - total_len; struct ipa *ipa = endpoint->ipa; + struct device *dev = ipa->dev; u32 resid = total_len; while (resid) { @@ -1544,7 +1544,7 @@ static void ipa_endpoint_status_parse(struct ipa_endpoint *endpoint, u32 len; if (resid < IPA_STATUS_SIZE) { - dev_err(&endpoint->ipa->pdev->dev, + dev_err(dev, "short message (%u bytes < %zu byte status)\n", resid, IPA_STATUS_SIZE); break; @@ -1666,8 +1666,8 @@ void ipa_endpoint_default_route_clear(struct ipa *ipa) */ static int ipa_endpoint_reset_rx_aggr(struct ipa_endpoint *endpoint) { - struct device *dev = &endpoint->ipa->pdev->dev; struct ipa *ipa = endpoint->ipa; + struct device *dev = ipa->dev; struct gsi *gsi = &ipa->gsi; bool suspended = false; dma_addr_t addr; @@ -1769,7 +1769,7 @@ static void ipa_endpoint_reset(struct ipa_endpoint *endpoint) gsi_channel_reset(&ipa->gsi, channel_id, true); if (ret) - dev_err(&ipa->pdev->dev, + dev_err(ipa->dev, "error %d resetting channel %u for endpoint %u\n", ret, endpoint->channel_id, endpoint->endpoint_id); } @@ -1817,7 +1817,7 @@ int ipa_endpoint_enable_one(struct ipa_endpoint *endpoint) ret = gsi_channel_start(gsi, endpoint->channel_id); if (ret) { - dev_err(&ipa->pdev->dev, + dev_err(ipa->dev, "error %d starting %cX channel %u for endpoint %u\n", ret, endpoint->toward_ipa ? 'T' : 'R', endpoint->channel_id, endpoint_id); @@ -1854,14 +1854,13 @@ void ipa_endpoint_disable_one(struct ipa_endpoint *endpoint) /* Note that if stop fails, the channel's state is not well-defined */ ret = gsi_channel_stop(gsi, endpoint->channel_id); if (ret) - dev_err(&ipa->pdev->dev, - "error %d attempting to stop endpoint %u\n", ret, - endpoint_id); + dev_err(ipa->dev, "error %d attempting to stop endpoint %u\n", + ret, endpoint_id); } void ipa_endpoint_suspend_one(struct ipa_endpoint *endpoint) { - struct device *dev = &endpoint->ipa->pdev->dev; + struct device *dev = endpoint->ipa->dev; struct gsi *gsi = &endpoint->ipa->gsi; int ret; @@ -1881,7 +1880,7 @@ void ipa_endpoint_suspend_one(struct ipa_endpoint *endpoint) void ipa_endpoint_resume_one(struct ipa_endpoint *endpoint) { - struct device *dev = &endpoint->ipa->pdev->dev; + struct device *dev = endpoint->ipa->dev; struct gsi *gsi = &endpoint->ipa->gsi; int ret; @@ -1983,7 +1982,7 @@ void ipa_endpoint_deconfig(struct ipa *ipa) int ipa_endpoint_config(struct ipa *ipa) { - struct device *dev = &ipa->pdev->dev; + struct device *dev = ipa->dev; const struct reg *reg; u32 endpoint_id; u32 hw_limit; diff --git a/drivers/net/ipa/ipa_interrupt.c b/drivers/net/ipa/ipa_interrupt.c index 7399724160a89..c3e8784d51d91 100644 --- a/drivers/net/ipa/ipa_interrupt.c +++ b/drivers/net/ipa/ipa_interrupt.c @@ -110,14 +110,13 @@ static irqreturn_t ipa_isr_thread(int irq, void *dev_id) struct ipa_interrupt *interrupt = dev_id; struct ipa *ipa = interrupt->ipa; u32 enabled = interrupt->enabled; + struct device *dev = ipa->dev; const struct reg *reg; - struct device *dev; u32 pending; u32 offset; u32 mask; int ret; - dev = &ipa->pdev->dev; ret = pm_runtime_get_sync(dev); if (WARN_ON(ret < 0)) goto out_power_put; @@ -240,8 +239,8 @@ void ipa_interrupt_simulate_suspend(struct ipa_interrupt *interrupt) int ipa_interrupt_config(struct ipa *ipa) { struct ipa_interrupt *interrupt = ipa->interrupt; - struct device *dev = &ipa->pdev->dev; unsigned int irq = interrupt->irq; + struct device *dev = ipa->dev; const struct reg *reg; int ret; @@ -281,7 +280,7 @@ int ipa_interrupt_config(struct ipa *ipa) void ipa_interrupt_deconfig(struct ipa *ipa) { struct ipa_interrupt *interrupt = ipa->interrupt; - struct device *dev = &ipa->pdev->dev; + struct device *dev = ipa->dev; ipa->interrupt = NULL; diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 3125aec88e6e1..57b241417e8cd 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -114,7 +113,7 @@ int ipa_setup(struct ipa *ipa) { struct ipa_endpoint *exception_endpoint; struct ipa_endpoint *command_endpoint; - struct device *dev = &ipa->pdev->dev; + struct device *dev = ipa->dev; int ret; ret = gsi_setup(&ipa->gsi); @@ -858,7 +857,7 @@ static int ipa_probe(struct platform_device *pdev) goto err_power_exit; } - ipa->pdev = pdev; + ipa->dev = dev; dev_set_drvdata(dev, ipa); ipa->interrupt = interrupt; ipa->power = power; @@ -953,12 +952,16 @@ 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 device *dev = &pdev->dev; struct ipa_interrupt *interrupt; struct ipa_power *power; + struct device *dev; + struct ipa *ipa; int ret; + ipa = dev_get_drvdata(&pdev->dev); + dev = ipa->dev; + WARN_ON(dev != &pdev->dev); + power = ipa->power; interrupt = ipa->interrupt; diff --git a/drivers/net/ipa/ipa_mem.c b/drivers/net/ipa/ipa_mem.c index d7df7d340221d..709f061ede617 100644 --- a/drivers/net/ipa/ipa_mem.c +++ b/drivers/net/ipa/ipa_mem.c @@ -88,7 +88,7 @@ int ipa_mem_setup(struct ipa *ipa) */ trans = ipa_cmd_trans_alloc(ipa, 4); if (!trans) { - dev_err(&ipa->pdev->dev, "no transaction for memory setup\n"); + dev_err(ipa->dev, "no transaction for memory setup\n"); return -EBUSY; } @@ -218,8 +218,8 @@ static bool ipa_mem_id_required(struct ipa *ipa, enum ipa_mem_id mem_id) static bool ipa_mem_valid_one(struct ipa *ipa, const struct ipa_mem *mem) { - struct device *dev = &ipa->pdev->dev; enum ipa_mem_id mem_id = mem->id; + struct device *dev = ipa->dev; u16 size_multiple; /* Make sure the memory region is valid for this version of IPA */ @@ -255,7 +255,7 @@ static bool ipa_mem_valid_one(struct ipa *ipa, const struct ipa_mem *mem) static bool ipa_mem_valid(struct ipa *ipa, const struct ipa_mem_data *mem_data) { DECLARE_BITMAP(regions, IPA_MEM_COUNT) = { }; - struct device *dev = &ipa->pdev->dev; + struct device *dev = ipa->dev; enum ipa_mem_id mem_id; u32 i; @@ -291,7 +291,7 @@ static bool ipa_mem_valid(struct ipa *ipa, const struct ipa_mem_data *mem_data) /* Do all memory regions fit within the IPA local memory? */ static bool ipa_mem_size_valid(struct ipa *ipa) { - struct device *dev = &ipa->pdev->dev; + struct device *dev = ipa->dev; u32 limit = ipa->mem_size; u32 i; @@ -318,7 +318,7 @@ static bool ipa_mem_size_valid(struct ipa *ipa) */ int ipa_mem_config(struct ipa *ipa) { - struct device *dev = &ipa->pdev->dev; + struct device *dev = ipa->dev; const struct ipa_mem *mem; const struct reg *reg; dma_addr_t addr; @@ -394,7 +394,7 @@ int ipa_mem_config(struct ipa *ipa) /* Inverse of ipa_mem_config() */ void ipa_mem_deconfig(struct ipa *ipa) { - struct device *dev = &ipa->pdev->dev; + struct device *dev = ipa->dev; dma_free_coherent(dev, ipa->zero_size, ipa->zero_virt, ipa->zero_addr); ipa->zero_size = 0; @@ -421,8 +421,7 @@ int ipa_mem_zero_modem(struct ipa *ipa) */ trans = ipa_cmd_trans_alloc(ipa, 3); if (!trans) { - dev_err(&ipa->pdev->dev, - "no transaction to zero modem memory\n"); + dev_err(ipa->dev, "no transaction to zero modem memory\n"); return -EBUSY; } @@ -453,7 +452,7 @@ int ipa_mem_zero_modem(struct ipa *ipa) */ static int ipa_imem_init(struct ipa *ipa, unsigned long addr, size_t size) { - struct device *dev = &ipa->pdev->dev; + struct device *dev = ipa->dev; struct iommu_domain *domain; unsigned long iova; phys_addr_t phys; @@ -486,13 +485,12 @@ static int ipa_imem_init(struct ipa *ipa, unsigned long addr, size_t size) static void ipa_imem_exit(struct ipa *ipa) { + struct device *dev = ipa->dev; struct iommu_domain *domain; - struct device *dev; if (!ipa->imem_size) return; - dev = &ipa->pdev->dev; domain = iommu_get_domain_for_dev(dev); if (domain) { size_t size; @@ -528,7 +526,7 @@ static void ipa_imem_exit(struct ipa *ipa) */ static int ipa_smem_init(struct ipa *ipa, u32 item, size_t size) { - struct device *dev = &ipa->pdev->dev; + struct device *dev = ipa->dev; struct iommu_domain *domain; unsigned long iova; phys_addr_t phys; @@ -595,7 +593,7 @@ static int ipa_smem_init(struct ipa *ipa, u32 item, size_t size) static void ipa_smem_exit(struct ipa *ipa) { - struct device *dev = &ipa->pdev->dev; + struct device *dev = ipa->dev; struct iommu_domain *domain; domain = iommu_get_domain_for_dev(dev); diff --git a/drivers/net/ipa/ipa_modem.c b/drivers/net/ipa/ipa_modem.c index 1d1be92fbebcb..c27ca3f27f7d4 100644 --- a/drivers/net/ipa/ipa_modem.c +++ b/drivers/net/ipa/ipa_modem.c @@ -58,7 +58,7 @@ static int ipa_open(struct net_device *netdev) struct device *dev; int ret; - dev = &ipa->pdev->dev; + dev = ipa->dev; ret = pm_runtime_get_sync(dev); if (ret < 0) goto err_power_put; @@ -94,7 +94,7 @@ static int ipa_stop(struct net_device *netdev) struct device *dev; int ret; - dev = &ipa->pdev->dev; + dev = ipa->dev; ret = pm_runtime_get_sync(dev); if (ret < 0) goto out_power_put; @@ -158,7 +158,7 @@ ipa_start_xmit(struct sk_buff *skb, struct net_device *netdev) */ netif_stop_queue(netdev); - dev = &ipa->pdev->dev; + dev = ipa->dev; ret = pm_runtime_get(dev); if (ret < 1) { /* If a resume won't happen, just drop the packet */ @@ -322,7 +322,7 @@ int ipa_modem_start(struct ipa *ipa) goto out_set_state; } - SET_NETDEV_DEV(netdev, &ipa->pdev->dev); + SET_NETDEV_DEV(netdev, ipa->dev); priv = netdev_priv(netdev); priv->ipa = ipa; priv->tx = ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]; @@ -396,7 +396,7 @@ int ipa_modem_stop(struct ipa *ipa) /* Treat a "clean" modem stop the same as a crash */ static void ipa_modem_crashed(struct ipa *ipa) { - struct device *dev = &ipa->pdev->dev; + struct device *dev = ipa->dev; int ret; /* Prevent the modem from triggering a call to ipa_setup() */ @@ -443,7 +443,7 @@ static int ipa_modem_notify(struct notifier_block *nb, unsigned long action, { struct ipa *ipa = container_of(nb, struct ipa, nb); struct qcom_ssr_notify_data *notify_data = data; - struct device *dev = &ipa->pdev->dev; + struct device *dev = ipa->dev; switch (action) { case QCOM_SSR_BEFORE_POWERUP: @@ -492,7 +492,7 @@ int ipa_modem_config(struct ipa *ipa) void ipa_modem_deconfig(struct ipa *ipa) { - struct device *dev = &ipa->pdev->dev; + struct device *dev = ipa->dev; int ret; ret = qcom_unregister_ssr_notifier(ipa->notifier, &ipa->nb); diff --git a/drivers/net/ipa/ipa_power.c b/drivers/net/ipa/ipa_power.c index 0f635b8356bfb..41ca7ef5e20fc 100644 --- a/drivers/net/ipa/ipa_power.c +++ b/drivers/net/ipa/ipa_power.c @@ -238,7 +238,7 @@ int ipa_power_setup(struct ipa *ipa) ipa_interrupt_enable(ipa, IPA_IRQ_TX_SUSPEND); - ret = device_init_wakeup(&ipa->pdev->dev, true); + ret = device_init_wakeup(ipa->dev, true); if (ret) ipa_interrupt_disable(ipa, IPA_IRQ_TX_SUSPEND); @@ -247,7 +247,7 @@ int ipa_power_setup(struct ipa *ipa) void ipa_power_teardown(struct ipa *ipa) { - (void)device_init_wakeup(&ipa->pdev->dev, false); + (void)device_init_wakeup(ipa->dev, false); ipa_interrupt_disable(ipa, IPA_IRQ_TX_SUSPEND); } diff --git a/drivers/net/ipa/ipa_qmi.c b/drivers/net/ipa/ipa_qmi.c index f70f0a1d1cdac..65c40e207802a 100644 --- a/drivers/net/ipa/ipa_qmi.c +++ b/drivers/net/ipa/ipa_qmi.c @@ -96,7 +96,7 @@ static void ipa_server_init_complete(struct ipa_qmi *ipa_qmi) IPA_QMI_INIT_COMPLETE_IND_SZ, ipa_init_complete_ind_ei, &ind); if (ret) - dev_err(&ipa->pdev->dev, + dev_err(ipa->dev, "error %d sending init complete indication\n", ret); else ipa_qmi->indication_sent = true; @@ -148,7 +148,7 @@ static void ipa_qmi_ready(struct ipa_qmi *ipa_qmi) ipa = container_of(ipa_qmi, struct ipa, qmi); ret = ipa_modem_start(ipa); if (ret) - dev_err(&ipa->pdev->dev, "error %d starting modem\n", ret); + dev_err(ipa->dev, "error %d starting modem\n", ret); } /* All QMI clients from the modem node are gone (modem shut down or crashed). */ @@ -199,7 +199,7 @@ static void ipa_server_indication_register(struct qmi_handle *qmi, ipa_qmi->indication_requested = true; ipa_qmi_ready(ipa_qmi); /* We might be ready now */ } else { - dev_err(&ipa->pdev->dev, + dev_err(ipa->dev, "error %d sending register indication response\n", ret); } } @@ -228,7 +228,7 @@ static void ipa_server_driver_init_complete(struct qmi_handle *qmi, ipa_qmi->uc_ready = true; ipa_qmi_ready(ipa_qmi); /* We might be ready now */ } else { - dev_err(&ipa->pdev->dev, + dev_err(ipa->dev, "error %d sending init complete response\n", ret); } } @@ -417,7 +417,7 @@ static void ipa_client_init_driver_work(struct work_struct *work) qmi = &ipa_qmi->client_handle; ipa = container_of(ipa_qmi, struct ipa, qmi); - dev = &ipa->pdev->dev; + dev = ipa->dev; ret = qmi_txn_init(qmi, &txn, NULL, NULL); if (ret < 0) { diff --git a/drivers/net/ipa/ipa_smp2p.c b/drivers/net/ipa/ipa_smp2p.c index 831268551d9a7..aeccce9fab727 100644 --- a/drivers/net/ipa/ipa_smp2p.c +++ b/drivers/net/ipa/ipa_smp2p.c @@ -84,15 +84,13 @@ struct ipa_smp2p { */ static void ipa_smp2p_notify(struct ipa_smp2p *smp2p) { - struct device *dev; u32 value; u32 mask; if (smp2p->notified) return; - dev = &smp2p->ipa->pdev->dev; - smp2p->power_on = pm_runtime_get_if_active(dev, true) > 0; + smp2p->power_on = pm_runtime_get_if_active(smp2p->ipa->dev, true) > 0; /* Signal whether the IPA power is enabled */ mask = BIT(smp2p->enabled_bit); @@ -152,15 +150,16 @@ static void ipa_smp2p_panic_notifier_unregister(struct ipa_smp2p *smp2p) static irqreturn_t ipa_smp2p_modem_setup_ready_isr(int irq, void *dev_id) { struct ipa_smp2p *smp2p = dev_id; + struct ipa *ipa = smp2p->ipa; struct device *dev; int ret; /* Ignore any (spurious) interrupts received after the first */ - if (smp2p->ipa->setup_complete) + if (ipa->setup_complete) return IRQ_HANDLED; /* Power needs to be active for setup */ - dev = &smp2p->ipa->pdev->dev; + dev = ipa->dev; ret = pm_runtime_get_sync(dev); if (ret < 0) { dev_err(dev, "error %d getting power for setup\n", ret); @@ -168,7 +167,7 @@ static irqreturn_t ipa_smp2p_modem_setup_ready_isr(int irq, void *dev_id) } /* An error here won't cause driver shutdown, so warn if one occurs */ - ret = ipa_setup(smp2p->ipa); + ret = ipa_setup(ipa); WARN(ret != 0, "error %d from ipa_setup()\n", ret); out_power_put: @@ -209,7 +208,7 @@ static void ipa_smp2p_irq_exit(struct ipa_smp2p *smp2p, u32 irq) /* Drop the power reference if it was taken in ipa_smp2p_notify() */ static void ipa_smp2p_power_release(struct ipa *ipa) { - struct device *dev = &ipa->pdev->dev; + struct device *dev = ipa->dev; if (!ipa->smp2p->power_on) return; diff --git a/drivers/net/ipa/ipa_table.c b/drivers/net/ipa/ipa_table.c index 7b637bb8b41c8..a24ac11b8893d 100644 --- a/drivers/net/ipa/ipa_table.c +++ b/drivers/net/ipa/ipa_table.c @@ -163,7 +163,7 @@ ipa_table_mem(struct ipa *ipa, bool filter, bool hashed, bool ipv6) bool ipa_filtered_valid(struct ipa *ipa, u64 filtered) { - struct device *dev = &ipa->pdev->dev; + struct device *dev = ipa->dev; u32 count; if (!filtered) { @@ -236,8 +236,7 @@ ipa_filter_reset_table(struct ipa *ipa, bool hashed, bool ipv6, bool modem) trans = ipa_cmd_trans_alloc(ipa, hweight64(ep_mask)); if (!trans) { - dev_err(&ipa->pdev->dev, - "no transaction for %s filter reset\n", + dev_err(ipa->dev, "no transaction for %s filter reset\n", modem ? "modem" : "AP"); return -EBUSY; } @@ -298,8 +297,7 @@ static int ipa_route_reset(struct ipa *ipa, bool modem) trans = ipa_cmd_trans_alloc(ipa, hash_support ? 4 : 2); if (!trans) { - dev_err(&ipa->pdev->dev, - "no transaction for %s route reset\n", + dev_err(ipa->dev, "no transaction for %s route reset\n", modem ? "modem" : "AP"); return -EBUSY; } @@ -327,7 +325,7 @@ static int ipa_route_reset(struct ipa *ipa, bool modem) void ipa_table_reset(struct ipa *ipa, bool modem) { - struct device *dev = &ipa->pdev->dev; + struct device *dev = ipa->dev; const char *ee_name; int ret; @@ -356,7 +354,7 @@ int ipa_table_hash_flush(struct ipa *ipa) trans = ipa_cmd_trans_alloc(ipa, 1); if (!trans) { - dev_err(&ipa->pdev->dev, "no transaction for hash flush\n"); + dev_err(ipa->dev, "no transaction for hash flush\n"); return -EBUSY; } @@ -469,7 +467,7 @@ int ipa_table_setup(struct ipa *ipa) */ trans = ipa_cmd_trans_alloc(ipa, 8); if (!trans) { - dev_err(&ipa->pdev->dev, "no transaction for table setup\n"); + dev_err(ipa->dev, "no transaction for table setup\n"); return -EBUSY; } @@ -713,7 +711,7 @@ bool ipa_table_mem_valid(struct ipa *ipa, bool filter) */ int ipa_table_init(struct ipa *ipa) { - struct device *dev = &ipa->pdev->dev; + struct device *dev = ipa->dev; dma_addr_t addr; __le64 le_addr; __le64 *virt; @@ -763,7 +761,7 @@ int ipa_table_init(struct ipa *ipa) void ipa_table_exit(struct ipa *ipa) { u32 count = max_t(u32, 1 + ipa->filter_count, ipa->route_count); - struct device *dev = &ipa->pdev->dev; + struct device *dev = ipa->dev; size_t size; size = IPA_ZERO_RULE_SIZE + (1 + count) * sizeof(__le64); diff --git a/drivers/net/ipa/ipa_uc.c b/drivers/net/ipa/ipa_uc.c index 7eaa0b4ebed92..bfd5dc6dab432 100644 --- a/drivers/net/ipa/ipa_uc.c +++ b/drivers/net/ipa/ipa_uc.c @@ -127,7 +127,7 @@ static struct ipa_uc_mem_area *ipa_uc_shared(struct ipa *ipa) static void ipa_uc_event_handler(struct ipa *ipa) { struct ipa_uc_mem_area *shared = ipa_uc_shared(ipa); - struct device *dev = &ipa->pdev->dev; + struct device *dev = ipa->dev; if (shared->event == IPA_UC_EVENT_ERROR) dev_err(dev, "microcontroller error event\n"); @@ -141,7 +141,7 @@ static void ipa_uc_event_handler(struct ipa *ipa) static void ipa_uc_response_hdlr(struct ipa *ipa) { struct ipa_uc_mem_area *shared = ipa_uc_shared(ipa); - struct device *dev = &ipa->pdev->dev; + struct device *dev = ipa->dev; /* An INIT_COMPLETED response message is sent to the AP by the * microcontroller when it is operational. Other than this, the AP @@ -191,7 +191,7 @@ void ipa_uc_config(struct ipa *ipa) /* Inverse of ipa_uc_config() */ void ipa_uc_deconfig(struct ipa *ipa) { - struct device *dev = &ipa->pdev->dev; + struct device *dev = ipa->dev; ipa_interrupt_disable(ipa, IPA_IRQ_UC_1); ipa_interrupt_disable(ipa, IPA_IRQ_UC_0); @@ -208,8 +208,8 @@ void ipa_uc_deconfig(struct ipa *ipa) /* Take a proxy power reference for the microcontroller */ void ipa_uc_power(struct ipa *ipa) { + struct device *dev = ipa->dev; static bool already; - struct device *dev; int ret; if (already) @@ -217,7 +217,6 @@ void ipa_uc_power(struct ipa *ipa) already = true; /* Only do this on first boot */ /* This power reference dropped in ipa_uc_response_hdlr() above */ - dev = &ipa->pdev->dev; ret = pm_runtime_get_sync(dev); if (ret < 0) { pm_runtime_put_noidle(dev);