2019-05-23 12:54:29

by Simon Sandström

[permalink] [raw]
Subject: [PATCH v2 0/9] 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".

Changed in v2: don't bother fixing the __func__ usage in the out of
memory debug message, instead add a patch that removes
it completely.

- Simon

Simon Sandström (9):
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
staging: kpc2000: remove unnecessary oom message

drivers/staging/kpc2000/kpc2000/cell_probe.c | 81 +++++++++-----------
1 file changed, 38 insertions(+), 43 deletions(-)

--
2.20.1


2019-05-23 12:54:31

by Simon Sandström

[permalink] [raw]
Subject: [PATCH v2 5/9] 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 5b88504b00ec..f8d19e693f21 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;
@@ -346,7 +343,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 12:54:40

by Simon Sandström

[permalink] [raw]
Subject: [PATCH v2 3/9] 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 b559ade04aca..945d8e4e7ba5 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 12:55:07

by Simon Sandström

[permalink] [raw]
Subject: [PATCH v2 1/9] staging: kpc2000: add blank line after declarations

Fixes checkpatch.pl warning "Missing a blank line after declarations".

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

diff --git a/drivers/staging/kpc2000/kpc2000/cell_probe.c b/drivers/staging/kpc2000/kpc2000/cell_probe.c
index e5cddf0eeed3..95bfbe4aae4d 100644
--- a/drivers/staging/kpc2000/kpc2000/cell_probe.c
+++ b/drivers/staging/kpc2000/kpc2000/cell_probe.c
@@ -245,6 +245,7 @@ int kp2000_check_uio_irq(struct kp2000_device *pcard, u32 irq_num)
u64 interrupt_active = readq(pcard->sysinfo_regs_base + REG_INTERRUPT_ACTIVE);
u64 interrupt_mask_inv = ~readq(pcard->sysinfo_regs_base + REG_INTERRUPT_MASK);
u64 irq_check_mask = (1 << irq_num);
+
if (interrupt_active & irq_check_mask) { // if it's active (interrupt pending)
if (interrupt_mask_inv & irq_check_mask) { // and if it's not masked off
return 1;
@@ -257,6 +258,7 @@ static
irqreturn_t kuio_handler(int irq, struct uio_info *uioinfo)
{
struct kpc_uio_device *kudev = uioinfo->priv;
+
if (irq != kudev->pcard->pdev->irq)
return IRQ_NONE;

@@ -506,8 +508,10 @@ void kp2000_remove_cores(struct kp2000_device *pcard)
{
struct list_head *ptr;
struct list_head *next;
+
list_for_each_safe(ptr, next, &pcard->uio_devices_list) {
struct kpc_uio_device *kudev = list_entry(ptr, struct kpc_uio_device, list);
+
uio_unregister_device(&kudev->uioinfo);
device_unregister(kudev->dev);
list_del(&kudev->list);
--
2.20.1

2019-05-23 12:55:20

by Simon Sandström

[permalink] [raw]
Subject: [PATCH v2 2/9] 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 | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000/cell_probe.c b/drivers/staging/kpc2000/kpc2000/cell_probe.c
index 95bfbe4aae4d..b559ade04aca 100644
--- a/drivers/staging/kpc2000/kpc2000/cell_probe.c
+++ b/drivers/staging/kpc2000/kpc2000/cell_probe.c
@@ -327,7 +327,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 +336,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 +412,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 +426,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 +476,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 +496,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