2019-05-23 11:39:01

by Simon Sandström

[permalink] [raw]
Subject: [PATCH 0/8] Fix more coding style issues in staging/kpc2000

Hi,

These patches fixes a few more minor coding style issues found in
staging/kpc2000/cell_probe.c. There are only two more types of
checkpatch.pl warnings left in this file with these patches applied:
"line over 80 characters" and "Macro argument reuse".

- Simon

Simon Sandström (8):
staging: kpc2000: add blank line after declarations
staging: kpc2000: use __func__ in debug messages
staging: kpc2000: add missing asterisk in comment
staging: kpc2000: fix alignment issues in cell_probe.c
staging: kpc2000: remove extra blank lines in cell_probe.c
staging: kpc2000: use kzalloc(sizeof(var)...) in cell_probe.c
staging: kpc2000: remove unnecessary braces in cell_probe.c
staging: kpc2000: remove unnecessary include in cell_probe.c

drivers/staging/kpc2000/kpc2000/cell_probe.c | 80 ++++++++++----------
1 file changed, 39 insertions(+), 41 deletions(-)

--
2.20.1


2019-05-23 11:39:10

by Simon Sandström

[permalink] [raw]
Subject: [PATCH 2/8] staging: kpc2000: use __func__ in debug messages

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/cell_probe.c | 22 +++++++++++++-------
1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000/cell_probe.c b/drivers/staging/kpc2000/kpc2000/cell_probe.c
index 95bfbe4aae4d..7b850f3e808b 100644
--- a/drivers/staging/kpc2000/kpc2000/cell_probe.c
+++ b/drivers/staging/kpc2000/kpc2000/cell_probe.c
@@ -299,7 +299,8 @@ static int probe_core_uio(unsigned int core_num, struct kp2000_device *pcard,

kudev = kzalloc(sizeof(struct kpc_uio_device), GFP_KERNEL);
if (!kudev) {
- dev_err(&pcard->pdev->dev, "probe_core_uio: failed to kzalloc kpc_uio_device\n");
+ dev_err(&pcard->pdev->dev, "%s: failed to kzalloc kpc_uio_device\n",
+ __func__);
return -ENOMEM;
}

@@ -327,7 +328,8 @@ static int probe_core_uio(unsigned int core_num, struct kp2000_device *pcard,

kudev->dev = device_create(kpc_uio_class, &pcard->pdev->dev, MKDEV(0, 0), kudev, "%s.%d.%d.%d", kudev->uioinfo.name, pcard->card_num, cte.type, kudev->core_num);
if (IS_ERR(kudev->dev)) {
- dev_err(&pcard->pdev->dev, "probe_core_uio device_create failed!\n");
+ dev_err(&pcard->pdev->dev, "%s: device_create failed!\n",
+ __func__);
kfree(kudev);
return -ENODEV;
}
@@ -335,7 +337,8 @@ static int probe_core_uio(unsigned int core_num, struct kp2000_device *pcard,

rv = uio_register_device(kudev->dev, &kudev->uioinfo);
if (rv) {
- dev_err(&pcard->pdev->dev, "probe_core_uio failed uio_register_device: %d\n", rv);
+ dev_err(&pcard->pdev->dev, "%s: failed uio_register_device: %d\n",
+ __func__, rv);
put_device(kudev->dev);
kfree(kudev);
return rv;
@@ -410,7 +413,8 @@ static int kp2000_setup_dma_controller(struct kp2000_device *pcard)
return 0;

err_out:
- dev_err(&pcard->pdev->dev, "kp2000_setup_dma_controller: failed to add a DMA Engine: %d\n", err);
+ dev_err(&pcard->pdev->dev, "%s: failed to add a DMA Engine: %d\n",
+ __func__, err);
return err;
}

@@ -423,7 +427,8 @@ int kp2000_probe_cores(struct kp2000_device *pcard)
unsigned int highest_core_id = 0;
struct core_table_entry cte;

- dev_dbg(&pcard->pdev->dev, "kp2000_probe_cores(pcard = %p / %d)\n", pcard, pcard->card_num);
+ dev_dbg(&pcard->pdev->dev, "%s(pcard = %p / %d)\n", __func__, pcard,
+ pcard->card_num);

err = kp2000_setup_dma_controller(pcard);
if (err)
@@ -472,8 +477,8 @@ int kp2000_probe_cores(struct kp2000_device *pcard)
}
if (err) {
dev_err(&pcard->pdev->dev,
- "kp2000_probe_cores: failed to add core %d: %d\n",
- i, err);
+ "%s: failed to add core %d: %d\n",
+ __func__, i, err);
goto error;
}
core_num++;
@@ -492,7 +497,8 @@ int kp2000_probe_cores(struct kp2000_device *pcard)
cte.irq_base_num = 0;
err = probe_core_uio(0, pcard, "kpc_uio", cte);
if (err) {
- dev_err(&pcard->pdev->dev, "kp2000_probe_cores: failed to add board_info core: %d\n", err);
+ dev_err(&pcard->pdev->dev, "%s: failed to add board_info core: %d\n",
+ __func__, err);
goto error;
}

--
2.20.1

2019-05-23 11:39:17

by Simon Sandström

[permalink] [raw]
Subject: [PATCH 4/8] staging: kpc2000: fix alignment issues in cell_probe.c

Fixes checkpatch.pl warnings "Alignment should match open parenthesis"
and "Lines should not end with a '('".

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

diff --git a/drivers/staging/kpc2000/kpc2000/cell_probe.c b/drivers/staging/kpc2000/kpc2000/cell_probe.c
index c4015c62686f..b621adb712ff 100644
--- a/drivers/staging/kpc2000/kpc2000/cell_probe.c
+++ b/drivers/staging/kpc2000/kpc2000/cell_probe.c
@@ -128,15 +128,13 @@ static int probe_core_basic(unsigned int core_num, struct kp2000_device *pcard,

cell.resources = resources;

- return mfd_add_devices(
- PCARD_TO_DEV(pcard), // parent
- pcard->card_num * 100, // id
- &cell, // struct mfd_cell *
- 1, // ndevs
- &pcard->regs_base_resource,
- 0, // irq_base
- NULL // struct irq_domain *
- );
+ return mfd_add_devices(PCARD_TO_DEV(pcard), // parent
+ pcard->card_num * 100, // id
+ &cell, // struct mfd_cell *
+ 1, // ndevs
+ &pcard->regs_base_resource,
+ 0, // irq_base
+ NULL); // struct irq_domain *
}


@@ -374,15 +372,13 @@ static int create_dma_engine_core(struct kp2000_device *pcard, size_t engine_re

cell.resources = resources;

- return mfd_add_devices(
- PCARD_TO_DEV(pcard), // parent
- pcard->card_num * 100, // id
- &cell, // struct mfd_cell *
- 1, // ndevs
- &pcard->dma_base_resource,
- 0, // irq_base
- NULL // struct irq_domain *
- );
+ return mfd_add_devices(PCARD_TO_DEV(pcard), // parent
+ pcard->card_num * 100, // id
+ &cell, // struct mfd_cell *
+ 1, // ndevs
+ &pcard->dma_base_resource,
+ 0, // irq_base
+ NULL); // struct irq_domain *
}

static int kp2000_setup_dma_controller(struct kp2000_device *pcard)
@@ -463,7 +459,7 @@ int kp2000_probe_cores(struct kp2000_device *pcard)
switch (cte.type) {
case KP_CORE_ID_I2C:
err = probe_core_basic(core_num, pcard,
- KP_DRIVER_NAME_I2C, cte);
+ KP_DRIVER_NAME_I2C, cte);
break;

case KP_CORE_ID_SPI:
--
2.20.1

2019-05-23 11:39:19

by Simon Sandström

[permalink] [raw]
Subject: [PATCH 3/8] staging: kpc2000: add missing asterisk in comment

Fixes checkpatch.pl error "code indent should use tabs where possible".

Signed-off-by: Simon Sandström <[email protected]>
---
drivers/staging/kpc2000/kpc2000/cell_probe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/kpc2000/kpc2000/cell_probe.c b/drivers/staging/kpc2000/kpc2000/cell_probe.c
index 7b850f3e808b..c4015c62686f 100644
--- a/drivers/staging/kpc2000/kpc2000/cell_probe.c
+++ b/drivers/staging/kpc2000/kpc2000/cell_probe.c
@@ -25,7 +25,7 @@
* D C2S DMA Present
* DDD C2S DMA Channel Number [up to 8 channels]
* II IRQ Count [0 to 3 IRQs per core]
- 1111111000
+ * 1111111000
* IIIIIII IRQ Base Number [up to 128 IRQs per card]
* ___ Spare
*
--
2.20.1

2019-05-23 11:40:20

by Simon Sandström

[permalink] [raw]
Subject: [PATCH 5/8] staging: kpc2000: remove extra blank lines in cell_probe.c

Fixes checkpatch.pl warnings "Please don't use multiple blank lines".

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

diff --git a/drivers/staging/kpc2000/kpc2000/cell_probe.c b/drivers/staging/kpc2000/kpc2000/cell_probe.c
index b621adb712ff..0da41ca17eb7 100644
--- a/drivers/staging/kpc2000/kpc2000/cell_probe.c
+++ b/drivers/staging/kpc2000/kpc2000/cell_probe.c
@@ -94,7 +94,6 @@ void parse_core_table_entry(struct core_table_entry *cte, const u64 read_val, co
}
}

