* [PATCH v3] Staging: pi433: fix brace coding style issues in pi433_if.c
@ 2017-12-09 20:41 Tomas Marek
2017-12-13 11:55 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Tomas Marek @ 2017-12-09 20:41 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, marek_tomas
This patch fix several brace on next line, braces not necessary, space
around =/<, and space before/after open/close parenthesis coding style
errors find by checkpatch in pi433_if.c.
Signed-off-by: Tomas Marek <marek_tomas@centrum.cz>
---
Changes in v3:
- DIO0_irq_handler update reverted - will be submitted in separate
patch for the sake of clarity.
Changes in v2:
- DIO0_irq_handler updated - 'if/else if' replaced by 'switch' and
'dev_dbg_ratelimited' used instead of 'dev_dbg' according to Joe
Perches suggestion.
- The removal of braces around SET_CHECKED() reverted - caused syntax
error and is addressed by another patch
"[PATCHv2] staging: pi433: pi433_if.c remove SET_CHECKED macro".
---
drivers/staging/pi433/pi433_if.c | 84 +++++++++++++---------------------------
1 file changed, 27 insertions(+), 57 deletions(-)
diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 55ed45f..9822fb8 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -158,12 +158,9 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id)
{
struct pi433_device *device = dev_id;
- if (device->irq_state[DIO1] == DIO_FIFO_NOT_EMPTY_DIO1)
- {
+ if (device->irq_state[DIO1] == DIO_FIFO_NOT_EMPTY_DIO1) {
device->free_in_fifo = FIFO_SIZE;
- }
- else if (device->irq_state[DIO1] == DIO_FIFO_LEVEL)
- {
+ } else if (device->irq_state[DIO1] == DIO_FIFO_LEVEL) {
if (device->rx_active) device->free_in_fifo = FIFO_THRESHOLD - 1;
else device->free_in_fifo = FIFO_SIZE - FIFO_THRESHOLD - 1;
}
@@ -236,19 +233,14 @@ rf69_set_rx_cfg(struct pi433_device *dev, struct pi433_rx_cfg *rx_cfg)
/* lengths */
SET_CHECKED(rf69_set_sync_size(dev->spi, rx_cfg->sync_length));
- if (rx_cfg->enable_length_byte == OPTION_ON)
- {
+ if (rx_cfg->enable_length_byte == OPTION_ON) {
SET_CHECKED(rf69_set_payload_length(dev->spi, 0xff));
- }
- else if (rx_cfg->fixed_message_length != 0)
- {
+ } else if (rx_cfg->fixed_message_length != 0) {
payload_length = rx_cfg->fixed_message_length;
if (rx_cfg->enable_length_byte == OPTION_ON) payload_length++;
if (rx_cfg->enable_address_filtering != filteringOff) payload_length++;
SET_CHECKED(rf69_set_payload_length(dev->spi, payload_length));
- }
- else
- {
+ } else {
SET_CHECKED(rf69_set_payload_length(dev->spi, 0));
}
@@ -257,8 +249,7 @@ rf69_set_rx_cfg(struct pi433_device *dev, struct pi433_rx_cfg *rx_cfg)
{
SET_CHECKED(rf69_set_sync_values(dev->spi, rx_cfg->sync_pattern));
}
- if (rx_cfg->enable_address_filtering != filteringOff)
- {
+ if (rx_cfg->enable_address_filtering != filteringOff) {
SET_CHECKED(rf69_set_node_address (dev->spi, rx_cfg->node_address));
SET_CHECKED(rf69_set_broadcast_address(dev->spi, rx_cfg->broadcast_address));
}
@@ -394,8 +385,7 @@ pi433_receive(void *data)
return retval;
/* now check RSSI, if low wait for getting high (RSSI interrupt) */
- while ( !rf69_get_flag(dev->spi, rssiExceededThreshold) )
- {
+ while (!rf69_get_flag(dev->spi, rssiExceededThreshold)) {
/* allow tx to interrupt us while waiting for high RSSI */
dev->interrupt_rx_allowed = true;
wake_up_interruptible(&dev->tx_wait_queue);
@@ -418,25 +408,20 @@ pi433_receive(void *data)
irq_set_irq_type(dev->irq_num[DIO0], IRQ_TYPE_EDGE_RISING);
/* fixed or unlimited length? */
- if (dev->rx_cfg.fixed_message_length != 0)
- {
- if (dev->rx_cfg.fixed_message_length > dev->rx_buffer_size)
- {
+ if (dev->rx_cfg.fixed_message_length != 0) {
+ if (dev->rx_cfg.fixed_message_length > dev->rx_buffer_size) {
retval = -1;
goto abort;
}
bytes_total = dev->rx_cfg.fixed_message_length;
dev_dbg(dev->dev,"rx: msg len set to %d by fixed length", bytes_total);
- }
- else
- {
+ } else {
bytes_total = dev->rx_buffer_size;
dev_dbg(dev->dev, "rx: msg len set to %d as requested by read", bytes_total);
}
/* length byte enabled? */
- if (dev->rx_cfg.enable_length_byte == OPTION_ON)
- {
+ if (dev->rx_cfg.enable_length_byte == OPTION_ON) {
retval = wait_event_interruptible(dev->fifo_wait_queue,
dev->free_in_fifo < FIFO_SIZE);
if (retval) goto abort; /* wait was interrupted */
@@ -451,8 +436,7 @@ pi433_receive(void *data)
}
/* address byte enabled? */
- if (dev->rx_cfg.enable_address_filtering != filteringOff)
- {
+ if (dev->rx_cfg.enable_address_filtering != filteringOff) {
u8 dummy;
bytes_total--;
@@ -467,10 +451,8 @@ pi433_receive(void *data)
}
/* get payload */
- while (dev->rx_position < bytes_total)
- {
- if ( !rf69_get_flag(dev->spi, payloadReady) )
- {
+ while (dev->rx_position < bytes_total) {
+ if (!rf69_get_flag(dev->spi, payloadReady)) {
retval = wait_event_interruptible(dev->fifo_wait_queue,
dev->free_in_fifo < FIFO_SIZE);
if (retval) goto abort; /* wait was interrupted */
@@ -524,8 +506,7 @@ pi433_tx_thread(void *data)
int position, repetitions;
int retval;
- while (1)
- {
+ while (1) {
/* wait for fifo to be populated or for request to terminate*/
dev_dbg(device->dev, "thread: going to wait for new messages");
wait_event_interruptible(device->tx_wait_queue,
@@ -642,19 +623,17 @@ pi433_tx_thread(void *data)
device->free_in_fifo = FIFO_SIZE;
position = 0;
repetitions = tx_cfg.repetitions;
- while( (repetitions > 0) && (size > position) )
- {
- if ( (size - position) > device->free_in_fifo)
- { /* msg to big for fifo - take a part */
+ while ((repetitions > 0) && (size > position)) {
+ if ((size - position) > device->free_in_fifo) {
+ /* msg to big for fifo - take a part */
int temp = device->free_in_fifo;
device->free_in_fifo = 0;
rf69_write_fifo(spi,
&buffer[position],
temp);
position +=temp;
- }
- else
- { /* msg fits into fifo - take all */
+ } else {
+ /* msg fits into fifo - take all */
device->free_in_fifo -= size;
repetitions--;
rf69_write_fifo(spi,
@@ -683,8 +662,7 @@ pi433_tx_thread(void *data)
/* everything sent? */
if (kfifo_is_empty(&device->tx_fifo)) {
abort:
- if (rx_interrupted)
- {
+ if (rx_interrupted) {
rx_interrupted = false;
pi433_start_rx(device);
}
@@ -713,13 +691,10 @@ pi433_read(struct file *filp, char __user *buf, size_t size, loff_t *f_pos)
/* just one read request at a time */
mutex_lock(&device->rx_lock);
- if (device->rx_active)
- {
+ if (device->rx_active) {
mutex_unlock(&device->rx_lock);
return -EAGAIN;
- }
- else
- {
+ } else {
device->rx_active = true;
mutex_unlock(&device->rx_lock);
}
@@ -945,8 +920,7 @@ static int setup_GPIOs(struct pi433_device *device)
DIO1_irq_handler
};
- for (i=0; i<NUM_DIO; i++)
- {
+ for (i = 0; i < NUM_DIO; i++) {
/* "construct" name and get the gpio descriptor */
snprintf(name, sizeof(name), "DIO%d", i);
device->gpiod[i] = gpiod_get(&device->spi->dev, name, 0 /*GPIOD_IN*/);
@@ -1002,8 +976,7 @@ static void free_GPIOs(struct pi433_device *device)
{
int i;
- for (i = 0; i < NUM_DIO; i++)
- {
+ for (i = 0; i < NUM_DIO; i++) {
/* check if gpiod is valid */
if ( IS_ERR(device->gpiod[i]) )
continue;
@@ -1067,13 +1040,10 @@ static int pi433_probe(struct spi_device *spi)
/* spi->max_speed_hz = 10000000; 1MHz already set by device tree overlay */
retval = spi_setup(spi);
- if (retval)
- {
+ if (retval) {
dev_dbg(&spi->dev, "configuration of SPI interface failed!\n");
return retval;
- }
- else
- {
+ } else {
dev_dbg(&spi->dev,
"spi interface setup: mode 0x%2x, %d bits per word, %dhz max speed",
spi->mode, spi->bits_per_word, spi->max_speed_hz);
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v3] Staging: pi433: fix brace coding style issues in pi433_if.c
2017-12-09 20:41 [PATCH v3] Staging: pi433: fix brace coding style issues in pi433_if.c Tomas Marek
@ 2017-12-13 11:55 ` Greg KH
2017-12-13 19:31 ` Tomas Marek
0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2017-12-13 11:55 UTC (permalink / raw)
To: Tomas Marek; +Cc: devel, linux-kernel
On Sat, Dec 09, 2017 at 12:41:11PM -0800, Tomas Marek wrote:
> This patch fix several brace on next line, braces not necessary, space
> around =/<, and space before/after open/close parenthesis coding style
> errors find by checkpatch in pi433_if.c.
>
> Signed-off-by: Tomas Marek <marek_tomas@centrum.cz>
> ---
> Changes in v3:
> - DIO0_irq_handler update reverted - will be submitted in separate
> patch for the sake of clarity.
> Changes in v2:
> - DIO0_irq_handler updated - 'if/else if' replaced by 'switch' and
> 'dev_dbg_ratelimited' used instead of 'dev_dbg' according to Joe
> Perches suggestion.
> - The removal of braces around SET_CHECKED() reverted - caused syntax
> error and is addressed by another patch
> "[PATCHv2] staging: pi433: pi433_if.c remove SET_CHECKED macro".
This doesn't apply to my tree at all :(
Please rebase it against the staging-next branch of staging.git (or the
staging-testing branch to be sure), and then resend.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] Staging: pi433: fix brace coding style issues in pi433_if.c
2017-12-13 11:55 ` Greg KH
@ 2017-12-13 19:31 ` Tomas Marek
2017-12-14 7:29 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Tomas Marek @ 2017-12-13 19:31 UTC (permalink / raw)
To: Greg KH; +Cc: devel, linux-kernel
On 12/13/2017 03:55 AM, Greg KH wrote:
> On Sat, Dec 09, 2017 at 12:41:11PM -0800, Tomas Marek wrote:
>> This patch fix several brace on next line, braces not necessary, space
>> around =/<, and space before/after open/close parenthesis coding style
>> errors find by checkpatch in pi433_if.c.
>>
>> Signed-off-by: Tomas Marek <marek_tomas@centrum.cz>
>> ---
>> Changes in v3:
>> - DIO0_irq_handler update reverted - will be submitted in separate
>> patch for the sake of clarity.
>> Changes in v2:
>> - DIO0_irq_handler updated - 'if/else if' replaced by 'switch' and
>> 'dev_dbg_ratelimited' used instead of 'dev_dbg' according to Joe
>> Perches suggestion.
>> - The removal of braces around SET_CHECKED() reverted - caused syntax
>> error and is addressed by another patch
>> "[PATCHv2] staging: pi433: pi433_if.c remove SET_CHECKED macro".
> This doesn't apply to my tree at all :(
>
> Please rebase it against the staging-next branch of staging.git (or the
> staging-testing branch to be sure), and then resend.
>
> thanks,
>
> greg k-h
I am sorry for complications. I did it against linux-next. I'll rebase it
against stating and cross-check against staging-testing, hopefully it will
be fine then.
Thank you very much for your patience Greg.
Tomas
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] Staging: pi433: fix brace coding style issues in pi433_if.c
2017-12-13 19:31 ` Tomas Marek
@ 2017-12-14 7:29 ` Greg KH
0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2017-12-14 7:29 UTC (permalink / raw)
To: Tomas Marek; +Cc: devel, linux-kernel
On Wed, Dec 13, 2017 at 11:31:15AM -0800, Tomas Marek wrote:
> On 12/13/2017 03:55 AM, Greg KH wrote:
>
> > On Sat, Dec 09, 2017 at 12:41:11PM -0800, Tomas Marek wrote:
> >> This patch fix several brace on next line, braces not necessary, space
> >> around =/<, and space before/after open/close parenthesis coding style
> >> errors find by checkpatch in pi433_if.c.
> >>
> >> Signed-off-by: Tomas Marek <marek_tomas@centrum.cz>
> >> ---
> >> Changes in v3:
> >> - DIO0_irq_handler update reverted - will be submitted in separate
> >> patch for the sake of clarity.
> >> Changes in v2:
> >> - DIO0_irq_handler updated - 'if/else if' replaced by 'switch' and
> >> 'dev_dbg_ratelimited' used instead of 'dev_dbg' according to Joe
> >> Perches suggestion.
> >> - The removal of braces around SET_CHECKED() reverted - caused syntax
> >> error and is addressed by another patch
> >> "[PATCHv2] staging: pi433: pi433_if.c remove SET_CHECKED macro".
> > This doesn't apply to my tree at all :(
> >
> > Please rebase it against the staging-next branch of staging.git (or the
> > staging-testing branch to be sure), and then resend.
> >
> > thanks,
> >
> > greg k-h
> I am sorry for complications. I did it against linux-next. I'll rebase it
> against stating and cross-check against staging-testing, hopefully it will
> be fine then.
Normally linux-next is fine to do your work against. But as you can see
on the mailing list, there are a lot of people sending a lot of patches
for this one driver. So things end up changing quickly, usually the
merge issue is that I took a patch that was sent a few hours before
yours, and you did it all right.
Sorry, rebasing and resending patches are just a normal mode for working
on a high-traffic area in the kernel, thanks for your patience.
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-12-14 7:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-09 20:41 [PATCH v3] Staging: pi433: fix brace coding style issues in pi433_if.c Tomas Marek
2017-12-13 11:55 ` Greg KH
2017-12-13 19:31 ` Tomas Marek
2017-12-14 7:29 ` Greg KH
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.