linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/6] iio: core: pass parent device as parameter during allocation
@ 2020-06-03 11:40 Alexandru Ardelean
  2020-06-03 11:40 ` [PATCH v2 1/6] " Alexandru Ardelean
                   ` (5 more replies)
  0 siblings, 6 replies; 18+ messages in thread
From: Alexandru Ardelean @ 2020-06-03 11:40 UTC (permalink / raw)
  To: linux-iio, linux-kernel; +Cc: johan, andy.shevchenko, Alexandru Ardelean

This patch updates the {devm_}iio_device_alloc() functions to automatically
assign the parent device on allocation.
For iio_device_alloc() this means a new parameter.
For devm_iio_device_alloc() this means a new behavior; the device object is
the parent. For this one, this is the common case for most drivers (except
one: 'lm3533-als').

For the special cases an iio_device_set_parent() has been created to change
the parent betwee allocation & registration.
The purpose of this helper, is mostly to highlight the new behavior of
devm_iio_device_alloc().

This patchset also removes explicit parent assignments from most IIO
drivers (except for lm3533-als).

Using a semantic patch, about 303 drivers are updated, and some needed some
manual attention. This is probably due to some limitations of spatch. At
least in some cases the parent device is not the same variable as passed to
devm_iio_device_alloc(), OR the parent assignment is moved to a separate
function than where devm_iio_device_alloc() is called.

Changelog v1 -> v2:
* added iio_device_set_parent() helper (new commit)
* update commit for lm3533-als to use iio_device_set_parent()

Alexandru Ardelean (6):
  iio: core: pass parent device as parameter during allocation
  iio: core: add iio_device_set_parent() helper
  iio: remove explicit IIO device parent assignment
  iio: remove left-over comments about parent assignment
  iio: light: lm3533-als: use iio_device_set_parent() to assign parent
  iio: remove left-over parent assignments

 drivers/counter/104-quad-8.c                  |  1 -
 drivers/counter/stm32-lptimer-cnt.c           |  1 -
 drivers/iio/accel/adis16201.c                 |  1 -
 drivers/iio/accel/adis16209.c                 |  1 -
 drivers/iio/accel/adxl345_core.c              |  1 -
 drivers/iio/accel/adxl372.c                   |  1 -
 drivers/iio/accel/bma180.c                    |  1 -
 drivers/iio/accel/bma220_spi.c                |  1 -
 drivers/iio/accel/bma400_core.c               |  1 -
 drivers/iio/accel/bmc150-accel-core.c         |  1 -
 drivers/iio/accel/da280.c                     |  1 -
 drivers/iio/accel/da311.c                     |  1 -
 drivers/iio/accel/dmard06.c                   |  1 -
 drivers/iio/accel/dmard09.c                   |  1 -
 drivers/iio/accel/dmard10.c                   |  1 -
 drivers/iio/accel/hid-sensor-accel-3d.c       |  1 -
 drivers/iio/accel/kxcjk-1013.c                |  1 -
 drivers/iio/accel/kxsd9.c                     |  1 -
 drivers/iio/accel/mc3230.c                    |  1 -
 drivers/iio/accel/mma7455_core.c              |  1 -
 drivers/iio/accel/mma7660.c                   |  1 -
 drivers/iio/accel/mma8452.c                   |  1 -
 drivers/iio/accel/mma9551.c                   |  1 -
 drivers/iio/accel/mma9553.c                   |  1 -
 drivers/iio/accel/mxc4005.c                   |  1 -
 drivers/iio/accel/mxc6255.c                   |  1 -
 drivers/iio/accel/sca3000.c                   |  1 -
 drivers/iio/accel/ssp_accel_sensor.c          |  1 -
 drivers/iio/accel/stk8312.c                   |  1 -
 drivers/iio/accel/stk8ba50.c                  |  1 -
 drivers/iio/adc/ab8500-gpadc.c                |  1 -
 drivers/iio/adc/ad7091r-base.c                |  1 -
 drivers/iio/adc/ad7124.c                      |  1 -
 drivers/iio/adc/ad7192.c                      |  1 -
 drivers/iio/adc/ad7266.c                      |  1 -
 drivers/iio/adc/ad7291.c                      |  1 -
 drivers/iio/adc/ad7292.c                      |  1 -
 drivers/iio/adc/ad7298.c                      |  1 -
 drivers/iio/adc/ad7476.c                      |  2 --
 drivers/iio/adc/ad7606.c                      |  1 -
 drivers/iio/adc/ad7766.c                      |  1 -
 drivers/iio/adc/ad7768-1.c                    |  1 -
 drivers/iio/adc/ad7780.c                      |  1 -
 drivers/iio/adc/ad7791.c                      |  1 -
 drivers/iio/adc/ad7793.c                      |  1 -
 drivers/iio/adc/ad7887.c                      |  2 --
 drivers/iio/adc/ad7923.c                      |  1 -
 drivers/iio/adc/ad7949.c                      |  1 -
 drivers/iio/adc/ad799x.c                      |  1 -
 drivers/iio/adc/adi-axi-adc.c                 |  1 -
 drivers/iio/adc/aspeed_adc.c                  |  1 -
 drivers/iio/adc/at91-sama5d2_adc.c            |  1 -
 drivers/iio/adc/at91_adc.c                    |  1 -
 drivers/iio/adc/axp20x_adc.c                  |  1 -
 drivers/iio/adc/axp288_adc.c                  |  1 -
 drivers/iio/adc/bcm_iproc_adc.c               |  1 -
 drivers/iio/adc/berlin2-adc.c                 |  1 -
 drivers/iio/adc/cc10001_adc.c                 |  1 -
 drivers/iio/adc/cpcap-adc.c                   |  1 -
 drivers/iio/adc/da9150-gpadc.c                |  1 -
 drivers/iio/adc/dln2-adc.c                    |  1 -
 drivers/iio/adc/envelope-detector.c           |  1 -
 drivers/iio/adc/ep93xx_adc.c                  |  1 -
 drivers/iio/adc/exynos_adc.c                  |  1 -
 drivers/iio/adc/fsl-imx25-gcq.c               |  1 -
 drivers/iio/adc/hi8435.c                      |  1 -
 drivers/iio/adc/hx711.c                       |  1 -
 drivers/iio/adc/imx7d_adc.c                   |  1 -
 drivers/iio/adc/ina2xx-adc.c                  |  1 -
 drivers/iio/adc/ingenic-adc.c                 |  1 -
 drivers/iio/adc/intel_mrfld_adc.c             |  1 -
 drivers/iio/adc/lp8788_adc.c                  |  1 -
 drivers/iio/adc/lpc18xx_adc.c                 |  1 -
 drivers/iio/adc/lpc32xx_adc.c                 |  1 -
 drivers/iio/adc/ltc2471.c                     |  1 -
 drivers/iio/adc/ltc2485.c                     |  1 -
 drivers/iio/adc/max1027.c                     |  1 -
 drivers/iio/adc/max11100.c                    |  1 -
 drivers/iio/adc/max1118.c                     |  1 -
 drivers/iio/adc/max1241.c                     |  1 -
 drivers/iio/adc/max1363.c                     |  2 --
 drivers/iio/adc/max9611.c                     |  1 -
 drivers/iio/adc/mcp320x.c                     |  1 -
 drivers/iio/adc/mcp3422.c                     |  1 -
 drivers/iio/adc/mcp3911.c                     |  1 -
 drivers/iio/adc/men_z188_adc.c                |  1 -
 drivers/iio/adc/meson_saradc.c                |  1 -
 drivers/iio/adc/mt6577_auxadc.c               |  1 -
 drivers/iio/adc/mxs-lradc-adc.c               |  1 -
 drivers/iio/adc/nau7802.c                     |  1 -
 drivers/iio/adc/npcm_adc.c                    |  1 -
 drivers/iio/adc/palmas_gpadc.c                |  1 -
 drivers/iio/adc/qcom-pm8xxx-xoadc.c           |  1 -
 drivers/iio/adc/qcom-spmi-adc5.c              |  1 -
 drivers/iio/adc/qcom-spmi-iadc.c              |  1 -
 drivers/iio/adc/qcom-spmi-vadc.c              |  1 -
 drivers/iio/adc/rcar-gyroadc.c                |  1 -
 drivers/iio/adc/rn5t618-adc.c                 |  1 -
 drivers/iio/adc/rockchip_saradc.c             |  1 -
 drivers/iio/adc/sc27xx_adc.c                  |  1 -
 drivers/iio/adc/sd_adc_modulator.c            |  1 -
 drivers/iio/adc/spear_adc.c                   |  1 -
 drivers/iio/adc/stm32-adc.c                   |  1 -
 drivers/iio/adc/stm32-dfsdm-adc.c             |  1 -
 drivers/iio/adc/stmpe-adc.c                   |  1 -
 drivers/iio/adc/stx104.c                      |  1 -
 drivers/iio/adc/sun4i-gpadc-iio.c             |  1 -
 drivers/iio/adc/ti-adc081c.c                  |  1 -
 drivers/iio/adc/ti-adc0832.c                  |  1 -
 drivers/iio/adc/ti-adc084s021.c               |  1 -
 drivers/iio/adc/ti-adc108s102.c               |  1 -
 drivers/iio/adc/ti-adc12138.c                 |  1 -
 drivers/iio/adc/ti-adc128s052.c               |  1 -
 drivers/iio/adc/ti-adc161s626.c               |  1 -
 drivers/iio/adc/ti-ads1015.c                  |  1 -
 drivers/iio/adc/ti-ads124s08.c                |  1 -
 drivers/iio/adc/ti-ads7950.c                  |  1 -
 drivers/iio/adc/ti-ads8344.c                  |  1 -
 drivers/iio/adc/ti-ads8688.c                  |  1 -
 drivers/iio/adc/ti-tlc4541.c                  |  1 -
 drivers/iio/adc/ti_am335x_adc.c               |  1 -
 drivers/iio/adc/twl4030-madc.c                |  1 -
 drivers/iio/adc/twl6030-gpadc.c               |  1 -
 drivers/iio/adc/vf610_adc.c                   |  1 -
 drivers/iio/adc/viperboard_adc.c              |  1 -
 drivers/iio/adc/xilinx-xadc-core.c            |  1 -
 drivers/iio/afe/iio-rescale.c                 |  1 -
 drivers/iio/amplifiers/ad8366.c               |  1 -
 drivers/iio/amplifiers/hmc425a.c              |  1 -
 drivers/iio/chemical/ams-iaq-core.c           |  1 -
 drivers/iio/chemical/atlas-sensor.c           |  1 -
 drivers/iio/chemical/bme680_core.c            |  1 -
 drivers/iio/chemical/ccs811.c                 |  1 -
 drivers/iio/chemical/pms7003.c                |  1 -
 drivers/iio/chemical/sgp30.c                  |  1 -
 drivers/iio/chemical/sps30.c                  |  1 -
 drivers/iio/chemical/vz89x.c                  |  1 -
 drivers/iio/dac/ad5064.c                      |  1 -
 drivers/iio/dac/ad5360.c                      |  1 -
 drivers/iio/dac/ad5380.c                      |  1 -
 drivers/iio/dac/ad5421.c                      |  1 -
 drivers/iio/dac/ad5446.c                      |  2 --
 drivers/iio/dac/ad5449.c                      |  1 -
 drivers/iio/dac/ad5504.c                      |  1 -
 drivers/iio/dac/ad5592r-base.c                |  1 -
 drivers/iio/dac/ad5624r_spi.c                 |  1 -
 drivers/iio/dac/ad5686.c                      |  1 -
 drivers/iio/dac/ad5755.c                      |  1 -
 drivers/iio/dac/ad5758.c                      |  1 -
 drivers/iio/dac/ad5761.c                      |  1 -
 drivers/iio/dac/ad5764.c                      |  1 -
 drivers/iio/dac/ad5770r.c                     |  1 -
 drivers/iio/dac/ad5791.c                      |  1 -
 drivers/iio/dac/ad7303.c                      |  1 -
 drivers/iio/dac/ad8801.c                      |  1 -
 drivers/iio/dac/cio-dac.c                     |  1 -
 drivers/iio/dac/dpot-dac.c                    |  1 -
 drivers/iio/dac/ds4424.c                      |  1 -
 drivers/iio/dac/lpc18xx_dac.c                 |  1 -
 drivers/iio/dac/ltc1660.c                     |  1 -
 drivers/iio/dac/ltc2632.c                     |  1 -
 drivers/iio/dac/m62332.c                      |  3 ---
 drivers/iio/dac/max517.c                      |  3 ---
 drivers/iio/dac/max5821.c                     |  1 -
 drivers/iio/dac/mcp4725.c                     |  1 -
 drivers/iio/dac/mcp4922.c                     |  1 -
 drivers/iio/dac/stm32-dac.c                   |  1 -
 drivers/iio/dac/ti-dac082s085.c               |  1 -
 drivers/iio/dac/ti-dac5571.c                  |  1 -
 drivers/iio/dac/ti-dac7311.c                  |  1 -
 drivers/iio/dac/ti-dac7612.c                  |  1 -
 drivers/iio/dac/vf610_dac.c                   |  1 -
 drivers/iio/dummy/iio_simple_dummy.c          | 14 ++++++-----
 drivers/iio/frequency/ad9523.c                |  1 -
 drivers/iio/frequency/adf4350.c               |  1 -
 drivers/iio/frequency/adf4371.c               |  1 -
 drivers/iio/gyro/adis16080.c                  |  1 -
 drivers/iio/gyro/adis16130.c                  |  1 -
 drivers/iio/gyro/adis16136.c                  |  1 -
 drivers/iio/gyro/adis16260.c                  |  1 -
 drivers/iio/gyro/adxrs450.c                   |  1 -
 drivers/iio/gyro/bmg160_core.c                |  1 -
 drivers/iio/gyro/fxas21002c_core.c            |  1 -
 drivers/iio/gyro/hid-sensor-gyro-3d.c         |  1 -
 drivers/iio/gyro/itg3200_core.c               |  1 -
 drivers/iio/gyro/mpu3050-core.c               |  1 -
 drivers/iio/gyro/ssp_gyro_sensor.c            |  1 -
 drivers/iio/health/afe4403.c                  |  1 -
 drivers/iio/health/afe4404.c                  |  1 -
 drivers/iio/health/max30100.c                 |  1 -
 drivers/iio/health/max30102.c                 |  1 -
 drivers/iio/humidity/am2315.c                 |  1 -
 drivers/iio/humidity/dht11.c                  |  1 -
 drivers/iio/humidity/hdc100x.c                |  1 -
 drivers/iio/humidity/hid-sensor-humidity.c    |  1 -
 drivers/iio/humidity/hts221_core.c            |  1 -
 drivers/iio/humidity/htu21.c                  |  1 -
 drivers/iio/humidity/si7005.c                 |  1 -
 drivers/iio/humidity/si7020.c                 |  1 -
 drivers/iio/imu/adis16400.c                   |  1 -
 drivers/iio/imu/adis16460.c                   |  1 -
 drivers/iio/imu/adis16475.c                   |  1 -
 drivers/iio/imu/adis16480.c                   |  1 -
 drivers/iio/imu/bmi160/bmi160_core.c          |  1 -
 drivers/iio/imu/fxos8700_core.c               |  1 -
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c    |  1 -
 drivers/iio/imu/kmx61.c                       |  1 -
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c  |  1 -
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c  |  1 -
 drivers/iio/industrialio-core.c               | 11 +++++----
 drivers/iio/light/acpi-als.c                  |  1 -
 drivers/iio/light/adjd_s311.c                 |  1 -
 drivers/iio/light/adux1020.c                  |  1 -
 drivers/iio/light/al3010.c                    |  1 -
 drivers/iio/light/al3320a.c                   |  1 -
 drivers/iio/light/apds9300.c                  |  1 -
 drivers/iio/light/apds9960.c                  |  1 -
 drivers/iio/light/bh1750.c                    |  1 -
 drivers/iio/light/bh1780.c                    |  1 -
 drivers/iio/light/cm32181.c                   |  1 -
 drivers/iio/light/cm3232.c                    |  1 -
 drivers/iio/light/cm3323.c                    |  1 -
 drivers/iio/light/cm3605.c                    |  1 -
 drivers/iio/light/cm36651.c                   |  1 -
 drivers/iio/light/gp2ap002.c                  |  1 -
 drivers/iio/light/gp2ap020a00f.c              |  1 -
 drivers/iio/light/hid-sensor-als.c            |  1 -
 drivers/iio/light/hid-sensor-prox.c           |  1 -
 drivers/iio/light/iqs621-als.c                |  1 -
 drivers/iio/light/isl29018.c                  |  1 -
 drivers/iio/light/isl29028.c                  |  1 -
 drivers/iio/light/isl29125.c                  |  1 -
 drivers/iio/light/jsa1212.c                   |  1 -
 drivers/iio/light/lm3533-als.c                |  2 +-
 drivers/iio/light/ltr501.c                    |  1 -
 drivers/iio/light/lv0104cs.c                  |  1 -
 drivers/iio/light/max44000.c                  |  1 -
 drivers/iio/light/max44009.c                  |  1 -
 drivers/iio/light/noa1305.c                   |  1 -
 drivers/iio/light/opt3001.c                   |  1 -
 drivers/iio/light/pa12203001.c                |  1 -
 drivers/iio/light/rpr0521.c                   |  1 -
 drivers/iio/light/si1133.c                    |  1 -
 drivers/iio/light/si1145.c                    |  1 -
 drivers/iio/light/st_uvis25_core.c            |  1 -
 drivers/iio/light/stk3310.c                   |  1 -
 drivers/iio/light/tcs3414.c                   |  1 -
 drivers/iio/light/tcs3472.c                   |  1 -
 drivers/iio/light/tsl2563.c                   |  1 -
 drivers/iio/light/tsl2583.c                   |  1 -
 drivers/iio/light/tsl2772.c                   |  1 -
 drivers/iio/light/tsl4531.c                   |  1 -
 drivers/iio/light/us5182d.c                   |  1 -
 drivers/iio/light/vcnl4000.c                  |  1 -
 drivers/iio/light/vcnl4035.c                  |  1 -
 drivers/iio/light/veml6030.c                  |  1 -
 drivers/iio/light/veml6070.c                  |  1 -
 drivers/iio/light/vl6180.c                    |  1 -
 drivers/iio/light/zopt2201.c                  |  1 -
 drivers/iio/magnetometer/ak8974.c             |  1 -
 drivers/iio/magnetometer/ak8975.c             |  1 -
 drivers/iio/magnetometer/bmc150_magn.c        |  1 -
 drivers/iio/magnetometer/hid-sensor-magn-3d.c |  1 -
 drivers/iio/magnetometer/hmc5843_core.c       |  1 -
 drivers/iio/magnetometer/mag3110.c            |  1 -
 drivers/iio/magnetometer/mmc35240.c           |  1 -
 drivers/iio/magnetometer/rm3100-core.c        |  1 -
 drivers/iio/multiplexer/iio-mux.c             |  1 -
 drivers/iio/orientation/hid-sensor-incl-3d.c  |  1 -
 drivers/iio/orientation/hid-sensor-rotation.c |  1 -
 drivers/iio/position/iqs624-pos.c             |  1 -
 drivers/iio/potentiometer/ad5272.c            |  1 -
 drivers/iio/potentiometer/ds1803.c            |  1 -
 drivers/iio/potentiometer/max5432.c           |  1 -
 drivers/iio/potentiometer/max5481.c           |  1 -
 drivers/iio/potentiometer/max5487.c           |  1 -
 drivers/iio/potentiometer/mcp4018.c           |  1 -
 drivers/iio/potentiometer/mcp41010.c          |  1 -
 drivers/iio/potentiometer/mcp4131.c           |  1 -
 drivers/iio/potentiometer/mcp4531.c           |  1 -
 drivers/iio/potentiometer/tpl0102.c           |  1 -
 drivers/iio/potentiostat/lmp91000.c           |  1 -
 drivers/iio/pressure/abp060mg.c               |  1 -
 drivers/iio/pressure/bmp280-core.c            |  1 -
 drivers/iio/pressure/dlhl60d.c                |  1 -
 drivers/iio/pressure/dps310.c                 |  1 -
 drivers/iio/pressure/hid-sensor-press.c       |  1 -
 drivers/iio/pressure/hp03.c                   |  1 -
 drivers/iio/pressure/hp206c.c                 |  1 -
 drivers/iio/pressure/icp10100.c               |  1 -
 drivers/iio/pressure/mpl115.c                 |  1 -
 drivers/iio/pressure/mpl3115.c                |  1 -
 drivers/iio/pressure/ms5637.c                 |  1 -
 drivers/iio/pressure/t5403.c                  |  1 -
 drivers/iio/pressure/zpa2326.c                |  1 -
 drivers/iio/proximity/as3935.c                |  1 -
 drivers/iio/proximity/isl29501.c              |  1 -
 drivers/iio/proximity/mb1232.c                |  1 -
 drivers/iio/proximity/ping.c                  |  1 -
 .../iio/proximity/pulsedlight-lidar-lite-v2.c |  1 -
 drivers/iio/proximity/rfd77402.c              |  1 -
 drivers/iio/proximity/srf04.c                 |  1 -
 drivers/iio/proximity/srf08.c                 |  1 -
 drivers/iio/proximity/sx9310.c                |  1 -
 drivers/iio/proximity/sx9500.c                |  1 -
 drivers/iio/proximity/vl53l0x-i2c.c           |  1 -
 drivers/iio/resolver/ad2s1200.c               |  1 -
 drivers/iio/resolver/ad2s90.c                 |  1 -
 .../iio/temperature/hid-sensor-temperature.c  |  1 -
 drivers/iio/temperature/iqs620at-temp.c       |  1 -
 drivers/iio/temperature/ltc2983.c             |  1 -
 drivers/iio/temperature/max31856.c            |  1 -
 drivers/iio/temperature/maxim_thermocouple.c  |  1 -
 drivers/iio/temperature/mlx90614.c            |  1 -
 drivers/iio/temperature/mlx90632.c            |  1 -
 drivers/iio/temperature/tmp006.c              |  1 -
 drivers/iio/temperature/tmp007.c              |  1 -
 drivers/iio/temperature/tsys01.c              |  1 -
 drivers/iio/temperature/tsys02d.c             |  1 -
 drivers/iio/trigger/stm32-timer-trigger.c     |  1 -
 drivers/input/touchscreen/tsc2007_iio.c       |  1 -
 drivers/platform/x86/toshiba_acpi.c           |  3 +--
 drivers/staging/iio/Documentation/device.txt  |  4 +---
 drivers/staging/iio/accel/adis16203.c         |  1 -
 drivers/staging/iio/accel/adis16240.c         |  1 -
 drivers/staging/iio/adc/ad7280a.c             |  1 -
 drivers/staging/iio/adc/ad7816.c              |  1 -
 drivers/staging/iio/addac/adt7316.c           |  1 -
 drivers/staging/iio/cdc/ad7150.c              |  2 --
 drivers/staging/iio/cdc/ad7746.c              |  2 --
 drivers/staging/iio/frequency/ad9832.c        |  1 -
 drivers/staging/iio/frequency/ad9834.c        |  1 -
 .../staging/iio/impedance-analyzer/ad5933.c   |  1 -
 drivers/staging/iio/resolver/ad2s1210.c       |  1 -
 include/linux/iio/iio.h                       | 24 +++++++++++++++++--
 335 files changed, 39 insertions(+), 358 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2 1/6] iio: core: pass parent device as parameter during allocation
  2020-06-03 11:40 [PATCH v2 0/6] iio: core: pass parent device as parameter during allocation Alexandru Ardelean
@ 2020-06-03 11:40 ` Alexandru Ardelean
  2020-06-06 15:24   ` Jonathan Cameron
  2020-06-03 11:40 ` [PATCH v2 2/6] iio: core: add iio_device_set_parent() helper Alexandru Ardelean
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 18+ messages in thread
From: Alexandru Ardelean @ 2020-06-03 11:40 UTC (permalink / raw)
  To: linux-iio, linux-kernel; +Cc: johan, andy.shevchenko, Alexandru Ardelean

The change passes the parent device to the iio_device_alloc() call. This
also updates the devm_iio_device_alloc() call to consider the device object
as the parent device by default.

Having it passed like this, should ensure that any IIO device object
already has a device object as parent, allowing for neater control, like
passing the 'indio_dev' object for other stuff [like buffers/triggers/etc],
and potentially creating iiom_xxx(indio_dev) functions.

With this patch, only the 'drivers/platform/x86/toshiba_acpi.c' needs an
update to pass the parent object as a parameter.

In the next patch all devm_iio_device_alloc() calls will be handled.

Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
 drivers/iio/dummy/iio_simple_dummy.c         | 14 ++++++++------
 drivers/iio/industrialio-core.c              | 11 ++++++-----
 drivers/platform/x86/toshiba_acpi.c          |  3 +--
 drivers/staging/iio/Documentation/device.txt |  4 +---
 include/linux/iio/iio.h                      |  4 ++--
 5 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/iio/dummy/iio_simple_dummy.c b/drivers/iio/dummy/iio_simple_dummy.c
index 6cb02299a215..b35ae7c039f7 100644
--- a/drivers/iio/dummy/iio_simple_dummy.c
+++ b/drivers/iio/dummy/iio_simple_dummy.c
@@ -566,6 +566,13 @@ static struct iio_sw_device *iio_dummy_probe(const char *name)
 	struct iio_dev *indio_dev;
 	struct iio_dummy_state *st;
 	struct iio_sw_device *swd;
+	struct device *parent = NULL;
+
+	/*
+	 * With hardware: Set the parent device.
+	 * parent = &spi->dev;
+	 * parent = &client->dev;
+	 */
 
 	swd = kzalloc(sizeof(*swd), GFP_KERNEL);
 	if (!swd) {
@@ -580,7 +587,7 @@ static struct iio_sw_device *iio_dummy_probe(const char *name)
 	 * It also has a region (accessed by iio_priv()
 	 * for chip specific state information.
 	 */
-	indio_dev = iio_device_alloc(sizeof(*st));
+	indio_dev = iio_device_alloc(parent, sizeof(*st));
 	if (!indio_dev) {
 		ret = -ENOMEM;
 		goto error_ret;
@@ -590,11 +597,6 @@ static struct iio_sw_device *iio_dummy_probe(const char *name)
 	mutex_init(&st->lock);
 
 	iio_dummy_init_device(indio_dev);
-	/*
-	 * With hardware: Set the parent device.
-	 * indio_dev->dev.parent = &spi->dev;
-	 * indio_dev->dev.parent = &client->dev;
-	 */
 
 	 /*
 	 * Make the iio_dev struct available to remove function.
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 1527f01a44f1..75661661aaba 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -1493,7 +1493,7 @@ struct device_type iio_device_type = {
  * iio_device_alloc() - allocate an iio_dev from a driver
  * @sizeof_priv:	Space to allocate for private structure.
  **/
-struct iio_dev *iio_device_alloc(int sizeof_priv)
+struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv)
 {
 	struct iio_dev *dev;
 	size_t alloc_size;
@@ -1510,6 +1510,7 @@ struct iio_dev *iio_device_alloc(int sizeof_priv)
 	if (!dev)
 		return NULL;
 
+	dev->dev.parent = parent;
 	dev->dev.groups = dev->groups;
 	dev->dev.type = &iio_device_type;
 	dev->dev.bus = &iio_bus_type;
@@ -1551,7 +1552,7 @@ static void devm_iio_device_release(struct device *dev, void *res)
 
 /**
  * devm_iio_device_alloc - Resource-managed iio_device_alloc()
- * @dev:		Device to allocate iio_dev for
+ * @parent:		Device to allocate iio_dev for, and parent for this IIO device
  * @sizeof_priv:	Space to allocate for private structure.
  *
  * Managed iio_device_alloc. iio_dev allocated with this function is
@@ -1560,7 +1561,7 @@ static void devm_iio_device_release(struct device *dev, void *res)
  * RETURNS:
  * Pointer to allocated iio_dev on success, NULL on failure.
  */
-struct iio_dev *devm_iio_device_alloc(struct device *dev, int sizeof_priv)
+struct iio_dev *devm_iio_device_alloc(struct device *parent, int sizeof_priv)
 {
 	struct iio_dev **ptr, *iio_dev;
 
@@ -1569,10 +1570,10 @@ struct iio_dev *devm_iio_device_alloc(struct device *dev, int sizeof_priv)
 	if (!ptr)
 		return NULL;
 
-	iio_dev = iio_device_alloc(sizeof_priv);
+	iio_dev = iio_device_alloc(parent, sizeof_priv);
 	if (iio_dev) {
 		*ptr = iio_dev;
-		devres_add(dev, ptr);
+		devres_add(parent, ptr);
 	} else {
 		devres_free(ptr);
 	}
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 808944546739..4a4d09c352dd 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -3128,7 +3128,7 @@ static int toshiba_acpi_add(struct acpi_device *acpi_dev)
 
 	toshiba_accelerometer_available(dev);
 	if (dev->accelerometer_supported) {
-		dev->indio_dev = iio_device_alloc(sizeof(*dev));
+		dev->indio_dev = iio_device_alloc(&acpi_dev->dev, sizeof(*dev));
 		if (!dev->indio_dev) {
 			pr_err("Unable to allocate iio device\n");
 			goto iio_error;
@@ -3138,7 +3138,6 @@ static int toshiba_acpi_add(struct acpi_device *acpi_dev)
 
 		dev->indio_dev->info = &toshiba_iio_accel_info;
 		dev->indio_dev->name = "Toshiba accelerometer";
-		dev->indio_dev->dev.parent = &acpi_dev->dev;
 		dev->indio_dev->modes = INDIO_DIRECT_MODE;
 		dev->indio_dev->channels = toshiba_iio_accel_channels;
 		dev->indio_dev->num_channels =
diff --git a/drivers/staging/iio/Documentation/device.txt b/drivers/staging/iio/Documentation/device.txt
index ec42544a46aa..0d1275b1eb3f 100644
--- a/drivers/staging/iio/Documentation/device.txt
+++ b/drivers/staging/iio/Documentation/device.txt
@@ -8,7 +8,7 @@ The crucial structure for device drivers in iio is iio_dev.
 
 First allocate one using:
 
-struct iio_dev *indio_dev = iio_device_alloc(sizeof(struct chip_state));
+struct iio_dev *indio_dev = iio_device_alloc(parent, sizeof(struct chip_state));
 where chip_state is a structure of local state data for this instance of
 the chip.
 
@@ -16,8 +16,6 @@ That data can be accessed using iio_priv(struct iio_dev *).
 
 Then fill in the following:
 
-- indio_dev->dev.parent
-	Struct device associated with the underlying hardware.
 - indio_dev->name
 	Name of the device being driven - made available as the name
 	attribute in sysfs.
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index a1be82e74c93..91a69f4751aa 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -676,7 +676,7 @@ static inline void *iio_device_get_drvdata(struct iio_dev *indio_dev)
 
 /* Can we make this smaller? */
 #define IIO_ALIGN L1_CACHE_BYTES
-struct iio_dev *iio_device_alloc(int sizeof_priv);
+struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv);
 
 static inline void *iio_priv(const struct iio_dev *indio_dev)
 {
@@ -690,7 +690,7 @@ static inline struct iio_dev *iio_priv_to_dev(void *priv)
 }
 
 void iio_device_free(struct iio_dev *indio_dev);
-struct iio_dev *devm_iio_device_alloc(struct device *dev, int sizeof_priv);
+struct iio_dev *devm_iio_device_alloc(struct device *parent, int sizeof_priv);
 struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,
 						const char *fmt, ...);
 /**
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 2/6] iio: core: add iio_device_set_parent() helper
  2020-06-03 11:40 [PATCH v2 0/6] iio: core: pass parent device as parameter during allocation Alexandru Ardelean
  2020-06-03 11:40 ` [PATCH v2 1/6] " Alexandru Ardelean
@ 2020-06-03 11:40 ` Alexandru Ardelean
  2020-06-06 15:25   ` Jonathan Cameron
  2020-06-03 11:40 ` [PATCH v2 4/6] iio: remove left-over comments about parent assignment Alexandru Ardelean
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 18+ messages in thread
From: Alexandru Ardelean @ 2020-06-03 11:40 UTC (permalink / raw)
  To: linux-iio, linux-kernel; +Cc: johan, andy.shevchenko, Alexandru Ardelean

By default, the device allocation will also assign a parent device to the
IIO device object. In cases where devm_iio_device_alloc() is used,
sometimes the parent device must be different than the device used to
manage the allocation.

In that case, this helper should be used to change the parent, hence the
requirement to call this between allocation & registration.

This pattern/requirement is not very common in the IIO space, and it may be
cleaned up later.
But until then, assigning the parent manually between allocation &
registration is slightly easier.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
 include/linux/iio/iio.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 91a69f4751aa..5784f8c9508f 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -649,6 +649,26 @@ static inline struct iio_dev *iio_device_get(struct iio_dev *indio_dev)
 	return indio_dev ? dev_to_iio_dev(get_device(&indio_dev->dev)) : NULL;
 }
 
+/**
+ * iio_device_set_parent() - assign parent device to the IIO device object
+ * @indio_dev: 		IIO device structure
+ * @parent:		reference to parent device object
+ *
+ * This utility must be called between IIO device allocation
+ * (via devm_iio_device_alloc()) & IIO device registration
+ * (via {devm_}iio_device_register()).
+ * By default, the device allocation will also assign a parent device to
+ * the IIO device object. In cases where devm_iio_device_alloc() is used,
+ * sometimes the parent device must be different than the device used to
+ * manage the allocation.
+ * In that case, this helper should be used to change the parent, hence the
+ * requirement to call this between allocation & registration.
+ **/
+static inline void iio_device_set_parent(struct iio_dev *indio_dev,
+					 struct device *parent)
+{
+	indio_dev->dev.parent = parent;
+}
 
 /**
  * iio_device_set_drvdata() - Set device driver data
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 4/6] iio: remove left-over comments about parent assignment
  2020-06-03 11:40 [PATCH v2 0/6] iio: core: pass parent device as parameter during allocation Alexandru Ardelean
  2020-06-03 11:40 ` [PATCH v2 1/6] " Alexandru Ardelean
  2020-06-03 11:40 ` [PATCH v2 2/6] iio: core: add iio_device_set_parent() helper Alexandru Ardelean
@ 2020-06-03 11:40 ` Alexandru Ardelean
  2020-06-06 15:46   ` Jonathan Cameron
  2020-06-03 11:40 ` [PATCH v2 5/6] iio: light: lm3533-als: use iio_device_set_parent() to assign parent Alexandru Ardelean
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 18+ messages in thread
From: Alexandru Ardelean @ 2020-06-03 11:40 UTC (permalink / raw)
  To: linux-iio, linux-kernel; +Cc: johan, andy.shevchenko, Alexandru Ardelean

These were obtained by doing a 'git diff | grep \/\*', in the previous diff
to find comments. These needed a bit more manual review, as the semantic
patch isn't great for catching these.

The result is:
 	/* Initialize Counter device and driver data */
 	/* Initialize IIO device */
 	/* Establish that the iio_dev is a child of the spi device */
 	/* Estabilish that the iio_dev is a child of the spi device */
 	/* Initiate the Industrial I/O device */
 	/* Establish that the iio_dev is a child of the device */