-
static int probe_core_basic(unsigned int core_num, struct kp2000_device *pcard,
char *name, const struct core_table_entry cte)
{
@@ -111,7 +110,6 @@ static int probe_core_basic(unsigned int core_num, struct kp2000_device *pcard,

dev_dbg(&pcard->pdev->dev, "Found Basic core: type = %02d dma = %02x / %02x offset = 0x%x length = 0x%x (%d regs)\n", cte.type, KPC_OLD_S2C_DMA_CH_NUM(cte), KPC_OLD_C2S_DMA_CH_NUM(cte), cte.offset, cte.length, cte.length / 8);

-
cell.platform_data = &core_pdata;
cell.pdata_size = sizeof(struct kpc_core_device_platdata);
cell.num_resources = 2;
@@ -137,7 +135,6 @@ static int probe_core_basic(unsigned int core_num, struct kp2000_device *pcard,
NULL); // struct irq_domain *
}

-
struct kpc_uio_device {
struct list_head list;
struct kp2000_device *pcard;
@@ -347,7 +344,6 @@ static int probe_core_uio(unsigned int core_num, struct kp2000_device *pcard,
return 0;
}

-
static int create_dma_engine_core(struct kp2000_device *pcard, size_t engine_regs_offset, int engine_num, int irq_num)
{
struct mfd_cell cell = { .id = engine_num };
--
2.20.1

2019-05-23 11:59:18

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 2/8] staging: kpc2000: use __func__ in debug messages

On Thu, May 23, 2019 at 01:36:07PM +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/cell_probe.c | 22 +++++++++++++-------
> 1 file changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/staging/kpc2000/kpc2000/cell_probe.c b/drivers/staging/kpc2000/kpc2000/cell_probe.c
> index 95bfbe4aae4d..7b850f3e808b 100644
> --- a/drivers/staging/kpc2000/kpc2000/cell_probe.c
> +++ b/drivers/staging/kpc2000/kpc2000/cell_probe.c
> @@ -299,7 +299,8 @@ static int probe_core_uio(unsigned int core_num, struct kp2000_device *pcard,
>
> kudev = kzalloc(sizeof(struct kpc_uio_device), GFP_KERNEL);
> if (!kudev) {
> - dev_err(&pcard->pdev->dev, "probe_core_uio: failed to kzalloc kpc_uio_device\n");
> + dev_err(&pcard->pdev->dev, "%s: failed to kzalloc kpc_uio_device\n",
> + __func__);

kmalloc and friend error messages should just be deleted. Didn't
checkpatch say something about that?

thanks,

greg k-h

2019-05-23 12:11:20

by Simon Sandström

[permalink] [raw]
Subject: Re: [PATCH 2/8] staging: kpc2000: use __func__ in debug messages

On Thu, May 23, 2019 at 01:55:53PM +0200, Greg KH wrote:
> On Thu, May 23, 2019 at 01:36:07PM +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/cell_probe.c | 22 +++++++++++++-------
> > 1 file changed, 14 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/staging/kpc2000/kpc2000/cell_probe.c b/drivers/staging/kpc2000/kpc2000/cell_probe.c
> > index 95bfbe4aae4d..7b850f3e808b 100644
> > --- a/drivers/staging/kpc2000/kpc2000/cell_probe.c
> > +++ b/drivers/staging/kpc2000/kpc2000/cell_probe.c
> > @@ -299,7 +299,8 @@ static int probe_core_uio(unsigned int core_num, struct kp2000_device *pcard,
> >
> > kudev = kzalloc(sizeof(struct kpc_uio_device), GFP_KERNEL);
> > if (!kudev) {
> > - dev_err(&pcard->pdev->dev, "probe_core_uio: failed to kzalloc kpc_uio_device\n");
> > + dev_err(&pcard->pdev->dev, "%s: failed to kzalloc kpc_uio_device\n",
> > + __func__);
>
> kmalloc and friend error messages should just be deleted. Didn't
> checkpatch say something about that?
>
> thanks,
>
> greg k-h

Yes sorry, it did. Should I delete this chunk from this patch and add
another patch to this series that just deletes the message, in v2?

- Simon

2019-05-23 12:28:31

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 2/8] staging: kpc2000: use __func__ in debug messages

On Thu, May 23, 2019 at 02:09:37PM +0200, Simon Sandstr?m wrote:
> On Thu, May 23, 2019 at 01:55:53PM +0200, Greg KH wrote:
> > On Thu, May 23, 2019 at 01:36:07PM +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/cell_probe.c | 22 +++++++++++++-------
> > > 1 file changed, 14 insertions(+), 8 deletions(-)
> > >
> > > diff --git a/drivers/staging/kpc2000/kpc2000/cell_probe.c b/drivers/staging/kpc2000/kpc2000/cell_probe.c
> > > index 95bfbe4aae4d..7b850f3e808b 100644
> > > --- a/drivers/staging/kpc2000/kpc2000/cell_probe.c
> > > +++ b/drivers/staging/kpc2000/kpc2000/cell_probe.c
> > > @@ -299,7 +299,8 @@ static int probe_core_uio(unsigned int core_num, struct kp2000_device *pcard,
> > >
> > > kudev = kzalloc(sizeof(struct kpc_uio_device), GFP_KERNEL);
> > > if (!kudev) {
> > > - dev_err(&pcard->pdev->dev, "probe_core_uio: failed to kzalloc kpc_uio_device\n");
> > > + dev_err(&pcard->pdev->dev, "%s: failed to kzalloc kpc_uio_device\n",
> > > + __func__);
> >
> > kmalloc and friend error messages should just be deleted. Didn't
> > checkpatch say something about that?
> >
> > thanks,
> >
> > greg k-h
>
> Yes sorry, it did. Should I delete this chunk from this patch and add
> another patch to this series that just deletes the message, in v2?

Yes please.

thanks,

greg k-h