2014-07-07 22:32:05

by Guillaume Clement

[permalink] [raw]
Subject: [PATCH] staging:nvec: Fix several coding style warnings

This fixes several warnings in the nvec staging driver.


2014-07-07 22:32:04

by Guillaume Clement

[permalink] [raw]
Subject: [PATCH 1/5] staging:nvec: Fix "unnecessary else" coding style warning.

The last else is unnessary as all the if statements end with a return.

Signed-off-by: Guillaume Clément <[email protected]>
---
drivers/staging/nvec/nvec.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 90f1c4d..8a3dd47 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -232,8 +232,7 @@ static size_t nvec_msg_size(struct nvec_msg *msg)
return 2;
else if (event_length == NVEC_3BYTES)
return 3;
- else
- return 0;
+ return 0;
}

/**
--
1.8.5.5

2014-07-07 22:32:07

by Guillaume Clement

[permalink] [raw]
Subject: [PATCH 2/5] staging:nvec: Remove unnessary out of memory message.

Logging messages that show some type of "out of memory" error
are generally unnecessary as there is a generic message and
a stack dump done by the memory subsystem.

Signed-off-by: Guillaume Clément <[email protected]>
---
drivers/staging/nvec/nvec.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 8a3dd47..d325048 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -806,10 +806,9 @@ static int tegra_nvec_probe(struct platform_device *pdev)
}

nvec = devm_kzalloc(&pdev->dev, sizeof(struct nvec_chip), GFP_KERNEL);
- if (nvec == NULL) {
- dev_err(&pdev->dev, "failed to reserve memory\n");
+ if (nvec == NULL)
return -ENOMEM;
- }
+
platform_set_drvdata(pdev, nvec);
nvec->dev = &pdev->dev;

--
1.8.5.5

2014-07-07 22:32:39

by Guillaume Clement

[permalink] [raw]
Subject: [PATCH 5/5] staging:nvec: Add missing blank line after declarations.

Signed-off-by: Guillaume Clément <[email protected]>
---
drivers/staging/nvec/nvec_ps2.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_ps2.c
index 45b2f13..f56f1db 100644
--- a/drivers/staging/nvec/nvec_ps2.c
+++ b/drivers/staging/nvec/nvec_ps2.c
@@ -53,12 +53,14 @@ static struct nvec_ps2 ps2_dev;
static int ps2_startstreaming(struct serio *ser_dev)
{
unsigned char buf[] = { NVEC_PS2, AUTO_RECEIVE_N, PACKET_SIZE };
+
return nvec_write_async(ps2_dev.nvec, buf, sizeof(buf));
}

static void ps2_stopstreaming(struct serio *ser_dev)
{
unsigned char buf[] = { NVEC_PS2, CANCEL_AUTO_RECEIVE };
+
nvec_write_async(ps2_dev.nvec, buf, sizeof(buf));
}

--
1.8.5.5

2014-07-07 22:32:56

by Guillaume Clement

[permalink] [raw]
Subject: [PATCH 4/5] staging:nvec: Add missing blank line after declarations.

Signed-off-by: Guillaume Clément <[email protected]>
---
drivers/staging/nvec/nvec_power.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/staging/nvec/nvec_power.c b/drivers/staging/nvec/nvec_power.c
index aacfcd6..6446e15 100644
--- a/drivers/staging/nvec/nvec_power.c
+++ b/drivers/staging/nvec/nvec_power.c
@@ -226,6 +226,7 @@ static int nvec_power_get_property(struct power_supply *psy,
union power_supply_propval *val)
{
struct nvec_power *power = dev_get_drvdata(psy->dev->parent);
+
switch (psp) {
case POWER_SUPPLY_PROP_ONLINE:
val->intval = power->on;
--
1.8.5.5

2014-07-07 22:33:19

by Guillaume Clement

[permalink] [raw]
Subject: [PATCH 3/5] staging:nvec: Add missing blank line after declarations.

Signed-off-by: Guillaume Clément <[email protected]>
---
drivers/staging/nvec/nvec_paz00.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/staging/nvec/nvec_paz00.c b/drivers/staging/nvec/nvec_paz00.c
index 934b796..e2e675a 100644
--- a/drivers/staging/nvec/nvec_paz00.c
+++ b/drivers/staging/nvec/nvec_paz00.c
@@ -35,6 +35,7 @@ static void nvec_led_brightness_set(struct led_classdev *led_cdev,
{
struct nvec_led *led = to_nvec_led(led_cdev);
unsigned char buf[] = NVEC_LED_REQ;
+
buf[4] = value;

nvec_write_async(led->nvec, buf, sizeof(buf));
--
1.8.5.5

2014-07-08 08:32:39

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH 5/5] staging:nvec: Add missing blank line after declarations.

Looks ok. If you wanted it probably would have been better to fold
patches 3, 4, and 5 together but this is ok too.

regards,
dan carpenter

2014-07-08 10:14:47

by Marc Dietrich

[permalink] [raw]
Subject: Re: [PATCH] staging:nvec: Fix several coding style warnings

Hi Guillaume,

On Tue, 8 Jul 2014 00:31:32 +0200
Guillaume Clement <[email protected]> wrote:

> This fixes several warnings in the nvec staging driver.

Pawel Lebioda already sent a patch series to fix these issues
a few days ago. From a first look, your patch series looks identical.
Thanks anyway for taking your time.

Marc

Marc Dietrich <[email protected]>