-	/* establish that the iio_dev is a child of the i2c device */
-	/* establish that the iio_dev is a child of the i2c device */
 	/* This is only used for removal purposes */
 	/* setup the industrialio driver allocated elements */
 	/* variant specific configuration */
 	/* Setup for userspace synchronous on demand sampling. */
 	st->readback_delay_us += 5; /* Add tWAIT */
-	/* Establish that the iio_dev is a child of the i2c device */
 	/* Establish that the iio_dev is a child of the i2c device */

Out of which, 4 are really left-over comments about parent assignment.
3 of them are removed by the semantic patch, as the comment removed (by
spatch) would be for an empty line.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
 drivers/iio/adc/ad7476.c         | 1 -
 drivers/iio/adc/ad7887.c         | 1 -
 drivers/iio/dac/ad5446.c         | 1 -
 drivers/staging/iio/cdc/ad7746.c | 1 -
 4 files changed, 4 deletions(-)

diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c
index e2a69dd6a47e..6286e230f55b 100644
--- a/drivers/iio/adc/ad7476.c
+++ b/drivers/iio/adc/ad7476.c
@@ -300,7 +300,6 @@ static int ad7476_probe(struct spi_device *spi)
 
 	st->spi = spi;
 
-	/* Establish that the iio_dev is a child of the spi device */
 	indio_dev->dev.of_node = spi->dev.of_node;
 	indio_dev->name = spi_get_device_id(spi)->name;
 	indio_dev->modes = INDIO_DIRECT_MODE;
diff --git a/drivers/iio/adc/ad7887.c b/drivers/iio/adc/ad7887.c
index ca4c98401ebc..0f93f5c8965d 100644
--- a/drivers/iio/adc/ad7887.c
+++ b/drivers/iio/adc/ad7887.c
@@ -264,7 +264,6 @@ static int ad7887_probe(struct spi_device *spi)
 	spi_set_drvdata(spi, indio_dev);
 	st->spi = spi;
 
-	/* Estabilish that the iio_dev is a child of the spi device */
 	indio_dev->dev.of_node = spi->dev.of_node;
 	indio_dev->name = spi_get_device_id(spi)->name;
 	indio_dev->info = &ad7887_info;
diff --git a/drivers/iio/dac/ad5446.c b/drivers/iio/dac/ad5446.c
index e01ba90dc106..5931bd630c4e 100644
--- a/drivers/iio/dac/ad5446.c
+++ b/drivers/iio/dac/ad5446.c
@@ -250,7 +250,6 @@ static int ad5446_probe(struct device *dev, const char *name,
 	st->reg = reg;
 	st->dev = dev;
 
-	/* Establish that the iio_dev is a child of the device */
 	indio_dev->name = name;
 	indio_dev->info = &ad5446_info;
 	indio_dev->modes = INDIO_DIRECT_MODE;
diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c
index bd9803c7c5b6..dfd71e99e872 100644
--- a/drivers/staging/iio/cdc/ad7746.c
+++ b/drivers/staging/iio/cdc/ad7746.c
@@ -693,7 +693,6 @@ static int ad7746_probe(struct i2c_client *client,
 	chip->client = client;
 	chip->capdac_set = -1;
 
-	/* Establish that the iio_dev is a child of the i2c device */
 	indio_dev->name = id->name;
 	indio_dev->info = &ad7746_info;
 	indio_dev->channels = ad7746_channels;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 5/6] iio: light: lm3533-als: use iio_device_set_parent() to assign parent
  2020-06-03 11:40 [PATCH v2 0/6] iio: core: pass parent device as parameter during allocation Alexandru Ardelean
                   ` (2 preceding siblings ...)
  2020-06-03 11:40 ` [PATCH v2 4/6] iio: remove left-over comments about parent assignment Alexandru Ardelean
@ 2020-06-03 11:40 ` Alexandru Ardelean
  2020-06-06 15:46   ` Jonathan Cameron
  2020-06-03 11:40 ` [PATCH v2 6/6] iio: remove left-over parent assignments Alexandru Ardelean
  2020-06-03 11:41 ` [PATCH v2 0/6] iio: core: pass parent device as parameter during allocation Ardelean, Alexandru
  5 siblings, 1 reply; 18+ messages in thread
From: Alexandru Ardelean @ 2020-06-03 11:40 UTC (permalink / raw)
  To: linux-iio, linux-kernel; +Cc: johan, andy.shevchenko, Alexandru Ardelean

This assignment is the more peculiar as it assigns the parent of the
platform-device's device (i.e. pdev->dev.parent) as the IIO device's
parent.

Since the devm_iio_device_alloc() [now] assigns the device argument as the
default parent (and since this is the more common case), for cases
where the parent needs to be different, the iio_device_set_parent helper
should be used.

That makes things a bit more obvious about the new behavior of
devm_iio_device_alloc() and makes it clearer that iio_device_set_parent()
should be used.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
 drivers/iio/light/lm3533-als.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/light/lm3533-als.c b/drivers/iio/light/lm3533-als.c
index bc196c212881..8a621244dd01 100644
--- a/drivers/iio/light/lm3533-als.c
+++ b/drivers/iio/light/lm3533-als.c
@@ -852,7 +852,7 @@ static int lm3533_als_probe(struct platform_device *pdev)
 	indio_dev->channels = lm3533_als_channels;
 	indio_dev->num_channels = ARRAY_SIZE(lm3533_als_channels);
 	indio_dev->name = dev_name(&pdev->dev);
-	indio_dev->dev.parent = pdev->dev.parent;
+	iio_device_set_parent(indio_dev, pdev->dev.parent);
 	indio_dev->modes = INDIO_DIRECT_MODE;
 
 	als = iio_priv(indio_dev);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 6/6] iio: remove left-over parent assignments
  2020-06-03 11:40 [PATCH v2 0/6] iio: core: pass parent device as parameter during allocation Alexandru Ardelean
                   ` (3 preceding siblings ...)
  2020-06-03 11:40 ` [PATCH v2 5/6] iio: light: lm3533-als: use iio_device_set_parent() to assign parent Alexandru Ardelean
@ 2020-06-03 11:40 ` Alexandru Ardelean
  2020-06-06 16:05   ` Jonathan Cameron
  2020-06-03 11:41 ` [PATCH v2 0/6] iio: core: pass parent device as parameter during allocation Ardelean, Alexandru
  5 siblings, 1 reply; 18+ messages in thread
From: Alexandru Ardelean @ 2020-06-03 11:40 UTC (permalink / raw)
  To: linux-iio, linux-kernel; +Cc: johan, andy.shevchenko, Alexandru Ardelean

These were found by doing some shell magic:
------------
for file in $(git grep -w devm_iio_device_alloc | cut -d: -f1 | sort | uniq) ; do
	if grep 'parent =' $file | grep -v trig | grep -vq devm_; then
		echo "$file -> $(grep "parent =" $file)"
	fi
done
-----------

The output is bearable [after the semantic patch is applied].
There is a mix of trigger assignments with some iio device parent
assignments that are removed via this patch.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
 drivers/iio/accel/kxcjk-1013.c                    | 1 -
 drivers/iio/accel/mma8452.c                       | 1 -
 drivers/iio/accel/mma9553.c                       | 1 -
 drivers/iio/adc/ad7192.c                          | 1 -
 drivers/iio/adc/hx711.c                           | 1 -
 drivers/iio/adc/max1363.c                         | 2 --
 drivers/iio/adc/mcp3911.c                         | 1 -
 drivers/iio/adc/qcom-spmi-iadc.c                  | 1 -
 drivers/iio/amplifiers/ad8366.c                   | 1 -
 drivers/iio/chemical/vz89x.c                      | 1 -
 drivers/iio/dac/ad5770r.c                         | 1 -
 drivers/iio/health/afe4403.c                      | 1 -
 drivers/iio/health/afe4404.c                      | 1 -
 drivers/iio/humidity/dht11.c                      | 1 -
 drivers/iio/humidity/hts221_core.c                | 1 -
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c        | 1 -
 drivers/iio/light/cm3605.c                        | 1 -
 drivers/iio/light/ltr501.c                        | 1 -
 drivers/iio/magnetometer/ak8975.c                 | 1 -
 drivers/iio/orientation/hid-sensor-rotation.c     | 1 -
 drivers/iio/potentiostat/lmp91000.c               | 1 -
 drivers/iio/proximity/ping.c                      | 1 -
 drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 1 -
 drivers/iio/proximity/srf04.c                     | 1 -
 drivers/iio/proximity/srf08.c                     | 1 -
 drivers/iio/temperature/tsys01.c                  | 1 -
 drivers/staging/iio/addac/adt7316.c               | 1 -
 27 files changed, 28 deletions(-)

diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
index c9924a65c32a..6b93521c0e17 100644
--- a/drivers/iio/accel/kxcjk-1013.c
+++ b/drivers/iio/accel/kxcjk-1013.c
@@ -1311,7 +1311,6 @@ static int kxcjk1013_probe(struct i2c_client *client,
 
 	mutex_init(&data->mutex);
 
-	indio_dev->dev.parent = &client->dev;
 	indio_dev->channels = kxcjk1013_channels;
 	indio_dev->num_channels = ARRAY_SIZE(kxcjk1013_channels);
 	indio_dev->available_scan_masks = kxcjk1013_scan_masks;
diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
index 00e100fc845a..ef3df402fc3c 100644
--- a/drivers/iio/accel/mma8452.c
+++ b/drivers/iio/accel/mma8452.c
@@ -1592,7 +1592,6 @@ static int mma8452_probe(struct i2c_client *client,
 	i2c_set_clientdata(client, indio_dev);
 	indio_dev->info = &mma8452_info;
 	indio_dev->name = id->name;
-	indio_dev->dev.parent = &client->dev;
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->channels = data->chip_info->channels;
 	indio_dev->num_channels = data->chip_info->num_channels;
diff --git a/drivers/iio/accel/mma9553.c b/drivers/iio/accel/mma9553.c
index 312070dcf035..c15908faa381 100644
--- a/drivers/iio/accel/mma9553.c
+++ b/drivers/iio/accel/mma9553.c
@@ -1103,7 +1103,6 @@ static int mma9553_probe(struct i2c_client *client,
 	if (ret < 0)
 		return ret;
 
-	indio_dev->dev.parent = &client->dev;
 	indio_dev->channels = mma9553_channels;
 	indio_dev->num_channels = ARRAY_SIZE(mma9553_channels);
 	indio_dev->name = name;
diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
index 08ba1a8f05eb..a0837d7e9176 100644
--- a/drivers/iio/adc/ad7192.c
+++ b/drivers/iio/adc/ad7192.c
@@ -970,7 +970,6 @@ static int ad7192_probe(struct spi_device *spi)
 
 	spi_set_drvdata(spi, indio_dev);
 	st->chip_info = of_device_get_match_data(&spi->dev);
-	indio_dev->dev.parent = &spi->dev;
 	indio_dev->name = st->chip_info->name;
 	indio_dev->modes = INDIO_DIRECT_MODE;
 
diff --git a/drivers/iio/adc/hx711.c b/drivers/iio/adc/hx711.c
index c8686558429b..6a173531d355 100644
--- a/drivers/iio/adc/hx711.c
+++ b/drivers/iio/adc/hx711.c
@@ -551,7 +551,6 @@ static int hx711_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, indio_dev);
 
 	indio_dev->name = "hx711";
-	indio_dev->dev.parent = &pdev->dev;
 	indio_dev->info = &hx711_iio_info;
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->channels = hx711_chan_spec;
diff --git a/drivers/iio/adc/max1363.c b/drivers/iio/adc/max1363.c
index 9d92017c79b2..cc1ba7bfc8e6 100644
--- a/drivers/iio/adc/max1363.c
+++ b/drivers/iio/adc/max1363.c
@@ -1652,8 +1652,6 @@ static int max1363_probe(struct i2c_client *client,
 	if (ret)
 		goto error_disable_reg;
 
-	/* Establish that the iio_dev is a child of the i2c device */
-	indio_dev->dev.parent = &client->dev;
 	indio_dev->dev.of_node = client->dev.of_node;
 	indio_dev->name = id->name;
 	indio_dev->channels = st->chip_info->channels;
diff --git a/drivers/iio/adc/mcp3911.c b/drivers/iio/adc/mcp3911.c
index dd52f08ec82e..818b92518c66 100644
--- a/drivers/iio/adc/mcp3911.c
+++ b/drivers/iio/adc/mcp3911.c
@@ -293,7 +293,6 @@ static int mcp3911_probe(struct spi_device *spi)
 	if (ret)
 		goto clk_disable;
 
-	indio_dev->dev.parent = &spi->dev;
 	indio_dev->dev.of_node = spi->dev.of_node;
 	indio_dev->name = spi_get_device_id(spi)->name;
 	indio_dev->modes = INDIO_DIRECT_MODE;
diff --git a/drivers/iio/adc/qcom-spmi-iadc.c b/drivers/iio/adc/qcom-spmi-iadc.c
index 46858eddf1c3..1c90ad33a881 100644
--- a/drivers/iio/adc/qcom-spmi-iadc.c
+++ b/drivers/iio/adc/qcom-spmi-iadc.c
@@ -553,7 +553,6 @@ static int iadc_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	indio_dev->dev.parent = dev;
 	indio_dev->dev.of_node = node;
 	indio_dev->name = pdev->name;
 	indio_dev->modes = INDIO_DIRECT_MODE;
diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad8366.c
index 62167b87caea..2595e9cb0b2d 100644
--- a/drivers/iio/amplifiers/ad8366.c
+++ b/drivers/iio/amplifiers/ad8366.c
@@ -274,7 +274,6 @@ static int ad8366_probe(struct spi_device *spi)
 	}
 
 	st->info = &ad8366_infos[st->type];
-	indio_dev->dev.parent = &spi->dev;
 	indio_dev->name = spi_get_device_id(spi)->name;
 	indio_dev->info = &ad8366_info;
 	indio_dev->modes = INDIO_DIRECT_MODE;
diff --git a/drivers/iio/chemical/vz89x.c b/drivers/iio/chemical/vz89x.c
index 415b39339d4e..5586eb8e12cd 100644
--- a/drivers/iio/chemical/vz89x.c
+++ b/drivers/iio/chemical/vz89x.c
@@ -382,7 +382,6 @@ static int vz89x_probe(struct i2c_client *client,
 	data->last_update = jiffies - HZ;
 	mutex_init(&data->lock);
 
-	indio_dev->dev.parent = &client->dev;
 	indio_dev->info = &vz89x_info;
 	indio_dev->name = dev_name(&client->dev);
 	indio_dev->modes = INDIO_DIRECT_MODE;
diff --git a/drivers/iio/dac/ad5770r.c b/drivers/iio/dac/ad5770r.c
index 2d7623b9b2c0..84dcf149261f 100644
--- a/drivers/iio/dac/ad5770r.c
+++ b/drivers/iio/dac/ad5770r.c
@@ -651,7 +651,6 @@ static int ad5770r_probe(struct spi_device *spi)
 		}
 	}
 
-	indio_dev->dev.parent = &spi->dev;
 	indio_dev->name = spi_get_device_id(spi)->name;
 	indio_dev->info = &ad5770r_info;
 	indio_dev->modes = INDIO_DIRECT_MODE;
diff --git a/drivers/iio/health/afe4403.c b/drivers/iio/health/afe4403.c
index e9f87e42ff4f..ed230f12b2f8 100644
--- a/drivers/iio/health/afe4403.c
+++ b/drivers/iio/health/afe4403.c
@@ -509,7 +509,6 @@ static int afe4403_probe(struct spi_device *spi)
 	}
 
 	indio_dev->modes = INDIO_DIRECT_MODE;
-	indio_dev->dev.parent = afe->dev;
 	indio_dev->channels = afe4403_channels;
 	indio_dev->num_channels = ARRAY_SIZE(afe4403_channels);
 	indio_dev->name = AFE4403_DRIVER_NAME;
diff --git a/drivers/iio/health/afe4404.c b/drivers/iio/health/afe4404.c
index e728bbb21ca8..3a3efae4695a 100644
--- a/drivers/iio/health/afe4404.c
+++ b/drivers/iio/health/afe4404.c
@@ -517,7 +517,6 @@ static int afe4404_probe(struct i2c_client *client,
 	}
 
 	indio_dev->modes = INDIO_DIRECT_MODE;
-	indio_dev->dev.parent = afe->dev;
 	indio_dev->channels = afe4404_channels;
 	indio_dev->num_channels = ARRAY_SIZE(afe4404_channels);
 	indio_dev->name = AFE4404_DRIVER_NAME;
diff --git a/drivers/iio/humidity/dht11.c b/drivers/iio/humidity/dht11.c
index d05c6fdb758b..9a7819817488 100644
--- a/drivers/iio/humidity/dht11.c
+++ b/drivers/iio/humidity/dht11.c
@@ -321,7 +321,6 @@ static int dht11_probe(struct platform_device *pdev)
 	init_completion(&dht11->completion);
 	mutex_init(&dht11->lock);
 	iio->name = pdev->name;
-	iio->dev.parent = &pdev->dev;
 	iio->info = &dht11_iio_info;
 	iio->modes = INDIO_DIRECT_MODE;
 	iio->channels = dht11_chan_spec;
diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
index 7ce1bd1defa0..16657789dc45 100644
--- a/drivers/iio/humidity/hts221_core.c
+++ b/drivers/iio/humidity/hts221_core.c
@@ -572,7 +572,6 @@ int hts221_probe(struct device *dev, int irq, const char *name,
 		return err;
 
 	iio_dev->modes = INDIO_DIRECT_MODE;
-	iio_dev->dev.parent = hw->dev;
 	iio_dev->available_scan_masks = hts221_scan_masks;
 	iio_dev->channels = hts221_channels;
 	iio_dev->num_channels = ARRAY_SIZE(hts221_channels);
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index 4d604fe842e5..153f855db8d6 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -1530,7 +1530,6 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,
 	}
 
 	dev_set_drvdata(dev, indio_dev);
-	indio_dev->dev.parent = dev;
 	/* name will be NULL when enumerated via ACPI */
 	if (name)
 		indio_dev->name = name;
diff --git a/drivers/iio/light/cm3605.c b/drivers/iio/light/cm3605.c
index 964ede49f662..4c83953672be 100644
--- a/drivers/iio/light/cm3605.c
+++ b/drivers/iio/light/cm3605.c
@@ -239,7 +239,6 @@ static int cm3605_probe(struct platform_device *pdev)
 	led_trigger_register_simple("cm3605", &cm3605->led);
 	led_trigger_event(cm3605->led, LED_FULL);
 
-	indio_dev->dev.parent = dev;
 	indio_dev->info = &cm3605_info;
 	indio_dev->name = "cm3605";
 	indio_dev->channels = cm3605_channels;
diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
index 5a3fcb127cd2..4bac0646398d 100644
--- a/drivers/iio/light/ltr501.c
+++ b/drivers/iio/light/ltr501.c
@@ -1480,7 +1480,6 @@ static int ltr501_probe(struct i2c_client *client,
 	if ((partid >> 4) != data->chip_info->partid)
 		return -ENODEV;
 
-	indio_dev->dev.parent = &client->dev;
 	indio_dev->info = data->chip_info->info;
 	indio_dev->channels = data->chip_info->channels;
 	indio_dev->num_channels = data->chip_info->no_channels;
diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c
index a23422aad97d..03d71f796177 100644
--- a/drivers/iio/magnetometer/ak8975.c
+++ b/drivers/iio/magnetometer/ak8975.c
@@ -940,7 +940,6 @@ static int ak8975_probe(struct i2c_client *client,
 	}
 
 	mutex_init(&data->lock);
-	indio_dev->dev.parent = &client->dev;
 	indio_dev->channels = ak8975_channels;
 	indio_dev->num_channels = ARRAY_SIZE(ak8975_channels);
 	indio_dev->info = &ak8975_info;
diff --git a/drivers/iio/orientation/hid-sensor-rotation.c b/drivers/iio/orientation/hid-sensor-rotation.c
index b99f41240e3e..23bc61a7f018 100644
--- a/drivers/iio/orientation/hid-sensor-rotation.c
+++ b/drivers/iio/orientation/hid-sensor-rotation.c
@@ -281,7 +281,6 @@ static int hid_dev_rot_probe(struct platform_device *pdev)
 	}
 
 	indio_dev->num_channels = ARRAY_SIZE(dev_rot_channels);
-	indio_dev->dev.parent = &pdev->dev;
 	indio_dev->info = &dev_rot_info;
 	indio_dev->name = name;
 	indio_dev->modes = INDIO_DIRECT_MODE;
diff --git a/drivers/iio/potentiostat/lmp91000.c b/drivers/iio/potentiostat/lmp91000.c
index 2cb11da18e0f..2d601889c8c0 100644
--- a/drivers/iio/potentiostat/lmp91000.c
+++ b/drivers/iio/potentiostat/lmp91000.c
@@ -321,7 +321,6 @@ static int lmp91000_probe(struct i2c_client *client,
 	indio_dev->channels = lmp91000_channels;
 	indio_dev->num_channels = ARRAY_SIZE(lmp91000_channels);
 	indio_dev->name = LMP91000_DRV_NAME;
-	indio_dev->dev.parent = &client->dev;
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	i2c_set_clientdata(client, indio_dev);
 
diff --git a/drivers/iio/proximity/ping.c b/drivers/iio/proximity/ping.c
index 2e99eeb27f2e..1283ac1c2e03 100644
--- a/drivers/iio/proximity/ping.c
+++ b/drivers/iio/proximity/ping.c
@@ -309,7 +309,6 @@ static int ping_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, indio_dev);
 
 	indio_dev->name = "ping";
-	indio_dev->dev.parent = &pdev->dev;
 	indio_dev->info = &ping_iio_info;
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->channels = ping_chan_spec;
diff --git a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
index 5b369645ef49..a8e716dbd24e 100644
--- a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
+++ b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
@@ -270,7 +270,6 @@ static int lidar_probe(struct i2c_client *client,
 	indio_dev->name = LIDAR_DRV_NAME;
 	indio_dev->channels = lidar_channels;
 	indio_dev->num_channels = ARRAY_SIZE(lidar_channels);
-	indio_dev->dev.parent = &client->dev;
 	indio_dev->modes = INDIO_DIRECT_MODE;
 
 	i2c_set_clientdata(client, indio_dev);
diff --git a/drivers/iio/proximity/srf04.c b/drivers/iio/proximity/srf04.c
index 568b76e06385..2a3acff431d7 100644
--- a/drivers/iio/proximity/srf04.c
+++ b/drivers/iio/proximity/srf04.c
@@ -317,7 +317,6 @@ static int srf04_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, indio_dev);
 
 	indio_dev->name = "srf04";
-	indio_dev->dev.parent = &pdev->dev;
 	indio_dev->info = &srf04_iio_info;
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->channels = srf04_chan_spec;
diff --git a/drivers/iio/proximity/srf08.c b/drivers/iio/proximity/srf08.c
index b23ce446b7be..6677221d5818 100644
--- a/drivers/iio/proximity/srf08.c
+++ b/drivers/iio/proximity/srf08.c
@@ -483,7 +483,6 @@ static int srf08_probe(struct i2c_client *client,
 	}
 
 	indio_dev->name = id->name;
-	indio_dev->dev.parent = &client->dev;
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->channels = srf08_channels;
 	indio_dev->num_channels = ARRAY_SIZE(srf08_channels);
diff --git a/drivers/iio/temperature/tsys01.c b/drivers/iio/temperature/tsys01.c
index d41f050c2fea..2c631a1ca33b 100644
--- a/drivers/iio/temperature/tsys01.c
+++ b/drivers/iio/temperature/tsys01.c
@@ -160,7 +160,6 @@ static int tsys01_probe(struct iio_dev *indio_dev, struct device *dev)
 
 	indio_dev->info = &tsys01_info;
 	indio_dev->name = dev->driver->name;
-	indio_dev->dev.parent = dev;
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->channels = tsys01_channels;
 	indio_dev->num_channels = ARRAY_SIZE(tsys01_channels);
diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c
index 9cb3d0e42c38..ccbafcaaf27e 100644
--- a/drivers/staging/iio/addac/adt7316.c
+++ b/drivers/staging/iio/addac/adt7316.c
@@ -2171,7 +2171,6 @@ int adt7316_probe(struct device *dev, struct adt7316_bus *bus,
 	if ((chip->id & ID_FAMILY_MASK) == ID_ADT75XX)
 		chip->int_mask |= ADT7516_AIN_INT_MASK;
 
-	indio_dev->dev.parent = dev;
 	if ((chip->id & ID_FAMILY_MASK) == ID_ADT75XX)
 		indio_dev->info = &adt7516_info;
 	else
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 0/6] iio: core: pass parent device as parameter during allocation
  2020-06-03 11:40 [PATCH v2 0/6] iio: core: pass parent device as parameter during allocation Alexandru Ardelean
                   ` (4 preceding siblings ...)
  2020-06-03 11:40 ` [PATCH v2 6/6] iio: remove left-over parent assignments Alexandru Ardelean
@ 2020-06-03 11:41 ` Ardelean, Alexandru
  2020-06-04 17:34   ` Jonathan Cameron
  5 siblings, 1 reply; 18+ messages in thread
From: Ardelean, Alexandru @ 2020-06-03 11:41 UTC (permalink / raw)
  To: linux-kernel, linux-iio; +Cc: andy.shevchenko, jic23, johan

On Wed, 2020-06-03 at 14:40 +0300, Alexandru Ardelean wrote:
> This patch updates the {devm_}iio_device_alloc() functions to automatically
> assign the parent device on allocation.
> For iio_device_alloc() this means a new parameter.
> For devm_iio_device_alloc() this means a new behavior; the device object is
> the parent. For this one, this is the common case for most drivers (except
> one: 'lm3533-als').
> 
> For the special cases an iio_device_set_parent() has been created to change
> the parent betwee allocation & registration.
> The purpose of this helper, is mostly to highlight the new behavior of
> devm_iio_device_alloc().
> 
> This patchset also removes explicit parent assignments from most IIO
> drivers (except for lm3533-als).
> 
> Using a semantic patch, about 303 drivers are updated, and some needed some
> manual attention. This is probably due to some limitations of spatch. At
> least in some cases the parent device is not the same variable as passed to
> devm_iio_device_alloc(), OR the parent assignment is moved to a separate
> function than where devm_iio_device_alloc() is called.
> 

Forgot to explicitly CC Jonathan.
But I'm hoping this shows up from the list.

> Changelog v1 -> v2:
> * added iio_device_set_parent() helper (new commit)
> * update commit for lm3533-als to use iio_device_set_parent()
> 
> Alexandru Ardelean (6):
>   iio: core: pass parent device as parameter during allocation
>   iio: core: add iio_device_set_parent() helper
>   iio: remove explicit IIO device parent assignment
>   iio: remove left-over comments about parent assignment
>   iio: light: lm3533-als: use iio_device_set_parent() to assign parent
>   iio: remove left-over parent assignments
> 
>  drivers/counter/104-quad-8.c                  |  1 -
>  drivers/counter/stm32-lptimer-cnt.c           |  1 -
>  drivers/iio/accel/adis16201.c                 |  1 -
>  drivers/iio/accel/adis16209.c                 |  1 -
>  drivers/iio/accel/adxl345_core.c              |  1 -
>  drivers/iio/accel/adxl372.c                   |  1 -
>  drivers/iio/accel/bma180.c                    |  1 -
>  drivers/iio/accel/bma220_spi.c                |  1 -
>  drivers/iio/accel/bma400_core.c               |  1 -
>  drivers/iio/accel/bmc150-accel-core.c         |  1 -
>  drivers/iio/accel/da280.c                     |  1 -
>  drivers/iio/accel/da311.c                     |  1 -
>  drivers/iio/accel/dmard06.c                   |  1 -
>  drivers/iio/accel/dmard09.c                   |  1 -
>  drivers/iio/accel/dmard10.c                   |  1 -
>  drivers/iio/accel/hid-sensor-accel-3d.c       |  1 -
>  drivers/iio/accel/kxcjk-1013.c                |  1 -
>  drivers/iio/accel/kxsd9.c                     |  1 -
>  drivers/iio/accel/mc3230.c                    |  1 -
>  drivers/iio/accel/mma7455_core.c              |  1 -
>  drivers/iio/accel/mma7660.c                   |  1 -
>  drivers/iio/accel/mma8452.c                   |  1 -
>  drivers/iio/accel/mma9551.c                   |  1 -
>  drivers/iio/accel/mma9553.c                   |  1 -
>  drivers/iio/accel/mxc4005.c                   |  1 -
>  drivers/iio/accel/mxc6255.c                   |  1 -
>  drivers/iio/accel/sca3000.c                   |  1 -
>  drivers/iio/accel/ssp_accel_sensor.c          |  1 -
>  drivers/iio/accel/stk8312.c                   |  1 -
>  drivers/iio/accel/stk8ba50.c                  |  1 -
>  drivers/iio/adc/ab8500-gpadc.c                |  1 -
>  drivers/iio/adc/ad7091r-base.c                |  1 -
>  drivers/iio/adc/ad7124.c                      |  1 -
>  drivers/iio/adc/ad7192.c                      |  1 -
>  drivers/iio/adc/ad7266.c                      |  1 -
>  drivers/iio/adc/ad7291.c                      |  1 -
>  drivers/iio/adc/ad7292.c                      |  1 -
>  drivers/iio/adc/ad7298.c                      |  1 -
>  drivers/iio/adc/ad7476.c                      |  2 --
>  drivers/iio/adc/ad7606.c                      |  1 -
>  drivers/iio/adc/ad7766.c                      |  1 -
>  drivers/iio/adc/ad7768-1.c                    |  1 -
>  drivers/iio/adc/ad7780.c                      |  1 -
>  drivers/iio/adc/ad7791.c                      |  1 -
>  drivers/iio/adc/ad7793.c                      |  1 -
>  drivers/iio/adc/ad7887.c                      |  2 --
>  drivers/iio/adc/ad7923.c                      |  1 -
>  drivers/iio/adc/ad7949.c                      |  1 -
>  drivers/iio/adc/ad799x.c                      |  1 -
>  drivers/iio/adc/adi-axi-adc.c                 |  1 -
>  drivers/iio/adc/aspeed_adc.c                  |  1 -
>  drivers/iio/adc/at91-sama5d2_adc.c            |  1 -
>  drivers/iio/adc/at91_adc.c                    |  1 -
>  drivers/iio/adc/axp20x_adc.c                  |  1 -
>  drivers/iio/adc/axp288_adc.c                  |  1 -
>  drivers/iio/adc/bcm_iproc_adc.c               |  1 -
>  drivers/iio/adc/berlin2-adc.c                 |  1 -
>  drivers/iio/adc/cc10001_adc.c                 |  1 -
>  drivers/iio/adc/cpcap-adc.c                   |  1 -
>  drivers/iio/adc/da9150-gpadc.c                |  1 -
>  drivers/iio/adc/dln2-adc.c                    |  1 -
>  drivers/iio/adc/envelope-detector.c           |  1 -
>  drivers/iio/adc/ep93xx_adc.c                  |  1 -
>  drivers/iio/adc/exynos_adc.c                  |  1 -
>  drivers/iio/adc/fsl-imx25-gcq.c               |  1 -
>  drivers/iio/adc/hi8435.c                      |  1 -
>  drivers/iio/adc/hx711.c                       |  1 -
>  drivers/iio/adc/imx7d_adc.c                   |  1 -
>  drivers/iio/adc/ina2xx-adc.c                  |  1 -
>  drivers/iio/adc/ingenic-adc.c                 |  1 -
>  drivers/iio/adc/intel_mrfld_adc.c             |  1 -
>  drivers/iio/adc/lp8788_adc.c                  |  1 -
>  drivers/iio/adc/lpc18xx_adc.c                 |  1 -
>  drivers/iio/adc/lpc32xx_adc.c                 |  1 -
>  drivers/iio/adc/ltc2471.c                     |  1 -
>  drivers/iio/adc/ltc2485.c                     |  1 -
>  drivers/iio/adc/max1027.c                     |  1 -
>  drivers/iio/adc/max11100.c                    |  1 -
>  drivers/iio/adc/max1118.c                     |  1 -
>  drivers/iio/adc/max1241.c                     |  1 -
>  drivers/iio/adc/max1363.c                     |  2 --
>  drivers/iio/adc/max9611.c                     |  1 -
>  drivers/iio/adc/mcp320x.c                     |  1 -
>  drivers/iio/adc/mcp3422.c                     |  1 -
>  drivers/iio/adc/mcp3911.c                     |  1 -
>  drivers/iio/adc/men_z188_adc.c                |  1 -
>  drivers/iio/adc/meson_saradc.c                |  1 -
>  drivers/iio/adc/mt6577_auxadc.c               |  1 -
>  drivers/iio/adc/mxs-lradc-adc.c               |  1 -
>  drivers/iio/adc/nau7802.c                     |  1 -
>  drivers/iio/adc/npcm_adc.c                    |  1 -
>  drivers/iio/adc/palmas_gpadc.c                |  1 -
>  drivers/iio/adc/qcom-pm8xxx-xoadc.c           |  1 -
>  drivers/iio/adc/qcom-spmi-adc5.c              |  1 -
>  drivers/iio/adc/qcom-spmi-iadc.c              |  1 -
>  drivers/iio/adc/qcom-spmi-vadc.c              |  1 -
>  drivers/iio/adc/rcar-gyroadc.c                |  1 -
>  drivers/iio/adc/rn5t618-adc.c                 |  1 -
>  drivers/iio/adc/rockchip_saradc.c             |  1 -
>  drivers/iio/adc/sc27xx_adc.c                  |  1 -
>  drivers/iio/adc/sd_adc_modulator.c            |  1 -
>  drivers/iio/adc/spear_adc.c                   |  1 -
>  drivers/iio/adc/stm32-adc.c                   |  1 -
>  drivers/iio/adc/stm32-dfsdm-adc.c             |  1 -
>  drivers/iio/adc/stmpe-adc.c                   |  1 -
>  drivers/iio/adc/stx104.c                      |  1 -
>  drivers/iio/adc/sun4i-gpadc-iio.c             |  1 -
>  drivers/iio/adc/ti-adc081c.c                  |  1 -
>  drivers/iio/adc/ti-adc0832.c                  |  1 -
>  drivers/iio/adc/ti-adc084s021.c               |  1 -
>  drivers/iio/adc/ti-adc108s102.c               |  1 -
>  drivers/iio/adc/ti-adc12138.c                 |  1 -
>  drivers/iio/adc/ti-adc128s052.c               |  1 -
>  drivers/iio/adc/ti-adc161s626.c               |  1 -
>  drivers/iio/adc/ti-ads1015.c                  |  1 -
>  drivers/iio/adc/ti-ads124s08.c                |  1 -
>  drivers/iio/adc/ti-ads7950.c                  |  1 -
>  drivers/iio/adc/ti-ads8344.c                  |  1 -
>  drivers/iio/adc/ti-ads8688.c                  |  1 -
>  drivers/iio/adc/ti-tlc4541.c                  |  1 -
>  drivers/iio/adc/ti_am335x_adc.c               |  1 -
>  drivers/iio/adc/twl4030-madc.c                |  1 -
>  drivers/iio/adc/twl6030-gpadc.c               |  1 -
>  drivers/iio/adc/vf610_adc.c                   |  1 -
>  drivers/iio/adc/viperboard_adc.c              |  1 -
>  drivers/iio/adc/xilinx-xadc-core.c            |  1 -
>  drivers/iio/afe/iio-rescale.c                 |  1 -
>  drivers/iio/amplifiers/ad8366.c               |  1 -
>  drivers/iio/amplifiers/hmc425a.c              |  1 -
>  drivers/iio/chemical/ams-iaq-core.c           |  1 -
>  drivers/iio/chemical/atlas-sensor.c           |  1 -
>  drivers/iio/chemical/bme680_core.c            |  1 -
>  drivers/iio/chemical/ccs811.c                 |  1 -
>  drivers/iio/chemical/pms7003.c                |  1 -
>  drivers/iio/chemical/sgp30.c                  |  1 -
>  drivers/iio/chemical/sps30.c                  |  1 -
>  drivers/iio/chemical/vz89x.c                  |  1 -
>  drivers/iio/dac/ad5064.c                      |  1 -
>  drivers/iio/dac/ad5360.c                      |  1 -
>  drivers/iio/dac/ad5380.c                      |  1 -
>  drivers/iio/dac/ad5421.c                      |  1 -
>  drivers/iio/dac/ad5446.c                      |  2 --
>  drivers/iio/dac/ad5449.c                      |  1 -
>  drivers/iio/dac/ad5504.c                      |  1 -
>  drivers/iio/dac/ad5592r-base.c                |  1 -
>  drivers/iio/dac/ad5624r_spi.c                 |  1 -
>  drivers/iio/dac/ad5686.c                      |  1 -
>  drivers/iio/dac/ad5755.c                      |  1 -
>  drivers/iio/dac/ad5758.c                      |  1 -
>  drivers/iio/dac/ad5761.c                      |  1 -
>  drivers/iio/dac/ad5764.c                      |  1 -
>  drivers/iio/dac/ad5770r.c                     |  1 -
>  drivers/iio/dac/ad5791.c                      |  1 -
>  drivers/iio/dac/ad7303.c                      |  1 -
>  drivers/iio/dac/ad8801.c                      |  1 -
>  drivers/iio/dac/cio-dac.c                     |  1 -
>  drivers/iio/dac/dpot-dac.c                    |  1 -
>  drivers/iio/dac/ds4424.c                      |  1 -
>  drivers/iio/dac/lpc18xx_dac.c                 |  1 -
>  drivers/iio/dac/ltc1660.c                     |  1 -
>  drivers/iio/dac/ltc2632.c                     |  1 -
>  drivers/iio/dac/m62332.c                      |  3 ---
>  drivers/iio/dac/max517.c                      |  3 ---
>  drivers/iio/dac/max5821.c                     |  1 -
>  drivers/iio/dac/mcp4725.c                     |  1 -
>  drivers/iio/dac/mcp4922.c                     |  1 -
>  drivers/iio/dac/stm32-dac.c                   |  1 -
>  drivers/iio/dac/ti-dac082s085.c               |  1 -
>  drivers/iio/dac/ti-dac5571.c                  |  1 -
>  drivers/iio/dac/ti-dac7311.c                  |  1 -
>  drivers/iio/dac/ti-dac7612.c                  |  1 -
>  drivers/iio/dac/vf610_dac.c                   |  1 -
>  drivers/iio/dummy/iio_simple_dummy.c          | 14 ++++++-----
>  drivers/iio/frequency/ad9523.c                |  1 -
>  drivers/iio/frequency/adf4350.c               |  1 -
>  drivers/iio/frequency/adf4371.c               |  1 -
>  drivers/iio/gyro/adis16080.c                  |  1 -
>  drivers/iio/gyro/adis16130.c                  |  1 -
>  drivers/iio/gyro/adis16136.c                  |  1 -
>  drivers/iio/gyro/adis16260.c                  |  1 -
>  drivers/iio/gyro/adxrs450.c                   |  1 -
>  drivers/iio/gyro/bmg160_core.c                |  1 -
>  drivers/iio/gyro/fxas21002c_core.c            |  1 -
>  drivers/iio/gyro/hid-sensor-gyro-3d.c         |  1 -
>  drivers/iio/gyro/itg3200_core.c               |  1 -
>  drivers/iio/gyro/mpu3050-core.c               |  1 -
>  drivers/iio/gyro/ssp_gyro_sensor.c            |  1 -
>  drivers/iio/health/afe4403.c                  |  1 -
>  drivers/iio/health/afe4404.c                  |  1 -
>  drivers/iio/health/max30100.c                 |  1 -
>  drivers/iio/health/max30102.c                 |  1 -
>  drivers/iio/humidity/am2315.c                 |  1 -
>  drivers/iio/humidity/dht11.c                  |  1 -
>  drivers/iio/humidity/hdc100x.c                |  1 -
>  drivers/iio/humidity/hid-sensor-humidity.c    |  1 -
>  drivers/iio/humidity/hts221_core.c            |  1 -
>  drivers/iio/humidity/htu21.c                  |  1 -
>  drivers/iio/humidity/si7005.c                 |  1 -
>  drivers/iio/humidity/si7020.c                 |  1 -
>  drivers/iio/imu/adis16400.c                   |  1 -
>  drivers/iio/imu/adis16460.c                   |  1 -
>  drivers/iio/imu/adis16475.c                   |  1 -
>  drivers/iio/imu/adis16480.c                   |  1 -
>  drivers/iio/imu/bmi160/bmi160_core.c          |  1 -
>  drivers/iio/imu/fxos8700_core.c               |  1 -
>  drivers/iio/imu/inv_mpu6050/inv_mpu_core.c    |  1 -
>  drivers/iio/imu/kmx61.c                       |  1 -
>  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c  |  1 -
>  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c  |  1 -
>  drivers/iio/industrialio-core.c               | 11 +++++----
>  drivers/iio/light/acpi-als.c                  |  1 -
>  drivers/iio/light/adjd_s311.c                 |  1 -
>  drivers/iio/light/adux1020.c                  |  1 -
>  drivers/iio/light/al3010.c                    |  1 -
>  drivers/iio/light/al3320a.c                   |  1 -
>  drivers/iio/light/apds9300.c                  |  1 -
>  drivers/iio/light/apds9960.c                  |  1 -
>  drivers/iio/light/bh1750.c                    |  1 -
>  drivers/iio/light/bh1780.c                    |  1 -
>  drivers/iio/light/cm32181.c                   |  1 -
>  drivers/iio/light/cm3232.c                    |  1 -
>  drivers/iio/light/cm3323.c                    |  1 -
>  drivers/iio/light/cm3605.c                    |  1 -
>  drivers/iio/light/cm36651.c                   |  1 -
>  drivers/iio/light/gp2ap002.c                  |  1 -
>  drivers/iio/light/gp2ap020a00f.c              |  1 -
>  drivers/iio/light/hid-sensor-als.c            |  1 -
>  drivers/iio/light/hid-sensor-prox.c           |  1 -
>  drivers/iio/light/iqs621-als.c                |  1 -
>  drivers/iio/light/isl29018.c                  |  1 -
>  drivers/iio/light/isl29028.c                  |  1 -
>  drivers/iio/light/isl29125.c                  |  1 -
>  drivers/iio/light/jsa1212.c                   |  1 -
>  drivers/iio/light/lm3533-als.c                |  2 +-
>  drivers/iio/light/ltr501.c                    |  1 -
>  drivers/iio/light/lv0104cs.c                  |  1 -
>  drivers/iio/light/max44000.c                  |  1 -
>  drivers/iio/light/max44009.c                  |  1 -
>  drivers/iio/light/noa1305.c                   |  1 -
>  drivers/iio/light/opt3001.c                   |  1 -
>  drivers/iio/light/pa12203001.c                |  1 -
>  drivers/iio/light/rpr0521.c                   |  1 -
>  drivers/iio/light/si1133.c                    |  1 -
>  drivers/iio/light/si1145.c                    |  1 -
>  drivers/iio/light/st_uvis25_core.c            |  1 -
>  drivers/iio/light/stk3310.c                   |  1 -
>  drivers/iio/light/tcs3414.c                   |  1 -
>  drivers/iio/light/tcs3472.c                   |  1 -
>  drivers/iio/light/tsl2563.c                   |  1 -
>  drivers/iio/light/tsl2583.c                   |  1 -
>  drivers/iio/light/tsl2772.c                   |  1 -
>  drivers/iio/light/tsl4531.c                   |  1 -
>  drivers/iio/light/us5182d.c                   |  1 -
>  drivers/iio/light/vcnl4000.c                  |  1 -
>  drivers/iio/light/vcnl4035.c                  |  1 -
>  drivers/iio/light/veml6030.c                  |  1 -
>  drivers/iio/light/veml6070.c                  |  1 -
>  drivers/iio/light/vl6180.c                    |  1 -
>  drivers/iio/light/zopt2201.c                  |  1 -
>  drivers/iio/magnetometer/ak8974.c             |  1 -
>  drivers/iio/magnetometer/ak8975.c             |  1 -
>  drivers/iio/magnetometer/bmc150_magn.c        |  1 -
>  drivers/iio/magnetometer/hid-sensor-magn-3d.c |  1 -
>  drivers/iio/magnetometer/hmc5843_core.c       |  1 -
>  drivers/iio/magnetometer/mag3110.c            |  1 -
>  drivers/iio/magnetometer/mmc35240.c           |  1 -
>  drivers/iio/magnetometer/rm3100-core.c        |  1 -
>  drivers/iio/multiplexer/iio-mux.c             |  1 -
>  drivers/iio/orientation/hid-sensor-incl-3d.c  |  1 -
>  drivers/iio/orientation/hid-sensor-rotation.c |  1 -
>  drivers/iio/position/iqs624-pos.c             |  1 -
>  drivers/iio/potentiometer/ad5272.c            |  1 -
>  drivers/iio/potentiometer/ds1803.c            |  1 -
>  drivers/iio/potentiometer/max5432.c           |  1 -
>  drivers/iio/potentiometer/max5481.c           |  1 -
>  drivers/iio/potentiometer/max5487.c           |  1 -
>  drivers/iio/potentiometer/mcp4018.c           |  1 -
>  drivers/iio/potentiometer/mcp41010.c          |  1 -
>  drivers/iio/potentiometer/mcp4131.c           |  1 -
>  drivers/iio/potentiometer/mcp4531.c           |  1 -
>  drivers/iio/potentiometer/tpl0102.c           |  1 -
>  drivers/iio/potentiostat/lmp91000.c           |  1 -
>  drivers/iio/pressure/abp060mg.c               |  1 -
>  drivers/iio/pressure/bmp280-core.c            |  1 -
>  drivers/iio/pressure/dlhl60d.c                |  1 -
>  drivers/iio/pressure/dps310.c                 |  1 -
>  drivers/iio/pressure/hid-sensor-press.c       |  1 -
>  drivers/iio/pressure/hp03.c                   |  1 -
>  drivers/iio/pressure/hp206c.c                 |  1 -
>  drivers/iio/pressure/icp10100.c               |  1 -
>  drivers/iio/pressure/mpl115.c                 |  1 -
>  drivers/iio/pressure/mpl3115.c                |  1 -
>  drivers/iio/pressure/ms5637.c                 |  1 -
>  drivers/iio/pressure/t5403.c                  |  1 -
>  drivers/iio/pressure/zpa2326.c                |  1 -
>  drivers/iio/proximity/as3935.c                |  1 -
>  drivers/iio/proximity/isl29501.c              |  1 -
>  drivers/iio/proximity/mb1232.c                |  1 -
>  drivers/iio/proximity/ping.c                  |  1 -
>  .../iio/proximity/pulsedlight-lidar-lite-v2.c |  1 -
>  drivers/iio/proximity/rfd77402.c              |  1 -
>  drivers/iio/proximity/srf04.c                 |  1 -
>  drivers/iio/proximity/srf08.c                 |  1 -
>  drivers/iio/proximity/sx9310.c                |  1 -
>  drivers/iio/proximity/sx9500.c                |  1 -
>  drivers/iio/proximity/vl53l0x-i2c.c           |  1 -
>  drivers/iio/resolver/ad2s1200.c               |  1 -
>  drivers/iio/resolver/ad2s90.c                 |  1 -
>  .../iio/temperature/hid-sensor-temperature.c  |  1 -
>  drivers/iio/temperature/iqs620at-temp.c       |  1 -
>  drivers/iio/temperature/ltc2983.c             |  1 -
>  drivers/iio/temperature/max31856.c            |  1 -
>  drivers/iio/temperature/maxim_thermocouple.c  |  1 -
>  drivers/iio/temperature/mlx90614.c            |  1 -
>  drivers/iio/temperature/mlx90632.c            |  1 -
>  drivers/iio/temperature/tmp006.c              |  1 -
>  drivers/iio/temperature/tmp007.c              |  1 -
>  drivers/iio/temperature/tsys01.c              |  1 -
>  drivers/iio/temperature/tsys02d.c             |  1 -
>  drivers/iio/trigger/stm32-timer-trigger.c     |  1 -
>  drivers/input/touchscreen/tsc2007_iio.c       |  1 -
>  drivers/platform/x86/toshiba_acpi.c           |  3 +--
>  drivers/staging/iio/Documentation/device.txt  |  4 +---
>  drivers/staging/iio/accel/adis16203.c         |  1 -
>  drivers/staging/iio/accel/adis16240.c         |  1 -
>  drivers/staging/iio/adc/ad7280a.c             |  1 -
>  drivers/staging/iio/adc/ad7816.c              |  1 -
>  drivers/staging/iio/addac/adt7316.c           |  1 -
>  drivers/staging/iio/cdc/ad7150.c              |  2 --
>  drivers/staging/iio/cdc/ad7746.c              |  2 --
>  drivers/staging/iio/frequency/ad9832.c        |  1 -
>  drivers/staging/iio/frequency/ad9834.c        |  1 -
>  .../staging/iio/impedance-analyzer/ad5933.c   |  1 -
>  drivers/staging/iio/resolver/ad2s1210.c       |  1 -
>  include/linux/iio/iio.h                       | 24 +++++++++++++++++--
>  335 files changed, 39 insertions(+), 358 deletions(-)
> 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 0/6] iio: core: pass parent device as parameter during allocation
  2020-06-03 11:41 ` [PATCH v2 0/6] iio: core: pass parent device as parameter during allocation Ardelean, Alexandru
