From: Philipp Stanner <pstanner@redhat.com>
To: Philipp Stanner <phasta@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Huacai Chen <chenhuacai@kernel.org>,
Yanteng Si <si.yanteng@linux.dev>,
Yinggang Gu <guyinggang@loongson.cn>,
Feiyang Chen <chenfeiyang@loongson.cn>,
Jiaxun Yang <jiaxun.yang@flygoat.com>,
Qing Zhang <zhangqing@loongson.cn>
Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v3 4/4] stmmac: Replace deprecated PCI functions
Date: Tue, 25 Feb 2025 08:16:18 +0100 [thread overview]
Message-ID: <f1c3e538e19aca7fd46dd7f10da190d691bace83.camel@redhat.com> (raw)
In-Reply-To: <20250224135321.36603-6-phasta@kernel.org>
On Mon, 2025-02-24 at 14:53 +0100, Philipp Stanner wrote:
> From: Philipp Stanner <pstanner@redhat.com>
>
> The PCI functions
> - pcim_iomap_regions() and
> - pcim_iomap_table()
> have been deprecated.
>
> Replace them with their successor function, pcim_iomap_region().
>
> Make variable declaration order at closeby places comply with reverse
> christmas tree order.
>
> Signed-off-by: Philipp Stanner <pstanner@redhat.com>
> ---
> .../net/ethernet/stmicro/stmmac/dwmac-loongson.c | 11 ++++-------
> drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 14 ++++++------
> --
> 2 files changed, 10 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> index f3ea6016be68..25ef7b9c5dce 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> @@ -521,10 +521,10 @@ static int loongson_dwmac_acpi_config(struct
> pci_dev *pdev,
> static int loongson_dwmac_probe(struct pci_dev *pdev, const struct
> pci_device_id *id)
> {
> struct plat_stmmacenet_data *plat;
> + struct stmmac_resources res = {};
> struct stmmac_pci_info *info;
> - struct stmmac_resources res;
> struct loongson_data *ld;
> - int ret, i;
> + int ret;
>
> plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
> if (!plat)
> @@ -554,13 +554,11 @@ static int loongson_dwmac_probe(struct pci_dev
> *pdev, const struct pci_device_id
> pci_set_master(pdev);
>
> /* Get the base address of device */
> - ret = pcim_iomap_regions(pdev, BIT(0), DRIVER_NAME);
> + res.addr = pcim_iomap_region(pdev, 0, DRIVER_NAME);
> + ret = PTR_ERR_OR_ZERO(res.addr);
> if (ret)
> goto err_disable_device;
>
> - memset(&res, 0, sizeof(res));
> - res.addr = pcim_iomap_table(pdev)[0];
> -
> plat->bsp_priv = ld;
> plat->setup = loongson_dwmac_setup;
> ld->dev = &pdev->dev;
> @@ -603,7 +601,6 @@ static void loongson_dwmac_remove(struct pci_dev
> *pdev)
> struct net_device *ndev = dev_get_drvdata(&pdev->dev);
> struct stmmac_priv *priv = netdev_priv(ndev);
> struct loongson_data *ld;
> - int i;
Just saw that this is a left-over that actually should be in patch 3.
Will fix.
P.
>
> ld = priv->plat->bsp_priv;
> stmmac_dvr_remove(&pdev->dev);
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
> b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
> index 91ff6c15f977..37fc7f55a7e4 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
> @@ -155,9 +155,9 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
> {
> struct stmmac_pci_info *info = (struct stmmac_pci_info *)id-
> >driver_data;
> struct plat_stmmacenet_data *plat;
> - struct stmmac_resources res;
> - int i;
> + struct stmmac_resources res = {};
> int ret;
> + int i;
>
> plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
> if (!plat)
> @@ -188,13 +188,13 @@ static int stmmac_pci_probe(struct pci_dev
> *pdev,
> return ret;
> }
>
> - /* Get the base address of device */
> + /* The first BAR > 0 is the base IO addr of our device. */
> for (i = 0; i < PCI_STD_NUM_BARS; i++) {
> if (pci_resource_len(pdev, i) == 0)
> continue;
> - ret = pcim_iomap_regions(pdev, BIT(i),
> pci_name(pdev));
> - if (ret)
> - return ret;
> + res.addr = pcim_iomap_region(pdev, i,
> STMMAC_RESOURCE_NAME);
> + if (IS_ERR(res.addr))
> + return PTR_ERR(res.addr);
> break;
> }
>
> @@ -204,8 +204,6 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
> if (ret)
> return ret;
>
> - memset(&res, 0, sizeof(res));
> - res.addr = pcim_iomap_table(pdev)[i];
> res.wol_irq = pdev->irq;
> res.irq = pdev->irq;
>
next prev parent reply other threads:[~2025-02-25 7:16 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-24 13:53 [PATCH net-next v3 0/4] stmmac: Several PCI-related improvements Philipp Stanner
2025-02-24 13:53 ` [PATCH net-next v3 1/4] stmmac: loongson: Pass correct arg to PCI function Philipp Stanner
2025-02-24 19:55 ` Andrew Lunn
2025-02-25 9:00 ` Yanteng Si
2025-02-24 13:53 ` [PATCH net-next v3 2/4] stmmac: loongson: Remove surplus loop Philipp Stanner
2025-02-24 19:55 ` Andrew Lunn
2025-02-25 9:06 ` Yanteng Si
2025-02-25 9:15 ` Philipp Stanner
2025-02-26 1:57 ` Yanteng Si
2025-02-25 9:29 ` Huacai Chen
2025-02-24 13:53 ` [PATCH net-next v3 3/4] stmmac: Remove pcim_* functions for driver detach Philipp Stanner
2025-02-24 19:56 ` Andrew Lunn
2025-02-25 9:10 ` Yanteng Si
2025-02-25 9:19 ` Huacai Chen
2025-02-24 13:53 ` [PATCH net-next v3 4/4] stmmac: Replace deprecated PCI functions Philipp Stanner
2025-02-24 19:57 ` Andrew Lunn
2025-02-25 7:16 ` Philipp Stanner [this message]
2025-02-25 9:14 ` Yanteng Si
2025-02-25 9:30 ` Huacai Chen
2025-02-25 8:42 ` [PATCH net-next v3 0/4] stmmac: Several PCI-related improvements Henry Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f1c3e538e19aca7fd46dd7f10da190d691bace83.camel@redhat.com \
--to=pstanner@redhat.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=chenfeiyang@loongson.cn \
--cc=chenhuacai@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=guyinggang@loongson.cn \
--cc=jiaxun.yang@flygoat.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=phasta@kernel.org \
--cc=si.yanteng@linux.dev \
--cc=zhangqing@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®