* [PATCH] staging: pi433: remove unnecessary new line escape sequence characters
@ 2022-01-30 6:18 Paulo Miguel Almeida
2022-01-31 10:40 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Paulo Miguel Almeida @ 2022-01-30 6:18 UTC (permalink / raw)
To: gregkh, paulo.miguel.almeida.rodenas, realwakka
Cc: linux-staging, linux-kernel
In this driver there were occurences of '\n'-ended strings when using
dev_dbg function which isn't required which most likely were leftovers
from a previous printk/pr_<level> implementation.
This patch removes the extraneous '\n' characters to make it consistent
with the other dev_dbg instances.
Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
---
Patch dependencies:
The following patches must be applied first given that changes are made
to the same set of files:
- https://lore.kernel.org/lkml/YfYdVokxsQ+Adl+T@mail.google.com/
- https://lore.kernel.org/lkml/YfX+llwDWZZMz+NY@mail.google.com/
---
drivers/staging/pi433/pi433_if.c | 14 +++++++-------
drivers/staging/pi433/rf69.c | 16 ++++++++--------
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 02d4ccebf..db1b092e8 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -124,13 +124,13 @@ static irqreturn_t DIO0_irq_handler(int irq, void *dev_id)
if (device->irq_state[DIO0] == DIO_PACKET_SENT) {
device->free_in_fifo = FIFO_SIZE;
- dev_dbg(device->dev, "DIO0 irq: Packet sent\n");
+ dev_dbg(device->dev, "DIO0 irq: Packet sent");
wake_up_interruptible(&device->fifo_wait_queue);
} else if (device->irq_state[DIO0] == DIO_RSSI_DIO0) {
- dev_dbg(device->dev, "DIO0 irq: RSSI level over threshold\n");
+ dev_dbg(device->dev, "DIO0 irq: RSSI level over threshold");
wake_up_interruptible(&device->rx_wait_queue);
} else if (device->irq_state[DIO0] == DIO_PAYLOAD_READY) {
- dev_dbg(device->dev, "DIO0 irq: Payload ready\n");
+ dev_dbg(device->dev, "DIO0 irq: Payload ready");
device->free_in_fifo = 0;
wake_up_interruptible(&device->fifo_wait_queue);
}
@@ -151,7 +151,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id)
device->free_in_fifo = FIFO_SIZE - FIFO_THRESHOLD - 1;
}
dev_dbg(device->dev,
- "DIO1 irq: %d bytes free in fifo\n", device->free_in_fifo);
+ "DIO1 irq: %d bytes free in fifo", device->free_in_fifo);
wake_up_interruptible(&device->fifo_wait_queue);
return IRQ_HANDLED;
@@ -726,7 +726,7 @@ static int pi433_tx_thread(void *data)
retval = wait_event_interruptible(device->fifo_wait_queue,
device->free_in_fifo > 0);
if (retval) {
- dev_dbg(device->dev, "ABORT\n");
+ dev_dbg(device->dev, "ABORT");
goto abort;
}
}
@@ -1180,7 +1180,7 @@ static int pi433_probe(struct spi_device *spi)
retval = spi_setup(spi);
if (retval) {
- dev_dbg(&spi->dev, "configuration of SPI interface failed!\n");
+ dev_dbg(&spi->dev, "configuration of SPI interface failed!");
return retval;
}
@@ -1283,7 +1283,7 @@ static int pi433_probe(struct spi_device *spi)
goto device_create_failed;
} else {
dev_dbg(device->dev,
- "created device for major %d, minor %d\n",
+ "created device for major %d, minor %d",
MAJOR(pi433_dev),
device->minor);
}
diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index 2ab3bf46e..9a8f93fd7 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -37,9 +37,9 @@ u8 rf69_read_reg(struct spi_device *spi, u8 addr)
* that module is connected. Therefore no error
* handling, just an optional error message...
*/
- dev_dbg(&spi->dev, "read 0x%x FAILED\n", addr);
+ dev_dbg(&spi->dev, "read 0x%x FAILED", addr);
else
- dev_dbg(&spi->dev, "read 0x%x from reg 0x%x\n", retval, addr);
+ dev_dbg(&spi->dev, "read 0x%x from reg 0x%x", retval, addr);
#endif
return retval;
@@ -62,9 +62,9 @@ static int rf69_write_reg(struct spi_device *spi, u8 addr, u8 value)
* that module is connected. Therefore no error
* handling, just an optional error message...
*/
- dev_dbg(&spi->dev, "write 0x%x to 0x%x FAILED\n", value, addr);
+ dev_dbg(&spi->dev, "write 0x%x to 0x%x FAILED", value, addr);
else
- dev_dbg(&spi->dev, "wrote 0x%x to reg 0x%x\n", value, addr);
+ dev_dbg(&spi->dev, "wrote 0x%x to reg 0x%x", value, addr);
#endif
return retval;
@@ -870,7 +870,7 @@ int rf69_read_fifo(struct spi_device *spi, u8 *buffer, unsigned int size)
if (size > FIFO_SIZE) {
dev_dbg(&spi->dev,
- "read fifo: passed in buffer bigger then internal buffer\n");
+ "read fifo: passed in buffer bigger then internal buffer");
return -EMSGSIZE;
}
@@ -885,7 +885,7 @@ int rf69_read_fifo(struct spi_device *spi, u8 *buffer, unsigned int size)
#ifdef DEBUG_FIFO_ACCESS
for (i = 0; i < size; i++)
- dev_dbg(&spi->dev, "%d - 0x%x\n", i, local_buffer[i + 1]);
+ dev_dbg(&spi->dev, "%d - 0x%x", i, local_buffer[i + 1]);
#endif
memcpy(buffer, &local_buffer[1], size);
@@ -902,7 +902,7 @@ int rf69_write_fifo(struct spi_device *spi, u8 *buffer, unsigned int size)
if (size > FIFO_SIZE) {
dev_dbg(&spi->dev,
- "read fifo: passed in buffer bigger then internal buffer\n");
+ "read fifo: passed in buffer bigger then internal buffer");
return -EMSGSIZE;
}
@@ -911,7 +911,7 @@ int rf69_write_fifo(struct spi_device *spi, u8 *buffer, unsigned int size)
#ifdef DEBUG_FIFO_ACCESS
for (i = 0; i < size; i++)
- dev_dbg(&spi->dev, "0x%x\n", buffer[i]);
+ dev_dbg(&spi->dev, "0x%x", buffer[i]);
#endif
return spi_write(spi, local_buffer, size + 1);
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: pi433: remove unnecessary new line escape sequence characters
2022-01-30 6:18 [PATCH] staging: pi433: remove unnecessary new line escape sequence characters Paulo Miguel Almeida
@ 2022-01-31 10:40 ` Dan Carpenter
2022-01-31 19:30 ` Paulo Miguel Almeida
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2022-01-31 10:40 UTC (permalink / raw)
To: Paulo Miguel Almeida; +Cc: gregkh, realwakka, linux-staging, linux-kernel
On Sun, Jan 30, 2022 at 07:18:26PM +1300, Paulo Miguel Almeida wrote:
> In this driver there were occurences of '\n'-ended strings when using
> dev_dbg function which isn't required which most likely were leftovers
> from a previous printk/pr_<level> implementation.
>
> This patch removes the extraneous '\n' characters to make it consistent
> with the other dev_dbg instances.
>
> Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
> ---
> Patch dependencies:
>
> The following patches must be applied first given that changes are made
> to the same set of files:
>
> - https://lore.kernel.org/lkml/YfYdVokxsQ+Adl+T@mail.google.com/
> - https://lore.kernel.org/lkml/YfX+llwDWZZMz+NY@mail.google.com/
> ---
> drivers/staging/pi433/pi433_if.c | 14 +++++++-------
> drivers/staging/pi433/rf69.c | 16 ++++++++--------
> 2 files changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
> index 02d4ccebf..db1b092e8 100644
> --- a/drivers/staging/pi433/pi433_if.c
> +++ b/drivers/staging/pi433/pi433_if.c
> @@ -124,13 +124,13 @@ static irqreturn_t DIO0_irq_handler(int irq, void *dev_id)
>
> if (device->irq_state[DIO0] == DIO_PACKET_SENT) {
> device->free_in_fifo = FIFO_SIZE;
> - dev_dbg(device->dev, "DIO0 irq: Packet sent\n");
> + dev_dbg(device->dev, "DIO0 irq: Packet sent");
Both the old and new code will do the same thing. You are correct.
However in terms of style, I believe the preference is to add a newline.
I don't remember the reasoning behind this. But a lot of these style
rules are just decided by consensus. If you do a
`git grep -w dev_dbg | grep \;$` then it is 12391 places that add a
new line and 622 which don't. Adding a newline is the clear winner.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: pi433: remove unnecessary new line escape sequence characters
2022-01-31 10:40 ` Dan Carpenter
@ 2022-01-31 19:30 ` Paulo Miguel Almeida
0 siblings, 0 replies; 3+ messages in thread
From: Paulo Miguel Almeida @ 2022-01-31 19:30 UTC (permalink / raw)
To: Dan Carpenter; +Cc: gregkh, realwakka, linux-staging, linux-kernel
On Mon, Jan 31, 2022 at 01:40:20PM +0300, Dan Carpenter wrote:
> > if (device->irq_state[DIO0] == DIO_PACKET_SENT) {
> > device->free_in_fifo = FIFO_SIZE;
> > - dev_dbg(device->dev, "DIO0 irq: Packet sent\n");
> > + dev_dbg(device->dev, "DIO0 irq: Packet sent");
>
> Both the old and new code will do the same thing. You are correct.
> However in terms of style, I believe the preference is to add a newline.
>
> I don't remember the reasoning behind this. But a lot of these style
> rules are just decided by consensus. If you do a
> `git grep -w dev_dbg | grep \;$` then it is 12391 places that add a
> new line and 622 which don't. Adding a newline is the clear winner.
>
it makes sense. I will send a different patch adding the newline escapes
instead.
Thanks heaps!
Paulo Almeida
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-31 19:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-30 6:18 [PATCH] staging: pi433: remove unnecessary new line escape sequence characters Paulo Miguel Almeida
2022-01-31 10:40 ` Dan Carpenter
2022-01-31 19:30 ` Paulo Miguel Almeida
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.