2019-06-03 22:32:03

by Simon Sandström

[permalink] [raw]
Subject: [PATCH 0/7] staging: kpc2000: various minor checkpatch fixes

Here is a bunch of checkpatch fixes for core.c in staging/kpc2000.

Some of these were sent earlier but not applied. Now rebased on top of
staging-testing (incl. Jeremy's kpc2000 misc device removal commits).


- Simon

Simon Sandström (7):
staging: kpc2000: simplify comparisons to NULL in core.c
staging: kpc2000: remove unnecessary parentheses in core.c
staging: kpc2000: remove unnecessary oom message in core.c
staging: kpc2000: use __func__ in debug messages in core.c
staging: kpc2000: remove unnecessary include in core.c
staging: kpc2000: use sizeof(var) in kzalloc call
staging: kpc2000: fix incorrect code comment in core.c

drivers/staging/kpc2000/kpc2000/core.c | 36 ++++++++++++--------------
1 file changed, 16 insertions(+), 20 deletions(-)

--
2.20.1


2019-06-03 22:32:25

by Simon Sandström

[permalink] [raw]
Subject: [PATCH 4/7] staging: kpc2000: use __func__ in debug messages in core.c

Fixes checkpatch.pl warning "Prefer using '"%s...", __func__' to using
'<function name>', this function's name, in a string".

Signed-off-by: Simon Sandström <[email protected]>
---
drivers/staging/kpc2000/kpc2000/core.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000/core.c b/drivers/staging/kpc2000/kpc2000/core.c
index a70665a202c3..6d4fc1f37c9f 100644
--- a/drivers/staging/kpc2000/kpc2000/core.c
+++ b/drivers/staging/kpc2000/kpc2000/core.c
@@ -312,8 +312,8 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
unsigned long dma_bar_phys_len;
u16 regval;

- dev_dbg(&pdev->dev, "kp2000_pcie_probe(pdev = [%p], id = [%p])\n",
- pdev, id);
+ dev_dbg(&pdev->dev, "%s(pdev = [%p], id = [%p])\n",
+ __func__, pdev, id);

/*
* Step 1: Allocate a struct for the pcard
@@ -481,7 +481,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
pcard->name, pcard);
if (rv) {
dev_err(&pcard->pdev->dev,
- "kp2000_pcie_probe: failed to request_irq: %d\n", rv);
+ "%s: failed to request_irq: %d\n", __func__, rv);
goto out8b;
}

@@ -507,7 +507,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
writel(KPC_DMA_CARD_IRQ_ENABLE | KPC_DMA_CARD_USER_INTERRUPT_MODE,
pcard->dma_common_regs);

- dev_dbg(&pcard->pdev->dev, "kp2000_pcie_probe() complete!\n");
+ dev_dbg(&pcard->pdev->dev, "%s() complete!\n", __func__);
mutex_unlock(&pcard->sem);
return 0;

@@ -541,7 +541,7 @@ static void kp2000_pcie_remove(struct pci_dev *pdev)
{
struct kp2000_device *pcard = pci_get_drvdata(pdev);

- dev_dbg(&pdev->dev, "kp2000_pcie_remove(pdev=%p)\n", pdev);
+ dev_dbg(&pdev->dev, "%s(pdev=%p)\n", __func__, pdev);

if (!pcard)
return;
--
2.20.1

2019-06-06 13:06:19

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 4/7] staging: kpc2000: use __func__ in debug messages in core.c

On Tue, Jun 04, 2019 at 12:29:13AM +0200, Simon Sandstr?m wrote:
> Fixes checkpatch.pl warning "Prefer using '"%s...", __func__' to using
> '<function name>', this function's name, in a string".
>
> Signed-off-by: Simon Sandstr?m <[email protected]>
> ---
> drivers/staging/kpc2000/kpc2000/core.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/kpc2000/kpc2000/core.c b/drivers/staging/kpc2000/kpc2000/core.c
> index a70665a202c3..6d4fc1f37c9f 100644
> --- a/drivers/staging/kpc2000/kpc2000/core.c
> +++ b/drivers/staging/kpc2000/kpc2000/core.c
> @@ -312,8 +312,8 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
> unsigned long dma_bar_phys_len;
> u16 regval;
>
> - dev_dbg(&pdev->dev, "kp2000_pcie_probe(pdev = [%p], id = [%p])\n",
> - pdev, id);
> + dev_dbg(&pdev->dev, "%s(pdev = [%p], id = [%p])\n",
> + __func__, pdev, id);

debugging lines that say "called this function!" can all be removed, as
we have ftrace in the kernel tree, we can use that instead. I'll take
this, but feel free to clean them up as follow-on patches.

thanks,

greg k-h

2019-06-10 07:20:32

by Simon Sandström

[permalink] [raw]
Subject: Re: [PATCH 4/7] staging: kpc2000: use __func__ in debug messages in core.c

On 06/06, Greg KH wrote:
> On Tue, Jun 04, 2019 at 12:29:13AM +0200, Simon Sandström wrote:
> >
> > - dev_dbg(&pdev->dev, "kp2000_pcie_probe(pdev = [%p], id = [%p])\n",
> > - pdev, id);
> > + dev_dbg(&pdev->dev, "%s(pdev = [%p], id = [%p])\n",
> > + __func__, pdev, id);
>
> debugging lines that say "called this function!" can all be removed, as
> we have ftrace in the kernel tree, we can use that instead. I'll take
> this, but feel free to clean them up as follow-on patches.
>
> thanks,
>
> greg k-h

Can they be removed even if they print function arguments or other
variables?

- Simon

2019-06-10 07:51:14

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 4/7] staging: kpc2000: use __func__ in debug messages in core.c

On Mon, Jun 10, 2019 at 09:20:09AM +0200, Simon Sandstr?m wrote:
> On 06/06, Greg KH wrote:
> > On Tue, Jun 04, 2019 at 12:29:13AM +0200, Simon Sandstr?m wrote:
> > >
> > > - dev_dbg(&pdev->dev, "kp2000_pcie_probe(pdev = [%p], id = [%p])\n",
> > > - pdev, id);
> > > + dev_dbg(&pdev->dev, "%s(pdev = [%p], id = [%p])\n",
> > > + __func__, pdev, id);
> >
> > debugging lines that say "called this function!" can all be removed, as
> > we have ftrace in the kernel tree, we can use that instead. I'll take
> > this, but feel free to clean them up as follow-on patches.
> >
> > thanks,
> >
> > greg k-h
>
> Can they be removed even if they print function arguments or other
> variables?

Of course!