From: "Simon Sandström" <simon@nikanor.nu>
To: gregkh@linuxfoundation.org
Cc: dan.carpenter@oracle.com, jeremy@azazel.net,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
"Simon Sandström" <simon@nikanor.nu>
Subject: [PATCH 2/2] staging: kpc2000: remove unnecessary comments in kp2000_pcie_probe
Date: Mon, 10 Jun 2019 22:05:35 +0200 [thread overview]
Message-ID: <20190610200535.31820-3-simon@nikanor.nu> (raw)
In-Reply-To: <20190610200535.31820-1-simon@nikanor.nu>
Much of the code comments in kp2000_pcie_probe just repeats the code and
does not add any additional information. Delete them and make sure that
comments still left in the function all use the same style.
Signed-off-by: Simon Sandström <simon@nikanor.nu>
---
drivers/staging/kpc2000/kpc2000/core.c | 38 ++++----------------------
1 file changed, 5 insertions(+), 33 deletions(-)
diff --git a/drivers/staging/kpc2000/kpc2000/core.c b/drivers/staging/kpc2000/kpc2000/core.c
index ee6b9be7127d..7ec54b672c20 100644
--- a/drivers/staging/kpc2000/kpc2000/core.c
+++ b/drivers/staging/kpc2000/kpc2000/core.c
@@ -311,18 +311,12 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
unsigned long dma_bar_phys_len;
u16 regval;
- /*
- * Step 1: Allocate a struct for the pcard
- */
pcard = kzalloc(sizeof(*pcard), GFP_KERNEL);
if (!pcard)
return -ENOMEM;
dev_dbg(&pdev->dev, "probe: allocated struct kp2000_device @ %p\n",
pcard);
- /*
- * Step 2: Initialize trivial pcard elements
- */
err = ida_simple_get(&card_num_ida, 1, INT_MAX, GFP_KERNEL);
if (err < 0) {
dev_err(&pdev->dev, "probe: failed to get card number (%d)\n",
@@ -338,9 +332,6 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
pcard->pdev = pdev;
pci_set_drvdata(pdev, pcard);
- /*
- * Step 3: Enable PCI device
- */
err = pci_enable_device(pcard->pdev);
if (err) {
dev_err(&pcard->pdev->dev,
@@ -349,9 +340,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
goto err_remove_ida;
}
- /*
- * Step 4: Setup the Register BAR
- */
+ // Setup the Register BAR
reg_bar_phys_addr = pci_resource_start(pcard->pdev, REG_BAR);
reg_bar_phys_len = pci_resource_len(pcard->pdev, REG_BAR);
@@ -381,9 +370,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
reg_bar_phys_len - 1;
pcard->regs_base_resource.flags = IORESOURCE_MEM;
- /*
- * Step 5: Setup the DMA BAR
- */
+ // Setup the DMA BAR
dma_bar_phys_addr = pci_resource_start(pcard->pdev, DMA_BAR);
dma_bar_phys_len = pci_resource_len(pcard->pdev, DMA_BAR);
@@ -415,9 +402,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
dma_bar_phys_len - 1;
pcard->dma_base_resource.flags = IORESOURCE_MEM;
- /*
- * Step 6: System Regs
- */
+ // Read System Regs
pcard->sysinfo_regs_base = pcard->regs_bar_base;
err = read_system_regs(pcard);
if (err)
@@ -427,11 +412,9 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
writeq(0xFFFFFFFFFFFFFFFF,
pcard->sysinfo_regs_base + REG_INTERRUPT_MASK);
- /*
- * Step 7: Configure PCI thingies
- */
// let the card master PCIe
pci_set_master(pcard->pdev);
+
// enable IO and mem if not already done
pci_read_config_word(pcard->pdev, PCI_COMMAND, ®val);
regval |= (PCI_COMMAND_IO | PCI_COMMAND_MEMORY);
@@ -466,9 +449,6 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
dev_dbg(&pcard->pdev->dev,
"Using DMA mask %0llx\n", dma_get_mask(PCARD_TO_DEV(pcard)));
- /*
- * Step 8: Configure IRQs
- */
err = pci_enable_msi(pcard->pdev);
if (err < 0)
goto err_unmap_dma;
@@ -481,25 +461,17 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
goto err_disable_msi;
}
- /*
- * Step 9: Setup sysfs attributes
- */
err = sysfs_create_files(&pdev->dev.kobj, kp_attr_list);
if (err) {
dev_err(&pdev->dev, "Failed to add sysfs files: %d\n", err);
goto err_free_irq;
}
- /*
- * Step 10: Probe cores
- */
err = kp2000_probe_cores(pcard);
if (err)
goto err_remove_sysfs;
- /*
- * Step 11: Enable IRQs in HW
- */
+ // Enable IRQs in HW
writel(KPC_DMA_CARD_IRQ_ENABLE | KPC_DMA_CARD_USER_INTERRUPT_MODE,
pcard->dma_common_regs);
--
2.20.1
next prev parent reply other threads:[~2019-06-10 20:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-10 20:05 [PATCH 0/2] staging: kpc2000: minor fixes in kp2000_pcie_probe Simon Sandström
2019-06-10 20:05 ` [PATCH 1/2] staging: kpc2000: improve label names " Simon Sandström
2019-06-12 7:37 ` Dan Carpenter
2019-06-10 20:05 ` Simon Sandström [this message]
2019-06-12 7:39 ` [PATCH 2/2] staging: kpc2000: remove unnecessary comments " Dan Carpenter
2019-06-12 7:46 ` Greg KH
2019-06-12 10:07 ` Simon Sandström
2019-06-12 13:58 ` [PATCH v2 0/2] staging: kpc2000: minor fixes " Simon Sandström
2019-06-12 13:58 ` [PATCH v2 1/2] staging: kpc2000: improve label names " Simon Sandström
2019-06-12 13:58 ` [PATCH v2 2/2] staging: kpc2000: remove unnecessary comments " Simon Sandström
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=20190610200535.31820-3-simon@nikanor.nu \
--to=simon@nikanor.nu \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=jeremy@azazel.net \
--cc=linux-kernel@vger.kernel.org \
/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).