Solve checkstyle problems
Subsystems (2)
cover Solve checkstyle problems
Solve checkpath.pl's CHECK messages:
Bárbara Fernandes (4):
iio:adc:ad7923: Align broken line to parenthesis iio:adc:ad7923: Use BIT macro instead of bitshift iio:adc:ad7923: Put macro argument between ()'s iio:adc:ad7923: Rewrite comparison to NULL
drivers/iio/adc/ad7923.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/4 iio:adc:ad7923: Align broken line to parenthesis
Get broken line aligned with parenthesis on upper line. Solves checkpatch.pl's message:
CHECK: Alignment should match open parenthesis
--- drivers/iio/adc/ad7923.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/adc/ad7923.c +3 -3
@@ -130,7 +130,7 @@ static const struct ad7923_chip_info ad7923_chip_info[] = {* ad7923_update_scan_mode() setup the spi transfer buffer for the new scan mask **/ static int ad7923_update_scan_mode (struct iio_dev *indio_dev, -const unsigned long *active_scan_mask) +const unsigned long *active_scan_mask) {struct ad7923_state *st =iio_priv (indio_dev);int i, cmd, len;
@@ -181,7 +181,7 @@ static irqreturn_t ad7923_trigger_handler(int irq, void *p) goto done;iio_push_to_buffers_with_timestamp (indio_dev, st->rx_buf, -iio_get_time_ns (indio_dev)); +iio_get_time_ns (indio_dev)); done:iio_trigger_notify_done (indio_dev->trig);
@@ -314,7 +314,7 @@ static int ad7923_probe(struct spi_device *spi)return ret; ret =iio_triggered_buffer_setup (indio_dev,NULL , - &ad7923_trigger_handler,NULL ); + &ad7923_trigger_handler,NULL );if (ret) goto error_disable_reg;
Signature · 1 line
2.17.1
Jonathan Cameron
maintainerRe: [PATCH 1/4] iio:adc:ad7923: Align broken line to parenthesis
Quoted 6 lines · On Fri, 22 Feb 2019 17:31:56 -0300 Bárbara Fernandes…
Get broken line aligned with parenthesis on upper line. Solves checkpatch.pl's message:
CHECK: Alignment should match open parenthesis
Signed-off-by Bárbara Fernandes <[email protected]>
Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.
Thanks,
Jonathan
Quoted 35 lines
--- drivers/iio/adc/ad7923.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/iio/adc/ad7923.c +3
-3@@ -130,7 +130,7 @@ static const struct ad7923_chip_info ad7923_chip_info[] = {* ad7923_update_scan_mode() setup the spi transfer buffer for the new scan mask **/ static int ad7923_update_scan_mode (struct iio_dev *indio_dev, -const unsigned long *active_scan_mask) +const unsigned long *active_scan_mask) {struct ad7923_state *st =iio_priv (indio_dev);int i, cmd, len;@@ -181,7 +181,7 @@ static irqreturn_t ad7923_trigger_handler(int irq, void *p) goto done;iio_push_to_buffers_with_timestamp (indio_dev, st->rx_buf, -iio_get_time_ns (indio_dev)); +iio_get_time_ns (indio_dev)); done:iio_trigger_notify_done (indio_dev->trig);@@ -314,7 +314,7 @@ static int ad7923_probe(struct spi_device *spi)return ret; ret =iio_triggered_buffer_setup (indio_dev,NULL , - &ad7923_trigger_handler,NULL ); + &ad7923_trigger_handler,NULL );if (ret) goto error_disable_reg;
PATCH 2/4 iio:adc:ad7923: Use BIT macro instead of bitshift
In reply to Bárbara FernandesReplace use of the operation '<<' by the BIT macro. Solves checkpath.pl's message:
CHECK: Prefer using the BIT macro
--- drivers/iio/adc/ad7923.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/adc/ad7923.c +3 -3
@@ -24,9 +24,9 @@#include <linux/iio/trigger_consumer.h> #include <linux/iio/triggered_buffer.h> -#define AD7923_WRITE_CR (1 << 11)/* write control register */ -#define AD7923_RANGE (1 << 1)/* range to REFin */ -#define AD7923_CODING (1 << 0)/* coding is straight binary */ +#define AD7923_WRITE_CR BIT(11)/* write control register */ +#define AD7923_RANGE BIT(1)/* range to REFin */ +#define AD7923_CODING BIT(0)/* coding is straight binary */ #define AD7923_PM_MODE_AS (1)/* auto shutdown */ #define AD7923_PM_MODE_FS (2)/* full shutdown */ #define AD7923_PM_MODE_OPS (3)/* normal operation */
Signature · 1 line
2.17.1
Re: [PATCH 2/4] iio:adc:ad7923: Use BIT macro instead of bitshift
Quoted 6 lines · On Fri, 22 Feb 2019 17:31:57 -0300 Bárbara Fernandes…
Replace use of the operation '<<' by the BIT macro. Solves checkpath.pl's message:
CHECK: Prefer using the BIT macro
Signed-off-by Bárbara Fernandes <[email protected]>
Applied. Thanks,
Jonathan
Quoted 21 lines
--- drivers/iio/adc/ad7923.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/iio/adc/ad7923.c +3
-3@@ -24,9 +24,9 @@#include <linux/iio/trigger_consumer.h> #include <linux/iio/triggered_buffer.h> -#define AD7923_WRITE_CR (1 << 11)/* write control register */ -#define AD7923_RANGE (1 << 1)/* range to REFin */ -#define AD7923_CODING (1 << 0)/* coding is straight binary */ +#define AD7923_WRITE_CR BIT(11)/* write control register */ +#define AD7923_RANGE BIT(1)/* range to REFin */ +#define AD7923_CODING BIT(0)/* coding is straight binary */ #define AD7923_PM_MODE_AS (1)/* auto shutdown */ #define AD7923_PM_MODE_FS (2)/* full shutdown */ #define AD7923_PM_MODE_OPS (3)/* normal operation */
PATCH 3/4 iio:adc:ad7923: Put macro argument between ()'s
In reply to Bárbara FernandesPut macro argument between parenthesis in order to avoid precedence issues. Solves the following checkpath.pl's messages:
CHECK: Macro argument 'mode' may be better as '(mode)' to avoid precedence issues
CHECK: Macro argument 'channel' may be better as '(channel)' to avoid precedence issues
CHECK: Macro argument reuse 'sequence' - possible side-effects?
CHECK: Macro argument 'sequence' may be better as '(sequence)' to avoid precedence issues
CHECK: Macro argument 'val' may be better as '(val)' to avoid precedence issues
CHECK: Macro argument 'dec' may be better as '(dec)' to avoid precedence issues
CHECK: Macro argument 'bits' may be better as '(bits)' to avoid precedence issues
--- drivers/iio/adc/ad7923.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/iio/adc/ad7923.c +5 -5
@@ -40,16 +40,16 @@#define AD7923_MAX_CHAN 4 -#define AD7923_PM_MODE_WRITE (mode) (mode << 4)/* write mode */ -#define AD7923_CHANNEL_WRITE (channel) (channel << 6)/* write channel */ -#define AD7923_SEQUENCE_WRITE (sequence) (((sequence & 1) << 3) \ - + ((sequence & 2) << 9)) +#define AD7923_PM_MODE_WRITE (mode) ((mode) << 4)/* write mode */ +#define AD7923_CHANNEL_WRITE (channel) ((channel) << 6)/* write channel */ +#define AD7923_SEQUENCE_WRITE (sequence) ((((sequence) & 1) << 3) \ + + (((sequence) & 2) << 9))/* write sequence fonction */ /* left shift for CR : bit 11 transmit in first */ #define AD7923_SHIFT_REGISTER 4/* val = value, dec = left shift, bits = number of bits of the mask */ -#define EXTRACT (val, dec, bits) ((val >> dec) & ((1 << bits) - 1)) +#define EXTRACT (val, dec, bits) (((val) >> (dec)) & ((1 << (bits)) - 1))struct ad7923_state {struct spi_device *spi;
Signature · 1 line
2.17.1
Re: [PATCH 3/4] iio:adc:ad7923: Put macro argument between ()'s
Quoted 17 lines · On Fri, 22 Feb 2019 17:31:58 -0300 Bárbara Fernandes…
Put macro argument between parenthesis in order to avoid precedence issues. Solves the following checkpath.pl's messages:
CHECK: Macro argument 'mode' may be better as '(mode)' to avoid precedence issues
CHECK: Macro argument 'channel' may be better as '(channel)' to avoid precedence issues
CHECK: Macro argument reuse 'sequence' - possible side-effects?
CHECK: Macro argument 'sequence' may be better as '(sequence)' to avoid precedence issues
CHECK: Macro argument 'val' may be better as '(val)' to avoid precedence issues
CHECK: Macro argument 'dec' may be better as '(dec)' to avoid precedence issues
CHECK: Macro argument 'bits' may be better as '(bits)' to avoid precedence issues
Quoted 1 line
Signed-off-by Bárbara Fernandes <[email protected]>
Applied.
Thanks,
Jonathan
Quoted 30 lines
--- drivers/iio/adc/ad7923.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/iio/adc/ad7923.c +5
-5@@ -40,16 +40,16 @@#define AD7923_MAX_CHAN 4 -#define AD7923_PM_MODE_WRITE (mode) (mode << 4)/* write mode */ -#define AD7923_CHANNEL_WRITE (channel) (channel << 6)/* write channel */ -#define AD7923_SEQUENCE_WRITE (sequence) (((sequence & 1) << 3) \ - + ((sequence & 2) << 9)) +#define AD7923_PM_MODE_WRITE (mode) ((mode) << 4)/* write mode */ +#define AD7923_CHANNEL_WRITE (channel) ((channel) << 6)/* write channel */ +#define AD7923_SEQUENCE_WRITE (sequence) ((((sequence) & 1) << 3) \ + + (((sequence) & 2) << 9))/* write sequence fonction */ /* left shift for CR : bit 11 transmit in first */ #define AD7923_SHIFT_REGISTER 4/* val = value, dec = left shift, bits = number of bits of the mask */ -#define EXTRACT (val, dec, bits) ((val >> dec) & ((1 << bits) - 1)) +#define EXTRACT (val, dec, bits) (((val) >> (dec)) & ((1 << (bits)) - 1))struct ad7923_state {struct spi_device *spi;
PATCH 4/4 iio:adc:ad7923: Rewrite comparison to NULL
In reply to Bárbara FernandesSolves checkpath.pl's message:
CHECK: Comparison to NULL could be written "!indio_dev"
--- drivers/iio/adc/ad7923.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ad7923.c +1 -1
@@ -272,7 +272,7 @@ static int ad7923_probe(struct spi_device *spi)int ret; indio_dev =devm_iio_device_alloc (&spi->dev,sizeof (*st)); -if (indio_dev ==NULL ) +if (!indio_dev)return -ENOMEM ; st =iio_priv (indio_dev);
Signature · 1 line
2.17.1
Re: [PATCH 4/4] iio:adc:ad7923: Rewrite comparison to NULL
Quoted 5 lines · On Fri, 22 Feb 2019 17:31:59 -0300 Bárbara Fernandes…
Solves checkpath.pl's message:
CHECK: Comparison to NULL could be written "!indio_dev"
Signed-off-by Bárbara Fernandes <[email protected]>
Applied, thanks.
It's nice to get some cleanup for drivers that aren't in staging sometimes. After all, in recent years the kernel coding style and tools to check it have improved considerably.
Thanks,
Jonathan
Quoted 17 lines
--- drivers/iio/adc/ad7923.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/adc/ad7923.c +1
-1@@ -272,7 +272,7 @@ static int ad7923_probe(struct spi_device *spi)int ret; indio_dev =devm_iio_device_alloc (&spi->dev,sizeof (*st)); -if (indio_dev ==NULL ) +if (!indio_dev)return -ENOMEM ; st =iio_priv (indio_dev);