netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Xin Tian <tianx@yunsilicon.com>
Cc: netdev@vger.kernel.org, leon@kernel.org, andrew+netdev@lunn.ch,
	kuba@kernel.org, pabeni@redhat.com, edumazet@google.com,
	davem@davemloft.net, jeff.johnson@oss.qualcomm.com,
	przemyslaw.kitszel@intel.com, weihg@yunsilicon.com,
	wanry@yunsilicon.com
Subject: Re: [PATCH v3 01/14] net-next/yunsilicon: Add xsc driver basic framework
Date: Wed, 15 Jan 2025 15:54:52 +0000	[thread overview]
Message-ID: <20250115155452.GP5497@kernel.org> (raw)
In-Reply-To: <20250115102242.3541496-2-tianx@yunsilicon.com>

On Wed, Jan 15, 2025 at 06:22:44PM +0800, Xin Tian wrote:
> Add yunsilicon xsc driver basic framework, including xsc_pci driver
> and xsc_eth driver
> 
> Co-developed-by: Honggang Wei <weihg@yunsilicon.com>
> Signed-off-by: Honggang Wei <weihg@yunsilicon.com>
> Co-developed-by: Lei Yan <jacky@yunsilicon.com>
> Signed-off-by: Lei Yan <jacky@yunsilicon.com>
> Signed-off-by: Xin Tian <tianx@yunsilicon.com>

...

> diff --git a/drivers/net/ethernet/yunsilicon/xsc/common/xsc_core.h b/drivers/net/ethernet/yunsilicon/xsc/common/xsc_core.h

...

> +struct xsc_dev_resource {
> +	struct mutex alloc_mutex;	/* protect buffer alocation according to numa node */

nit: allocation

...

> diff --git a/drivers/net/ethernet/yunsilicon/xsc/pci/main.c b/drivers/net/ethernet/yunsilicon/xsc/pci/main.c

...

> +static int xsc_pci_init(struct xsc_core_device *xdev, const struct pci_device_id *id)
> +{
> +	struct pci_dev *pdev = xdev->pdev;
> +	void __iomem *bar_base;
> +	int bar_num = 0;
> +	int err;
> +
> +	xdev->numa_node = dev_to_node(&pdev->dev);
> +
> +	err = xsc_pci_enable_device(xdev);
> +	if (err) {
> +		pci_err(pdev, "failed to enable PCI device: err=%d\n", err);
> +		goto err_ret;
> +	}
> +
> +	err = pci_request_region(pdev, bar_num, KBUILD_MODNAME);
> +	if (err) {
> +		pci_err(pdev, "failed to request %s pci_region=%d: err=%d\n",
> +			KBUILD_MODNAME, bar_num, err);
> +		goto err_disable;
> +	}
> +
> +	pci_set_master(pdev);
> +
> +	err = set_dma_caps(pdev);
> +	if (err) {
> +		pci_err(pdev, "failed to set DMA capabilities mask: err=%d\n", err);
> +		goto err_clr_master;
> +	}
> +
> +	bar_base = pci_ioremap_bar(pdev, bar_num);
> +	if (!bar_base) {
> +		pci_err(pdev, "failed to ioremap %s bar%d\n", KBUILD_MODNAME, bar_num);

Should err, which will be the return value of the function,
be set to a negative error value here? As is, the function will
return 0.

> +		goto err_clr_master;
> +	}
> +
> +	err = pci_save_state(pdev);
> +	if (err) {
> +		pci_err(pdev, "pci_save_state failed: err=%d\n", err);
> +		goto err_io_unmap;
> +	}
> +
> +	xdev->bar_num = bar_num;
> +	xdev->bar = bar_base;
> +
> +	return 0;
> +
> +err_io_unmap:
> +	pci_iounmap(pdev, bar_base);
> +err_clr_master:
> +	pci_clear_master(pdev);
> +	pci_release_region(pdev, bar_num);
> +err_disable:
> +	xsc_pci_disable_device(xdev);
> +err_ret:
> +	return err;
> +}

...

  reply	other threads:[~2025-01-15 15:54 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-15 10:23 [PATCH v3 00/14] net-next/yunsilicon: ADD Yunsilicon XSC Ethernet Driver Xin Tian
2025-01-15 10:22 ` [PATCH v3 01/14] net-next/yunsilicon: Add xsc driver basic framework Xin Tian
2025-01-15 15:54   ` Simon Horman [this message]
2025-01-16  7:03     ` tianx
2025-01-15 16:04   ` Simon Horman
2025-01-16  8:04     ` tianx
2025-01-16 10:53       ` Simon Horman
2025-01-15 10:22 ` [PATCH v3 02/14] net-next/yunsilicon: Enable CMDQ Xin Tian
2025-01-16 10:30   ` Przemek Kitszel
2025-02-13  2:09     ` tianx
2025-01-16 13:55   ` Simon Horman
2025-01-17  3:42     ` tianx
2025-01-17 13:33       ` Simon Horman
2025-01-15 10:22 ` [PATCH v3 03/14] net-next/yunsilicon: Add hardware setup APIs Xin Tian
2025-01-15 10:22 ` [PATCH v3 04/14] net-next/yunsilicon: Add qp and cq management Xin Tian
2025-01-17 13:45   ` Simon Horman
2025-01-15 10:22 ` [PATCH v3 05/14] net-next/yunsilicon: Add eq and alloc Xin Tian
2025-01-15 10:22 ` [PATCH v3 06/14] net-next/yunsilicon: Add pci irq Xin Tian
2025-01-15 10:22 ` [PATCH v3 07/14] net-next/yunsilicon: Init auxiliary device Xin Tian
2025-01-15 10:23 ` [PATCH v3 08/14] net-next/yunsilicon: Add ethernet interface Xin Tian
2025-01-15 10:23 ` [PATCH v3 09/14] net-next/yunsilicon: Init net device Xin Tian
2025-01-15 10:23 ` [PATCH v3 10/14] net-next/yunsilicon: Add eth needed qp and cq apis Xin Tian
2025-01-15 10:23 ` [PATCH v3 11/14] net-next/yunsilicon: ndo_open and ndo_stop Xin Tian
2025-01-15 10:23 ` [PATCH v3 12/14] net-next/yunsilicon: Add ndo_start_xmit Xin Tian
2025-01-15 10:23 ` [PATCH v3 13/14] net-next/yunsilicon: Add eth rx Xin Tian
2025-01-15 10:23 ` [PATCH v3 14/14] net-next/yunsilicon: add ndo_get_stats64 Xin Tian

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=20250115155452.GP5497@kernel.org \
    --to=horms@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jeff.johnson@oss.qualcomm.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=tianx@yunsilicon.com \
    --cc=wanry@yunsilicon.com \
    --cc=weihg@yunsilicon.com \
    /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;
as well as URLs for NNTP newsgroup(s).