diff mbox

SPI: BCM2835: fix all checkpath --strict messages

Message ID 1426755714-28130-1-git-send-email-kernel@martin.sperl.org (mailing list archive)
State New, archived
Headers show

Commit Message

Martin Sperl March 19, 2015, 9:01 a.m. UTC
From: Martin Sperl <kernel@martin.sperl.org>

Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
---
 drivers/spi/spi-bcm2835.c |   28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

Comments

Stephen Warren March 20, 2015, 4:58 a.m. UTC | #1
On 03/19/2015 03:01 AM, kernel@martin.sperl.org wrote:
> From: Martin Sperl <kernel@martin.sperl.org>

Do you have a list of the warnings this fixes and why? The extra
wrapping here looks a bit odd, since the lines before your patch are
well under 80 columns.
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Martin Sperl March 20, 2015, 6:26 a.m. UTC | #2
> On 20.03.2015, at 05:58, Stephen Warren <swarren@wwwdotorg.org> wrote:
> 
> Do you have a list of the warnings this fixes and why? The extra
> wrapping here looks a bit odd, since the lines before your patch are
> well under 80 columns.

scripts/checkpatch.pl --file --terse --strict drivers/spi/spi-bcm2835.c
drivers/spi/spi-bcm2835.c:182: CHECK: Alignment should match open parenthesis
drivers/spi/spi-bcm2835.c:191: CHECK: braces {} should be used on all arms of this statement
drivers/spi/spi-bcm2835.c:234: CHECK: Alignment should match open parenthesis
drivers/spi/spi-bcm2835.c:256: CHECK: Alignment should match open parenthesis
drivers/spi/spi-bcm2835.c:271: CHECK: Alignment should match open parenthesis
drivers/spi/spi-bcm2835.c:346: CHECK: Alignment should match open parenthesis
total: 0 errors, 0 warnings, 6 checks, 403 lines checked

Martin--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mark Brown March 20, 2015, 1:36 p.m. UTC | #3
On Thu, Mar 19, 2015 at 09:01:50AM +0000, kernel@martin.sperl.org wrote:

Looks like I did get these but they took a while to come through...
odd.

> -static int bcm2835_spi_start_transfer(struct spi_device *spi,
> -		struct spi_transfer *tfr)
> +static int bcm2835_spi_start_transfer(
> +	struct spi_device *spi,
> +	struct spi_transfer *tfr)

Like Stephen says I'm not 100% sure what issues this is fixing but I
have to say I find the overall result worse.  It's possible the
warning is something reasonable but without knowing what it is it's hard
to say, I do like to see at least the first argument on the same line as
the function name though.
Mark Brown March 20, 2015, 1:40 p.m. UTC | #4
On Fri, Mar 20, 2015 at 07:26:29AM +0100, Martin Sperl wrote:
> > On 20.03.2015, at 05:58, Stephen Warren <swarren@wwwdotorg.org> wrote:

> > Do you have a list of the warnings this fixes and why? The extra
> > wrapping here looks a bit odd, since the lines before your patch are
> > well under 80 columns.

> scripts/checkpatch.pl --file --terse --strict drivers/spi/spi-bcm2835.c
> drivers/spi/spi-bcm2835.c:182: CHECK: Alignment should match open parenthesis

This is telling you to add more indentation to the second argument not
wrap the first.  Though frankly I don't think it matters - it's
certainly not a routinely followed thing and it frequently makes things
worse.
diff mbox

Patch

diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c
index 419a782..e1dea40 100644
--- a/drivers/spi/spi-bcm2835.c
+++ b/drivers/spi/spi-bcm2835.c
@@ -178,8 +178,9 @@  static irqreturn_t bcm2835_spi_interrupt(int irq, void *dev_id)
 	return IRQ_NONE;
 }
 
-static int bcm2835_spi_start_transfer(struct spi_device *spi,
-		struct spi_transfer *tfr)
+static int bcm2835_spi_start_transfer(
+	struct spi_device *spi,
+	struct spi_transfer *tfr)
 {
 	struct bcm2835_spi *bs = spi_master_get_devdata(spi->master);
 	unsigned long spi_hz, clk_hz, cdiv;
@@ -196,8 +197,9 @@  static int bcm2835_spi_start_transfer(struct spi_device *spi,
 
 		if (cdiv >= 65536)
 			cdiv = 0; /* 0 is the slowest we can go */
-	} else
+	} else {
 		cdiv = 0; /* 0 is the slowest we can go */
+	}
 
 	if (spi->mode & SPI_CPOL)
 		cs |= BCM2835_SPI_CS_CPOL;
@@ -230,8 +232,9 @@  static int bcm2835_spi_start_transfer(struct spi_device *spi,
 	return 0;
 }
 
-static int bcm2835_spi_finish_transfer(struct spi_device *spi,
-		struct spi_transfer *tfr, bool cs_change)
+static int bcm2835_spi_finish_transfer(
+	struct spi_device *spi,
+	struct spi_transfer *tfr, bool cs_change)
 {
 	struct bcm2835_spi *bs = spi_master_get_devdata(spi->master);
 	u32 cs = bcm2835_rd(bs, BCM2835_SPI_CS);
@@ -252,8 +255,9 @@  static int bcm2835_spi_finish_transfer(struct spi_device *spi,
 	return 0;
 }
 
-static int bcm2835_spi_transfer_one(struct spi_master *master,
-		struct spi_message *mesg)
+static int bcm2835_spi_transfer_one(
+	struct spi_master *master,
+	struct spi_message *mesg)
 {
 	struct bcm2835_spi *bs = spi_master_get_devdata(master);
 	struct spi_transfer *tfr;
@@ -267,8 +271,9 @@  static int bcm2835_spi_transfer_one(struct spi_master *master,
 		if (err)
 			goto out;
 
-		timeout = wait_for_completion_timeout(&bs->done,
-				msecs_to_jiffies(BCM2835_SPI_TIMEOUT_MS));
+		timeout = wait_for_completion_timeout(
+			&bs->done,
+			msecs_to_jiffies(BCM2835_SPI_TIMEOUT_MS));
 		if (!timeout) {
 			err = -ETIMEDOUT;
 			goto out;
@@ -342,8 +347,9 @@  static int bcm2835_spi_probe(struct platform_device *pdev)
 
 	clk_prepare_enable(bs->clk);
 
-	err = devm_request_irq(&pdev->dev, bs->irq, bcm2835_spi_interrupt, 0,
-				dev_name(&pdev->dev), master);
+	err = devm_request_irq(
+		&pdev->dev, bs->irq, bcm2835_spi_interrupt, 0,
+		dev_name(&pdev->dev), master);
 	if (err) {
 		dev_err(&pdev->dev, "could not request IRQ: %d\n", err);
 		goto out_clk_disable;