@ 2020-06-04 17:34   ` Jonathan Cameron
  2020-06-06 16:02     ` Jonathan Cameron
  0 siblings, 1 reply; 18+ messages in thread
From: Jonathan Cameron @ 2020-06-04 17:34 UTC (permalink / raw)
  To: Ardelean, Alexandru
  Cc: linux-kernel, linux-iio, andy.shevchenko, jic23, johan

On Wed, 3 Jun 2020 11:41:52 +0000
"Ardelean, Alexandru" <alexandru.Ardelean@analog.com> wrote:

> On Wed, 2020-06-03 at 14:40 +0300, Alexandru Ardelean wrote:
> > This patch updates the {devm_}iio_device_alloc() functions to automatically
> > assign the parent device on allocation.
> > For iio_device_alloc() this means a new parameter.
> > For devm_iio_device_alloc() this means a new behavior; the device object is
> > the parent. For this one, this is the common case for most drivers (except
> > one: 'lm3533-als').
> > 
> > For the special cases an iio_device_set_parent() has been created to change
> > the parent betwee allocation & registration.
> > The purpose of this helper, is mostly to highlight the new behavior of
> > devm_iio_device_alloc().
> > 
> > This patchset also removes explicit parent assignments from most IIO
> > drivers (except for lm3533-als).
> > 
> > Using a semantic patch, about 303 drivers are updated, and some needed some
> > manual attention. This is probably due to some limitations of spatch. At
> > least in some cases the parent device is not the same variable as passed to
> > devm_iio_device_alloc(), OR the parent assignment is moved to a separate
> > function than where devm_iio_device_alloc() is called.
> >   
> 
> Forgot to explicitly CC Jonathan.
> But I'm hoping this shows up from the list.

No problem.  I filter anything going to the list into the same folder
whether or not I'm cc'd :) Well several folders on different machines via
different email addresses, but you get the idea...


> 
> > Changelog v1 -> v2:
> > * added iio_device_set_parent() helper (new commit)
> > * update commit for lm3533-als to use iio_device_set_parent()
> > 
> > Alexandru Ardelean (6):
> >   iio: core: pass parent device as parameter during allocation
> >   iio: core: add iio_device_set_parent() helper
> >   iio: remove explicit IIO device parent assignment
> >   iio: remove left-over comments about parent assignment
> >   iio: light: lm3533-als: use iio_device_set_parent() to assign parent
> >   iio: remove left-over parent assignments
> > 
> >  drivers/counter/104-quad-8.c                  |  1 -
> >  drivers/counter/stm32-lptimer-cnt.c           |  1 -
> >  drivers/iio/accel/adis16201.c                 |  1 -
> >  drivers/iio/accel/adis16209.c                 |  1 -
> >  drivers/iio/accel/adxl345_core.c              |  1 -
> >  drivers/iio/accel/adxl372.c                   |  1 -
> >  drivers/iio/accel/bma180.c                    |  1 -
> >  drivers/iio/accel/bma220_spi.c                |  1 -
> >  drivers/iio/accel/bma400_core.c               |  1 -
> >  drivers/iio/accel/bmc150-accel-core.c         |  1 -
> >  drivers/iio/accel/da280.c                     |  1 -
> >  drivers/iio/accel/da311.c                     |  1 -
> >  drivers/iio/accel/dmard06.c                   |  1 -
> >  drivers/iio/accel/dmard09.c                   |  1 -
> >  drivers/iio/accel/dmard10.c                   |  1 -
> >  drivers/iio/accel/hid-sensor-accel-3d.c       |  1 -
> >  drivers/iio/accel/kxcjk-1013.c                |  1 -
> >  drivers/iio/accel/kxsd9.c                     |  1 -
> >  drivers/iio/accel/mc3230.c                    |  1 -
> >  drivers/iio/accel/mma7455_core.c              |  1 -
> >  drivers/iio/accel/mma7660.c                   |  1 -
> >  drivers/iio/accel/mma8452.c                   |  1 -
> >  drivers/iio/accel/mma9551.c                   |  1 -
> >  drivers/iio/accel/mma9553.c                   |  1 -
> >  drivers/iio/accel/mxc4005.c                   |  1 -
> >  drivers/iio/accel/mxc6255.c                   |  1 -
> >  drivers/iio/accel/sca3000.c                   |  1 -
> >  drivers/iio/accel/ssp_accel_sensor.c          |  1 -
> >  drivers/iio/accel/stk8312.c                   |  1 -
> >  drivers/iio/accel/stk8ba50.c                  |  1 -
> >  drivers/iio/adc/ab8500-gpadc.c                |  1 -
> >  drivers/iio/adc/ad7091r-base.c                |  1 -
> >  drivers/iio/adc/ad7124.c                      |  1 -
> >  drivers/iio/adc/ad7192.c                      |  1 -
> >  drivers/iio/adc/ad7266.c                      |  1 -
> >  drivers/iio/adc/ad7291.c                      |  1 -
> >  drivers/iio/adc/ad7292.c                      |  1 -
> >  drivers/iio/adc/ad7298.c                      |  1 -
> >  drivers/iio/adc/ad7476.c                      |  2 --
> >  drivers/iio/adc/ad7606.c                      |  1 -
> >  drivers/iio/adc/ad7766.c                      |  1 -
> >  drivers/iio/adc/ad7768-1.c                    |  1 -
> >  drivers/iio/adc/ad7780.c                      |  1 -
> >  drivers/iio/adc/ad7791.c                      |  1 -
> >  drivers/iio/adc/ad7793.c                      |  1 -
> >  drivers/iio/adc/ad7887.c                      |  2 --
> >  drivers/iio/adc/ad7923.c                      |  1 -
> >  drivers/iio/adc/ad7949.c                      |  1 -
> >  drivers/iio/adc/ad799x.c                      |  1 -
> >  drivers/iio/adc/adi-axi-adc.c                 |  1 -
> >  drivers/iio/adc/aspeed_adc.c                  |  1 -
> >  drivers/iio/adc/at91-sama5d2_adc.c            |  1 -
> >  drivers/iio/adc/at91_adc.c                    |  1 -
> >  drivers/iio/adc/axp20x_adc.c                  |  1 -
> >  drivers/iio/adc/axp288_adc.c                  |  1 -
> >  drivers/iio/adc/bcm_iproc_adc.c               |  1 -
> >  drivers/iio/adc/berlin2-adc.c                 |  1 -
> >  drivers/iio/adc/cc10001_adc.c                 |  1 -
> >  drivers/iio/adc/cpcap-adc.c                   |  1 -
> >  drivers/iio/adc/da9150-gpadc.c                |  1 -
> >  drivers/iio/adc/dln2-adc.c                    |  1 -
> >  drivers/iio/adc/envelope-detector.c           |  1 -
> >  drivers/iio/adc/ep93xx_adc.c                  |  1 -
> >  drivers/iio/adc/exynos_adc.c                  |  1 -
> >  drivers/iio/adc/fsl-imx25-gcq.c               |  1 -
> >  drivers/iio/adc/hi8435.c                      |  1 -
> >  drivers/iio/adc/hx711.c                       |  1 -
> >  drivers/iio/adc/imx7d_adc.c                   |  1 -
> >  drivers/iio/adc/ina2xx-adc.c                  |  1 -
> >  drivers/iio/adc/ingenic-adc.c                 |  1 -
> >  drivers/iio/adc/intel_mrfld_adc.c             |  1 -
> >  drivers/iio/adc/lp8788_adc.c                  |  1 -
> >  drivers/iio/adc/lpc18xx_adc.c                 |  1 -
> >  drivers/iio/adc/lpc32xx_adc.c                 |  1 -
> >  drivers/iio/adc/ltc2471.c                     |  1 -
> >  drivers/iio/adc/ltc2485.c                     |  1 -
> >  drivers/iio/adc/max1027.c                     |  1 -
> >  drivers/iio/adc/max11100.c                    |  1 -
> >  drivers/iio/adc/max1118.c                     |  1 -
> >  drivers/iio/adc/max1241.c                     |  1 -
> >  drivers/iio/adc/max1363.c                     |  2 --
> >  drivers/iio/adc/max9611.c                     |  1 -
> >  drivers/iio/adc/mcp320x.c                     |  1 -
> >  drivers/iio/adc/mcp3422.c                     |  1 -
> >  drivers/iio/adc/mcp3911.c                     |  1 -
> >  drivers/iio/adc/men_z188_adc.c                |  1 -
> >  drivers/iio/adc/meson_saradc.c                |  1 -
> >  drivers/iio/adc/mt6577_auxadc.c               |  1 -
> >  drivers/iio/adc/mxs-lradc-adc.c               |  1 -
> >  drivers/iio/adc/nau7802.c                     |  1 -
> >  drivers/iio/adc/npcm_adc.c                    |  1 -
> >  drivers/iio/adc/palmas_gpadc.c                |  1 -
> >  drivers/iio/adc/qcom-pm8xxx-xoadc.c           |  1 -
> >  drivers/iio/adc/qcom-spmi-adc5.c              |  1 -
> >  drivers/iio/adc/qcom-spmi-iadc.c              |  1 -
> >  drivers/iio/adc/qcom-spmi-vadc.c              |  1 -
> >  drivers/iio/adc/rcar-gyroadc.c                |  1 -
> >  drivers/iio/adc/rn5t618-adc.c                 |  1 -
> >  drivers/iio/adc/rockchip_saradc.c             |  1 -
> >  drivers/iio/adc/sc27xx_adc.c                  |  1 -
> >  drivers/iio/adc/sd_adc_modulator.c            |  1 -
> >  drivers/iio/adc/spear_adc.c                   |  1 -
> >  drivers/iio/adc/stm32-adc.c                   |  1 -
> >  drivers/iio/adc/stm32-dfsdm-adc.c             |  1 -
> >  drivers/iio/adc/stmpe-adc.c                   |  1 -
> >  drivers/iio/adc/stx104.c                      |  1 -
> >  drivers/iio/adc/sun4i-gpadc-iio.c             |  1 -
> >  drivers/iio/adc/ti-adc081c.c                  |  1 -
> >  drivers/iio/adc/ti-adc0832.c                  |  1 -
> >  drivers/iio/adc/ti-adc084s021.c               |  1 -
> >  drivers/iio/adc/ti-adc108s102.c               |  1 -
> >  drivers/iio/adc/ti-adc12138.c                 |  1 -
> >  drivers/iio/adc/ti-adc128s052.c               |  1 -
> >  drivers/iio/adc/ti-adc161s626.c               |  1 -
> >  drivers/iio/adc/ti-ads1015.c                  |  1 -
> >  drivers/iio/adc/ti-ads124s08.c                |  1 -
> >  drivers/iio/adc/ti-ads7950.c                  |  1 -
> >  drivers/iio/adc/ti-ads8344.c                  |  1 -
> >  drivers/iio/adc/ti-ads8688.c                  |  1 -
> >  drivers/iio/adc/ti-tlc4541.c                  |  1 -
> >  drivers/iio/adc/ti_am335x_adc.c               |  1 -
> >  drivers/iio/adc/twl4030-madc.c                |  1 -
> >  drivers/iio/adc/twl6030-gpadc.c               |  1 -
> >  drivers/iio/adc/vf610_adc.c                   |  1 -
> >  drivers/iio/adc/viperboard_adc.c              |  1 -
> >  drivers/iio/adc/xilinx-xadc-core.c            |  1 -
> >  drivers/iio/afe/iio-rescale.c                 |  1 -
> >  drivers/iio/amplifiers/ad8366.c               |  1 -
> >  drivers/iio/amplifiers/hmc425a.c              |  1 -
> >  drivers/iio/chemical/ams-iaq-core.c           |  1 -
> >  drivers/iio/chemical/atlas-sensor.c           |  1 -
> >  drivers/iio/chemical/bme680_core.c            |  1 -
> >  drivers/iio/chemical/ccs811.c                 |  1 -
> >  drivers/iio/chemical/pms7003.c                |  1 -
> >  drivers/iio/chemical/sgp30.c                  |  1 -
> >  drivers/iio/chemical/sps30.c                  |  1 -
> >  drivers/iio/chemical/vz89x.c                  |  1 -
> >  drivers/iio/dac/ad5064.c                      |  1 -
> >  drivers/iio/dac/ad5360.c                      |  1 -
> >  drivers/iio/dac/ad5380.c                      |  1 -
> >  drivers/iio/dac/ad5421.c                      |  1 -
> >  drivers/iio/dac/ad5446.c                      |  2 --
> >  drivers/iio/dac/ad5449.c                      |  1 -
> >  drivers/iio/dac/ad5504.c                      |  1 -
> >  drivers/iio/dac/ad5592r-base.c                |  1 -
> >  drivers/iio/dac/ad5624r_spi.c                 |  1 -
> >  drivers/iio/dac/ad5686.c                      |  1 -
> >  drivers/iio/dac/ad5755.c                      |  1 -
> >  drivers/iio/dac/ad5758.c                      |  1 -
> >  drivers/iio/dac/ad5761.c                      |  1 -
> >  drivers/iio/dac/ad5764.c                      |  1 -
> >  drivers/iio/dac/ad5770r.c                     |  1 -
> >  drivers/iio/dac/ad5791.c                      |  1 -
> >  drivers/iio/dac/ad7303.c                      |  1 -
> >  drivers/iio/dac/ad8801.c                      |  1 -
> >  drivers/iio/dac/cio-dac.c                     |  1 -
> >  drivers/iio/dac/dpot-dac.c                    |  1 -
> >  drivers/iio/dac/ds4424.c                      |  1 -
> >  drivers/iio/dac/lpc18xx_dac.c                 |  1 -
> >  drivers/iio/dac/ltc1660.c                     |  1 -
> >  drivers/iio/dac/ltc2632.c                     |  1 -
> >  drivers/iio/dac/m62332.c                      |  3 ---
> >  drivers/iio/dac/max517.c                      |  3 ---
> >  drivers/iio/dac/max5821.c                     |  1 -
> >  drivers/iio/dac/mcp4725.c                     |  1 -
> >  drivers/iio/dac/mcp4922.c                     |  1 -
> >  drivers/iio/dac/stm32-dac.c                   |  1 -
> >  drivers/iio/dac/ti-dac082s085.c               |  1 -
> >  drivers/iio/dac/ti-dac5571.c                  |  1 -
> >  drivers/iio/dac/ti-dac7311.c                  |  1 -
> >  drivers/iio/dac/ti-dac7612.c                  |  1 -
> >  drivers/iio/dac/vf610_dac.c                   |  1 -
> >  drivers/iio/dummy/iio_simple_dummy.c          | 14 ++++++-----
> >  drivers/iio/frequency/ad9523.c                |  1 -
> >  drivers/iio/frequency/adf4350.c               |  1 -
> >  drivers/iio/frequency/adf4371.c               |  1 -
> >  drivers/iio/gyro/adis16080.c                  |  1 -
> >  drivers/iio/gyro/adis16130.c                  |  1 -
> >  drivers/iio/gyro/adis16136.c                  |  1 -
> >  drivers/iio/gyro/adis16260.c                  |  1 -
> >  drivers/iio/gyro/adxrs450.c                   |  1 -
> >  drivers/iio/gyro/bmg160_core.c                |  1 -
> >  drivers/iio/gyro/fxas21002c_core.c            |  1 -
> >  drivers/iio/gyro/hid-sensor-gyro-3d.c         |  1 -
> >  drivers/iio/gyro/itg3200_core.c               |  1 -
> >  drivers/iio/gyro/mpu3050-core.c               |  1 -
> >  drivers/iio/gyro/ssp_gyro_sensor.c            |  1 -
> >  drivers/iio/health/afe4403.c                  |  1 -
> >  drivers/iio/health/afe4404.c                  |  1 -
> >  drivers/iio/health/max30100.c                 |  1 -
> >  drivers/iio/health/max30102.c                 |  1 -
> >  drivers/iio/humidity/am2315.c                 |  1 -
> >  drivers/iio/humidity/dht11.c                  |  1 -
> >  drivers/iio/humidity/hdc100x.c                |  1 -
> >  drivers/iio/humidity/hid-sensor-humidity.c    |  1 -
> >  drivers/iio/humidity/hts221_core.c            |  1 -
> >  drivers/iio/humidity/htu21.c                  |  1 -
> >  drivers/iio/humidity/si7005.c                 |  1 -
> >  drivers/iio/humidity/si7020.c                 |  1 -
> >  drivers/iio/imu/adis16400.c                   |  1 -
> >  drivers/iio/imu/adis16460.c                   |  1 -
> >  drivers/iio/imu/adis16475.c                   |  1 -
> >  drivers/iio/imu/adis16480.c                   |  1 -
> >  drivers/iio/imu/bmi160/bmi160_core.c          |  1 -
> >  drivers/iio/imu/fxos8700_core.c               |  1 -
> >  drivers/iio/imu/inv_mpu6050/inv_mpu_core.c    |  1 -
> >  drivers/iio/imu/kmx61.c                       |  1 -
> >  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c  |  1 -
> >  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c  |  1 -
> >  drivers/iio/industrialio-core.c               | 11 +++++----
> >  drivers/iio/light/acpi-als.c                  |  1 -
> >  drivers/iio/light/adjd_s311.c                 |  1 -
> >  drivers/iio/light/adux1020.c                  |  1 -
> >  drivers/iio/light/al3010.c                    |  1 -
> >  drivers/iio/light/al3320a.c                   |  1 -
> >  drivers/iio/light/apds9300.c                  |  1 -
> >  drivers/iio/light/apds9960.c                  |  1 -
> >  drivers/iio/light/bh1750.c                    |  1 -
> >  drivers/iio/light/bh1780.c                    |  1 -
> >  drivers/iio/light/cm32181.c                   |  1 -
> >  drivers/iio/light/cm3232.c                    |  1 -
> >  drivers/iio/light/cm3323.c                    |  1 -
> >  drivers/iio/light/cm3605.c                    |  1 -
> >  drivers/iio/light/cm36651.c                   |  1 -
> >  drivers/iio/light/gp2ap002.c                  |  1 -
> >  drivers/iio/light/gp2ap020a00f.c              |  1 -
> >  drivers/iio/light/hid-sensor-als.c            |  1 -
> >  drivers/iio/light/hid-sensor-prox.c           |  1 -
> >  drivers/iio/light/iqs621-als.c                |  1 -
> >  drivers/iio/light/isl29018.c                  |  1 -
> >  drivers/iio/light/isl29028.c                  |  1 -
> >  drivers/iio/light/isl29125.c                  |  1 -
> >  drivers/iio/light/jsa1212.c                   |  1 -
> >  drivers/iio/light/lm3533-als.c                |  2 +-
> >  drivers/iio/light/ltr501.c                    |  1 -
> >  drivers/iio/light/lv0104cs.c                  |  1 -
> >  drivers/iio/light/max44000.c                  |  1 -
> >  drivers/iio/light/max44009.c                  |  1 -
> >  drivers/iio/light/noa1305.c                   |  1 -
> >  drivers/iio/light/opt3001.c                   |  1 -
> >  drivers/iio/light/pa12203001.c                |  1 -
> >  drivers/iio/light/rpr0521.c                   |  1 -
> >  drivers/iio/light/si1133.c                    |  1 -
> >  drivers/iio/light/si1145.c                    |  1 -
> >  drivers/iio/light/st_uvis25_core.c            |  1 -
> >  drivers/iio/light/stk3310.c                   |  1 -
> >  drivers/iio/light/tcs3414.c                   |  1 -
> >  drivers/iio/light/tcs3472.c                   |  1 -
> >  drivers/iio/light/tsl2563.c                   |  1 -
> >  drivers/iio/light/tsl2583.c                   |  1 -
> >  drivers/iio/light/tsl2772.c                   |  1 -
> >  drivers/iio/light/tsl4531.c                   |  1 -
> >  drivers/iio/light/us5182d.c                   |  1 -
> >  drivers/iio/light/vcnl4000.c                  |  1 -
> >  drivers/iio/light/vcnl4035.c                  |  1 -
> >  drivers/iio/light/veml6030.c                  |  1 -
> >  drivers/iio/light/veml6070.c                  |  1 -
> >  drivers/iio/light/vl6180.c                    |  1 -
> >  drivers/iio/light/zopt2201.c                  |  1 -
> >  drivers/iio/magnetometer/ak8974.c             |  1 -
> >  drivers/iio/magnetometer/ak8975.c             |  1 -
> >  drivers/iio/magnetometer/bmc150_magn.c        |  1 -
> >  drivers/iio/magnetometer/hid-sensor-magn-3d.c |  1 -
> >  drivers/iio/magnetometer/hmc5843_core.c       |  1 -
> >  drivers/iio/magnetometer/mag3110.c            |  1 -
> >  drivers/iio/magnetometer/mmc35240.c           |  1 -
> >  drivers/iio/magnetometer/rm3100-core.c        |  1 -
> >  drivers/iio/multiplexer/iio-mux.c             |  1 -
> >  drivers/iio/orientation/hid-sensor-incl-3d.c  |  1 -
> >  drivers/iio/orientation/hid-sensor-rotation.c |  1 -
> >  drivers/iio/position/iqs624-pos.c             |  1 -
> >  drivers/iio/potentiometer/ad5272.c            |  1 -
> >  drivers/iio/potentiometer/ds1803.c            |  1 -
> >  drivers/iio/potentiometer/max5432.c           |  1 -
> >  drivers/iio/potentiometer/max5481.c           |  1 -
> >  drivers/iio/potentiometer/max5487.c           |  1 -
> >  drivers/iio/potentiometer/mcp4018.c           |  1 -
> >  drivers/iio/potentiometer/mcp41010.c          |  1 -
> >  drivers/iio/potentiometer/mcp4131.c           |  1 -
> >  drivers/iio/potentiometer/mcp4531.c           |  1 -
> >  drivers/iio/potentiometer/tpl0102.c           |  1 -
> >  drivers/iio/potentiostat/lmp91000.c           |  1 -
> >  drivers/iio/pressure/abp060mg.c               |  1 -
> >  drivers/iio/pressure/bmp280-core.c            |  1 -
> >  drivers/iio/pressure/dlhl60d.c                |  1 -
> >  drivers/iio/pressure/dps310.c                 |  1 -
> >  drivers/iio/pressure/hid-sensor-press.c       |  1 -
> >  drivers/iio/pressure/hp03.c                   |  1 -
> >  drivers/iio/pressure/hp206c.c                 |  1 -
> >  drivers/iio/pressure/icp10100.c               |  1 -
> >  drivers/iio/pressure/mpl115.c                 |  1 -
> >  drivers/iio/pressure/mpl3115.c                |  1 -
> >  drivers/iio/pressure/ms5637.c                 |  1 -
> >  drivers/iio/pressure/t5403.c                  |  1 -
> >  drivers/iio/pressure/zpa2326.c                |  1 -
> >  drivers/iio/proximity/as3935.c                |  1 -
> >  drivers/iio/proximity/isl29501.c              |  1 -
> >  drivers/iio/proximity/mb1232.c                |  1 -
> >  drivers/iio/proximity/ping.c                  |  1 -
> >  .../iio/proximity/pulsedlight-lidar-lite-v2.c |  1 -
> >  drivers/iio/proximity/rfd77402.c              |  1 -
> >  drivers/iio/proximity/srf04.c                 |  1 -
> >  drivers/iio/proximity/srf08.c                 |  1 -
> >  drivers/iio/proximity/sx9310.c                |  1 -
> >  drivers/iio/proximity/sx9500.c                |  1 -
> >  drivers/iio/proximity/vl53l0x-i2c.c           |  1 -
> >  drivers/iio/resolver/ad2s1200.c               |  1 -
> >  drivers/iio/resolver/ad2s90.c                 |  1 -
> >  .../iio/temperature/hid-sensor-temperature.c  |  1 -
> >  drivers/iio/temperature/iqs620at-temp.c       |  1 -
> >  drivers/iio/temperature/ltc2983.c             |  1 -
> >  drivers/iio/temperature/max31856.c            |  1 -
> >  drivers/iio/temperature/maxim_thermocouple.c  |  1 -
> >  drivers/iio/temperature/mlx90614.c            |  1 -
> >  drivers/iio/temperature/mlx90632.c            |  1 -
> >  drivers/iio/temperature/tmp006.c              |  1 -
> >  drivers/iio/temperature/tmp007.c              |  1 -
> >  drivers/iio/temperature/tsys01.c              |  1 -
> >  drivers/iio/temperature/tsys02d.c             |  1 -
> >  drivers/iio/trigger/stm32-timer-trigger.c     |  1 -
> >  drivers/input/touchscreen/tsc2007_iio.c       |  1 -
> >  drivers/platform/x86/toshiba_acpi.c           |  3 +--
> >  drivers/staging/iio/Documentation/device.txt  |  4 +---
> >  drivers/staging/iio/accel/adis16203.c         |  1 -
> >  drivers/staging/iio/accel/adis16240.c         |  1 -
> >  drivers/staging/iio/adc/ad7280a.c             |  1 -
> >  drivers/staging/iio/adc/ad7816.c              |  1 -
> >  drivers/staging/iio/addac/adt7316.c           |  1 -
> >  drivers/staging/iio/cdc/ad7150.c              |  2 --
> >  drivers/staging/iio/cdc/ad7746.c              |  2 --
> >  drivers/staging/iio/frequency/ad9832.c        |  1 -
> >  drivers/staging/iio/frequency/ad9834.c        |  1 -
> >  .../staging/iio/impedance-analyzer/ad5933.c   |  1 -
> >  drivers/staging/iio/resolver/ad2s1210.c       |  1 -
> >  include/linux/iio/iio.h                       | 24 +++++++++++++++++--
> >  335 files changed, 39 insertions(+), 358 deletions(-)
> >   



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/6] iio: core: pass parent device as parameter during allocation
  2020-06-03 11:40 ` [PATCH v2 1/6] " Alexandru Ardelean
@ 2020-06-06 15:24   ` Jonathan Cameron
  0 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2020-06-06 15:24 UTC (permalink / raw)
  To: Alexandru Ardelean; +Cc: linux-iio, linux-kernel, johan, andy.shevchenko

