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

Configure Feed

Select the types of activity you want to include in your feed.

iio: adc: ad7606: drop ch param from ad7606_scale_setup_cb_t

Drop the ch parameter from the ad7606_scale_setup_cb_t functions. The
same info is already available from the chan param via chan->scan_type
and chan->channel, so the parameter is redundant.

Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250318-iio-adc-ad7606-improvements-v2-8-4b605427774c@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

David Lechner and committed by
Jonathan Cameron
c1f571c3 f504e352

+24 -22
+23 -21
drivers/iio/adc/ad7606.c
··· 182 182 }; 183 183 184 184 static int ad7606c_18bit_chan_scale_setup(struct iio_dev *indio_dev, 185 - struct iio_chan_spec *chan, int ch); 185 + struct iio_chan_spec *chan); 186 186 static int ad7606c_16bit_chan_scale_setup(struct iio_dev *indio_dev, 187 - struct iio_chan_spec *chan, int ch); 187 + struct iio_chan_spec *chan); 188 188 static int ad7606_16bit_chan_scale_setup(struct iio_dev *indio_dev, 189 - struct iio_chan_spec *chan, int ch); 189 + struct iio_chan_spec *chan); 190 190 static int ad7607_chan_scale_setup(struct iio_dev *indio_dev, 191 - struct iio_chan_spec *chan, int ch); 191 + struct iio_chan_spec *chan); 192 192 static int ad7608_chan_scale_setup(struct iio_dev *indio_dev, 193 - struct iio_chan_spec *chan, int ch); 193 + struct iio_chan_spec *chan); 194 194 static int ad7609_chan_scale_setup(struct iio_dev *indio_dev, 195 - struct iio_chan_spec *chan, int ch); 195 + struct iio_chan_spec *chan); 196 196 static int ad7616_sw_mode_setup(struct iio_dev *indio_dev); 197 197 static int ad7606b_sw_mode_setup(struct iio_dev *indio_dev); 198 198 ··· 346 346 EXPORT_SYMBOL_NS_GPL(ad7606_reset, "IIO_AD7606"); 347 347 348 348 static int ad7606_16bit_chan_scale_setup(struct iio_dev *indio_dev, 349 - struct iio_chan_spec *chan, int ch) 349 + struct iio_chan_spec *chan) 350 350 { 351 351 struct ad7606_state *st = iio_priv(indio_dev); 352 - struct ad7606_chan_scale *cs = &st->chan_scales[ch]; 352 + struct ad7606_chan_scale *cs = &st->chan_scales[chan->scan_index]; 353 353 354 354 if (!st->sw_mode_en) { 355 355 /* tied to logic low, analog input range is +/- 5V */ ··· 425 425 } 426 426 427 427 static int ad7606c_18bit_chan_scale_setup(struct iio_dev *indio_dev, 428 - struct iio_chan_spec *chan, int ch) 428 + struct iio_chan_spec *chan) 429 429 { 430 430 struct ad7606_state *st = iio_priv(indio_dev); 431 - struct ad7606_chan_scale *cs = &st->chan_scales[ch]; 431 + struct ad7606_chan_scale *cs = &st->chan_scales[chan->scan_index]; 432 432 bool bipolar, differential; 433 433 int ret; 434 434 ··· 439 439 return 0; 440 440 } 441 441 442 - ret = ad7606_get_chan_config(indio_dev, ch, &bipolar, &differential); 442 + ret = ad7606_get_chan_config(indio_dev, chan->scan_index, &bipolar, 443 + &differential); 443 444 if (ret) 444 445 return ret; 445 446 ··· 483 482 } 484 483 485 484 static int ad7606c_16bit_chan_scale_setup(struct iio_dev *indio_dev, 486 - struct iio_chan_spec *chan, int ch) 485 + struct iio_chan_spec *chan) 487 486 { 488 487 struct ad7606_state *st = iio_priv(indio_dev); 489 - struct ad7606_chan_scale *cs = &st->chan_scales[ch]; 488 + struct ad7606_chan_scale *cs = &st->chan_scales[chan->scan_index]; 490 489 bool bipolar, differential; 491 490 int ret; 492 491 ··· 497 496 return 0; 498 497 } 499 498 500 - ret = ad7606_get_chan_config(indio_dev, ch, &bipolar, &differential); 499 + ret = ad7606_get_chan_config(indio_dev, chan->scan_index, &bipolar, 500 + &differential); 501 501 if (ret) 502 502 return ret; 503 503 ··· 542 540 } 543 541 544 542 static int ad7607_chan_scale_setup(struct iio_dev *indio_dev, 545 - struct iio_chan_spec *chan, int ch) 543 + struct iio_chan_spec *chan) 546 544 { 547 545 struct ad7606_state *st = iio_priv(indio_dev); 548 - struct ad7606_chan_scale *cs = &st->chan_scales[ch]; 546 + struct ad7606_chan_scale *cs = &st->chan_scales[chan->scan_index]; 549 547 550 548 cs->range = 0; 551 549 cs->scale_avail = ad7607_hw_scale_avail; ··· 554 552 } 555 553 556 554 static int ad7608_chan_scale_setup(struct iio_dev *indio_dev, 557 - struct iio_chan_spec *chan, int ch) 555 + struct iio_chan_spec *chan) 558 556 { 559 557 struct ad7606_state *st = iio_priv(indio_dev); 560 - struct ad7606_chan_scale *cs = &st->chan_scales[ch]; 558 + struct ad7606_chan_scale *cs = &st->chan_scales[chan->scan_index]; 561 559 562 560 cs->range = 0; 563 561 cs->scale_avail = ad7606_18bit_hw_scale_avail; ··· 566 564 } 567 565 568 566 static int ad7609_chan_scale_setup(struct iio_dev *indio_dev, 569 - struct iio_chan_spec *chan, int ch) 567 + struct iio_chan_spec *chan) 570 568 { 571 569 struct ad7606_state *st = iio_priv(indio_dev); 572 - struct ad7606_chan_scale *cs = &st->chan_scales[ch]; 570 + struct ad7606_chan_scale *cs = &st->chan_scales[chan->scan_index]; 573 571 574 572 cs->range = 0; 575 573 cs->scale_avail = ad7609_hw_scale_avail; ··· 1302 1300 indio_dev->channels = chans; 1303 1301 1304 1302 for (ch = 0; ch < st->chip_info->num_adc_channels; ch++) { 1305 - ret = st->chip_info->scale_setup_cb(indio_dev, &chans[ch + offset], ch); 1303 + ret = st->chip_info->scale_setup_cb(indio_dev, &chans[ch + offset]); 1306 1304 if (ret) 1307 1305 return ret; 1308 1306 }
+1 -1
drivers/iio/adc/ad7606.h
··· 113 113 struct ad7606_state; 114 114 115 115 typedef int (*ad7606_scale_setup_cb_t)(struct iio_dev *indio_dev, 116 - struct iio_chan_spec *chan, int ch); 116 + struct iio_chan_spec *chan); 117 117 typedef int (*ad7606_sw_setup_cb_t)(struct iio_dev *indio_dev); 118 118 119 119 /**