Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: adis: stylistic changes

Minor stylistic changes to address checkptach complains when called with
'--strict'.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20220122130905.99-3-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Nuno Sá and committed by
Jonathan Cameron
c39010ea da593677

+54 -50
+25 -22
drivers/iio/imu/adis.c
··· 30 30 * @value: The value to write to device (up to 4 bytes) 31 31 * @size: The size of the @value (in bytes) 32 32 */ 33 - int __adis_write_reg(struct adis *adis, unsigned int reg, 34 - unsigned int value, unsigned int size) 33 + int __adis_write_reg(struct adis *adis, unsigned int reg, unsigned int value, 34 + unsigned int size) 35 35 { 36 36 unsigned int page = reg / ADIS_PAGE_SIZE; 37 37 int ret, i; ··· 114 114 ret = spi_sync(adis->spi, &msg); 115 115 if (ret) { 116 116 dev_err(&adis->spi->dev, "Failed to write register 0x%02X: %d\n", 117 - reg, ret); 117 + reg, ret); 118 118 } else { 119 119 adis->current_page = page; 120 120 } ··· 130 130 * @val: The value read back from the device 131 131 * @size: The size of the @val buffer 132 132 */ 133 - int __adis_read_reg(struct adis *adis, unsigned int reg, 134 - unsigned int *val, unsigned int size) 133 + int __adis_read_reg(struct adis *adis, unsigned int reg, unsigned int *val, 134 + unsigned int size) 135 135 { 136 136 unsigned int page = reg / ADIS_PAGE_SIZE; 137 137 struct spi_message msg; ··· 201 201 ret = spi_sync(adis->spi, &msg); 202 202 if (ret) { 203 203 dev_err(&adis->spi->dev, "Failed to read register 0x%02X: %d\n", 204 - reg, ret); 204 + reg, ret); 205 205 return ret; 206 - } else { 207 - adis->current_page = page; 208 206 } 207 + 208 + adis->current_page = page; 209 209 210 210 switch (size) { 211 211 case 4: ··· 247 247 248 248 #ifdef CONFIG_DEBUG_FS 249 249 250 - int adis_debugfs_reg_access(struct iio_dev *indio_dev, 251 - unsigned int reg, unsigned int writeval, unsigned int *readval) 250 + int adis_debugfs_reg_access(struct iio_dev *indio_dev, unsigned int reg, 251 + unsigned int writeval, unsigned int *readval) 252 252 { 253 253 struct adis *adis = iio_device_get_drvdata(indio_dev); 254 254 255 255 if (readval) { 256 - uint16_t val16; 256 + u16 val16; 257 257 int ret; 258 258 259 259 ret = adis_read_reg_16(adis, reg, &val16); ··· 261 261 *readval = val16; 262 262 263 263 return ret; 264 - } else { 265 - return adis_write_reg_16(adis, reg, writeval); 266 264 } 265 + 266 + return adis_write_reg_16(adis, reg, writeval); 267 267 } 268 268 EXPORT_SYMBOL(adis_debugfs_reg_access); 269 269 ··· 279 279 int adis_enable_irq(struct adis *adis, bool enable) 280 280 { 281 281 int ret = 0; 282 - uint16_t msc; 282 + u16 msc; 283 283 284 284 mutex_lock(&adis->state_lock); 285 285 286 286 if (adis->data->enable_irq) { 287 287 ret = adis->data->enable_irq(adis, enable); 288 288 goto out_unlock; 289 - } else if (adis->data->unmasked_drdy) { 289 + } 290 + 291 + if (adis->data->unmasked_drdy) { 290 292 if (enable) 291 293 enable_irq(adis->spi->irq); 292 294 else ··· 324 322 */ 325 323 int __adis_check_status(struct adis *adis) 326 324 { 327 - uint16_t status; 325 + u16 status; 328 326 int ret; 329 327 int i; 330 328 ··· 360 358 const struct adis_timeout *timeouts = adis->data->timeouts; 361 359 362 360 ret = __adis_write_reg_8(adis, adis->data->glob_cmd_reg, 363 - ADIS_GLOB_CMD_SW_RESET); 361 + ADIS_GLOB_CMD_SW_RESET); 364 362 if (ret) { 365 363 dev_err(&adis->spi->dev, "Failed to reset device: %d\n", ret); 366 364 return ret; ··· 416 414 { 417 415 const struct adis_timeout *timeouts = adis->data->timeouts; 418 416 struct gpio_desc *gpio; 419 - uint16_t prod_id; 417 + u16 prod_id; 420 418 int ret; 421 419 422 420 /* check if the device has rst pin low */ ··· 425 423 return PTR_ERR(gpio); 426 424 427 425 if (gpio) { 428 - msleep(10); 426 + usleep_range(10, 12); 429 427 /* bring device out of reset */ 430 428 gpiod_set_value_cansleep(gpio, 0); 431 429 msleep(timeouts->reset_ms); ··· 479 477 * a error bit in the channels raw value set error_mask to 0. 480 478 */ 481 479 int adis_single_conversion(struct iio_dev *indio_dev, 482 - const struct iio_chan_spec *chan, unsigned int error_mask, int *val) 480 + const struct iio_chan_spec *chan, 481 + unsigned int error_mask, int *val) 483 482 { 484 483 struct adis *adis = iio_device_get_drvdata(indio_dev); 485 484 unsigned int uval; ··· 489 486 mutex_lock(&adis->state_lock); 490 487 491 488 ret = __adis_read_reg(adis, chan->address, &uval, 492 - chan->scan_type.storagebits / 8); 489 + chan->scan_type.storagebits / 8); 493 490 if (ret) 494 491 goto err_unlock; 495 492 ··· 524 521 * called. 525 522 */ 526 523 int adis_init(struct adis *adis, struct iio_dev *indio_dev, 527 - struct spi_device *spi, const struct adis_data *data) 524 + struct spi_device *spi, const struct adis_data *data) 528 525 { 529 526 if (!data || !data->timeouts) { 530 527 dev_err(&spi->dev, "No config data or timeouts not defined!\n");
+3 -3
drivers/iio/imu/adis_buffer.c
··· 20 20 #include <linux/iio/imu/adis.h> 21 21 22 22 static int adis_update_scan_mode_burst(struct iio_dev *indio_dev, 23 - const unsigned long *scan_mask) 23 + const unsigned long *scan_mask) 24 24 { 25 25 struct adis *adis = iio_device_get_drvdata(indio_dev); 26 26 unsigned int burst_length, burst_max_length; ··· 67 67 } 68 68 69 69 int adis_update_scan_mode(struct iio_dev *indio_dev, 70 - const unsigned long *scan_mask) 70 + const unsigned long *scan_mask) 71 71 { 72 72 struct adis *adis = iio_device_get_drvdata(indio_dev); 73 73 const struct iio_chan_spec *chan; ··· 158 158 } 159 159 160 160 iio_push_to_buffers_with_timestamp(indio_dev, adis->buffer, 161 - pf->timestamp); 161 + pf->timestamp); 162 162 163 163 irq_done: 164 164 iio_trigger_notify_done(indio_dev->trig);
+1 -2
drivers/iio/imu/adis_trigger.c
··· 15 15 #include <linux/iio/trigger.h> 16 16 #include <linux/iio/imu/adis.h> 17 17 18 - static int adis_data_rdy_trigger_set_state(struct iio_trigger *trig, 19 - bool state) 18 + static int adis_data_rdy_trigger_set_state(struct iio_trigger *trig, bool state) 20 19 { 21 20 struct adis *adis = iio_trigger_get_drvdata(trig); 22 21
+25 -23
include/linux/iio/imu/adis.h
··· 32 32 u16 sw_reset_ms; 33 33 u16 self_test_ms; 34 34 }; 35 + 35 36 /** 36 37 * struct adis_data - ADIS chip variant specific data 37 38 * @read_delay: SPI delay for read operations in us ··· 46 45 * @self_test_mask: Bitmask of supported self-test operations 47 46 * @self_test_reg: Register address to request self test command 48 47 * @self_test_no_autoclear: True if device's self-test needs clear of ctrl reg 49 - * @status_error_msgs: Array of error messgaes 48 + * @status_error_msgs: Array of error messages 50 49 * @status_error_mask: Bitmask of errors supported by the device 51 50 * @timeouts: Chip specific delays 52 51 * @enable_irq: Hook for ADIS devices that have a special IRQ enable/disable ··· 131 130 unsigned long irq_flag; 132 131 void *buffer; 133 132 134 - uint8_t tx[10] ____cacheline_aligned; 135 - uint8_t rx[4]; 133 + u8 tx[10] ____cacheline_aligned; 134 + u8 rx[4]; 136 135 }; 137 136 138 137 int adis_init(struct adis *adis, struct iio_dev *indio_dev, 139 - struct spi_device *spi, const struct adis_data *data); 138 + struct spi_device *spi, const struct adis_data *data); 140 139 int __adis_reset(struct adis *adis); 141 140 142 141 /** ··· 157 156 } 158 157 159 158 int __adis_write_reg(struct adis *adis, unsigned int reg, 160 - unsigned int val, unsigned int size); 159 + unsigned int val, unsigned int size); 161 160 int __adis_read_reg(struct adis *adis, unsigned int reg, 162 - unsigned int *val, unsigned int size); 161 + unsigned int *val, unsigned int size); 163 162 164 163 /** 165 164 * __adis_write_reg_8() - Write single byte to a register (unlocked) ··· 168 167 * @value: The value to write 169 168 */ 170 169 static inline int __adis_write_reg_8(struct adis *adis, unsigned int reg, 171 - uint8_t val) 170 + u8 val) 172 171 { 173 172 return __adis_write_reg(adis, reg, val, 1); 174 173 } ··· 180 179 * @value: Value to be written 181 180 */ 182 181 static inline int __adis_write_reg_16(struct adis *adis, unsigned int reg, 183 - uint16_t val) 182 + u16 val) 184 183 { 185 184 return __adis_write_reg(adis, reg, val, 2); 186 185 } ··· 192 191 * @value: Value to be written 193 192 */ 194 193 static inline int __adis_write_reg_32(struct adis *adis, unsigned int reg, 195 - uint32_t val) 194 + u32 val) 196 195 { 197 196 return __adis_write_reg(adis, reg, val, 4); 198 197 } ··· 204 203 * @val: The value read back from the device 205 204 */ 206 205 static inline int __adis_read_reg_16(struct adis *adis, unsigned int reg, 207 - uint16_t *val) 206 + u16 *val) 208 207 { 209 208 unsigned int tmp; 210 209 int ret; ··· 223 222 * @val: The value read back from the device 224 223 */ 225 224 static inline int __adis_read_reg_32(struct adis *adis, unsigned int reg, 226 - uint32_t *val) 225 + u32 *val) 227 226 { 228 227 unsigned int tmp; 229 228 int ret; ··· 243 242 * @size: The size of the @value (in bytes) 244 243 */ 245 244 static inline int adis_write_reg(struct adis *adis, unsigned int reg, 246 - unsigned int val, unsigned int size) 245 + unsigned int val, unsigned int size) 247 246 { 248 247 int ret; 249 248 ··· 262 261 * @size: The size of the @val buffer 263 262 */ 264 263 static int adis_read_reg(struct adis *adis, unsigned int reg, 265 - unsigned int *val, unsigned int size) 264 + unsigned int *val, unsigned int size) 266 265 { 267 266 int ret; 268 267 ··· 280 279 * @value: The value to write 281 280 */ 282 281 static inline int adis_write_reg_8(struct adis *adis, unsigned int reg, 283 - uint8_t val) 282 + u8 val) 284 283 { 285 284 return adis_write_reg(adis, reg, val, 1); 286 285 } ··· 292 291 * @value: Value to be written 293 292 */ 294 293 static inline int adis_write_reg_16(struct adis *adis, unsigned int reg, 295 - uint16_t val) 294 + u16 val) 296 295 { 297 296 return adis_write_reg(adis, reg, val, 2); 298 297 } ··· 304 303 * @value: Value to be written 305 304 */ 306 305 static inline int adis_write_reg_32(struct adis *adis, unsigned int reg, 307 - uint32_t val) 306 + u32 val) 308 307 { 309 308 return adis_write_reg(adis, reg, val, 4); 310 309 } ··· 316 315 * @val: The value read back from the device 317 316 */ 318 317 static inline int adis_read_reg_16(struct adis *adis, unsigned int reg, 319 - uint16_t *val) 318 + u16 *val) 320 319 { 321 320 unsigned int tmp; 322 321 int ret; ··· 335 334 * @val: The value read back from the device 336 335 */ 337 336 static inline int adis_read_reg_32(struct adis *adis, unsigned int reg, 338 - uint32_t *val) 337 + u32 *val) 339 338 { 340 339 unsigned int tmp; 341 340 int ret; ··· 440 439 } 441 440 442 441 int adis_single_conversion(struct iio_dev *indio_dev, 443 - const struct iio_chan_spec *chan, unsigned int error_mask, 444 - int *val); 442 + const struct iio_chan_spec *chan, 443 + unsigned int error_mask, int *val); 445 444 446 445 #define ADIS_VOLTAGE_CHAN(addr, si, chan, name, info_all, bits) { \ 447 446 .type = IIO_VOLTAGE, \ ··· 490 489 .modified = 1, \ 491 490 .channel2 = IIO_MOD_ ## mod, \ 492 491 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ 493 - info_sep, \ 492 + (info_sep), \ 494 493 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ 495 494 .info_mask_shared_by_all = info_all, \ 496 495 .address = (addr), \ ··· 524 523 int devm_adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev); 525 524 526 525 int adis_update_scan_mode(struct iio_dev *indio_dev, 527 - const unsigned long *scan_mask); 526 + const unsigned long *scan_mask); 528 527 529 528 #else /* CONFIG_IIO_BUFFER */ 530 529 ··· 548 547 #ifdef CONFIG_DEBUG_FS 549 548 550 549 int adis_debugfs_reg_access(struct iio_dev *indio_dev, 551 - unsigned int reg, unsigned int writeval, unsigned int *readval); 550 + unsigned int reg, unsigned int writeval, 551 + unsigned int *readval); 552 552 553 553 #else 554 554