On Wed, 3 Jun 2020 14:40:18 +0300
Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:

> The change passes the parent device to the iio_device_alloc() call. This
> also updates the devm_iio_device_alloc() call to consider the device object
> as the parent device by default.
> 
> Having it passed like this, should ensure that any IIO device object
> already has a device object as parent, allowing for neater control, like
> passing the 'indio_dev' object for other stuff [like buffers/triggers/etc],
> and potentially creating iiom_xxx(indio_dev) functions.
> 
> With this patch, only the 'drivers/platform/x86/toshiba_acpi.c' needs an
> update to pass the parent object as a parameter.
> 
> In the next patch all devm_iio_device_alloc() calls will be handled.
> 
> Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>

Applied to the togreg branch of iio.git and pushed out as testing
for the all the usual reasons.

Hmm. I should probably clear out that bit of docs that is left in staging.
I'd imagine they have rotted pretty badly and our main docs are probably
more useful.

Thanks,

Jonathan

> ---
>  drivers/iio/dummy/iio_simple_dummy.c         | 14 ++++++++------
>  drivers/iio/industrialio-core.c              | 11 ++++++-----
>  drivers/platform/x86/toshiba_acpi.c          |  3 +--
>  drivers/staging/iio/Documentation/device.txt |  4 +---
>  include/linux/iio/iio.h                      |  4 ++--
>  5 files changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/iio/dummy/iio_simple_dummy.c b/drivers/iio/dummy/iio_simple_dummy.c
> index 6cb02299a215..b35ae7c039f7 100644
> --- a/drivers/iio/dummy/iio_simple_dummy.c
> +++ b/drivers/iio/dummy/iio_simple_dummy.c
> @@ -566,6 +566,13 @@ static struct iio_sw_device *iio_dummy_probe(const char *name)
>  	struct iio_dev *indio_dev;
>  	struct iio_dummy_state *st;
>  	struct iio_sw_device *swd;
> +	struct device *parent = NULL;
> +
> +	/*
> +	 * With hardware: Set the parent device.
> +	 * parent = &spi->dev;
> +	 * parent = &client->dev;
> +	 */
>  
>  	swd = kzalloc(sizeof(*swd), GFP_KERNEL);
>  	if (!swd) {
> @@ -580,7 +587,7 @@ static struct iio_sw_device *iio_dummy_probe(const char *name)
>  	 * It also has a region (accessed by iio_priv()
>  	 * for chip specific state information.
>  	 */
> -	indio_dev = iio_device_alloc(sizeof(*st));
> +	indio_dev = iio_device_alloc(parent, sizeof(*st));
>  	if (!indio_dev) {
>  		ret = -ENOMEM;
>  		goto error_ret;
> @@ -590,11 +597,6 @@ static struct iio_sw_device *iio_dummy_probe(const char *name)
>  	mutex_init(&st->lock);
>  
>  	iio_dummy_init_device(indio_dev);
> -	/*
> -	 * With hardware: Set the parent device.
> -	 * indio_dev->dev.parent = &spi->dev;
> -	 * indio_dev->dev.parent = &client->dev;
> -	 */
>  
>  	 /*
>  	 * Make the iio_dev struct available to remove function.
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index 1527f01a44f1..75661661aaba 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -1493,7 +1493,7 @@ struct device_type iio_device_type = {
>   * iio_device_alloc() - allocate an iio_dev from a driver
>   * @sizeof_priv:	Space to allocate for private structure.
>   **/
> -struct iio_dev *iio_device_alloc(int sizeof_priv)
> +struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv)
>  {
>  	struct iio_dev *dev;
>  	size_t alloc_size;
> @@ -1510,6 +1510,7 @@ struct iio_dev *iio_device_alloc(int sizeof_priv)
>  	if (!dev)
>  		return NULL;
>  
> +	dev->dev.parent = parent;
>  	dev->dev.groups = dev->groups;
>  	dev->dev.type = &iio_device_type;
>  	dev->dev.bus = &iio_bus_type;
> @@ -1551,7 +1552,7 @@ static void devm_iio_device_release(struct device *dev, void *res)
>  
>  /**
>   * devm_iio_device_alloc - Resource-managed iio_device_alloc()
> - * @dev:		Device to allocate iio_dev for
> + * @parent:		Device to allocate iio_dev for, and parent for this IIO device
>   * @sizeof_priv:	Space to allocate for private structure.
>   *
>   * Managed iio_device_alloc. iio_dev allocated with this function is
> @@ -1560,7 +1561,7 @@ static void devm_iio_device_release(struct device *dev, void *res)
>   * RETURNS:
>   * Pointer to allocated iio_dev on success, NULL on failure.
>   */
> -struct iio_dev *devm_iio_device_alloc(struct device *dev, int sizeof_priv)
> +struct iio_dev *devm_iio_device_alloc(struct device *parent, int sizeof_priv)
>  {
>  	struct iio_dev **ptr, *iio_dev;
>  
> @@ -1569,10 +1570,10 @@ struct iio_dev *devm_iio_device_alloc(struct device *dev, int sizeof_priv)
>  	if (!ptr)
>  		return NULL;
>  
> -	iio_dev = iio_device_alloc(sizeof_priv);
> +	iio_dev = iio_device_alloc(parent, sizeof_priv);
>  	if (iio_dev) {
>  		*ptr = iio_dev;
> -		devres_add(dev, ptr);
> +		devres_add(parent, ptr);
>  	} else {
>  		devres_free(ptr);
>  	}
> diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
> index 808944546739..4a4d09c352dd 100644
> --- a/drivers/platform/x86/toshiba_acpi.c
> +++ b/drivers/platform/x86/toshiba_acpi.c
> @@ -3128,7 +3128,7 @@ static int toshiba_acpi_add(struct acpi_device *acpi_dev)
>  
>  	toshiba_accelerometer_available(dev);
>  	if (dev->accelerometer_supported) {
> -		dev->indio_dev = iio_device_alloc(sizeof(*dev));
> +		dev->indio_dev = iio_device_alloc(&acpi_dev->dev, sizeof(*dev));
>  		if (!dev->indio_dev) {
>  			pr_err("Unable to allocate iio device\n");
>  			goto iio_error;
> @@ -3138,7 +3138,6 @@ static int toshiba_acpi_add(struct acpi_device *acpi_dev)
>  
>  		dev->indio_dev->info = &toshiba_iio_accel_info;
>  		dev->indio_dev->name = "Toshiba accelerometer";
> -		dev->indio_dev->dev.parent = &acpi_dev->dev;
>  		dev->indio_dev->modes = INDIO_DIRECT_MODE;
>  		dev->indio_dev->channels = toshiba_iio_accel_channels;
>  		dev->indio_dev->num_channels =
> diff --git a/drivers/staging/iio/Documentation/device.txt b/drivers/staging/iio/Documentation/device.txt
> index ec42544a46aa..0d1275b1eb3f 100644
> --- a/drivers/staging/iio/Documentation/device.txt
> +++ b/drivers/staging/iio/Documentation/device.txt
> @@ -8,7 +8,7 @@ The crucial structure for device drivers in iio is iio_dev.
>  
>  First allocate one using:
>  
> -struct iio_dev *indio_dev = iio_device_alloc(sizeof(struct chip_state));
> +struct iio_dev *indio_dev = iio_device_alloc(parent, sizeof(struct chip_state));
>  where chip_state is a structure of local state data for this instance of
>  the chip.
>  
> @@ -16,8 +16,6 @@ That data can be accessed using iio_priv(struct iio_dev *).
>  
>  Then fill in the following:
>  
> -- indio_dev->dev.parent
> -	Struct device associated with the underlying hardware.
>  - indio_dev->name
>  	Name of the device being driven - made available as the name
>  	attribute in sysfs.
> diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
> index a1be82e74c93..91a69f4751aa 100644
> --- a/include/linux/iio/iio.h
> +++ b/include/linux/iio/iio.h
> @@ -676,7 +676,7 @@ static inline void *iio_device_get_drvdata(struct iio_dev *indio_dev)
>  
>  /* Can we make this smaller? */
>  #define IIO_ALIGN L1_CACHE_BYTES
> -struct iio_dev *iio_device_alloc(int sizeof_priv);
> +struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv);
>  
>  static inline void *iio_priv(const struct iio_dev *indio_dev)
>  {
> @@ -690,7 +690,7 @@ static inline struct iio_dev *iio_priv_to_dev(void *priv)
>  }
>  
>  void iio_device_free(struct iio_dev *indio_dev);
> -struct iio_dev *devm_iio_device_alloc(struct device *dev, int sizeof_priv);
> +struct iio_dev *devm_iio_device_alloc(struct device *parent, int sizeof_priv);
>  struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,
>  						const char *fmt, ...);
>  /**


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 2/6] iio: core: add iio_device_set_parent() helper
  2020-06-03 11:40 ` [PATCH v2 2/6] iio: core: add iio_device_set_parent() helper Alexandru Ardelean
@ 2020-06-06 15:25   ` Jonathan Cameron
  0 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2020-06-06 15:25 UTC (permalink / raw)
  To: Alexandru Ardelean; +Cc: linux-iio, linux-kernel, johan, andy.shevchenko

On Wed, 3 Jun 2020 14:40:19 +0300
Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:

> By default, the device allocation will also assign a parent device to the
> IIO device object. In cases where devm_iio_device_alloc() is used,
> sometimes the parent device must be different than the device used to
> manage the allocation.
> 
> In that case, this helper should be used to change the parent, hence the
> requirement to call this between allocation & registration.
> 
> This pattern/requirement is not very common in the IIO space, and it may be
> cleaned up later.
> But until then, assigning the parent manually between allocation &
> registration is slightly easier.
> 
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>

That does the job nicely.

Applied,

Jonathan

> ---
>  include/linux/iio/iio.h | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
> index 91a69f4751aa..5784f8c9508f 100644
> --- a/include/linux/iio/iio.h
> +++ b/include/linux/iio/iio.h
> @@ -649,6 +649,26 @@ static inline struct iio_dev *iio_device_get(struct iio_dev *indio_dev)
>  	return indio_dev ? dev_to_iio_dev(get_device(&indio_dev->dev)) : NULL;
>  }
>  
> +/**
> + * iio_device_set_parent() - assign parent device to the IIO device object
> + * @indio_dev: 		IIO device structure
> + * @parent:		reference to parent device object
> + *
> + * This utility must be called between IIO device allocation
> + * (via devm_iio_device_alloc()) & IIO device registration
> + * (via {devm_}iio_device_register()).
> + * By default, the device allocation will also assign a parent device to
> + * the IIO device object. In cases where devm_iio_device_alloc() is used,
> + * sometimes the parent device must be different than the device used to
> + * manage the allocation.
> + * In that case, this helper should be used to change the parent, hence the
> + * requirement to call this between allocation & registration.
> + **/
> +static inline void iio_device_set_parent(struct iio_dev *indio_dev,
> +					 struct device *parent)
> +{
> +	indio_dev->dev.parent = parent;
> +}
>  
>  /**
>   * iio_device_set_drvdata() - Set device driver data


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 4/6] iio: remove left-over comments about parent assignment
  2020-06-03 11:40 ` [PATCH v2 4/6] iio: remove left-over comments about parent assignment Alexandru Ardelean
@ 2020-06-06 15:46   ` Jonathan Cameron
  0 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2020-06-06 15:46 UTC (permalink / raw)
  To: Alexandru Ardelean; +Cc: linux-iio, linux-kernel, johan, andy.shevchenko

On Wed, 3 Jun 2020 14:40:21 +0300
Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:

> These were obtained by doing a 'git diff | grep \/\*', in the previous diff
> to find comments. These needed a bit more manual review, as the semantic
> patch isn't great for catching these.
> 
> The result is:
>  	/* Initialize Counter device and driver data */
>  	/* Initialize IIO device */
>  	/* Establish that the iio_dev is a child of the spi device */
>  	/* Estabilish that the iio_dev is a child of the spi device */
>  	/* Initiate the Industrial I/O device */
>  	/* Establish that the iio_dev is a child of the device */
> -	/* establish that the iio_dev is a child of the i2c device */
> -	/* establish that the iio_dev is a child of the i2c device */
>  	/* This is only used for removal purposes */
>  	/* setup the industrialio driver allocated elements */
>  	/* variant specific configuration */
>  	/* Setup for userspace synchronous on demand sampling. */
>  	st->readback_delay_us += 5; /* Add tWAIT */
> -	/* Establish that the iio_dev is a child of the i2c device */
>  	/* Establish that the iio_dev is a child of the i2c device */
> 
> Out of which, 4 are really left-over comments about parent assignment.
> 3 of them are removed by the semantic patch, as the comment removed (by
> spatch) would be for an empty line.
> 
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>

Applied to the togreg branch of iio.git and pushed out as testing
for all the normal reasons.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/ad7476.c         | 1 -
>  drivers/iio/adc/ad7887.c         | 1 -
>  drivers/iio/dac/ad5446.c         | 1 -
>  drivers/staging/iio/cdc/ad7746.c | 1 -
>  4 files changed, 4 deletions(-)
> 
> diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c
> index e2a69dd6a47e..6286e230f55b 100644
> --- a/drivers/iio/adc/ad7476.c
> +++ b/drivers/iio/adc/ad7476.c
> @@ -300,7 +300,6 @@ static int ad7476_probe(struct spi_device *spi)
>  
>  	st->spi = spi;
>  
> -	/* Establish that the iio_dev is a child of the spi device */
>  	indio_dev->dev.of_node = spi->dev.of_node;
>  	indio_dev->name = spi_get_device_id(spi)->name;
>  	indio_dev->modes = INDIO_DIRECT_MODE;
> diff --git a/drivers/iio/adc/ad7887.c b/drivers/iio/adc/ad7887.c
> index ca4c98401ebc..0f93f5c8965d 100644
> --- a/drivers/iio/adc/ad7887.c
> +++ b/drivers/iio/adc/ad7887.c
> @@ -264,7 +264,6 @@ static int ad7887_probe(struct spi_device *spi)
>  	spi_set_drvdata(spi, indio_dev);
>  	st->spi = spi;
>  
> -	/* Estabilish that the iio_dev is a child of the spi device */
>  	indio_dev->dev.of_node = spi->dev.of_node;
>  	indio_dev->name = spi_get_device_id(spi)->name;
>  	indio_dev->info = &ad7887_info;
> diff --git a/drivers/iio/dac/ad5446.c b/drivers/iio/dac/ad5446.c
> index e01ba90dc106..5931bd630c4e 100644
> --- a/drivers/iio/dac/ad5446.c
> +++ b/drivers/iio/dac/ad5446.c
> @@ -250,7 +250,6 @@ static int ad5446_probe(struct device *dev, const char *name,
>  	st->reg = reg;
>  	st->dev = dev;
>  
> -	/* Establish that the iio_dev is a child of the device */
>  	indio_dev->name = name;
>  	indio_dev->info = &ad5446_info;
>  	indio_dev->modes = INDIO_DIRECT_MODE;
> diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c
> index bd9803c7c5b6..dfd71e99e872 100644
> --- a/drivers/staging/iio/cdc/ad7746.c
> +++ b/drivers/staging/iio/cdc/ad7746.c
> @@ -693,7 +693,6 @@ static int ad7746_probe(struct i2c_client *client,
>  	chip->client = client;
>  	chip->capdac_set = -1;
>  
> -	/* Establish that the iio_dev is a child of the i2c device */
>  	indio_dev->name = id->name;
>  	indio_dev->info = &ad7746_info;
>  	indio_dev->channels = ad7746_channels;


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 5/6] iio: light: lm3533-als: use iio_device_set_parent() to assign parent
  2020-06-03 11:40 ` [PATCH v2 5/6] iio: light: lm3533-als: use iio_device_set_parent() to assign parent Alexandru Ardelean
@ 2020-06-06 15:46   ` Jonathan Cameron
  0 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2020-06-06 15:46 UTC (permalink / raw)
  To: Alexandru Ardelean; +Cc: linux-iio, linux-kernel, johan, andy.shevchenko

On Wed, 3 Jun 2020 14:40:22 +0300
Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:

> This assignment is the more peculiar as it assigns the parent of the
> platform-device's device (i.e. pdev->dev.parent) as the IIO device's
> parent.
> 
> Since the devm_iio_device_alloc() [now] assigns the device argument as the
> default parent (and since this is the more common case), for cases
> where the parent needs to be different, the iio_device_set_parent helper
> should be used.
> 
> That makes things a bit more obvious about the new behavior of
> devm_iio_device_alloc() and makes it clearer that iio_device_set_parent()
> should be used.
> 
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Applied.

Thanks,

Jonathan

> ---
>  drivers/iio/light/lm3533-als.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/light/lm3533-als.c b/drivers/iio/light/lm3533-als.c
> index bc196c212881..8a621244dd01 100644
> --- a/drivers/iio/light/lm3533-als.c
> +++ b/drivers/iio/light/lm3533-als.c
> @@ -852,7 +852,7 @@ static int lm3533_als_probe(struct platform_device *pdev)
>  	indio_dev->channels = lm3533_als_channels;
>  	indio_dev->num_channels = ARRAY_SIZE(lm3533_als_channels);
>  	indio_dev->name = dev_name(&pdev->dev);
> -	indio_dev->dev.parent = pdev->dev.parent;
> +	iio_device_set_parent(indio_dev, pdev->dev.parent);
>  	indio_dev->modes = INDIO_DIRECT_MODE;
>  
>  	als = iio_priv(indio_dev);


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 0/6] iio: core: pass parent device as parameter during allocation
  2020-06-04 17:34   ` Jonathan Cameron
@ 2020-06-06 16:02     ` Jonathan Cameron
  2020-06-08  6:37       ` Alexandru Ardelean
  0 siblings, 1 reply; 18+ messages in thread
From: Jonathan Cameron @ 2020-06-06 16:02 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Ardelean, Alexandru, linux-kernel, linux-iio, andy.shevchenko, johan

On Thu, 4 Jun 2020 18:34:40 +0100
Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote:

> On Wed, 3 Jun 2020 11:41:52 +0000
> "Ardelean, Alexandru" <alexandru.Ardelean@analog.com> wrote:
> 
> > On Wed, 2020-06-03 at 14:40 +0300, Alexandru Ardelean wrote:  
> > > This patch updates the {devm_}iio_device_alloc() functions to automatically
> > > assign the parent device on allocation.
> > > For iio_device_alloc() this means a new parameter.
> > > For devm_iio_device_alloc() this means a new behavior; the device object is
> > > the parent. For this one, this is the common case for most drivers (except
> > > one: 'lm3533-als').
> > > 
> > > For the special cases an iio_device_set_parent() has been created to change
> > > the parent betwee allocation & registration.
> > > The purpose of this helper, is mostly to highlight the new behavior of
> > > devm_iio_device_alloc().
> > > 
> > > This patchset also removes explicit parent assignments from most IIO
> > > drivers (except for lm3533-als).
> > > 
> > > Using a semantic patch, about 303 drivers are updated, and some needed some
> > > manual attention. This is probably due to some limitations of spatch. At
> > > least in some cases the parent device is not the same variable as passed to
> > > devm_iio_device_alloc(), OR the parent assignment is moved to a separate
> > > function than where devm_iio_device_alloc() is called.
> > >     
> > 
> > Forgot to explicitly CC Jonathan.
> > But I'm hoping this shows up from the list.  
> 
> No problem.  I filter anything going to the list into the same folder
> whether or not I'm cc'd :) Well several folders on different machines via
> different email addresses, but you get the idea...

Patch 3 doesn't seem to have made it to me or the list.

I assumed no change from patch 2 in previous set and applied that.

After applying the rest of the series, there were left over cases in:

vcnl3020 (new)
ms5611 (hidden via an extra call)
st_sensors_spi (hidden via an extra call)
st_sensors_i2c (hidden via an extra call)
cros_ec_sensors_core (hidden via an extra call)

I've added them to patch 6 - with a note to say why.
If you could do a quick sanity check that would be great.

Thanks,

Jonathan


Thanks,

Jonathan

> 
> 
> >   
> > > Changelog v1 -> v2:
> > > * added iio_device_set_parent() helper (new commit)
> > > * update commit for lm3533-als to use iio_device_set_parent()
> > > 
> > > Alexandru Ardelean (6):
> > >   iio: core: pass parent device as parameter during allocation
> > >   iio: core: add iio_device_set_parent() helper
> > >   iio: remove explicit IIO device parent assignment
> > >   iio: remove left-over comments about parent assignment
> > >   iio: light: lm3533-als: use iio_device_set_parent() to assign parent
> > >   iio: remove left-over parent assignments
> > > 
> > >  drivers/counter/104-quad-8.c                  |  1 -
> > >  drivers/counter/stm32-lptimer-cnt.c           |  1 -
> > >  drivers/iio/accel/adis16201.c                 |  1 -
> > >  drivers/iio/accel/adis16209.c                 |  1 -
> > >  drivers/iio/accel/adxl345_core.c              |  1 -
> > >  drivers/iio/accel/adxl372.c                   |  1 -
> > >  drivers/iio/accel/bma180.c                    |  1 -
> > >  drivers/iio/accel/bma220_spi.c                |  1 -
> > >  drivers/iio/accel/bma400_core.c               |  1 -
> > >  drivers/iio/accel/bmc150-accel-core.c         |  1 -
> > >  drivers/iio/accel/da280.c                     |  1 -
> > >  drivers/iio/accel/da311.c                     |  1 -
> > >  drivers/iio/accel/dmard06.c                   |  1 -
> > >  drivers/iio/accel/dmard09.c                   |  1 -
> > >  drivers/iio/accel/dmard10.c                   |  1 -
> > >  drivers/iio/accel/hid-sensor-accel-3d.c       |  1 -
> > >  drivers/iio/accel/kxcjk-1013.c                |  1 -
> > >  drivers/iio/accel/kxsd9.c                     |  1 -
> > >  drivers/iio/accel/mc3230.c                    |  1 -
> > >  drivers/iio/accel/mma7455_core.c              |  1 -
> > >  drivers/iio/accel/mma7660.c                   |  1 -
> > >  drivers/iio/accel/mma8452.c                   |  1 -
> > >  drivers/iio/accel/mma9551.c                   |  1 -
> > >  drivers/iio/accel/mma9553.c                   |  1 -
> > >  drivers/iio/accel/mxc4005.c                   |  1 -
> > >  drivers/iio/accel/mxc6255.c                   |  1 -
> > >  drivers/iio/accel/sca3000.c                   |  1 -
> > >  drivers/iio/accel/ssp_accel_sensor.c          |  1 -
> > >  drivers/iio/accel/stk8312.c                   |  1 -
> > >  drivers/iio/accel/stk8ba50.c                  |  1 -
> > >  drivers/iio/adc/ab8500-gpadc.c                |  1 -
> > >  drivers/iio/adc/ad7091r-base.c                |  1 -
> > >  drivers/iio/adc/ad7124.c                      |  1 -
> > >  drivers/iio/adc/ad7192.c                      |  1 -
> > >  drivers/iio/adc/ad7266.c                      |  1 -
> > >  drivers/iio/adc/ad7291.c                      |  1 -
> > >  drivers/iio/adc/ad7292.c                      |  1 -
> > >  drivers/iio/adc/ad7298.c                      |  1 -
> > >  drivers/iio/adc/ad7476.c                      |  2 --
> > >  drivers/iio/adc/ad7606.c                      |  1 -
> > >  drivers/iio/adc/ad7766.c                      |  1 -
> > >  drivers/iio/adc/ad7768-1.c                    |  1 -
> > >  drivers/iio/adc/ad7780.c                      |  1 -
> > >  drivers/iio/adc/ad7791.c                      |  1 -
> > >  drivers/iio/adc/ad7793.c                      |  1 -
> > >  drivers/iio/adc/ad7887.c                      |  2 --
> > >  drivers/iio/adc/ad7923.c                      |  1 -
> > >  drivers/iio/adc/ad7949.c                      |  1 -
> > >  drivers/iio/adc/ad799x.c                      |  1 -
> > >  drivers/iio/adc/adi-axi-adc.c                 |  1 -
> > >  drivers/iio/adc/aspeed_adc.c                  |  1 -
> > >  drivers/iio/adc/at91-sama5d2_adc.c            |  1 -
> > >  drivers/iio/adc/at91_adc.c                    |  1 -
> > >  drivers/iio/adc/axp20x_adc.c                  |  1 -
> > >  drivers/iio/adc/axp288_adc.c                  |  1 -
> > >  drivers/iio/adc/bcm_iproc_adc.c               |  1 -
> > >  drivers/iio/adc/berlin2-adc.c                 |  1 -
> > >  drivers/iio/adc/cc10001_adc.c                 |  1 -
> > >  drivers/iio/adc/cpcap-adc.c                   |  1 -
> > >  drivers/iio/adc/da9150-gpadc.c                |  1 -
> > >  drivers/iio/adc/dln2-adc.c                    |  1 -
> > >  drivers/iio/adc/envelope-detector.c           |  1 -
> > >  drivers/iio/adc/ep93xx_adc.c                  |  1 -
> > >  drivers/iio/adc/exynos_adc.c                  |  1 -
> > >  drivers/iio/adc/fsl-imx25-gcq.c               |  1 -
> > >  drivers/iio/adc/hi8435.c                      |  1 -
> > >  drivers/iio/adc/hx711.c                       |  1 -
> > >  drivers/iio/adc/imx7d_adc.c                   |  1 -
> > >  drivers/iio/adc/ina2xx-adc.c                  |  1 -
> > >  drivers/iio/adc/ingenic-adc.c                 |  1 -
> > >  drivers/iio/adc/intel_mrfld_adc.c             |  1 -
> > >  drivers/iio/adc/lp8788_adc.c                  |  1 -
> > >  drivers/iio/adc/lpc18xx_adc.c                 |  1 -
> > >  drivers/iio/adc/lpc32xx_adc.c                 |  1 -
> > >  drivers/iio/adc/ltc2471.c                     |  1 -
> > >  drivers/iio/adc/ltc2485.c                     |  1 -
> > >  drivers/iio/adc/max1027.c                     |  1 -
> > >  drivers/iio/adc/max11100.c                    |  1 -
> > >  drivers/iio/adc/max1118.c                     |  1 -
> > >  drivers/iio/adc/max1241.c                     |  1 -
> > >  drivers/iio/adc/max1363.c                     |  2 --
> > >  drivers/iio/adc/max9611.c                     |  1 -
> > >  drivers/iio/adc/mcp320x.c                     |  1 -
> > >  drivers/iio/adc/mcp3422.c                     |  1 -
> > >  drivers/iio/adc/mcp3911.c                     |  1 -
> > >  drivers/iio/adc/men_z188_adc.c                |  1 -
> > >  drivers/iio/adc/meson_saradc.c                |  1 -
> > >  drivers/iio/adc/mt6577_auxadc.c               |  1 -
> > >  drivers/iio/adc/mxs-lradc-adc.c               |  1 -
> > >  drivers/iio/adc/nau7802.c                     |  1 -
> > >  drivers/iio/adc/npcm_adc.c                    |  1 -
> > >  drivers/iio/adc/palmas_gpadc.c                |  1 -
> > >  drivers/iio/adc/qcom-pm8xxx-xoadc.c           |  1 -
> > >  drivers/iio/adc/qcom-spmi-adc5.c              |  1 -
> > >  drivers/iio/adc/qcom-spmi-iadc.c              |  1 -
> > >  drivers/iio/adc/qcom-spmi-vadc.c              |  1 -
> > >  drivers/iio/adc/rcar-gyroadc.c                |  1 -
> > >  drivers/iio/adc/rn5t618-adc.c                 |  1 -
> > >  drivers/iio/adc/rockchip_saradc.c             |  1 -
> > >  drivers/iio/adc/sc27xx_adc.c                  |  1 -
> > >  drivers/iio/adc/sd_adc_modulator.c            |  1 -
> > >  drivers/iio/adc/spear_adc.c                   |  1 -
> > >  drivers/iio/adc/stm32-adc.c                   |  1 -
> > >  drivers/iio/adc/stm32-dfsdm-adc.c             |  1 -
> > >  drivers/iio/adc/stmpe-adc.c                   |  1 -
> > >  drivers/iio/adc/stx104.c                      |  1 -
> > >  drivers/iio/adc/sun4i-gpadc-iio.c             |  1 -
> > >  drivers/iio/adc/ti-adc081c.c                  |  1 -
> > >  drivers/iio/adc/ti-adc0832.c                  |  1 -
> > >  drivers/iio/adc/ti-adc084s021.c               |  1 -
> > >  drivers/iio/adc/ti-adc108s102.c               |  1 -
> > >  drivers/iio/adc/ti-adc12138.c                 |  1 -
> > >  drivers/iio/adc/ti-adc128s052.c               |  1 -
> > >  drivers/iio/adc/ti-adc161s626.c               |  1 -
> > >  drivers/iio/adc/ti-ads1015.c                  |  1 -
> > >  drivers/iio/adc/ti-ads124s08.c                |  1 -
> > >  drivers/iio/adc/ti-ads7950.c                  |  1 -
> > >  drivers/iio/adc/ti-ads8344.c                  |  1 -
> > >  drivers/iio/adc/ti-ads8688.c                  |  1 -
> > >  drivers/iio/adc/ti-tlc4541.c                  |  1 -
> > >  drivers/iio/adc/ti_am335x_adc.c               |  1 -
> > >  drivers/iio/adc/twl4030-madc.c                |  1 -
> > >  drivers/iio/adc/twl6030-gpadc.c               |  1 -
> > >  drivers/iio/adc/vf610_adc.c                   |  1 -
> > >  drivers/iio/adc/viperboard_adc.c              |  1 -
> > >  drivers/iio/adc/xilinx-xadc-core.c            |  1 -
> > >  drivers/iio/afe/iio-rescale.c                 |  1 -
> > >  drivers/iio/amplifiers/ad8366.c               |  1 -
> > >  drivers/iio/amplifiers/hmc425a.c              |  1 -
> > >  drivers/iio/chemical/ams-iaq-core.c           |  1 -
> > >  drivers/iio/chemical/atlas-sensor.c           |  1 -
> > >  drivers/iio/chemical/bme680_core.c            |  1 -
> > >  drivers/iio/chemical/ccs811.c                 |  1 -
> > >  drivers/iio/chemical/pms7003.c                |  1 -
> > >  drivers/iio/chemical/sgp30.c                  |  1 -
> > >  drivers/iio/chemical/sps30.c                  |  1 -
> > >  drivers/iio/chemical/vz89x.c                  |  1 -
> > >  drivers/iio/dac/ad5064.c                      |  1 -
> > >  drivers/iio/dac/ad5360.c                      |  1 -
> > >  drivers/iio/dac/ad5380.c                      |  1 -
> > >  drivers/iio/dac/ad5421.c                      |  1 -
> > >  drivers/iio/dac/ad5446.c                      |  2 --
> > >  drivers/iio/dac/ad5449.c                      |  1 -
> > >  drivers/iio/dac/ad5504.c                      |  1 -
> > >  drivers/iio/dac/ad5592r-base.c                |  1 -
> > >  drivers/iio/dac/ad5624r_spi.c                 |  1 -
> > >  drivers/iio/dac/ad5686.c                      |  1 -
> > >  drivers/iio/dac/ad5755.c                      |  1 -
> > >  drivers/iio/dac/ad5758.c                      |  1 -
> > >  drivers/iio/dac/ad5761.c                      |  1 -
> > >  drivers/iio/dac/ad5764.c                      |  1 -
> > >  drivers/iio/dac/ad5770r.c                     |  1 -
> > >  drivers/iio/dac/ad5791.c                      |  1 -
> > >  drivers/iio/dac/ad7303.c                      |  1 -
> > >  drivers/iio/dac/ad8801.c                      |  1 -
> > >  drivers/iio/dac/cio-dac.c                     |  1 -
> > >  drivers/iio/dac/dpot-dac.c                    |  1 -
> > >  drivers/iio/dac/ds4424.c                      |  1 -
> > >  drivers/iio/dac/lpc18xx_dac.c                 |  1 -
> > >  drivers/iio/dac/ltc1660.c                     |  1 -
> > >  drivers/iio/dac/ltc2632.c                     |  1 -
> > >  drivers/iio/dac/m62332.c                      |  3 ---
> > >  drivers/iio/dac/max517.c                      |  3 ---
> > >  drivers/iio/dac/max5821.c                     |  1 -
> > >  drivers/iio/dac/mcp4725.c                     |  1 -
> > >  drivers/iio/dac/mcp4922.c                     |  1 -
> > >  drivers/iio/dac/stm32-dac.c                   |  1 -
> > >  drivers/iio/dac/ti-dac082s085.c               |  1 -
> > >  drivers/iio/dac/ti-dac5571.c                  |  1 -
> > >  drivers/iio/dac/ti-dac7311.c                  |  1 -
> > >  drivers/iio/dac/ti-dac7612.c                  |  1 -
> > >  drivers/iio/dac/vf610_dac.c                   |  1 -
> > >  drivers/iio/dummy/iio_simple_dummy.c          | 14 ++++++-----
> > >  drivers/iio/frequency/ad9523.c                |  1 -
> > >  drivers/iio/frequency/adf4350.c               |  1 -
> > >  drivers/iio/frequency/adf4371.c               |  1 -
> > >  drivers/iio/gyro/adis16080.c                  |  1 -
> > >  drivers/iio/gyro/adis16130.c                  |  1 -
> > >  drivers/iio/gyro/adis16136.c                  |  1 -
> > >  drivers/iio/gyro/adis16260.c                  |  1 -
> > >  drivers/iio/gyro/adxrs450.c                   |  1 -
> > >  drivers/iio/gyro/bmg160_core.c                |  1 -
> > >  drivers/iio/gyro/fxas21002c_core.c            |  1 -
> > >  drivers/iio/gyro/hid-sensor-gyro-3d.c         |  1 -
> > >  drivers/iio/gyro/itg3200_core.c               |  1 -
> > >  drivers/iio/gyro/mpu3050-core.c               |  1 -
> > >  drivers/iio/gyro/ssp_gyro_sensor.c            |  1 -
> > >  drivers/iio/health/afe4403.c                  |  1 -
> > >  drivers/iio/health/afe4404.c                  |  1 -
> > >  drivers/iio/health/max30100.c                 |  1 -
> > >  drivers/iio/health/max30102.c                 |  1 -
> > >  drivers/iio/humidity/am2315.c                 |  1 -
> > >  drivers/iio/humidity/dht11.c                  |  1 -
> > >  drivers/iio/humidity/hdc100x.c                |  1 -
> > >  drivers/iio/humidity/hid-sensor-humidity.c    |  1 -
> > >  drivers/iio/humidity/hts221_core.c            |  1 -
> > >  drivers/iio/humidity/htu21.c                  |  1 -
> > >  drivers/iio/humidity/si7005.c                 |  1 -
> > >  drivers/iio/humidity/si7020.c                 |  1 -
> > >  drivers/iio/imu/adis16400.c                   |  1 -
> > >  drivers/iio/imu/adis16460.c                   |  1 -
> > >  drivers/iio/imu/adis16475.c                   |  1 -
> > >  drivers/iio/imu/adis16480.c                   |  1 -
> > >  drivers/iio/imu/bmi160/bmi160_core.c          |  1 -
> > >  drivers/iio/imu/fxos8700_core.c               |  1 -
> > >  drivers/iio/imu/inv_mpu6050/inv_mpu_core.c    |  1 -
> > >  drivers/iio/imu/kmx61.c                       |  1 -
> > >  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c  |  1 -
> > >  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c  |  1 -
> > >  drivers/iio/industrialio-core.c               | 11 +++++----
> > >  drivers/iio/light/acpi-als.c                  |  1 -
> > >  drivers/iio/light/adjd_s311.c                 |  1 -
> > >  drivers/iio/light/adux1020.c                  |  1 -
> > >  drivers/iio/light/al3010.c                    |  1 -
> > >  drivers/iio/light/al3320a.c                   |  1 -
> > >  drivers/iio/light/apds9300.c                  |  1 -
> > >  drivers/iio/light/apds9960.c                  |  1 -
> > >  drivers/iio/light/bh1750.c                    |  1 -
> > >  drivers/iio/light/bh1780.c                    |  1 -
> > >  drivers/iio/light/cm32181.c                   |  1 -
> > >  drivers/iio/light/cm3232.c                    |  1 -
> > >  drivers/iio/light/cm3323.c                    |  1 -
> > >  drivers/iio/light/cm3605.c                    |  1 -
> > >  drivers/iio/light/cm36651.c                   |  1 -
> > >  drivers/iio/light/gp2ap002.c                  |  1 -
> > >  drivers/iio/light/gp2ap020a00f.c              |  1 -
> > >  drivers/iio/light/hid-sensor-als.c            |  1 -
> > >  drivers/iio/light/hid-sensor-prox.c           |  1 -
> > >  drivers/iio/light/iqs621-als.c                |  1 -
> > >  drivers/iio/light/isl29018.c                  |  1 -
> > >  drivers/iio/light/isl29028.c                  |  1 -
> > >  drivers/iio/light/isl29125.c                  |  1 -
> > >  drivers/iio/light/jsa1212.c                   |  1 -
> > >  drivers/iio/light/lm3533-als.c                |  2 +-
> > >  drivers/iio/light/ltr501.c                    |  1 -
> > >  drivers/iio/light/lv0104cs.c                  |  1 -
> > >  drivers/iio/light/max44000.c                  |  1 -
> > >  drivers/iio/light/max44009.c                  |  1 -
> > >  drivers/iio/light/noa1305.c                   |  1 -
> > >  drivers/iio/light/opt3001.c                   |  1 -
> > >  drivers/iio/light/pa12203001.c                |  1 -
> > >  drivers/iio/light/rpr0521.c                   |  1 -
> > >  drivers/iio/light/si1133.c                    |  1 -
> > >  drivers/iio/light/si1145.c                    |  1 -
> > >  drivers/iio/light/st_uvis25_core.c            |  1 -
> > >  drivers/iio/light/stk3310.c                   |  1 -
> > >  drivers/iio/light/tcs3414.c                   |  1 -
> > >  drivers/iio/light/tcs3472.c                   |  1 -
> > >  drivers/iio/light/tsl2563.c                   |  1 -
> > >  drivers/iio/light/tsl2583.c                   |  1 -
> > >  drivers/iio/light/tsl2772.c                   |  1 -
> > >  drivers/iio/light/tsl4531.c                   |  1 -
> > >  drivers/iio/light/us5182d.c                   |  1 -
> > >  drivers/iio/light/vcnl4000.c                  |  1 -
> > >  drivers/iio/light/vcnl4035.c                  |  1 -
> > >  drivers/iio/light/veml6030.c                  |  1 -
> > >  drivers/iio/light/veml6070.c                  |  1 -
> > >  drivers/iio/light/vl6180.c                    |  1 -
> > >  drivers/iio/light/zopt2201.c                  |  1 -
> > >  drivers/iio/magnetometer/ak8974.c             |  1 -
> > >  drivers/iio/magnetometer/ak8975.c             |  1 -
> > >  drivers/iio/magnetometer/bmc150_magn.c        |  1 -
> > >  drivers/iio/magnetometer/hid-sensor-magn-3d.c |  1 -
> > >  drivers/iio/magnetometer/hmc5843_core.c       |  1 -
> > >  drivers/iio/magnetometer/mag3110.c            |  1 -
> > >  drivers/iio/magnetometer/mmc35240.c           |  1 -
> > >  drivers/iio/magnetometer/rm3100-core.c        |  1 -
> > >  drivers/iio/multiplexer/iio-mux.c             |  1 -
> > >  drivers/iio/orientation/hid-sensor-incl-3d.c  |  1 -
> > >  drivers/iio/orientation/hid-sensor-rotation.c |  1 -
> > >  drivers/iio/position/iqs624-pos.c             |  1 -
> > >  drivers/iio/potentiometer/ad5272.c            |  1 -
> > >  drivers/iio/potentiometer/ds1803.c            |  1 -
> > >  drivers/iio/potentiometer/max5432.c           |  1 -
> > >  drivers/iio/potentiometer/max5481.c           |  1 -
> > >  drivers/iio/potentiometer/max5487.c           |  1 -
> > >  drivers/iio/potentiometer/mcp4018.c           |  1 -
> > >  drivers/iio/potentiometer/mcp41010.c          |  1 -
> > >  drivers/iio/potentiometer/mcp4131.c           |  1 -
> > >  drivers/iio/potentiometer/mcp4531.c           |  1 -
> > >  drivers/iio/potentiometer/tpl0102.c           |  1 -
> > >  drivers/iio/potentiostat/lmp91000.c           |  1 -
> > >  drivers/iio/pressure/abp060mg.c               |  1 -
> > >  drivers/iio/pressure/bmp280-core.c            |  1 -
> > >  drivers/iio/pressure/dlhl60d.c                |  1 -
> > >  drivers/iio/pressure/dps310.c                 |  1 -
> > >  drivers/iio/pressure/hid-sensor-press.c       |  1 -
> > >  drivers/iio/pressure/hp03.c                   |  1 -
> > >  drivers/iio/pressure/hp206c.c                 |  1 -
> > >  drivers/iio/pressure/icp10100.c               |  1 -
> > >  drivers/iio/pressure/mpl115.c                 |  1 -
> > >  drivers/iio/pressure/mpl3115.c                |  1 -
> > >  drivers/iio/pressure/ms5637.c                 |  1 -
> > >  drivers/iio/pressure/t5403.c                  |  1 -
> > >  drivers/iio/pressure/zpa2326.c                |  1 -
> > >  drivers/iio/proximity/as3935.c                |  1 -
> > >  drivers/iio/proximity/isl29501.c              |  1 -
> > >  drivers/iio/proximity/mb1232.c                |  1 -
> > >  drivers/iio/proximity/ping.c                  |  1 -
> > >  .../iio/proximity/pulsedlight-lidar-lite-v2.c |  1 -
> > >  drivers/iio/proximity/rfd77402.c              |  1 -
> > >  drivers/iio/proximity/srf04.c                 |  1 -
> > >  drivers/iio/proximity/srf08.c                 |  1 -
> > >  drivers/iio/proximity/sx9310.c                |  1 -
> > >  drivers/iio/proximity/sx9500.c                |  1 -
> > >  drivers/iio/proximity/vl53l0x-i2c.c           |  1 -
> > >  drivers/iio/resolver/ad2s1200.c               |  1 -
> > >  drivers/iio/resolver/ad2s90.c                 |  1 -
> > >  .../iio/temperature/hid-sensor-temperature.c  |  1 -
> > >  drivers/iio/temperature/iqs620at-temp.c       |  1 -
> > >  drivers/iio/temperature/ltc2983.c             |  1 -
> > >  drivers/iio/temperature/max31856.c            |  1 -
> > >  drivers/iio/temperature/maxim_thermocouple.c  |  1 -
> > >  drivers/iio/temperature/mlx90614.c            |  1 -
> > >  drivers/iio/temperature/mlx90632.c            |  1 -
> > >  drivers/iio/temperature/tmp006.c              |  1 -
> > >  drivers/iio/temperature/tmp007.c              |  1 -
> > >  drivers/iio/temperature/tsys01.c              |  1 -
> > >  drivers/iio/temperature/tsys02d.c             |  1 -
> > >  drivers/iio/trigger/stm32-timer-trigger.c     |  1 -
> > >  drivers/input/touchscreen/tsc2007_iio.c       |  1 -
> > >  drivers/platform/x86/toshiba_acpi.c           |  3 +--
> > >  drivers/staging/iio/Documentation/device.txt  |  4 +---
> > >  drivers/staging/iio/accel/adis16203.c         |  1 -
> > >  drivers/staging/iio/accel/adis16240.c         |  1 -
> > >  drivers/staging/iio/adc/ad7280a.c             |  1 -
> > >  drivers/staging/iio/adc/ad7816.c              |  1 -
> > >  drivers/staging/iio/addac/adt7316.c           |  1 -
> > >  drivers/staging/iio/cdc/ad7150.c              |  2 --
> > >  drivers/staging/iio/cdc/ad7746.c              |  2 --
> > >  drivers/staging/iio/frequency/ad9832.c        |  1 -
> > >  drivers/staging/iio/frequency/ad9834.c        |  1 -
> > >  .../staging/iio/impedance-analyzer/ad5933.c   |  1 -
> > >  drivers/staging/iio/resolver/ad2s1210.c       |  1 -
> > >  include/linux/iio/iio.h                       | 24 +++++++++++++++++--
> > >  335 files changed, 39 insertions(+), 358 deletions(-)
> > >     
> 
> 


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 6/6] iio: remove left-over parent assignments
  2020-06-03 11:40 ` [PATCH v2 6/6] iio: remove left-over parent assignments Alexandru Ardelean
@ 2020-06-06 16:05   ` Jonathan Cameron
  2020-06-11  6:52     ` Ardelean, Alexandru
  0 siblings, 1 reply; 18+ messages in thread
From: Jonathan Cameron @ 2020-06-06 16:05 UTC (permalink / raw)
  To: Alexandru Ardelean; +Cc: linux-iio, linux-kernel, johan, andy.shevchenko

On Wed, 3 Jun 2020 14:40:23 +0300
Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:

> These were found by doing some shell magic:
> ------------
> for file in $(git grep -w devm_iio_device_alloc | cut -d: -f1 | sort | uniq) ; do
> 	if grep 'parent =' $file | grep -v trig | grep -vq devm_; then
> 		echo "$file -> $(grep "parent =" $file)"
> 	fi
> done
> -----------
> 
> The output is bearable [after the semantic patch is applied].
> There is a mix of trigger assignments with some iio device parent
> assignments that are removed via this patch.
> 
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>

I added a bunch more via a grep of simple parent\ = 
and eyeballing it.  Much easier to do after your patches as far
fewer entries.

vcnl3020 (new)
ms5611 (hidden via an extra call)
st_sensors_spi (hidden via an extra call)
st_sensors_i2c (hidden via an extra call)
cros_ec_sensors_core (hidden via an extra call)
> ---
>  drivers/iio/accel/kxcjk-1013.c                    | 1 -
>  drivers/iio/accel/mma8452.c                       | 1 -
>  drivers/iio/accel/mma9553.c                       | 1 -
>  drivers/iio/adc/ad7192.c                          | 1 -
>  drivers/iio/adc/hx711.c                           | 1 -
>  drivers/iio/adc/max1363.c                         | 2 --
>  drivers/iio/adc/mcp3911.c                         | 1 -
>  drivers/iio/adc/qcom-spmi-iadc.c                  | 1 -
>  drivers/iio/amplifiers/ad8366.c                   | 1 -
>  drivers/iio/chemical/vz89x.c                      | 1 -
>  drivers/iio/dac/ad5770r.c                         | 1 -
>  drivers/iio/health/afe4403.c                      | 1 -
>  drivers/iio/health/afe4404.c                      | 1 -
>  drivers/iio/humidity/dht11.c                      | 1 -
>  drivers/iio/humidity/hts221_core.c                | 1 -
>  drivers/iio/imu/inv_mpu6050/inv_mpu_core.c        | 1 -
>  drivers/iio/light/cm3605.c                        | 1 -
>  drivers/iio/light/ltr501.c                        | 1 -
>  drivers/iio/magnetometer/ak8975.c                 | 1 -
>  drivers/iio/orientation/hid-sensor-rotation.c     | 1 -
>  drivers/iio/potentiostat/lmp91000.c               | 1 -
>  drivers/iio/proximity/ping.c                      | 1 -
>  drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 1 -
>  drivers/iio/proximity/srf04.c                     | 1 -
>  drivers/iio/proximity/srf08.c                     | 1 -
>  drivers/iio/temperature/tsys01.c                  | 1 -
>  drivers/staging/iio/addac/adt7316.c               | 1 -
>  27 files changed, 28 deletions(-)
> 
> diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
> index c9924a65c32a..6b93521c0e17 100644
> --- a/drivers/iio/accel/kxcjk-1013.c
> +++ b/drivers/iio/accel/kxcjk-1013.c
> @@ -1311,7 +1311,6 @@ static int kxcjk1013_probe(struct i2c_client *client,
>  
>  	mutex_init(&data->mutex);
>  
> -	indio_dev->dev.parent = &client->dev;
>  	indio_dev->channels = kxcjk1013_channels;
>  	indio_dev->num_channels = ARRAY_SIZE(kxcjk1013_channels);
>  	indio_dev->available_scan_masks = kxcjk1013_scan_masks;
> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
> index 00e100fc845a..ef3df402fc3c 100644
> --- a/drivers/iio/accel/mma8452.c
> +++ b/drivers/iio/accel/mma8452.c
> @@ -1592,7 +1592,6 @@ static int mma8452_probe(struct i2c_client *client,
>  	i2c_set_clientdata(client, indio_dev);
>  	indio_dev->info = &mma8452_info;
>  	indio_dev->name = id->name;
> -	indio_dev->dev.parent = &client->dev;
>  	indio_dev->modes = INDIO_DIRECT_MODE;
>  	indio_dev->channels = data->chip_info->channels;
>  	indio_dev->num_channels = data->chip_info->num_channels;
> diff --git a/drivers/iio/accel/mma9553.c b/drivers/iio/accel/mma9553.c
> index 312070dcf035..c15908faa381 100644
> --- a/drivers/iio/accel/mma9553.c
> +++ b/drivers/iio/accel/mma9553.c
> @@ -1103,7 +1103,6 @@ static int mma9553_probe(struct i2c_client *client,
>  	if (ret < 0)
>  		return ret;
>  
> -	indio_dev->dev.parent = &client->dev;
>  	indio_dev->channels = mma9553_channels;
>  	indio_dev->num_channels = ARRAY_SIZE(mma9553_channels);
>  	indio_dev->name = name;
> diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
> index 08ba1a8f05eb..a0837d7e9176 100644
> --- a/drivers/iio/adc/ad7192.c
> +++ b/drivers/iio/adc/ad7192.c
> @@ -970,7 +970,6 @@ static int ad7192_probe(struct spi_device *spi)
>  
>  	spi_set_drvdata(spi, indio_dev);
>  	st->chip_info = of_device_get_match_data(&spi->dev);
> -	indio_dev->dev.parent = &spi->dev;
>  	indio_dev->name = st->chip_info->name;
>  	indio_dev->modes = INDIO_DIRECT_MODE;
>  
> diff --git a/drivers/iio/adc/hx711.c b/drivers/iio/adc/hx711.c
> index c8686558429b..6a173531d355 100644
> --- a/drivers/iio/adc/hx711.c
> +++ b/drivers/iio/adc/hx711.c
> @@ -551,7 +551,6 @@ static int hx711_probe(struct platform_device *pdev)
>  	platform_set_drvdata(pdev, indio_dev);
>  
>  	indio_dev->name = "hx711";
> -	indio_dev->dev.parent = &pdev->dev;
>  	indio_dev->info = &hx711_iio_info;
>  	indio_dev->modes = INDIO_DIRECT_MODE;
>  	indio_dev->channels = hx711_chan_spec;
> diff --git a/drivers/iio/adc/max1363.c b/drivers/iio/adc/max1363.c
> index 9d92017c79b2..cc1ba7bfc8e6 100644
> --- a/drivers/iio/adc/max1363.c
> +++ b/drivers/iio/adc/max1363.c
> @@ -1652,8 +1652,6 @@ static int max1363_probe(struct i2c_client *client,
>  	if (ret)
>  		goto error_disable_reg;
>  
> -	/* Establish that the iio_dev is a child of the i2c device */
> -	indio_dev->dev.parent = &client->dev;
>  	indio_dev->dev.of_node = client->dev.of_node;
>  	indio_dev->name = id->name;
>  	indio_dev->channels = st->chip_info->channels;
> diff --git a/drivers/iio/adc/mcp3911.c b/drivers/iio/adc/mcp3911.c
> index dd52f08ec82e..818b92518c66 100644
> --- a/drivers/iio/adc/mcp3911.c
> +++ b/drivers/iio/adc/mcp3911.c
> @@ -293,7 +293,6 @@ static int mcp3911_probe(struct spi_device *spi)
>  	if (ret)
>  		goto clk_disable;
>  
> -	indio_dev->dev.parent = &spi->dev;
>  	indio_dev->dev.of_node = spi->dev.of_node;
>  	indio_dev->name = spi_get_device_id(spi)->name;
>  	indio_dev->modes = INDIO_DIRECT_MODE;
> diff --git a/drivers/iio/adc/qcom-spmi-iadc.c b/drivers/iio/adc/qcom-spmi-iadc.c
> index 46858eddf1c3..1c90ad33a881 100644
> --- a/drivers/iio/adc/qcom-spmi-iadc.c
> +++ b/drivers/iio/adc/qcom-spmi-iadc.c
> @@ -553,7 +553,6 @@ static int iadc_probe(struct platform_device *pdev)
>  		return ret;
>  	}
>  
> -	indio_dev->dev.parent = dev;
>  	indio_dev->dev.of_node = node;
>  	indio_dev->name = pdev->name;
>  	indio_dev->modes = INDIO_DIRECT_MODE;
> diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad8366.c
> index 62167b87caea..2595e9cb0b2d 100644
> --- a/drivers/iio/amplifiers/ad8366.c
> +++ b/drivers/iio/amplifiers/ad8366.c
> @@ -274,7 +274,6 @@ static int ad8366_probe(struct spi_device *spi)
>  	}
>  
>  	st->info = &ad8366_infos[st->type];
> -	indio_dev->dev.parent = &spi->dev;
>  	indio_dev->name = spi_get_device_id(spi)->name;
>  	indio_dev->info = &ad8366_info;
>  	indio_dev->modes = INDIO_DIRECT_MODE;
> diff --git a/drivers/iio/chemical/vz89x.c b/drivers/iio/chemical/vz89x.c
> index 415b39339d4e..5586eb8e12cd 100644
> --- a/drivers/iio/chemical/vz89x.c
> +++ b/drivers/iio/chemical/vz89x.c
> @@ -382,7 +382,6 @@ static int vz89x_probe(struct i2c_client *client,
>  	data->last_update = jiffies - HZ;
>  	mutex_init(&data->lock);
>  
> -	indio_dev->dev.parent = &client->dev;
>  	indio_dev->info = &vz89x_info;
>  	indio_dev->name = dev_name(&client->dev);
>  	indio_dev->modes = INDIO_DIRECT_MODE;
> diff --git a/drivers/iio/dac/ad5770r.c b/drivers/iio/dac/ad5770r.c
> index 2d7623b9b2c0..84dcf149261f 100644
> --- a/drivers/iio/dac/ad5770r.c
> +++ b/drivers/iio/dac/ad5770r.c
> @@ -651,7 +651,6 @@ static int ad5770r_probe(struct spi_device *spi)
>  		}
>  	}
>  
> -	indio_dev->dev.parent = &spi->dev;
>  	indio_dev->name = spi_get_device_id(spi)->name;
>  	indio_dev->info = &ad5770r_info;
>  	indio_dev->modes = INDIO_DIRECT_MODE;
> diff --git a/drivers/iio/health/afe4403.c b/drivers/iio/health/afe4403.c
> index e9f87e42ff4f..ed230f12b2f8 100644
> --- a/drivers/iio/health/afe4403.c
> +++ b/drivers/iio/health/afe4403.c
> @@ -509,7 +509,6 @@ static int afe4403_probe(struct spi_device *spi)
>  	}
>  
>  	indio_dev->modes = INDIO_DIRECT_MODE;
> -	indio_dev->dev.parent = afe->dev;
>  	indio_dev->channels = afe4403_channels;
>  	indio_dev->num_channels = ARRAY_SIZE(afe4403_channels);
>  	indio_dev->name = AFE4403_DRIVER_NAME;
> diff --git a/drivers/iio/health/afe4404.c b/drivers/iio/health/afe4404.c
> index e728bbb21ca8..3a3efae4695a 100644
> --- a/drivers/iio/health/afe4404.c
> +++ b/drivers/iio/health/afe4404.c
> @@ -517,7 +517,6 @@ static int afe4404_probe(struct i2c_client *client,
>  	}
>  
>  	indio_dev->modes = INDIO_DIRECT_MODE;
> -	indio_dev->dev.parent = afe->dev;
>  	indio_dev->channels = afe4404_channels;
>  	indio_dev->num_channels = ARRAY_SIZE(afe4404_channels);
>  	indio_dev->name = AFE4404_DRIVER_NAME;
> diff --git a/drivers/iio/humidity/dht11.c b/drivers/iio/humidity/dht11.c
> index d05c6fdb758b..9a7819817488 100644
> --- a/drivers/iio/humidity/dht11.c
> +++ b/drivers/iio/humidity/dht11.c
> @@ -321,7 +321,6 @@ static int dht11_probe(struct platform_device *pdev)
>  	init_completion(&dht11->completion);
>  	mutex_init(&dht11->lock);
>  	iio->name = pdev->name;
> -	iio->dev.parent = &pdev->dev;
>  	iio->info = &dht11_iio_info;
>  	iio->modes = INDIO_DIRECT_MODE;
>  	iio->channels = dht11_chan_spec;
> diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
> index 7ce1bd1defa0..16657789dc45 100644
> --- a/drivers/iio/humidity/hts221_core.c
> +++ b/drivers/iio/humidity/hts221_core.c
> @@ -572,7 +572,6 @@ int hts221_probe(struct device *dev, int irq, const char *name,
>  		return err;
>  
>  	iio_dev->modes = INDIO_DIRECT_MODE;
> -	iio_dev->dev.parent = hw->dev;
>  	iio_dev->available_scan_masks = hts221_scan_masks;
>  	iio_dev->channels = hts221_channels;
>  	iio_dev->num_channels = ARRAY_SIZE(hts221_channels);
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> index 4d604fe842e5..153f855db8d6 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> @@ -1530,7 +1530,6 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,
>  	}
>  
>  	dev_set_drvdata(dev, indio_dev);
> -	indio_dev->dev.parent = dev;
>  	/* name will be NULL when enumerated via ACPI */
>  	if (name)
>  		indio_dev->name = name;
> diff --git a/drivers/iio/light/cm3605.c b/drivers/iio/light/cm3605.c
> index 964ede49f662..4c83953672be 100644
> --- a/drivers/iio/light/cm3605.c
> +++ b/drivers/iio/light/cm3605.c
> @@ -239,7 +239,6 @@ static int cm3605_probe(struct platform_device *pdev)
>  	led_trigger_register_simple("cm3605", &cm3605->led);
>  	led_trigger_event(cm3605->led, LED_FULL);
>  
> -	indio_dev->dev.parent = dev;
>  	indio_dev->info = &cm3605_info;
>  	indio_dev->name = "cm3605";
>  	indio_dev->channels = cm3605_channels;
> diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
> index 5a3fcb127cd2..4bac0646398d 100644
> --- a/drivers/iio/light/ltr501.c
> +++ b/drivers/iio/light/ltr501.c
> @@ -1480,7 +1480,6 @@ static int ltr501_probe(struct i2c_client *client,
>  	if ((partid >> 4) != data->chip_info->partid)
>  		return -ENODEV;
>  
> -	indio_dev->dev.parent = &client->dev;
>  	indio_dev->info = data->chip_info->info;
>  	indio_dev->channels = data->chip_info->channels;
>  	indio_dev->num_channels = data->chip_info->no_channels;
> diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c
> index a23422aad97d..03d71f796177 100644
> --- a/drivers/iio/magnetometer/ak8975.c
> +++ b/drivers/iio/magnetometer/ak8975.c
> @@ -940,7 +940,6 @@ static int ak8975_probe(struct i2c_client *client,
>  	}
>  
>  	mutex_init(&data->lock);
> -	indio_dev->dev.parent = &client->dev;
>  	indio_dev->channels = ak8975_channels;
>  	indio_dev->num_channels = ARRAY_SIZE(ak8975_channels);
>  	indio_dev->info = &ak8975_info;
> diff --git a/drivers/iio/orientation/hid-sensor-rotation.c b/drivers/iio/orientation/hid-sensor-rotation.c
> index b99f41240e3e..23bc61a7f018 100644
> --- a/drivers/iio/orientation/hid-sensor-rotation.c
> +++ b/drivers/iio/orientation/hid-sensor-rotation.c
> @@ -281,7 +281,6 @@ static int hid_dev_rot_probe(struct platform_device *pdev)
>  	}
>  
>  	indio_dev->num_channels = ARRAY_SIZE(dev_rot_channels);
> -	indio_dev->dev.parent = &pdev->dev;
>  	indio_dev->info = &dev_rot_info;
>  	indio_dev->name = name;
>  	indio_dev->modes = INDIO_DIRECT_MODE;
> diff --git a/drivers/iio/potentiostat/lmp91000.c b/drivers/iio/potentiostat/lmp91000.c
> index 2cb11da18e0f..2d601889c8c0 100644
> --- a/drivers/iio/potentiostat/lmp91000.c
> +++ b/drivers/iio/potentiostat/lmp91000.c
> @@ -321,7 +321,6 @@ static int lmp91000_probe(struct i2c_client *client,
>  	indio_dev->channels = lmp91000_channels;
>  	indio_dev->num_channels = ARRAY_SIZE(lmp91000_channels);
>  	indio_dev->name = LMP91000_DRV_NAME;
> -	indio_dev->dev.parent = &client->dev;
>  	indio_dev->modes = INDIO_DIRECT_MODE;
>  	i2c_set_clientdata(client, indio_dev);
>  
> diff --git a/drivers/iio/proximity/ping.c b/drivers/iio/proximity/ping.c
> index 2e99eeb27f2e..1283ac1c2e03 100644
> --- a/drivers/iio/proximity/ping.c
> +++ b/drivers/iio/proximity/ping.c
> @@ -309,7 +309,6 @@ static int ping_probe(struct platform_device *pdev)
>  	platform_set_drvdata(pdev, indio_dev);
>  
>  	indio_dev->name = "ping";
> -	indio_dev->dev.parent = &pdev->dev;
>  	indio_dev->info = &ping_iio_info;
>  	indio_dev->modes = INDIO_DIRECT_MODE;
>  	indio_dev->channels = ping_chan_spec;
> diff --git a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> index 5b369645ef49..a8e716dbd24e 100644
> --- a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> +++ b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> @@ -270,7 +270,6 @@ static int lidar_probe(struct i2c_client *client,
>  	indio_dev->name = LIDAR_DRV_NAME;
>  	indio_dev->channels = lidar_channels;
>  	indio_dev->num_channels = ARRAY_SIZE(lidar_channels);
> -	indio_dev->dev.parent = &client->dev;
>  	indio_dev->modes = INDIO_DIRECT_MODE;
>  
>  	i2c_set_clientdata(client, indio_dev);
> diff --git a/drivers/iio/proximity/srf04.c b/drivers/iio/proximity/srf04.c
> index 568b76e06385..2a3acff431d7 100644
> --- a/drivers/iio/proximity/srf04.c
> +++ b/drivers/iio/proximity/srf04.c
> @@ -317,7 +317,6 @@ static int srf04_probe(struct platform_device *pdev)
>  	platform_set_drvdata(pdev, indio_dev);
>  
>  	indio_dev->name = "srf04";
> -	indio_dev->dev.parent = &pdev->dev;
>  	indio_dev->info = &srf04_iio_info;
>  	indio_dev->modes = INDIO_DIRECT_MODE;
>  	indio_dev->channels = srf04_chan_spec;
> diff --git a/drivers/iio/proximity/srf08.c b/drivers/iio/proximity/srf08.c
> index b23ce446b7be..6677221d5818 100644
> --- a/drivers/iio/proximity/srf08.c
> +++ b/drivers/iio/proximity/srf08.c
> @@ -483,7 +483,6 @@ static int srf08_probe(struct i2c_client *client,
>  	}
>  
>  	indio_dev->name = id->name;
> -	indio_dev->dev.parent = &client->dev;
>  	indio_dev->modes = INDIO_DIRECT_MODE;
>  	indio_dev->channels = srf08_channels;
>  	indio_dev->num_channels = ARRAY_SIZE(srf08_channels);
> diff --git a/drivers/iio/temperature/tsys01.c b/drivers/iio/temperature/tsys01.c
> index d41f050c2fea..2c631a1ca33b 100644
> --- a/drivers/iio/temperature/tsys01.c
> +++ b/drivers/iio/temperature/tsys01.c
> @@ -160,7 +160,6 @@ static int tsys01_probe(struct iio_dev *indio_dev, struct device *dev)
>  
>  	indio_dev->info = &tsys01_info;
>  	indio_dev->name = dev->driver->name;
> -	indio_dev->dev.parent = dev;
>  	indio_dev->modes = INDIO_DIRECT_MODE;
>  	indio_dev->channels = tsys01_channels;
>  	indio_dev->num_channels = ARRAY_SIZE(tsys01_channels);
> diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c
> index 9cb3d0e42c38..ccbafcaaf27e 100644
> --- a/drivers/staging/iio/addac/adt7316.c
> +++ b/drivers/staging/iio/addac/adt7316.c
> @@ -2171,7 +2171,6 @@ int adt7316_probe(struct device *dev, struct adt7316_bus *bus,
>  	if ((chip->id & ID_FAMILY_MASK) == ID_ADT75XX)
>  		chip->int_mask |= ADT7516_AIN_INT_MASK;
>  
> -	indio_dev->dev.parent = dev;
>  	if ((chip->id & ID_FAMILY_MASK) == ID_ADT75XX)
>  		indio_dev->info = &adt7516_info;
>  	else


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 0/6] iio: core: pass parent device as parameter during allocation
  2020-06-06 16:02     ` Jonathan Cameron
@ 2020-06-08  6:37       ` Alexandru Ardelean
  2020-06-08 11:10         ` Jonathan Cameron
  0 siblings, 1 reply; 18+ messages in thread
From: Alexandru Ardelean @ 2020-06-08  6:37 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Jonathan Cameron, Ardelean, Alexandru, linux-kernel, linux-iio,
	andy.shevchenko, johan

On Sat, Jun 6, 2020 at 7:03 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> On Thu, 4 Jun 2020 18:34:40 +0100
> Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote:
>
> > On Wed, 3 Jun 2020 11:41:52 +0000
> > "Ardelean, Alexandru" <alexandru.Ardelean@analog.com> wrote:
> >
> > > On Wed, 2020-06-03 at 14:40 +0300, Alexandru Ardelean wrote:
> > > > This patch updates the {devm_}iio_device_alloc() functions to automatically
> > > > assign the parent device on allocation.
> > > > For iio_device_alloc() this means a new parameter.
> > > > For devm_iio_device_alloc() this means a new behavior; the device object is
> > > > the parent. For this one, this is the common case for most drivers (except
> > > > one: 'lm3533-als').
> > > >
> > > > For the special cases an iio_device_set_parent() has been created to change
> > > > the parent betwee allocation & registration.
> > > > The purpose of this helper, is mostly to highlight the new behavior of
> > > > devm_iio_device_alloc().
> > > >
> > > > This patchset also removes explicit parent assignments from most IIO
> > > > drivers (except for lm3533-als).
> > > >
> > > > Using a semantic patch, about 303 drivers are updated, and some needed some
> > > > manual attention. This is probably due to some limitations of spatch. At
> > > > least in some cases the parent device is not the same variable as passed to
> > > > devm_iio_device_alloc(), OR the parent assignment is moved to a separate
> > > > function than where devm_iio_device_alloc() is called.
> > > >
> > >
> > > Forgot to explicitly CC Jonathan.
> > > But I'm hoping this shows up from the list.
> >
> > No problem.  I filter anything going to the list into the same folder
> > whether or not I'm cc'd :) Well several folders on different machines via
> > different email addresses, but you get the idea...
>
> Patch 3 doesn't seem to have made it to me or the list.
>

hmm, that's weird;
i'll check my work email inbox and see if it got there;
i'm in a short vacation this week; and left everything at work [intentionally]

> I assumed no change from patch 2 in previous set and applied that.
>
that looks like the spatch patch;
nothing changed there;

> After applying the rest of the series, there were left over cases in:
>
> vcnl3020 (new)
> ms5611 (hidden via an extra call)
> st_sensors_spi (hidden via an extra call)
> st_sensors_i2c (hidden via an extra call)
> cros_ec_sensors_core (hidden via an extra call)
>
> I've added them to patch 6 - with a note to say why.
> If you could do a quick sanity check that would be great.
>

did you push the branch anywhere?
i can't seem to find the patches

> Thanks,
>
> Jonathan
>
>
> Thanks,
>
> Jonathan
>
> >
> >
> > >
> > > > Changelog v1 -> v2:
> > > > * added iio_device_set_parent() helper (new commit)
> > > > * update commit for lm3533-als to use iio_device_set_parent()
> > > >
> > > > Alexandru Ardelean (6):
> > > >   iio: core: pass parent device as parameter during allocation
> > > >   iio: core: add iio_device_set_parent() helper
> > > >   iio: remove explicit IIO device parent assignment
> > > >   iio: remove left-over comments about parent assignment
> > > >   iio: light: lm3533-als: use iio_device_set_parent() to assign parent
> > > >   iio: remove left-over parent assignments
> > > >
> > > >  drivers/counter/104-quad-8.c                  |  1 -
> > > >  drivers/counter/stm32-lptimer-cnt.c           |  1 -
> > > >  drivers/iio/accel/adis16201.c                 |  1 -
> > > >  drivers/iio/accel/adis16209.c                 |  1 -
> > > >  drivers/iio/accel/adxl345_core.c              |  1 -
> > > >  drivers/iio/accel/adxl372.c                   |  1 -
> > > >  drivers/iio/accel/bma180.c                    |  1 -
> > > >  drivers/iio/accel/bma220_spi.c                |  1 -
> > > >  drivers/iio/accel/bma400_core.c               |  1 -
> > > >  drivers/iio/accel/bmc150-accel-core.c         |  1 -
> > > >  drivers/iio/accel/da280.c                     |  1 -
> > > >  drivers/iio/accel/da311.c                     |  1 -
> > > >  drivers/iio/accel/dmard06.c                   |  1 -
> > > >  drivers/iio/accel/dmard09.c                   |  1 -
> > > >  drivers/iio/accel/dmard10.c                   |  1 -
> > > >  drivers/iio/accel/hid-sensor-accel-3d.c       |  1 -
> > > >  drivers/iio/accel/kxcjk-1013.c                |  1 -
> > > >  drivers/iio/accel/kxsd9.c                     |  1 -
> > > >  drivers/iio/accel/mc3230.c                    |  1 -
> > > >  drivers/iio/accel/mma7455_core.c              |  1 -
> > > >  drivers/iio/accel/mma7660.c                   |  1 -
> > > >  drivers/iio/accel/mma8452.c                   |  1 -
> > > >  drivers/iio/accel/mma9551.c                   |  1 -
> > > >  drivers/iio/accel/mma9553.c                   |  1 -
> > > >  drivers/iio/accel/mxc4005.c                   |  1 -
> > > >  drivers/iio/accel/mxc6255.c                   |  1 -
> > > >  drivers/iio/accel/sca3000.c                   |  1 -
> > > >  drivers/iio/accel/ssp_accel_sensor.c          |  1 -
> > > >  drivers/iio/accel/stk8312.c                   |  1 -
> > > >  drivers/iio/accel/stk8ba50.c                  |  1 -
> > > >  drivers/iio/adc/ab8500-gpadc.c                |  1 -
> > > >  drivers/iio/adc/ad7091r-base.c                |  1 -
> > > >  drivers/iio/adc/ad7124.c                      |  1 -
> > > >  drivers/iio/adc/ad7192.c                      |  1 -
> > > >  drivers/iio/adc/ad7266.c                      |  1 -
> > > >  drivers/iio/adc/ad7291.c                      |  1 -
> > > >  drivers/iio/adc/ad7292.c                      |  1 -
> > > >  drivers/iio/adc/ad7298.c                      |  1 -
> > > >  drivers/iio/adc/ad7476.c                      |  2 --
> > > >  drivers/iio/adc/ad7606.c                      |  1 -
> > > >  drivers/iio/adc/ad7766.c                      |  1 -
> > > >  drivers/iio/adc/ad7768-1.c                    |  1 -
> > > >  drivers/iio/adc/ad7780.c                      |  1 -
> > > >  drivers/iio/adc/ad7791.c                      |  1 -
> > > >  drivers/iio/adc/ad7793.c                      |  1 -
> > > >  drivers/iio/adc/ad7887.c                      |  2 --
> > > >  drivers/iio/adc/ad7923.c                      |  1 -
> > > >  drivers/iio/adc/ad7949.c                      |  1 -
> > > >  drivers/iio/adc/ad799x.c                      |  1 -
> > > >  drivers/iio/adc/adi-axi-adc.c                 |  1 -
> > > >  drivers/iio/adc/aspeed_adc.c                  |  1 -
> > > >  drivers/iio/adc/at91-sama5d2_adc.c            |  1 -
> > > >  drivers/iio/adc/at91_adc.c                    |  1 -
> > > >  drivers/iio/adc/axp20x_adc.c                  |  1 -
> > > >  drivers/iio/adc/axp288_adc.c                  |  1 -
> > > >  drivers/iio/adc/bcm_iproc_adc.c               |  1 -
> > > >  drivers/iio/adc/berlin2-adc.c                 |  1 -
> > > >  drivers/iio/adc/cc10001_adc.c                 |  1 -
> > > >  drivers/iio/adc/cpcap-adc.c                   |  1 -
> > > >  drivers/iio/adc/da9150-gpadc.c                |  1 -
> > > >  drivers/iio/adc/dln2-adc.c                    |  1 -
> > > >  drivers/iio/adc/envelope-detector.c           |  1 -
> > > >  drivers/iio/adc/ep93xx_adc.c                  |  1 -
> > > >  drivers/iio/adc/exynos_adc.c                  |  1 -
> > > >  drivers/iio/adc/fsl-imx25-gcq.c               |  1 -
> > > >  drivers/iio/adc/hi8435.c                      |  1 -
> > > >  drivers/iio/adc/hx711.c                       |  1 -
> > > >  drivers/iio/adc/imx7d_adc.c                   |  1 -
> > > >  drivers/iio/adc/ina2xx-adc.c                  |  1 -
> > > >  drivers/iio/adc/ingenic-adc.c                 |  1 -
> > > >  drivers/iio/adc/intel_mrfld_adc.c             |  1 -
> > > >  drivers/iio/adc/lp8788_adc.c                  |  1 -
> > > >  drivers/iio/adc/lpc18xx_adc.c                 |  1 -
> > > >  drivers/iio/adc/lpc32xx_adc.c                 |  1 -
> > > >  drivers/iio/adc/ltc2471.c                     |  1 -
> > > >  drivers/iio/adc/ltc2485.c                     |  1 -
> > > >  drivers/iio/adc/max1027.c                     |  1 -
> > > >  drivers/iio/adc/max11100.c                    |  1 -
> > > >  drivers/iio/adc/max1118.c                     |  1 -
> > > >  drivers/iio/adc/max1241.c                     |  1 -
> > > >  drivers/iio/adc/max1363.c                     |  2 --
> > > >  drivers/iio/adc/max9611.c                     |  1 -
> > > >  drivers/iio/adc/mcp320x.c                     |  1 -
> > > >  drivers/iio/adc/mcp3422.c                     |  1 -
> > > >  drivers/iio/adc/mcp3911.c                     |  1 -
> > > >  drivers/iio/adc/men_z188_adc.c                |  1 -
> > > >  drivers/iio/adc/meson_saradc.c                |  1 -
> > > >  drivers/iio/adc/mt6577_auxadc.c               |  1 -
> > > >  drivers/iio/adc/mxs-lradc-adc.c               |  1 -
> > > >  drivers/iio/adc/nau7802.c                     |  1 -
> > > >  drivers/iio/adc/npcm_adc.c                    |  1 -
> > > >  drivers/iio/adc/palmas_gpadc.c                |  1 -
> > > >  drivers/iio/adc/qcom-pm8xxx-xoadc.c           |  1 -
> > > >  drivers/iio/adc/qcom-spmi-adc5.c              |  1 -
> > > >  drivers/iio/adc/qcom-spmi-iadc.c              |  1 -
> > > >  drivers/iio/adc/qcom-spmi-vadc.c              |  1 -
> > > >  drivers/iio/adc/rcar-gyroadc.c                |  1 -
> > > >  drivers/iio/adc/rn5t618-adc.c                 |  1 -
> > > >  drivers/iio/adc/rockchip_saradc.c             |  1 -
> > > >  drivers/iio/adc/sc27xx_adc.c                  |  1 -
> > > >  drivers/iio/adc/sd_adc_modulator.c            |  1 -
> > > >  drivers/iio/adc/spear_adc.c                   |  1 -
> > > >  drivers/iio/adc/stm32-adc.c                   |  1 -
> > > >  drivers/iio/adc/stm32-dfsdm-adc.c             |  1 -
> > > >  drivers/iio/adc/stmpe-adc.c                   |  1 -
> > > >  drivers/iio/adc/stx104.c                      |  1 -
> > > >  drivers/iio/adc/sun4i-gpadc-iio.c             |  1 -
> > > >  drivers/iio/adc/ti-adc081c.c                  |  1 -
> > > >  drivers/iio/adc/ti-adc0832.c                  |  1 -
> > > >  drivers/iio/adc/ti-adc084s021.c               |  1 -
> > > >  drivers/iio/adc/ti-adc108s102.c               |  1 -
> > > >  drivers/iio/adc/ti-adc12138.c                 |  1 -
> > > >  drivers/iio/adc/ti-adc128s052.c               |  1 -
> > > >  drivers/iio/adc/ti-adc161s626.c               |  1 -
> > > >  drivers/iio/adc/ti-ads1015.c                  |  1 -
> > > >  drivers/iio/adc/ti-ads124s08.c                |  1 -
> > > >  drivers/iio/adc/ti-ads7950.c                  |  1 -
> > > >  drivers/iio/adc/ti-ads8344.c                  |  1 -
> > > >  drivers/iio/adc/ti-ads8688.c                  |  1 -
> > > >  drivers/iio/adc/ti-tlc4541.c                  |  1 -
> > > >  drivers/iio/adc/ti_am335x_adc.c               |  1 -
> > > >  drivers/iio/adc/twl4030-madc.c                |  1 -
> > > >  drivers/iio/adc/twl6030-gpadc.c               |  1 -
> > > >  drivers/iio/adc/vf610_adc.c                   |  1 -
> > > >  drivers/iio/adc/viperboard_adc.c              |  1 -
> > > >  drivers/iio/adc/xilinx-xadc-core.c            |  1 -
> > > >  drivers/iio/afe/iio-rescale.c                 |  1 -
> > > >  drivers/iio/amplifiers/ad8366.c               |  1 -
> > > >  drivers/iio/amplifiers/hmc425a.c              |  1 -
> > > >  drivers/iio/chemical/ams-iaq-core.c           |  1 -
> > > >  drivers/iio/chemical/atlas-sensor.c           |  1 -
> > > >  drivers/iio/chemical/bme680_core.c            |  1 -
> > > >  drivers/iio/chemical/ccs811.c                 |  1 -
> > > >  drivers/iio/chemical/pms7003.c                |  1 -
> > > >  drivers/iio/chemical/sgp30.c                  |  1 -
> > > >  drivers/iio/chemical/sps30.c                  |  1 -
> > > >  drivers/iio/chemical/vz89x.c                  |  1 -
> > > >  drivers/iio/dac/ad5064.c                      |  1 -
> > > >  drivers/iio/dac/ad5360.c                      |  1 -
> > > >  drivers/iio/dac/ad5380.c                      |  1 -
> > > >  drivers/iio/dac/ad5421.c                      |  1 -
> > > >  drivers/iio/dac/ad5446.c                      |  2 --
> > > >  drivers/iio/dac/ad5449.c                      |  1 -
> > > >  drivers/iio/dac/ad5504.c                      |  1 -
> > > >  drivers/iio/dac/ad5592r-base.c                |  1 -
> > > >  drivers/iio/dac/ad5624r_spi.c                 |  1 -
> > > >  drivers/iio/dac/ad5686.c                      |  1 -
> > > >  drivers/iio/dac/ad5755.c                      |  1 -
> > > >  drivers/iio/dac/ad5758.c                      |  1 -
> > > >  drivers/iio/dac/ad5761.c                      |  1 -
> > > >  drivers/iio/dac/ad5764.c                      |  1 -
> > > >  drivers/iio/dac/ad5770r.c                     |  1 -
> > > >  drivers/iio/dac/ad5791.c                      |  1 -
> > > >  drivers/iio/dac/ad7303.c                      |  1 -
> > > >  drivers/iio/dac/ad8801.c                      |  1 -
> > > >  drivers/iio/dac/cio-dac.c                     |  1 -
> > > >  drivers/iio/dac/dpot-dac.c                    |  1 -
> > > >  drivers/iio/dac/ds4424.c                      |  1 -
> > > >  drivers/iio/dac/lpc18xx_dac.c                 |  1 -
> > > >  drivers/iio/dac/ltc1660.c                     |  1 -
> > > >  drivers/iio/dac/ltc2632.c                     |  1 -
> > > >  drivers/iio/dac/m62332.c                      |  3 ---
> > > >  drivers/iio/dac/max517.c                      |  3 ---
> > > >  drivers/iio/dac/max5821.c                     |  1 -
> > > >  drivers/iio/dac/mcp4725.c                     |  1 -
> > > >  drivers/iio/dac/mcp4922.c                     |  1 -
> > > >  drivers/iio/dac/stm32-dac.c                   |  1 -
> > > >  drivers/iio/dac/ti-dac082s085.c               |  1 -
> > > >  drivers/iio/dac/ti-dac5571.c                  |  1 -
> > > >  drivers/iio/dac/ti-dac7311.c                  |  1 -
> > > >  drivers/iio/dac/ti-dac7612.c                  |  1 -
> > > >  drivers/iio/dac/vf610_dac.c                   |  1 -
> > > >  drivers/iio/dummy/iio_simple_dummy.c          | 14 ++++++-----
> > > >  drivers/iio/frequency/ad9523.c                |  1 -
> > > >  drivers/iio/frequency/adf4350.c               |  1 -
> > > >  drivers/iio/frequency/adf4371.c               |  1 -
> > > >  drivers/iio/gyro/adis16080.c                  |  1 -
> > > >  drivers/iio/gyro/adis16130.c                  |  1 -
> > > >  drivers/iio/gyro/adis16136.c                  |  1 -
> > > >  drivers/iio/gyro/adis16260.c                  |  1 -
> > > >  drivers/iio/gyro/adxrs450.c                   |  1 -
> > > >  drivers/iio/gyro/bmg160_core.c                |  1 -
> > > >  drivers/iio/gyro/fxas21002c_core.c            |  1 -
> > > >  drivers/iio/gyro/hid-sensor-gyro-3d.c         |  1 -
> > > >  drivers/iio/gyro/itg3200_core.c               |  1 -
> > > >  drivers/iio/gyro/mpu3050-core.c               |  1 -
> > > >  drivers/iio/gyro/ssp_gyro_sensor.c            |  1 -
> > > >  drivers/iio/health/afe4403.c                  |  1 -
> > > >  drivers/iio/health/afe4404.c                  |  1 -
> > > >  drivers/iio/health/max30100.c                 |  1 -
> > > >  drivers/iio/health/max30102.c                 |  1 -
> > > >  drivers/iio/humidity/am2315.c                 |  1 -
> > > >  drivers/iio/humidity/dht11.c                  |  1 -
> > > >  drivers/iio/humidity/hdc100x.c                |  1 -
> > > >  drivers/iio/humidity/hid-sensor-humidity.c    |  1 -
> > > >  drivers/iio/humidity/hts221_core.c            |  1 -
> > > >  drivers/iio/humidity/htu21.c                  |  1 -
> > > >  drivers/iio/humidity/si7005.c                 |  1 -
> > > >  drivers/iio/humidity/si7020.c                 |  1 -
> > > >  drivers/iio/imu/adis16400.c                   |  1 -
> > > >  drivers/iio/imu/adis16460.c                   |  1 -
> > > >  drivers/iio/imu/adis16475.c                   |  1 -
> > > >  drivers/iio/imu/adis16480.c                   |  1 -
> > > >  drivers/iio/imu/bmi160/bmi160_core.c          |  1 -
> > > >  drivers/iio/imu/fxos8700_core.c               |  1 -
> > > >  drivers/iio/imu/inv_mpu6050/inv_mpu_core.c    |  1 -
> > > >  drivers/iio/imu/kmx61.c                       |  1 -
> > > >  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c  |  1 -
> > > >  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c  |  1 -
> > > >  drivers/iio/industrialio-core.c               | 11 +++++----
> > > >  drivers/iio/light/acpi-als.c                  |  1 -
> > > >  drivers/iio/light/adjd_s311.c                 |  1 -
> > > >  drivers/iio/light/adux1020.c                  |  1 -
> > > >  drivers/iio/light/al3010.c                    |  1 -
> > > >  drivers/iio/light/al3320a.c                   |  1 -
> > > >  drivers/iio/light/apds9300.c                  |  1 -
> > > >  drivers/iio/light/apds9960.c                  |  1 -
> > > >  drivers/iio/light/bh1750.c                    |  1 -
> > > >  drivers/iio/light/bh1780.c                    |  1 -
> > > >  drivers/iio/light/cm32181.c                   |  1 -
> > > >  drivers/iio/light/cm3232.c                    |  1 -
> > > >  drivers/iio/light/cm3323.c                    |  1 -
> > > >  drivers/iio/light/cm3605.c                    |  1 -
> > > >  drivers/iio/light/cm36651.c                   |  1 -
> > > >  drivers/iio/light/gp2ap002.c                  |  1 -
> > > >  drivers/iio/light/gp2ap020a00f.c              |  1 -
> > > >  drivers/iio/light/hid-sensor-als.c            |  1 -
> > > >  drivers/iio/light/hid-sensor-prox.c           |  1 -
> > > >  drivers/iio/light/iqs621-als.c                |  1 -
> > > >  drivers/iio/light/isl29018.c                  |  1 -
> > > >  drivers/iio/light/isl29028.c                  |  1 -
> > > >  drivers/iio/light/isl29125.c                  |  1 -
> > > >  drivers/iio/light/jsa1212.c                   |  1 -
> > > >  drivers/iio/light/lm3533-als.c                |  2 +-
> > > >  drivers/iio/light/ltr501.c                    |  1 -
> > > >  drivers/iio/light/lv0104cs.c                  |  1 -
> > > >  drivers/iio/light/max44000.c                  |  1 -
> > > >  drivers/iio/light/max44009.c                  |  1 -
> > > >  drivers/iio/light/noa1305.c                   |  1 -
> > > >  drivers/iio/light/opt3001.c                   |  1 -
> > > >  drivers/iio/light/pa12203001.c                |  1 -
> > > >  drivers/iio/light/rpr0521.c                   |  1 -
> > > >  drivers/iio/light/si1133.c                    |  1 -
> > > >  drivers/iio/light/si1145.c                    |  1 -
> > > >  drivers/iio/light/st_uvis25_core.c            |  1 -
> > > >  drivers/iio/light/stk3310.c                   |  1 -
> > > >  drivers/iio/light/tcs3414.c                   |  1 -
> > > >  drivers/iio/light/tcs3472.c                   |  1 -
> > > >  drivers/iio/light/tsl2563.c                   |  1 -
> > > >  drivers/iio/light/tsl2583.c                   |  1 -
> > > >  drivers/iio/light/tsl2772.c                   |  1 -
> > > >  drivers/iio/light/tsl4531.c                   |  1 -
> > > >  drivers/iio/light/us5182d.c                   |  1 -
> > > >  drivers/iio/light/vcnl4000.c                  |  1 -
> > > >  drivers/iio/light/vcnl4035.c                  |  1 -
> > > >  drivers/iio/light/veml6030.c                  |  1 -
> > > >  drivers/iio/light/veml6070.c                  |  1 -
> > > >  drivers/iio/light/vl6180.c                    |  1 -
> > > >  drivers/iio/light/zopt2201.c                  |  1 -
> > > >  drivers/iio/magnetometer/ak8974.c             |  1 -
> > > >  drivers/iio/magnetometer/ak8975.c             |  1 -
> > > >  drivers/iio/magnetometer/bmc150_magn.c        |  1 -
> > > >  drivers/iio/magnetometer/hid-sensor-magn-3d.c |  1 -
> > > >  drivers/iio/magnetometer/hmc5843_core.c       |  1 -
> > > >  drivers/iio/magnetometer/mag3110.c            |  1 -
> > > >  drivers/iio/magnetometer/mmc35240.c           |  1 -
> > > >  drivers/iio/magnetometer/rm3100-core.c        |  1 -
> > > >  drivers/iio/multiplexer/iio-mux.c             |  1 -
> > > >  drivers/iio/orientation/hid-sensor-incl-3d.c  |  1 -
> > > >  drivers/iio/orientation/hid-sensor-rotation.c |  1 -
> > > >  drivers/iio/position/iqs624-pos.c             |  1 -
> > > >  drivers/iio/potentiometer/ad5272.c            |  1 -
> > > >  drivers/iio/potentiometer/ds1803.c            |  1 -
> > > >  drivers/iio/potentiometer/max5432.c           |  1 -
> > > >  drivers/iio/potentiometer/max5481.c           |  1 -
> > > >  drivers/iio/potentiometer/max5487.c           |  1 -
> > > >  drivers/iio/potentiometer/mcp4018.c           |  1 -
> > > >  drivers/iio/potentiometer/mcp41010.c          |  1 -
> > > >  drivers/iio/potentiometer/mcp4131.c           |  1 -
> > > >  drivers/iio/potentiometer/mcp4531.c           |  1 -
> > > >  drivers/iio/potentiometer/tpl0102.c           |  1 -
> > > >  drivers/iio/potentiostat/lmp91000.c           |  1 -
> > > >  drivers/iio/pressure/abp060mg.c               |  1 -
> > > >  drivers/iio/pressure/bmp280-core.c            |  1 -
> > > >  drivers/iio/pressure/dlhl60d.c                |  1 -
> > > >  drivers/iio/pressure/dps310.c                 |  1 -
> > > >  drivers/iio/pressure/hid-sensor-press.c       |  1 -
> > > >  drivers/iio/pressure/hp03.c                   |  1 -
> > > >  drivers/iio/pressure/hp206c.c                 |  1 -
> > > >  drivers/iio/pressure/icp10100.c               |  1 -
> > > >  drivers/iio/pressure/mpl115.c                 |  1 -
> > > >  drivers/iio/pressure/mpl3115.c                |  1 -
> > > >  drivers/iio/pressure/ms5637.c                 |  1 -
> > > >  drivers/iio/pressure/t5403.c                  |  1 -
> > > >  drivers/iio/pressure/zpa2326.c                |  1 -
> > > >  drivers/iio/proximity/as3935.c                |  1 -
> > > >  drivers/iio/proximity/isl29501.c              |  1 -
> > > >  drivers/iio/proximity/mb1232.c                |  1 -
> > > >  drivers/iio/proximity/ping.c                  |  1 -
> > > >  .../iio/proximity/pulsedlight-lidar-lite-v2.c |  1 -
> > > >  drivers/iio/proximity/rfd77402.c              |  1 -
> > > >  drivers/iio/proximity/srf04.c                 |  1 -
> > > >  drivers/iio/proximity/srf08.c                 |  1 -
> > > >  drivers/iio/proximity/sx9310.c                |  1 -
> > > >  drivers/iio/proximity/sx9500.c                |  1 -
> > > >  drivers/iio/proximity/vl53l0x-i2c.c           |  1 -
> > > >  drivers/iio/resolver/ad2s1200.c               |  1 -
> > > >  drivers/iio/resolver/ad2s90.c                 |  1 -
> > > >  .../iio/temperature/hid-sensor-temperature.c  |  1 -
> > > >  drivers/iio/temperature/iqs620at-temp.c       |  1 -
> > > >  drivers/iio/temperature/ltc2983.c             |  1 -
> > > >  drivers/iio/temperature/max31856.c            |  1 -
> > > >  drivers/iio/temperature/maxim_thermocouple.c  |  1 -
> > > >  drivers/iio/temperature/mlx90614.c            |  1 -
> > > >  drivers/iio/temperature/mlx90632.c            |  1 -
> > > >  drivers/iio/temperature/tmp006.c              |  1 -
> > > >  drivers/iio/temperature/tmp007.c              |  1 -
> > > >  drivers/iio/temperature/tsys01.c              |  1 -
> > > >  drivers/iio/temperature/tsys02d.c             |  1 -
> > > >  drivers/iio/trigger/stm32-timer-trigger.c     |  1 -
> > > >  drivers/input/touchscreen/tsc2007_iio.c       |  1 -
> > > >  drivers/platform/x86/toshiba_acpi.c           |  3 +--
> > > >  drivers/staging/iio/Documentation/device.txt  |  4 +---
> > > >  drivers/staging/iio/accel/adis16203.c         |  1 -
> > > >  drivers/staging/iio/accel/adis16240.c         |  1 -
> > > >  drivers/staging/iio/adc/ad7280a.c             |  1 -
> > > >  drivers/staging/iio/adc/ad7816.c              |  1 -
> > > >  drivers/staging/iio/addac/adt7316.c           |  1 -
> > > >  drivers/staging/iio/cdc/ad7150.c              |  2 --
> > > >  drivers/staging/iio/cdc/ad7746.c              |  2 --
> > > >  drivers/staging/iio/frequency/ad9832.c        |  1 -
> > > >  drivers/staging/iio/frequency/ad9834.c        |  1 -
> > > >  .../staging/iio/impedance-analyzer/ad5933.c   |  1 -
> > > >  drivers/staging/iio/resolver/ad2s1210.c       |  1 -
> > > >  include/linux/iio/iio.h                       | 24 +++++++++++++++++--
> > > >  335 files changed, 39 insertions(+), 358 deletions(-)
> > > >
> >
> >
>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 0/6] iio: core: pass parent device as parameter during allocation
  2020-06-08  6:37       ` Alexandru Ardelean
@ 2020-06-08 11:10         ` Jonathan Cameron
  0 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2020-06-08 11:10 UTC (permalink / raw)
  To: Alexandru Ardelean
  Cc: Jonathan Cameron, Ardelean, Alexandru, linux-kernel, linux-iio,
	andy.shevchenko, johan

On Mon, 8 Jun 2020 09:37:48 +0300
Alexandru Ardelean <ardeleanalex@gmail.com> wrote:

> On Sat, Jun 6, 2020 at 7:03 PM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > On Thu, 4 Jun 2020 18:34:40 +0100
> > Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote:
> >  
> > > On Wed, 3 Jun 2020 11:41:52 +0000
> > > "Ardelean, Alexandru" <alexandru.Ardelean@analog.com> wrote:
> > >  
> > > > On Wed, 2020-06-03 at 14:40 +0300, Alexandru Ardelean wrote:  
> > > > > This patch updates the {devm_}iio_device_alloc() functions to automatically
> > > > > assign the parent device on allocation.
> > > > > For iio_device_alloc() this means a new parameter.
> > > > > For devm_iio_device_alloc() this means a new behavior; the device object is
> > > > > the parent. For this one, this is the common case for most drivers (except
> > > > > one: 'lm3533-als').
> > > > >
> > > > > For the special cases an iio_device_set_parent() has been created to change
> > > > > the parent betwee allocation & registration.
> > > > > The purpose of this helper, is mostly to highlight the new behavior of
> > > > > devm_iio_device_alloc().
> > > > >
> > > > > This patchset also removes explicit parent assignments from most IIO
> > > > > drivers (except for lm3533-als).
> > > > >
> > > > > Using a semantic patch, about 303 drivers are updated, and some needed some
> > > > > manual attention. This is probably due to some limitations of spatch. At
> > > > > least in some cases the parent device is not the same variable as passed to
> > > > > devm_iio_device_alloc(), OR the parent assignment is moved to a separate
> > > > > function than where devm_iio_device_alloc() is called.
> > > > >  
> > > >
> > > > Forgot to explicitly CC Jonathan.
> > > > But I'm hoping this shows up from the list.  
> > >
> > > No problem.  I filter anything going to the list into the same folder
> > > whether or not I'm cc'd :) Well several folders on different machines via
> > > different email addresses, but you get the idea...  
> >
> > Patch 3 doesn't seem to have made it to me or the list.
> >  
> 
> hmm, that's weird;
> i'll check my work email inbox and see if it got there;
> i'm in a short vacation this week; and left everything at work [intentionally]
> 
> > I assumed no change from patch 2 in previous set and applied that.
> >  
> that looks like the spatch patch;
> nothing changed there;
> 
> > After applying the rest of the series, there were left over cases in:
> >
> > vcnl3020 (new)
> > ms5611 (hidden via an extra call)
> > st_sensors_spi (hidden via an extra call)
> > st_sensors_i2c (hidden via an extra call)
> > cros_ec_sensors_core (hidden via an extra call)
> >
> > I've added them to patch 6 - with a note to say why.
> > If you could do a quick sanity check that would be great.
> >  
> 
> did you push the branch anywhere?
> i can't seem to find the patches
Ah. oops. May not have done.  Will do so a bit later today.

Jonathan

> 
> > Thanks,
> >
> > Jonathan
> >
> >
> > Thanks,
> >
> > Jonathan
> >  
> > >
> > >  
> > > >  
> > > > > Changelog v1 -> v2:
> > > > > * added iio_device_set_parent() helper (new commit)
> > > > > * update commit for lm3533-als to use iio_device_set_parent()
> > > > >
> > > > > Alexandru Ardelean (6):
> > > > >   iio: core: pass parent device as parameter during allocation
> > > > >   iio: core: add iio_device_set_parent() helper
> > > > >   iio: remove explicit IIO device parent assignment
> > > > >   iio: remove left-over comments about parent assignment
> > > > >   iio: light: lm3533-als: use iio_device_set_parent() to assign parent
> > > > >   iio: remove left-over parent assignments
> > > > >
> > > > >  drivers/counter/104-quad-8.c                  |  1 -
> > > > >  drivers/counter/stm32-lptimer-cnt.c           |  1 -
> > > > >  drivers/iio/accel/adis16201.c                 |  1 -
> > > > >  drivers/iio/accel/adis16209.c                 |  1 -
> > > > >  drivers/iio/accel/adxl345_core.c              |  1 -
> > > > >  drivers/iio/accel/adxl372.c                   |  1 -
> > > > >  drivers/iio/accel/bma180.c                    |  1 -
> > > > >  drivers/iio/accel/bma220_spi.c                |  1 -
> > > > >  drivers/iio/accel/bma400_core.c               |  1 -
> > > > >  drivers/iio/accel/bmc150-accel-core.c         |  1 -
> > > > >  drivers/iio/accel/da280.c                     |  1 -
> > > > >  drivers/iio/accel/da311.c                     |  1 -
> > > > >  drivers/iio/accel/dmard06.c                   |  1 -
> > > > >  drivers/iio/accel/dmard09.c                   |  1 -
> > > > >  drivers/iio/accel/dmard10.c                   |  1 -
> > > > >  drivers/iio/accel/hid-sensor-accel-3d.c       |  1 -
> > > > >  drivers/iio/accel/kxcjk-1013.c                |  1 -
> > > > >  drivers/iio/accel/kxsd9.c                     |  1 -
> > > > >  drivers/iio/accel/mc3230.c                    |  1 -
> > > > >  drivers/iio/accel/mma7455_core.c              |  1 -
> > > > >  drivers/iio/accel/mma7660.c                   |  1 -
> > > > >  drivers/iio/accel/mma8452.c                   |  1 -
> > > > >  drivers/iio/accel/mma9551.c                   |  1 -
> > > > >  drivers/iio/accel/mma9553.c                   |  1 -
> > > > >  drivers/iio/accel/mxc4005.c                   |  1 -
> > > > >  drivers/iio/accel/mxc6255.c                   |  1 -
> > > > >  drivers/iio/accel/sca3000.c                   |  1 -
> > > > >  drivers/iio/accel/ssp_accel_sensor.c          |  1 -
> > > > >  drivers/iio/accel/stk8312.c                   |  1 -
> > > > >  drivers/iio/accel/stk8ba50.c                  |  1 -
> > > > >  drivers/iio/adc/ab8500-gpadc.c                |  1 -
> > > > >  drivers/iio/adc/ad7091r-base.c                |  1 -
> > > > >  drivers/iio/adc/ad7124.c                      |  1 -
> > > > >  drivers/iio/adc/ad7192.c                      |  1 -
> > > > >  drivers/iio/adc/ad7266.c                      |  1 -
> > > > >  drivers/iio/adc/ad7291.c                      |  1 -
> > > > >  drivers/iio/adc/ad7292.c                      |  1 -
> > > > >  drivers/iio/adc/ad7298.c                      |  1 -
> > > > >  drivers/iio/adc/ad7476.c                      |  2 --
> > > > >  drivers/iio/adc/ad7606.c                      |  1 -
> > > > >  drivers/iio/adc/ad7766.c                      |  1 -
> > > > >  drivers/iio/adc/ad7768-1.c                    |  1 -
> > > > >  drivers/iio/adc/ad7780.c                      |  1 -
> > > > >  drivers/iio/adc/ad7791.c                      |  1 -
> > > > >  drivers/iio/adc/ad7793.c                      |  1 -
> > > > >  drivers/iio/adc/ad7887.c                      |  2 --
> > > > >  drivers/iio/adc/ad7923.c                      |  1 -
> > > > >  drivers/iio/adc/ad7949.c                      |  1 -
> > > > >  drivers/iio/adc/ad799x.c                      |  1 -
> > > > >  drivers/iio/adc/adi-axi-adc.c                 |  1 -
> > > > >  drivers/iio/adc/aspeed_adc.c                  |  1 -
> > > > >  drivers/iio/adc/at91-sama5d2_adc.c            |  1 -
> > > > >  drivers/iio/adc/at91_adc.c                    |  1 -
> > > > >  drivers/iio/adc/axp20x_adc.c                  |  1 -
> > > > >  drivers/iio/adc/axp288_adc.c                  |  1 -
> > > > >  drivers/iio/adc/bcm_iproc_adc.c               |  1 -
> > > > >  drivers/iio/adc/berlin2-adc.c                 |  1 -
> > > > >  drivers/iio/adc/cc10001_adc.c                 |  1 -
> > > > >  drivers/iio/adc/cpcap-adc.c                   |  1 -
> > > > >  drivers/iio/adc/da9150-gpadc.c                |  1 -
> > > > >  drivers/iio/adc/dln2-adc.c                    |  1 -
> > > > >  drivers/iio/adc/envelope-detector.c           |  1 -
> > > > >  drivers/iio/adc/ep93xx_adc.c                  |  1 -
> > > > >  drivers/iio/adc/exynos_adc.c                  |  1 -
> > > > >  drivers/iio/adc/fsl-imx25-gcq.c               |  1 -
> > > > >  drivers/iio/adc/hi8435.c                      |  1 -
> > > > >  drivers/iio/adc/hx711.c                       |  1 -
> > > > >  drivers/iio/adc/imx7d_adc.c                   |  1 -
> > > > >  drivers/iio/adc/ina2xx-adc.c                  |  1 -
> > > > >  drivers/iio/adc/ingenic-adc.c                 |  1 -
> > > > >  drivers/iio/adc/intel_mrfld_adc.c             |  1 -
> > > > >  drivers/iio/adc/lp8788_adc.c                  |  1 -
> > > > >  drivers/iio/adc/lpc18xx_adc.c                 |  1 -
> > > > >  drivers/iio/adc/lpc32xx_adc.c                 |  1 -
> > > > >  drivers/iio/adc/ltc2471.c                     |  1 -
> > > > >  drivers/iio/adc/ltc2485.c                     |  1 -
> > > > >  drivers/iio/adc/max1027.c                     |  1 -
> > > > >  drivers/iio/adc/max11100.c                    |  1 -
> > > > >  drivers/iio/adc/max1118.c                     |  1 -
> > > > >  drivers/iio/adc/max1241.c                     |  1 -
> > > > >  drivers/iio/adc/max1363.c                     |  2 --
> > > > >  drivers/iio/adc/max9611.c                     |  1 -
> > > > >  drivers/iio/adc/mcp320x.c                     |  1 -
> > > > >  drivers/iio/adc/mcp3422.c                     |  1 -
> > > > >  drivers/iio/adc/mcp3911.c                     |  1 -
> > > > >  drivers/iio/adc/men_z188_adc.c                |  1 -
> > > > >  drivers/iio/adc/meson_saradc.c                |  1 -
> > > > >  drivers/iio/adc/mt6577_auxadc.c               |  1 -
> > > > >  drivers/iio/adc/mxs-lradc-adc.c               |  1 -
> > > > >  drivers/iio/adc/nau7802.c                     |  1 -
> > > > >  drivers/iio/adc/npcm_adc.c                    |  1 -
> > > > >  drivers/iio/adc/palmas_gpadc.c                |  1 -
> > > > >  drivers/iio/adc/qcom-pm8xxx-xoadc.c           |  1 -
> > > > >  drivers/iio/adc/qcom-spmi-adc5.c              |  1 -
> > > > >  drivers/iio/adc/qcom-spmi-iadc.c              |  1 -
> > > > >  drivers/iio/adc/qcom-spmi-vadc.c              |  1 -
> > > > >  drivers/iio/adc/rcar-gyroadc.c                |  1 -
> > > > >  drivers/iio/adc/rn5t618-adc.c                 |  1 -
> > > > >  drivers/iio/adc/rockchip_saradc.c             |  1 -
> > > > >  drivers/iio/adc/sc27xx_adc.c                  |  1 -
> > > > >  drivers/iio/adc/sd_adc_modulator.c            |  1 -
> > > > >  drivers/iio/adc/spear_adc.c                   |  1 -
> > > > >  drivers/iio/adc/stm32-adc.c                   |  1 -
> > > > >  drivers/iio/adc/stm32-dfsdm-adc.c             |  1 -
> > > > >  drivers/iio/adc/stmpe-adc.c                   |  1 -
> > > > >  drivers/iio/adc/stx104.c                      |  1 -
> > > > >  drivers/iio/adc/sun4i-gpadc-iio.c             |  1 -
> > > > >  drivers/iio/adc/ti-adc081c.c                  |  1 -
> > > > >  drivers/iio/adc/ti-adc0832.c                  |  1 -
> > > > >  drivers/iio/adc/ti-adc084s021.c               |  1 -
> > > > >  drivers/iio/adc/ti-adc108s102.c               |  1 -
> > > > >  drivers/iio/adc/ti-adc12138.c                 |  1 -
> > > > >  drivers/iio/adc/ti-adc128s052.c               |  1 -
> > > > >  drivers/iio/adc/ti-adc161s626.c               |  1 -
> > > > >  drivers/iio/adc/ti-ads1015.c                  |  1 -
> > > > >  drivers/iio/adc/ti-ads124s08.c                |  1 -
> > > > >  drivers/iio/adc/ti-ads7950.c                  |  1 -
> > > > >  drivers/iio/adc/ti-ads8344.c                  |  1 -
> > > > >  drivers/iio/adc/ti-ads8688.c                  |  1 -
> > > > >  drivers/iio/adc/ti-tlc4541.c                  |  1 -
> > > > >  drivers/iio/adc/ti_am335x_adc.c               |  1 -
> > > > >  drivers/iio/adc/twl4030-madc.c                |  1 -
> > > > >  drivers/iio/adc/twl6030-gpadc.c               |  1 -
> > > > >  drivers/iio/adc/vf610_adc.c                   |  1 -
> > > > >  drivers/iio/adc/viperboard_adc.c              |  1 -
> > > > >  drivers/iio/adc/xilinx-xadc-core.c            |  1 -
> > > > >  drivers/iio/afe/iio-rescale.c                 |  1 -
> > > > >  drivers/iio/amplifiers/ad8366.c               |  1 -
> > > > >  drivers/iio/amplifiers/hmc425a.c              |  1 -
> > > > >  drivers/iio/chemical/ams-iaq-core.c           |  1 -
> > > > >  drivers/iio/chemical/atlas-sensor.c           |  1 -
> > > > >  drivers/iio/chemical/bme680_core.c            |  1 -
> > > > >  drivers/iio/chemical/ccs811.c                 |  1 -
> > > > >  drivers/iio/chemical/pms7003.c                |  1 -
> > > > >  drivers/iio/chemical/sgp30.c                  |  1 -
> > > > >  drivers/iio/chemical/sps30.c                  |  1 -
> > > > >  drivers/iio/chemical/vz89x.c                  |  1 -
> > > > >  drivers/iio/dac/ad5064.c                      |  1 -
> > > > >  drivers/iio/dac/ad5360.c                      |  1 -
> > > > >  drivers/iio/dac/ad5380.c                      |  1 -
> > > > >  drivers/iio/dac/ad5421.c                      |  1 -
> > > > >  drivers/iio/dac/ad5446.c                      |  2 --
> > > > >  drivers/iio/dac/ad5449.c                      |  1 -
> > > > >  drivers/iio/dac/ad5504.c                      |  1 -
> > > > >  drivers/iio/dac/ad5592r-base.c                |  1 -
> > > > >  drivers/iio/dac/ad5624r_spi.c                 |  1 -
> > > > >  drivers/iio/dac/ad5686.c                      |  1 -
> > > > >  drivers/iio/dac/ad5755.c                      |  1 -
> > > > >  drivers/iio/dac/ad5758.c                      |  1 -
> > > > >  drivers/iio/dac/ad5761.c                      |  1 -
> > > > >  drivers/iio/dac/ad5764.c                      |  1 -
> > > > >  drivers/iio/dac/ad5770r.c                     |  1 -
> > > > >  drivers/iio/dac/ad5791.c                      |  1 -
> > > > >  drivers/iio/dac/ad7303.c                      |  1 -
> > > > >  drivers/iio/dac/ad8801.c                      |  1 -
> > > > >  drivers/iio/dac/cio-dac.c                     |  1 -
> > > > >  drivers/iio/dac/dpot-dac.c                    |  1 -
> > > > >  drivers/iio/dac/ds4424.c                      |  1 -
> > > > >  drivers/iio/dac/lpc18xx_dac.c                 |  1 -
> > > > >  drivers/iio/dac/ltc1660.c                     |  1 -
> > > > >  drivers/iio/dac/ltc2632.c                     |  1 -
> > > > >  drivers/iio/dac/m62332.c                      |  3 ---
> > > > >  drivers/iio/dac/max517.c                      |  3 ---
> > > > >  drivers/iio/dac/max5821.c                     |  1 -
> > > > >  drivers/iio/dac/mcp4725.c                     |  1 -
> > > > >  drivers/iio/dac/mcp4922.c                     |  1 -
> > > > >  drivers/iio/dac/stm32-dac.c                   |  1 -
> > > > >  drivers/iio/dac/ti-dac082s085.c               |  1 -
> > > > >  drivers/iio/dac/ti-dac5571.c                  |  1 -
> > > > >  drivers/iio/dac/ti-dac7311.c                  |  1 -
> > > > >  drivers/iio/dac/ti-dac7612.c                  |  1 -
> > > > >  drivers/iio/dac/vf610_dac.c                   |  1 -
> > > > >  drivers/iio/dummy/iio_simple_dummy.c          | 14 ++++++-----
> > > > >  drivers/iio/frequency/ad9523.c                |  1 -
> > > > >  drivers/iio/frequency/adf4350.c               |  1 -
> > > > >  drivers/iio/frequency/adf4371.c               |  1 -
> > > > >  drivers/iio/gyro/adis16080.c                  |  1 -
> > > > >  drivers/iio/gyro/adis16130.c                  |  1 -
> > > > >  drivers/iio/gyro/adis16136.c                  |  1 -
> > > > >  drivers/iio/gyro/adis16260.c                  |  1 -
> > > > >  drivers/iio/gyro/adxrs450.c                   |  1 -
> > > > >  drivers/iio/gyro/bmg160_core.c                |  1 -
> > > > >  drivers/iio/gyro/fxas21002c_core.c            |  1 -
> > > > >  drivers/iio/gyro/hid-sensor-gyro-3d.c         |  1 -
> > > > >  drivers/iio/gyro/itg3200_core.c               |  1 -
> > > > >  drivers/iio/gyro/mpu3050-core.c               |  1 -
> > > > >  drivers/iio/gyro/ssp_gyro_sensor.c            |  1 -
> > > > >  drivers/iio/health/afe4403.c                  |  1 -
> > > > >  drivers/iio/health/afe4404.c                  |  1 -
> > > > >  drivers/iio/health/max30100.c                 |  1 -
> > > > >  drivers/iio/health/max30102.c                 |  1 -
> > > > >  drivers/iio/humidity/am2315.c                 |  1 -
> > > > >  drivers/iio/humidity/dht11.c                  |  1 -
> > > > >  drivers/iio/humidity/hdc100x.c                |  1 -
> > > > >  drivers/iio/humidity/hid-sensor-humidity.c    |  1 -
> > > > >  drivers/iio/humidity/hts221_core.c            |  1 -
> > > > >  drivers/iio/humidity/htu21.c                  |  1 -
> > > > >  drivers/iio/humidity/si7005.c                 |  1 -
> > > > >  drivers/iio/humidity/si7020.c                 |  1 -
> > > > >  drivers/iio/imu/adis16400.c                   |  1 -
> > > > >  drivers/iio/imu/adis16460.c                   |  1 -
> > > > >  drivers/iio/imu/adis16475.c                   |  1 -
> > > > >  drivers/iio/imu/adis16480.c                   |  1 -
> > > > >  drivers/iio/imu/bmi160/bmi160_core.c          |  1 -
> > > > >  drivers/iio/imu/fxos8700_core.c               |  1 -
> > > > >  drivers/iio/imu/inv_mpu6050/inv_mpu_core.c    |  1 -
> > > > >  drivers/iio/imu/kmx61.c                       |  1 -
> > > > >  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c  |  1 -
> > > > >  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c  |  1 -
> > > > >  drivers/iio/industrialio-core.c               | 11 +++++----
> > > > >  drivers/iio/light/acpi-als.c                  |  1 -
> > > > >  drivers/iio/light/adjd_s311.c                 |  1 -
> > > > >  drivers/iio/light/adux1020.c                  |  1 -
> > > > >  drivers/iio/light/al3010.c                    |  1 -
> > > > >  drivers/iio/light/al3320a.c                   |  1 -
> > > > >  drivers/iio/light/apds9300.c                  |  1 -
> > > > >  drivers/iio/light/apds9960.c                  |  1 -
> > > > >  drivers/iio/light/bh1750.c                    |  1 -
> > > > >  drivers/iio/light/bh1780.c                    |  1 -
> > > > >  drivers/iio/light/cm32181.c                   |  1 -
> > > > >  drivers/iio/light/cm3232.c                    |  1 -
> > > > >  drivers/iio/light/cm3323.c                    |  1 -
> > > > >  drivers/iio/light/cm3605.c                    |  1 -
> > > > >  drivers/iio/light/cm36651.c                   |  1 -
> > > > >  drivers/iio/light/gp2ap002.c                  |  1 -
> > > > >  drivers/iio/light/gp2ap020a00f.c              |  1 -
> > > > >  drivers/iio/light/hid-sensor-als.c            |  1 -
> > > > >  drivers/iio/light/hid-sensor-prox.c           |  1 -
> > > > >  drivers/iio/light/iqs621-als.c                |  1 -
> > > > >  drivers/iio/light/isl29018.c                  |  1 -
> > > > >  drivers/iio/light/isl29028.c                  |  1 -
> > > > >  drivers/iio/light/isl29125.c                  |  1 -
> > > > >  drivers/iio/light/jsa1212.c                   |  1 -
> > > > >  drivers/iio/light/lm3533-als.c                |  2 +-
> > > > >  drivers/iio/light/ltr501.c                    |  1 -
> > > > >  drivers/iio/light/lv0104cs.c                  |  1 -
> > > > >  drivers/iio/light/max44000.c                  |  1 -
> > > > >  drivers/iio/light/max44009.c                  |  1 -
> > > > >  drivers/iio/light/noa1305.c                   |  1 -
> > > > >  drivers/iio/light/opt3001.c                   |  1 -
> > > > >  drivers/iio/light/pa12203001.c                |  1 -
> > > > >  drivers/iio/light/rpr0521.c                   |  1 -
> > > > >  drivers/iio/light/si1133.c                    |  1 -
> > > > >  drivers/iio/light/si1145.c                    |  1 -
> > > > >  drivers/iio/light/st_uvis25_core.c            |  1 -
> > > > >  drivers/iio/light/stk3310.c                   |  1 -
> > > > >  drivers/iio/light/tcs3414.c                   |  1 -
> > > > >  drivers/iio/light/tcs3472.c                   |  1 -
> > > > >  drivers/iio/light/tsl2563.c                   |  1 -
> > > > >  drivers/iio/light/tsl2583.c                   |  1 -
> > > > >  drivers/iio/light/tsl2772.c                   |  1 -
> > > > >  drivers/iio/light/tsl4531.c                   |  1 -
> > > > >  drivers/iio/light/us5182d.c                   |  1 -
> > > > >  drivers/iio/light/vcnl4000.c                  |  1 -
> > > > >  drivers/iio/light/vcnl4035.c                  |  1 -
> > > > >  drivers/iio/light/veml6030.c                  |  1 -
> > > > >  drivers/iio/light/veml6070.c                  |  1 -
> > > > >  drivers/iio/light/vl6180.c                    |  1 -
> > > > >  drivers/iio/light/zopt2201.c                  |  1 -
> > > > >  drivers/iio/magnetometer/ak8974.c             |  1 -
> > > > >  drivers/iio/magnetometer/ak8975.c             |  1 -
> > > > >  drivers/iio/magnetometer/bmc150_magn.c        |  1 -
> > > > >  drivers/iio/magnetometer/hid-sensor-magn-3d.c |  1 -
> > > > >  drivers/iio/magnetometer/hmc5843_core.c       |  1 -
> > > > >  drivers/iio/magnetometer/mag3110.c            |  1 -
> > > > >  drivers/iio/magnetometer/mmc35240.c           |  1 -
> > > > >  drivers/iio/magnetometer/rm3100-core.c        |  1 -
> > > > >  drivers/iio/multiplexer/iio-mux.c             |  1 -
> > > > >  drivers/iio/orientation/hid-sensor-incl-3d.c  |  1 -
> > > > >  drivers/iio/orientation/hid-sensor-rotation.c |  1 -
> > > > >  drivers/iio/position/iqs624-pos.c             |  1 -
> > > > >  drivers/iio/potentiometer/ad5272.c            |  1 -
> > > > >  drivers/iio/potentiometer/ds1803.c            |  1 -
> > > > >  drivers/iio/potentiometer/max5432.c           |  1 -
> > > > >  drivers/iio/potentiometer/max5481.c           |  1 -
> > > > >  drivers/iio/potentiometer/max5487.c           |  1 -
> > > > >  drivers/iio/potentiometer/mcp4018.c           |  1 -
> > > > >  drivers/iio/potentiometer/mcp41010.c          |  1 -
> > > > >  drivers/iio/potentiometer/mcp4131.c           |  1 -
> > > > >  drivers/iio/potentiometer/mcp4531.c           |  1 -
> > > > >  drivers/iio/potentiometer/tpl0102.c           |  1 -
> > > > >  drivers/iio/potentiostat/lmp91000.c           |  1 -
> > > > >  drivers/iio/pressure/abp060mg.c               |  1 -
> > > > >  drivers/iio/pressure/bmp280-core.c            |  1 -
> > > > >  drivers/iio/pressure/dlhl60d.c                |  1 -
> > > > >  drivers/iio/pressure/dps310.c                 |  1 -
> > > > >  drivers/iio/pressure/hid-sensor-press.c       |  1 -
> > > > >  drivers/iio/pressure/hp03.c                   |  1 -
> > > > >  drivers/iio/pressure/hp206c.c                 |  1 -
> > > > >  drivers/iio/pressure/icp10100.c               |  1 -
> > > > >  drivers/iio/pressure/mpl115.c                 |  1 -
> > > > >  drivers/iio/pressure/mpl3115.c                |  1 -
> > > > >  drivers/iio/pressure/ms5637.c                 |  1 -
> > > > >  drivers/iio/pressure/t5403.c                  |  1 -
> > > > >  drivers/iio/pressure/zpa2326.c                |  1 -
> > > > >  drivers/iio/proximity/as3935.c                |  1 -
> > > > >  drivers/iio/proximity/isl29501.c              |  1 -
> > > > >  drivers/iio/proximity/mb1232.c                |  1 -
> > > > >  drivers/iio/proximity/ping.c                  |  1 -
> > > > >  .../iio/proximity/pulsedlight-lidar-lite-v2.c |  1 -
> > > > >  drivers/iio/proximity/rfd77402.c              |  1 -
> > > > >  drivers/iio/proximity/srf04.c                 |  1 -
> > > > >  drivers/iio/proximity/srf08.c                 |  1 -
> > > > >  drivers/iio/proximity/sx9310.c                |  1 -
> > > > >  drivers/iio/proximity/sx9500.c                |  1 -
> > > > >  drivers/iio/proximity/vl53l0x-i2c.c           |  1 -
> > > > >  drivers/iio/resolver/ad2s1200.c               |  1 -
> > > > >  drivers/iio/resolver/ad2s90.c                 |  1 -
> > > > >  .../iio/temperature/hid-sensor-temperature.c  |  1 -
> > > > >  drivers/iio/temperature/iqs620at-temp.c       |  1 -
> > > > >  drivers/iio/temperature/ltc2983.c             |  1 -
> > > > >  drivers/iio/temperature/max31856.c            |  1 -
> > > > >  drivers/iio/temperature/maxim_thermocouple.c  |  1 -
> > > > >  drivers/iio/temperature/mlx90614.c            |  1 -
> > > > >  drivers/iio/temperature/mlx90632.c            |  1 -
> > > > >  drivers/iio/temperature/tmp006.c              |  1 -
> > > > >  drivers/iio/temperature/tmp007.c              |  1 -
> > > > >  drivers/iio/temperature/tsys01.c              |  1 -
> > > > >  drivers/iio/temperature/tsys02d.c             |  1 -
> > > > >  drivers/iio/trigger/stm32-timer-trigger.c     |  1 -
> > > > >  drivers/input/touchscreen/tsc2007_iio.c       |  1 -
> > > > >  drivers/platform/x86/toshiba_acpi.c           |  3 +--
> > > > >  drivers/staging/iio/Documentation/device.txt  |  4 +---
> > > > >  drivers/staging/iio/accel/adis16203.c         |  1 -
> > > > >  drivers/staging/iio/accel/adis16240.c         |  1 -
> > > > >  drivers/staging/iio/adc/ad7280a.c             |  1 -
> > > > >  drivers/staging/iio/adc/ad7816.c              |  1 -
> > > > >  drivers/staging/iio/addac/adt7316.c           |  1 -
> > > > >  drivers/staging/iio/cdc/ad7150.c              |  2 --
> > > > >  drivers/staging/iio/cdc/ad7746.c              |  2 --
> > > > >  drivers/staging/iio/frequency/ad9832.c        |  1 -
> > > > >  drivers/staging/iio/frequency/ad9834.c        |  1 -
> > > > >  .../staging/iio/impedance-analyzer/ad5933.c   |  1 -
> > > > >  drivers/staging/iio/resolver/ad2s1210.c       |  1 -
> > > > >  include/linux/iio/iio.h                       | 24 +++++++++++++++++--
> > > > >  335 files changed, 39 insertions(+), 358 deletions(-)
> > > > >  
> > >
> > >  
> >  



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 6/6] iio: remove left-over parent assignments
  2020-06-06 16:05   ` Jonathan Cameron
@ 2020-06-11  6:52     ` Ardelean, Alexandru
  2020-06-14 12:14       ` Jonathan Cameron
  0 siblings, 1 reply; 18+ messages in thread
From: Ardelean, Alexandru @ 2020-06-11  6:52 UTC (permalink / raw)
  To: jic23; +Cc: andy.shevchenko, linux-kernel, linux-iio, johan

On Sat, 2020-06-06 at 17:05 +0100, Jonathan Cameron wrote:
> [External]
> 
> On Wed, 3 Jun 2020 14:40:23 +0300
> Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:
> 
> > These were found by doing some shell magic:
> > ------------
> > for file in $(git grep -w devm_iio_device_alloc | cut -d: -f1 | sort | uniq)
> > ; do
> > 	if grep 'parent =' $file | grep -v trig | grep -vq devm_; then
> > 		echo "$file -> $(grep "parent =" $file)"
> > 	fi
> > done
> > -----------
> > 
> > The output is bearable [after the semantic patch is applied].
> > There is a mix of trigger assignments with some iio device parent
> > assignments that are removed via this patch.
> > 
> > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> 
> I added a bunch more via a grep of simple parent\ = 
> and eyeballing it.  Much easier to do after your patches as far
> fewer entries.
> 
> vcnl3020 (new)
> ms5611 (hidden via an extra call)
> st_sensors_spi (hidden via an extra call)
> st_sensors_i2c (hidden via an extra call)
> cros_ec_sensors_core (hidden via an extra call)

I rebased your branch with my work-branch.
That displayes neatly all the stuff you've added.

drivers/iio/adc/ltc2497-core.c
drivers/iio/chemical/atlas-ezo-sensor.c
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
drivers/iio/common/st_sensors/st_sensors_i2c.c
drivers/iio/common/st_sensors/st_sensors_spi.c
drivers/iio/pressure/ms5611_core.c
drivers/iio/proximity/vcnl3020.c

All look good to me.
So, purely for record purporses, for all the files above:

Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>

> > ---
> >  drivers/iio/accel/kxcjk-1013.c                    | 1 -
> >  drivers/iio/accel/mma8452.c                       | 1 -
> >  drivers/iio/accel/mma9553.c                       | 1 -
> >  drivers/iio/adc/ad7192.c                          | 1 -
> >  drivers/iio/adc/hx711.c                           | 1 -
> >  drivers/iio/adc/max1363.c                         | 2 --
> >  drivers/iio/adc/mcp3911.c                         | 1 -
> >  drivers/iio/adc/qcom-spmi-iadc.c                  | 1 -
> >  drivers/iio/amplifiers/ad8366.c                   | 1 -
> >  drivers/iio/chemical/vz89x.c                      | 1 -
> >  drivers/iio/dac/ad5770r.c                         | 1 -
> >  drivers/iio/health/afe4403.c                      | 1 -
> >  drivers/iio/health/afe4404.c                      | 1 -
> >  drivers/iio/humidity/dht11.c                      | 1 -
> >  drivers/iio/humidity/hts221_core.c                | 1 -
> >  drivers/iio/imu/inv_mpu6050/inv_mpu_core.c        | 1 -
> >  drivers/iio/light/cm3605.c                        | 1 -
> >  drivers/iio/light/ltr501.c                        | 1 -
> >  drivers/iio/magnetometer/ak8975.c                 | 1 -
> >  drivers/iio/orientation/hid-sensor-rotation.c     | 1 -
> >  drivers/iio/potentiostat/lmp91000.c               | 1 -
> >  drivers/iio/proximity/ping.c                      | 1 -
> >  drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 1 -
> >  drivers/iio/proximity/srf04.c                     | 1 -
> >  drivers/iio/proximity/srf08.c                     | 1 -
> >  drivers/iio/temperature/tsys01.c                  | 1 -
> >  drivers/staging/iio/addac/adt7316.c               | 1 -
> >  27 files changed, 28 deletions(-)
> > 
> > diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
> > index c9924a65c32a..6b93521c0e17 100644
> > --- a/drivers/iio/accel/kxcjk-1013.c
> > +++ b/drivers/iio/accel/kxcjk-1013.c
> > @@ -1311,7 +1311,6 @@ static int kxcjk1013_probe(struct i2c_client *client,
> >  
> >  	mutex_init(&data->mutex);
> >  
> > -	indio_dev->dev.parent = &client->dev;
> >  	indio_dev->channels = kxcjk1013_channels;
> >  	indio_dev->num_channels = ARRAY_SIZE(kxcjk1013_channels);
> >  	indio_dev->available_scan_masks = kxcjk1013_scan_masks;
> > diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
> > index 00e100fc845a..ef3df402fc3c 100644
> > --- a/drivers/iio/accel/mma8452.c
> > +++ b/drivers/iio/accel/mma8452.c
> > @@ -1592,7 +1592,6 @@ static int mma8452_probe(struct i2c_client *client,
> >  	i2c_set_clientdata(client, indio_dev);
> >  	indio_dev->info = &mma8452_info;
> >  	indio_dev->name = id->name;
> > -	indio_dev->dev.parent = &client->dev;
> >  	indio_dev->modes = INDIO_DIRECT_MODE;
> >  	indio_dev->channels = data->chip_info->channels;
> >  	indio_dev->num_channels = data->chip_info->num_channels;
> > diff --git a/drivers/iio/accel/mma9553.c b/drivers/iio/accel/mma9553.c
> > index 312070dcf035..c15908faa381 100644
> > --- a/drivers/iio/accel/mma9553.c
> > +++ b/drivers/iio/accel/mma9553.c
> > @@ -1103,7 +1103,6 @@ static int mma9553_probe(struct i2c_client *client,
> >  	if (ret < 0)
> >  		return ret;
> >  
> > -	indio_dev->dev.parent = &client->dev;
> >  	indio_dev->channels = mma9553_channels;
> >  	indio_dev->num_channels = ARRAY_SIZE(mma9553_channels);
> >  	indio_dev->name = name;
> > diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
> > index 08ba1a8f05eb..a0837d7e9176 100644
> > --- a/drivers/iio/adc/ad7192.c
> > +++ b/drivers/iio/adc/ad7192.c
> > @@ -970,7 +970,6 @@ static int ad7192_probe(struct spi_device *spi)
> >  
> >  	spi_set_drvdata(spi, indio_dev);
> >  	st->chip_info = of_device_get_match_data(&spi->dev);
> > -	indio_dev->dev.parent = &spi->dev;
> >  	indio_dev->name = st->chip_info->name;
> >  	indio_dev->modes = INDIO_DIRECT_MODE;
> >  
> > diff --git a/drivers/iio/adc/hx711.c b/drivers/iio/adc/hx711.c
> > index c8686558429b..6a173531d355 100644
> > --- a/drivers/iio/adc/hx711.c
> > +++ b/drivers/iio/adc/hx711.c
> > @@ -551,7 +551,6 @@ static int hx711_probe(struct platform_device *pdev)
> >  	platform_set_drvdata(pdev, indio_dev);
> >  
> >  	indio_dev->name = "hx711";
> > -	indio_dev->dev.parent = &pdev->dev;
> >  	indio_dev->info = &hx711_iio_info;
> >  	indio_dev->modes = INDIO_DIRECT_MODE;
> >  	indio_dev->channels = hx711_chan_spec;
> > diff --git a/drivers/iio/adc/max1363.c b/drivers/iio/adc/max1363.c
> > index 9d92017c79b2..cc1ba7bfc8e6 100644
> > --- a/drivers/iio/adc/max1363.c
> > +++ b/drivers/iio/adc/max1363.c
> > @@ -1652,8 +1652,6 @@ static int max1363_probe(struct i2c_client *client,
> >  	if (ret)
> >  		goto error_disable_reg;
> >  
> > -	/* Establish that the iio_dev is a child of the i2c device */
> > -	indio_dev->dev.parent = &client->dev;
> >  	indio_dev->dev.of_node = client->dev.of_node;
> >  	indio_dev->name = id->name;
> >  	indio_dev->channels = st->chip_info->channels;
> > diff --git a/drivers/iio/adc/mcp3911.c b/drivers/iio/adc/mcp3911.c
> > index dd52f08ec82e..818b92518c66 100644
> > --- a/drivers/iio/adc/mcp3911.c
> > +++ b/drivers/iio/adc/mcp3911.c
> > @@ -293,7 +293,6 @@ static int mcp3911_probe(struct spi_device *spi)
> >  	if (ret)
> >  		goto clk_disable;
> >  
> > -	indio_dev->dev.parent = &spi->dev;
> >  	indio_dev->dev.of_node = spi->dev.of_node;
> >  	indio_dev->name = spi_get_device_id(spi)->name;
> >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > diff --git a/drivers/iio/adc/qcom-spmi-iadc.c b/drivers/iio/adc/qcom-spmi-
> > iadc.c
> > index 46858eddf1c3..1c90ad33a881 100644
> > --- a/drivers/iio/adc/qcom-spmi-iadc.c
> > +++ b/drivers/iio/adc/qcom-spmi-iadc.c
> > @@ -553,7 +553,6 @@ static int iadc_probe(struct platform_device *pdev)
> >  		return ret;
> >  	}
> >  
> > -	indio_dev->dev.parent = dev;
> >  	indio_dev->dev.of_node = node;
> >  	indio_dev->name = pdev->name;
> >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > diff --git a/drivers/iio/amplifiers/ad8366.c
> > b/drivers/iio/amplifiers/ad8366.c
> > index 62167b87caea..2595e9cb0b2d 100644
> > --- a/drivers/iio/amplifiers/ad8366.c
> > +++ b/drivers/iio/amplifiers/ad8366.c
> > @@ -274,7 +274,6 @@ static int ad8366_probe(struct spi_device *spi)
> >  	}
> >  
> >  	st->info = &ad8366_infos[st->type];
> > -	indio_dev->dev.parent = &spi->dev;
> >  	indio_dev->name = spi_get_device_id(spi)->name;
> >  	indio_dev->info = &ad8366_info;
> >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > diff --git a/drivers/iio/chemical/vz89x.c b/drivers/iio/chemical/vz89x.c
> > index 415b39339d4e..5586eb8e12cd 100644
> > --- a/drivers/iio/chemical/vz89x.c
> > +++ b/drivers/iio/chemical/vz89x.c
> > @@ -382,7 +382,6 @@ static int vz89x_probe(struct i2c_client *client,
> >  	data->last_update = jiffies - HZ;
> >  	mutex_init(&data->lock);
> >  
> > -	indio_dev->dev.parent = &client->dev;
> >  	indio_dev->info = &vz89x_info;
> >  	indio_dev->name = dev_name(&client->dev);
> >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > diff --git a/drivers/iio/dac/ad5770r.c b/drivers/iio/dac/ad5770r.c
> > index 2d7623b9b2c0..84dcf149261f 100644
> > --- a/drivers/iio/dac/ad5770r.c
> > +++ b/drivers/iio/dac/ad5770r.c
> > @@ -651,7 +651,6 @@ static int ad5770r_probe(struct spi_device *spi)
> >  		}
> >  	}
> >  
> > -	indio_dev->dev.parent = &spi->dev;
> >  	indio_dev->name = spi_get_device_id(spi)->name;
> >  	indio_dev->info = &ad5770r_info;
> >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > diff --git a/drivers/iio/health/afe4403.c b/drivers/iio/health/afe4403.c
> > index e9f87e42ff4f..ed230f12b2f8 100644
> > --- a/drivers/iio/health/afe4403.c
> > +++ b/drivers/iio/health/afe4403.c
> > @@ -509,7 +509,6 @@ static int afe4403_probe(struct spi_device *spi)
> >  	}
> >  
> >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > -	indio_dev->dev.parent = afe->dev;
> >  	indio_dev->channels = afe4403_channels;
> >  	indio_dev->num_channels = ARRAY_SIZE(afe4403_channels);
> >  	indio_dev->name = AFE4403_DRIVER_NAME;
> > diff --git a/drivers/iio/health/afe4404.c b/drivers/iio/health/afe4404.c
> > index e728bbb21ca8..3a3efae4695a 100644
> > --- a/drivers/iio/health/afe4404.c
> > +++ b/drivers/iio/health/afe4404.c
> > @@ -517,7 +517,6 @@ static int afe4404_probe(struct i2c_client *client,
> >  	}
> >  
> >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > -	indio_dev->dev.parent = afe->dev;
> >  	indio_dev->channels = afe4404_channels;
> >  	indio_dev->num_channels = ARRAY_SIZE(afe4404_channels);
> >  	indio_dev->name = AFE4404_DRIVER_NAME;
> > diff --git a/drivers/iio/humidity/dht11.c b/drivers/iio/humidity/dht11.c
> > index d05c6fdb758b..9a7819817488 100644
> > --- a/drivers/iio/humidity/dht11.c
> > +++ b/drivers/iio/humidity/dht11.c
> > @@ -321,7 +321,6 @@ static int dht11_probe(struct platform_device *pdev)
> >  	init_completion(&dht11->completion);
> >  	mutex_init(&dht11->lock);
> >  	iio->name = pdev->name;
> > -	iio->dev.parent = &pdev->dev;
> >  	iio->info = &dht11_iio_info;
> >  	iio->modes = INDIO_DIRECT_MODE;
> >  	iio->channels = dht11_chan_spec;
> > diff --git a/drivers/iio/humidity/hts221_core.c
> > b/drivers/iio/humidity/hts221_core.c
> > index 7ce1bd1defa0..16657789dc45 100644
> > --- a/drivers/iio/humidity/hts221_core.c
> > +++ b/drivers/iio/humidity/hts221_core.c
> > @@ -572,7 +572,6 @@ int hts221_probe(struct device *dev, int irq, const char
> > *name,
> >  		return err;
> >  
> >  	iio_dev->modes = INDIO_DIRECT_MODE;
> > -	iio_dev->dev.parent = hw->dev;
> >  	iio_dev->available_scan_masks = hts221_scan_masks;
> >  	iio_dev->channels = hts221_channels;
> >  	iio_dev->num_channels = ARRAY_SIZE(hts221_channels);
> > diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> > b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> > index 4d604fe842e5..153f855db8d6 100644
> > --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> > +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> > @@ -1530,7 +1530,6 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq,
> > const char *name,
> >  	}
> >  
> >  	dev_set_drvdata(dev, indio_dev);
> > -	indio_dev->dev.parent = dev;
> >  	/* name will be NULL when enumerated via ACPI */
> >  	if (name)
> >  		indio_dev->name = name;
> > diff --git a/drivers/iio/light/cm3605.c b/drivers/iio/light/cm3605.c
> > index 964ede49f662..4c83953672be 100644
> > --- a/drivers/iio/light/cm3605.c
> > +++ b/drivers/iio/light/cm3605.c
> > @@ -239,7 +239,6 @@ static int cm3605_probe(struct platform_device *pdev)
> >  	led_trigger_register_simple("cm3605", &cm3605->led);
> >  	led_trigger_event(cm3605->led, LED_FULL);
> >  
> > -	indio_dev->dev.parent = dev;
> >  	indio_dev->info = &cm3605_info;
> >  	indio_dev->name = "cm3605";
> >  	indio_dev->channels = cm3605_channels;
> > diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
> > index 5a3fcb127cd2..4bac0646398d 100644
> > --- a/drivers/iio/light/ltr501.c
> > +++ b/drivers/iio/light/ltr501.c
> > @@ -1480,7 +1480,6 @@ static int ltr501_probe(struct i2c_client *client,
> >  	if ((partid >> 4) != data->chip_info->partid)
> >  		return -ENODEV;
> >  
> > -	indio_dev->dev.parent = &client->dev;
> >  	indio_dev->info = data->chip_info->info;
> >  	indio_dev->channels = data->chip_info->channels;
> >  	indio_dev->num_channels = data->chip_info->no_channels;
> > diff --git a/drivers/iio/magnetometer/ak8975.c
> > b/drivers/iio/magnetometer/ak8975.c
> > index a23422aad97d..03d71f796177 100644
> > --- a/drivers/iio/magnetometer/ak8975.c
> > +++ b/drivers/iio/magnetometer/ak8975.c
> > @@ -940,7 +940,6 @@ static int ak8975_probe(struct i2c_client *client,
> >  	}
> >  
> >  	mutex_init(&data->lock);
> > -	indio_dev->dev.parent = &client->dev;
> >  	indio_dev->channels = ak8975_channels;
> >  	indio_dev->num_channels = ARRAY_SIZE(ak8975_channels);
> >  	indio_dev->info = &ak8975_info;
> > diff --git a/drivers/iio/orientation/hid-sensor-rotation.c
> > b/drivers/iio/orientation/hid-sensor-rotation.c
> > index b99f41240e3e..23bc61a7f018 100644
> > --- a/drivers/iio/orientation/hid-sensor-rotation.c
> > +++ b/drivers/iio/orientation/hid-sensor-rotation.c
> > @@ -281,7 +281,6 @@ static int hid_dev_rot_probe(struct platform_device
> > *pdev)
> >  	}
> >  
> >  	indio_dev->num_channels = ARRAY_SIZE(dev_rot_channels);
> > -	indio_dev->dev.parent = &pdev->dev;
> >  	indio_dev->info = &dev_rot_info;
> >  	indio_dev->name = name;
> >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > diff --git a/drivers/iio/potentiostat/lmp91000.c
> > b/drivers/iio/potentiostat/lmp91000.c
> > index 2cb11da18e0f..2d601889c8c0 100644
> > --- a/drivers/iio/potentiostat/lmp91000.c
> > +++ b/drivers/iio/potentiostat/lmp91000.c
> > @@ -321,7 +321,6 @@ static int lmp91000_probe(struct i2c_client *client,
> >  	indio_dev->channels = lmp91000_channels;
> >  	indio_dev->num_channels = ARRAY_SIZE(lmp91000_channels);
> >  	indio_dev->name = LMP91000_DRV_NAME;
> > -	indio_dev->dev.parent = &client->dev;
> >  	indio_dev->modes = INDIO_DIRECT_MODE;
> >  	i2c_set_clientdata(client, indio_dev);
> >  
> > diff --git a/drivers/iio/proximity/ping.c b/drivers/iio/proximity/ping.c
> > index 2e99eeb27f2e..1283ac1c2e03 100644
> > --- a/drivers/iio/proximity/ping.c
> > +++ b/drivers/iio/proximity/ping.c
> > @@ -309,7 +309,6 @@ static int ping_probe(struct platform_device *pdev)
> >  	platform_set_drvdata(pdev, indio_dev);
> >  
> >  	indio_dev->name = "ping";
> > -	indio_dev->dev.parent = &pdev->dev;
> >  	indio_dev->info = &ping_iio_info;
> >  	indio_dev->modes = INDIO_DIRECT_MODE;
> >  	indio_dev->channels = ping_chan_spec;
> > diff --git a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> > b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> > index 5b369645ef49..a8e716dbd24e 100644
> > --- a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> > +++ b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> > @@ -270,7 +270,6 @@ static int lidar_probe(struct i2c_client *client,
> >  	indio_dev->name = LIDAR_DRV_NAME;
> >  	indio_dev->channels = lidar_channels;
> >  	indio_dev->num_channels = ARRAY_SIZE(lidar_channels);
> > -	indio_dev->dev.parent = &client->dev;
> >  	indio_dev->modes = INDIO_DIRECT_MODE;
> >  
> >  	i2c_set_clientdata(client, indio_dev);
> > diff --git a/drivers/iio/proximity/srf04.c b/drivers/iio/proximity/srf04.c
> > index 568b76e06385..2a3acff431d7 100644
> > --- a/drivers/iio/proximity/srf04.c
> > +++ b/drivers/iio/proximity/srf04.c
> > @@ -317,7 +317,6 @@ static int srf04_probe(struct platform_device *pdev)
> >  	platform_set_drvdata(pdev, indio_dev);
> >  
> >  	indio_dev->name = "srf04";
> > -	indio_dev->dev.parent = &pdev->dev;
> >  	indio_dev->info = &srf04_iio_info;
> >  	indio_dev->modes = INDIO_DIRECT_MODE;
> >  	indio_dev->channels = srf04_chan_spec;
> > diff --git a/drivers/iio/proximity/srf08.c b/drivers/iio/proximity/srf08.c
> > index b23ce446b7be..6677221d5818 100644
> > --- a/drivers/iio/proximity/srf08.c
> > +++ b/drivers/iio/proximity/srf08.c
> > @@ -483,7 +483,6 @@ static int srf08_probe(struct i2c_client *client,
> >  	}
> >  
> >  	indio_dev->name = id->name;
> > -	indio_dev->dev.parent = &client->dev;
> >  	indio_dev->modes = INDIO_DIRECT_MODE;
> >  	indio_dev->channels = srf08_channels;
> >  	indio_dev->num_channels = ARRAY_SIZE(srf08_channels);
> > diff --git a/drivers/iio/temperature/tsys01.c
> > b/drivers/iio/temperature/tsys01.c
> > index d41f050c2fea..2c631a1ca33b 100644
> > --- a/drivers/iio/temperature/tsys01.c
> > +++ b/drivers/iio/temperature/tsys01.c
> > @@ -160,7 +160,6 @@ static int tsys01_probe(struct iio_dev *indio_dev,
> > struct device *dev)
> >  
> >  	indio_dev->info = &tsys01_info;
> >  	indio_dev->name = dev->driver->name;
> > -	indio_dev->dev.parent = dev;
> >  	indio_dev->modes = INDIO_DIRECT_MODE;
> >  	indio_dev->channels = tsys01_channels;
> >  	indio_dev->num_channels = ARRAY_SIZE(tsys01_channels);
> > diff --git a/drivers/staging/iio/addac/adt7316.c
> > b/drivers/staging/iio/addac/adt7316.c
> > index 9cb3d0e42c38..ccbafcaaf27e 100644
> > --- a/drivers/staging/iio/addac/adt7316.c
> > +++ b/drivers/staging/iio/addac/adt7316.c
> > @@ -2171,7 +2171,6 @@ int adt7316_probe(struct device *dev, struct
> > adt7316_bus *bus,
> >  	if ((chip->id & ID_FAMILY_MASK) == ID_ADT75XX)
> >  		chip->int_mask |= ADT7516_AIN_INT_MASK;
> >  
> > -	indio_dev->dev.parent = dev;
> >  	if ((chip->id & ID_FAMILY_MASK) == ID_ADT75XX)
> >  		indio_dev->info = &adt7516_info;
> >  	else

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 6/6] iio: remove left-over parent assignments
  2020-06-11  6:52     ` Ardelean, Alexandru
@ 2020-06-14 12:14       ` Jonathan Cameron
  0 siblings, 0 replies; 18+ messages in thread
From: Jonathan Cameron @ 2020-06-14 12:14 UTC (permalink / raw)
  To: Ardelean, Alexandru; +Cc: andy.shevchenko, linux-kernel, linux-iio, johan

On Thu, 11 Jun 2020 06:52:00 +0000
"Ardelean, Alexandru" <alexandru.Ardelean@analog.com> wrote:

> On Sat, 2020-06-06 at 17:05 +0100, Jonathan Cameron wrote:
> > [External]
> > 
> > On Wed, 3 Jun 2020 14:40:23 +0300
> > Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:
> >   
> > > These were found by doing some shell magic:
> > > ------------
> > > for file in $(git grep -w devm_iio_device_alloc | cut -d: -f1 | sort | uniq)
> > > ; do
> > > 	if grep 'parent =' $file | grep -v trig | grep -vq devm_; then
> > > 		echo "$file -> $(grep "parent =" $file)"
> > > 	fi
> > > done
> > > -----------
> > > 
> > > The output is bearable [after the semantic patch is applied].
> > > There is a mix of trigger assignments with some iio device parent
> > > assignments that are removed via this patch.
> > > 
> > > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>  
> > 
> > I added a bunch more via a grep of simple parent\ = 
> > and eyeballing it.  Much easier to do after your patches as far
> > fewer entries.
> > 
> > vcnl3020 (new)
> > ms5611 (hidden via an extra call)
> > st_sensors_spi (hidden via an extra call)
> > st_sensors_i2c (hidden via an extra call)
> > cros_ec_sensors_core (hidden via an extra call)  
> 
> I rebased your branch with my work-branch.
> That displayes neatly all the stuff you've added.
> 
> drivers/iio/adc/ltc2497-core.c
> drivers/iio/chemical/atlas-ezo-sensor.c
> drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
> drivers/iio/common/st_sensors/st_sensors_i2c.c
> drivers/iio/common/st_sensors/st_sensors_spi.c
> drivers/iio/pressure/ms5611_core.c
> drivers/iio/proximity/vcnl3020.c
> 
> All look good to me.
> So, purely for record purporses, for all the files above:
> 
> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>

Thanks.  I should probably have done this as a separate patch
for easier reviewing but he thought of left overs to the left
overs patch annoyed me ;)

Anyhow, end result is the same and the history look sane
so I'll leave it as it stands.

Thanks,

Jonathan

> 
> > > ---
> > >  drivers/iio/accel/kxcjk-1013.c                    | 1 -
> > >  drivers/iio/accel/mma8452.c                       | 1 -
> > >  drivers/iio/accel/mma9553.c                       | 1 -
> > >  drivers/iio/adc/ad7192.c                          | 1 -
> > >  drivers/iio/adc/hx711.c                           | 1 -
> > >  drivers/iio/adc/max1363.c                         | 2 --
> > >  drivers/iio/adc/mcp3911.c                         | 1 -
> > >  drivers/iio/adc/qcom-spmi-iadc.c                  | 1 -
> > >  drivers/iio/amplifiers/ad8366.c                   | 1 -
> > >  drivers/iio/chemical/vz89x.c                      | 1 -
> > >  drivers/iio/dac/ad5770r.c                         | 1 -
> > >  drivers/iio/health/afe4403.c                      | 1 -
> > >  drivers/iio/health/afe4404.c                      | 1 -
> > >  drivers/iio/humidity/dht11.c                      | 1 -
> > >  drivers/iio/humidity/hts221_core.c                | 1 -
> > >  drivers/iio/imu/inv_mpu6050/inv_mpu_core.c        | 1 -
> > >  drivers/iio/light/cm3605.c                        | 1 -
> > >  drivers/iio/light/ltr501.c                        | 1 -
> > >  drivers/iio/magnetometer/ak8975.c                 | 1 -
> > >  drivers/iio/orientation/hid-sensor-rotation.c     | 1 -
> > >  drivers/iio/potentiostat/lmp91000.c               | 1 -
> > >  drivers/iio/proximity/ping.c                      | 1 -
> > >  drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 1 -
> > >  drivers/iio/proximity/srf04.c                     | 1 -
> > >  drivers/iio/proximity/srf08.c                     | 1 -
> > >  drivers/iio/temperature/tsys01.c                  | 1 -
> > >  drivers/staging/iio/addac/adt7316.c               | 1 -
> > >  27 files changed, 28 deletions(-)
> > > 
> > > diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
> > > index c9924a65c32a..6b93521c0e17 100644
> > > --- a/drivers/iio/accel/kxcjk-1013.c
> > > +++ b/drivers/iio/accel/kxcjk-1013.c
> > > @@ -1311,7 +1311,6 @@ static int kxcjk1013_probe(struct i2c_client *client,
> > >  
> > >  	mutex_init(&data->mutex);
> > >  
> > > -	indio_dev->dev.parent = &client->dev;
> > >  	indio_dev->channels = kxcjk1013_channels;
> > >  	indio_dev->num_channels = ARRAY_SIZE(kxcjk1013_channels);
> > >  	indio_dev->available_scan_masks = kxcjk1013_scan_masks;
> > > diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
> > > index 00e100fc845a..ef3df402fc3c 100644
> > > --- a/drivers/iio/accel/mma8452.c
> > > +++ b/drivers/iio/accel/mma8452.c
> > > @@ -1592,7 +1592,6 @@ static int mma8452_probe(struct i2c_client *client,
> > >  	i2c_set_clientdata(client, indio_dev);
> > >  	indio_dev->info = &mma8452_info;
> > >  	indio_dev->name = id->name;
> > > -	indio_dev->dev.parent = &client->dev;
> > >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > >  	indio_dev->channels = data->chip_info->channels;
> > >  	indio_dev->num_channels = data->chip_info->num_channels;
> > > diff --git a/drivers/iio/accel/mma9553.c b/drivers/iio/accel/mma9553.c
> > > index 312070dcf035..c15908faa381 100644
> > > --- a/drivers/iio/accel/mma9553.c
> > > +++ b/drivers/iio/accel/mma9553.c
> > > @@ -1103,7 +1103,6 @@ static int mma9553_probe(struct i2c_client *client,
> > >  	if (ret < 0)
> > >  		return ret;
> > >  
> > > -	indio_dev->dev.parent = &client->dev;
> > >  	indio_dev->channels = mma9553_channels;
> > >  	indio_dev->num_channels = ARRAY_SIZE(mma9553_channels);
> > >  	indio_dev->name = name;
> > > diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
> > > index 08ba1a8f05eb..a0837d7e9176 100644
> > > --- a/drivers/iio/adc/ad7192.c
> > > +++ b/drivers/iio/adc/ad7192.c
> > > @@ -970,7 +970,6 @@ static int ad7192_probe(struct spi_device *spi)
> > >  
> > >  	spi_set_drvdata(spi, indio_dev);
> > >  	st->chip_info = of_device_get_match_data(&spi->dev);
> > > -	indio_dev->dev.parent = &spi->dev;
> > >  	indio_dev->name = st->chip_info->name;
> > >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > >  
> > > diff --git a/drivers/iio/adc/hx711.c b/drivers/iio/adc/hx711.c
> > > index c8686558429b..6a173531d355 100644
> > > --- a/drivers/iio/adc/hx711.c
> > > +++ b/drivers/iio/adc/hx711.c
> > > @@ -551,7 +551,6 @@ static int hx711_probe(struct platform_device *pdev)
> > >  	platform_set_drvdata(pdev, indio_dev);
> > >  
> > >  	indio_dev->name = "hx711";
> > > -	indio_dev->dev.parent = &pdev->dev;
> > >  	indio_dev->info = &hx711_iio_info;
> > >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > >  	indio_dev->channels = hx711_chan_spec;
> > > diff --git a/drivers/iio/adc/max1363.c b/drivers/iio/adc/max1363.c
> > > index 9d92017c79b2..cc1ba7bfc8e6 100644
> > > --- a/drivers/iio/adc/max1363.c
> > > +++ b/drivers/iio/adc/max1363.c
> > > @@ -1652,8 +1652,6 @@ static int max1363_probe(struct i2c_client *client,
> > >  	if (ret)
> > >  		goto error_disable_reg;
> > >  
> > > -	/* Establish that the iio_dev is a child of the i2c device */
> > > -	indio_dev->dev.parent = &client->dev;
> > >  	indio_dev->dev.of_node = client->dev.of_node;
> > >  	indio_dev->name = id->name;
> > >  	indio_dev->channels = st->chip_info->channels;
> > > diff --git a/drivers/iio/adc/mcp3911.c b/drivers/iio/adc/mcp3911.c
> > > index dd52f08ec82e..818b92518c66 100644
> > > --- a/drivers/iio/adc/mcp3911.c
> > > +++ b/drivers/iio/adc/mcp3911.c
> > > @@ -293,7 +293,6 @@ static int mcp3911_probe(struct spi_device *spi)
> > >  	if (ret)
> > >  		goto clk_disable;
> > >  
> > > -	indio_dev->dev.parent = &spi->dev;
> > >  	indio_dev->dev.of_node = spi->dev.of_node;
> > >  	indio_dev->name = spi_get_device_id(spi)->name;
> > >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > > diff --git a/drivers/iio/adc/qcom-spmi-iadc.c b/drivers/iio/adc/qcom-spmi-
> > > iadc.c
> > > index 46858eddf1c3..1c90ad33a881 100644
> > > --- a/drivers/iio/adc/qcom-spmi-iadc.c
> > > +++ b/drivers/iio/adc/qcom-spmi-iadc.c
> > > @@ -553,7 +553,6 @@ static int iadc_probe(struct platform_device *pdev)
> > >  		return ret;
> > >  	}
> > >  
> > > -	indio_dev->dev.parent = dev;
> > >  	indio_dev->dev.of_node = node;
> > >  	indio_dev->name = pdev->name;
> > >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > > diff --git a/drivers/iio/amplifiers/ad8366.c
> > > b/drivers/iio/amplifiers/ad8366.c
> > > index 62167b87caea..2595e9cb0b2d 100644
> > > --- a/drivers/iio/amplifiers/ad8366.c
> > > +++ b/drivers/iio/amplifiers/ad8366.c
> > > @@ -274,7 +274,6 @@ static int ad8366_probe(struct spi_device *spi)
> > >  	}
> > >  
> > >  	st->info = &ad8366_infos[st->type];
> > > -	indio_dev->dev.parent = &spi->dev;
> > >  	indio_dev->name = spi_get_device_id(spi)->name;
> > >  	indio_dev->info = &ad8366_info;
> > >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > > diff --git a/drivers/iio/chemical/vz89x.c b/drivers/iio/chemical/vz89x.c
> > > index 415b39339d4e..5586eb8e12cd 100644
> > > --- a/drivers/iio/chemical/vz89x.c
> > > +++ b/drivers/iio/chemical/vz89x.c
> > > @@ -382,7 +382,6 @@ static int vz89x_probe(struct i2c_client *client,
> > >  	data->last_update = jiffies - HZ;
> > >  	mutex_init(&data->lock);
> > >  
> > > -	indio_dev->dev.parent = &client->dev;
> > >  	indio_dev->info = &vz89x_info;
> > >  	indio_dev->name = dev_name(&client->dev);
> > >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > > diff --git a/drivers/iio/dac/ad5770r.c b/drivers/iio/dac/ad5770r.c
> > > index 2d7623b9b2c0..84dcf149261f 100644
> > > --- a/drivers/iio/dac/ad5770r.c
> > > +++ b/drivers/iio/dac/ad5770r.c
> > > @@ -651,7 +651,6 @@ static int ad5770r_probe(struct spi_device *spi)
> > >  		}
> > >  	}
> > >  
> > > -	indio_dev->dev.parent = &spi->dev;
> > >  	indio_dev->name = spi_get_device_id(spi)->name;
> > >  	indio_dev->info = &ad5770r_info;
> > >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > > diff --git a/drivers/iio/health/afe4403.c b/drivers/iio/health/afe4403.c
> > > index e9f87e42ff4f..ed230f12b2f8 100644
> > > --- a/drivers/iio/health/afe4403.c
> > > +++ b/drivers/iio/health/afe4403.c
> > > @@ -509,7 +509,6 @@ static int afe4403_probe(struct spi_device *spi)
> > >  	}
> > >  
> > >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > > -	indio_dev->dev.parent = afe->dev;
> > >  	indio_dev->channels = afe4403_channels;
> > >  	indio_dev->num_channels = ARRAY_SIZE(afe4403_channels);
> > >  	indio_dev->name = AFE4403_DRIVER_NAME;
> > > diff --git a/drivers/iio/health/afe4404.c b/drivers/iio/health/afe4404.c
> > > index e728bbb21ca8..3a3efae4695a 100644
> > > --- a/drivers/iio/health/afe4404.c
> > > +++ b/drivers/iio/health/afe4404.c
> > > @@ -517,7 +517,6 @@ static int afe4404_probe(struct i2c_client *client,
> > >  	}
> > >  
> > >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > > -	indio_dev->dev.parent = afe->dev;
> > >  	indio_dev->channels = afe4404_channels;
> > >  	indio_dev->num_channels = ARRAY_SIZE(afe4404_channels);
> > >  	indio_dev->name = AFE4404_DRIVER_NAME;
> > > diff --git a/drivers/iio/humidity/dht11.c b/drivers/iio/humidity/dht11.c
> > > index d05c6fdb758b..9a7819817488 100644
> > > --- a/drivers/iio/humidity/dht11.c
> > > +++ b/drivers/iio/humidity/dht11.c
> > > @@ -321,7 +321,6 @@ static int dht11_probe(struct platform_device *pdev)
> > >  	init_completion(&dht11->completion);
> > >  	mutex_init(&dht11->lock);
> > >  	iio->name = pdev->name;
> > > -	iio->dev.parent = &pdev->dev;
> > >  	iio->info = &dht11_iio_info;
> > >  	iio->modes = INDIO_DIRECT_MODE;
> > >  	iio->channels = dht11_chan_spec;
> > > diff --git a/drivers/iio/humidity/hts221_core.c
> > > b/drivers/iio/humidity/hts221_core.c
> > > index 7ce1bd1defa0..16657789dc45 100644
> > > --- a/drivers/iio/humidity/hts221_core.c
> > > +++ b/drivers/iio/humidity/hts221_core.c
> > > @@ -572,7 +572,6 @@ int hts221_probe(struct device *dev, int irq, const char
> > > *name,
> > >  		return err;
> > >  
> > >  	iio_dev->modes = INDIO_DIRECT_MODE;
> > > -	iio_dev->dev.parent = hw->dev;
> > >  	iio_dev->available_scan_masks = hts221_scan_masks;
> > >  	iio_dev->channels = hts221_channels;
> > >  	iio_dev->num_channels = ARRAY_SIZE(hts221_channels);
> > > diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> > > b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> > > index 4d604fe842e5..153f855db8d6 100644
> > > --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> > > +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> > > @@ -1530,7 +1530,6 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq,
> > > const char *name,
> > >  	}
> > >  
> > >  	dev_set_drvdata(dev, indio_dev);
> > > -	indio_dev->dev.parent = dev;
> > >  	/* name will be NULL when enumerated via ACPI */
> > >  	if (name)
> > >  		indio_dev->name = name;
> > > diff --git a/drivers/iio/light/cm3605.c b/drivers/iio/light/cm3605.c
> > > index 964ede49f662..4c83953672be 100644
> > > --- a/drivers/iio/light/cm3605.c
> > > +++ b/drivers/iio/light/cm3605.c
> > > @@ -239,7 +239,6 @@ static int cm3605_probe(struct platform_device *pdev)
> > >  	led_trigger_register_simple("cm3605", &cm3605->led);
> > >  	led_trigger_event(cm3605->led, LED_FULL);
> > >  
> > > -	indio_dev->dev.parent = dev;
> > >  	indio_dev->info = &cm3605_info;
> > >  	indio_dev->name = "cm3605";
> > >  	indio_dev->channels = cm3605_channels;
> > > diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
> > > index 5a3fcb127cd2..4bac0646398d 100644
> > > --- a/drivers/iio/light/ltr501.c
> > > +++ b/drivers/iio/light/ltr501.c
> > > @@ -1480,7 +1480,6 @@ static int ltr501_probe(struct i2c_client *client,
> > >  	if ((partid >> 4) != data->chip_info->partid)
> > >  		return -ENODEV;
> > >  
> > > -	indio_dev->dev.parent = &client->dev;
> > >  	indio_dev->info = data->chip_info->info;
> > >  	indio_dev->channels = data->chip_info->channels;
> > >  	indio_dev->num_channels = data->chip_info->no_channels;
> > > diff --git a/drivers/iio/magnetometer/ak8975.c
> > > b/drivers/iio/magnetometer/ak8975.c
> > > index a23422aad97d..03d71f796177 100644
> > > --- a/drivers/iio/magnetometer/ak8975.c
> > > +++ b/drivers/iio/magnetometer/ak8975.c
> > > @@ -940,7 +940,6 @@ static int ak8975_probe(struct i2c_client *client,
> > >  	}
> > >  
> > >  	mutex_init(&data->lock);
> > > -	indio_dev->dev.parent = &client->dev;
> > >  	indio_dev->channels = ak8975_channels;
> > >  	indio_dev->num_channels = ARRAY_SIZE(ak8975_channels);
> > >  	indio_dev->info = &ak8975_info;
> > > diff --git a/drivers/iio/orientation/hid-sensor-rotation.c
> > > b/drivers/iio/orientation/hid-sensor-rotation.c
> > > index b99f41240e3e..23bc61a7f018 100644
> > > --- a/drivers/iio/orientation/hid-sensor-rotation.c
> > > +++ b/drivers/iio/orientation/hid-sensor-rotation.c
> > > @@ -281,7 +281,6 @@ static int hid_dev_rot_probe(struct platform_device
> > > *pdev)
> > >  	}
> > >  
> > >  	indio_dev->num_channels = ARRAY_SIZE(dev_rot_channels);
> > > -	indio_dev->dev.parent = &pdev->dev;
> > >  	indio_dev->info = &dev_rot_info;
> > >  	indio_dev->name = name;
> > >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > > diff --git a/drivers/iio/potentiostat/lmp91000.c
> > > b/drivers/iio/potentiostat/lmp91000.c
> > > index 2cb11da18e0f..2d601889c8c0 100644
> > > --- a/drivers/iio/potentiostat/lmp91000.c
> > > +++ b/drivers/iio/potentiostat/lmp91000.c
> > > @@ -321,7 +321,6 @@ static int lmp91000_probe(struct i2c_client *client,
> > >  	indio_dev->channels = lmp91000_channels;
> > >  	indio_dev->num_channels = ARRAY_SIZE(lmp91000_channels);
> > >  	indio_dev->name = LMP91000_DRV_NAME;
> > > -	indio_dev->dev.parent = &client->dev;
> > >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > >  	i2c_set_clientdata(client, indio_dev);
> > >  
> > > diff --git a/drivers/iio/proximity/ping.c b/drivers/iio/proximity/ping.c
> > > index 2e99eeb27f2e..1283ac1c2e03 100644
> > > --- a/drivers/iio/proximity/ping.c
> > > +++ b/drivers/iio/proximity/ping.c
> > > @@ -309,7 +309,6 @@ static int ping_probe(struct platform_device *pdev)
> > >  	platform_set_drvdata(pdev, indio_dev);
> > >  
> > >  	indio_dev->name = "ping";
> > > -	indio_dev->dev.parent = &pdev->dev;
> > >  	indio_dev->info = &ping_iio_info;
> > >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > >  	indio_dev->channels = ping_chan_spec;
> > > diff --git a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> > > b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> > > index 5b369645ef49..a8e716dbd24e 100644
> > > --- a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> > > +++ b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> > > @@ -270,7 +270,6 @@ static int lidar_probe(struct i2c_client *client,
> > >  	indio_dev->name = LIDAR_DRV_NAME;
> > >  	indio_dev->channels = lidar_channels;
> > >  	indio_dev->num_channels = ARRAY_SIZE(lidar_channels);
> > > -	indio_dev->dev.parent = &client->dev;
> > >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > >  
> > >  	i2c_set_clientdata(client, indio_dev);
> > > diff --git a/drivers/iio/proximity/srf04.c b/drivers/iio/proximity/srf04.c
> > > index 568b76e06385..2a3acff431d7 100644
> > > --- a/drivers/iio/proximity/srf04.c
> > > +++ b/drivers/iio/proximity/srf04.c
> > > @@ -317,7 +317,6 @@ static int srf04_probe(struct platform_device *pdev)
> > >  	platform_set_drvdata(pdev, indio_dev);
> > >  
> > >  	indio_dev->name = "srf04";
> > > -	indio_dev->dev.parent = &pdev->dev;
> > >  	indio_dev->info = &srf04_iio_info;
> > >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > >  	indio_dev->channels = srf04_chan_spec;
> > > diff --git a/drivers/iio/proximity/srf08.c b/drivers/iio/proximity/srf08.c
> > > index b23ce446b7be..6677221d5818 100644
> > > --- a/drivers/iio/proximity/srf08.c
> > > +++ b/drivers/iio/proximity/srf08.c
> > > @@ -483,7 +483,6 @@ static int srf08_probe(struct i2c_client *client,
> > >  	}
> > >  
> > >  	indio_dev->name = id->name;
> > > -	indio_dev->dev.parent = &client->dev;
> > >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > >  	indio_dev->channels = srf08_channels;
> > >  	indio_dev->num_channels = ARRAY_SIZE(srf08_channels);
> > > diff --git a/drivers/iio/temperature/tsys01.c
> > > b/drivers/iio/temperature/tsys01.c
> > > index d41f050c2fea..2c631a1ca33b 100644
> > > --- a/drivers/iio/temperature/tsys01.c
> > > +++ b/drivers/iio/temperature/tsys01.c
> > > @@ -160,7 +160,6 @@ static int tsys01_probe(struct iio_dev *indio_dev,
> > > struct device *dev)
> > >  
> > >  	indio_dev->info = &tsys01_info;
> > >  	indio_dev->name = dev->driver->name;
> > > -	indio_dev->dev.parent = dev;
> > >  	indio_dev->modes = INDIO_DIRECT_MODE;
> > >  	indio_dev->channels = tsys01_channels;
> > >  	indio_dev->num_channels = ARRAY_SIZE(tsys01_channels);
> > > diff --git a/drivers/staging/iio/addac/adt7316.c
> > > b/drivers/staging/iio/addac/adt7316.c
> > > index 9cb3d0e42c38..ccbafcaaf27e 100644
> > > --- a/drivers/staging/iio/addac/adt7316.c
> > > +++ b/drivers/staging/iio/addac/adt7316.c
> > > @@ -2171,7 +2171,6 @@ int adt7316_probe(struct device *dev, struct
> > > adt7316_bus *bus,
> > >  	if ((chip->id & ID_FAMILY_MASK) == ID_ADT75XX)
> > >  		chip->int_mask |= ADT7516_AIN_INT_MASK;
> > >  
> > > -	indio_dev->dev.parent = dev;
> > >  	if ((chip->id & ID_FAMILY_MASK) == ID_ADT75XX)
> > >  		indio_dev->info = &adt7516_info;
> > >  	else  


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2020-06-14 12:14 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03 11:40 [PATCH v2 0/6] iio: core: pass parent device as parameter during allocation Alexandru Ardelean
2020-06-03 11:40 ` [PATCH v2 1/6] " Alexandru Ardelean
2020-06-06 15:24   ` Jonathan Cameron
2020-06-03 11:40 ` [PATCH v2 2/6] iio: core: add iio_device_set_parent() helper Alexandru Ardelean
2020-06-06 15:25   ` Jonathan Cameron
2020-06-03 11:40 ` [PATCH v2 4/6] iio: remove left-over comments about parent assignment Alexandru Ardelean
2020-06-06 15:46   ` Jonathan Cameron
2020-06-03 11:40 ` [PATCH v2 5/6] iio: light: lm3533-als: use iio_device_set_parent() to assign parent Alexandru Ardelean
2020-06-06 15:46   ` Jonathan Cameron
2020-06-03 11:40 ` [PATCH v2 6/6] iio: remove left-over parent assignments Alexandru Ardelean
2020-06-06 16:05   ` Jonathan Cameron
2020-06-11  6:52     ` Ardelean, Alexandru
2020-06-14 12:14       ` Jonathan Cameron
2020-06-03 11:41 ` [PATCH v2 0/6] iio: core: pass parent device as parameter during allocation Ardelean, Alexandru
2020-06-04 17:34   ` Jonathan Cameron
2020-06-06 16:02     ` Jonathan Cameron
2020-06-08  6:37       ` Alexandru Ardelean
2020-06-08 11:10         ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).